Project

General

Profile

1 173 ryan
<?php
2
3
// $Id$
4
5
/*
6
7
 Website Baker Project <http://www.websitebaker.org/>
8 915 Ruebenwurz
 Copyright (C) 2004-2009, 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 587 doc
// check if module language file exists for the language set by the user (e.g. DE, EN)
30
if(!file_exists(WB_PATH .'/modules/reload/languages/'.LANGUAGE .'.php')) {
31
	// no module language file exists for the language set by the user, include default module language file EN.php
32
	require_once(WB_PATH .'/modules/reload/languages/EN.php');
33
} else {
34
	// a module language file exists for the language defined by the user, load it
35
	require_once(WB_PATH .'/modules/reload/languages/'.LANGUAGE .'.php');
36
}
37
38 176 ryan
// Check if user selected what add-ons to reload
39
if(isset($_POST['submit']) AND $_POST['submit'] != '') {
40
	// Include functions file
41
	require_once(WB_PATH.'/framework/functions.php');
42
	// Perform empty/reload
43
	if(isset($_POST['reload_modules'])) {
44
		// Remove all modules
45
		$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
46
		// Load all modules
47
		if($handle = opendir(WB_PATH.'/modules/')) {
48
			while(false !== ($file = readdir($handle))) {
49
				if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
50 178 ryan
					load_module(WB_PATH.'/modules/'.$file);
51 176 ryan
				}
52
			}
53
		closedir($handle);
54
		}
55 587 doc
		echo '<br />'.$MOD_RELOAD['MODULES_RELOADED'];
56 176 ryan
	}
57
	if(isset($_POST['reload_templates'])) {
58 178 ryan
		// Remove all templates
59
		$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
60
		// Load all templates
61
		if($handle = opendir(WB_PATH.'/templates/')) {
62
			while(false !== ($file = readdir($handle))) {
63
				if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
64
					load_template(WB_PATH.'/templates/'.$file);
65
				}
66
			}
67
		closedir($handle);
68
		}
69 587 doc
		echo '<br />'.$MOD_RELOAD['TEMPLATES_RELOADED'];
70 176 ryan
	}
71
	if(isset($_POST['reload_languages'])) {
72 178 ryan
		// Remove all languages
73
		$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
74
		// Load all languages
75
		if($handle = opendir(WB_PATH.'/languages/')) {
76
			while(false !== ($file = readdir($handle))) {
77
				if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
78
					load_language(WB_PATH.'/languages/'.$file);
79
				}
80
			}
81
		closedir($handle);
82
		}
83 587 doc
		echo '<br />'.$MOD_RELOAD['LANGUAGES_RELOADED'];
84 176 ryan
	}
85 178 ryan
	?>
86
	<br /><br />
87
	<a href="<?php echo $_SERVER['REQUEST_URI']; ?>"><?php echo $TEXT['BACK']; ?></a>
88
	<?php
89 176 ryan
} else {
90 178 ryan
	// Display form
91
	?>
92
	<br />
93
	<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
94
	<table cellpadding="4" cellspacing="0" border="0">
95
	<tr>
96 587 doc
		<td colspan="2"><?php echo $MOD_RELOAD['PLEASE_SELECT']; ?>:</td>
97 178 ryan
	</tr>
98
	<tr>
99
		<td width="20"><input type="checkbox" name="reload_modules" id="reload_modules" value="true" /></td>
100 587 doc
		<td><label for="reload_modules"><?php echo $MOD_RELOAD['MODULES']; ?></label></td>
101 178 ryan
	</tr>
102
	<tr>
103
		<td><input type="checkbox" name="reload_templates" id="reload_templates" value="true" /></td>
104 587 doc
		<td><label for="reload_templates"><?php echo $MOD_RELOAD['TEMPLATES']; ?></label></td>
105 178 ryan
	</tr>
106
	<tr>
107
		<td><input type="checkbox" name="reload_languages" id="reload_languages" value="true" /></td>
108 587 doc
		<td><label for="reload_languages"><?php echo $MOD_RELOAD['LANGUAGES']; ?></label></td>
109 178 ryan
	</tr>
110
	<tr>
111
		<td>&nbsp;</td>
112
		<td>
113
			<input type="submit" name="submit" value="<?php echo $TEXT['RELOAD']; ?>" onClick="javascript: if(!confirm('<?php echo $TEXT['ARE_YOU_SURE']; ?>')) { return false; }" />
114
		</td>
115
	</tr>
116
	</table>
117
	</form>
118
	<?php
119 176 ryan
}
120
121 173 ryan
?>