2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/10/2003 *
4 * =================== Last change: 11/26/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-register.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Registration form *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Anmeldeformular *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
45 // Add description as navigation point
46 addMenuDescription('guest', __FILE__);
48 if (!isExtensionActive('register')) {
49 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('register'));
51 } elseif (!isExtensionActive('country')) {
52 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('country'));
56 // Is the form sent and all went fine?
57 //* DEBUG: */ debugOutput('isFormSent=' . intval(isFormSent()) . ',isRegistrationDataComplete=' . intval(isRegistrationDataComplete()) . ',isAdmin=' . intval(isAdmin()));
58 if ((isFormSent()) && (isRegistrationDataComplete())) {
59 // Do the registration here
62 // Output success registration
63 loadTemplate('admin_settings_saved', false, '{--REGISTRATION_DONE--}');
65 // Do this only if form is sent
67 if (postRequestParameter('agree') == '!') {
68 registerOutputFailedMessage('HAVE_TO_AGREE');
71 if (postRequestParameter('email') == '!') {
72 registerOutputFailedMessage('ENTER_EMAIL');
73 setPostRequestParameter('email', '');
74 } elseif (postRequestParameter('email') == '?') {
75 registerOutputFailedMessage('EMAIL_ALREADY_DB');
76 setPostRequestParameter('email', '');
79 if (postRequestParameter('surname') == '!') {
80 registerOutputFailedMessage('ENTER_SURNAME');
81 setPostRequestParameter('surname', '');
84 if (postRequestParameter('family') == '!') {
85 registerOutputFailedMessage('ENTER_FAMILY');
86 setPostRequestParameter('family', '');
89 if ((postRequestParameter('pass1') == '!') && (postRequestParameter('pass2') == '!')) {
90 registerOutputFailedMessage('ENTER_BOTH_PASSWORDS');
91 } elseif (postRequestParameter('pass1') == '!') {
92 registerOutputFailedMessage('ENTER_PASS1');
93 } elseif (postRequestParameter('pass2') == '!') {
94 registerOutputFailedMessage('ENTER_PASS2');
97 if ((isset($GLOBALS['registration_short_password'])) && ($GLOBALS['registration_short_password'] === true)) {
98 registerOutputFailedMessage('SHORT_PASS', ': ' . getConfig('pass_len'));
101 if ((isset($GLOBALS['registration_ip_timeout'])) && ($GLOBALS['registration_ip_timeout'] === true)) {
102 registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT');
105 if ((!empty($GLOBALS['register_selected_cats'])) && ($GLOBALS['register_selected_cats'] < getConfig('least_cats'))) {
106 registerOutputFailedMessage('', getMessage('CATS_LEAST'));
110 // Generate birthday selection
111 switch (getLanguage()) {
112 case 'de': // German date format
113 $content['birthday_selection'] = addSelectionBox('day', postRequestParameter('day')).addSelectionBox('month', postRequestParameter('month')).addSelectionBox('year', postRequestParameter('year'));
116 default: // Default is the US date format... :)
117 $content['birthday_selection'] = addSelectionBox('month', postRequestParameter('month')).addSelectionBox('day', postRequestParameter('day')).addSelectionBox('year', postRequestParameter('year'));
121 // Adds a table for the guests with all visible categories
122 $content['category_selection'] = registerGenerateCategoryTable('guest', true);
124 // Adds maximum receiveable mails list... :)
125 $content['max_receive_list'] = addMaxReceiveList('guest', '', true);
127 // Shall I display the refid or shall I make it editable?
128 if (getConfig('display_refid') == 'Y') {
129 // Load "hide" form template
130 $content['refid_content'] = loadTemplate('guest_register_refid_hide', true);
132 // Load template to enter it
133 $content['refid_content'] = loadTemplate('guest_register_refid', true);
136 // You may want to modify the register_header.tpl.xx file and not this script when you add your scripts etc. :-)
137 $content['header_content'] = loadTemplate('register_header', true);
140 $content['surname'] = SQL_ESCAPE(postRequestParameter('surname'));
141 $content['family'] = SQL_ESCAPE(postRequestParameter('family'));
142 $content['street_nr'] = SQL_ESCAPE(postRequestParameter('street_nr'));
143 $content['zip'] = '';
144 if (isPostRequestParameterSet('zip')) {
145 $content['zip'] = bigintval(postRequestParameter('zip'));
147 $content['city'] = SQL_ESCAPE(postRequestParameter('city'));
148 $content['email'] = SQL_ESCAPE(postRequestParameter('email'));
150 // The admin may see all
151 $whereStatement = "WHERE `is_active`='Y'";
152 if (isAdmin()) $whereStatement = '';
154 // Prepare country selection box
155 $OUT = '<select name="country_code" class="guest_select" size="1">';
156 $OUT .= generateOptionList('countries', 'id', 'descr', postRequestParameter('country_code'), 'code', $whereStatement);
158 $content['country'] = $OUT;
160 // Set must-fillout fields
161 $content = runFilterChain('register_must_fillout', $content);
163 // Display registration form
164 loadTemplate('guest_register', false, $content);