X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Floader%2Fload-admins.php;h=c27872e694661bd322349fef856c4117c3597c00;hp=448c283e1c3adab9598318dc69c375e126986c03;hb=4373e155854012d687fdfcae4c69d1a940883fab;hpb=0f3a135204757cc8750262871c8e62c42300acb4 diff --git a/inc/loader/load-admins.php b/inc/loader/load-admins.php index 448c283e1c..c27872e694 100644 --- a/inc/loader/load-admins.php +++ b/inc/loader/load-admins.php @@ -10,14 +10,9 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Mehr Cache-Dateien nachladen * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2013 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -38,9 +33,10 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif (isInstallationPhase()) { - // Use this code if you don't want to run this cache loader on installation phase - return; +} elseif (isInstaller()) { + // Do not run in installation phase + //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Run from installation phase.'); + return FALSE; } // Let's start with the admins table... @@ -57,7 +53,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('admin')) && ($GLOBALS['cache_ins foreach ($GLOBALS['cache_array']['admin']['login'] as $idx => $admin) { // Rewrite all entries foreach ($GLOBALS['cache_array']['admin'] as $key => $entry) { - // Do we have login or regular entries? + // Is there login or regular entries? if ($key == 'admin_id') { // Admin id, so use login $admins[$key][$GLOBALS['cache_array']['admin']['login'][$idx]] = $entry[$idx]; @@ -81,7 +77,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('admin')) && ($GLOBALS['cache_ins $GLOBALS['cache_instance']->removeCacheFile(); unset($GLOBALS['cache_array']['admin']); } -} elseif (isHtmlOutputMode()) { +} elseif ((isHtmlOutputMode()) || (isAjaxOutputMode()) || (isRawOutputMode())) { // Create cache file $GLOBALS['cache_instance']->init(); @@ -89,19 +85,23 @@ if (($GLOBALS['cache_instance']->loadCacheFile('admin')) && ($GLOBALS['cache_ins $add = runFilterChain('sql_admin_extra_data'); // Query the database about this - $result = SQL_QUERY('SELECT - `id` AS admin_id, `login`,`password`,`email`' . $add . ' + $result = sqlQuery('SELECT + `id` AS `admin_id`, + `login`, + `password`, + `email` + ' . $add . ' FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `login` ASC', __FILE__, __LINE__); - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Save row $GLOBALS['cache_instance']->addRow($row); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close cache $GLOBALS['cache_instance']->storeExtensionVersion('admins'); @@ -112,7 +112,7 @@ ORDER BY if (isExtensionInstalledAndNewer('admins', '0.3')) { // Check for cache file if (($GLOBALS['cache_instance']->loadCacheFile('admin_acls')) && ($GLOBALS['cache_instance']->extensionVersionMatches('admins'))) { - // Load referal system from cache + // Load admin ACLs from cache $GLOBALS['cache_array']['admin_acls'] = $GLOBALS['cache_instance']->getArrayFromCache(); // Check if valid @@ -124,10 +124,10 @@ if (isExtensionInstalledAndNewer('admins', '0.3')) { foreach ($GLOBALS['cache_array']['admin_acls']['admin_id'] as $idx => $admin) { // Rewrite all entries foreach ($GLOBALS['cache_array']['admin_acls'] as $key => $entry) { - // Do we have 'admin_id' or regular entries? + // Is there 'admin_id' or regular entries? if ($key != 'admin_id') { // Regular entry so use id - $admins[$key][$GLOBALS['cache_array']['admin_acls']['admin_id'][$idx]][] = $entry[$idx]; + array_push($admins[$key][$GLOBALS['cache_array']['admin_acls']['admin_id'][$idx]], $entry[$idx]); } // END - if } // END - foreach } // END - foreach @@ -148,21 +148,21 @@ if (isExtensionInstalledAndNewer('admins', '0.3')) { // This may drive a lot messages to the logfile //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'No entry found in admin_acls to rewrite.'); } - } elseif (isHtmlOutputMode()) { + } elseif ((isHtmlOutputMode()) || (isAjaxOutputMode()) || (isRawOutputMode())) { // Create cache file here $GLOBALS['cache_instance']->init(); // Load all admins and their data - $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_admins_acls` ORDER BY `admin_id` ASC, `action_menu` ASC, `what_menu` ASC', __FILE__, __LINE__); + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}_admins_acls` ORDER BY `admin_id` ASC,`action_menu` ASC,`what_menu` ASC', __FILE__, __LINE__); // Add all rows - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row to cache file $GLOBALS['cache_instance']->addRow($content); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close cache $GLOBALS['cache_instance']->storeExtensionVersion('admins');