More misc fixes and rewrites (sorry, lame description)
[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  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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')) || (!IS_ADMIN())) {
41         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
42         require($INC);
43 } // END - if
44
45 // Add description as navigation point
46 ADD_DESCR('admin', __FILE__);
47
48 if (isFormSent()) {
49         // Cache path has been not changed by default so don't test it again
50         REQUEST_SET_POST('cache_tested', 'N');
51
52         // Check if path has been changed
53         if (REQUEST_POST('cache_path') != getConfig('cache_path')) {
54                 // Okay, cache path has been altered so we have to test it again!
55                 REQUEST_SET_POST('cache_tested', 'Y');
56         } // END - if
57
58         if ((REQUEST_POST('cache_admins') == 'N') && ($GLOBALS['cache_instance']->loadCacheFile('admins'))) {
59                 $GLOBALS['cache_instance']->destroyCacheFile();
60         } // END - if
61
62         if ((REQUEST_POST('cache_acls') == 'N') && ($GLOBALS['cache_instance']->loadCacheFile('acls'))) {
63                 $GLOBALS['cache_instance']->destroyCacheFile();
64         } // END - if
65
66         if ((REQUEST_POST('cache_exts') == 'N') && ($GLOBALS['cache_instance']->loadCacheFile('extensions', true))) {
67                 $GLOBALS['cache_instance']->destroyCacheFile();
68         } // END - if
69
70         if ((REQUEST_POST('cache_config') == 'N') && ($GLOBALS['cache_instance']->loadCacheFile('config'))) {
71                 $GLOBALS['cache_instance']->destroyCacheFile();
72         } // END - if
73
74         if ((REQUEST_POST('cache_modreg') == 'N') && ($GLOBALS['cache_instance']->loadCacheFile('modreg'))) {
75                 $GLOBALS['cache_instance']->destroyCacheFile();
76         } // END - if
77
78         if ((REQUEST_POST('cache_refdepth') == 'N') && ($GLOBALS['cache_instance']->loadCacheFile('refdepth'))) {
79                 $GLOBALS['cache_instance']->destroyCacheFile();
80         } // END - if
81
82         if ((REQUEST_POST('cache_refsys') == 'N') && ($GLOBALS['cache_instance']->loadCacheFile('refsys'))) {
83                 $GLOBALS['cache_instance']->destroyCacheFile();
84         } // END - if
85
86         if ((REQUEST_POST('cache_filter') == 'N') && ($GLOBALS['cache_instance']->loadCacheFile('filter'))) {
87                 $GLOBALS['cache_instance']->destroyCacheFile();
88         } // END - if
89
90         // Save configuration
91         ADMIN_SAVE_SETTINGS_POST();
92 } else {
93         // Prepare data
94         // @TODO Rewrite all constants
95         switch (getConfig('cache_admins')) {
96                 case 'Y':
97                         define('__ADMINS_Y', ' checked="checked"');
98                         define('__ADMINS_N', '');
99                         break;
100
101                 case 'N':
102                         define('__ADMINS_Y', '');
103                         define('__ADMINS_N', ' checked="checked"');
104                         break;
105         } // END - switch
106
107         switch (getConfig('cache_acls')) {
108                 case 'Y':
109                         define('__ACLS_Y', ' checked="checked"');
110                         define('__ACLS_N', '');
111                         break;
112
113                 case 'N':
114                         define('__ACLS_Y', '');
115                         define('__ACLS_N', ' checked="checked"');
116                         break;
117         } // END - switch
118
119         switch (getConfig('cache_exts')) {
120                 case 'Y':
121                         define('__EXTS_Y', ' checked="checked"');
122                         define('__EXTS_N', '');
123                         break;
124
125                 case 'N':
126                         define('__EXTS_Y', '');
127                         define('__EXTS_N', ' checked="checked"');
128                         break;
129         } // END - switch
130
131         switch (getConfig('cache_config')) {
132                 case 'Y':
133                         define('__CONFIG_Y', ' checked="checked"');
134                         define('__CONFIG_N', '');
135                         break;
136
137                 case 'N':
138                         define('__CONFIG_Y', '');
139                         define('__CONFIG_N', ' checked="checked"');
140                         break;
141         } // END - switch
142
143         switch (getConfig('cache_modreg')) {
144                 case 'Y':
145                         define('__MODREG_Y', ' checked="checked"');
146                         define('__MODREG_N', '');
147                         break;
148
149                 case 'N':
150                         define('__MODREG_Y', '');
151                         define('__MODREG_N', ' checked="checked"');
152                         break;
153         } // END - switch
154
155         switch (getConfig('cache_refdepth')) {
156                 case 'Y':
157                         define('__REFDEPTH_Y', ' checked="checked"');
158                         define('__REFDEPTH_N', '');
159                         break;
160
161                 case 'N':
162                         define('__REFDEPTH_Y', '');
163                         define('__REFDEPTH_N', ' checked="checked"');
164                         break;
165         } // END - switch
166
167         switch (getConfig('cache_refsys')) {
168                 case 'Y':
169                         define('__REFSYS_Y', ' checked="checked"');
170                         define('__REFSYS_N', '');
171                         break;
172
173                 case 'N':
174                         define('__REFSYS_Y', '');
175                         define('__REFSYS_N', ' checked="checked"');
176                         break;
177         } // END - switch
178
179         switch (getConfig('cache_filter')) {
180                 case 'Y':
181                         define('__FILTER_Y', ' checked="checked"');
182                         define('__FILTER_N', '');
183                         break;
184
185                 case 'N':
186                         define('__FILTER_Y', '');
187                         define('__FILTER_N', ' checked="checked"');
188                         break;
189         } // END - switch
190
191         switch (getConfig('cache_themes')) {
192                 case 'Y':
193                         define('__THEMES_Y', ' checked="checked"');
194                         define('__THEMES_N', '');
195                         break;
196
197                 case 'N':
198                         define('__THEMES_Y', '');
199                         define('__THEMES_N', ' checked="checked"');
200                         break;
201         } // END - switch
202
203         switch (getConfig('cache_admin_menu')) {
204                 case 'Y':
205                         define('__ADMIN_MENU_Y', ' checked="checked"');
206                         define('__ADMIN_MENU_N', '');
207                         break;
208
209                 case 'N':
210                         define('__ADMIN_MENU_Y', '');
211                         define('__ADMIN_MENU_N', ' checked="checked"');
212                         break;
213         } // END - switch
214
215         define('__PATH', getConfig('cache_path'));
216
217         // Load template
218         LOAD_TEMPLATE('admin_config_cache');
219 }
220
221 //
222 ?>