1 |
1241
|
Luisehahne
|
<?php
|
2 |
1255
|
Luisehahne
|
/*
|
3 |
1241
|
Luisehahne
|
*
|
4 |
1255
|
Luisehahne
|
* About WebsiteBaker
|
5 |
1241
|
Luisehahne
|
*
|
6 |
|
|
* Website Baker is a PHP-based Content Management System (CMS)
|
7 |
|
|
* designed with one goal in mind: to enable its users to produce websites
|
8 |
|
|
* with ease.
|
9 |
|
|
*
|
10 |
1255
|
Luisehahne
|
* LICENSE INFORMATION
|
11 |
1241
|
Luisehahne
|
*
|
12 |
|
|
* WebsiteBaker is free software; you can redistribute it and/or
|
13 |
|
|
* modify it under the terms of the GNU General Public License
|
14 |
|
|
* as published by the Free Software Foundation; either version 2
|
15 |
|
|
* of the License, or (at your option) any later version.
|
16 |
|
|
*
|
17 |
|
|
* WebsiteBaker is distributed in the hope that it will be useful,
|
18 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
20 |
|
|
* See the GNU General Public License for more details.
|
21 |
|
|
*
|
22 |
|
|
* You should have received a copy of the GNU General Public License
|
23 |
|
|
* along with this program; if not, write to the Free Software
|
24 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
25 |
|
|
*
|
26 |
|
|
* WebsiteBaker Extra Information
|
27 |
|
|
*
|
28 |
|
|
*
|
29 |
1255
|
Luisehahne
|
*/
|
30 |
1241
|
Luisehahne
|
/**
|
31 |
|
|
*
|
32 |
1255
|
Luisehahne
|
* @category admin
|
33 |
|
|
* @package settings
|
34 |
1268
|
Luisehahne
|
* @author WebsiteBaker Project
|
35 |
1255
|
Luisehahne
|
* @copyright 2004-2009, Ryan Djurovich
|
36 |
|
|
* @copyright 2009-2010, Website Baker Org. e.V.
|
37 |
|
|
* @link http://www.websitebaker2.org/
|
38 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
39 |
|
|
* @platform WebsiteBaker 2.8.x
|
40 |
|
|
* @requirements PHP 4.3.4 and higher
|
41 |
1268
|
Luisehahne
|
* @version $Id$
|
42 |
|
|
* @filesource $HeadURL$
|
43 |
1255
|
Luisehahne
|
* @lastmodified $Date$
|
44 |
|
|
*
|
45 |
1241
|
Luisehahne
|
*/
|
46 |
|
|
|
47 |
|
|
// prevent this file from being accessed directly in the browser (would set all entries in DB settings table to '')
|
48 |
|
|
if(!isset($_POST['default_language']) || $_POST['default_language'] == '') die(header('Location: index.php'));
|
49 |
|
|
|
50 |
|
|
// Find out if the user was view advanced options or not
|
51 |
|
|
if($_POST['advanced'] == 'yes' ? $advanced = '?advanced=yes' : $advanced = '');
|
52 |
|
|
|
53 |
|
|
// Print admin header
|
54 |
|
|
require('../../config.php');
|
55 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
56 |
|
|
if($advanced == '') {
|
57 |
|
|
$admin = new admin('Settings', 'settings_basic');
|
58 |
|
|
$_POST['database_password'] = DB_PASSWORD;
|
59 |
|
|
} else {
|
60 |
|
|
$admin = new admin('Settings', 'settings_advanced');
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
// Create a javascript back link
|
64 |
|
|
$js_back = "javascript: history.go(-1);";
|
65 |
|
|
|
66 |
|
|
// Ensure that the specified default email is formally valid
|
67 |
1255
|
Luisehahne
|
if(isset($_POST['server_email']))
|
68 |
|
|
{
|
69 |
1241
|
Luisehahne
|
$_POST['server_email'] = strip_tags($_POST['server_email']);
|
70 |
|
|
if(!eregi("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $_POST['server_email'])) {
|
71 |
|
|
$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'].
|
72 |
|
|
'<br /><strong>Email: '.htmlentities($_POST['server_email']).'</strong>', $js_back);
|
73 |
|
|
}
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
// Work-out file mode
|
77 |
1255
|
Luisehahne
|
if($advanced == '')
|
78 |
|
|
{
|
79 |
1241
|
Luisehahne
|
// Check if should be set to 777 or left alone
|
80 |
1255
|
Luisehahne
|
if(isset($_POST['world_writeable']) AND $_POST['world_writeable'] == 'true')
|
81 |
|
|
{
|
82 |
1241
|
Luisehahne
|
$file_mode = '0777';
|
83 |
|
|
$dir_mode = '0777';
|
84 |
|
|
} else {
|
85 |
|
|
$file_mode = STRING_FILE_MODE;
|
86 |
|
|
$dir_mode = STRING_DIR_MODE;
|
87 |
|
|
}
|
88 |
|
|
} else {
|
89 |
|
|
// Work-out the octal value for file mode
|
90 |
|
|
$u = 0;
|
91 |
|
|
if(isset($_POST['file_u_r']) AND $_POST['file_u_r'] == 'true') {
|
92 |
|
|
$u = $u+4;
|
93 |
|
|
}
|
94 |
|
|
if(isset($_POST['file_u_w']) AND $_POST['file_u_w'] == 'true') {
|
95 |
|
|
$u = $u+2;
|
96 |
|
|
}
|
97 |
|
|
if(isset($_POST['file_u_e']) AND $_POST['file_u_e'] == 'true') {
|
98 |
|
|
$u = $u+1;
|
99 |
|
|
}
|
100 |
|
|
$g = 0;
|
101 |
|
|
if(isset($_POST['file_g_r']) AND $_POST['file_g_r'] == 'true') {
|
102 |
|
|
$g = $g+4;
|
103 |
|
|
}
|
104 |
|
|
if(isset($_POST['file_g_w']) AND $_POST['file_g_w'] == 'true') {
|
105 |
|
|
$g = $g+2;
|
106 |
|
|
}
|
107 |
|
|
if(isset($_POST['file_g_e']) AND $_POST['file_g_e'] == 'true') {
|
108 |
|
|
$g = $g+1;
|
109 |
|
|
}
|
110 |
|
|
$o = 0;
|
111 |
|
|
if(isset($_POST['file_o_r']) AND $_POST['file_o_r'] == 'true') {
|
112 |
|
|
$o = $o+4;
|
113 |
|
|
}
|
114 |
|
|
if(isset($_POST['file_o_w']) AND $_POST['file_o_w'] == 'true') {
|
115 |
|
|
$o = $o+2;
|
116 |
|
|
}
|
117 |
|
|
if(isset($_POST['file_o_e']) AND $_POST['file_o_e'] == 'true') {
|
118 |
|
|
$o = $o+1;
|
119 |
|
|
}
|
120 |
|
|
$file_mode = "0".$u.$g.$o;
|
121 |
|
|
// Work-out the octal value for dir mode
|
122 |
|
|
$u = 0;
|
123 |
|
|
if(isset($_POST['dir_u_r']) AND $_POST['dir_u_r'] == 'true') {
|
124 |
|
|
$u = $u+4;
|
125 |
|
|
}
|
126 |
|
|
if(isset($_POST['dir_u_w']) AND $_POST['dir_u_w'] == 'true') {
|
127 |
|
|
$u = $u+2;
|
128 |
|
|
}
|
129 |
|
|
if(isset($_POST['dir_u_e']) AND $_POST['dir_u_e'] == 'true') {
|
130 |
|
|
$u = $u+1;
|
131 |
|
|
}
|
132 |
|
|
$g = 0;
|
133 |
|
|
if(isset($_POST['dir_g_r']) AND $_POST['dir_g_r'] == 'true') {
|
134 |
|
|
$g = $g+4;
|
135 |
|
|
}
|
136 |
|
|
if(isset($_POST['dir_g_w']) AND $_POST['dir_g_w'] == 'true') {
|
137 |
|
|
$g = $g+2;
|
138 |
|
|
}
|
139 |
|
|
if(isset($_POST['dir_g_e']) AND $_POST['dir_g_e'] == 'true') {
|
140 |
|
|
$g = $g+1;
|
141 |
|
|
}
|
142 |
|
|
$o = 0;
|
143 |
|
|
if(isset($_POST['dir_o_r']) AND $_POST['dir_o_r'] == 'true') {
|
144 |
|
|
$o = $o+4;
|
145 |
|
|
}
|
146 |
|
|
if(isset($_POST['dir_o_w']) AND $_POST['dir_o_w'] == 'true') {
|
147 |
|
|
$o = $o+2;
|
148 |
|
|
}
|
149 |
|
|
if(isset($_POST['dir_o_e']) AND $_POST['dir_o_e'] == 'true') {
|
150 |
|
|
$o = $o+1;
|
151 |
|
|
}
|
152 |
|
|
$dir_mode = "0".$u.$g.$o;
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
// Create new database object
|
156 |
1255
|
Luisehahne
|
/*$database = new database(); */
|
157 |
1241
|
Luisehahne
|
|
158 |
|
|
// Query current settings in the db, then loop through them and update the db with the new value
|
159 |
|
|
$query = "SELECT name FROM ".TABLE_PREFIX."settings";
|
160 |
|
|
$results = $database->query($query);
|
161 |
1255
|
Luisehahne
|
while($setting = $results->fetchRow())
|
162 |
|
|
{
|
163 |
1241
|
Luisehahne
|
$setting_name = $setting['name'];
|
164 |
|
|
$value = $admin->get_post($setting_name);
|
165 |
1255
|
Luisehahne
|
if ($setting_name!='wb_version')
|
166 |
|
|
{
|
167 |
1241
|
Luisehahne
|
$allow_tags_in_fields = array('website_header', 'website_footer','wbmailer_smtp_password');
|
168 |
|
|
if(!in_array($setting_name, $allow_tags_in_fields)) {
|
169 |
|
|
$value = strip_tags($value);
|
170 |
|
|
}
|
171 |
|
|
switch ($setting_name) {
|
172 |
|
|
case 'default_timezone':
|
173 |
|
|
$value=$value*60*60;
|
174 |
|
|
break;
|
175 |
|
|
case 'string_dir_mode':
|
176 |
|
|
$value=$dir_mode;
|
177 |
|
|
break;
|
178 |
|
|
case 'string_file_mode':
|
179 |
|
|
$value=$file_mode;
|
180 |
|
|
break;
|
181 |
|
|
case 'pages_directory':
|
182 |
|
|
if(trim($value)=='/') $value='';
|
183 |
|
|
break;
|
184 |
|
|
}
|
185 |
|
|
$value = $admin->add_slashes($value);
|
186 |
|
|
$database->query("UPDATE ".TABLE_PREFIX."settings SET value = '$value' WHERE name = '$setting_name'");
|
187 |
|
|
}
|
188 |
|
|
}
|
189 |
|
|
|
190 |
|
|
// Query current search settings in the db, then loop through them and update the db with the new value
|
191 |
|
|
$query = "SELECT name, value FROM ".TABLE_PREFIX."search WHERE extra = ''";
|
192 |
|
|
$results = $database->query($query);
|
193 |
|
|
while($search_setting = $results->fetchRow())
|
194 |
|
|
{
|
195 |
|
|
$old_value = $search_setting['value'];
|
196 |
|
|
$setting_name = $search_setting['name'];
|
197 |
|
|
$post_name = 'search_'.$search_setting['name'];
|
198 |
1255
|
Luisehahne
|
// hold old value if post is empty
|
199 |
|
|
// check search template
|
200 |
|
|
$value = ( ($admin->get_post($post_name) == '') AND ($setting_name != 'template') ) ? $old_value : $admin->get_post($post_name);
|
201 |
1241
|
Luisehahne
|
|
202 |
|
|
$value = $admin->add_slashes($value);
|
203 |
|
|
$database->query("UPDATE ".TABLE_PREFIX."search SET value = '$value' WHERE name = '$setting_name'");
|
204 |
|
|
}
|
205 |
|
|
|
206 |
|
|
// Check if there was an error updating the db
|
207 |
|
|
if($database->is_error()) {
|
208 |
|
|
$admin->print_error($database->get_error, ADMIN_URL.'/settings/index.php'.$advanced);
|
209 |
|
|
$admin->print_footer();
|
210 |
|
|
exit();
|
211 |
|
|
}
|
212 |
|
|
|
213 |
|
|
$admin->print_success($MESSAGE['SETTINGS']['SAVED'], ADMIN_URL.'/settings/index.php'.$advanced);
|
214 |
|
|
$admin->print_footer();
|
215 |
|
|
|
216 |
|
|
?>
|