************************************************************************/
// 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);
}
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 = "<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"admin_menu_main\">
if (!$SUB)
{
// Insert compiled menu title and description
- $menuTitle[$menu] = $title;
+ $menuTitle[$menu] = $title;
$menuDesription[$menu] = $descr;
}
$OUT .= "<TR>
<TD class=\"admin_menu\" colspan=\"2\">
<NOBR> <STRONG>·</STRONG> ";
- if (($menu == $act) && (empty($wht)))
+ if (($menu == $act) && (empty($wht)))
{
$OUT .= "<STRONG>";
}
$OUT .= "[<A href=\"".URL."/modules.php?module=admin&action=".$menu."\">";
}
$OUT .= $title;
- if (($menu == $act) && (empty($wht)))
+ if (($menu == $act) && (empty($wht)))
{
$OUT .= "</STRONG>";
}
<TD width=\"10\" class=\"seperator\"> </TD>
<TD class=\"admin_menu\">
<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"admin_menu_sub\">\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 .= "<TR>
<TD class=\"admin_menu\" colspan=\"2\">
$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;