OSDN Git Service

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