Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id: details.php 1400 2011-01-21 19:42:51Z FrankH $
14
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/details.php $
15
 * @lastmodified    $Date: 2011-01-21 20:42:51 +0100 (Fri, 21 Jan 2011) $
16
 *
17
 */
18

    
19
if(!defined('WB_URL')) {
20
	header('Location: ../pages/index.php');
21
	exit(0);
22
}
23

    
24
// Get entered values
25
$display_name = $wb->add_slashes(strip_tags($wb->get_post('display_name')));
26
$language = $wb->get_post_escaped('language');
27
$timezone = $wb->get_post_escaped('timezone')*60*60;
28
$date_format = $wb->get_post_escaped('date_format');
29
$time_format = $wb->get_post_escaped('time_format');
30

    
31
if (!$wb->checkFTAN())
32
{
33
	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
34
	exit();
35
}
36

    
37
// Create a javascript back link
38
$js_back = "javascript: history.go(-1);";
39

    
40
// Update the database
41
// $database = new database();
42
$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()."'";
43
$database->query($query);
44
if($database->is_error()) {
45
	$wb->print_error($database->get_error,'index.php',false);
46
} else {
47
	$wb->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED'], WB_URL.'/account/preferences.php');
48
	$_SESSION['DISPLAY_NAME'] = $display_name;
49
	$_SESSION['LANGUAGE'] = $language;
50
	// Update date format
51
	if($date_format != '') {
52
		$_SESSION['DATE_FORMAT'] = $date_format;
53
		if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
54
	} else {
55
		$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true;
56
		if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); }
57
	}
58
	// Update time format
59
	if($time_format != '') {
60
		$_SESSION['TIME_FORMAT'] = $time_format;
61
		if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); }
62
	} else {
63
		$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true;
64
		if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); }
65
	}
66
	// Update timezone
67
	if($timezone != '-72000') {
68
		$_SESSION['TIMEZONE'] = $timezone;
69
		if(isset($_SESSION['USE_DEFAULT_TIMEZONE'])) { unset($_SESSION['USE_DEFAULT_TIMEZONE']); }
70
	} else {
71
		$_SESSION['USE_DEFAULT_TIMEZONE'] = true;
72
		if(isset($_SESSION['TIMEZONE'])) { unset($_SESSION['TIMEZONE']); }
73
	}
74
}
75

    
76
?>
(1-1/14)