示例#1
0
 function getAddressbook($gmail_acc, $gmail_pwd)
 {
     $my_timezone = 0;
     $gmailer = new GMailer();
     if ($gmailer->created) {
         $gmailer->setLoginInfo($gmail_acc, $gmail_pwd, $my_timezone);
         echo "Created gmailer obj...<br />";
         if ($gmailer->connect()) {
             echo 'connected with gmailer obj...<br />';
             // GMailer connected to Gmail successfully.
             // Do something with it.
             //Get the contacts
             // For "Inbox"
             $gmailer->fetchBox(GM_CONTACT, "all", "");
             $snapshot = $gmailer->getSnapshot(GM_CONTACT);
             //Outputs an array of the contacts
             return $snapshot;
             return $snapshot->contacts;
             //Outputs the number of contacts
             //var_dump($snapshot->contacts_total);
         } else {
             return $gmailer->lastActionStatus();
         }
     }
 }
示例#2
0
     $tpl = new Templates('tpls');
     $gm->fetchBox(GM_CONTACT, "all", 0);
     $snapshot = $gm->getSnapshot(GM_CONTACT);
     $cs = "";
     foreach ($snapshot->contacts as $c) {
         $tpl->set('contact', array('id' => $c['id'], 'name' => $c['name'], 'email' => $c['email']));
         $cs = $cs . $tpl->parse('contact');
     }
     $tpl->set('contacts', 'list', $cs);
     $tpl->set('main', 'content', $tpl->parse('contacts'));
     print $tpl->parse('main');
     break;
 case 'enter':
     $u = $_POST['user'];
     $p = $_POST['pass'];
     $gm->setLoginInfo($u, $p, 1.0);
     if ($gm->connect()) {
         $gm->saveCookieToBrowser();
         header("Location: ?mode=list");
     } else {
         die("f**k");
         header("Location: ?");
     }
     break;
 case 'logout':
     $gm->removeCookieFromBrowser();
     header("Location: ?");
     break;
 default:
     $tpl = new Templates('tpls');
     $tpl->set('main', 'content', $tpl->parse('login'));