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


PHP Pw::subArray方法代码示例

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


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

示例1: run

	public function run() {
		$order = $this->getInput('order', 'get');
		$page = intval($this->getInput('page', 'get'));
		
		$threadList = new PwThreadList();
		// $this->runHook('c_thread_run', $forumDisplay);
		$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($threaddb, 'threadList');
		$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');
		$seoBo = PwSeoBo::getInstance();
		$lang = Wind::getComponent('i18n');
		$threadList->page <=1 && $seoBo->setDefaultSeo($lang->getMessage('SEO:bbs.forum.run.title'), '', $lang->getMessage('SEO:bbs.forum.run.description'));
		$seoBo->init('bbs', 'new');
		$seoBo->set('{page}', $threadList->page);
		Wekit::setV('seo', $seoBo);
	}
开发者ID:healthguo,项目名称:PHP,代码行数:54,代码来源:ForumController.php

示例2: fetch

 /**
  * 获取多个个缓存 (有缓存性能优化)
  *
  * @param array $keys 查询键值 <例:array('config', 'level', array('group', array($gid)))>
  * @return array
  */
 public function fetch($keys)
 {
     $vkeys = $this->bulidKeys($keys);
     $sids = array();
     foreach ($vkeys as $i => $vkey) {
         if (!isset($this->_cacheData[$vkey])) {
             $value = is_array($keys[$i]) ? $keys[$i] : array($keys[$i], array());
             list($key, $param) = $value;
             $sid = $this->_initServer($key);
             $this->_readykeys[$sid][$vkey] = $value;
             $sids[$sid] = 1;
         }
     }
     if ($sids) {
         $this->_query(array_keys($sids));
     }
     return Pw::subArray($this->_cacheData, $vkeys);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:24,代码来源:PwCache.php

示例3: permissionAction

 /**
  * 获得用户拥有的权限 //这个权限在读贴子详细内容时获取,此接口暂时不用
  * 
  * @access public
  * @return void
  * @example
  * <pre>
  * post: tid
  * </pre>
  */
 private function permissionAction()
 {
     $tid = $this->getInput('tid');
     $userBo = new PwUserBo($this->uid);
     Wind::import('SRV:forum.srv.PwThreadDisplay');
     $threadDisplay = new PwThreadDisplay($tid, $userBo);
     $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();
     $isBM = $pwforum->isBM($userBo->username);
     if ($threadPermission = $userBo->getPermission('operate_thread', $isBM, array())) {
         $operateThread = Pw::subArray($threadPermission, array('delete', 'ban'));
         $operateReply = Pw::subArray($threadPermission, array('delete', 'ban'));
     }
     /**
      * if ($hasFirstPart || $hasSecondPart || $hasThirdPart) //只要是版主都可以推荐
      * $operateThread['delete']
      * $operateReply['ban']
      */
     //        print_r($operateThread);
     //        print_r($operateReply);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:35,代码来源:ManageController.php

示例4: run

 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()), true);
         $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');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     if ($threadList->page <= 1) {
         $seoBo->setDefaultSeo($lang->getMessage('SEO:bbs.thread.run.title'), '', $lang->getMessage('SEO:bbs.thread.run.description'));
     }
     $seoBo->init('bbs', 'thread', $fid);
     $seoBo->set(array('{forumname}' => $pwforum->foruminfo['name'], '{forumdescription}' => Pw::substrs($pwforum->foruminfo['descrip'], 100, 0, false), '{classification}' => '', '{page}' => $threadList->page));
     Wekit::setV('seo', $seoBo);
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:84,代码来源:CateController.php

