public function index($id = '')
 {
     if ($id == '') {
         View::AdminErrorMessage('goback', '木有选择文章哦!');
     }
     $fields = Request::getRequest('page', 'int');
     $page = isset($fields) && $fields > 0 ? $fields : 1;
     $article = self::$models->Article;
     $comment = self::$models->Comment;
     $mem = self::$models->Memcache;
     $ret = $mem->get('articleshowController_index_id_' . $id);
     if (empty($ret)) {
         $ret = array();
         $ret['articleShow'] = $article->getArticleShow($id);
         if (empty($ret['articleShow'])) {
             NotFound();
         }
         $ret['articleShow']['tag'] = explode('|', $ret['articleShow']['tag']);
         $ret['articleRelevant'] = $article->getArticleRelevant($ret['articleShow']['mid'], $ret['articleShow']['id']);
         $ret['pushArticleList'] = $article->getPushArticleList();
         $ret['newArticleList'] = $article->getNewArticleList();
         $ret['commentArticleList'] = $article->getCommentArticleList();
         $mem->set('articleshowController_index_id_' . $id, $ret);
     }
     $ret['comments'] = $comment->getArticleCommentList($id, $page);
     if (!empty($ret['comments']['counts'])) {
         $ret['articleShow']['counts'] = array_pop($ret['comments']);
     }
     if (!empty($ret['comments']['page'])) {
         $ret['articleShow']['commentPage_nav'] = array_pop($ret['comments']);
     }
     $article->updatePlus($id, 'clicks');
     //文章的点击数+1
     View::Transmit('articleshow', $ret);
 }
Exemple #2
0
 public function articletag($tagurl = '')
 {
     $tag = self::$models->Tag;
     if (!empty($tagurl)) {
         $tagurl = iconv('gbk', 'utf-8', urldecode($tag));
     } else {
         View::AdminErrorMessage('goback', '非法入口!Go Die');
     }
     $ret = $tag->getTagByTag($tagurl);
     empty($ret) ? $this->index(1) : $this->index($ret['id']);
 }
Exemple #3
0
 public static function pushs()
 {
     $ret = array();
     $diary = self::$models->Diary;
     $ret['pushs'] = $diary->getPushList();
     if (Request::getRequest('dosubmit', 'str')) {
         $pushimg = Request::getRequest('pushimg', 'array');
         $pushurl = Request::getRequest('pushurl', 'array');
         $result = $diary->editPush(self::$models->make('Qiniu', array('alice')), $pushurl, $pushimg, $_FILES['doc']);
         $result ? View::AdminMessage('admin/pushs', '修改成功') : View::AdminErrorMessage('goback', '修改失败');
     }
     View::Transmit('admin/pushs', $ret);
 }
 public function search()
 {
     if (Request::getRequest('dosubmit', 'str')) {
         $mem = self::$models->Memcache;
         $index = self::$models->Index;
         $article = self::$models->Article;
         $ret = $mem->get('indexController_search');
         if (empty($ret)) {
             $ret = array();
             $ret['pushArticleList'] = $article->getPushArticleList();
             $ret['newArticleList'] = $article->getNewArticleList();
             $ret['commentArticleList'] = $article->getCommentArticleList();
             $mem->set('indexController_search', $ret, 12 * 3600);
         }
         $ret['keyword'] = Request::getRequest('search', 'str');
         $ret['searchList'] = $index->getSearchList($ret['keyword']);
         View::Transmit('search', $ret);
     } else {
         View::AdminErrorMessage('goback', '没有输入关键词!');
     }
 }
Exemple #5
0
 public static function comments()
 {
     $fields = Request::getRequest('page', 'int');
     $page = isset($fields) && $fields > 0 ? $fields : 1;
     $ret = $scree = array();
     $comment = self::$models->Comment;
     if (Request::getRequest('keyword', 'str') && Request::getRequest('keyword_type', 'str')) {
         $scree['keyword'] = Request::getRequest('keyword', 'str');
         $scree['keyword_type'] = Request::getRequest('keyword_type', 'str');
         $ret['CommentList'] = $comment->getCommentList($page, $scree);
     } elseif (!empty(Request::getRequest('aid', 'int'))) {
         $scree['keyword'] = Request::getRequest('aid', 'int');
         $scree['keyword_type'] = 'aid';
         $ret['CommentList'] = $comment->getCommentList($page, $scree);
     } else {
         $ret['CommentList'] = $comment->getCommentList($page);
     }
     $ret['scree'] = $scree;
     $ret['pageNav'] = @array_pop($ret['CommentList']);
     View::Transmit('admin/comments', $ret);
 }
Exemple #6
0
 public static function edit($type, $id)
 {
     $ret = $fields = array();
     $user = self::$models->User;
     $ret['users'] = $user->getOneUser($type, $id);
     if (Request::getRequest('dosubmit', 'str')) {
         $fields['username'] = Request::getRequest('username', 'str');
         $fields['email'] = Request::getRequest('email', 'str');
         $fields['password'] = Request::getRequest('oldpw', 'str');
         $fields['newpw'] = Request::getRequest('newpw', 'str');
         $fields['newpw_a'] = Request::getRequest('newpw_a', 'str');
         if (empty($fields['password']) && empty($fields['newpw'])) {
             $fields['password'] = $ret['users']['password'];
             unset($fields['newpw']);
             unset($fields['newpw_a']);
         } else {
             $password = $ret['users']['password'];
             if ($password !== md5($fields['password'])) {
                 View::AdminErrorMessage('admin/user_edit', '原始密码不正确');
             }
             $fields['password'] = md5($fields['newpw_a']);
             unset($fields['newpw']);
             unset($fields['newpw_a']);
         }
         $result = $user->editUser($id, $fields);
         if ($result) {
             if ($fields['username'] !== $ret['users']['username']) {
                 $session = Request::getSession('admin_user_login');
                 $session['username'] = $fields['username'];
                 Request::setSession('admin_user_login', $session);
                 $user->editArticleAuthor($fields['username'], $id);
             }
             View::AdminMessage('goback', '修改成功');
         } else {
             View::AdminErrorMessage('goback', '修改失败');
         }
     }
     View::Transmit('admin/user_edit', $ret);
 }
 public function wxindex()
 {
     //这里可以对微信登录用户进行一些操作~~~
     View::jsJump('/admin/index');
 }
Exemple #8
0
    public static function baiduSite()
    {
        if (Request::getRequest('dosubmit', 'str')) {
            $fields = Request::getRequest('pushbaidu', 'array');
            $api = BAIDU_SITE_API;
            $ch = curl_init();
            $options = array(CURLOPT_URL => $api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => implode('
', $fields), CURLOPT_HTTPHEADER => array('Content-Type: text/plain'));
            curl_setopt_array($ch, $options);
            $result = curl_exec($ch);
            strpos($result, 'success') ? View::AdminMessage('goback', '成功推送' . $result) : View::AdminErrorMessage('goback', '推送失败' . $result);
        }
        View::Transmit('admin/baidusite');
    }
Exemple #9
0
 public static function tag_delete($id)
 {
     $tag = self::$models->Tag;
     $result = $tag->delTag($id);
     $result ? View::AdminMessage('admin/tags', '删除成功') : View::AdminErrorMessage('goback', '删除失败');
 }
Exemple #10
0
 public function liuy()
 {
     View::Transmit('liuy');
 }