Some language strings fixed, renamed. Copyright notice updated
[mailer.git] / inc / modules / guest / what-register.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 10/10/2003 *
4  * ===================                          Last change: 11/26/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-register.php                                *
8  * -------------------------------------------------------------------- *
9  * Short description : Registration form                                *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Anmeldeformular                                  *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
20  * For more information visit: http://www.mxchange.org                  *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Add description as navigation point
44 addYouAreHereLink('guest', __FILE__);
45
46 if (!isExtensionActive('register')) {
47         loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('register'));
48         return;
49 } elseif (!isExtensionActive('country')) {
50         loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('country'));
51         return;
52 }
53
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
58         doRegistration();
59
60         // Output success registration
61         loadTemplate('admin_settings_saved', false, '{--REGISTRATION_DONE--}');
62 } else {
63         // Do this only if form is sent
64         if (isFormSent()) {
65                 if (postRequestParameter('agree') == '!') {
66                         registerOutputFailedMessage('HAVE_TO_AGREE');
67                 } // END - if
68
69                 if (postRequestParameter('email') == '!') {
70                         registerOutputFailedMessage('ENTER_EMAIL');
71                         setPostRequestParameter('email', '');
72                 } elseif (postRequestParameter('email') == '?') {
73                         registerOutputFailedMessage('GUEST_EMAIL_ALREADY_DB');
74                         setPostRequestParameter('email', '');
75                 }
76
77                 if (postRequestParameter('surname') == '!') {
78                         registerOutputFailedMessage('ENTER_SURNAME');
79                         setPostRequestParameter('surname', '');
80                 } // END - if
81
82                 if (postRequestParameter('family') == '!') {
83                         registerOutputFailedMessage('ENTER_FAMILY');
84                         setPostRequestParameter('family', '');
85                 } // END - if
86
87                 if ((postRequestParameter('pass1') == '!') && (postRequestParameter('pass2') == '!')) {
88                         registerOutputFailedMessage('ENTER_BOTH_PASSWORDS');
89                 } elseif (postRequestParameter('pass1') == '!') {
90                         registerOutputFailedMessage('ENTER_PASS1');
91                 } elseif (postRequestParameter('pass2') == '!') {
92                         registerOutputFailedMessage('ENTER_PASS2');
93                 }
94
95                 if ((isset($GLOBALS['registration_short_password'])) && ($GLOBALS['registration_short_password'] === true)) {
96                         registerOutputFailedMessage('GUEST_SHORT_PASS', ': ' . getPassLen());
97                 } // END - if
98
99                 if ((isset($GLOBALS['registration_ip_timeout'])) && ($GLOBALS['registration_ip_timeout'] === true)) {
100                         registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT');
101                 } // END - if
102
103                 if ((!empty($GLOBALS['registration_selected_cats'])) && ($GLOBALS['registration_selected_cats'] < getLeastCats())) {
104                         registerOutputFailedMessage('', '{--CHOOSE_MORE_CATEGORIES--}');
105                 } // END - if
106         } // END - if
107
108         // Generate birthday selection
109         switch (getLanguage()) {
110                 case 'de': // German date format
111                         $content['birthday_selection'] = addSelectionBox('day', postRequestParameter('day')).addSelectionBox('month', postRequestParameter('month')).addSelectionBox('year', postRequestParameter('year'));
112                         break;
113
114                 default: // Default is the US date format... :)
115                         $content['birthday_selection'] = addSelectionBox('month', postRequestParameter('month')).addSelectionBox('day', postRequestParameter('day')).addSelectionBox('year', postRequestParameter('year'));
116                         break;
117         }
118
119         // Adds a table for the guests with all visible categories
120         $content['category_selection'] = registerGenerateCategoryTable('guest', true);
121
122         // Adds maximum receiveable mails list... :)
123         $content['max_receive_list'] = addMaxReceiveList('guest', '', true);
124
125         // Shall I display the refid or shall I make it editable?
126         if (isDisplayRefidEnabled()) {
127                 // Load "hide" form template
128                 $content['refid_content'] = loadTemplate('guest_register_refid_hide', true);
129         } else {
130                 // Load template to enter it
131                 $content['refid_content'] = loadTemplate('guest_register_refid', true);
132         }
133
134         // You may want to modify the register_header.tpl.xx file and not this script when you add your scripts etc. :-)
135         $content['header_content'] = loadTemplate('register_header', true);
136
137         // Other values
138         $content['surname']   = SQL_ESCAPE(postRequestParameter('surname'));
139         $content['family']    = SQL_ESCAPE(postRequestParameter('family'));
140         $content['street_nr'] = SQL_ESCAPE(postRequestParameter('street_nr'));
141         $content['zip']       = '';
142         if (isPostRequestParameterSet('zip')) {
143                 $content['zip']       = bigintval(postRequestParameter('zip'));
144         } // END - if
145         $content['city']      = SQL_ESCAPE(postRequestParameter('city'));
146         $content['email']     = SQL_ESCAPE(postRequestParameter('email'));
147
148         // The admin may see all
149         $whereStatement = "WHERE `is_active`='Y'";
150         if (isAdmin()) $whereStatement = '';
151
152         // Prepare country selection box
153         $OUT  = '<select name="country_code" class="form_select" size="1">';
154         $OUT .= generateOptionList('countries', 'id', 'descr', postRequestParameter('country_code'), 'code', $whereStatement);
155         $OUT .= '</select>';
156         $content['country'] = $OUT;
157
158         // Set must-fillout fields
159         $content = runFilterChain('register_must_fillout', $content);
160
161         // Display registration form
162         loadTemplate('guest_register', false, $content);
163 }
164
165 // [EOF]
166 ?>