Project

General

Profile

1
<?php
2
/*
3
*
4
*                       About WebsiteBaker
5
*
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
*                       LICENSE INFORMATION
11
*
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
*/
30
/**
31
 *
32
 * @category        frontend
33
 * @package         account
34
 * @author          WebsiteBaker Project
35
 * @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
 * @version         $Id: details.php 1268 2010-01-22 17:21:02Z Luisehahne $
42
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/details.php $
43
 * @lastmodified    $Date: 2010-01-22 18:21:02 +0100 (Fri, 22 Jan 2010) $
44
 *
45
 */
46

    
47
if(!defined('WB_URL')) {
48
	header('Location: ../pages/index.php');
49
	exit(0);
50
}
51

    
52
// Get entered values
53
$display_name = $wb->add_slashes(strip_tags($wb->get_post('display_name')));
54
$language = $wb->get_post_escaped('language');
55
$timezone = $wb->get_post_escaped('timezone')*60*60;
56
$date_format = $wb->get_post_escaped('date_format');
57
$time_format = $wb->get_post_escaped('time_format');
58

    
59
// Create a javascript back link
60
$js_back = "javascript: history.go(-1);";
61

    
62
// Update the database
63
$database = new database();
64
$query = "UPDATE ".TABLE_PREFIX."users SET display_name = '$display_name', language = '$language', timezone = '$timezone', date_format = '$date_format', time_format = '$time_format' WHERE user_id = '".$wb->get_user_id()."'";
65
$database->query($query);
66
if($database->is_error()) {
67
	$wb->print_error($database->get_error,'index.php',false);
68
} else {
69
	$wb->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED'], WB_URL.'/account/preferences.php');
70
	$_SESSION['DISPLAY_NAME'] = $display_name;
71
	$_SESSION['LANGUAGE'] = $language;
72
	// Update date format
73
	if($date_format != '') {
74
		$_SESSION['DATE_FORMAT'] = $date_format;
75
		if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
76
	} else {
77
		$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true;
78
		if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); }
79
	}
80
	// Update time format
81
	if($time_format != '') {
82
		$_SESSION['TIME_FORMAT'] = $time_format;
83
		if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); }
84
	} else {
85
		$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true;
86
		if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); }
87
	}
88
	// Update timezone
89
	if($timezone != '-72000') {
90
		$_SESSION['TIMEZONE'] = $timezone;
91
		if(isset($_SESSION['USE_DEFAULT_TIMEZONE'])) { unset($_SESSION['USE_DEFAULT_TIMEZONE']); }
92
	} else {
93
		$_SESSION['USE_DEFAULT_TIMEZONE'] = true;
94
		if(isset($_SESSION['TIMEZONE'])) { unset($_SESSION['TIMEZONE']); }
95
	}
96
}
97

    
98
?>
(1-1/14)