If an external source can supply a useful timezone name, we can use that.

This commit is contained in:
Andrew McMillan 2012-01-15 20:44:46 +13:00
parent 7140963e49
commit f9998cb782

View File

@ -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);