<?php require_once 'libgmailer.php'; require_once '../Templates.php'; error_reporting(0); $gm = new GMailer(); if (!$gm->created) { die("GMailer not created"); } $gm->getCookieFromBrowser(); $mode = $_GET['mode']; if (strlen($mode) != 0 and $mode != 'enter' and !$gm->isConnected()) { header("Location: ?"); } switch ($mode) { case 'new': $tpl = new Templates('tpls'); $tpl->set('contact_form', array('name' => "", 'email' => "", 'id' => -1)); $tpl->set('main', 'content', $tpl->parse('contact_form')); print $tpl->parse('main'); break; case 'edit': $id = $_GET['id']; if (!$gm->fetchBox(GM_CONTACT, 'detail', $id)) { die($gm->lastActionStatus()); } $sps = $gm->getSnapshot(GM_CONTACT); $tpl = new Templates('tpls'); foreach ($sps->contacts as $c) { $tpl->set('contact_form', array('name' => $c['name'], 'email' => $c['email'], 'id' => $id)); $tpl->set('main', 'content', $tpl->parse('contact_form'));