示例#1
0
 public function run()
 {
     $order = $this->getInput('order', 'get');
     $page = intval($this->getInput('page', 'get'));
     $threadList = new PwThreadList();
     $this->runHook('c_index_run', $threadList);
     $threadList->setPage($page)->setPerpage(Wekit::C('bbs', 'thread.perpage'));
     Wind::import('SRV:forum.srv.threadList.PwNewThread');
     $forbidFids = Wekit::load('forum.srv.PwForumService')->getForbidVisitForum($this->loginUser);
     $dataSource = new PwNewThread($forbidFids);
     if ($order == 'postdate') {
         $dataSource->setOrderBy($order);
     } else {
         $dataSource->setOrderBy('lastpost');
     }
     $threadList->execute($dataSource);
     if ($threadList->total > 12000) {
         Wekit::load('forum.PwThreadIndex')->deleteOver($threadList->total - 10000);
     }
     $threaddb = $threadList->getList();
     $fids = array();
     foreach ($threaddb as $key => $value) {
         $fids[] = $value['fid'];
     }
     $forums = Wekit::load('forum.srv.PwForumService')->fetchForum($fids);
     if ($operateThread = $this->loginUser->getPermission('operate_thread', false, array())) {
         $operateThread = Pw::subArray($operateThread, array('delete'));
     }
     $this->setOutput($threadList, 'threadList');
     $this->setOutput($threaddb, 'threaddb');
     $this->setOutput($forums, 'forums');
     $this->setOutput($threadList->icon, 'icon');
     $this->setOutput($threadList->uploadIcon, 'uploadIcon');
     $this->setOutput(26, 'numofthreadtitle');
     $this->setOutput($order, 'order');
     $this->setOutput($operateThread, 'operateThread');
     $this->setOutput($threadList->page, 'page');
     $this->setOutput($threadList->perpage, 'perpage');
     $this->setOutput($threadList->total, 'count');
     $this->setOutput($threadList->maxPage, 'totalpage');
     $this->setOutput($threadList->getUrlArgs(), 'urlargs');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     $threadList->page <= 1 && PwSeoBo::setDefaultSeo($lang->getMessage('SEO:bbs.forum.run.title'), '', $lang->getMessage('SEO:bbs.forum.run.description'));
     PwSeoBo::init('bbs', 'new');
     PwSeoBo::set('{page}', $threadList->page);
 }
