public function appDo($space)
 {
     if (!in_array('profile', Wekit::C('site', 'app.torrent.showuserinfo'))) {
         return '';
     }
     $user = Wekit::load('EXT:torrent.service.PwTorrentUser')->getTorrentUserByUid($space->{'spaceUid'});
     $torrents = Wekit::load('EXT:torrent.service.PwTorrent')->fetchTorrentByUid($space->{'spaceUid'});
     $histories = Wekit::load('EXT:torrent.service.PwTorrentHistory')->fetchTorrentHistoryByUid($space->{'spaceUid'});
     $passkey = $user['passkey'];
     $posted = count($torrents);
     foreach ($histories as $history) {
         $downloaded_total += $history['downloaded'];
         $uploaded_total += $history['uploaded'];
     }
     $downloaded_total = floor($downloaded_total / 1048567);
     $uploaded_total = floor($uploaded_total / 1048567);
     if ($downloaded_total != 0) {
         $rotio = round($uploaded_total / $downloaded_total, 2);
     } else {
         $rotio = 'Inf.';
     }
     echo '<div class="space_profile"><h3><strong>PT个人信息</strong></h3>';
     if ($space->{'visitUid'} == $space->{'spaceUid'}) {
         echo '<dl class="cc"><dt>Passkey:</dt><dd><span id="passkey" style="background-color:rgb(51,51,51); color:rgb(51,51,51);">' . $passkey . '</span>&nbsp;<button class="btn" id="btnToggle" onclick="if ($(\'#btnToggle\').text() == \'显示\') {$(\'#passkey\').css(\'background\', \'white\'); $(\'#btnToggle\').text(\'隐藏\');} else {$(\'#passkey\').css(\'background\', \'rgb(51,51,51)\');$(\'#btnToggle\').text(\'显示\');}">显示</button></dd></dl>';
         echo '<dl class="cc"><dt>订阅地址:</dt><dd><a href="' . WindUrlHelper::createUrl('/app/torrent/index/rss?uid=' . $space->{'spaceUid'} . '&passkey=' . $passkey) . '">RSS 链接(请勿泄露)</a><a href="' . WindUrlHelper::createUrl('/app/torrent/index/my') . '" class="btn">管理</a></dd></dl>';
     }
     echo '<dl class="cc"><dt>下载:</dt><dd>' . $downloaded_total . ' M</dd></dl>';
     echo '<dl class="cc"><dt>上传:</dt><dd>' . $uploaded_total . ' M</dd></dl>';
     echo '<dl class="cc"><dt>分享率:</dt><dd>' . $rotio . '</dd></dl>';
     echo '<dl class="cc"><dt>发布:</dt><dd>' . $posted . '</dd></dl>';
     echo '</div>';
 }
 public function run()
 {
     // type表示哪一种第三方平台
     $type = $this->getInput('type', 'get') ? $this->getInput('type', 'get') : 'qq';
     // 管理界面显示的名称
     $lab = $this->_displayText($type);
     // 在数据库中存储的字段名称
     $status = $type . '.status';
     $appId = $type . '.appid';
     $appKey = $type . '.appkey';
     $displayOrder = $type . '.displayOrder';
     //
     $config = Wekit::C()->getValues('webThirdLogin');
     $info = array('status' => $config[$status], 'appId' => $config[$appId], 'appKey' => $config[$appKey], 'displayOrder' => $config[$displayOrder]);
     // 回调地址
     $config = Wekit::C()->getConfigByName('site', 'info.url');
     if ($type == 'qq') {
         // QQ的回调地址填写比较诡异,提示和文档都是错的
         $redirecturl = $config['value'] . '/index.php';
     } else {
         $redirecturl = $config['value'] . '/index.php?m=u&c=login&a=thirdlogincallback&platform=' . $type;
     }
     //
     $this->setOutput($redirecturl, 'redirecturl');
     $this->setOutput($type, 'type');
     $this->setOutput($lab, 'lab');
     $this->setOutput($info, 'info');
     //
     $typeClasses[$type] = 'class="current"';
     $this->setOutput($typeClasses, 'typeClasses');
 }
