当前位置: 首页>>代码示例>>PHP>>正文


PHP Article::getInstance方法代码示例

本文整理汇总了PHP中Article::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::getInstance方法的具体用法?PHP Article::getInstance怎么用?PHP Article::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Article的用法示例。


在下文中一共展示了Article::getInstance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionDisplay

 public function actionDisplay()
 {
     $model = Article::getInstance();
     $params["items"] = $model->getTinTuc();
     $page_title = "wapsite - trang tin tức tổng hợp nhanh nhất";
     setSysConfig("seopage.title", $page_title);
     setSysConfig("seopage.keyword", $page_title);
     setSysConfig("seopage.description", $page_title);
     $this->render('default', $params);
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:10,代码来源:HomeController.php

示例2: actionDisplay

 public function actionDisplay()
 {
     $cid = Request::getVar('id', null);
     $alias = Request::getVar('alias', null);
     $model = Article::getInstance();
     $obj_item = $model->getItem($cid, $alias);
     $obj_category = $model->getCategory($obj_item['catID']);
     $data['item'] = $obj_item;
     $data['category'] = $obj_category;
     $page_title = $obj_item['title'];
     $page_keyword = $obj_item['metakey'] != "" ? $obj_item['metakey'] : $page_title;
     $page_description = $obj_item['metadesc'] != "" ? $obj_item['metadesc'] : $page_title;
     setSysConfig("seopage.title", $page_title);
     setSysConfig("seopage.keyword", $page_keyword);
     setSysConfig("seopage.description", $page_description);
     $this->render('default', $data);
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:17,代码来源:DetailController.php

示例3: actionBlog

 public function actionBlog()
 {
     $model = Article::getInstance();
     $catAlias = Request::getVar('alias', null);
     $currentPage = Request::getVar('page', 1);
     $limit = 12;
     $data['alias'] = $catAlias;
     $catID = Request::getVar("id");
     $obj_category = $model->getCategory($catID, $catAlias);
     if ($obj_category == false) {
         $this->redirect($this->createUrl("articles/"));
     }
     $start = ($currentPage - 1) * $limit;
     $obj_category['items'] = $model->getArticlesCategoy($obj_category['id'], $start, $limit);
     if ($obj_category['total'] > $start + $limit) {
         $page = $currentPage + 1;
     } else {
         $page = $currentPage - 1;
     }
     $catAlias = $obj_category['alias'];
     if ($page > 1) {
         $obj_category['pagemore'] = Yii::app()->createUrl("articles/category", array("alias" => $catAlias, "page" => $page));
     } elseif ($page == 1) {
         $obj_category['pagemore'] = Yii::app()->createUrl("articles/category", array("alias" => $catAlias));
     }
     $page_title = $obj_category['title'];
     if ($currentPage > 1) {
         $page_title = $page_title . " trang {$currentPage}";
     }
     $page_keyword = $obj_category['metakey'] != "" ? $obj_category['metakey'] : $page_title;
     $page_description = $obj_category['metadesc'] != "" ? $obj_category['metadesc'] : $page_title;
     setSysConfig("seopage.title", $page_title);
     setSysConfig("seopage.keyword", $page_keyword);
     setSysConfig("seopage.description", $page_description);
     $data['category'] = $obj_category;
     $this->render('default', $data);
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:37,代码来源:CategoryController.php

示例4: reply

 public function reply()
 {
     $mail = $this->_sendInit();
     $this->js[] = "forum.post.js";
     $this->css[] = "post.css";
     $this->notice[] = array("url" => "/mail/send", "text" => "回复邮件");
     $u = User::getInstance();
     if (false === $mail) {
         //reply article
         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 {
             $b = Board::getInstance($type);
             if (!$b->hasReadPerm($u)) {
                 $this->error(ECode::$BOARD_NOPERM);
             }
             $mail = Article::getInstance($num, $b);
         } catch (Exception $e) {
             $this->error(ECode::$MAIL_NOMAIL);
         }
     }
     if (!strncmp($mail->TITLE, "Re: ", 4)) {
         $title = $mail->TITLE;
     } else {
         $title = "Re: " . $mail->TITLE;
     }
     $content = "\n" . $mail->getRef();
     //remove ref ubb tag
     $content = XUBB::remove($content);
     $this->set("rid", $mail->OWNER);
     $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));
     $this->render('send');
 }
开发者ID:tilitala,项目名称:nForum,代码行数:55,代码来源:mail_controller.php

示例5: _editInit

 private function _editInit()
 {
     if ($this->_board->isReadOnly()) {
         $this->error(ECode::$BOARD_READONLY);
     }
     if (!$this->_board->hasPostPerm(User::getInstance())) {
         $this->error(ECode::$BOARD_NOPOST);
     }
     if (!isset($this->params['id'])) {
         $this->error(ECode::$ARTICLE_NONE);
     }
     $id = intval($this->params['id']);
     try {
         $article = Article::getInstance($id, $this->_board);
     } catch (ArticleNullException $e) {
         $this->error(ECode::$ARTICLE_NONE);
     }
     $u = User::getInstance();
     if (!$article->hasEditPerm($u)) {
         $this->error(ECode::$ARTICLE_NOEDIT);
     }
     $this->set('reid', $id);
     return $article;
 }
开发者ID:rainsun,项目名称:nForum,代码行数:24,代码来源:article_controller.php

示例6: delete

 public function delete()
 {
     $u = User::getInstance();
     if (isset($this->params['gid'])) {
         try {
             $a = Article::getInstance(intval($this->params['gid']), $this->_board);
             if (!$a->hasEditPerm($u)) {
                 $this->error(ECode::$ARTICLE_NODEL);
             }
             if (!$a->delete()) {
                 $this->error(ECode::$ARTICLE_NODEL);
             }
         } catch (ArticleNullException $e) {
             $this->error(ECode::$ARTICLE_NONE);
         }
     }
     $single = isset($this->params['url']['s']) || isset($this->params['form']['s']);
     $this->redirect($this->_mbase . "/board/" . $this->_board->NAME . ($single ? "/0" : "") . "?m=" . ECode::$ARTICLE_DELOK);
 }
开发者ID:rainsun,项目名称:nForum,代码行数:19,代码来源:article_controller.php

示例7: actionSavecopy

 function actionSavecopy()
 {
     $cid = Request::getVar("id", 0);
     $model = Article::getInstance();
     $cid = $model->copyitem($cid);
     $this->redirect(Router::buildLink("articles", array("layout" => "edit", 'cid' => $cid)));
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:7,代码来源:homeController.php

示例8: _attList

 private function _attList()
 {
     $u = User::getInstance();
     if (isset($this->params['id'])) {
         $id = $this->params['id'];
         try {
             $article = Article::getInstance($id, $this->_board);
             if (!$article->hasEditPerm($u)) {
                 $this->error(ECode::$ARTICLE_NOEDIT);
             }
             $atts = $article->getAttList();
             $this->set("postUrl", "/{$article->ID}");
         } catch (Exception $e) {
             $this->error(ECode::$ARTICLE_NONE);
         }
     } else {
         $atts = Forum::listAttach();
     }
     return $atts;
 }
开发者ID:tilitala,项目名称:nForum,代码行数:20,代码来源:attachment_controller.php

示例9: send

 public function send()
 {
     if (!Mail::canSend()) {
         $this->error(ECode::$MAIL_SENDERROR);
     }
     $u = User::getInstance();
     $mail = false;
     if (isset($this->params['type']) && isset($this->params['num'])) {
         $type = $this->params['type'];
         $num = $this->params['num'];
         try {
             $mail = MAIL::getInstance($num, new MailBox($u, $type));
         } catch (Exception $e) {
         }
     }
     if ($this->RequestHandler->isPost()) {
         $title = $content = '';
         $sig = User::getInstance()->signature;
         if (isset($this->params['form']['title'])) {
             $title = trim($this->params['form']['title']);
         }
         if (isset($this->params['form']['content'])) {
             $content = $this->params['form']['content'];
         }
         $sig = 0;
         $bak = isset($this->params['form']['backup']) ? 1 : 0;
         $title = nforum_iconv($this->encoding, $this->appEncoding, $title);
         $content = nforum_iconv($this->encoding, $this->appEncoding, $content);
         try {
             if (false === $mail) {
                 //send new
                 if (!isset($this->params['form']['id'])) {
                     $this->error(ECode::$POST_NOID);
                 }
                 $id = trim($this->params['form']['id']);
                 Mail::send($id, $title, $content, $sig, $bak);
                 $this->redirect($this->_mbase . "/mail?m=" . ECode::$MAIL_SENDOK);
             } else {
                 //reply
                 $mail->reply($title, $content, $sig, $bak);
                 $this->redirect($this->_mbase . "/mail/{$type}?m=" . ECode::$MAIL_SENDOK);
             }
         } catch (MailSendException $e) {
             $this->error($e->getMessage());
         }
     }
     $uid = $title = $content = "";
     if (isset($this->params['type']) && isset($this->params['num'])) {
         $this->notice = "邮件-回复邮件";
         if (false === $mail) {
             //reply article
             try {
                 $b = Board::getInstance($type);
                 if (!$b->hasReadPerm($u)) {
                     $this->error(ECode::$BOARD_NOPERM);
                 }
                 $mail = Article::getInstance($num, $b);
             } catch (Exception $e) {
                 $this->error(ECode::$MAIL_NOMAIL);
             }
         }
         if (!strncmp($mail->TITLE, "Re: ", 4)) {
             $title = $mail->TITLE;
         } else {
             $title = "Re: " . $mail->TITLE;
         }
         $content = "\n" . $mail->getRef();
         //remove ref ubb tag
         $content = XUBB::remove($content);
         $uid = $mail->OWNER;
     } else {
         $this->notice = "邮件-新邮件";
     }
     $this->set("uid", $uid);
     $this->set("title", $title);
     $this->set("content", $content);
     $this->set("bak", $u->getCustom("mailbox_prop", 0));
 }
开发者ID:tilitala,项目名称:nForum,代码行数:78,代码来源:mail_controller.php

示例10: delete

 public function delete()
 {
     if (!$this->RequestHandler->isPost()) {
         $this->error(ECode::$SYS_REQUESTERROR);
     }
     if (!isset($this->params['id'])) {
         $this->error(ECode::$ARTICLE_NONE);
     }
     $id = intval($this->params['id']);
     try {
         App::import('vendor', "model/article");
         $article = Article::getInstance($id, $this->_board);
     } catch (ArticleNullException $e) {
         $this->error(ECode::$ARTICLE_NONE);
     }
     $u = User::getInstance();
     if (!$article->hasEditPerm($u)) {
         $this->error(ECode::$ARTICLE_NODEL);
     }
     $wrapper = Wrapper::getInstance();
     $this->set('data', $wrapper->article($article, array('content' => true)));
     if (!$article->delete()) {
         $this->error(ECode::$ARTICLE_NODEL);
     }
 }
开发者ID:rainsun,项目名称:nForum,代码行数:25,代码来源:article_controller.php

示例11: delete

 public function delete()
 {
     if (!$this->RequestHandler->isPost()) {
         $this->error(ECode::$SYS_REQUESTERROR);
     }
     $this->_attOpInit();
     $u = User::getInstance();
     if (!isset($this->params['form']['name'])) {
         $this->error(ECode::$ATT_NAMEERROR);
     }
     $attName = strval($this->params['form']['name']);
     try {
         if (isset($this->params['id'])) {
             $id = $this->params['id'];
             $article = Article::getInstance($id, $this->_board);
             if (!$article->hasEditPerm($u)) {
                 $this->error(ECode::$ARTICLE_NOEDIT);
             }
             $attNum = 0;
             foreach ($article->getAttList() as $k => $v) {
                 if ($v['name'] == $attName) {
                     $attNum = intval($k + 1);
                     break;
                 }
             }
             $article->delAttach($attNum);
             $article = Article::getInstance($id, $this->_board);
         } else {
             Forum::delAttach($attName);
             $article = Forum::listAttach();
         }
         $wrapper = Wrapper::getInstance();
         $this->set('data', $wrapper->attachment($article));
         return;
     } catch (ArchiveAttException $e) {
         $msg = $e->getMessage();
     } catch (AttException $e) {
         $msg = $e->getMessage();
     } catch (Exception $e) {
         $this->error();
     }
 }
开发者ID:tilitala,项目名称:nForum,代码行数:42,代码来源:attachment_controller.php

示例12: classic

 public function classic()
 {
     $map = array("recommend" => array("commend.xml", "近期热点活动", "/board/recommend"), "bless" => array("bless.xml", "十大祝福", "/board/Blessing"));
     if (!isset($this->params['file'])) {
         $this->_stop();
     }
     $key = strtolower(trim($this->params['file']));
     if (!array_key_exists($key, $map)) {
         $this->_stop();
     }
     $file = BBS_HOME . "/xml/" . $map[$key][0];
     if (!file_exists($file)) {
         $this->_stop();
     }
     $mTime = @filemtime($file);
     $this->cache(true, $mTime);
     $this->header("Content-Type: text/xml; charset=" . $this->encoding);
     $this->header("Content-Disposition: inline;filename={$key}.xml");
     $this->_cache_read($key, $mTime);
     $channel = $items = array();
     $channel['title'] = $map[$key][1];
     $channel['description'] = $this->_siteName . $map[$key][1];
     $channel['link'] = $this->_domain . $this->base . $map[$key][2];
     $channel['language'] = "zh-cn";
     $channel['generator'] = "nForum RSS Generator By xw";
     if ($mTime > 0) {
         $channel['lastBuildDate'] = $mTime;
     }
     $ret = array();
     $xml = simplexml_load_file($file);
     if ($xml == false) {
         return $ret;
     }
     foreach ($xml->hotsubject as $v) {
         $board = $v->o_board == "" ? $v->board : $v->o_board;
         $id = $v->o_groupid == 0 ? $v->groupid : $v->o_groupid;
         $link = $this->_domain . $this->base . '/article/' . $board . '/' . $id;
         $item = array("title" => nforum_fix_gbk(urldecode($v->title)), "link" => $link, "author" => $v->owner, "pubDate" => intval($v->time), "guid" => $link, "comments" => $link);
         try {
             $article = Article::getInstance(intval($v->groupid), Board::getInstance($v->board));
             $item['description'] = "<![CDATA[" . XUBB::parse($article->getHtml()) . "]]>";
         } catch (Exception $e) {
         }
         $items[] = $item;
     }
     $rss = new Rss($channel, $items);
     $out = $rss->getRss();
     $this->_cache_write($key, $mTime, $out);
     echo $out;
     $this->_stop();
 }
开发者ID:tilitala,项目名称:nForum,代码行数:51,代码来源:rss_controller.php


注:本文中的Article::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。