More XHTML-fied and extended header added to templates
[mailer.git] / inc / loader / load_cache-modreg.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 09/09/2008 *
4  * ===============                              Last change: 09/09/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : load_cache-config.php                            *
8  * -------------------------------------------------------------------- *
9  * Short description : Load more cache files                            *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Mehr Cache-Dateien nachladen                     *
12  * -------------------------------------------------------------------- *
13  * $Revision:: 856                                                    $ *
14  * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. March 2009)             $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author:: stelzi                                                   $ *
17  * Needs to be in all Files and every File needs "svn propset           *
18  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
19  * -------------------------------------------------------------------- *
20  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
21  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
42         require($INC);
43 }
44
45 // Next cached table is the module registry (mod_reg)...
46 if (($GLOBALS['cache_instance']->loadCacheFile("modreg")) && ($GLOBALS['cache_instance']->extensionVersionMatches("sql_patches"))) {
47         // Load cache
48         $GLOBALS['cache_array']['modules'] = $GLOBALS['cache_instance']->getArrayFromCache();
49
50         // Rewrite module cache
51         $modArray = $GLOBALS['cache_array']['modules'];
52         foreach ($modArray['module'] as $key => $mod) {
53                 $GLOBALS['cache_array']['modules']['id'][$mod] = $modArray['id'][$key];
54                 unset($GLOBALS['cache_array']['modules']['id'][$key]);
55                 $GLOBALS['cache_array']['modules']['title'][$mod] = $modArray['title'][$key];
56                 unset($GLOBALS['cache_array']['modules']['title'][$key]);
57                 $GLOBALS['cache_array']['modules']['locked'][$mod] = $modArray['locked'][$key];
58                 unset($GLOBALS['cache_array']['modules']['locked'][$key]);
59                 $GLOBALS['cache_array']['modules']['hidden'][$mod] = $modArray['hidden'][$key];
60                 unset($GLOBALS['cache_array']['modules']['hidden'][$key]);
61                 $GLOBALS['cache_array']['modules']['admin_only'][$mod] = $modArray['admin_only'][$key];
62                 unset($GLOBALS['cache_array']['modules']['admin_only'][$key]);
63                 $GLOBALS['cache_array']['modules']['mem_only'][$mod] = $modArray['mem_only'][$key];
64                 unset($GLOBALS['cache_array']['modules']['mem_only'][$key]);
65                 if (isset($GLOBALS['cache_array']['modules']['has_menu'][$key])) {
66                         $GLOBALS['cache_array']['modules']['has_menu'][$mod] = $modArray['has_menu'][$key];
67                         unset($GLOBALS['cache_array']['modules']['has_menu'][$key]);
68                 } // END - if
69         } // END - foreach
70         unset($modArray);
71 } elseif ((getConfig('cache_modreg') == "Y") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
72         // Create cache file here
73         $GLOBALS['cache_instance']->init("MODULES");
74         $GLOBALS['cache_instance']->storeExtensionVersion("sql_patches");
75
76         // Load all modules and their data
77         if (GET_EXT_VERSION("sql_patches") >= "0.3.6") {
78                 // Load has_menu
79                 $result = SQL_QUERY("SELECT id, module, title, locked, hidden, admin_only, title, mem_only, has_menu
80 FROM `{!_MYSQL_PREFIX!}_mod_reg` ORDER BY `id`", __FILE__, __LINE__);
81         } else {
82                 // Don't load has_menu
83                 $result = SQL_QUERY("SELECT id, module, title, locked, hidden, admin_only, title, mem_only
84 FROM `{!_MYSQL_PREFIX!}_mod_reg` ORDER BY `id`", __FILE__, __LINE__);
85         }
86
87         // Cache all data
88         while ($data = SQL_FETCHARRAY($result)) {
89                 // Add row to cache file
90                 $GLOBALS['cache_instance']->addRow($data);
91         } // END - while
92
93         // Free memory
94         SQL_FREERESULT($result);
95
96         // Close the cache
97         $GLOBALS['cache_instance']->finalize();
98
99         // Include loader again
100         require(__FILE__);
101 }
102
103 //
104 ?>