Esempio n. 3
0
 public function dorunAction()
 {
     list($showuserinfo, $titlegenifopen, $titlegendouban, $check, $deniedfts, $torrentnameprefix, $peertimeout, $torrentimeout) = $this->getInput(array('showuserinfo', 'titlegenifopen', 'titlegendouban', 'check', 'deniedfts', 'torrentnameprefix', 'peertimeout', 'torrentimeout'), 'post');
     if (is_array($deniedfts)) {
         foreach ($deniedfts as $key => $value) {
             if (empty($value)) {
                 continue;
             }
             $_deniedfts[$key] = $value;
         }
     }
     if (empty($torrentnameprefix)) {
         $torrentnameprefix = Wekit::C('site', 'info.name');
     }
     if (intval($peertimeout) < 15) {
         $peertimeout = 15;
     }
     $config = new PwConfigSet('site');
     $config->set('app.torrent.showuserinfo', $showuserinfo)->set('app.torrent.titlegen.ifopen', $titlegenifopen)->set('app.torrent.titlegen.douban', $titlegendouban)->set('app.torrent.check', $check)->set('app.torrent.torrentnameprefix', $torrentnameprefix)->set('app.torrent.cron.peertimeout', intval($peertimeout))->set('app.torrent.cron.torrentimeout', intval($torrentimeout));
     if (!empty($deniedfts)) {
         $config->set('app.torrent.deniedfts', $_deniedfts);
     }
     $sconfig = $this->_loadConfigService()->getValues('site');
     if ($sconfig['theme.site.default'] == 'pt') {
         $showpeers = $this->getInput('showpeers', 'post');
         $config->set('app.torrent.theme.showpeers', $showpeers);
     }
     $config->flush();
     $this->showMessage('ADMIN:success');
 }
 /**
  * 搜索邀请码列表
  *
  * @param PwInviteCodeSo $search 搜索的条件
  * @param int $page 搜索的开始位置
  * @param int $perpage
  * @return array
  */
 public function searchInvitecodeList(PwInviteCodeSo $search, $limit = 10, $start = 0)
 {
     $data = $this->_getDs()->searchCode($search, $limit, $start);
     if (!$data) {
         return array();
     }
     $result = array();
     $time = Wekit::C('register', 'invite.expired');
     $expire = Pw::getTime() - $time * 86400;
     $_invitedUid = array();
     foreach ($data as $_item) {
         $_item['status'] = $_item['created_time'] < $expire ? '-1' : $_item['ifused'];
         $_item['expired_time'] = $_item['created_time'] + $time * 86400;
         $_item['invited_userid'] && ($_invitedUid[] = $_item['invited_userid']);
         $result[] = $_item;
     }
     if ($_invitedUid) {
         /* @var $userDs PwUser */
         $userDs = Wekit::load('user.PwUser');
         $invitedUsers = $userDs->fetchUserByUid($_invitedUid);
         foreach ($result as $_k => $_item) {
             $result[$_k]['invited_username'] = $invitedUsers[$_item['invited_userid']] ? $invitedUsers[$_item['invited_userid']]['username'] : '';
         }
     }
     return $result;
 }
Esempio n. 5
0
 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');
     }
 }
Esempio n. 6
0
 public function __construct()
 {
     $config = Wekit::C('pay');
     $this->tenpay = $config['tenpay'];
     $this->tenpay_key = $config['tenpaykey'];
     $this->baseurl = WindUrlHelper::createUrl('bbs/tenpay/run');
 }
 public function compile($key, $content)
 {
     $content = substr($content, 8, -1);
     if (!$content) {
         return '';
     }
     $themeBaseUrl = 'Wekit::app()->themes';
     preg_match('/(\\w*.)?(\\w*.)?(css|js|images)(.\\w*)?/i', $content, $matchs);
     if (!$matchs) {
         return '';
     }
     if (empty($matchs[3])) {
         return '';
     }
     $pack = $theme = '';
     if (!empty($matchs[1])) {
         $themeType = trim($matchs[1], '.');
         $pack = Wekit::C('site', 'theme.' . $themeType . '.pack');
         $theme = empty($matchs[2]) ? '\'.Wekit::C(\'site\', \'theme.' . $themeType . '.default\').\'' : trim($matchs[2], '.');
     } else {
         list($theme, $pack) = $this->windViewerResolver->getWindView()->getTheme(0);
         $pack && ($pack = str_replace('THEMES:', '', $pack));
     }
     $content = $pack ? '.\'/' . str_replace('.', '/', $pack) . '\'' : '';
     $content .= $theme ? '.\'/' . $theme . '\'' : '';
     $content .= '.\'/' . $matchs[3] . '\'';
     if ($matchs[3] === 'css') {
         $content .= '.Wekit::getGlobal(\'theme\',\'debug\')';
     }
     $content = '<?php echo ' . $themeBaseUrl . $content . '; ?>';
     $content = str_replace('\'.\'', '', $content);
     return $content;
 }
Esempio n. 8
0
 public function __construct()
 {
     $config = Wekit::C('pay');
     $this->bill = $config['99bill'];
     $this->bill_key = $config['99billkey'];
     $this->baseurl = WindUrlHelper::createUrl('bbs/pay99bill/run');
 }