示例#2
0
 /**
  * 帖子阅读页
  */
 public function run()
 {
     $tid = intval($this->getInput('tid'));
     list($page, $uid, $desc) = $this->getInput(array('page', 'uid', 'desc'), 'get');
     $threadDisplay = new PwThreadDisplay($tid, $this->loginUser);
     $this->runHook('c_read_run', $threadDisplay);
     if (($result = $threadDisplay->check()) !== true) {
         $this->showError($result->getError());
     }
     $_cache = Wekit::cache()->fetch(array('level', 'group_right'));
     $pwforum = $threadDisplay->getForum();
     if ($pwforum->foruminfo['password']) {
         if (!$this->loginUser->isExists()) {
             $this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('bbs/cate/run', array('fid' => ${$pwforum}->fid))));
         } elseif (Pw::getPwdCode($pwforum->foruminfo['password']) != Pw::getCookie('fp_' . $pwforum->fid)) {
             $this->forwardAction('bbs/forum/password', array('fid' => $pwforum->fid));
         }
     }
     if ($uid) {
         Wind::import('SRV:forum.srv.threadDisplay.PwUserRead');
         $dataSource = new PwUserRead($threadDisplay->thread, $uid);
     } else {
         Wind::import('SRV:forum.srv.threadDisplay.PwCommonRead');
         $dataSource = new PwCommonRead($threadDisplay->thread);
     }
     $dataSource->setPage($page)->setPerpage($pwforum->forumset['readperpage'] ? $pwforum->forumset['readperpage'] : Wekit::C('bbs', 'read.perpage'))->setDesc($desc);
     $threadDisplay->setImgLazy(Wekit::C('bbs', 'read.image_lazy'));
     $threadDisplay->execute($dataSource);
     $operateReply = $operateThread = array();
     $isBM = $pwforum->isBM($this->loginUser->username);
     if ($threadPermission = $this->loginUser->getPermission('operate_thread', $isBM, array())) {
         $operateReply = Pw::subArray($threadPermission, array('toppedreply', 'remind', 'shield', 'delete', 'ban', 'inspect', 'read'));
         $operateThread = Pw::subArray($threadPermission, array('digest', 'topped', 'up', 'highlight', 'copy', 'type', 'move', 'lock', 'down', 'delete', 'ban'));
     }
     $threadInfo = $threadDisplay->getThreadInfo();
     $this->setOutput($threadDisplay, 'threadDisplay');
     $this->setOutput($tid, 'tid');
     $this->setOutput($threadDisplay->fid, 'fid');
     $this->setOutput($threadInfo, 'threadInfo');
     $this->setOutput($threadDisplay->getList(), 'readdb');
     $this->setOutput($threadDisplay->getUsers(), 'users');
     $this->setOutput($pwforum, 'pwforum');
     $this->setOutput(PwCreditBo::getInstance(), 'creditBo');
     $this->setOutput($threadDisplay->getHeadguide(), 'headguide');
     $this->setOutput(Wekit::C('bbs', 'read.display_member_info'), 'displayMemberInfo');
     $this->setOutput(Wekit::C('bbs', 'read.display_info'), 'displayInfo');
     $this->setOutput(Wekit::C('bbs', 'thread.hotthread_replies'), 'hotIcon');
     $this->setOutput($threadPermission, 'threadPermission');
     $this->setOutput($operateThread, 'operateThread');
     $this->setOutput($operateReply, 'operateReply');
     $this->setOutput(!$this->loginUser->uid && !$this->allowPost($pwforum) ? ' J_qlogin_trigger' : '', 'postNeedLogin');
     $this->setOutput(!$this->loginUser->uid && !$this->allowReply($pwforum) ? ' J_qlogin_trigger' : '', 'replyNeedLogin');
     $this->setOutput($_cache['level']['ltitle'], 'ltitle');
     $this->setOutput($_cache['level']['lpic'], 'lpic');
     $this->setOutput($_cache['level']['lneed'], 'lneed');
     $this->setOutput($_cache['group_right'], 'groupRight');
     $this->setOutput($threadDisplay->page, 'page');
     $this->setOutput($threadDisplay->perpage, 'perpage');
     $this->setOutput($threadDisplay->total, 'count');
     $this->setOutput($threadDisplay->maxpage, 'totalpage');
     $this->setOutput($threadDisplay->getUrlArgs(), 'urlargs');
     $this->setOutput($threadDisplay->getUrlArgs('desc'), 'urlDescArgs');
     $this->setOutput($this->loginUser->getPermission('look_thread_log', $isBM, array()), 'canLook');
     $logs = Wekit::load('log.srv.PwLogService')->getThreadLog($tid, 1, 0);
     $this->setOutput($logs ? array_shift($logs) : array(), 'log');
     $this->setOutput($this->_getFpage($threadDisplay->fid), 'fpage');
     //版块风格
     if ($pwforum->foruminfo['style']) {
         $this->setTheme('forum', $pwforum->foruminfo['style']);
         //$this->addCompileDir($pwforum->foruminfo['style']);
     }
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     $threadDisplay->page <= 1 && PwSeoBo::setDefaultSeo($lang->getMessage('SEO:bbs.read.run.title'), '', $lang->getMessage('SEO:bbs.read.run.description'));
     PwSeoBo::init('bbs', 'read');
     PwSeoBo::set(array('{forumname}' => $threadDisplay->forum->foruminfo['name'], '{title}' => $threadDisplay->thread->info['subject'], '{description}' => Pw::substrs($threadDisplay->thread->info['content'], 100, 0, false), '{classfication}' => $threadDisplay->thread->info['topic_type'], '{tags}' => $threadInfo['tags'], '{page}' => $threadDisplay->page));
     //是否显示回复
     $showReply = true;
     //锁定时间
     if ($pwforum->forumset['locktime'] && $threadInfo['created_time'] + $pwforum->forumset['locktime'] * 86400 < Pw::getTime()) {
         $showReply = false;
     } elseif (Pw::getstatus($threadInfo['tpcstatus'], PwThread::STATUS_LOCKED) && !$this->loginUser->getPermission('reply_locked_threads')) {
         $showReply = false;
     }
     $this->setOutput($showReply, 'showReply');
     $this->runReadDesign($threadDisplay->fid);
     $this->updateReadOnline($threadDisplay->fid, $tid);
 }
