2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 07/16/2004 *
4 * =================== Last change: 10/27/2004 *
6 * -------------------------------------------------------------------- *
7 * File : user_functions.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Special functions for user extension *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Spezielle Funktionen fuer die user-Erweiterung *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
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 *
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 links for selecting some users
44 function alpha ($sortby, $colspan, $return=false) {
45 if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', 0);
46 $add = '&page='.getRequestParameter('page').'&offset='.getRequestParameter('offset');
47 if (isGetRequestParameterSet('mode')) $add .= '&mode='.getRequestParameter('mode');
49 /* Creates the list of letters and makes them a link. */
50 $alphabet = explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,');
51 $num = count($alphabet) - 1;
53 while (list($counter, $ltr) = each($alphabet)) {
54 if (getRequestParameter('letter') == $ltr) {
55 // Current letter is letter from URL
56 $OUT .= '<strong>' . $ltr . '</strong>';
58 // Output link to letter
59 $OUT .= '<a href="{%url=modules.php?module=admin&what=' . getWhat();
60 if (isGetRequestParameterSet('mode')) $OUT .= '&mode=' . getRequestParameter('mode');
61 $OUT .= '&letter=' . $ltr . '&sortby=' . $sortby . $add . '%}">' . $ltr . '</a>';
64 if ((($counter / getConfig('user_alpha')) == round($counter / getConfig('user_alpha'))) && ($counter > 0)) {
66 } elseif ( $counter != $num ) {
73 'colspan2' => $colspan,
74 'alpha_selection' => $OUT
78 $OUT = loadTemplate('admin_list_user_alpha', true, $content);
79 if ($return === true) {
80 // Return generated code
83 // Output generated code
88 // Add links for sorting
89 function addSortLinks ($letter, $sortby, $colspan, $return=false) {
91 if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', 0);
92 if (!isGetRequestParameterSet('page')) setGetRequestParameter('page' , 0);
94 // Add page and offset
95 $add = '&page=' . getRequestParameter('page') . '&offset=' . getRequestParameter('offset');
98 if (isGetRequestParameterSet('status')) $add .= '&mode=' . getRequestParameter('status');
99 elseif (isGetRequestParameterSet('mode')) $add .= '&mode=' . getRequestParameter('mode');
101 // Makes order by links..
102 if ($letter == 'front') $letter = '';
104 // Prepare array with all possible sorters
106 'userid' => '{--_USERID--}',
107 'family' => '{--FAMILY--}',
108 'email' => '{--EMAIL--}',
109 'REMOTE_ADDR' => '{--REMOTE_IP--}'
112 // Add nickname if extension is installed
113 if (isExtensionActive('nickname')) {
114 $list['nickname'] = '{--NICKNAME--}';
117 foreach ($list as $sort => $title) {
118 if ($sortby == $sort) {
119 $OUT .= '<strong>' . $title . '</strong>|';
121 $OUT .= '<a href="{%url=modules.php?module=admin&what=list_user&letter=' . $letter . '&sortby=' . $sort . $add . '%}">' . $title . '</a>|';
125 // Add list and colspan
126 $content['list'] = substr($OUT, 0, -1);
127 $content['colspan2'] = $colspan;
130 $OUT = loadTemplate('admin_list_user_sort', true, $content);
132 // Should we return or output?
133 if ($return === true) {
142 // Add page navigation
143 function addPageNavigation ($numPages, $offset, $showForm, $colspan, $return=false) {
144 // @TODO These two constants are no longer used, maybe we reactivate this code?
145 //if ($showForm === true) {
146 // // Load form for changing number of lines
147 // define('__FORM_HEADER', loadTemplate('admin_list_user_sort_form', true));
148 // define('__FORM_FOOTER', '<tr><td colspan="'.$colspan.'" class="seperator bottom"> </td></tr>');
151 // define('__FORM_HEADER', '<tr><td colspan="' . $colspan . '" class="seperator"> </td></tr>');
152 // define('__FORM_FOOTER', '<tr><td colspan="' . $colspan . '" class="seperator bottom"> </td></tr>');
156 for ($page = 1; $page <= $numPages; $page++) {
157 if (($page == getRequestParameter('page')) || ((!isGetRequestParameterSet('page')) && ($page == 1))) {
160 if (!isGetRequestParameterSet('letter')) setGetRequestParameter('letter', '');
161 if (!isGetRequestParameterSet('sortby')) setGetRequestParameter('sortby', 'userid');
164 $OUT .= '<a href="{%url=modules.php?module=admin&what=' . getWhat();
166 // Add status or mode
167 if (isGetRequestParameterSet('status')) $OUT .= '&mode=' . getRequestParameter('status');
168 elseif (isGetRequestParameterSet('mode')) $OUT .= '&mode=' . getRequestParameter('mode');
171 $OUT .= '&letter=' . getRequestParameter('letter') . '&sortby=' . getRequestParameter('sortby') . '&page=' . $page . '&offset=' . $offset . '%}">';
176 if (($page == getRequestParameter('page')) || ((!isGetRequestParameterSet('page')) && ($page == 1))) {
177 $OUT .= '-</strong>';
182 if ($page < $numPages) $OUT .= '|';
185 // Remember the list and colspan
186 $content['list'] = $OUT;
187 $content['colspan2'] = $colspan;
190 $OUT = loadTemplate('admin_list_user_pagenav', true, $content);
191 if ($return === true) {
200 // Create email link to user's account
201 function generateUserEmailLink ($email, $mod = 'admin') {
202 // Show contact link only if user is confirmed by default
203 $locked = " AND `status`='CONFIRMED'";
205 // But admins shall always see it
206 if (isAdmin()) $locked = '';
208 $result = SQL_QUERY_ESC("SELECT
211 `{?_MYSQL_PREFIX?}_user_data`
213 `email`='%s'" . $locked."
215 array($email), __FUNCTION__, __LINE__);
216 if (SQL_NUMROWS($result) == 1) {
218 list($userid) = SQL_FETCHROW($result);
220 // Rewrite email address to contact link
221 $email = '{%url=modules.php?module=' . $mod . '&what=user_contct&userid=' . bigintval($userid) . '%}';
225 SQL_FREERESULT($result);
227 // Return rewritten (?) email address
231 // Selects a random user id as the new referal id if they have at least X confirmed mails in this run
232 // @TODO Double-check configuration entry here
233 function determineRandomReferalId () {
234 // Default is zero refid
237 // Is the extension version fine?
238 if (isExtensionInstalledAndNewer('user', '0.3.4')) {
240 $totalUsers = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', true, " AND `rand_confirmed` >= {?user_min_confirmed?}");
242 // Do we have at least one?
243 if ($totalUsers > 0) {
244 // Then choose random number
245 $randNum = mt_rand(0, ($totalUsers - 1));
247 // Look for random user
248 $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status`='CONFIRMED' AND `rand_confirmed` >= {?user_min_confirmed?} ORDER BY `rand_confirmed` DESC LIMIT %s, 1",
249 array($randNum), __FUNCTION__, __LINE__);
251 // Do we have one entry there?
252 if (SQL_NUMROWS($result) == 1) {
253 // Use that userid as new referal id
254 list($refid) = SQL_FETCHROW($result);
256 // Reset all users, this makes this random referal id more challenging
257 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0",
258 array($refid), __FUNCTION__, __LINE__);
262 SQL_FREERESULT($result);
271 function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.php?module=index&what=login&login=') {
289 if ((isExtensionActive('nickname')) && (isNicknameUsed($userid))) {
291 fetchUserData($userid, 'nickname');
292 } elseif (isNicknameUsed($userid)) {
293 // No nickname installed
294 $errorCode = getCode('EXTENSION_PROBLEM');
297 // Direct userid entered
298 $isFound = fetchUserData($userid);
302 if (($errorCode == '0') && ($isFound === true)) {
303 // Get user data array and set userid (e.g. important if we login with nickname)
304 $content = getUserDataArray();
305 if (!empty($content['userid'])) {
306 $userid = bigintval($content['userid']);
310 // Is there an entry?
311 if (($errorCode == '0') && (isUserDataValid()) && (getUserData('status') == 'CONFIRMED') && (!empty($content['userid']))) {
312 // Check for old MD5 passwords
313 if ((strlen(getUserData('password')) == 32) && (md5($passwd) == getUserData('password'))) {
314 // Just set the hash to the password from DB... :)
315 $content['hash'] = getUserData('password');
317 // Hash password with improved way for comparsion
318 $content['hash'] = generateHash($passwd, substr(getUserData('password'), 0, -40));
321 // Does the password match the hash?
322 if ($content['hash'] == getUserData('password')) {
323 // New hashed password found so let's generate a new one
324 $content['hash'] = generateHash($passwd);
326 // ... and update database
327 // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
328 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `password`='%s' WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
329 array($content['hash'], $userid), __FUNCTION__, __LINE__);
331 // No login bonus by default
332 $GLOBALS['bonus_payed'] = false;
334 // Is bonus up-to-date?
335 if (isExtensionInstalledAndNewer('bonus', '0.2.2')) {
336 // Probe for last online timemark
337 $probe = time() - getUserData('last_online');
338 if (getUserData('last_login') > 0) {
339 // Use timestamp from last login
340 $probe = time() - getUserData('last_login');
343 // Is the timeout reached?
344 if ($probe >= getConfig('login_timeout')) {
345 // Add login bonus to user's account
346 $add = ', `login_bonus`=`login_bonus`+{?login_bonus?}';
347 $GLOBALS['bonus_payed'] = true;
349 // Subtract login bonus from userid's account or jackpot
350 if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD')) {
351 handleBonusPoints('login_bonus');
356 // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
359 setMemberId($userid);
361 // Try to set session data (which shall normally always work!)
362 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',hash=' . $content['hash'] . '(' . strlen($content['hash']) . ')');
363 if ((setSession('userid', $userid )) && (setSession('u_hash', encodeHashForCookie($content['hash'])))) {
364 // Update database records
365 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `total_logins`=`total_logins`+1" . $add . " WHERE `userid`=%s LIMIT 1",
366 array($userid), __FUNCTION__, __LINE__);
367 if (!SQL_HASZEROAFFECTED()) {
368 // Is a success URL set?
369 if (empty($successUrl)) {
370 // Procedure to checking for login data
371 if (($GLOBALS['bonus_payed'] === true) && (isExtensionActive('bonus'))) {
372 // Bonus added (just displaying!)
373 $url = 'modules.php?module=chk_login&mode=bonus';
376 $url = 'modules.php?module=chk_login&mode=login';
383 // Cannot update counter!
384 $errorCode = getCode('CNTR_FAILED');
387 // Cookies not setable!
388 $errorCode = getCode('COOKIES_DISABLED');
390 } elseif (isExtensionInstalledAndNewer('sql_patches', '0.6.1')) {
391 // Update failure counter
392 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `login_failures`=`login_failures`+1,`last_failure`=NOW() WHERE `userid`=%s LIMIT 1",
393 array($userid), __FUNCTION__, __LINE__);
396 $errorCode = getCode('WRONG_PASS');
398 } elseif ((isUserDataValid()) && (getUserData('status') != 'CONFIRMED')) {
399 // Create an error code from given status
400 $errorCode = generateErrorCodeFromUserStatus(getUserData('status'));
402 // Set userid in session
403 setSession('current_userid', getUserData('userid'));
404 } elseif (!isUserDataValid()) {
406 $errorCode = getCode('WRONG_ID');
409 $errorCode = getCode('UNKNOWN_ERROR');
412 // Error code provided?
413 if ($errorCode > 0) {
414 // Then reconstruct the URL
415 $url = $errorUrl . $errorCode;
417 // Extension set? Then add it as well.
419 $url .= '&ext=' . $ext;
427 // Try to send a new password for the given user account
428 function doNewUserPassword ($email, $userid) {
429 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'email=' . $email . ',userid=' . $userid . ' - ENTERED!');
430 // Init found-status and error
432 $accountFound = false;
434 // Probe userid/nickname
435 if (!empty($email)) {
437 $accountFound = fetchUserData($email, 'email');
438 } elseif ((isExtensionActive('nickname')) && (isNicknameOrUserid($userid))) {
440 $accountFound = fetchUserData($userid, 'nickname');
441 } elseif ((isValidUserId($userid)) && (empty($email))) {
442 // Direct userid entered
443 $accountFound = fetchUserData($userid);
446 logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',email=' . $email . ': Important variables are empty.');
450 if ($accountFound === true) {
451 // Is the account confirmed
452 if (getUserData('status') == 'CONFIRMED') {
453 // Generate new password
454 $NEW_PASS = generatePassword();
457 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `password`='%s' WHERE `userid`=%s LIMIT 1",
458 array(generateHash($NEW_PASS), getUserData('userid')), __FUNCTION__, __LINE__);
460 // Prepare data and message for email
461 $message = loadEmailTemplate('guest_new_password',
463 'new_pass' => $NEW_PASS,
464 'nickname' => $userid
465 ), bigintval(getUserData('userid')));
467 // ... and send it away
468 sendEmail(bigintval(getUserData('userid')), '{--GUEST_NEW_PASSWORD--}', $message);
470 // Output note to user
471 displayMessage('{--GUEST_NEW_PASSWORD_SEND--}');
473 // Account is locked or unconfirmed
474 $errorCode = generateErrorCodeFromUserStatus(getUserData('status'));
477 redirectToUrl('modules.php?module=index&what=login&login=' . $errorCode);
480 // id or email is wrong
481 displayMessage('<span class="notice">{--GUEST_WRONG_ID_EMAIL--}</span>');
484 // Return the error code
485 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'email=' . $email . ',userid=' . $userid . ',errorCode=' . $errorCode . ' - EXIT!');
489 // Get timestamp for given stats type and data
490 function getEpocheTimeFromUserStats ($statsType, $statsData, $userid = '0') {
491 // Default timestamp is zero
492 $data['inserted'] = '0';
495 if ((isMemberIdSet()) && ($userid == '0')) {
496 $userid = getMemberId();
499 // Is the extension installed and updated?
500 if ((!isExtensionActive('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.6'))) {
502 return $data['inserted'];
505 // Try to find the entry
506 $result = SQL_QUERY_ESC("SELECT
507 UNIX_TIMESTAMP(`inserted`) AS inserted
509 `{?_MYSQL_PREFIX?}_user_stats_data`
512 `stats_type`='%s' AND
519 ), __FUNCTION__, __LINE__);
521 // Is the entry there?
522 if (SQL_NUMROWS($result) == 1) {
524 $data = SQL_FETCHARRAY($result);
528 SQL_FREERESULT($result);
531 return $data['inserted'];
534 // Inserts user stats
535 function insertUserStatsRecord ($userid, $statsType, $statsData) {
536 // Is the extension installed and updated?
537 if ((!isExtensionActive('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.6'))) {
543 if ((!getEpocheTimeFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) {
545 SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')",
550 ), __FUNCTION__, __LINE__);
551 } elseif (is_array($statsData)) {
553 logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',type=' . $statsType . ',data=' . gettype($statsData) . ': Invalid statistics data type!');
557 // Confirms a user account
558 function doConfirmUserAccount ($hash) {
561 'message' => '{--GUEST_CONFIRMED_FAILED--}',
565 // Initialize the user id
568 // Search for an unconfirmed or confirmed account
569 $result = SQL_QUERY_ESC("SELECT `userid`, `refid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `user_hash`='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1",
570 array($hash), __FILE__, __LINE__);
571 if (SQL_NUMROWS($result) == 1) {
572 // Ok, he want's to confirm now so we load some data
573 list($userid, $refid) = SQL_FETCHROW($result);
576 if (!fetchUserData($userid)) {
577 // Not found, should not happen
578 debug_report_bug(__FILE__, __LINE__, 'User account ' . $userid . ' not found.');
581 // Load all data and add points
582 $content = getUserDataArray();
584 // Unlock his account (but only when it is on UNCONFIRMED!)
585 SQL_QUERY_ESC("UPDATE
586 `{?_MYSQL_PREFIX?}_user_data`
588 `status`='CONFIRMED',
589 `ref_payout`={?ref_payout?},
593 `status`='UNCONFIRMED'
595 array($hash), __FILE__, __LINE__);
598 if (!SQL_HASZEROAFFECTED()) {
599 // Send email if updated
600 $message = loadEmailTemplate('guest_user_confirmed', $content, bigintval($userid));
602 // And send him right away the confirmation mail
603 sendEmail($userid, '{--GUEST_THANX_CONFIRM--}', $message);
605 // Maybe he got "referaled"?
606 if (($refid > 0) && ($refid != $userid)) {
607 // Select the referal userid
608 if (fetchUserData($refid)) {
609 // Update ref counter...
610 updateReferalCounter($refid);
612 // If version matches add ref bonus to refid's account
613 if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (isBonusRallyeActive())) {
614 // Add points (directly only!)
615 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_ref`=`bonus_ref`+{?bonus_ref?} WHERE `userid`=%s LIMIT 1",
616 array(bigintval($refid)), __FILE__, __LINE__);
618 // Subtract points from system
619 handleBonusPoints(getConfig('bonus_ref'));
622 // Add one-time referal bonus over referal system or directly
623 // @TODO Try to rewrite the following unset()
624 unset($GLOBALS['ref_level']);
625 addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), true, bigintval($userid), getConfig('reg_points_mode'));
629 if (isExtensionActive('rallye')) {
630 // Add user to rallye (or not?)
631 addUserToReferalRallye(bigintval($userid));
634 // Account confirmed!
635 if (isExtensionActive('lead')) {
636 // Set special lead cookie
637 setSession('lead_userid', bigintval($userid));
639 // Lead-Code mode enabled
640 redirectToUrl('lead-confirm.php');
642 $content['message'] = '{--GUEST_CONFIRMED_DONE--}';
643 $content['userid'] = bigintval($userid);
645 } elseif (isExtensionActive('lead')) {
646 // Set special lead cookie
647 setSession('lead_userid', bigintval($userid));
649 // Lead-Code mode enabled
650 redirectToUrl('lead-confirm.php');
652 // Nobody was found unter this hash key... or our new member want's to confirm twice?
653 $content['message'] = '{--GUEST_CONFIRMED_TWICE--}';
656 // Nobody was found unter this hash key... or our new member want's to confirm twice?
657 $content['message'] = '{--GUEST_CONFIRMED_TWICE--}';
661 displayMessage($content['message']);
664 // Does resend the user's confirmation link for given email address
665 function doResendUserConfirmationLink ($email) {
666 // Email address not registered is default message
667 $message = '{--EMAIL_404--}';
669 // Confirmation link requested
670 if (fetchUserData($email, 'email')) {
671 // Email address found
672 $content = getUserDataArray();
674 // Is the account unconfirmed?
675 if ($content['status'] == 'UNCONFIRMED') {
676 // Load email template
677 $message = loadEmailTemplate('guest_request_confirm', array(), $content['userid']);
680 sendEmail($content['userid'], '{--GUEST_REQUEST_CONFIRM_LINK_SUBJECT--}', $message);
683 // Create message based on the status
684 $message = getConfirmationMessageFromUserStatus($content['status']);
688 displayMessage($message);
691 // Get a message (somewhat translation) from user status for confirmation link.
692 // This is different to translateUserStatus() in text messages.
693 function getConfirmationMessageFromUserStatus ($status) {
694 // Default is 'UNKNOWN'
695 $message = '{%message,GUEST_LOGIN_ID_UNKNOWN_STATUS=' . $status . '%}';
697 // Which status is it?
699 case 'UNCONFIRMED': // Account is unconfirmed
701 $message = '{--GUEST_CONFIRM_LINK_SENT--}';
704 case 'CONFIRMED': // Account already confirmed
705 $message = '{--GUEST_LOGIN_ID_CONFIRMED--}';
708 case 'LOCKED': // Account is locked
709 $message = '{--GUEST_LOGIN_ID_LOCKED--}';
712 default: // This should not happen
713 debug_report_bug(__FUNCTION__, __LINE__, 'Unknown user status ' . $status . ' detected.');
721 // Expression call-back function for fetching user data
722 function doExpressionUser ($data) {
723 // Use current userid by default
724 $functionName = 'getMemberId()';
726 // User-related data, so is there a userid?
727 if (!empty($data['matches'][4][$data['key']])) {
728 // Do we have a userid or $userid?
729 if ($data['matches'][4][$data['key']] == '$userid') {
731 $functionName = "getFetchedUserData('userid', \$userid, '" . $data['callback'] . "')";
732 } elseif (!empty($data['matches'][4][$data['key']])) {
734 $functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')";
736 } elseif ((!empty($data['callback'])) && (isUserDataValid())) {
737 // "Call-back" alias column for current logged in user's data
738 $functionName = "getUserData('" . $data['callback'] . "')";
741 // Do we have another function to run (e.g. translations)
742 if (!empty($data['extra_func'])) {
743 // Surround the original function call with it
744 $functionName = $data['extra_func'] . '(' . $functionName . ')';
748 $replacer = '{DQUOTE} . ' . $functionName . ' . {DQUOTE}';
750 // Now replace the code
751 $code = replaceExpressionCode($data, $replacer);
753 // Return replaced code
757 // Template call-back function for list_user admin function
758 function doTemplateAdminListUserTitle ($template, $dummy = false) {
759 // Init title with "all accounts"
760 $code = '{--ADMIN_LIST_ALL_ACCOUNTS--}';
762 // Do we have a 'status' or 'mode' set?
763 if (isGetRequestParameterSet('status')) {
764 // Set title according to the 'status'
765 $code = sprintf("{--ADMIN_LIST_STATUS_%s_ACCOUNTS--}", strtoupper(getRequestParameter('status')));
766 } elseif (isGetRequestParameterSet('mode')) {
767 // Set title according to the "mode"
768 $code = sprintf("{--ADMIN_LIST_MODE_%s_ACCOUNTS--}", strtoupper(getRequestParameter('mode')));