Esempio n. 9
0
 public function run()
 {
     $addons = Wekit::load('domain.srv.PwDomainService')->getRewriteAddOns();
     $rewrite = Wekit::C('rewrite');
     $this->setOutput($addons, 'addons');
     $this->setOutput($rewrite, 'rewrite');
 }
Esempio n. 10
0
 public function postHandle()
 {
     //门户管理模式 编译目录切换
     if ($this->getRequest()->getPost('design')) {
         $loginUser = Wekit::getLoginUser();
         $designPermission = $loginUser->getPermission('design_allow_manage.push');
         if ($designPermission > 0) {
             $dir = Wind::getRealDir('DATA:design.template');
             if (is_dir($dir)) {
                 WindFolder::rm($dir, true);
             }
             $this->forward->getWindView()->compileDir = 'DATA:design.template';
         }
     }
     // SEO settings
     Wind::import('SRV:seo.bo.PwSeoBo');
     $sitename = Wekit::C('site', 'info.name');
     PwSeoBo::set('{sitename}', $sitename);
     Wekit::setGlobal(NEXT_VERSION . ' ' . NEXT_RELEASE, 'version');
     Wekit::setGlobal(PwSeoBo::getData(), 'seo');
     $this->setOutput($this->getRequest()->getIsAjaxRequest() ? '1' : '0', '_ajax_');
     /*[设置给PwGlobalFilters需要的变量]*/
     $_var = array('current' => $this->forward->getWindView()->templateName, 'a' => $this->router->getAction(), 'c' => $this->router->getController(), 'm' => $this->router->getModule());
     $this->getResponse()->setData($_var, '_aCloud_');
     Wekit::load('APPS:appcenter.service.srv.PwDebugApplication')->compile();
 }
Esempio n. 11
0
 public function run()
 {
     $config = Wekit::C()->getValues('reg');
     is_array($config['security.password']) || ($config['security.password'] = array());
     //$config['security.ban.username'] = implode(',', $config['security.ban.username']);
     $this->setOutput($config, 'config');
 }
Esempio n. 12
0
 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['99bill'] || !$this->_conf['99billkey']) {
         $this->paymsg('onlinepay.settings.99bill.error');
     }
     strlen($this->_conf['99bill']) == 11 && ($this->_conf['99bill'] .= '01');
     $arr = array('payType', 'bankId', 'orderId', 'orderTime', 'orderAmount', 'dealId', 'bankDealId', 'dealTime', 'payAmount', 'fee', 'payResult', 'errCode');
     $txt = 'merchantAcctId=' . $this->_conf['99bill'] . '&version=v2.0&language=1&signType=1';
     foreach ($arr as $value) {
         $this->_var[$value] = trim($this->_var[$value]);
         if (strlen($this->_var[$value]) > 0) {
             $txt .= '&' . $value . '=' . $this->_var[$value];
         }
     }
     $mac = strtoupper(md5($txt . '&key=' . $this->_conf['99billkey']));
     if ($mac != strtoupper(trim($this->_var['signMsg']))) {
         $this->paymsg('onlinepay.auth.fail');
     }
     if ($this->_var['payResult'] != '10') {
         $this->paymsg('onlinepay.success');
     }
 }
Esempio n. 13
0
 public function run()
 {
     if (isset($_POST['submit'])) {
         list($mobile, $password, $username) = $this->getInput(array('mobile', 'password', 'username'), 'post');
         $registeresult = $this->_getCommonDs()->weixinRegisterUser(Wekit::C('site', 'info.url'), $mobile, $password, $username);
     }
 }
Esempio n. 14
0
 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['tenpay'] || !$this->_conf['tenpaykey']) {
         $this->paymsg('onlinepay.settings.tenpay.error');
     }
     $arr = array('cmdno', 'pay_result', 'date', 'transaction_id', 'sp_billno', 'total_fee', 'fee_type', 'attach');
     $txt = '';
     foreach ($arr as $value) {
         $txt .= $value . '=' . $this->_var[$value] . '&';
     }
     $mac = strtoupper(md5($txt . 'key=' . $this->_conf['tenpaykey']));
     if ($mac != $this->_var['sign']) {
         $this->paymsg('onlinepay.auth.fail');
     }
     if ($this->_conf['tenpay'] != $this->_var['bargainor_id']) {
         $this->paymsg('onlinepay.tenpay.bargainorid.error');
     }
     if ($this->_var['pay_result'] != "0") {
         $this->paymsg('onlinepay.fail');
     }
 }
 public function checkVerify($inputCode)
 {
     Wind::import('WINDID:service.verify.srv.PwVerifyService');
     $srv = new PwVerifyService('PwVerifyService_getVerifyType');
     $config = Wekit::C('verify');
     return $srv->checkVerify($config['type'], $inputCode);
 }
