X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fuser_functions.php;h=e9a14776500636d76220c3c81fab3a8fa7242a64;hb=397daebbe84c443a220724a1a63e74945a1f0a30;hp=09dc679ba2d9201bb24deaa50931e1839af08001;hpb=dc25bd7a76750f02e2d617c9db9eb0aae53270f5;p=mailer.git diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 09dc679ba2..e9a1477650 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -42,9 +42,15 @@ if (!defined('__SECURITY')) { // Add links for selecting some users function alpha ($sortby, $colspan, $return=false) { - if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', 0); + if (!isGetRequestParameterSet('offset')) { + setGetRequestParameter('offset', 0); + } // END - if $add = '&page=' . getRequestParameter('page').'&offset=' . getRequestParameter('offset'); - if (isGetRequestParameterSet('mode')) $add .= '&mode=' . getRequestParameter('mode'); + foreach (array('mode','status') as $param) { + if (isGetRequestParameterSet($param)) { + $add .= '&' . $param . '=' . getRequestParameter($param); + } // END - if + } // END - foreach /* Creates the list of letters and makes them a link. */ $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,'); @@ -57,7 +63,11 @@ function alpha ($sortby, $colspan, $return=false) { } else { // Output link to letter $OUT .= '' . $ltr . ''; } @@ -94,9 +104,12 @@ function addSortLinks ($letter, $sortby, $colspan, $return=false) { // Add page and offset $add = '&page=' . getRequestParameter('page') . '&offset=' . getRequestParameter('offset'); - // Add status or mode - if (isGetRequestParameterSet('status')) $add .= '&mode=' . getRequestParameter('status'); - elseif (isGetRequestParameterSet('mode')) $add .= '&mode=' . getRequestParameter('mode'); + // Add status/ mode + foreach (array('mode','status') as $param) { + if (isGetRequestParameterSet($param)) { + $add .= '&' . $param . '=' . getRequestParameter($param); + } // END - if + } // END - foreach // Makes order by links.. if ($letter == 'front') { @@ -165,9 +178,12 @@ function addPageNavigation ($numPages, $offset, $showForm, $colspan, $return=fal // Base link $OUT .= ''; @@ -234,7 +250,7 @@ LIMIT 1", // @TODO Double-check configuration entry here function determineRandomReferalId () { // Default is zero refid - $refid = null; + $refid = NULL; // Is the extension version fine? if (isExtensionInstalledAndNewer('user', '0.3.4')) { @@ -256,8 +272,7 @@ function determineRandomReferalId () { list($refid) = SQL_FETCHROW($result); // Reset all users, this makes this random referal id more challenging - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0", - array($refid), __FUNCTION__, __LINE__); + SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0', __FUNCTION__, __LINE__); } // END - if // Free result @@ -544,7 +559,7 @@ function insertUserStatsRecord ($userid, $statsType, $statsData) { // Does it exist? if ((!getEpocheTimeFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) { // Then insert it! - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')", + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`, `stats_type`, `stats_data`) VALUES (%s,'%s','%s')", array( bigintval($userid), $statsType, @@ -622,7 +637,7 @@ LIMIT 1", // Add one-time referal bonus over referal system or directly initReferalSystem(); - addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), true, bigintval($userid), getConfig('reg_points_mode')); + addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), bigintval($userid)); } // END - if } // END - if @@ -730,7 +745,13 @@ function doExpressionUser ($data) { // Use dynamic call $functionName = "getFetchedUserData('userid', \$userid, '" . $data['callback'] . "')"; } elseif (!empty($data['matches'][4][$data['key']])) { - // User data found + // Do we have a number or a dollar sign in front of it? + if (preg_replace('/[^0123456789]/', '', $data['matches'][4][$data['key']]) != $data['matches'][4][$data['key']]) { + // Possible database column, so get it again + $data['matches'][4][$data['key']] = "getFetchedUserData('userid', getMemberId(), '" . $data['matches'][4][$data['key']] . "')"; + } // END - if + + // Fix all together $functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')"; } } elseif ((!empty($data['callback'])) && (isUserDataValid())) { @@ -743,6 +764,7 @@ function doExpressionUser ($data) { // Surround the original function call with it $functionName = $data['extra_func'] . '(' . $functionName . ')'; } // END - if + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'functionName=' . $functionName); // Generate replacer $replacer = '{DQUOTE} . ' . $functionName . ' . {DQUOTE}';