X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fadmin-inc.php;h=8060c156aa8bed72cbda7bd869ada17a563abf34;hp=a0700817fe6433c6cfa8c992365c5ae040afe28e;hb=963e55ca1ea79e255f235e359cde9f7862191dc5;hpb=89edd713e330fd16e8da1edeadfd5046296ff0d2 diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index a0700817fe..8060c156aa 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -32,8 +32,7 @@ ************************************************************************/ // Some security stuff... -if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) -{ +if (!defined('__SECURITY')) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; require($INC); } @@ -390,18 +389,43 @@ LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__); LOAD_TEMPLATE("admin_main_footer"); } // -function ADD_ADMIN_MENU($act, $wht,$return=false) -{ - global $menuDesription, $menuTitle; +function ADD_ADMIN_MENU($act, $wht, $return=false) { + global $menuDesription, $menuTitle, $cacheInstance; + + // Init variables $SUB = false; + $OUT = ""; // Menu descriptions $menuDesription = array(); $menuTitle = array(); + // Is there a cache instance? + if (is_object($cacheInstance)) { + // Create cache name + $cacheName = "admin_".$act."_".$wht."_".GET_LANGUAGE()."_".strtolower(get_session('admin_login')); + + // Is that cache there? + if ($cacheInstance->cache_file($cacheName, true)) { + // Then load it + $data = $cacheInstance->cache_load(); + + // Extract all parts + $OUT = base64_decode($data['output'][0]); + $menuTitle = unserialize(base64_decode($data['title'][0])); + $menuDescription = unserialize(base64_decode($data['descr'][0])); + + // Return or output content? + if ($return) { + return $OUT; + } else { + OUTPUT_HTML($OUT); + } + } // END - if + } // END - if + // Build main menu $result_main = SQL_QUERY("SELECT action, title, descr FROM "._MYSQL_PREFIX."_admin_menu WHERE (what='' OR what IS NULL) ORDER BY sort, id DESC", __FILE__, __LINE__); - $OUT = ""; if (SQL_NUMROWS($result_main) > 0) { $OUT = " @@ -422,13 +446,13 @@ function ADD_ADMIN_MENU($act, $wht,$return=false) if (!$SUB) { // Insert compiled menu title and description - $menuTitle[$menu] = $title; + $menuTitle[$menu] = $title; $menuDesription[$menu] = $descr; } $OUT .= "
 · "; - if (($menu == $act) && (empty($wht))) + if (($menu == $act) && (empty($wht))) { $OUT .= ""; } @@ -437,7 +461,7 @@ function ADD_ADMIN_MENU($act, $wht,$return=false) $OUT .= "["; } $OUT .= $title; - if (($menu == $act) && (empty($wht))) + if (($menu == $act) && (empty($wht))) { $OUT .= ""; } @@ -457,24 +481,19 @@ function ADD_ADMIN_MENU($act, $wht,$return=false)   \n"; - while (list($wht_sub, $title_what, $desc_what) = SQL_FETCHROW($result_what)) - { + while (list($wht_sub, $title_what, $desc_what) = SQL_FETCHROW($result_what)) { // Filename $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $wht_sub); - if ((EXT_IS_ACTIVE("admins")) && (GET_EXT_VERSION("admins") > "0.2")) - { + if ((EXT_IS_ACTIVE("admins")) && (GET_EXT_VERSION("admins") > "0.2")) { $ACL = ADMINS_CHECK_ACL("", $wht_sub); - } - else - { + } else { // ACL is "allow"... hmmm $ACL = true; } $readable = FILE_READABLE($INC); - if ($ACL) - { + if ($ACL) { // Insert compiled title and description - $menuTitle[$wht_sub] = $title_what; + $menuTitle[$wht_sub] = $title_what; $menuDesription[$wht_sub] = $desc_what; $OUT .= "
@@ -535,6 +554,25 @@ function ADD_ADMIN_MENU($act, $wht,$return=false) $eval = "\$OUT = \"".COMPILE_CODE(addslashes($OUT))."\";"; eval($eval); + // Is there a cache instance again? + if (is_object($cacheInstance)) { + // Init cache + $cacheInstance->cache_init($cacheName); + + // Prepare cache data + $data = array( + 'output' => base64_encode($OUT), + 'title' => $menuTitle, + 'descr' => $menuDesription + ); + + // Write the data away + $cacheInstance->add_row($data); + + // Close cache + $cacheInstance->cache_close(); + } // END - if + // Return or output content? if ($return) { return $OUT;