From c4c3d87ae208e7ed9691c76ff80b7a1231996a8f Mon Sep 17 00:00:00 2001
From: Robert Sesek <rsesek@bluestatic.org>
Date: Tue, 14 Nov 2006 03:41:58 +0000
Subject: [PATCH] r1285: Created the defaulttimezone option to allow admins to
 set the timezone for guests

---
 docs/changes.txt       | 1 +
 includes/functions.php | 3 ++-
 includes/settings.php  | 1 +
 register.php           | 1 +
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/docs/changes.txt b/docs/changes.txt
index f55d872..53cb013 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -12,6 +12,7 @@
 - In the "My Controls" tab, change the name of the email and password fields to prevent autocomplete from working on them
 - Include the Gettext mimic functions into the installer so people without the PHP extension can install Bugdar (http://www.bluestatic.org/bugs/showreport.php?bugid=51)
 - Fixed a SQL error that would occur when editing or deleting comments (http://www.bluestatic.org/bugs/showreport.php?bugid=52)
+- Allow administrators to set the default time zone which guests view all times and dates in (http://www.bluestatic.org/bugs/showreport.php?bugid=53)
 
 1.1.3
 ===============================
diff --git a/includes/functions.php b/includes/functions.php
index 9b730a2..26ec30a 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -540,7 +540,7 @@ function fetch_help_link($topic)
 function fetch_guest_user()
 {
 	global $bugsys;
-	
+		
 	return array(
 		'usergroupid' => 1,
 		'userid' => 0,
@@ -549,6 +549,7 @@ function fetch_guest_user()
 		'showcolors' => 1,
 		'permissions' => $bugsys->datastore['usergroup'][1]['permissions'],
 		'displaytitle' => $bugsys->datastore['usergroup'][1]['displaytitle'],
+		'timezone' => $bugsys->options['defaulttimezone']
 	);
 }
 
diff --git a/includes/settings.php b/includes/settings.php
index ea1fe2a..e95aa50 100755
--- a/includes/settings.php
+++ b/includes/settings.php
@@ -48,6 +48,7 @@ $settings = array(
 	'trackertitle'		=> array('textbox', '', false, _('Tracker Title'), _('The global name of the bug tracker. Example: Blue Static Bug Tracker')),
 	'trackerurl'		=> array('textbox', '', false, _('Tracker Base URL'), _('The base URL of the tracker. This is used when creating external links to the tracker. <strong>Be sure that this does not end in a trailing slash (&quot;/&quot;).</strong><br />Example: http://www.bluestatic.org/bugs')),
 	'dateformat'		=> array('textbox', 'F j, Y h:i:s A', false, _('Date Format'), _('Set the date format used for bug report and comment information. This is based on PHP\'s date() function.')),
+	'defaulttimezone'	=> array('" . construct_option_select("setting[defaulttimezone]", $bugsys->datef->fetch_timezone_list(), $bugsys->options["defaulttimezone"]) . "', 0, false, _('Default Time Zone'), _('This controls the time zone that all unregistered users view the tracker with.')),
 	'defaultlanguage'	=> array('" . construct_option_select("setting[defaultlanguage]", $bugsys->datastore["language"], $bugsys->options["defaultlanguage"], "languageid", "title") . "', 1, false, _('Default Language'), _('You can set the default language that all new users (and guests) will use.')),
 	'syndicateditems'	=> array('textbox', 10, false, _('Number of Syndicated Items'), _('The number of bugs to be syndicated at any one time by the Atom XML feed.'))
 ),
diff --git a/register.php b/register.php
index 7441765..3da35c0 100755
--- a/register.php
+++ b/register.php
@@ -80,6 +80,7 @@ if ($_POST['do'] == 'insert')
 	$user->set('showemail',		$bugsys->in['showemail']);
 	$user->set('showcolors',	1);
 	$user->set('languageid',	$bugsys->in['languageid']);
+	$user->set('timezone',		$bugsys->options['defaulttimezone']);
 	$user->set('usergroupid',	$usergroupid);
 	
 	if (!$message->items)
-- 
2.43.5