示例#3
0
 /**
  * 帖子列表页
  */
 public function run()
 {
     $tab = $this->getInput('tab');
     $fid = intval($this->getInput('fid'));
     $type = intval($this->getInput('type', 'get'));
     //主题分类ID
     $page = $this->getInput('page', 'get');
     $orderby = $this->getInput('orderby', 'get');
     $pwforum = new PwForumBo($fid, true);
     if (!$pwforum->isForum()) {
         $this->showError('BBS:forum.exists.not');
     }
     if ($pwforum->allowVisit($this->loginUser) !== true) {
         $this->showError(array('BBS:forum.permissions.visit.allow', array('{grouptitle}' => $this->loginUser->getGroupInfo('name'))));
     }
     if ($pwforum->forumset['jumpurl']) {
         $this->forwardRedirect($pwforum->forumset['jumpurl']);
     }
     if ($pwforum->foruminfo['password']) {
         if (!$this->loginUser->isExists()) {
             $this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('bbs/cate/run', array('fid' => $fid))));
         } elseif (Pw::getPwdCode($pwforum->foruminfo['password']) != Pw::getCookie('fp_' . $fid)) {
             $this->forwardAction('bbs/forum/password', array('fid' => $fid));
         }
     }
     $isBM = $pwforum->isBM($this->loginUser->username);
     if ($operateThread = $this->loginUser->getPermission('operate_thread', $isBM, array())) {
         $operateThread = Pw::subArray($operateThread, array('topped', 'digest', 'highlight', 'up', 'copy', 'type', 'move', 'lock', 'down', 'delete', 'ban'));
     }
     $this->_initTopictypes($fid, $type);
     $threadList = new PwThreadList();
     $this->runHook('c_thread_run', $threadList);
     $threadList->setPage($page)->setPerpage($pwforum->forumset['threadperpage'] ? $pwforum->forumset['threadperpage'] : Wekit::C('bbs', 'thread.perpage'))->setIconNew($pwforum->foruminfo['newtime']);
     $defaultOrderby = $pwforum->forumset['threadorderby'] ? 'postdate' : 'lastpost';
     !$orderby && ($orderby = $defaultOrderby);
     if ($tab == 'digest') {
         Wind::import('SRV:forum.srv.threadList.PwDigestThread');
         $dataSource = new PwDigestThread($pwforum->fid, $type, $orderby);
     } elseif ($type) {
         Wind::import('SRV:forum.srv.threadList.PwSearchThread');
         $dataSource = new PwSearchThread($pwforum);
         $dataSource->setOrderby($orderby);
         $dataSource->setType($type, $this->_getSubTopictype($type));
     } elseif ($orderby == 'postdate') {
         Wind::import('SRV:forum.srv.threadList.PwNewForumThread');
         $dataSource = new PwNewForumThread($pwforum);
     } else {
         Wind::import('SRV:forum.srv.threadList.PwCommonThread');
         $dataSource = new PwCommonThread($pwforum);
     }
     $orderby != $defaultOrderby && $dataSource->setUrlArg('orderby', $orderby);
     $threadList->execute($dataSource);
     $this->setOutput($threadList, 'threadList');
     $this->setOutput($threadList->getList(), 'threaddb');
     $this->setOutput($fid, 'fid');
     $this->setOutput($type ? $type : null, 'type');
     $this->setOutput($tab, 'tab');
     $this->setOutput($pwforum, 'pwforum');
     $this->setOutput($pwforum->headguide(), 'headguide');
     $this->setOutput($threadList->icon, 'icon');
     $this->setOutput($threadList->uploadIcon, 'uploadIcon');
     $this->setOutput($operateThread, 'operateThread');
     $this->setOutput($pwforum->forumset['numofthreadtitle'] ? $pwforum->forumset['numofthreadtitle'] : 26, 'numofthreadtitle');
     $this->setOutput(!$this->loginUser->uid && !$this->allowPost($pwforum) ? ' J_qlogin_trigger' : '', 'postNeedLogin');
     $this->setOutput($threadList->page, 'page');
     $this->setOutput($threadList->perpage, 'perpage');
     $this->setOutput($threadList->total, 'count');
     $this->setOutput($threadList->maxPage, 'totalpage');
     $this->setOutput($defaultOrderby, 'defaultOrderby');
     $this->setOutput($orderby, 'orderby');
     $this->setOutput($threadList->getUrlArgs(), 'urlargs');
     $this->setOutput($this->_formatTopictype($type), 'topictypes');
     //版块风格
     if ($pwforum->foruminfo['style']) {
         $this->setTheme('forum', $pwforum->foruminfo['style']);
         //$this->addCompileDir($pwforum->foruminfo['style']);
     }
     //seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     if ($threadList->page <= 1) {
         if ($type) {
             PwSeoBo::setDefaultSeo($lang->getMessage('SEO:bbs.thread.run.type.title'), '', $lang->getMessage('SEO:bbs.thread.run.type.description'));
         } else {
             PwSeoBo::setDefaultSeo($lang->getMessage('SEO:bbs.thread.run.title'), '', $lang->getMessage('SEO:bbs.thread.run.description'));
         }
     }
     PwSeoBo::init('bbs', 'thread', $fid);
     PwSeoBo::set(array('{forumname}' => $pwforum->foruminfo['name'], '{forumdescription}' => Pw::substrs($pwforum->foruminfo['descrip'], 100, 0, false), '{classification}' => $this->_getSubTopictypeName($type), '{page}' => $threadList->page));
     Pw::setCookie('visit_referer', 'fid_' . $fid . '_page_' . $threadList->page, 300);
 }
