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 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // Add description as navigation point
44 addYouAreHereLink('guest', __FILE__);
46 if (!isExtensionActive('register')) {
47 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=register%}');
49 } elseif (!isExtensionActive('country')) {
50 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=country%}');
54 // Is the form sent and all went fine?
55 //* DEBUG: */ debugOutput('isFormSent=' . intval(isFormSent()) . ',isRegistrationDataComplete=' . intval(isRegistrationDataComplete()) . ',isAdmin=' . intval(isAdmin()));
56 if ((isFormSent()) && (isRegistrationDataComplete())) {
57 // Do the registration here
60 // Output success registration
61 displayMessage('{--REGISTRATION_DONE--}');
63 // Do this only if form is sent
65 if (postRequestElement('agree') == '!') {
66 registerOutputFailedMessage('HAVE_TO_AGREE');
69 if (postRequestElement('email') == '!') {
70 registerOutputFailedMessage('ENTER_EMAIL');
71 setPostRequestElement('email', '');
72 } elseif (postRequestElement('email') == '?') {
73 registerOutputFailedMessage('GUEST_EMAIL_IS_ALREADY_REGISTERED');
74 setPostRequestElement('email', '');
77 if (postRequestElement('surname') == '!') {
78 registerOutputFailedMessage('ENTER_SURNAME');
79 setPostRequestElement('surname', '');
82 if (postRequestElement('family') == '!') {
83 registerOutputFailedMessage('ENTER_FAMILY');
84 setPostRequestElement('family', '');
87 if ((postRequestElement('password1') == '!') && (postRequestElement('password2') == '!')) {
88 registerOutputFailedMessage('ENTER_BOTH_PASSWORDS');
89 } elseif (postRequestElement('password1') == '!') {
90 registerOutputFailedMessage('ENTER_PASSWORD1');
91 } elseif (postRequestElement('password2') == '!') {
92 registerOutputFailedMessage('ENTER_PASSWORD2');
95 if ((isset($GLOBALS['registration_short_password'])) && ($GLOBALS['registration_short_password'] === TRUE)) {
96 registerOutputFailedMessage('GUEST_SHORT_PASS', ': ' . getPassLen());
99 if ((isset($GLOBALS['registration_ip_timeout'])) && ($GLOBALS['registration_ip_timeout'] === TRUE)) {
100 registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT');
103 if ((!empty($GLOBALS['registration_selected_cats'])) && ($GLOBALS['registration_selected_cats'] < getLeastCats())) {
104 registerOutputFailedMessage('', '{--CHOOSE_MORE_CATEGORIES--}');
108 // Generate birthday selection
109 switch (getLanguage()) {
110 case 'de': // German date format
111 $content['birthday_selection'] = addSelectionBox('da', postRequestElement('day')).addSelectionBox('mo', postRequestElement('month')).addSelectionBox('ye', postRequestElement('year'));
114 default: // Default is the US date format... :)
115 $content['birthday_selection'] = addSelectionBox('mo', postRequestElement('month')).addSelectionBox('da', postRequestElement('day')).addSelectionBox('ye', postRequestElement('year'));
119 // Shall I display the refid or shall I make it editable?
120 if (isDisplayRefidEnabled()) {
121 // Load "hide" form template
122 $content['refid_content'] = loadTemplate('guest_register_refid_hide', TRUE);
124 // Load template to enter it
125 $content['refid_content'] = loadTemplate('guest_register_refid', TRUE);
128 // ZIP codes are numerical values
129 $content['zip'] = '';
130 if ((isPostRequestElementSet('zip')) && (postRequestElement('zip') > 0)) {
131 $content['zip'] = bigintval(postRequestElement('zip'));
135 foreach (array('gender', 'surname', 'family', 'street_nr', 'city', 'email') as $entry) {
136 $content[$entry] = sqlEscapeString(postRequestElement($entry));
139 // Set must-fillout fields
140 $content = runFilterChain('register_must_fillout', $content);
142 // Display registration form
143 loadTemplate('guest_register', FALSE, $content);