Esempio n. 16
0
 /**
  * 设置伪静态
  */
 public function doModifyAction()
 {
     list($format, $isopen) = $this->getInput(array('format', 'isopen'));
     $bo = new PwConfigSet('rewrite');
     foreach ($format as $k => $v) {
         if (empty($v) && isset($isopen[$k])) {
             $this->showError('REWRITE:format.empty');
         }
         $bo->set("format.{$k}", $v);
     }
     $addons = Wekit::load('domain.srv.PwDomainService')->getRewriteAddOns();
     $rewriteData = array();
     $unique = array();
     foreach ($addons as $k1 => $v1) {
         $open = isset($isopen[$k1]) ? 1 : 0;
         $bo->set("isopen.{$k1}", $open);
         if ($open) {
             $format_i = preg_replace('/\\{\\w+\\}/', '', $format[$k1]);
             if (in_array($format_i, $unique)) {
                 $this->showError(array('REWRITE:format.conflict', array($format[$k1])));
             }
             $unique[] = $format_i;
             if ($k1 == 'thread') {
                 $rewriteData['cate'] = array('format' => $format[$k1], 'pattern' => $this->_compileFormat($format[$k1]), 'route' => 'bbs/cate/run');
             }
             $rewriteData[$k1] = array('format' => $format[$k1], 'pattern' => $this->_compileFormat($format[$k1]), 'route' => $v1[2]);
         }
     }
     $bo->flush();
     Wekit::C()->setConfig('site', 'rewrite', $rewriteData);
     Wekit::load('domain.srv.PwDomainService')->refreshTplCache();
     Wekit::load('SRV:nav.srv.PwNavService')->updateConfig();
     $this->showMessage('success');
 }
 /**
  * 获得第三方平台的appid,用来app生成使用
  * 
  * @access public
  * @return void
  */
 protected function thirdPlatformAppid()
 {
     $config = Wekit::C()->getValues('thirdPlatform');
     //
     $apidata = array();
     if (count($config)) {
         foreach ($config as $k => $v) {
             $_keys = explode('.', $k);
             $data[$_keys[0]][$_keys[1]] = $v;
         }
         foreach ($data as $k => $v) {
             if ($v['status'] == 1) {
                 $data[$k] = $v['displayOrder'] . '-' . $v['appId'];
             } else {
                 unset($data[$k]);
             }
         }
         asort($data);
         foreach ($data as $k => $v) {
             list($order, $appId) = explode('-', $v);
             $apidata[] = array('platformname' => $k, 'order' => $order, 'appId' => $appId);
         }
     }
     return $apidata;
 }
Esempio n. 18
0
 public function dataProcessing($postDm)
 {
     $word_version = $this->_word ? 0 : (int) Wekit::C('bbs', 'word_version');
     $this->_isVerified && $postDm->setDisabled(1);
     $postDm->setWordVersion($word_version);
     return $postDm;
 }
 public function createHtmlAfterUserInfo($user, $read)
 {
     $showuserinfo = Wekit::C('site', 'app.torrent.showuserinfo');
     if (is_array($showuserinfo) && !in_array('threadside', $showuserinfo)) {
         return;
     }
     $peers = Wekit::load('EXT:torrent.service.PwTorrentPeer')->fetchTorrentPeerByUid($user['uid']);
     $torrents = Wekit::load('EXT:torrent.service.PwTorrent')->fetchTorrentByUid($user['uid']);
     $histories = Wekit::load('EXT:torrent.service.PwTorrentHistory')->fetchTorrentHistoryByUid($user['uid']);
     $seeding = $leeching = 0;
     if (is_array($peers)) {
         foreach ($peers as $peer) {
             if ($peer['seeder'] == 'yes') {
                 $seeding++;
             } else {
                 $leeching++;
             }
         }
     }
     if (is_array($histories)) {
         foreach ($histories as $history) {
             $downloaded_total += $history['downloaded'];
             $uploaded_total += $history['uploaded'];
         }
     }
     if ($downloaded_total != 0) {
         $rotio = round($uploaded_total / $downloaded_total, 2);
     } else {
         $rotio = 'Inf.';
     }
     echo '<div id="PTInfo">下载:' . $leeching . '<br>做种:' . $seeding . '<br>发布: ' . count($torrents) . '<br>分享率: ' . $rotio . '<br>下载量: ' . PwUtils::readableDataTransfer($downloaded_total) . '<br>上传量: ' . PwUtils::readableDataTransfer($uploaded_total) . '</div>';
 }
