/** * DEMO * */ public function doDefault() { $base = dirname(__FILE__); // QQ验证码 if (isset($_GET['image'])) { header("Content-Type: image/jpeg"); importModule("Mail._qq"); _qq::getImage(); exit; } // QQ邮件验证码 if (isset($_GET['image_mail'])) { header("Content-Type: image/jpeg"); importModule("Mail._qqmail"); _qqmail::getImage(); exit; } // 初始化smarty import('smarty.Smarty'); $smarty = new Smarty(); $smarty->template_dir = $this->app->cfg['smarty']['template_dir']; $smarty->compile_dir = $this->app->cfg['smarty']['compile_dir']; $smarty->config_dir = $this->app->cfg['smarty']['config_dir']; $smarty->cache_dir = $this->app->cfg['smarty']['cache_dir']; $smarty->debugging = $this->app->cfg['smarty']['debugging']; $smarty->caching = $this->app->cfg['smarty']['caching']; $smarty->cache_lifetime = $this->app->cfg['smarty']['cache_lifetime']; $smarty->left_delimiter = '{<'; $smarty->right_delimiter = '>}'; // 逻辑处理 $result = null; if (isset($_POST['type'])) { $type = $_POST['type']; $login = $_POST['login']; $pass = $_POST['passwd']; if ($login == "" || $pass == "") { $result = "用户名密码空!"; } else { if ($type == 'mail') { $type = $_POST['mail']; if (strpos($type, '@') !== false) { list($type, $name) = explode("@", $type); $login .= '@' . $name; } } $list = new MailList(); $MailList = $list->init($type); $MailList->mail->set($login, $pass, trim($_POST['code'])); $result = print_r($MailList->getList(), true); if ($result == false) { $result = "用户名或密码不正确"; } } } $QQimage = "?image=qq"; $smarty->assign("QQ", $QQimage); $smarty->assign("result", $result); $smarty->display($base . "\\demo.tpl"); }
/** * Build and return admin interface * * Any module providing an admin interface is required to have this function, which * returns a string containing the (x)html of it's admin interface. * @return string */ function getAdminInterface() { switch (@$_REQUEST['section']) { case 'lists': switch (@$_REQUEST['action']) { case 'updateList': $list = new MailList($_REQUEST['listId']); $form = $list->getListUsersForm(); return; break; case 'delete': $list = new MailList(@$_REQUEST['maillist_id']); $list->delete(); break; case 'addedit': $list = new MailList(@$_REQUEST['maillist_id']); $form = $list->getAddEditForm(); if (!$form->validate() || !$form->isSubmitted() || !isset($_REQUEST['maillist_submit'])) { return $form->display(); } break; } $this->addJS('/modules/Mail/js/list_edit.js'); $lists = MailList::getAllMailLists(); $this->smarty->assign('lists', $lists); return $this->smarty->fetch('admin/lists.tpl'); case 'users': switch (@$_REQUEST['action']) { case 'addedit': $user = new MailUser(@$_REQUEST['mailuser_id']); $form = $user->getAddEditForm(); if (!$form->validate() || !$form->isSubmitted() || !isset($_REQUEST['mailuser_submit'])) { return $form->display(); } break; case 'delete': $user = new MailUser(@$_REQUEST['mailuser_id']); $user->delete(); break; } $users = MailUser::getAllMailUsers(); $this->smarty->assign('users', $users); return $this->smarty->fetch('admin/users.tpl'); case 'content': default: $this->addCSS('/modules/Mail/css/send.css'); switch (@$_REQUEST['action']) { case 'delete': $content = new MailContent(@$_REQUEST['mailcontent_mail_id']); $content->delete(); break; case 'addedit': $content = new MailContent(@$_REQUEST['mailcontent_mail_id']); $form = $content->getAddEditForm(); if (!$form->validate() || !$form->isSubmitted() || !isset($_REQUEST['mailcontent_submit'])) { return $form->display(); } else { break; } case 'send': $lists = MailList::getAllMailLists(); $content = new MailContent(@$_REQUEST['mailcontent_mail_id']); $this->smarty->assign('content', $content); $this->smarty->assign('lists', $lists); return $this->smarty->fetch('admin/send.tpl'); break; case 'queue': $list = new MailList($_REQUEST['maillist_id']); $content = new MailContent($_REQUEST['mailcontent_id']); $sendout = new MailSendOut(); $sendout->accept($content); $sendout->setTimestamp(date('Y-m-d H:i:s')); $sendout->setListCount($list->getListCount()); $sendout->save(); $list->queueUsers($sendout); break; case 'iframe_preview': $content = new MailContent(@$_REQUEST['mailcontent_mail_id']); $this->smarty->assign('content', $content); echo $this->smarty->fetch('admin/shell.tpl'); die; break; } $contents = MailContent::getAllMailContents(); $this->smarty->assign('contents', $contents); return $this->smarty->fetch('admin/contents.tpl'); case 'reports': switch (@$_REQUEST['action']) { case 'view': $report = new MailReport($_REQUEST['rid']); $this->smarty->assign('report', $report); return $this->smarty->fetch('admin/report_detail.tpl'); break; default: break; } $this->addCSS('/modules/Mail/css/report.css'); $this->addJS('/modules/Mail/js/report.js'); $reports = MailReport::getAllReports(); $this->smarty->assign('reports', $reports); return $this->smarty->fetch('admin/reports.tpl'); break; } }
$sanity = new Sanity(); require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/System/LoggedOnly.class.php"; new LoggedOnly(); require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/IniSets.class.php"; new IniSets(); require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/System/Manager.class.php"; $mn = new Manager(); require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/MuDatabase.class.php"; $db = new MuDatabase(); if ($mn->GetUserLevel($_SESSION['ManagerId'], $db) < $ManagerMailListLevel) { require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/Language/{$MainLanguage}/Manager.php"; $db->Disconnect(); exit("{$ManagerMessage01}"); } require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/System/MailList.class.php"; $ml = new MailList($db); switch ($_GET['action']) { case "new": echo $ml->AddMessageForm(); break; case "AddMessage": echo $ml->AddMessage($db, $_POST); break; case "EditMessage": echo $ml->EditMessageForm($_GET['idx'], $db); break; case "SaveMessage": echo $ml->SaveMessage($db, $_POST); break; case "DeleteMessage": echo $ml->DeleteMessage($db, $_POST['idx']);