/**
  *帖子阅读页 - 钩子方法
  *
  */
 public function createHtmlBeforeContent($read)
 {
     if (!is_array($read) || empty($read)) {
         return false;
     }
     !$this->tid && ($this->tid = intval($read['tid']));
     $this->pid = intval($read['pid']);
     //快速回复帖子
     if (!$this->pids && $this->pid != 0) {
         $this->pids[] = $this->pid;
     }
     //first,需要组装数据
     if ($this->isIn === false) {
         $rewardInfo = $this->getReplyRewardBo()->getRewardInfo();
         if (!$rewardInfo) {
             $this->isReplyReward = false;
         }
         $recordInfo = $this->pids ? $this->_getReplyRewardRecordDs()->getRewardRecordByTidAndPids($this->tid, $this->pids) : array();
         $creditInfo = $this->getReplyRewardBo()->getCreditInfo($rewardInfo['credittype']);
         $this->threadInfo = array('rewardInfo' => $rewardInfo['creditnum'] . $creditInfo['unit'] . $creditInfo['name'], 'creditnum' => $rewardInfo['creditnum'], 'creditunit' => $creditInfo['unit'], 'creditname' => $creditInfo['name'], 'repeattimes' => $rewardInfo['repeattimes'], 'chance' => $rewardInfo['chance'], 'pool' => $rewardInfo['lefttimes'] * $rewardInfo['creditnum']);
         foreach ($recordInfo as $val) {
             $this->floorInfo[$val['pid']] = $rewardInfo['creditnum'];
         }
         $this->isIn = true;
     }
     if ($this->pid > 0 && !$this->floorInfo[$this->pid]) {
         return false;
     }
     if ($this->tid > 0 && $this->pid == 0 && $this->isReplyReward === false) {
         return false;
     }
     PwHook::template('displayReadBeforeContentHtml', 'EXT:replyreward.template.read_replyreward', true, $this);
 }
 public function displayHtml($hook, $vProperty, $decorator)
 {
     list($tpl, $hookname) = explode('|', $hook);
     if (!$tpl || !$hookname) {
         return '';
     }
     PwHook::template($hookname, 'TPL:design.property.' . $tpl, true, array('property' => $vProperty, 'decorator' => $decorator));
 }
 /**
  *
  *钩子执行方法
  */
 public function createHtmlAfterSubject($thread)
 {
     if (!$thread['app_mark']) {
         return false;
     }
     list($cNum, ) = $this->_getService()->splitStringToArray($thread['app_mark']);
     $cNum && PwHook::template('app_mark_displayThreadListHtml', 'EXT:mark.template.read_mark', true, $cNum);
 }
 public function createHtmlForThreadButton($read)
 {
     if (!$read['pid']) {
         return true;
     }
     $read['app_mark'] && (list(, $count) = $this->_getService()->splitStringToArray($read['app_mark']));
     PwHook::template('app_mark_displayMarkHtmlForThreadButton', 'EXT:mark.template.read_mark', true, $read, (int) $count);
 }
 public function createHtml($spaceBo)
 {
     if (!$spaceBo->allowView('work')) {
         return false;
     }
     $spaceBo->spaceUser['work'] = Wekit::load('work.PwWork')->getByUid($spaceBo->spaceUid);
     PwHook::template('work', 'TPL:space.profile_extend', true, $spaceBo);
 }
 public function createHtml($spaceBo)
 {
     if (!$spaceBo->allowView('education')) {
         return false;
     }
     $educations = Wekit::load('education.srv.PwEducationService')->getEducationByUid($spaceBo->spaceUid, 100);
     $spaceBo->spaceUser['education'] = $educations;
     PwHook::template('education', 'TPL:space.profile_extend', true, $spaceBo);
 }
 /**
  *
  *钩子执行方法
  */
 public function createHtmlAfterSubject($thread)
 {
     if (!is_array($thread)) {
         return false;
     }
     $this->tid = intval($thread['tid']);
     if ($this->creditPoolInfo[$this->tid]) {
         PwHook::template('displayThreadListReplyRewardHtml', 'EXT:replyreward.template.threadlist_replyreward', true, $this);
     }
 }
 /**
  * 钩子方法 帖子发布展示
  */
 public function createHtmlRightContent()
 {
     if (!$this->_getReplyRewardConfigService()->getReplyRewardCreditType()) {
         return false;
     }
     if ($this->action == 'add' && $this->_checkPrivilege()) {
         PwHook::template('displayPostReplyRewardHtml', 'EXT:replyreward.template.post_replyreward', true, $this);
     } elseif ($this->action == 'modify' && $this->getReplyRewardBo()->getRewardInfo()) {
         PwHook::template('displayModifyReplyRewardHtml', 'EXT:replyreward.template.modify_replyreward', true, $this);
     }
 }
 public function createHtml($left, $tab)
 {
     $config = Wekit::C('app_majia');
     $list = array();
     $method = !in_array($this->bp->user->gid, $config['band.allow.groups']) ? 'displayMajiaForbidden' : 'displayList';
     if (!$config['isopen']) {
         $method = 'displayMajiaClose';
     } else {
         Wind::import('EXT:majia.service.srv.App_Majia_MajiaBandingBp');
         $bp = new App_Majia_MajiaBandingBp($this->bp->user);
         $list = $bp->doGetBanded();
     }
     PwHook::template($method, 'EXT:majia.template.my_run', true, $this->bp->user, $list, intval($config['band.max.num']));
 }
 /**
  *钩子
  */
 public function createHtmlBeforeContent($read)
 {
     $tid = intval($read['tid']);
     $pid = intval($read['pid']);
     if ($pid) {
         return false;
     }
     if (!$this->info) {
         return false;
     }
     $token = $this->info['token'];
     $this->url = WindUrlHelper::createUrl('bbs/read/run', array('tid' => $tid, 'fid' => $this->fid, 'token' => $token));
     PwHook::template('displayReadHtml', 'EXT:encryptposts.template.read_encryptposts', true, $this);
 }
 public function displayFootHtml($current)
 {
     $this->conf = Wekit::C('app_verify');
     if (!$this->conf['verify.isopen']) {
         return false;
     }
     $openTypes = $this->_getService()->getOpenVerifyType();
     $types = $this->_getService()->getVerifyTypeName();
     $data = array();
     foreach ($openTypes as $k => $v) {
         $data[$types[$k]] = WindUrlHelper::createUrl('app/verify/index/typeTab', array('type' => $types[$k]));
     }
     PwHook::template('displayAppProfileVerifyFootHtml', 'EXT:verify.template.index_run', true, $this->left, $data);
 }
 /**
  * 钩子方法 帖子发布展示
  */
 public function createHtmlRightContent()
 {
     if (!$this->checkPrivilege()) {
         return false;
     }
     if ($this->action == 'modify') {
         Wind::import('SRC:library.Pw');
         if ($this->tid && $this->_getEncryptPostsDs()->get($this->tid)) {
             $this->ifCheck = true;
         }
         PwHook::template('displayUpdateHtml', 'EXT:encryptposts.template.update_encryptposts', true, $this);
     } elseif ($this->action == 'add') {
         PwHook::template('displayPostHtml', 'EXT:encryptposts.template.post_encryptposts', true, $this);
     }
 }
 /**
  * 个人设置--绑定设置--页面
  * @see PwProfileExtendsDoBase::createHtml()
  */
 public function createHtml($left, $tab)
 {
     $this->typeFilter = $this->_getCommonService()->getAccountType();
     if ($this->typeFilter === false) {
         return false;
     }
     $res = $this->_getAccountBindDs()->fetchByUidAndTypes($this->uid, $this->typeFilter);
     $bindType = array();
     foreach ($res as $v) {
         $bindType[] = $v['type'];
         $this->bindInfo[$v['type']] = array('isopen' => 1, 'iconClass' => $this->_getAccountTypeService()->getIconClassByType($v['type']));
     }
     $unbindType = array();
     $unbindType = array_diff($this->typeFilter, $bindType);
     foreach ($unbindType as $v) {
         $this->bindInfo[$v] = array('isopen' => 0, 'iconClass' => $this->_getAccountTypeService()->getIconClassByType($v));
     }
     krsort($this->bindInfo);
     $this->avatar = Pw::getAvatar($this->uid, 'small');
     PwHook::template('displayAppProfileAccount', 'EXT:account.template.profile', true, $this);
 }
 public function createHtmlAfterContent($read)
 {
     if ($read['pid'] == 0) {
         PwHook::template('displayVoteHtmlAfterContent', 'TPL:bbs.read_vote', true, $this);
     }
 }
 public function createHtmlAfterUserInfo($user, $read)
 {
     if (isset($this->medals[$user['uid']])) {
         PwHook::template('displayMedalHtmlAfterContent', 'TPL:medal.read_medal', true, $this->medals[$user['uid']]);
     }
 }
