]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/admin-inc.php
Security line in all includes changed
[mailer.git] / inc / modules / admin / admin-inc.php
index a0700817fe6433c6cfa8c992365c5ae040afe28e..8060c156aa8bed72cbda7bd869ada17a563abf34 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
  ************************************************************************/
 
 // 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);
 }
        $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");
 }
 //
        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;
        $SUB = false;
+       $OUT = "";
 
        // Menu descriptions
        $menuDesription = array();
        $menuTitle = array();
 
 
        // 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__);
        // 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 (SQL_NUMROWS($result_main) > 0)
        {
                $OUT = "<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"admin_menu_main\">
@@ -422,13 +446,13 @@ function ADD_ADMIN_MENU($act, $wht,$return=false)
                                if (!$SUB)
                                {
                                        // Insert compiled menu title and description
                                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>&nbsp;<STRONG>&middot;</STRONG>&nbsp;";
                                        $menuDesription[$menu] = $descr;
                                }
                                $OUT .= "<TR>
        <TD class=\"admin_menu\" colspan=\"2\">
                <NOBR>&nbsp;<STRONG>&middot;</STRONG>&nbsp;";
-                                       if (($menu == $act) && (empty($wht)))
+                               if (($menu == $act) && (empty($wht)))
                                {
                                        $OUT .= "<STRONG>";
                                }
                                {
                                        $OUT .= "<STRONG>";
                                }
@@ -437,7 +461,7 @@ function ADD_ADMIN_MENU($act, $wht,$return=false)
                                        $OUT .= "[<A href=\"".URL."/modules.php?module=admin&amp;action=".$menu."\">";
                                }
                                $OUT .= $title;
                                        $OUT .= "[<A href=\"".URL."/modules.php?module=admin&amp;action=".$menu."\">";
                                }
                                $OUT .= $title;
-                                       if (($menu == $act) && (empty($wht)))
+                               if (($menu == $act) && (empty($wht)))
                                {
                                        $OUT .= "</STRONG>";
                                }
                                {
                                        $OUT .= "</STRONG>";
                                }
@@ -457,24 +481,19 @@ function ADD_ADMIN_MENU($act, $wht,$return=false)
        <TD width=\"10\" class=\"seperator\">&nbsp;</TD>
        <TD class=\"admin_menu\">
                <TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"admin_menu_sub\">\n";
        <TD width=\"10\" class=\"seperator\">&nbsp;</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);
                                                // 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);
                                                        $ACL = ADMINS_CHECK_ACL("", $wht_sub);
-                                               }
-                                                else
-                                               {
+                                               } else {
                                                        // ACL is "allow"... hmmm
                                                        $ACL = true;
                                                }
                                                $readable = FILE_READABLE($INC);
                                                        // ACL is "allow"... hmmm
                                                        $ACL = true;
                                                }
                                                $readable = FILE_READABLE($INC);
-                                               if ($ACL)
-                                               {
+                                               if ($ACL) {
                                                        // Insert compiled title and description
                                                        // 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\">
                                                        $menuDesription[$wht_sub] = $desc_what;
                                                        $OUT .= "<TR>
        <TD class=\"admin_menu\" colspan=\"2\">
@@ -535,6 +554,25 @@ function ADD_ADMIN_MENU($act, $wht,$return=false)
        $eval = "\$OUT = \"".COMPILE_CODE(addslashes($OUT))."\";";
        eval($eval);
 
        $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;
        // Return or output content?
        if ($return) {
                return $OUT;