X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=885b670ce1f68ded7d59f5e24be56f7ee4a0ee77;hb=07af932574589f4906be5ebf6733fdb95f30e9a2;hp=665dc6946b87365f678c02b00e268dc8aa003d75;hpb=98b92ea5ba992a63304091fa1b57f477befffc22;p=mailer.git diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 665dc6946b..885b670ce1 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -14,8 +14,6 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009, 2010 by Mailer Developer Team * @@ -262,7 +260,7 @@ ORDER BY $OUT .= ''; } else { // Not found! - open - $OUT .= ''; + $OUT .= ''; } // Menu title @@ -371,10 +369,10 @@ function isMember () { if ((!isset($GLOBALS['last_online'])) || (!is_array($GLOBALS['last_online']))) $GLOBALS['last_online'] = array(); // is the cache entry there? - if (isset($GLOBALS['is_member'])) { + if (isset($GLOBALS[__FUNCTION__])) { // Then return it - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'CACHED! (' . intval($GLOBALS['is_member']) . ')'); - return $GLOBALS['is_member']; + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'CACHED! (' . intval($GLOBALS[__FUNCTION__]) . ')'); + return $GLOBALS[__FUNCTION__]; } elseif ((!isSessionVariableSet('userid')) || (!isSessionVariableSet('u_hash'))) { // No member //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'No member set in cookie/session.'); @@ -424,7 +422,7 @@ function isMember () { } // Cache status - $GLOBALS['is_member'] = $ret; + $GLOBALS[__FUNCTION__] = $ret; // Return status //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . intval($ret)); @@ -442,7 +440,7 @@ function fetchUserData ($userid, $column = 'userid') { setCurrentUserId($userid); // Don't look for invalid userids... - if ($userid < 1) { + if (!isValidUserId($userid)) { // Invalid, so abort here debug_report_bug(__FUNCTION__, __LINE__, 'User id ' . $userid . ' is invalid.'); } elseif (isUserDataValid()) { @@ -540,9 +538,9 @@ function isAdmin () { } // END - if // Do we have cache? - if (!isset($GLOBALS['is_admin'][$adminId])) { + if (!isset($GLOBALS[__FUNCTION__][$adminId])) { // Init it with failed - $GLOBALS['is_admin'][$adminId] = false; + $GLOBALS[__FUNCTION__][$adminId] = false; // Search in array for entry if (isset($GLOBALS['admin_hash'])) { @@ -568,12 +566,12 @@ function isAdmin () { if (!empty($valPass)) { // Check if password is valid //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '(' . $valPass . '==' . $passCookie . ')='.intval($valPass == $passCookie)); - $GLOBALS['is_admin'][$adminId] = (($GLOBALS['admin_hash'] == $passCookie) || ((strlen($GLOBALS['admin_hash']) == 32) && ($GLOBALS['admin_hash'] == md5($passCookie))) || (($GLOBALS['admin_hash'] == '*FAILED*') && (!isExtensionActive('cache')))); + $GLOBALS[__FUNCTION__][$adminId] = (($GLOBALS['admin_hash'] == $passCookie) || ((strlen($GLOBALS['admin_hash']) == 32) && ($GLOBALS['admin_hash'] == md5($passCookie))) || (($GLOBALS['admin_hash'] == '*FAILED*') && (!isExtensionActive('cache')))); } // END - if } // END - if // Return result of comparision - return $GLOBALS['is_admin'][$adminId]; + return $GLOBALS[__FUNCTION__][$adminId]; } // Generates a list of "max receiveable emails per day" @@ -716,7 +714,7 @@ function getActionFromModuleWhat ($module, $what) { // Init status $data['action'] = ''; - //* DEBUG: */ debugOutput(__LINE__.'='.$module.'/'.$what.'/'.getAction().'='); + //* DEBUG: */ debugOutput(__LINE__ . '=' . $module . '/'.$what . '/' . getAction() . '='); if (!isExtensionInstalledAndNewer('sql_patches', '0.0.5')) { // sql_patches is missing so choose depending on mode if (isWhatSet()) { @@ -988,7 +986,7 @@ function getReferalLevelPercents ($level) { * Dynamic referal system, can also send mails! * * subject = Subject line, write in lower-case letters and underscore is allowed - * userid = Referal id wich should receive... + * userid = Referal id wich should receive... * points = ... xxx points * sendNotify = shall I send the referal an email or not? * refid = inc/modules/guest/what-confirm.php need this @@ -1019,15 +1017,20 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '): Referal level increased. DEPTH='.$GLOBALS['ref_level']); } - // Default is 'normal' points - $data = 'points'; - - // Which points, locked or normal? - if ($locked === true) $data = 'locked_points'; - // Check user account //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):userid='.$userid.',points='.$points); if (fetchUserData($userid)) { + // Determine wether the user has some mails to click before he/she gets the points + $locked = ifUserPointsLocked($userid); + + // Default is 'normal' points + $data = 'points'; + + // Which points, locked or normal? + if ($locked === true) { + $data = 'locked_points'; + } // END - if + // This is the user and his ref $GLOBALS['cache_array']['add_userid'][getUserData('refid')] = $userid; @@ -1061,10 +1064,6 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):data='.$data.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$add_mode.' - INSERTED! ('.SQL_AFFECTEDROWS().')'); } // END - if - // Determine wether the user has some mails to click before he/she gets the points - $locked = false; - if ((getUserData('ref_payout') > 0) && (!isDirectPaymentAllowed())) $locked = true; - // Prepare data for the filter $filterData = array( 'subject' => $subject, @@ -1094,10 +1093,10 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify // Send email sendEmail($userid, '{--THANX_REFERAL_ONE_SUBJECT--}', $message); - } elseif (($sendNotify === true) && (getUserData('refid') == '0') && ($locked === false) && ($add_mode == 'direct')) { + } elseif (($sendNotify === true) && (!isValidUserId(getUserData('refid'))) && ($locked === false) && ($add_mode == 'direct')) { // Prepare content $content = array( - 'text' => '{--REASON_DIRECT_PAYMENT--}', + 'reason' => '{--REASON_DIRECT_PAYMENT--}', 'points' => $ref_points ); @@ -1383,7 +1382,7 @@ function generateOptionList ($table, $id, $name, $default = '', $special = '', $ $ret = ''; if ($table == '/ARRAY/') { // Selection from array - if ((is_array($id)) && (is_array($name)) && (count($id)) == (count($name))) { + if ((is_array($id)) && (is_array($name)) && ((count($id)) == (count($name)) || (!empty($callback)))) { // Both are arrays foreach ($id as $idx => $value) { $ret .= ''; + $OUT = ''; } // Return HTML code