Beispiel #16
0
 public function display()
 {
     PwHook::template('testHook2', 'hook_sigment1', true, array('d' => 'bbb'), 'ddd');
 }
Beispiel #17
0
 public function createHtmlBeforeContent()
 {
     PwHook::template('displayPostTorrentHtml', 'EXT:torrent.template.post_injector_before_torrent', true, $this);
 }
 public function createHtmlBeforeContent($read)
 {
     if ($read['pid'] == 0 && isset($this->torrent)) {
         PwHook::template('displayReadTorrentHtml', 'EXT:torrent.template.read_injector_before_torrent', true, $this->torrent);
     }
 }
Beispiel #19
0
 public function createHtmlBeforeContent()
 {
     PwHook::template('displayPostPollHtml', 'TPL:bbs.post_poll', true, $this);
 }
 /**
  *s_login_sidebar - 钩子  
  */
 public function login_sidebar()
 {
     $types = $this->getAccountType();
     if ($types === false) {
         return false;
     }
     $address = $this->getLoginAddress($types);
     $info = array();
     foreach ($types as $type) {
         $info[$type] = array('href' => $address[$type], 'class' => $this->_getAccountTypeService()->getHrefClassByType($type), 'name' => $this->_getAccountTypeService()->getTypeName($type));
     }
     PwHook::template('displayLoginSidebarHtml', 'EXT:account.template.login_sidebar', true, $info);
 }
