/**
  * 设置论坛设置
  */
 public function dorunAction()
 {
     list($bbsname, $title_length_max, $content_length_min, $content_length_max, $check) = $this->getInput(array('bbsname', 'title_length_max', 'content_length_min', 'content_length_max', 'check'));
     $config = new PwConfigSet('bbs');
     $config->set('bbsname', $bbsname)->set('title.length.max', abs(intval($title_length_max)))->set('content.length.min', abs(intval($content_length_min)))->set('content.length.max', abs(intval($content_length_max)))->set('post.check.open', intval($check));
     /*
     list($start_hour, $start_min, $end_hour, $end_min) = $this->getInput(array('start_hour', 'start_min', 'end_hour', 'end_min'), 'post');
     $start_hour = intval($start_hour);
     $start_min = intval($start_min);
     $end_hour = intval($end_hour);
     $end_min = intval($end_min);
     $config->set('post.timing.start_hour', max(0, min(24, $start_hour)))
     	->set('post.timing.start_min', max(0, min(60, $start_min)))
     	->set('post.timing.end_hour', max(0, min(24, $end_hour)))
     	->set('post.timing.end_min', max(0, min(60, $end_min)))
     	->set('post.timing.groups', $this->getInput('timing_groups', 'post'));
     */
     list($check_start_hour, $check_start_min, $check_end_hour, $check_end_min) = $this->getInput(array('check_start_hour', 'check_start_min', 'check_end_hour', 'check_end_min'), 'post');
     $check_start_hour = intval($check_start_hour);
     $check_start_min = intval($check_start_min);
     $check_end_hour = intval($check_end_hour);
     $check_end_min = intval($check_end_min);
     $config->set('post.check.start_hour', max(0, min(24, $check_start_hour)))->set('post.check.start_min', max(0, min(24, $check_start_min)))->set('post.check.end_hour', max(0, min(24, $check_end_hour)))->set('post.check.end_min', max(0, min(24, $check_end_min)))->set('post.check.groups', $this->getInput('check_groups', 'post'));
     $config->flush();
     $this->showMessage('config.setting.success');
 }
 /**
  * 设置伪静态
  */
 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');
 }
 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');
 }
Exemple #4
0
 public function dorunAction()
 {
     list($doubankey, $omdbkey) = $this->getInput(array('doubankey', 'omdbkey'), 'post');
     $config = new PwConfigSet('site');
     $config->set('app.dimdb.doubankey', $doubankey)->set('app.dimdb.omdbkey', $omdbkey);
     $config->flush();
     $this->showMessage('ADMIN:success');
 }
 /**
  * 设置全局TPL配置
  *
  * @param array $style        	
  * @return boolean
  */
 private function _setConfigBo($style)
 {
     $configBo = new PwConfigSet('site');
     $config = Wekit::load('APPCENTER:service.srv.PwInstallApplication')->getConfig('style-type');
     foreach ($config as $k => $v) {
         $configBo->set("theme.{$k}.pack", $v[1]);
     }
     $configBo->set("theme.{$style['style_type']}.default", $style['alias']);
     $configBo->flush();
     return true;
 }
Exemple #6
0
 /**
  * 更新seo,同时更新缓存
  *
  * @param array $dms
  * @return boolean|PwError
  */
 public function batchReplaceSeoWithCache($dms)
 {
     if (empty($dms)) {
         return false;
     }
     !is_array($dms) && ($dms = array($dms));
     $r = $this->_seoDs()->batchReplaceSeo($dms);
     if ($r instanceof PwError) {
         return $r;
     }
     $bo = new PwConfigSet('seo');
     foreach ($dms as $dm) {
         $key = $this->_buildKey($dm->getField('mod'), $dm->getField('page'), $dm->getField('param'));
         $bo->set($key, $dm->getData());
     }
     $bo->flush();
     return true;
 }
