From 144127af8643e3aad5cdac9a012ab9a071b10cf6 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 22 Jul 2006 03:01:48 +0000 Subject: [PATCH] r922: - Adding support for DST - Fixing some bugs in admin/user.php --- admin/user.php | 11 +++++++---- docs/changes.txt | 1 + docs/schema_changes.sql | 2 ++ includes/api_user.php | 3 ++- includes/init.php | 3 ++- templates/userctrl.tpl | 4 ++++ userctrl.php | 2 ++ 7 files changed, 20 insertions(+), 6 deletions(-) diff --git a/admin/user.php b/admin/user.php index 8c840ba..d54b15c 100644 --- a/admin/user.php +++ b/admin/user.php @@ -61,17 +61,18 @@ if ($_REQUEST['do'] == 'delete') if ($_POST['do'] == 'insert') { $user = new UserAPI($bugsys); - $user->set('dispayname', $bugsys->in['displayname']); + $user->set('displayname', $bugsys->in['displayname']); $user->set('email', $bugsys->in['email']); $user->set('showemail', $bugsys->in['showemail']); $user->set('showcolours', $bugsys->in['showcolours']); $user->set('usergroupid', $bugsys->in['usergroupid']); $user->set('languageid', $bugsys->in['languageid']); $user->set('timezone', $bugsys->in['timezone']); + $user->set('usedst', $bugsys->in['usedst']); $user->set('password', $bugsys->in['password']); $user->insert(); - $admin->redirect('user.php?do=edit&userid=' . $db->insert_id()); + $admin->redirect('user.php?do=edit&userid=' . $user->insertid); } // ################################################################### @@ -81,17 +82,18 @@ if ($_POST['do'] == 'update') $user = new UserAPI($bugsys); $user->set('userid', $bugsys->in['userid']); $user->set_condition(); - $user->set('dispayname', $bugsys->in['displayname']); + $user->set('displayname', $bugsys->in['displayname']); $user->set('email', $bugsys->in['email']); $user->set('showemail', $bugsys->in['showemail']); $user->set('showcolours', $bugsys->in['showcolours']); $user->set('usergroupid', $bugsys->in['usergroupid']); $user->set('languageid', $bugsys->in['languageid']); $user->set('timezone', $bugsys->in['timezone']); + $user->set('usedst', $bugsys->in['usedst']); $user->set('password', $bugsys->in['password']); $user->update(); - $admin->redirect('user.php?do=edit&userid=' . $user['userid']); + $admin->redirect('user.php?do=edit&userid=' . $user->objdata['userid']); } // ################################################################### @@ -155,6 +157,7 @@ if ($_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == 'add') $admin->list_item($string, $value, ($user['timezone'] == $value)); } $admin->row_list($lang->string('Timezone'), 'timezone'); + $admin->row_yesno($lang->string('Observe Daylight Savings Time (DST)'), 'usedst', $user['usedst']); $admin->row_submit(); diff --git a/docs/changes.txt b/docs/changes.txt index 116b725..3aca7ad 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -25,6 +25,7 @@ - User - Usergroup - User help +- Added support for DST observation (http://bugs.iris-studios.com/showreport.php?bugid=22) 1.0.2 ================== diff --git a/docs/schema_changes.sql b/docs/schema_changes.sql index a17f91e..9c8368d 100644 --- a/docs/schema_changes.sql +++ b/docs/schema_changes.sql @@ -14,3 +14,5 @@ CREATE TABLE useremail ); DROP TABLE dependency; + +ALTER TABLE user ADD usedst BOOL NOT NULL; diff --git a/includes/api_user.php b/includes/api_user.php index 87b4a01..57403f6 100644 --- a/includes/api_user.php +++ b/includes/api_user.php @@ -50,7 +50,8 @@ class UserAPI extends API 'showemail' => array(TYPE_BOOL, REQ_NO), 'showcolours' => array(TYPE_BOOL, REQ_NO), 'languageid' => array(TYPE_UINT, REQ_NO), - 'timezone' => array(TYPE_INT, REQ_NO) + 'timezone' => array(TYPE_INT, REQ_NO), + 'usedst' => array(TYPE_BOOL, REQ_NO) ); /** diff --git a/includes/init.php b/includes/init.php index c035e32..e3d761f 100755 --- a/includes/init.php +++ b/includes/init.php @@ -140,7 +140,8 @@ $stylevar['charset'] = $LANGDATA['charset']; // ################################################################### // initialize the date system $bugsys->load('date', 'datef', true); -$datef->usertz = $bugsys->userinfo['timezone']; +$datef->usertz = $bugsys->userinfo['timezone'] + ($bugsys->userinfo['usedst'] * 1); +$bugsys->debug('user tz = ' . $bugsys->userinfo['timezone'] . '; use version = ' . $datef->usertz); $datef->fetch_offset(); // ################################################################### diff --git a/templates/userctrl.tpl b/templates/userctrl.tpl index 016a732..3b82546 100644 --- a/templates/userctrl.tpl +++ b/templates/userctrl.tpl @@ -53,6 +53,10 @@ $header {@"Timezone"} + +
+ {@"Observe Daylight Savings Time (DST)"} + checked="checked" /> {@"Yes, I'm currently observing DST"} diff --git a/userctrl.php b/userctrl.php index de4aa3b..6955222 100644 --- a/userctrl.php +++ b/userctrl.php @@ -113,6 +113,7 @@ if ($_POST['do'] == 'update') $userapi->set('showcolours', $bugsys->in['showcolours']); $userapi->set('languageid', $bugsys->in['languageid']); $userapi->set('timezone', $bugsys->in['timezone']); + $userapi->set('usedst', $bugsys->in['usedst']); // ------------------------------------------------------------------- // copy fields @@ -121,6 +122,7 @@ if ($_POST['do'] == 'update') $userinfo['showcolours'] = $bugsys->in['showcolours']; $userinfo['languageid'] = $bugsys->in['languageid']; $userinfo['timezone'] = $bugsys->in['timezone']; + $userinfo['usedst'] = $bugsys->in['usedst']; $email = $bugsys->in['email']; $email_confirm = $bugsys->in['email_confirm']; -- 2.43.5