More improved SQL queries
[mailer.git] / inc / modules / admin / what-config_cache.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 01/29/2006 *
4  * ================                             Last change: 01/29/2006 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-config_cache.php                            *
8  * -------------------------------------------------------------------- *
9  * Short description : Configuration for the caching system             *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Konfiguration des Caching-Systems                *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Add description as navigation point
41 ADD_DESCR("admin", __FILE__);
42
43 if (isset($_POST['ok'])) {
44         // Cache path has been not changed by default so don't test it again
45         $_POST['cache_tested'] = "N";
46
47         // Check if path has been changed
48         if ($_POST['cache_path'] != getConfig('cache_path')) {
49                 // Okay, cache path has been altered so we have to test it again!
50                 $_POST['cache_tested'] = "Y";
51         }
52
53         // Delete deactivated cache files
54         if (($_POST['cache_admins'] == "N") && ($cacheInstance->loadCacheFile("admins"))) {
55                 $cacheInstance->destroyCacheFile();
56         }
57         if (($_POST['cache_acls'] == "N") && ($cacheInstance->loadCacheFile("acls"))) {
58                 $cacheInstance->destroyCacheFile();
59         }
60         if (($_POST['cache_exts'] == "N") && ($cacheInstance->loadCacheFile("extensions", true))) {
61                 $cacheInstance->destroyCacheFile();
62         }
63         if (($_POST['cache_config'] == "N") && ($cacheInstance->loadCacheFile("config"))) {
64                 $cacheInstance->destroyCacheFile();
65         }
66         if (($_POST['cache_modreg'] == "N") && ($cacheInstance->loadCacheFile("modreg"))) {
67                 $cacheInstance->destroyCacheFile();
68         }
69         if (($_POST['cache_refdepth'] == "N") && ($cacheInstance->loadCacheFile("refdepth"))) {
70                 $cacheInstance->destroyCacheFile();
71         }
72         if (($_POST['cache_refsys'] == "N") && ($cacheInstance->loadCacheFile("refsys"))) {
73                 $cacheInstance->destroyCacheFile();
74         }
75
76         // Save configuration
77         ADMIN_SAVE_SETTINGS($_POST);
78 } else {
79         // Prepare data
80         switch (getConfig('cache_admins')) {
81                 case "Y":
82                         define('__ADMINS_Y', " checked=\"checked\"");
83                         define('__ADMINS_N', "");
84                         break;
85
86                 case "N":
87                         define('__ADMINS_Y', "");
88                         define('__ADMINS_N', " checked=\"checked\"");
89                         break;
90         }
91
92         switch (getConfig('cache_acls')) {
93                 case "Y":
94                         define('__ACLS_Y', " checked=\"checked\"");
95                         define('__ACLS_N', "");
96                         break;
97
98                 case "N":
99                         define('__ACLS_Y', "");
100                         define('__ACLS_N', " checked=\"checked\"");
101                         break;
102         }
103
104         switch (getConfig('cache_exts')) {
105                 case "Y":
106                         define('__EXTS_Y', " checked=\"checked\"");
107                         define('__EXTS_N', "");
108                         break;
109
110                 case "N":
111                         define('__EXTS_Y', "");
112                         define('__EXTS_N', " checked=\"checked\"");
113                         break;
114         }
115
116         switch (getConfig('cache_config')) {
117                 case "Y":
118                         define('__CONFIG_Y', " checked=\"checked\"");
119                         define('__CONFIG_N', "");
120                         break;
121
122                 case "N":
123                         define('__CONFIG_Y', "");
124                         define('__CONFIG_N', " checked=\"checked\"");
125                         break;
126         }
127
128         switch (getConfig('cache_modreg')) {
129                 case "Y":
130                         define('__MODREG_Y', " checked=\"checked\"");
131                         define('__MODREG_N', "");
132                         break;
133
134                 case "N":
135                         define('__MODREG_Y', "");
136                         define('__MODREG_N', " checked=\"checked\"");
137                         break;
138         }
139
140         switch (getConfig('cache_refdepth')) {
141                 case "Y":
142                         define('__REFDEPTH_Y', " checked=\"checked\"");
143                         define('__REFDEPTH_N', "");
144                         break;
145
146                 case "N":
147                         define('__REFDEPTH_Y', "");
148                         define('__REFDEPTH_N', " checked=\"checked\"");
149                         break;
150         }
151
152         switch (getConfig('cache_refsys')) {
153                 case "Y":
154                         define('__REFSYS_Y', " checked=\"checked\"");
155                         define('__REFSYS_N', "");
156                         break;
157
158                 case "N":
159                         define('__REFSYS_Y', "");
160                         define('__REFSYS_N', " checked=\"checked\"");
161                         break;
162         }
163
164         switch (getConfig('cache_themes')) {
165                 case "Y":
166                         define('__THEMES_Y', " checked=\"checked\"");
167                         define('__THEMES_N', "");
168                         break;
169
170                 case "N":
171                         define('__THEMES_Y', "");
172                         define('__THEMES_N', " checked=\"checked\"");
173                         break;
174         }
175
176         switch (getConfig('cache_admin_menu')) {
177                 case "Y":
178                         define('__ADMIN_MENU_Y', " checked=\"checked\"");
179                         define('__ADMIN_MENU_N', "");
180                         break;
181
182                 case "N":
183                         define('__ADMIN_MENU_Y', "");
184                         define('__ADMIN_MENU_N', " checked=\"checked\"");
185                         break;
186         }
187
188         define('__PATH', getConfig('cache_path'));
189
190         // Load template
191         LOAD_TEMPLATE("admin_config_cache");
192 }
193
194 //
195 ?>