X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=afd26d2bda99bc98233e00d388feda84281a292f;hp=af1420e77eadad4541423c93838bdeb7db71fd63;hb=1c62a6c2a4ed2bb170e0f1888899625e67a27947;hpb=537df432292cb0aa63070479258e3e84b182a28b diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index af1420e77e..afd26d2bda 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 * @@ -125,7 +123,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) { } // Begin the navigation line - if ((!isset($GLOBALS['nav_depth'])) && ($return === false)) { + if (!isset($GLOBALS['nav_depth'])) { // Init nav_depth $GLOBALS['nav_depth'] = '0'; @@ -147,7 +145,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) { if (substr($search, -4, 4) == '.php') { // Remove the .php $search = substr($search, 0, -4); - } // END - i + } // END - if if (((isExtensionInstalledAndNewer('sql_patches', '0.2.3')) && (getConfig('youre_here') == 'Y')) || ((isAdmin()) && ($modCheck == 'admin'))) { // Output HTML code @@ -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()) { @@ -454,7 +452,6 @@ function fetchUserData ($userid, $column = 'userid') { return true; } - // By default none was found $found = false; @@ -541,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'])) { @@ -569,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" @@ -717,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()) { @@ -825,7 +822,7 @@ function getPaymentTitlePrice ($pid, $full=false) { if ($full === false) { $ret = $data['mail_title']; } else { - $ret = $data['mail_title'] . ' / ' . translateComma($data['price']) . ' {?POINTS?}'; + $ret = $data['mail_title'] . ' / {%pipe,translateComma=' . $data['price' . '%} {?POINTS?}'; } } @@ -864,7 +861,7 @@ function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = '', $ $ret = 'failed'; // Is the userid valid? - if ($userid > 0) { + if (isValidUserId($userid)) { // Remove entry from array unset($receivers[$key]); @@ -989,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 @@ -1020,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; @@ -1062,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, @@ -1095,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 ); @@ -1107,7 +1105,10 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify // And sent it away sendEmail($userid, '{--DIRECT_PAYMENT_SUBJECT--}', $message); - if (!isGetRequestParameterSet('mid')) loadTemplate('admin_settings_saved', false, '{--ADMIN_POINTS_ADDED--}'); + if (!isGetRequestParameterSet('mid')) { + // Output message to admin + loadTemplate('admin_settings_saved', false, '{--ADMIN_POINTS_ADDED--}'); + } // END - if } // Maybe there's another ref? @@ -1377,11 +1378,11 @@ function getAdminDefaultAcl ($adminId) { } // Generates an option list from various parameters -function generateOptionList ($table, $id, $name, $default='', $special='', $where='', $disabled=array()) { +function generateOptionList ($table, $id, $name, $default = '', $special = '', $where = '', $disabled = array(), $callback = '') { $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 .= ''; } // END - while } else { @@ -1651,7 +1670,7 @@ function generateCategoryOptionsList ($mode) { } // END - foreach } else { // No cateogries are defined yet - $OUT = ''; + $OUT = ''; } // Return HTML code