Esempio n. 20
0
 /**
  * 根据用户的行为数据分析并发送自动任务
  *
  * @param array $behavior
  * @return boolean
  */
 public function sendAutoTask($behavior)
 {
     if (!Wekit::C('site', 'task.isOpen')) {
         return false;
     }
     $whitBehavior = array('login_days', 'post_days', 'thread_count');
     if (!in_array($behavior['behavior'], $whitBehavior)) {
         return false;
     }
     $tody = Pw::time2str(Pw::getTime(), 'Y-m-d');
     $isSend = false;
     switch ($behavior['behavior']) {
         case 'login_days':
             $isSend = $behavior['number'] % 3 == 0;
             break;
         case 'post_days':
             $is_tody = $tody == Pw::time2str($behavior['extend_info'], 'Y-m-d');
             $isSend = $is_tody && $behavior['number'] % 2 == 0;
             break;
         case 'thread_count':
             $isSend = $behavior['number'] == 1 || $behavior['number'] % 50 == 0;
             break;
     }
     if (!$isSend) {
         return false;
     }
     Wind::import('SRV:task.srv.PwTaskApply');
     $userTask = new PwTaskApply($behavior['uid']);
     $userTask->autoApplies($this->getAutoApplicableTaskList($behavior['uid'], 1));
     return true;
 }
Esempio n. 21
0
 public function run()
 {
     $keywords = $this->getInput('keyword');
     if (!Wekit::C('site', 'search.isopen')) {
         $this->forwardRedirect(WindUrlHelper::createUrl('search/search/run', array('keyword' => $keywords)));
     }
     $this->forwardAction('app/index/run?app=search', array('keywords' => $keywords));
 }
Esempio n. 22
0
 public function beforeAction($handlerAdapter)
 {
     parent::beforeAction($handlerAdapter);
     $config = Wekit::C('site', 'windid');
     if ($config == 'client') {
         $this->showError('WINDID:is.server.config');
     }
 }
Esempio n. 23
0
 public function __construct()
 {
     parent::__construct();
     $config = Wekit::C('pay');
     $this->paypal = $config['paypal'];
     $this->paypal_key = $config['paypalkey'];
     $this->baseurl = WindUrlHelper::createUrl('bbs/paypal/run');
 }
Esempio n. 24
0
 /**
  * 获取当前时间戳
  *
  * @return int
  */
 public function getTime()
 {
     $timestamp = time();
     if (Wekit::app() && ($cvtime = Wekit::C('site', 'time.cv'))) {
         $timestamp += $cvtime * 60;
     }
     return $timestamp;
 }
Esempio n. 25
0
 public function addPost($pid, $tid)
 {
     if (!Wekit::C('site', 'task.isOpen')) {
         return true;
     }
     $bp = new PwTaskComplete($this->uid, $this);
     $bp->doTask('bbs', 'reply');
 }
 /**
  * 获取可用积分类型 
  */
 public function getReplyRewardCreditType()
 {
     if ($this->crditInfo) {
         return $this->crditInfo;
     }
     $this->creditInfo = Wekit::C('credit', $this->creditTypeKey);
     return $this->creditInfo;
 }
Esempio n. 27
0
 /**
  * 导航列表
  *
  * @return void
  */
 public function run()
 {
     $this->_getNavType();
     $this->_navTab();
     $navList = $this->_getNavDs()->getNavByType($this->_navType, 2);
     $this->setOutput($navList, 'navList');
     $this->setOutput(Wekit::C('site', 'homeUrl'), 'homeUrl');
 }
Esempio n. 28
0
 public function __construct($info, $config = array())
 {
     $config || ($config = Wekit::C('site'));
     $this->moneyType = $config['app.signature.moneytype'];
     $this->money = $config['app.signature.money'];
     $this->groups = $config['app.signature.groups'];
     $this->info = $info;
 }
Esempio n. 29
0
 public function __construct()
 {
     $config = Wekit::C('site');
     $this->time = Pw::getTime();
     $this->isVisitorTime = 1;
     $this->spaceTime = 10;
     $this->offlineTime = $config['onlinetime'] * 60;
 }
Esempio n. 30
0
 public function run()
 {
     $config = Wekit::C()->getValues('site');
     Wind::import('SRV:credit.bo.PwCreditBo');
     $transfer = Wekit::C('credit', 'transfer');
     $this->setOutput(PwCreditBo::getInstance(), 'creditBo');
     $this->setOutput($config, 'config');
 }