Project

General

Profile

1 173 ryan
<?php
2
3
// $Id$
4
5
/*
6
7
 Website Baker Project <http://www.websitebaker.org/>
8 399 Ruebenwurz
 Copyright (C) 2004-2007, Ryan Djurovich
9 173 ryan
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
24
*/
25
26
// Direct access prevention
27 176 ryan
defined('WB_PATH') OR die(header('Location: ../index.php'));
28 173 ryan
29 176 ryan
// Check if user selected what add-ons to reload
30
if(isset($_POST['submit']) AND $_POST['submit'] != '') {
31
	// Include functions file
32
	require_once(WB_PATH.'/framework/functions.php');
33
	// Perform empty/reload
34
	if(isset($_POST['reload_modules'])) {
35
		// Remove all modules
36
		$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
37
		// Load all modules
38
		if($handle = opendir(WB_PATH.'/modules/')) {
39
			while(false !== ($file = readdir($handle))) {
40
				if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
41 178 ryan
					load_module(WB_PATH.'/modules/'.$file);
42 176 ryan
				}
43
			}
44
		closedir($handle);
45
		}
46 178 ryan
		echo '<br />'.$MESSAGE['MOD_RELOAD']['MODULES_RELOADED'];
47 176 ryan
	}
48
	if(isset($_POST['reload_templates'])) {
49 178 ryan
		// Remove all templates
50
		$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
51
		// Load all templates
52
		if($handle = opendir(WB_PATH.'/templates/')) {
53
			while(false !== ($file = readdir($handle))) {
54
				if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
55
					load_template(WB_PATH.'/templates/'.$file);
56
				}
57
			}
58
		closedir($handle);
59
		}
60
		echo '<br />'.$MESSAGE['MOD_RELOAD']['TEMPLATES_RELOADED'];
61 176 ryan
	}
62
	if(isset($_POST['reload_languages'])) {
63 178 ryan
		// Remove all languages
64
		$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
65
		// Load all languages
66
		if($handle = opendir(WB_PATH.'/languages/')) {
67
			while(false !== ($file = readdir($handle))) {
68
				if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
69
					load_language(WB_PATH.'/languages/'.$file);
70
				}
71
			}
72
		closedir($handle);
73
		}
74
		echo '<br />'.$MESSAGE['MOD_RELOAD']['LANGUAGES_RELOADED'];
75 176 ryan
	}
76 178 ryan
	?>
77
	<br /><br />
78
	<a href="<?php echo $_SERVER['REQUEST_URI']; ?>"><?php echo $TEXT['BACK']; ?></a>
79
	<?php
80 176 ryan
} else {
81 178 ryan
	// Display form
82
	?>
83
	<br />
84
	<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
85
	<table cellpadding="4" cellspacing="0" border="0">
86
	<tr>
87
		<td colspan="2"><?php echo $MESSAGE['MOD_RELOAD']['PLEASE_SELECT']; ?>:</td>
88
	</tr>
89
	<tr>
90
		<td width="20"><input type="checkbox" name="reload_modules" id="reload_modules" value="true" /></td>
91
		<td><label for="reload_modules"><?php echo $MENU['MODULES']; ?></label></td>
92
	</tr>
93
	<tr>
94
		<td><input type="checkbox" name="reload_templates" id="reload_templates" value="true" /></td>
95
		<td><label for="reload_templates"><?php echo $MENU['TEMPLATES']; ?></label></td>
96
	</tr>
97
	<tr>
98
		<td><input type="checkbox" name="reload_languages" id="reload_languages" value="true" /></td>
99
		<td><label for="reload_languages"><?php echo $MENU['LANGUAGES']; ?></label></td>
100
	</tr>
101
	<tr>
102
		<td>&nbsp;</td>
103
		<td>
104
			<input type="submit" name="submit" value="<?php echo $TEXT['RELOAD']; ?>" onClick="javascript: if(!confirm('<?php echo $TEXT['ARE_YOU_SURE']; ?>')) { return false; }" />
105
		</td>
106
	</tr>
107
	</table>
108
	</form>
109
	<?php
110 176 ryan
}
111
112 173 ryan
?>