X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=ccda58a7a7ae4fafcdaae85e3a8e4147267c41e2;hb=aee03a72f6131ee51374e17b05f8c712e4604776;hp=c26a12b991c15b93a9df2ac7756cf8b79b7fca2f;hpb=6a7be5e69b894d458efd287698882a0291ee2fe0;p=mailer.git diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index c26a12b991..ccda58a7a7 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -10,11 +10,6 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Alle datenbank-relevanten Funktionen * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009 - 2013 by Mailer Developer Team * * For more information visit: http://mxchange.org * @@ -572,16 +567,20 @@ function fetchUserData ($value, $column = 'userid') { * login. */ function isAdmin () { + //* DIE: */ reportBug(__FUNCTION__, __LINE__, 'CALLED!'); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'CALLED!'); + // Is there cache? if (isset($GLOBALS[__FUNCTION__])) { // Return it - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isAdmin()=' . intval($GLOBALS[__FUNCTION__])); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isAdmin()=' . intval($GLOBALS[__FUNCTION__]) . ' - CACHED!'); return $GLOBALS[__FUNCTION__]; } // END - if - // No admin in installation phase! if ((isInstaller()) || (!isAdminRegistered())) { + // No admin in installation phase! $GLOBALS[__FUNCTION__] = FALSE; + //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isAdmin()=' . intval($GLOBALS[__FUNCTION__]) . ' - INSTALLER!'); return FALSE; } // END - if @@ -589,20 +588,23 @@ function isAdmin () { $ret = FALSE; $adminId = '0'; $passwordFromCookie = ''; - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminId); // If admin login is not given take current from cookies... + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isSessionVariableSet(admin_id)=' . intval(isSessionVariableSet('admin_id')) . ',isSessionVariableSet(admin_md5)=' . intval(isSessionVariableSet('admin_md5'))); if ((isSessionVariableSet('admin_id')) && (isSessionVariableSet('admin_md5'))) { + // Debug message + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Getting admin data from session ...'); + // Get admin login and password from session/cookies $adminId = getCurrentAdminId(); $passwordFromCookie = getAdminMd5(); } // END - if - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminId=' . $adminId . ',passwordFromCookie=' . $passwordFromCookie); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminId=' . $adminId . ',passwordFromCookie=' . $passwordFromCookie); // Abort if admin id is zero if (($adminId == '0') || (empty($passwordFromCookie))) { // A very noisy debug message ... - //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Current adminId is zero. isSessionVariableSet(admin_id)=' . intval(isSessionVariableSet('admin_id')) . ',isSessionVariableSet(admin_md5)=' . intval(isSessionVariableSet('admin_md5'))); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Current adminId is zero. isSessionVariableSet(admin_id)=' . intval(isSessionVariableSet('admin_id')) . ',isSessionVariableSet(admin_md5)=' . intval(isSessionVariableSet('admin_md5'))); // Abort here now $GLOBALS[__FUNCTION__] = FALSE; @@ -615,26 +617,26 @@ function isAdmin () { // Search in array for entry if (isset($GLOBALS['admin_hash'])) { // Use cached string - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using admin_hash=' . $GLOBALS['admin_hash'] . ' from cache'); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using admin_hash=' . $GLOBALS['admin_hash'] . ' from cache'); } elseif ((!empty($adminId)) && (!empty($passwordFromCookie)) && (isAdminHashSet($adminId) === TRUE)) { // Get admin hash and hash it $GLOBALS['admin_hash'] = encodeHashForCookie(getAdminHash($adminId)); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'valPass=' . $GLOBALS['admin_hash']); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'valPass=' . $GLOBALS['admin_hash']); // Count cache hits incrementStatsEntry('cache_hits'); } elseif ((!empty($adminId)) && ((!isExtensionActive('cache')) || (isAdminHashSet($adminId) === FALSE))) { // Get admin hash and hash it $GLOBALS['admin_hash'] = encodeHashForCookie(getAdminHash($adminId)); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'valPass=' . $GLOBALS['admin_hash']); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'valPass=' . $GLOBALS['admin_hash']); } // Check if password is valid - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '(' . $GLOBALS['admin_hash'] . '==' . $passwordFromCookie . ')='.intval($GLOBALS['admin_hash'] == $passwordFromCookie)); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '(' . $GLOBALS['admin_hash'] . '==' . $passwordFromCookie . ')='.intval($GLOBALS['admin_hash'] == $passwordFromCookie)); $GLOBALS[__FUNCTION__] = ((!empty($GLOBALS['admin_hash'])) && ($GLOBALS['admin_hash'] == $passwordFromCookie)); // Return result of comparision - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isAdmin()=' . intval($GLOBALS[__FUNCTION__])); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isAdmin()=' . intval($GLOBALS[__FUNCTION__])); return $GLOBALS[__FUNCTION__]; } @@ -658,7 +660,7 @@ function addMaxReceiveList ($mode, $default = '') { break; default: // Invalid! - logDebugMessage(__FUNCTION__, __LINE__, sprintf("Invalid mode %s detected.", $mode)); + logDebugMessage(__FUNCTION__, __LINE__, sprintf('Invalid mode %s detected.', $mode)); break; } @@ -1789,7 +1791,7 @@ function generateReceiverList ($categoryId, $receiver, $mode = '') { if (isValidId($categoryId)) { // Select category $extraColumns = "LEFT JOIN `{?_MYSQL_PREFIX?}_user_cats` AS `c` ON `d`.`userid`=`c`.`userid`"; - $addWhere = sprintf(" AND `c`.`cat_id`=%s", $categoryId); + $addWhere = sprintf(' AND `c`.`cat_id`=%s', $categoryId); } // END - if // Exclude users in holiday? @@ -2188,7 +2190,7 @@ function doGenericEditEntriesConfirm ($tableName, $columns = array(), $filterFun $content = array(); // Prepare SQL for this row - $sql = sprintf("UPDATE `{?_MYSQL_PREFIX?}_%s` SET", + $sql = sprintf('UPDATE `{?_MYSQL_PREFIX?}_%s` SET', sqlEscapeString($tableName[0]) );