OSDN Git Service

CHANGE: フィードとゲストアカウント作成フォームのためのスクリプトを修正
[nucleus-jp/nucleus-next.git] / createaccount.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-20011 The Nucleus Group
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * (see nucleus/documentation/index.html#license for more info)
11  */
12
13 /**
14  * Registration form for new users
15  * @license http://nucleuscms.org/license.txt GNU General Public License
16  * @copyright Copyright (C) 2002-20011 The Nucleus Group
17  * @version $Id: createaccount.php 1624 2012-01-09 11:36:20Z sakamocchi $
18  */
19
20 require_once "./config.php";
21 include_libs('ACTION.php',false,false);
22
23 sendContentType('text/html', 'createaccount');
24 echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
25 echo "<html>\n";
26 echo "<head>\n";
27 echo "<title>Create Member Account</title>\n";
28 echo "<style type=\"text/css\">@import url(nucleus/styles/manual.css);</style>\n";
29 echo "</head>\n";
30 echo "<body>\n";
31 echo "<h1>Create Account</h1>\n";
32
33 // show form only if Visitors are allowed to create a Member Account
34 if ( $CONF['AllowMemberCreate'] == 1 )
35 {
36         $name = '';
37         $realname ='';
38         $email = '';
39         $url = '';
40         
41         /* already submit */
42         if ( array_key_exists('showform', $_POST) && $_POST['showform'] == 1 )
43         {
44                 if ( array_key_exists('name', $_POST) )
45                 {
46                         $name = $_POST['name'];
47                 }
48                 if ( array_key_exists('realname', $_POST) )
49                 {
50                         $realname = $_POST['realname'];
51                 }
52                 if ( array_key_exists('email', $_POST) )
53                 {
54                         $email = $_POST['email'];
55                 }
56                 if ( array_key_exists('url', $_POST) )
57                 {
58                         $url = $_POST['url'];
59                 }
60                 // after the from is sent it will be validated
61                 // POST data will be added as value to treat the user with care (;-))
62                 $a = new ACTION();
63                 
64                 $message = $a->createAccount();
65                 if ( $message != 1 )
66                 {
67                         echo '<p style="font-weight:bold; color:red;">' . $message . "</p>\n";
68                 }
69                 else
70                 {
71                         echo '<p>' . _MSG_ACTIVATION_SENT . "</p>\n"; 
72                         echo "<p>Return to <a href=\"{$CONF['IndexURL']}\" title=\"{$CONF['SiteName']}\">{$CONF['SiteName']}</a></p>\n";
73                         echo "</body>\n";
74                         echo "</html>\n";
75                         exit;
76                 }
77         }
78         
79         echo "<form method=\"post\" action=\"createaccount.php\">\n";
80         echo "<dl>\n";
81         echo "<dt><label for=\"name\">Login Name (required): </label></dt>\n";
82         echo "<dd><input id=\"name\"name=\"name\" value=\"{$name}\" size=\"32\" maxlength=\"32\" /><span style=\"\small\">(only a-z, 0-9)</span></dd>\n";
83         echo "<dt><label for=\"realname\">Real Name (required): </label></dt>\n";
84         echo "<dd><input id=\"realname\" name=\"realname\" value=\"{$realname}\" size=\"40\" /></dd>\n";
85         echo "<dt><label for=\"email\">Email (required): </label></dt>\n";
86         echo "<dd><input id=\"email\"name=\"email\" value=\"{$email}\" size=\"40\" /><span style=\"\small\">(must be valid, because an activation link will be sent over there)</span></dd>\n";
87         echo "<dt><label for=\"url\">URL: </label></dt>\n";
88         echo "<dd><input id=\"url\"name=\"url\" value=\"{$url}\" size=\"60\" /></dd>\n";
89         echo "<input type=\"hidden\" name=\"showform\" value=\"1\" />\n";
90         // add extra fields from Plugins, like NP_Profile
91         $manager->notify('RegistrationFormExtraFields', array('type' => 'createaccount.php', 'prelabel' => '', 'postlabel' => '<br />', 'prefield' => '', 'postfield' => '<br /><br />'));
92         
93         // add a Captcha challenge or something else
94         global $manager;
95         $manager->notify('FormExtra', array('type' => 'membermailform-notloggedin'));
96         echo "<button type=\"submit\" name=\"action\" value=\"createaccount\" />Create Account</button>\n";
97         echo "</dl>\n";
98         echo "</form>\n";
99 }
100 else
101 {
102         echo "<p>\n";
103         echo 'Visitors are not allowed to create a Member Account.<br /><br />';
104         echo 'Please contact the website administrator for more information.';
105         echo "</p>\n";
106 }
107         
108 echo "</body>\n";
109 echo "</html>\n";