Beispiel #21
0
 public function spaceProfile($space)
 {
     $PwThread = Wekit::load('forum.PwThread');
     $showuserinfo = Wekit::C('site', 'app.torrent.showuserinfo');
     if (is_array($showuserinfo) && !in_array('profile', $showuserinfo)) {
         return;
     }
     $user = Wekit::load('EXT:torrent.service.PwTorrentUser')->getTorrentUserByUid($space->spaceUid);
     $peers = Wekit::load('EXT:torrent.service.PwTorrentPeer')->fetchTorrentPeerByUid($space->spaceUid);
     $this->histories = Wekit::load('EXT:torrent.service.PwTorrentHistory')->fetchTorrentHistoryByUid($space->spaceUid);
     $this->torrents = $PwThread->getThreadByUid($space->spaceUid);
     $this->passkey = $user['passkey'];
     $this->seeding = $this->leeching = 0;
     if (is_array($peers)) {
         foreach ($peers as $peer) {
             if ($peer['seeder'] == 'yes') {
                 $this->seeding++;
             } else {
                 $this->leeching++;
             }
         }
     }
     if (is_array($this->histories)) {
         $PwTorrent = Wekit::load('EXT:torrent.service.PwTorrent');
         foreach ($this->histories as $key => $history) {
             $downloaded_total += $history['downloaded'];
             $uploaded_total += $history['uploaded'];
             $torrent = $PwTorrent->getTorrent($history['torrent']);
             $thread = $PwThread->getThread($torrent['tid']);
             if ($thread) {
                 $this->histories[$key]['tid'] = $torrent['tid'];
                 $this->histories[$key]['subject'] = $thread['subject'];
             } else {
                 unset($this->histories[$key]);
             }
         }
     }
     if ($downloaded_total != 0) {
         $this->rotio = round($uploaded_total / $downloaded_total, 2);
     } else {
         $this->rotio = 'Inf.';
     }
     $this->downloaded_total = PwUtils::readableDataTransfer($downloaded_total);
     $this->uploaded_total = PwUtils::readableDataTransfer($uploaded_total);
     PwHook::template('displayProfileTorrentHtml', 'EXT:torrent.template.profile_injector_after_content', true, $this);
 }