A lot more wrapper functions added, templates renamed
[mailer.git] / inc / libs / register_functions.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 07/10/2004 *
4  * ===================                          Last change: 07/10/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : register_functions.php                           *
8  * -------------------------------------------------------------------- *
9  * Short description : Special functions for register extension         *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Spezielle Funktion fuer register-Erweiterung     *
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 //
44 function ifRequiredRegisterFieldsAreSet (&$array) {
45         // By default all is fine
46         $ret = true;
47         foreach ($array as $key => $value) {
48                 // Check all fields that must register
49                 $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_must_register` WHERE `field_name`='%s' AND `field_required`='Y' LIMIT 1",
50                         array($key), __FUNCTION__, __LINE__);
51
52                 // Entry found?
53                 if (SQL_NUMROWS($result) == 1) {
54                         // Check if extension country is not found (you have to enter the 2-chars long country code) or
55                         // if extensions is present check if country code was selected
56                         //         01              2         21    12             3         32    234     5      54    4               43    34                      4    4      5      5432    2      3                      3210
57                         $country = ((!isExtensionActive('country')) || ((isExtensionActive('country')) && (((empty($value)) && ($key == 'cntry')) || (($key == 'country_code') && (!empty($value)))) && (!empty($array['country_code']))));
58                         if ((empty($value)) && ($country === false)) {
59                                 // Required field not set
60                                 $array[$key] = '!';
61                                 $ret = false;
62                         } // END - if
63                 } // END - if
64
65                 // Free result
66                 SQL_FREERESULT($result);
67         } // END - foreach
68
69         // Return result
70         return $ret;
71 }
72
73 // Generates a 'category table' for the registration form
74 function registerGenerateCategoryTable ($mode, $return=false) {
75         $OUT = '';
76
77         // Guests are mostly not interested in how many members has
78         // choosen an individual category
79         $AND = "WHERE `visible`='Y' ";
80
81         // Admins are allowed to see every category...
82         if (isAdmin()) $AND = '';
83
84         // Look for categories
85         $result = SQL_QUERY('SELECT `id`, `cat`, `visible` FROM `{?_MYSQL_PREFIX?}_cats` ' . $AND . ' ORDER BY `sort` ASC',
86                 __FUNCTION__, __LINE__);
87
88         if (!SQL_HASZERONUMS($result)) {
89                 // List alle visible modules (or all to the admin)
90                 $OUT .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
91                 while ($content = SQL_FETCHARRAY($result)) {
92                         // Prepare array for the template
93                         $content['default_yes'] = '';
94                         $content['default_no']  = '';
95
96                         // Mark categories
97                         if ((postRequestParameter('cat', $content['id']) == 'Y') || ((isRegisterDefaultEnabled()) && (!isPostRequestParameterSet('cat', $content['id'])))) {
98                                 $content['default_yes'] = ' checked="checked"';
99                         } else {
100                                 $content['default_no']  = ' checked="checked"';
101                         }
102
103                         // Load template and switch color
104                         $OUT .= loadTemplate('guest_cat_row', true, $content);
105                 } // END - while
106                 $OUT .= '</table>';
107
108                 // Free memory
109                 SQL_FREERESULT($result);
110         } else {
111                 // No categories setted up so far...
112                 $OUT .= loadTemplate('admin_settings_saved', true, '{--NO_CATEGORIES_VISIBLE--}');
113         }
114
115         if ($return === true) {
116                 // Return generated HTML code
117                 return $OUT;
118         } else {
119                 // Output directly (default)
120                 outputHtml($OUT);
121         }
122 }
123
124 // Outputs a 'failed message'
125 function registerOutputFailedMessage ($messageId, $extra='') {
126         if (empty($messageId)) {
127                 outputHtml('<div class="notice">' . $extra . '</div>');
128         } else {
129                 outputHtml('<div class="notice">{--' . $messageId . '--}' . $extra . '</div>');
130         }
131 }
132
133 // Run a filter for must-fillout fields
134 function FILTER_REGISTER_MUST_FILLOUT ($content) {
135         // Get all fields for output
136         $result = SQL_QUERY('SELECT `field_name`, `field_required` FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC',
137                 __FUNCTION__, __LINE__);
138
139         // Walk through all entries
140         while ($row = SQL_FETCHARRAY($result)) {
141                 // Must the user fill out this element?
142                 $value = '';
143                 if ($row['field_required'] == 'Y') {
144                         $value = '<span class="notice">(*)</span>';
145                 } // END - if
146
147                 // Add it
148                 $content['must_fillout_' . strtolower($row['field_name']) . ''] = $value;
149         } // END - while
150
151         // Free memory
152         SQL_FREERESULT($result);
153
154         // Return it
155         return $content;
156 }
157
158 // Checks wether the registration data is complete
159 function isRegistrationDataComplete () {
160         // Init elements
161         $GLOBALS['registration_ip_timeout']     = false;
162         $GLOBALS['registration_short_password'] = false;
163         $GLOBALS['registration_selected_cats']  = '0';
164
165         // Default is okay
166         $isOkay = true;
167
168         // First we only check the submitted data then we continue... :)
169         //
170         // Did he agree to our Terms Of Usage?
171         if (postRequestParameter('agree') != 'Y') {
172                 setPostRequestParameter('agree', '!');
173                 $isOkay = false;
174         } // END - if
175
176         // Did he enter a valid email address? (we really don't care about
177         // that, he has to click on a confirmation link :P )
178         if ((!isPostRequestParameterSet('email')) || (!isEmailValid(postRequestParameter('email')))) {
179                 setPostRequestParameter('email', '!');
180                 $isOkay = false;
181         } // END - if
182
183         // And what about surname and family's name?
184         if (!isPostRequestParameterSet('surname')) {
185                 setPostRequestParameter('surname', '!');
186                 $isOkay = false;
187         } // END - if
188         if (!isPostRequestParameterSet('family')) {
189                 setPostRequestParameter('family', '!');
190                 $isOkay = false;
191         } // END - if
192
193         // Get temporary array for modification
194         $postArray = postRequestArray();
195
196         // Check for required fields
197         $isOkay = ($isOkay && ifRequiredRegisterFieldsAreSet($postArray));
198
199         // Set it back in request
200         setPostRequestArray($postArray);
201
202         // Did he enter his password twice?
203         if (((!isPostRequestParameterSet('pass1')) || (!isPostRequestParameterSet('pass2'))) || ((postRequestParameter('pass1') != postRequestParameter('pass2')) && (isPostRequestParameterSet('pass1')) && (isPostRequestParameterSet('pass2')))) {
204                 if ((postRequestParameter('pass1') != postRequestParameter('pass2')) && (isPostRequestParameterSet('pass1')) && (isPostRequestParameterSet('pass2'))) {
205                         setPostRequestParameter('pass1', '!');
206                         setPostRequestParameter('pass2', '!');
207                 } else {
208                         if (!isPostRequestParameterSet('pass1')) {
209                                 setPostRequestParameter('pass1', '!');
210                         } else {
211                                 setPostRequestParameter('pass1', '');
212                         }
213                         if (!isPostRequestParameterSet('pass2')) {
214                                 setPostRequestParameter('pass2', '!');
215                         } else {
216                                 setPostRequestParameter('pass2', '');
217                         }
218                 }
219                 $isOkay = false;
220         } // END - if
221
222         // Are both passwords zero length?
223         if ((strlen(postRequestParameter('pass1')) == 0) && (strlen(postRequestParameter('pass2')) == 0) && ($isOkay === true)) {
224                 // Is the extension 'register' newer or equal 0.5.5?
225                 if ((isExtensionInstalledAndNewer('register', '0.5.5')) && (isRegisterGeneratePasswordEmptyEnabled())) {
226                         // Generate a random password
227                         $randomPassword = generatePassword();
228
229                         // Set it in both entries
230                         setPostRequestParameter('pass1', $randomPassword);
231                         setPostRequestParameter('pass2', $randomPassword);
232                 } else {
233                         // Not allowed or no recent extension version
234                         setPostRequestParameter('pass1', '!');
235                         setPostRequestParameter('pass2', '!');
236
237                         // ... which is both not okay
238                         $isOkay = false;
239                 }
240         } // END - if
241
242         // Is the password long enouth?
243         if ((strlen(postRequestParameter('pass1')) < getPassLen()) && ($isOkay === true)) {
244                 $GLOBALS['registration_short_password'] = true;
245                 $isOkay = false;
246         } // END - if
247
248         // Do this check only when no admin is logged in
249         if (is_array(postRequestParameter('cat'))) {
250                 // Only continue with array
251                 foreach (postRequestParameter('cat') as $id => $answer) {
252                         // Is this category choosen?
253                         if ($answer == 'Y') {
254                                 $GLOBALS['registration_selected_cats']++;
255                         } // END - if
256                 } // END - foreach
257         } // END - if
258
259         // Enougth categories selected?
260         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isOkay='.intval($isOkay).',selected='.$GLOBALS['registration_selected_cats'].'/'.getLeastCats());
261         $isOkay = (($isOkay) && ($GLOBALS['registration_selected_cats'] >= getLeastCats()));
262
263         if ((postRequestParameter('email') != '!') && (isCheckDoubleEmailEnabled())) {
264                 // Does the email address already exists in our database?
265                 if ((!isAdmin()) && (isEmailTaken(postRequestParameter('email')))) {
266                         setPostRequestParameter('email', '?');
267                         $isOkay = false;
268                 } // END - if
269         } // END - if
270
271         // Check for IP timeout?
272         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isOkay='.intval($isOkay));
273         if ((!isAdmin()) && (getIpTimeout() > 0)) {
274                 // Check his IP number
275                 $GLOBALS['registration_ip_timeout'] = (countSumTotalData(detectRemoteAddr()  , 'user_data', 'userid', 'REMOTE_ADDR', true, " AND ((UNIX_TIMESTAMP() - `joined`) < {?ip_timeout?} OR (UNIX_TIMESTAMP() - `last_update`) < {?ip_timeout?}) LIMIT 1") == 1);
276                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isOkay='.intval($isOkay).',timeout='.intval($GLOBALS['registration_ip_timeout']));
277                 $isOkay = (($isOkay) && (!$GLOBALS['registration_ip_timeout']));
278         } // END - if
279
280         // Return result
281         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isOkay='.intval($isOkay));
282         return $isOkay;
283 }
284
285 // Do the registration
286 function doRegistration () {
287         // Prepapre month and day of birth
288         if (strlen(postRequestParameter('day'))   == 1) setPostRequestParameter('day'  , '0' . postRequestParameter('day'));
289         if (strlen(postRequestParameter('month')) == 1) setPostRequestParameter('month', '0' . postRequestParameter('month'));
290
291         // Generate hash which will be inserted into confirmation mail
292         $hash = generateHash(sha1(
293                 // Get total confirmed, ...
294                 getTotalConfirmedUser() . getEncryptSeperator() .
295                 // ... unconfirmed ...
296                 getTotalUnconfirmedUser() . getEncryptSeperator() .
297                 // ... and locked users!
298                 getTotalLockedUser() . getEncryptSeperator() .
299                 postRequestParameter('month') . '-' .
300                 postRequestParameter('day') . '-' .
301                 postRequestParameter('year') . getEncryptSeperator() .
302                 detectServerName() . getEncryptSeperator() .
303                 detectRemoteAddr() . getEncryptSeperator() .
304                 detectUserAgent() . '/' .
305                 getSiteKey() . '/' .
306                 getDateKey() . '/' .
307                 getConfig('CACHE_BUSTER')
308         ));
309
310         // Old way with enterable two-char-code
311         $countryRow = '`country`';
312         $countryData = substr(postRequestParameter('cntry'), 0, 2);
313
314         // Add design when extension sql_patches is v0.2.7 or greater
315         // @TODO Rewrite these all to a single filter
316         $GLOBALS['register_sql_columns'] = '';
317         $GLOBALS['register_sql_data'] = '';
318         if (isExtensionInstalledAndNewer('theme', '0.0.8')) {
319                 // Okay, add design here
320                 $GLOBALS['register_sql_columns'] .= ', `curr_theme`';
321                 $GLOBALS['register_sql_data']    .= ", '" . getCurrentTheme() . "'";
322         } // END - if
323
324         // Check if I shall disable sending mail to newly registered members out about active/begging rallye
325         //
326         // First comes first: begging rallye
327         if ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (!isBegNewMemberNotifyEnabled())) {
328                 $GLOBALS['register_sql_columns'] .= ', `beg_rallye_enable_notify`, `beg_rallye_disable_notify`';
329                 $GLOBALS['register_sql_data']    .= ', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()';
330         } // END - if
331
332         // Second: active rallye
333         if (!isBonusNewMemberNotifyEnabled()) {
334                 $GLOBALS['register_sql_columns'] .= ', `bonus_rallye_enable_notify`, `bonus_rallye_disable_notify`';
335                 $GLOBALS['register_sql_data']    .= ', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()';
336         } // END - if
337
338         // Write user data to table
339         if (isExtensionActive('country')) {
340                 // Save with new selectable country code
341                 $countryRow = '`country_code`';
342                 $countryData = bigintval(postRequestParameter('country_code'));
343         } // END - if
344
345         // Create user's account...
346         SQL_QUERY_ESC("INSERT INTO
347         `{?_MYSQL_PREFIX?}_user_data`
348 (`gender`, `surname`, `family`, `street_nr`,%s, `zip`, `city`, `email`, `birth_day`, `birth_month`, `birth_year`, `password`, `max_mails`, `receive_mails`, `refid`, `status`, `user_hash`, `REMOTE_ADDR`, `joined`, `last_update`".$GLOBALS['register_sql_columns'].")
349         VALUES
350 ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONFIRMED','%s','%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()".$GLOBALS['register_sql_data'].")",
351         array(
352                 $countryRow,
353                 substr(postRequestParameter('gender'), 0, 1),
354                 postRequestParameter('surname'),
355                 postRequestParameter('family'),
356                 postRequestParameter('street_nr'),
357                 $countryData,
358                 bigintval(postRequestParameter('zip')),
359                 postRequestParameter('city'),
360                 postRequestParameter('email'),
361                 bigintval(postRequestParameter('day')),
362                 bigintval(postRequestParameter('month')),
363                 bigintval(postRequestParameter('year')),
364                 generateHash(postRequestParameter('pass1')),
365                 bigintval(postRequestParameter('max_mails')),
366                 bigintval(postRequestParameter('max_mails')),
367                 makeDatabaseUserId(postRequestParameter('refid')),
368                 $hash,
369                 detectRemoteAddr(),
370         ), __FUNCTION__, __LINE__);
371
372         // Get his userid
373         $userid = bigintval(SQL_INSERTID());
374
375         // Did this work?
376         if ($userid == '0') {
377                 // Something bad happened!
378                 loadTemplate('admin_settings_saved', false, '{--USER_NOT_REGISTERED--}');
379
380                 // Stop here
381                 return;
382         } // END - if
383
384         // Is the refback extension there?
385         // @TODO Rewrite this to a filter
386         if (isExtensionActive('refback')) {
387                 // Update refback table
388                 updateRefbackTable($userid);
389         } // END - if
390
391         // Write his welcome-points
392         // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable
393         addPointsDirectly('register_welcome', $userid, getPointsRegister());
394
395         // Write catgories
396         if ((is_array(postRequestParameter('cat'))) && (count(postRequestParameter('cat')))) {
397                 foreach (postRequestParameter('cat') as $cat => $joined) {
398                         if ($joined == 'Y') {
399                                 // Insert category entry
400                                 SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_cats` (`userid`, `cat_id`) VALUES (%s, %s)",
401                                         array($userid, bigintval($cat)), __FUNCTION__, __LINE__);
402                         } // END - if
403                 } // END - foreach
404         } // END - if
405
406         // ... rewrite a zero referal id to the main title
407         if (!isValidUserId(postRequestParameter('refid'))) {
408                 setPostRequestParameter('refid', getMainTitle());
409         } // END - if
410
411         // Is ZIP code set?
412         if (isPostRequestParameterSet('zip')) {
413                 // Prepare data array for the email template
414                 // Start with the gender...
415                 $content = array(
416                         'hash'     => $hash,
417                         'userid'   => $userid,
418                         'gender'   => SQL_ESCAPE(postRequestParameter('gender')),
419                         'surname'  => SQL_ESCAPE(postRequestParameter('surname')),
420                         'family'   => SQL_ESCAPE(postRequestParameter('family')),
421                         'email'    => SQL_ESCAPE(postRequestParameter('email')),
422                         'street'   => SQL_ESCAPE(postRequestParameter('street_nr')),
423                         'city'     => SQL_ESCAPE(postRequestParameter('city')),
424                         'zip'      => bigintval(postRequestParameter('zip')),
425                         'country'  => $countryData,
426                         'refid'    => SQL_ESCAPE(postRequestParameter('refid')),
427                         'password' => SQL_ESCAPE(postRequestParameter('pass1')),
428                 );
429         } else {
430                 // No ZIP code entered
431                 $content = array(
432                         'hash'     => $hash,
433                         'userid'   => $userid,
434                         'gender'   => SQL_ESCAPE(postRequestParameter('gender')),
435                         'surname'  => SQL_ESCAPE(postRequestParameter('surname')),
436                         'family'   => SQL_ESCAPE(postRequestParameter('family')),
437                         'email'    => SQL_ESCAPE(postRequestParameter('email')),
438                         'street'   => SQL_ESCAPE(postRequestParameter('street_nr')),
439                         'city'     => SQL_ESCAPE(postRequestParameter('city')),
440                         'zip'      => '',
441                         'country'  => $countryData,
442                         'refid'    => SQL_ESCAPE(postRequestParameter('refid')),
443                         'password' => SQL_ESCAPE(postRequestParameter('pass1')),
444                 );
445         }
446
447         // Continue with birthday...
448         switch (getLanguage()) {
449                 case 'de':
450                         $content['birthday'] = bigintval(postRequestParameter('day')) . '.' . bigintval(postRequestParameter('month')) . '.' . bigintval(postRequestParameter('year'));
451                         break;
452
453                 default:
454                         $content['birthday'] = bigintval(postRequestParameter('month')) . '/' . bigintval(postRequestParameter('day')) . '/' . bigintval(postRequestParameter('year'));
455                         break;
456         } // END - switch
457
458         // Display information to the user that he got mail and send it away
459         $messageGuest = loadEmailTemplate('register-member', $content, $userid, false);
460
461         // Send mail to user (confirmation link!)
462         $email = $content['email'];
463         sendEmail($content['email'], '{--GUEST_CONFIRM_LINK_SUBJECT--}', $messageGuest);
464         $content['email'] = $email;
465
466         // Send mail to admin
467         sendAdminNotification('{--ADMIN_NEW_ACCOUNT_SUBJECT--}', 'register-admin', $content, $userid);
468 }
469
470 //-----------------------------------------------------------------------------
471 //                      Wrapper functions for ext-register
472 //-----------------------------------------------------------------------------
473
474 // Getter for 'display_refid'
475 function getDisplayRefid () {
476         // Is the cache entry set?
477         if (!isset($GLOBALS[__FUNCTION__])) {
478                 // No, so determine it
479                 $GLOBALS[__FUNCTION__] = getConfig('display_refid');
480         } // END - if
481
482         // Return cached entry
483         return $GLOBALS[__FUNCTION__];
484 }
485
486 // Checks wether 'display_refid' is "YES"
487 function isDisplayRefidEnabled () {
488         // Is the cache entry set?
489         if (!isset($GLOBALS[__FUNCTION__])) {
490                 // No, so determine it
491                 $GLOBALS[__FUNCTION__] = (getDisplayRefid() == 'Y');
492         } // END - if
493
494         // Return cached entry
495         return $GLOBALS[__FUNCTION__];
496 }
497
498 // Getter for 'ip_timeout'
499 function getIpTimeout () {
500         // Is the cache entry set?
501         if (!isset($GLOBALS[__FUNCTION__])) {
502                 // No, so determine it
503                 $GLOBALS[__FUNCTION__] = getConfig('ip_timeout');
504         } // END - if
505
506         // Return cached entry
507         return $GLOBALS[__FUNCTION__];
508 }
509
510 // Getter for 'check_double_email'
511 function getCheckDoubleEmail () {
512         // Is the cache entry set?
513         if (!isset($GLOBALS[__FUNCTION__])) {
514                 // No, so determine it
515                 $GLOBALS[__FUNCTION__] = getConfig('check_double_email');
516         } // END - if
517
518         // Return cached entry
519         return $GLOBALS[__FUNCTION__];
520 }
521
522 // Checks wether 'check_double_email' is "YES"
523 function isCheckDoubleEmailEnabled () {
524         // Is the cache entry set?
525         if (!isset($GLOBALS[__FUNCTION__])) {
526                 // No, so determine it
527                 $GLOBALS[__FUNCTION__] = (getCheckDoubleEmail() == 'Y');
528         } // END - if
529
530         // Return cached entry
531         return $GLOBALS[__FUNCTION__];
532 }
533
534 // Getter for 'register_default'
535 function getRegisterDefault () {
536         // Is the cache entry set?
537         if (!isset($GLOBALS[__FUNCTION__])) {
538                 // No, so determine it
539                 $GLOBALS[__FUNCTION__] = getConfig('register_default');
540         } // END - if
541
542         // Return cached entry
543         return $GLOBALS[__FUNCTION__];
544 }
545
546 // Checks wether 'register_default' is "YES"
547 function isRegisterDefaultEnabled () {
548         // Is the cache entry set?
549         if (!isset($GLOBALS[__FUNCTION__])) {
550                 // No, so determine it
551                 $GLOBALS[__FUNCTION__] = (getRegisterDefault() == 'Y');
552         } // END - if
553
554         // Return cached entry
555         return $GLOBALS[__FUNCTION__];
556 }
557
558 // Getter for 'register_generate_password_empty'
559 function getRegisterGeneratePasswordEmpty () {
560         // Is the cache entry set?
561         if (!isset($GLOBALS[__FUNCTION__])) {
562                 // No, so determine it
563                 $GLOBALS[__FUNCTION__] = getConfig('register_generate_password_empty');
564         } // END - if
565
566         // Return cached entry
567         return $GLOBALS[__FUNCTION__];
568 }
569
570 // Checks wether 'register_generate_password_empty' is "YES"
571 function isRegisterGeneratePasswordEmptyEnabled () {
572         // Is the cache entry set?
573         if (!isset($GLOBALS[__FUNCTION__])) {
574                 // No, so determine it
575                 $GLOBALS[__FUNCTION__] = (getRegisterGeneratePasswordEmpty() == 'Y');
576         } // END - if
577
578         // Return cached entry
579         return $GLOBALS[__FUNCTION__];
580 }
581
582 // [EOF]
583 ?>