Project

General

Profile

1 1386 Luisehahne
<?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$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18
19 1773 Luisehahne
/* -------------------------------------------------------- */
20
// Must include code to stop this file being accessed directly
21
if(defined('WB_PATH') == false)
22
{
23
	// Stop this file being access directly
24
		die('<h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2>');
25
}
26
/* -------------------------------------------------------- */
27 1386 Luisehahne
28 1509 Luisehahne
// Get entered values
29 1773 Luisehahne
	$display_name = $wb->add_slashes(strip_tags($wb->get_post('display_name')));
30 1509 Luisehahne
	$language = $wb->get_post('language');
31
	$timezone = $wb->get_post('timezone')*60*60;
32
	$date_format = $wb->get_post('date_format');
33
	$time_format = $wb->get_post('time_format');
34 1386 Luisehahne
35
// Update the database
36
// $database = new database();
37 1509 Luisehahne
	$sql  = "UPDATE `".TABLE_PREFIX."users` SET ";
38
	$sql .= "`display_name` = '".$display_name."', `language` = '".$language."', ";
39
	$sql .= "`timezone` = '".$timezone."', `date_format` = '".$date_format."', ";
40
	$sql .= "`time_format` = '".$time_format."' ";
41
	$sql .=	"WHERE `user_id` = '".$wb->get_user_id()."'";
42
	$database->query($sql);
43
	if($database->is_error()) {
44
		$error[] = $database->get_error();
45 1386 Luisehahne
	} else {
46 1509 Luisehahne
		$success[] = $MOD_PREFERENCE['DETAILS_SAVED'];
47
		$_SESSION['DISPLAY_NAME'] = $display_name;
48
		$_SESSION['LANGUAGE'] = $language;
49 1386 Luisehahne
		$_SESSION['TIMEZONE'] = $timezone;
50 1599 Luisehahne
		$_SESSION['HTTP_REFERER'] = (($_SESSION['LANGUAGE']== LANGUAGE) ? $_SESSION['HTTP_REFERER'] : WB_URL);
51 1509 Luisehahne
// Update date format
52
		if($date_format != '') {
53
			$_SESSION['DATE_FORMAT'] = $date_format;
54
			if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
55
		} else {
56
			$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true;
57
			if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); }
58
		}
59
// Update time format
60
		if($time_format != '') {
61
			$_SESSION['TIME_FORMAT'] = $time_format;
62
			if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); }
63
		} else {
64
			$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true;
65
			if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); }
66
		}
67 1386 Luisehahne
	}