/**
  * (non-PHPdoc)
  * @see PwTagAction::getContents()
  */
 public function getContents($ids)
 {
     $threads = $this->_getThreadDs()->fetchThread($ids, PwThread::FETCH_ALL);
     $array = array();
     if ($threads) {
         $fids = array();
         foreach ($threads as $v) {
             $fids[] = $v['fid'];
         }
         $user = Wekit::getLoginUser();
         $forums = $this->_getForumDs()->fetchForum($fids);
         $forbidFids = $this->getForbidVisitForum($user, $forums);
         $lang = Wind::getComponent('i18n');
         foreach ($threads as $k => $v) {
             if ($v['disabled'] > 0) {
                 $content = $lang->getMessage('BBS:forum.thread.disabled');
                 $v['subject'] = $content;
                 $v['content'] = $content;
             } elseif (in_array($v['fid'], $forbidFids)) {
                 $content = $lang->getMessage('BBS:forum.thread.right.error');
                 $v['subject'] = $content;
                 $v['content'] = $content;
             }
             $v['forum_name'] = $forums[$v['fid']]['name'];
             $v['created_time_auto'] = pw::time2str($v['created_time'], 'auto');
             $v['type_id'] = $forums[$v['fid']]['name'];
             $array[$k] = $v;
         }
     }
     return $array;
 }
 public function run()
 {
     $page = $this->getInput('page');
     $this->page = $page < 1 ? 1 : intval($page);
     list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
     $timestamp = PW::getTime();
     $startTime = $timestamp - 7 * 86400;
     $endTime = $timestamp;
     $total = $this->_getPollDs()->countPollByTime($startTime, $endTime);
     $pollInfo = array();
     if ($total) {
         Wind::import('SRV:poll.srv.dataSource.PwFetchPollByTime');
         $pollDisplay = new PwPollDisplay(new PwFetchPollByTime($startTime, $endTime, $limit, $start, array('voter_num' => 0, 'created_time' => 0)));
         $pollInfo = $this->_buildPoll($pollDisplay->gather());
     }
     $latestPollDisplay = new PwPollDisplay(new PwFetchPollByOrder(10, 0, array('created_time' => '0')));
     $latestPoll = $latestPollDisplay->gather();
     $this->setOutput($total, 'total');
     $this->setOutput($pollInfo, 'pollInfo');
     $this->setOutput($latestPoll, 'latestPoll');
     $this->setOutput($this->page, 'page');
     $this->setOutput($this->perpage, 'perpage');
     $this->setOutput(array('allowview' => $this->loginUser->getPermission('allow_view_vote'), 'allowvote' => $this->loginUser->getPermission('allow_participate_vote')), 'pollGroup');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     if ($this->page > 1) {
         $seoBo->setCustomSeo($lang->getMessage('SEO:vote.hot.run.page.title', array($this->page)), $lang->getMessage('vote.hot.run.description'), '');
     } else {
         $seoBo->setCustomSeo($lang->getMessage('SEO:vote.hot.run.title'), '', $lang->getMessage('SEO:vote.hot.run.description'));
     }
     Wekit::setV('seo', $seoBo);
 }
 /**
  * 回复列表
  */
 public function replyAction()
 {
     list($page, $perpage) = $this->getInput(array('page', 'perpage'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $count = $this->_getThreadExpandDs()->countDisabledPostByUid($this->loginUser->uid);
     if ($count) {
         $tmpPosts = $this->_getThreadExpandDs()->getDisabledPostByUid($this->loginUser->uid, $limit, $start);
         $posts = $tids = array();
         foreach ($tmpPosts as $v) {
             $tids[] = $v['tid'];
         }
         $threads = $this->_getThreadDs()->fetchThread($tids);
         foreach ($tmpPosts as $v) {
             $v['threadSubject'] = Pw::substrs($threads[$v['tid']]['subject'], 30);
             $v['content'] = Pw::substrs($v['content'], 30);
             $v['created_time'] = PW::time2str($v['created_time'], 'auto');
             $posts[] = $v;
         }
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($posts, 'posts');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.article.reply.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 /**
  * 分析其中的脚本
  *
  * @param string $content
  * @return string
  */
 private function _compile($content)
 {
     if ($route = Wind::getComponent('router')->getRoute('pw')) {
         if ($route->dynamicDomain) {
             if (3 == count($route->dynamicDomain)) {
                 $content = $route->dynamicDomain[0] . $route->dynamicDomain[1] . $content . $route->dynamicDomain[2];
             } else {
                 $content = $route->dynamicDomain[0] . $route->dynamicDomain[1] . $route->dynamicDomain[4] . $route->dynamicDomain[2] . $content . $route->dynamicDomain[3];
             }
             $content = preg_replace_callback('/<\\?php(.*?)\\?>/is', array($this, '_parse'), $content);
         } else {
             if ($route->dynamic) {
                 if (false !== strpos($content, '{fname}')) {
                     $temp = explode('{fname}', $content, 2);
                     foreach ($this->_variables as $key => $var) {
                         $temp[0] = str_replace($key, '\',' . $var . ',\'', $temp[0]);
                         $temp[1] = str_replace($key, '\',' . $var . ',\'', $temp[1]);
                     }
                     $content = $route->dynamic[0] . 'echo \'' . $temp[0] . '\',' . $route->dynamic[1] . ',\'' . $temp[1] . '\';?>';
                 }
                 $content = preg_replace_callback('/<\\?php(.*?)\\?>/is', array($this, '_parse'), $content);
             }
         }
         if ($route->dynamicHost) {
             $content = ltrim(str_replace($route->dynamicHost, '', $content), '/');
         }
         $route->dynamicDomain = $route->dynamic = $route->dynamicDomain = null;
     }
     return $content;
 }
Exemple #5
0
 public function taAction()
 {
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     PwSeoBo::setCustomSeo($lang->getMessage('SEO:like.mylike.ta.title'), '', '');
 }
 public function run()
 {
     $page = $this->getInput('page');
     $this->page = $page < 1 ? 1 : intval($page);
     list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
     $total = $this->_getPollVoterDs()->countByUid(Wekit::getLoginUser()->uid);
     $poll = $total ? $this->_getPollVoterDs()->getPollByUid(Wekit::getLoginUser()->uid, $limit, $start) : array();
     $pollInfo = array();
     if ($poll) {
         $pollid = array();
         foreach ($poll as $value) {
             $pollid[] = $value['poll_id'];
         }
         Wind::import('SRV:poll.srv.dataSource.PwFetchPollByPollid');
         $pollDisplay = new PwPollDisplay(new PwFetchPollByPollid($pollid, count($pollid)));
         $pollInfo = $this->_buildPoll($pollDisplay->gather(), 'my');
     }
     $latestPollDisplay = new PwPollDisplay(new PwFetchPollByOrder(10, 0, array('created_time' => '0')));
     $latestPoll = $latestPollDisplay->gather();
     $this->setOutput($total, 'total');
     $this->setOutput($pollInfo, 'pollInfo');
     $this->setOutput($latestPoll, 'latestPoll');
     $this->setOutput($this->page, 'page');
     $this->setOutput($this->perpage, 'perpage');
     $this->setOutput(array('allowview' => $this->loginUser->getPermission('allow_view_vote'), 'allowvote' => $this->loginUser->getPermission('allow_participate_vote')), 'pollGroup');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:vote.my.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 /** 
  * 电子邮件用户激活
  */
 public function emailAction()
 {
     list($page, $perpage) = $this->getInput(array('page', 'perpage'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     $count = $this->_getDs()->countUnActived();
     $list = array();
     if ($count > 0) {
         $totalPage = ceil($count / $perpage);
         $page > $totalPage && ($page = $totalPage);
         $result = $this->_getDs()->getUnActivedList($perpage, intval(($page - 1) * $perpage));
         /* @var $userDs PwUser */
         $userDs = Wekit::load('user.PwUser');
         $list = $userDs->fetchUserByUid(array_keys($result), PwUser::FETCH_MAIN);
         $list = WindUtility::mergeArray($result, $list);
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput(array('perpage' => $perpage), 'args');
     $this->setOutput($list, 'list');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:manage.user.email.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
Exemple #8
0
 protected function sendErrorMessage($errorMessage, $errorcode)
 {
     if (!is_object($errorMessage)) {
         $_tmp = $errorMessage;
         /* @var $errorMessage WindErrorMessage */
         $errorMessage = Wind::getComponent('errorMessage');
         $errorMessage->addError($_tmp);
     }
     /* @var $router WindRouter */
     $moduleName = $this->handlerAdapter->getModule();
     if ($moduleName === 'error') {
         throw new WindFinalException($errorMessage->getError(0));
     }
     if (!($_errorAction = $errorMessage->getErrorAction())) {
         $module = $this->getModules($moduleName);
         $_errorClass = Wind::import(@$module['error-handler']);
         $_errorAction = 'error/' . $_errorClass . '/run/';
         $this->setModules('error', array('controller-path' => array_search($_errorClass, Wind::$_imports), 'controller-suffix' => '', 'error-handler' => ''));
     }
     /* @var $forward WindForward */
     $forward = Wind::getComponent('forward');
     $error = array('message' => $errorMessage->getError(), 'code' => $errorcode);
     $forward->forwardAction($_errorAction, array('__error' => $error, '__errorDir' => $this->getConfig('error-dir')), false, false);
     $this->doDispatch($forward);
 }
Exemple #9
0
 protected function showErrorMessage($message, $file, $line, $trace, $errorcode)
 {
     list($fileLines, $trace) = $this->crash($file, $line, $trace);
     if (Wind::$isDebug & 2) {
         $log = $message . "\r\n" . $file . ":" . $line . "\r\n";
         foreach ($trace as $key => $value) {
             $log .= $value . "\r\n";
         }
         Wind::getComponent('windLogger')->error($log, 'error', true);
     }
     $message = nl2br($message);
     $errDir = Wind::getRealPath($this->errorDir, false);
     if ($this->isClosed) {
         $errPage = 'close';
     } elseif (is_file($errDir . '/' . $errorcode . '.htm')) {
         $errPage = $errorcode;
     } else {
         $errPage = 'error';
     }
     $title = $this->getResponse()->codeMap($errorcode);
     $title = $title ? $errorcode . ' ' . $title : 'unknowen error';
     $__vars['title'] = ucwords($title);
     $__vars['message'] = $message;
     if (Wind::$isDebug & 1) {
         $__vars['debug']['file'] = $file;
         $__vars['debug']['line'] = $line;
         $__vars['debug']['trace'] = $trace;
         $__vars['debug']['fileLines'] = $fileLines;
     }
     $this->render($__vars, $errorcode, $errDir, $errPage);
 }
 public function buildTitle($param = 0, $extendParams = null, $aggregatedNotice = null)
 {
     $params = array();
     $msg = '';
     switch ($extendParams['change_type']) {
         //转账
         case 'transfer':
             $params['{username}'] = '<a href="' . WindUrlHelper::createUrl('space/index/run', array('uid' => $extendParams['fromUid'])) . '">' . $extendParams['fromUserName'] . '</a>';
             $params['{num}'] = $extendParams['num'];
             $params['{unit}'] = $extendParams['unit'];
             $params['{credit}'] = $extendParams['credit'];
             $msg = 'CREDIT:transfer.to.notice.format';
             break;
             //转换:
         //转换:
         case 'exchange':
             $params['{credit1}'] = $extendParams['credit1'];
             $params['{num1}'] = $extendParams['num1'];
             $params['{unit1}'] = $extendParams['unit1'];
             $params['{credit2}'] = $extendParams['credit2'];
             $params['{num2}'] = $extendParams['num2'];
             $params['{unit2}'] = $extendParams['unit2'];
             $msg = 'CREDIT:exchange.notice.format';
             break;
         case 'pay':
             $params['{credit}'] = $extendParams['credit'];
             $params['{num}'] = $extendParams['num'];
             $params['{unit}'] = $extendParams['unit'];
             $params['{price}'] = $extendParams['price'];
             $msg = 'CREDIT:pay.notice.format';
             break;
     }
     return Wind::getComponent('i18n')->getMessage($msg, $params);
 }
Exemple #11
0
 public function getDB()
 {
     if (!$this->_baseInstance) {
         $this->_baseInstance = Wind::getComponent('db');
     }
     return $this->_baseInstance;
 }
 public function afterAction($handlerAdapter)
 {
     parent::afterAction($handlerAdapter);
     $debug = Wekit::C('site', 'debug') || !Wekit::C('site', 'css.compress');
     Wekit::setGlobal(array('debug' => $debug ? '/dev' : '/build'), 'theme');
     $this->setTheme('site', null);
     /* @var $resource WindLangResource */
     $resource = Wind::getComponent('i18n');
     $_error = $this->getForward()->getVars('message');
     if ($resource !== null) {
         foreach ($_error as $key => $value) {
             if (is_array($value)) {
                 list($value, $var) = $value;
             } else {
                 $var = array();
             }
             $message = $resource->getMessage($value, $var);
             $message && ($_error[$key] = $message);
         }
     }
     $this->getForward()->setVars(array('message' => $_error, '__error' => ''));
     $type = $this->getRequest()->getAcceptTypes();
     // 如果是含有上传的递交,不能采用ajax的方式递交,需要以html的方式递交,并且返回的结果需要是json格式,将以json=1传递过来标志
     $json = $this->getInput('_json');
     $requestJson = $this->getRequest()->getIsAjaxRequest() && strpos(strtolower($type), "application/json") !== false;
     if ($requestJson || $json == 1) {
         $this->getResponse()->setHeader('Content-type', 'application/json; charset=' . Wekit::V('charset'));
         echo Pw::jsonEncode($this->getForward()->getVars());
         exit;
     }
 }
 public function beforeAction($handlerAdapter)
 {
     parent::beforeAction($handlerAdapter);
     $this->_var = $this->getRequest()->getRequest();
     $this->_conf = Wekit::C('pay');
     if (!$this->_conf['ifopen']) {
         $this->paymsg($this->_conf['reason']);
     }
     if (!$this->_conf['alipay']) {
         $this->paymsg('onlinepay.settings.alipay.error');
     }
     $http = Wind::getComponent('httptransfer', array('http://notify.alipay.com/trade/notify_query.do'));
     $veryfy_result2 = trim($http->post(array('notify_id' => $this->_var['notify_id'], 'partner' => $this->_conf['alipaypartnerID'])), "\r\n");
     //兼容支付宝urlencode之后伪静态+号无法rawurldecode的处理方案
     isset($this->_var['notify_time']) && ($this->_var['notify_time'] = urldecode($this->_var['notify_time']));
     ksort($this->_var);
     reset($this->_var);
     $arg = '';
     foreach ($this->_var as $key => $value) {
         if ($value && !in_array($key, array('p', 'm', 'c', 'a', 'sign', 'sign_type'))) {
             $arg .= "{$key}={$value}&";
         }
     }
     $veryfy_result1 = $this->_var['sign'] == md5(substr($arg, 0, -1) . $this->_conf['alipaykey']) ? true : false;
     if (!$veryfy_result1 || !preg_match("/true/i", $veryfy_result2)) {
         $this->paymsg('onlinepay.auth.fail', 'fail');
     }
 }
 public function run()
 {
     $ips = $this->_loadSafeService()->getAllowIps();
     $ips = implode(',', $ips);
     $this->setOutput($ips, 'ips');
     $this->setOutput(Wind::getComponent('request')->getClientIp(), 'clientIp');
 }
 public function run()
 {
     list($type, $page) = $this->getInput(array('type', 'page'));
     $page = intval($page);
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $noticeList = $this->_getNoticeDs()->getNotices($this->loginUser->uid, $type, $start, $limit);
     $noticeList = $this->_getNoticeService()->formatNoticeList($noticeList);
     $typeCounts = $this->_getNoticeService()->countNoticesByType($this->loginUser->uid);
     //类型
     $typeid = intval($type);
     //获取未读通知数
     $unreadCount = $this->_getNoticeDs()->getUnreadNoticeCount($this->loginUser->uid);
     $this->_readNoticeList($unreadCount, $noticeList);
     //count
     $count = intval($typeCounts[$typeid]['count']);
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput(ceil($count / $perpage), 'totalpage');
     $this->setOutput(array('type' => $typeid), 'args');
     $this->setOutput($typeid, 'typeid');
     $this->setOutput($typeCounts, 'typeCounts');
     $this->setOutput($noticeList, 'noticeList');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:mess.notice.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
Exemple #16
0
 public function run()
 {
     $this->setCurrentLeft('avatar');
     $isAvatarBan = false;
     if (Pw::getstatus($this->loginUser->info['status'], PwUser::STATUS_BAN_AVATAR)) {
         Wind::import('SRV:user.srv.PwBanBp');
         $banBp = new PwBanBp($this->loginUser->uid);
         if (false === $banBp->checkIfBanAvatar()) {
             $banBp->recoveryBanAvatarError();
         } elseif ($banBp->endDateTimeBanAvatar()) {
             $this->loginUser->info['status'] = $banBp->callEndDateTimeBanAvatar();
         } else {
             $isAvatarBan = true;
             $info = $banBp->getBanAvatarInfo();
             if ($info['created_userid'] == 0) {
                 $info['operator'] = 'system';
             } else {
                 $operatorInfo = Wekit::load('user.PwUser')->getUserByUid($info['created_userid']);
                 $info['operator'] = $operatorInfo['username'];
             }
             $this->setOutput($info, 'banInfo');
         }
     }
     $windidApi = $this->_getWindid();
     $this->setOutput($windidApi->showFlash($this->loginUser->uid), 'avatarFlash');
     $this->setOutput($windidApi->showFlash($this->loginUser->uid, 0), 'avatarArr');
     $this->setOutput($isAvatarBan, 'isAvatarBan');
     $this->setOutput($this->getInput('type'), 'type');
     $this->setLayout('');
     $this->setTemplate('profile_avatar');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     PwSeoBo::setCustomSeo($lang->getMessage('SEO:profile.avatar.run.title'), '', '');
 }
 /**
  * 谁看过我
  */
 public function run()
 {
     $space = $this->_getSpaceDs()->getSpace($this->loginUser->uid);
     $visitors = $space['visitors'] ? unserialize($space['visitors']) : array();
     $uids = array_keys($visitors);
     if ($uids) {
         $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN | PwUser::FETCH_DATA | PwUser::FETCH_INFO);
         $userList = $this->_buildData($userList, $uids);
         $follows = $this->_getAttentionDs()->fetchFollows($this->loginUser->uid, $uids);
         $fans = $this->_getAttentionDs()->fetchFans($this->loginUser->uid, $uids);
         $friends = array_intersect_key($fans, $follows);
         $this->setOutput($fans, 'fans');
         $this->setOutput($friends, 'friends');
         $this->setOutput($userList, 'userList');
         $this->setOutput($follows, 'follows');
     } else {
         Wind::import('SRV:user.vo.PwUserSo');
         $vo = new PwUserSo();
         $vo->orderbyLastpost(false);
         $lastPostUser = Wekit::load('SRV:user.PwUserSearch')->searchUser($vo, 2);
         if ($lastPostUser) {
             unset($lastPostUser[$this->loginUser->uid]);
             $lastPostUser = array_keys($lastPostUser);
             $this->setOutput($lastPostUser[0], 'lastPostUser');
         }
     }
     $this->setOutput($visitors, 'visitors');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.visitor.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 public function run()
 {
     $permissionService = new PwPermissionService();
     $categorys = $permissionService->getPermissionPoint($this->_getShowPoint(), array('basic', 'bbs'));
     $compare = $this->getInput('gid');
     if ($compare && $compare != $this->loginUser->gid) {
         $this->setOutput(true, 'compare');
         $compareGroup = $permissionService->getPermissionConfigByGid($compare, $this->_getShowPoint());
         $this->setOutput($compareGroup, 'compareGroupPermission');
         $this->setOutput($compare, 'comparegid');
     }
     $myGroup = $permissionService->getPermissionConfigByGid($this->loginUser->gid, $this->_getShowPoint());
     $this->listGroups();
     $attach = array('allow_upload', 'allow_download', 'uploads_perday');
     foreach ($categorys['bbs']['sub'] as $_k => $_v) {
         if (!in_array($_v, $attach)) {
             continue;
         }
         unset($categorys['bbs']['sub'][$_k]);
     }
     $totalCredit = Wekit::load('usergroup.srv.PwUserGroupsService')->getCredit($this->loginUser->info);
     $categorys['attach'] = array('name' => '附件权限', 'sub' => $attach);
     $this->setOutput($categorys, 'categorys');
     $this->setOutput($myGroup, 'myGroupPermission');
     $this->setOutput($totalCredit, 'myCredit');
     $this->_appendBread('权限查看', WindUrlHelper::createUrl('profile/right/run'));
     $this->setTemplate('profile_right');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:profile.right.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
Exemple #19
0
 public function beforeStart($front = null)
 {
     parent::beforeStart($front);
     if (!Wind::getComponent('router')->getRoute('pw')) {
         Wind::getComponent('router')->addRoute('pw', WindFactory::createInstance(Wind::import('LIB:route.PwRoute'), array('bbs')));
     }
 }
 /**
  * 关注-首页
  */
 public function run()
 {
     $type = $this->getInput('type');
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $url = $classCurrent = array();
     $typeCounts = $this->_getTypeDs()->countUserType($this->loginUser->uid);
     if ($type) {
         $tmp = $this->_getTypeDs()->getUserByType($this->loginUser->uid, $type, $limit, $start);
         $follows = $this->_getDs()->fetchFollows($this->loginUser->uid, array_keys($tmp));
         $count = $typeCounts[$type] ? $typeCounts[$type]['count'] : 0;
         $url['type'] = $type;
         $classCurrent[$type] = 'current';
     } else {
         $follows = $this->_getDs()->getFollows($this->loginUser->uid, $limit, $start);
         $count = $this->loginUser->info['follows'];
         $classCurrent[0] = 'current';
     }
     $uids = array_keys($follows);
     $fans = $this->_getDs()->fetchFans($this->loginUser->uid, $uids);
     $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN | PwUser::FETCH_DATA | PwUser::FETCH_INFO);
     $service = $this->_getService();
     $typeArr = $service->getAllType($this->loginUser->uid);
     $userType = $service->getUserType($this->loginUser->uid, $uids);
     foreach ($userType as $key => $value) {
         $tmp = array();
         foreach ($value as $k => $v) {
             $tmp[$v] = $typeArr[$v];
         }
         ksort($tmp);
         $userType[$key] = $tmp;
     }
     $follows = WindUtility::mergeArray($follows, $userList);
     if (!$type && !$follows) {
         $num = 30;
         $uids = $this->_getRecommendService()->getOnlneUids($num);
         $uids = array_slice($uids, 0, 24);
         $this->setOutput($this->_getRecommendService()->buildUserInfo($this->loginUser->uid, $uids, $num), 'recommend');
     }
     $this->setOutput($follows, 'follows');
     $this->setOutput($typeArr, 'typeArr');
     $this->setOutput($type, 'type');
     $this->setOutput($userType, 'userType');
     $this->setOutput($typeCounts, 'typeCounts');
     $this->setOutput($fans, 'fans');
     $this->setOutput($classCurrent, 'classCurrent');
     $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.follow.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 public function buildResponse($errorCode, $responseData = array())
 {
     if ($errorCode == -1) {
         $resource = Wind::getComponent('i18n');
         $responseData = $resource->getMessage($responseData);
     }
     return array($errorCode, $responseData);
 }
Exemple #22
0
	public static function buildMultiRequest($urls, $params = array()) {
		$result = array();
		foreach ($urls as $k => $url) {
			$request = Wind::getComponent('httptransfer', array($url));
			$result[$k] = $request->post($params[$k]);
		}
		return $result;
	}
 /**
  * @return IAdminUserDependenceService
  */
 public function loadUserService()
 {
     $userService = Wind::getComponent('adminUserService');
     if ($userService instanceof IAdminUserDependenceService) {
         return $userService;
     }
     throw new PwDependanceException('admin.userservice', array('{service}' => __CLASS__, '{userservice}' => 'IAdminUserDependenceService'));
 }
Exemple #24
0
 protected function init()
 {
     $router = Wind::getComponent('router');
     $this->default_m || ($this->default_m = Wind::getApp()->getConfig('default-module', '', $router->getDefaultModule()));
     if ($this->getConfig('default')) {
         $router->setDefaultModule($this->default_m);
     }
     $this->init = true;
 }
 private function _router()
 {
     $router = Wind::getComponent('router');
     $m = $router->getModule();
     $c = $router->getController();
     $a = $router->getAction();
     $this->_router = $m . '/' . $c . '/' . $a;
     $this->_uri = urlencode($router->request->getHostInfo() . $router->request->getRequestUri());
 }
 public function getAttachDirectories()
 {
     $storage = Wind::getComponent('storage');
     if (!$storage instanceof PwStorageLocal) {
         return array();
     }
     $attachDir = Wind::getRealDir('PUBLIC:') . PUBLIC_ATTACH;
     return $this->_listDirectories($attachDir);
 }
 public function taAction()
 {
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:like.mylike.ta.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
Exemple #28
0
 /** 
  * 推荐关注
  */
 public function run()
 {
     $uids = $this->getOnlneUids(40);
     $userList = $this->_buildUserInfo($this->loginUser->uid, $uids, 20);
     $this->setOutput($userList, 'userList');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     PwSeoBo::setCustomSeo($lang->getMessage('SEO:bbs.friend.run.title'), '', '');
 }
Exemple #29
0
 public function beforeAction($handlerAdapter)
 {
     $url['baseUrl'] = PUBLIC_URL;
     $url['res'] = WindUrlHelper::checkUrl(PUBLIC_RES, PUBLIC_URL);
     $url['css'] = WindUrlHelper::checkUrl(PUBLIC_RES . '/css', PUBLIC_URL);
     $url['images'] = WindUrlHelper::checkUrl(PUBLIC_RES . '/images', PUBLIC_URL);
     $url['js'] = WindUrlHelper::checkUrl(PUBLIC_RES . '/js/dev', PUBLIC_URL);
     Wekit::setGlobal($url, 'url');
     $config = Wind::getComponent('configParser')->parse(Wind::getRealPath('APPS:demo.WindManifest.xml', true, true));
     Wekit::setGlobal($config['application'], 'c');
 }
 /**
  * 获得搜索文件包路径
  * @return string
  */
 private function _getPath()
 {
     $this->setConfig(Wind::getComponent('i18n')->getConfig());
     $path = $this->resolvedPath('ADMIN');
     if (is_file($path . '/search' . $this->suffix)) {
         $path = $path . '/search' . $this->suffix;
     } elseif (is_file($path . '/' . $this->default . $this->suffix)) {
         $path = $path . '/' . $this->default . $this->suffix;
     }
     return $path;
 }