示例5: _initVar

 private function _initVar()
 {
     $creditBo = PwCreditBo::getInstance();
     $sellCreditRange = $this->loginUser->getPermission('sell_credit_range', false, array());
     $allowThreadExtend = $this->loginUser->getPermission('allow_thread_extend', false, array());
     $sellConfig = array('ifopen' => $this->post->forum->forumset['allowsell'] && $allowThreadExtend['sell'] ? 1 : 0, 'price' => $sellCreditRange['maxprice'], 'income' => $sellCreditRange['maxincome'], 'credit' => Pw::subArray($creditBo->cType, $this->loginUser->getPermission('sell_credits')));
     !$sellConfig['credit'] && ($sellConfig['credit'] = array_slice($creditBo->cType, 0, 1, true));
     $enhideConfig = array('ifopen' => $this->post->forum->forumset['allowhide'] && $allowThreadExtend['hide'] ? 1 : 0, 'credit' => Pw::subArray($creditBo->cType, $this->loginUser->getPermission('enhide_credits')));
     !$enhideConfig['credit'] && ($enhideConfig['credit'] = array_slice($creditBo->cType, 0, 1, true));
     $allowUpload = $this->post->user->isExists() && $this->post->forum->allowUpload($this->post->user) && ($this->post->user->getPermission('allow_upload') || $this->post->forum->foruminfo['allow_upload']) ? 1 : 0;
     $attachnum = intval(Wekit::C('attachment', 'attachnum'));
     if ($perday = $this->post->user->getPermission('uploads_perday')) {
         $count = $this->post->user->info['lastpost'] < Pw::getTdtime() ? 0 : $this->post->user->info['todayupload'];
         $attachnum = max(min($attachnum, $perday - $count), 0);
     }
     $this->setOutput(PwSimpleHook::getInstance('PwEditor_app')->runWithFilters(array()), 'editor_app_config');
     $this->setOutput($this->post, 'pwpost');
     $this->setOutput($this->post->getDisabled(), 'needcheck');
     $this->setOutput($this->post->forum->fid, 'fid');
     $this->setOutput($this->post->forum, 'pwforum');
     $this->setOutput($sellConfig, 'sellConfig');
     $this->setOutput($enhideConfig, 'enhideConfig');
     $this->setOutput($allowThreadExtend, 'allowThreadExtend');
     $this->setOutput($allowUpload, 'allowUpload');
     $this->setOutput($attachnum, 'attachnum');
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:26,代码来源:PostController.php

示例6: fetchForum

 /**
  * 获取指定版块的信息(使用全部版块缓存,如果没有这个前提,直接使用 forum.PwForum->fetchForum 接口比较合算)
  *
  * @param array $fids;
  * @return array
  */
 public function fetchForum($fids)
 {
     return Pw::subArray($this->getForumList(), $fids);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:10,代码来源:PwForumService.php

示例7: run

 /**
  * 帖子列表页
  */
 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);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:94,代码来源:ThreadController.php

示例8: run

 public function run()
 {
     $page = intval($this->getInput('page', 'get'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $gid = $this->getInput('gid');
     $url = array();
     if ($gid) {
         $url['gid'] = $gid;
         $current = $gid;
         $user = Wekit::load('attention.PwAttentionType')->getUserByType($this->loginUser->uid, $gid, 2000);
         $uids = array_keys($user);
         $count = $this->_getService()->countAttentionFreshByUid($this->loginUser->uid, $uids);
         Wind::import('SRV:attention.srv.dataSource.PwFetchAttentionFreshByUid');
         $dataSource = new PwFetchAttentionFreshByUid($this->loginUser->uid, $uids, $limit, $start);
     } else {
         $current = 'all';
         $count = $this->_getService()->countAttentionFresh($this->loginUser->uid);
         if ($count > 200) {
             $count > 250 && Wekit::load('attention.PwFresh')->deleteAttentionFresh($this->loginUser->uid, $count - 200);
             $count = 200;
         }
         Wind::import('SRV:attention.srv.dataSource.PwFetchAttentionFresh');
         $dataSource = new PwFetchAttentionFresh($this->loginUser->uid, $limit, $start);
     }
     $freshDisplay = new PwFreshDisplay($dataSource);
     $fresh = $freshDisplay->gather();
     $type = Wekit::load('attention.srv.PwAttentionService')->getAllType($this->loginUser->uid);
     $unpost = '';
     !$this->loginUser->info['lastpost'] && ($this->loginUser->info['lastpost'] = $this->loginUser->info['regdate']);
     $tmp = Pw::getTime() - $this->loginUser->info['lastpost'];
     if ($tmp > 31536000) {
         $unpost = floor($tmp / 31536000) . '年多';
     } elseif ($tmp > 2592000) {
         $unpost = floor($tmp / 2592000) . '个多月';
     } elseif ($tmp > 172800) {
         $unpost = floor($tmp / 86400) . '天';
     }
     $type = Wekit::load('attention.srv.PwAttentionService')->getAllType($this->loginUser->uid);
     $allowUpload = $this->loginUser->getPermission('allow_upload');
     if ($imgextsize = Pw::subArray(Wekit::C('attachment', 'extsize'), array('jpg', 'jpeg', 'png', 'gif', 'bmp'))) {
         $maxSize = max($imgextsize) . ' KB';
         $filetypes = '*.' . implode(';*.', array_keys($imgextsize));
         $attachnum = intval(Wekit::C('attachment', 'attachnum'));
         if ($perday = $this->loginUser->getPermission('uploads_perday')) {
             $todayupload = $this->loginUser->info['lastpost'] < Pw::getTdtime() ? 0 : $this->loginUser->info['todayupload'];
             $attachnum = max(min($attachnum, $perday - $todayupload), 0);
             $attachnum == 0 && ($allowUpload = 0);
         }
     } else {
         $allowUpload = $attachnum = $maxSize = 0;
         $filetypes = '';
     }
     $this->setOutput($allowUpload, 'allowUpload');
     $this->setOutput($attachnum, 'attachnum');
     $this->setOutput($maxSize, 'maxSize');
     $this->setOutput($filetypes, 'filetypes');
     $this->setOutput($current, 'currents');
     $this->setOutput($type, 'type');
     $this->setOutput($unpost, 'unpost');
     $this->setOutput($fresh, 'freshdb');
     $this->setOutput($this->loginUser->getPermission('fresh_delete'), 'freshDelete');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($url, 'url');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.fresh.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:74,代码来源:FreshController.php

示例9: run

 /**
 * 查看帖子
 * @access public
 * @return string
 * @example
 <pre>
 /index.php?m=native&c=read&tid=21&fid=8&page=1&_json=1
 cookie:usersession
 response: {err:"",data:""}  
 </pre>
 */
 public function run()
 {
     $tid = intval($this->getInput('tid', 'get'));
     list($page, $uid, $desc) = $this->getInput(array('page', 'uid', 'desc'), 'get');
     $threadDisplay = new PwNativeThreadDisplay($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->uid) {
             $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);
     }
     //数据分页
     $perpage = $pwforum->forumset['readperpage'] ? $pwforum->forumset['readperpage'] : Wekit::C('bbs', 'read.perpage');
     $dataSource->setPage($page)->setPerpage($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'));
     }
     isset($operateThread['topped']) && ($operateThread['topped'] = $this->loginUser->gid == 3 && $operateThread ? "1" : "0");
     //主题的信息
     $threadInfo = $threadDisplay->getThreadInfo();
     //帖子收藏统计
     $collectInfo = $this->_getCollectService()->countCollectByTids(array($threadInfo['tid']));
     //用户是否收藏过帖子
     $collectStatusInfo = array();
     if ($this->uid) {
         $collectStatusInfo = $this->_getCollectService()->getCollectByUidAndTids($this->uid, array($threadInfo['tid']));
     }
     //获得板块信息
     $forumInfo = $threadDisplay->getForum();
     $simpleForumInfo = array('fid' => $forumInfo->fid, 'name' => preg_replace('/<\\/?[^>]+>/i', '', $forumInfo->foruminfo['name']));
     //帖子数据列表
     $threadList = $threadDisplay->getList();
     //回复帖子列表
     $pids = array();
     foreach ($threadList as $key => $v) {
         $threadList[$key]['created_user_avatar'] = Pw::getAvatar($v['created_userid'], 'small');
         $threadList[$key]['created_time'] = Pw::time2str($v['created_time'], 'auto');
         //
         if (isset($v['pid'])) {
             $pids[] = $v['pid'];
         }
     }
     //获得用户是否喜欢过帖子|回复
     $threadLikeData = $postLikeData = array();
     if ($this->uid) {
         $threadLikeData = $this->_getLikeReplyService()->getAllLikeUserids(PwLikeContent::THREAD, array($tid));
         $_postLikeData = $this->_getLikeReplyService()->getAllLikeUserids(PwLikeContent::POST, $pids);
         if (!empty($pids)) {
             foreach ($pids as $v) {
                 if (isset($_postLikeData[$v])) {
                     $postLikeData[$v] = array_search($this->uid, $_postLikeData[$v]) === false ? 0 : 1;
                 }
             }
         }
     }
     //帖子发布来源
     $threadFromtypeList = $this->_getThreadsPlaceService()->getThreadFormTypeByTids(array($tid));
     //主帖的相关信息
     $simpleThreadInfo = array('uid' => $threadInfo['created_userid'], 'tid' => $threadInfo['tid'], 'fid' => $threadInfo['fid'], 'subject' => $threadInfo['subject'], 'replies' => $threadInfo['replies'], 'like_count' => $threadInfo['like_count'], 'collect_count' => isset($collectInfo[$threadInfo['tid']]) ? $collectInfo[$threadInfo['tid']]['sum'] : 0, 'like_status' => isset($threadLikeData[$tid]) && array_search($this->uid, $threadLikeData[$tid]) !== false ? 1 : 0, 'collect_status' => isset($collectStatusInfo[$tid]) && array_search($this->uid, $collectStatusInfo[$tid]) !== false ? 1 : 0, 'display_title' => isset($threadFromtypeList[$tid]) && $threadFromtypeList[$tid] ? 1 : 0);
     $simpleForumInfo['display_title'] = $simpleThreadInfo['display_title'];
     //位置
     $threadPlace = $this->_getThreadPlaceService()->fetchByTids(array($tid));
     $postPlace = $this->_getPostPlaceService()->fetchByPids($pids);
     //附件
     $threadAttachs = array();
     if (isset($threadDisplay->attach->attachs)) {
         foreach ($threadDisplay->attach->attachs as $k => $v) {
             foreach ($v as $kk => $vv) {
                 $threadAttachs['attachs'][$k][$kk] = array('aid' => $vv['aid'], 'name' => $vv['name'], 'type' => $vv['type'], 'url' => $vv['url']);
//.........这里部分代码省略.........
开发者ID:chendong0444,项目名称:phpwind,代码行数:101,代码来源:ReadController.php

示例10: run

 /**
  * 帖子阅读页
  */
 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');
     $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');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $threadDisplay->page <= 1 && $seoBo->setDefaultSeo($lang->getMessage('SEO:bbs.read.run.title'), '', $lang->getMessage('SEO:bbs.read.run.description'));
     $seoBo->init('bbs', 'read');
     $seoBo->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));
     Wekit::setV('seo', $seoBo);
     //是否显示回复
     $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);
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:92,代码来源:ReadController.php


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