Exemple #7
0
 /**
  * 安装过程中风格的初始化
  *
  */
 public function init()
 {
     $install = Wekit::load('APPS:appcenter.service.srv.PwInstallApplication');
     $configBo = new PwConfigSet('site');
     $config = $install->getConfig('style-type');
     foreach ($config as $k => $v) {
         $configBo->set("theme.{$k}.pack", $v[1]);
         $pack = Wind::getRealDir('THEMES:' . str_replace('/', '.', $v[1]) . '.default');
         $id = $this->install($pack);
         if (!$id) {
             continue;
         }
         $dm = new PwStyleDm();
         $dm->setAppid($id)->setIsCurrent(1);
         $this->_styleDs()->updateStyle($dm);
         $configBo->set("theme.{$k}.default", 'default');
     }
     $configBo->flush();
 }
 public function dorunAction()
 {
     $this->getRequest()->isPost() || $this->showError('operate.fail');
     list($windid, $serverUrl, $clientId, $clientKey, $connect) = $this->getInput(array('windid', 'serverUrl', 'clientId', 'clientKey', 'connect'), 'post');
     if ($windid == 'local') {
         $serverUrl = Wekit::C('site', 'info.url') . '/windid';
         $clientId = 1;
         !$clientKey && ($clientKey = md5(WindUtility::generateRandStr(10)));
         $connect = 'db';
     }
     $config = new PwConfigSet('windid');
     $config->set('windid', $windid)->set('serverUrl', $serverUrl)->set('clientId', $clientId)->set('clientKey', $clientKey)->set('connect', $connect);
     if ($windid == 'client') {
         list($dbhost, $dbport, $dbuser, $dbpwd, $dbname, $dbprefix, $dbcharset) = $this->getInput(array('dbhost', 'dbport', 'dbuser', 'dbpwd', 'dbname', 'dbprefix', 'dbcharset'), 'post');
         $config->set('db.host', $dbhost)->set('db.port', $dbport)->set('db.user', $dbuser)->set('db.pwd', $dbpwd)->set('db.name', $dbname)->set('db.prefix', $dbprefix)->set('db.charset', $dbcharset);
     }
     $config->flush();
     if ($clientId) {
         Wekit::C()->reload('windid');
         $service = WindidApi::api('app');
         WindidApi::getDm('app');
         if (!$service->getApp($clientId)) {
             $charset = Wekit::V('charset');
             $charset = str_replace('-', '', strtolower($charset));
             if (!in_array($charset, array('gbk', 'utf8', 'big5'))) {
                 $charset = 'utf8';
             }
             $dm = new WindidAppDm();
             $dm->setId($clientId)->setApiFile('windid.php')->setIsNotify(1)->setIsSyn(1)->setAppName(Wekit::C('site', 'info.name'))->setSecretkey($clientKey)->setAppUrl(Wekit::C('site', 'info.url'))->setAppIp(Wind::getComponent('request')->getClientIp())->setCharset($charset);
             $service->addApp($dm);
         } elseif ($clientKey) {
             $dm = new WindidAppDm($clientId);
             $dm->setSecretkey($clientKey)->setAppUrl(Wekit::C('site', 'info.url'))->setCharset($charset);
             $service->editApp($dm);
         }
     }
     $_avatarUrl = WindidApi::api('avatar')->getAvatarUrl();
     if ($_avatarUrl != WindidError::SERVER_ERROR) {
         Wekit::C()->setConfig('site', 'avatarUrl', $_avatarUrl);
     }
     $this->showMessage('ADMIN:success');
 }
 /**
  * 界面管理
  */
 public function doManageAction()
 {
     $config = Wekit::C('css');
     $logo = $this->_upload('logo');
     if ($logo) {
         $config['logo'] = $logo['path'];
         $old = $this->getInput('oldlogo');
         $old && Pw::deleteAttach($old);
     }
     $bg = $this->_upload('bg');
     if ($bg) {
         $config['bg'] = $bg['path'];
         $old = $this->getInput('oldbg');
         $old && Pw::deleteAttach($old);
     }
     $headbg = $this->_upload('headbg');
     if ($headbg) {
         $config['headbg'] = $headbg['path'];
         $old = $this->getInput('oldheadbg');
         $old && Pw::deleteAttach($old);
     }
     $boxbg = $this->_upload('boxbg');
     if ($boxbg) {
         $config['boxbg'] = $boxbg['path'];
         $old = $this->getInput('oldboxbg');
         $old && Pw::deleteAttach($old);
     }
     $boxhdbg = $this->_upload('boxhdbg');
     if ($boxhdbg) {
         $config['boxhdbg'] = $boxhdbg['path'];
         $old = $this->getInput('oldboxhdbg');
         $old && Pw::deleteAttach($old);
     }
     list($color, $headbgcolor, $headlink, $headactivelink, $headactivecolor, $corelink, $coretext, $boxbgcolor, $boxborder, $boxlink, $boxtext, $boxhdbgcolor, $boxhdborder, $boxhdlink, $boxhdtext) = $this->getInput(array('bgcolor', 'headbgcolor', 'headlink', 'headactivelink', 'headactivecolor', 'corelink', 'coretext', 'boxbgcolor', 'boxborder', 'boxlink', 'boxtext', 'boxhdbgcolor', 'boxhdborder', 'boxhdlink', 'boxhdtext'), 'post');
     $config = array('bgcolor' => $color == '#ffffff' ? '' : $color, 'headbgcolor' => $headbgcolor == '#ffffff' ? '' : $headbgcolor, 'headlink' => $headlink == '#ffffff' ? '' : $headlink, 'headactivelink' => $headactivelink == '#ffffff' ? '' : $headactivelink, 'corelink' => $corelink == '#ffffff' ? '' : $corelink, 'coretext' => $coretext == '#ffffff' ? '' : $coretext, 'headactivecolor' => $headactivecolor == '#ffffff' ? '' : $headactivecolor, 'boxbgcolor' => $boxbgcolor == '#ffffff' ? '' : $boxbgcolor, 'boxborder' => $boxborder == '#ffffff' ? '' : $boxborder, 'boxlink' => $boxlink == '#ffffff' ? '' : $boxlink, 'boxtext' => $boxtext == '#ffffff' ? '' : $boxtext, 'boxhdbgcolor' => $boxhdbgcolor == '#ffffff' ? '' : $boxhdbgcolor, 'boxhdborder' => $boxhdborder == '#ffffff' ? '' : $boxhdborder, 'boxhdlink' => $boxhdlink == '#ffffff' ? '' : $boxhdlink, 'boxhdtext' => $boxhdtext == '#ffffff' ? '' : $boxhdtext, 'bgtile' => $this->getInput('bgtile', 'post'), 'bgalign' => $this->getInput('bgalign', 'post'), 'size' => $this->getInput('size', 'post'), 'font' => $this->getInput('font', 'post'), 'subjectsize' => $this->getInput('subjectsize', 'post'), 'contentsize' => $this->getInput('contentsize', 'post'), 'headbgtile' => $this->getInput('headbgtile', 'post'), 'headbgalign' => $this->getInput('headbgalign', 'post'), 'boxbgtile' => $this->getInput('boxbgtile', 'post'), 'boxbgalign' => $this->getInput('boxbgalign', 'post'), 'boxhdbgtile' => $this->getInput('boxhdbgtile', 'post'), 'boxhdbgalign' => $this->getInput('boxhdbgalign', 'post')) + $config;
     $bo = new PwConfigSet('css');
     foreach ($config as $k => $v) {
         $bo->set($k, $v);
     }
     $bo->flush();
     $this->_compilerService()->doCompile($config);
     $this->showMessage('success');
 }
