From f9998cb782c4f02e51b39d72f8a23f940d791d4c Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 15 Jan 2012 20:44:46 +1300 Subject: [PATCH] If an external source can supply a useful timezone name, we can use that. --- inc/auth-functions.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/inc/auth-functions.php b/inc/auth-functions.php index b716f2f6..8f10c4f8 100644 --- a/inc/auth-functions.php +++ b/inc/auth-functions.php @@ -68,7 +68,7 @@ function getPrincipalByID( $principal_id, $use_cache = true ) { * Creates some default home collections for the user. * @param string $username The username of the user we are creating relationships for. */ -function CreateHomeCollections( $username ) { +function CreateHomeCollections( $username, $defult_timezone = null ) { global $session, $c; if ( empty($c->home_calendar_name) && empty($c->home_addressbook_name) ) return true; @@ -185,6 +185,12 @@ function CreateDefaultRelationships( $username ) { } +function UpdateCollectionTimezones( $username, $new_timezone=null ) { + if ( empty($new_timezone) ) return; + $qry = new AwlQuery('UPDATE collection SET timezone=? WHERE dav_name LIKE ? AND is_calendar', '/'.$username.'/%', $new_timezone); + $qry->Exec(); +} + /** * Update the local cache of the remote user details * @param object $usr The user details we read from the remote. @@ -305,7 +311,7 @@ EOERRMSG; if ( $qry->Exec('Login',__LINE__,__FILE__) && $qry->rows() == 1 ) { $usr = $qry->Fetch(); if ( session_validate_password( $password, $usr->password ) ) { - $principal = new Principal($username); + $principal = new Principal('username',$username); if ( $principal->Exists() ) { if ( $principal->modified <= $usr->updated ) $principal->Update($usr);