Project

General

Profile

« Previous | Next » 

Revision 1255

Added by Dietmar almost 15 years ago

Ticket #912 fix Search Template bug

View differences:

save.php
1 1
<?php
2
/****************************************************************************
3
* SVN Version information:
2
/*
4 3
*
5
* $Id$
4
*                       About WebsiteBaker
6 5
*
7
*****************************************************************************
8
*                          WebsiteBaker
9
*
10
* WebsiteBaker Project <http://www.websitebaker2.org/>
11
* Copyright (C) 2009, Website Baker Org. e.V.
12
*         http://start.websitebaker2.org/impressum-datenschutz.php
13
* Copyright (C) 2004-2009, Ryan Djurovich
14
*
15
*                        About WebsiteBaker
16
*
17 6
* Website Baker is a PHP-based Content Management System (CMS)
18 7
* designed with one goal in mind: to enable its users to produce websites
19 8
* with ease.
20 9
*
21
*****************************************************************************
10
*                       LICENSE INFORMATION
22 11
*
23
*****************************************************************************
24
*                        LICENSE INFORMATION
25
*
26 12
* WebsiteBaker is free software; you can redistribute it and/or
27 13
* modify it under the terms of the GNU General Public License
28 14
* as published by the Free Software Foundation; either version 2
......
36 22
* You should have received a copy of the GNU General Public License
37 23
* along with this program; if not, write to the Free Software
38 24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
39
****************************************************************************
40 25
*
41 26
*                   WebsiteBaker Extra Information
42 27
*
43 28
*
44
*
45
*
46
*****************************************************************************/
29
*/
47 30
/**
48 31
 *
49
 * @category     admin
50
 * @package      settings
51
 * @author       Ryan Djurovich
52
 * @copyright    2004-2009, Ryan Djurovich
53
 * @copyright    2009-2010, Website Baker Org. e.V.
54
 * @version      $Id$
55
 * @platform     WebsiteBaker 2.8.x
56
 * @requirements >= PHP 4.3.4
57
 * @license      http://www.gnu.org/licenses/gpl.html
32
 * @category        admin
33
 * @package         settings
34
 * @author          Ryan Djurovich
35
 * @copyright       2004-2009, Ryan Djurovich
36
 * @copyright       2009-2010, Website Baker Org. e.V.
37
 * @filesource		$HeadURL$
38
 * @author          Ryan Djurovich
39
 * @copyright       2004-2009, Ryan Djurovich
58 40
 *
41
 * @author          WebsiteBaker Project
42
 * @link			http://www.websitebaker2.org/
43
 * @copyright       2009-2010, Website Baker Org. e.V.
44
 * @link			http://start.websitebaker2.org/impressum-datenschutz.php
45
 * @license         http://www.gnu.org/licenses/gpl.html
46
 * @version         $Id$
47
 * @platform        WebsiteBaker 2.8.x
48
 * @requirements    PHP 4.3.4 and higher
49
 * @lastmodified    $Date$
50
 *
59 51
 */
60 52

  
61 53
// prevent this file from being accessed directly in the browser (would set all entries in DB settings table to '')
......
78 70
$js_back = "javascript: history.go(-1);";
79 71

  
80 72
// Ensure that the specified default email is formally valid
81
if(isset($_POST['server_email'])) {
73
if(isset($_POST['server_email']))
74
{
82 75
	$_POST['server_email'] = strip_tags($_POST['server_email']);
83 76
	if(!eregi("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $_POST['server_email'])) {
84 77
		$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'].
......
87 80
}
88 81

  
89 82
// Work-out file mode
90
if($advanced == '') {
83
if($advanced == '')
84
{
91 85
	// Check if should be set to 777 or left alone
92
	if(isset($_POST['world_writeable']) AND $_POST['world_writeable'] == 'true') {
86
	if(isset($_POST['world_writeable']) AND $_POST['world_writeable'] == 'true')
87
    {
93 88
		$file_mode = '0777';
94 89
		$dir_mode = '0777';
95 90
	} else {
......
164 159
}
165 160

  
166 161
// Create new database object
167
$database = new database();
162
/*$database = new database(); */
168 163

  
169 164
// Query current settings in the db, then loop through them and update the db with the new value
170 165
$query = "SELECT name FROM ".TABLE_PREFIX."settings";
171 166
$results = $database->query($query);
172
while($setting = $results->fetchRow()) {
167
while($setting = $results->fetchRow())
168
{
173 169
	$setting_name = $setting['name'];
174 170
	$value = $admin->get_post($setting_name);
175
	if ($setting_name!='wb_version') {
171
	if ($setting_name!='wb_version')
172
    {
176 173
		$allow_tags_in_fields = array('website_header', 'website_footer','wbmailer_smtp_password');
177 174
		if(!in_array($setting_name, $allow_tags_in_fields)) {
178 175
			$value = strip_tags($value);
......
204 201
	$old_value = $search_setting['value'];
205 202
	$setting_name = $search_setting['name'];
206 203
	$post_name = 'search_'.$search_setting['name'];
207
	if($admin->get_post($post_name) == '')
208
    {
209
        $value = $old_value;
210
    }
211
	else
212
    {
213
        $value = $admin->get_post($post_name);
214
    }
204
    // hold old value if post is empty
205
    // check search template
206
    $value = ( ($admin->get_post($post_name) == '') AND ($setting_name != 'template') ) ? $old_value : $admin->get_post($post_name);
215 207

  
216 208
	$value = $admin->add_slashes($value);
217 209
	$database->query("UPDATE ".TABLE_PREFIX."search SET value = '$value' WHERE name = '$setting_name'");
218 210

  

Also available in: Unified diff