google fixes

This commit is contained in:
SJ 2014-01-16 23:02:23 +01:00
parent 2c7e4ac3eb
commit 18dff068df
5 changed files with 10 additions and 25 deletions

View File

@ -327,7 +327,7 @@ create index `audit_idx5` on `audit`(`domain`);
create table if not exists `google` (
`id` bigint unsigned not null primary key,
`id` char(32) not null primary key,
`email` char(128) not null unique,
`access_token` char(255) default null,
`refresh_token` char(255) default null,
@ -336,7 +336,7 @@ create table if not exists `google` (
create table if not exists `google_imap` (
`id` bigint unsigned not null,
`id` char(32) not null primary key,
`email` char(128) not null,
`last_msg_id` bigint default 0,
key(`email`)

View File

@ -26,3 +26,6 @@ alter table ldap add column ldap_account_objectclass varchar(128) default null;
alter table ldap add column ldap_distributionlist_attr varchar(128) default null;
alter table ldap add column ldap_distributionlist_objectclass varchar(128) default null;
alter table google change column id id char(32) not null primary key;
alter table google_imap change column id id char(32) not null primary key;

View File

@ -1,13 +1,13 @@
<?php
ini_set("session.save_path", "/tmp");
$webuidir = "";
if(isset($_SERVER['argv'][1])) { $webuidir = $_SERVER['argv'][1]; }
require_once($webuidir . "/config.php");
ini_set("session.save_path", DIR_TMP);
require(DIR_SYSTEM . "/startup.php");
require_once 'Zend/Mail/Protocol/Imap.php';

View File

@ -12,14 +12,6 @@ class ModelUserGoogle extends Model {
$user = $query->row;
}
else {
/*
[id] => 11731982531819289345
[email] => bela@bacsi.hu
[verified_email] => 1
[name] => Bela Bacsi
[given_name] => Bela
[family_name] => Bacsi
*/
$d = explode('@', $google_account['email']);
@ -57,8 +49,8 @@ class ModelUserGoogle extends Model {
}
public function update_tokens($email = '', $id = 0, $token = array()) {
if($email == '') { return 0; }
public function update_tokens($email = '', $id = '', $token = array()) {
if($email == '' || $id == '') { return 0; }
$query = $this->db->query("SELECT email FROM " . TABLE_GOOGLE . " WHERE email=?", array($email));
@ -70,16 +62,6 @@ class ModelUserGoogle extends Model {
}
return $this->db->countAffected();
/*
[access_token] => ya29.AHES6ZSavh4CnWXyfAYRNwqqZ3FmZ-bHPZkWIEPlutG6K_E
[token_type] => Bearer
[expires_in] => 3600
[refresh_token] => 1/J7bwdfCfQkjCu3Q51ypdJeGOzOtw6F1uyg1vaAwOZ2Q
[created] => 1348415267
*/
}

View File

@ -2,7 +2,7 @@
function is_mobile_device() {
if(!isset($_SERVER['HTTP_USER_AGENT'])) { return 0; }
if(!isset($_SERVER['HTTP_USER_AGENT'])) { define('OUTLOOK', 0); return 0; }
if(strstr($_SERVER['HTTP_USER_AGENT'], "Microsoft Outlook")) { define('OUTLOOK', 1); } else { define('OUTLOOK', 0); }