Exemple #1
0
     break;
 case 'email':
     $email = $_GET['email'];
     if (!isset($email)) {
         $email = "";
     }
     $tpl = new Templates('tpls');
     $tpl->set('email_form', 'email', $email);
     $tpl->set('main', 'content', $tpl->parse('email_form'));
     print $tpl->parse('main');
     break;
 case 'send':
     $email = $_POST['email'];
     $subj = $_POST['subj'];
     $body = $_POST['content'];
     if (!$gm->send($email, $subj, $body)) {
         die($gm->lastActionStatus());
     }
     header("Location: ?mode=list");
     break;
 case 'list':
     $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'));