示例#4
0
 public function run()
 {
     $fid = intval($this->getInput('fid'));
     $pwforum = new PwForumBo($fid, true);
     if (!$pwforum->isForum(true)) {
         $this->showError('BBS:forum.exists.not');
     }
     if ($pwforum->allowVisit($this->loginUser) !== true) {
         $this->showError(array('BBS:forum.permissions.visit.allow', array('{grouptitle}' => $this->loginUser->getGroupInfo('name'))));
     }
     if ($pwforum->forumset['jumpurl']) {
         $this->forwardRedirect($pwforum->forumset['jumpurl']);
     }
     if ($pwforum->foruminfo['password']) {
         if (!$this->loginUser->isExists()) {
             $this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('bbs/cate/run', array('fid' => $fid))));
         } elseif (Pw::getPwdCode($pwforum->foruminfo['password']) != Pw::getCookie('fp_' . $fid)) {
             $this->forwardAction('bbs/forum/password', array('fid' => $fid));
         }
     }
     $isBM = $pwforum->isBM($this->loginUser->username);
     if ($operateThread = $this->loginUser->getPermission('operate_thread', $isBM, array())) {
         $operateThread = Pw::subArray($operateThread, array('delete'));
     }
     $pwforum->foruminfo['threads'] = $pwforum->foruminfo['subthreads'];
     $this->setOutput($operateThread, 'operateThread');
     $tab = $this->getInput('tab');
     //tab标签
     $page = intval($this->getInput('page', 'get'));
     $orderby = $this->getInput('orderby', 'get');
     $threadList = new PwThreadList();
     $this->runHook('c_cate_run', $threadList);
     $threadList->setPage($page)->setPerpage($pwforum->forumset['threadperpage'] ? $pwforum->forumset['threadperpage'] : Wekit::C('bbs', 'thread.perpage'))->setIconNew($pwforum->foruminfo['newtime']);
     $defaultOrderby = $pwforum->forumset['threadorderby'] ? 'postdate' : 'lastpost';
     !$orderby && ($orderby = $defaultOrderby);
     $isCommon = 0;
     if ($tab == 'digest') {
         Wind::import('SRV:forum.srv.threadList.PwCateDigestThread');
         $dataSource = new PwCateDigestThread($pwforum->fid, $orderby);
     } else {
         Wind::import('SRV:forum.srv.threadList.PwCateThread');
         $srv = Wekit::load('forum.srv.PwForumService');
         $forbidFids = $srv->getForbidVisitForum($this->loginUser, $srv->getForumsByLevel($fid, $srv->getForumMap()));
         $dataSource = new PwCateThread($pwforum, $forbidFids);
         $dataSource->setOrderby($orderby);
         $isCommon = 1;
     }
     $orderby != $defaultOrderby && $dataSource->setUrlArg('orderby', $orderby);
     $threadList->execute($dataSource);
     if ($isCommon && $threadList->total > 12000) {
         Wekit::load('forum.PwThreadCateIndex')->deleteOver($fid, $threadList->total - 10000);
     }
     $this->setOutput($threadList, 'threadList');
     $this->setOutput($threadList->getList(), 'threaddb');
     $this->setOutput($tab, 'tab');
     $this->setOutput($defaultOrderby, 'defaultOrderby');
     $this->setOutput($orderby, 'orderby');
     $this->setOutput($pwforum->fid, 'fid');
     $this->setOutput($pwforum, 'pwforum');
     $this->setOutput($pwforum->headguide(), 'headguide');
     $this->setOutput($threadList->icon, 'icon');
     $this->setOutput($threadList->uploadIcon, 'uploadIcon');
     $this->setOutput($pwforum->forumset['numofthreadtitle'] ? $pwforum->forumset['numofthreadtitle'] : 26, 'numofthreadtitle');
     $this->setOutput($threadList->page, 'page');
     $this->setOutput($threadList->perpage, 'perpage');
     $this->setOutput($threadList->total, 'count');
     $this->setOutput($threadList->maxPage, 'totalpage');
     $this->setOutput($threadList->getUrlArgs(), 'urlargs');
     //版块风格
     if ($pwforum->foruminfo['style']) {
         $this->setTheme('forum', $pwforum->foruminfo['style']);
         //$this->addCompileDir($pwforum->foruminfo['style']);
     }
     //seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     if ($threadList->page <= 1) {
         PwSeoBo::setDefaultSeo($lang->getMessage('SEO:bbs.thread.run.title'), '', $lang->getMessage('SEO:bbs.thread.run.description'));
     }
     PwSeoBo::init('bbs', 'thread', $fid);
     PwSeoBo::set(array('{forumname}' => $pwforum->foruminfo['name'], '{forumdescription}' => Pw::substrs($pwforum->foruminfo['descrip'], 100, 0, false), '{classification}' => '', '{page}' => $threadList->page));
 }