Exemple #10
0
 /**
  * 保存修改
  */
 public function doModifyAction()
 {
     $root = Wekit::C('site', 'cookie.domain');
     if (empty($root)) {
         $this->showError('REWRITE:cookie.domain.fail');
     }
     $root[0] != '.' && ($root = '.' . $root);
     list($app, $domain, $domain_hold) = $this->getInput(array('app', 'domain', 'domain_hold'));
     // 判断域名是否重复
     $unique = array();
     Wind::import('SRV:domain.dm.PwDomainDm');
     $bo = new PwConfigSet('domain');
     $addons = $this->_service()->getDomainAddOns();
     foreach ($app as $key => $value) {
         $domainKey = $addons[$key][1] ? $addons[$key][1] : "{$key}/index/run";
         if ($value) {
             //域名重复
             in_array($value, $unique) && $this->showError(array('REWRITE:domain.same', array($value)));
             $unique[] = $value;
             //添加应用域名
             $dm = new PwDomainDm();
             $dm->setDomain($value)->setRoot(substr($root, 1))->setDomainKey($domainKey)->setDomainType('app')->setFirst($value[0]);
             $r = $this->_ds()->replaceDomain($dm);
             if ($r instanceof PwError) {
                 $this->showError($r->getError());
             }
         } else {
             $this->_ds()->deleteByDomainKey($domainKey);
         }
     }
     $unique = array();
     $space_root = '';
     $siteBo = new PwConfigSet('site');
     foreach ($domain as $k => $v) {
         $domain_root = '';
         if ($v['isopen']) {
             if (!$app['default']) {
                 $this->showError('REWRITE:default.empty');
             }
             if ($k == 'space' && !$v['root']) {
                 $this->showError('REWRITE:root.empty');
             }
             $space_root = isset($domain['space']['root']) ? $domain['space']['root'] : '';
             if ($k != 'space' && $domain['space']['isopen']) {
                 if ($v['root'] == $space_root) {
                     $this->showError('REWRITE:root.same');
                 }
             }
             $unique[] = $v['root'];
             $domain_root = $v['root'] ? $v['root'] . $root : substr($root, 1);
             $dm = new PwDomainDm();
             $dm->setRoot($domain_root)->setDomainType($k);
             $r = $this->_ds()->updateByDomainType($dm);
             if ($r instanceof PwError) {
                 $this->showError($r->getError());
             }
         } elseif ($k != 'forum') {
             $this->_ds()->deleteByDomainType($k);
         }
         $siteBo->set("domain.{$k}.isopen", $v['isopen']);
         $bo->set("{$k}.isopen", $v['isopen'])->set("{$k}.root", $domain_root);
     }
     $bo->set('domain.hold', $domain_hold);
     $bo->flush();
     $siteBo->set('domain.space.root', $space_root);
     $siteBo->flush();
     $this->_service()->flushAll();
     Wekit::load('SRV:nav.srv.PwNavService')->updateConfig();
     $this->showMessage('success');
 }
Exemple #11
0
 public function dothemeAction()
 {
     $showpeers = $this->getInput('showpeers', 'post');
     $config = new PwConfigSet('site');
     $config->set('app.torrent.theme.showpeers', $showpeers);
     $config->flush();
     $this->showMessage('ADMIN:success');
 }