Project

General

Profile

1
<?php
2

    
3
// $Id: tool.php 915 2009-01-21 19:27:01Z Ruebenwurzel $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

    
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
defined('WB_PATH') OR die(header('Location: ../index.php'));
28

    
29
// 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
// 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
					load_module(WB_PATH.'/modules/'.$file);
51
				}
52
			}
53
		closedir($handle);
54
		}
55
		echo '<br />'.$MOD_RELOAD['MODULES_RELOADED'];
56
	}
57
	if(isset($_POST['reload_templates'])) {
58
		// 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
		echo '<br />'.$MOD_RELOAD['TEMPLATES_RELOADED'];
70
	}
71
	if(isset($_POST['reload_languages'])) {
72
		// 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
		echo '<br />'.$MOD_RELOAD['LANGUAGES_RELOADED'];
84
	}
85
	?>
86
	<br /><br />
87
	<a href="<?php echo $_SERVER['REQUEST_URI']; ?>"><?php echo $TEXT['BACK']; ?></a>
88
	<?php
89
} else {
90
	// 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
		<td colspan="2"><?php echo $MOD_RELOAD['PLEASE_SELECT']; ?>:</td>
97
	</tr>
98
	<tr>
99
		<td width="20"><input type="checkbox" name="reload_modules" id="reload_modules" value="true" /></td>
100
		<td><label for="reload_modules"><?php echo $MOD_RELOAD['MODULES']; ?></label></td>
101
	</tr>
102
	<tr>
103
		<td><input type="checkbox" name="reload_templates" id="reload_templates" value="true" /></td>
104
		<td><label for="reload_templates"><?php echo $MOD_RELOAD['TEMPLATES']; ?></label></td>
105
	</tr>
106
	<tr>
107
		<td><input type="checkbox" name="reload_languages" id="reload_languages" value="true" /></td>
108
		<td><label for="reload_languages"><?php echo $MOD_RELOAD['LANGUAGES']; ?></label></td>
109
	</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
}
120

    
121
?>
(3-3/3)