]> git.mxchange.org Git - mailer.git/blobdiff - inc/loader/load-admins.php
Heacy rewrite/cleanup:
[mailer.git] / inc / loader / load-admins.php
index c7111d689d3bca89ec7cc563ca87703c74c41b88..18c65bd2ecbd4bf68c055b7296a66dc1ea766a7f 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * 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 *
 // 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 +58,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 +82,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,7 +90,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('admin')) && ($GLOBALS['cache_ins
        $add = runFilterChain('sql_admin_extra_data');
 
        // Query the database about this
-       $result = SQL_QUERY('SELECT
+       $result = sqlQuery('SELECT
        `id` AS `admin_id`,
        `login`,
        `password`,
@@ -99,13 +100,13 @@ 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');
@@ -128,10 +129,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
@@ -152,21 +153,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');