Пример #1
0
 public function ajax_list()
 {
     $f = new Friend(User::getInstance());
     $friends = $f->getRecord(1, $f->getTotalNum());
     $ret = array();
     foreach ($friends as $v) {
         $ret[] = $v->userid;
     }
     $this->set('no_html_data', $ret);
     $this->set('no_ajax_info', true);
 }
Пример #2
0
 public function send()
 {
     $this->_sendInit();
     $this->js[] = "forum.post.js";
     $this->css[] = "post.css";
     $this->notice[] = array("url" => "/mail/send", "text" => "撰写邮件");
     $u = User::getInstance();
     $title = $content = "";
     if (isset($this->params['url']['id'])) {
         try {
             $user = User::getInstance($this->params['url']['id']);
         } catch (UserNullException $e) {
             $this->error(ECode::$USER_NOID);
         }
         $this->set("rid", $user->userid);
     } else {
         //show my friends
         $f = new Friend($u);
         $friends = $f->getRecord(1, $f->getTotalNum());
         $ret = array();
         foreach ($friends as $v) {
             $ret[$v->userid] = $v->userid;
         }
         $this->set("friends", $ret);
     }
     $sigOption = array();
     foreach (range(0, $u->signum) as $v) {
         if ($v == 0) {
             $sigOption["{$v}"] = "不使用签名档";
         } else {
             $sigOption["{$v}"] = "使用第{$v}个";
         }
     }
     $sigOption["-1"] = "使用随机签名档";
     App::import('Sanitize');
     $title = Sanitize::html($title);
     $content = Sanitize::html($content);
     $this->set("title", $title);
     $this->set("content", $content);
     $this->set("sigOption", $sigOption);
     $this->set("sigNow", $u->signature);
     $this->set("bak", $u->getCustom("mailbox_prop", 0));
 }
Пример #3
0
 public function forward()
 {
     $this->requestLogin();
     if (!isset($this->params['gid'])) {
         $this->error(ECode::$ARTICLE_NONE);
     }
     $single = isset($this->params['url']['s']) || isset($this->params['form']['s']);
     if ($this->RequestHandler->isPost()) {
         if (!isset($this->params['form']['target'])) {
             $this->error(ECode::$USER_NONE);
         }
         $gid = intval($this->params['gid']);
         $target = trim($this->params['form']['target']);
         $threads = isset($this->params['form']['threads']);
         $noref = isset($this->params['form']['noref']);
         $noatt = isset($this->params['form']['noatt']);
         $noansi = isset($this->params['form']['noansi']);
         $big5 = isset($this->params['form']['big5']);
         try {
             $gid = $this->params['gid'];
             $article = Article::getInstance($gid, $this->_board);
             if ($threads) {
                 $t = Threads::getInstance($article->GROUPID, $this->_board);
                 $t->forward($target, $t->ID, $noref, $noatt, $noansi, $big5);
             } else {
                 $article->forward($target, $noatt, $noansi, $big5);
             }
         } catch (ArticleNullException $e) {
             $this->error(ECode::$ARTICLE_NONE);
         } catch (ArticleForwardException $e) {
             $this->error($e->getMessage());
         }
         $this->redirect($this->_mbase . "/board/" . $this->_board->NAME . ($single ? "/0" : "") . "?m=" . ECode::$ARTICLE_FORWARDOK);
     }
     $this->notice = "{$this->_board->DESC}-转寄";
     App::import("vendor", array("model/friend"));
     $f = new Friend(User::getInstance());
     $friends = $f->getRecord(1, $f->getTotalNum());
     $ret = array();
     foreach ($friends as $v) {
         $ret[] = $v->userid;
     }
     $this->set('friends', $ret);
     $this->set('bName', $this->_board->NAME);
     $this->set('gid', $this->params['gid']);
     $this->set("single", $single);
 }
Пример #4
0
 public function forward()
 {
     if (!isset($this->params['type'])) {
         $this->error(ECode::$MAIL_NOBOX);
     }
     if (!isset($this->params['num'])) {
         $this->error(ECode::$MAIL_NOMAIL);
     }
     $type = $this->params['type'];
     $num = $this->params['num'];
     try {
         $box = new MailBox(User::getInstance(), $type);
         $mail = Mail::getInstance($num, $box);
     } catch (Exception $e) {
         $this->error(ECode::$MAIL_NOMAIL);
     }
     if ($this->RequestHandler->isPost()) {
         if (!isset($this->params['form']['target'])) {
             $this->error(ECode::$USER_NONE);
         }
         $target = trim($this->params['form']['target']);
         $noansi = isset($this->params['form']['noansi']);
         $big5 = isset($this->params['form']['big5']);
         try {
             $mail->forward($target, $noansi, $big5);
         } catch (MailSendException $e) {
             $this->error($e->getMessage());
         }
         $this->redirect($this->_mbase . "/mail/{$type}/{$num}?m=" . ECode::$MAIL_FORWARDOK);
     }
     $this->notice = "邮件-转寄";
     App::import("vendor", array("model/friend"));
     $f = new Friend(User::getInstance());
     $friends = $f->getRecord(1, $f->getTotalNum());
     $ret = array();
     foreach ($friends as $v) {
         $ret[] = $v->userid;
     }
     $this->set('friends', $ret);
     $this->set('type', $type);
     $this->set('num', $num);
 }