// Shall I test for a main or sub menu? (action or what?)
$acl_mode = "failed";
- if (GET_EXT_VERSION("cache") >= "0.1.2") {
+ if ((GET_EXT_VERSION("cache") >= "0.1.2") && (count($GLOBALS['cache_array']['admin_acls']) > 0)) {
// Lookup in cache
if ((!empty($act)) && (isset($GLOBALS['cache_array']['admin_acls']['action_menu'][$aid])) & ($GLOBALS['cache_array']['admin_acls']['action_menu'][$aid] == $act)) {
// Main menu line found
// Count cache hits
incrementConfigEntry('cache_hits');
}
- } else {
+ } elseif (!EXT_IS_ACTIVE("cache")) {
// Old version, so load it from database
if (!empty($act)) {
// Main menu
// Destroy the cache on extension changes
function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($data) {
+ // Return the data anyway if there is no cache extension
+ if (!isCacheInstanceValid()) return $data;
+
// Remove cache
if ($GLOBALS['cache_instance']->loadCacheFile("config")) $GLOBALS['cache_instance']->destroyCacheFile();
if ($GLOBALS['cache_instance']->loadCacheFile("extensions")) $GLOBALS['cache_instance']->destroyCacheFile();
// Destroy the cache on changing admin
function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE () {
+ // Skip this step if the cache instance is not there
+ if (!isCacheInstanceValid()) return false;
+
// Remove cache
if ($GLOBALS['cache_instance']->loadCacheFile("admins")) $GLOBALS['cache_instance']->destroyCacheFile();
}
// Destroy all cache files
function FILTER_CACHE_DESTROY_ALL () {
+ // Skip this step if the cache instance is not there
+ if (!isCacheInstanceValid()) return false;
+
// Remove cache files
if ($GLOBALS['cache_instance']->loadCacheFile("admins")) $GLOBALS['cache_instance']->destroyCacheFile();
if ($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) $GLOBALS['cache_instance']->destroyCacheFile();
ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins_mails` SET admin_id=%s WHERE id=%s ORDER BY `id` LIMIT 1",
array($content['admin_id'], $id), __FILE__, __LINE__, false));
- if (($content['admin_id'] < 1) && (REQUEST_ISSET_POST(('template', $id)))) {
+ if (($content['admin_id'] < 1) && (REQUEST_ISSET_POST('template', $id))) {
// Remove any other admin entries
ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admins_mails` WHERE mail_template='%s' AND id != '%s'",
array(REQUEST_POST('template', $id), $id), __FILE__, __LINE__, false));
- }
+ } // END - if
if (REQUEST_POST('admin_new', REQUEST_POST('template', $id)) > 0) {
// Add new admin
ADD_SQL(SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_admins_mails` (admin_id, mail_template) VALUES ('%s','%s')",
array($content['admin_id'], REQUEST_POST('template', $id)), __FILE__, __LINE__, false));
- }
- }
+ } // END - if
+ } // END - foreach
// Run all queries
runFilterChain('run_sqls');
// Query again...
$result = SQL_QUERY("SELECT DISTINCT m.id, m.admin_id, a.login, m.mail_template FROM `{!_MYSQL_PREFIX!}_admins_mails` AS m, `{!_MYSQL_PREFIX!}_admins` AS a WHERE m.admin_id=a.id OR m.admin_id < 1 ORDER BY m.admin_id", __FILE__, __LINE__);
- }
+ } // END - if
// List found entries
$OUT = ""; $SW = 2;
// Load row template
$OUT .= LOAD_TEMPLATE("admin_admins_mails_list_row", true, $content);
$SW = 3 - $SW;
- }
+ } // END - while
// Free result
SQL_FREERESULT($result);