Example #1
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();
 }
Example #2
0
 public function postHandle()
 {
     $this->runDesign();
     $this->updateOnline();
     $this->setOutput($this->runCron(), 'runCron');
     //门户管理模式 编译目录切换
     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
     Wekit::setGlobal(NEXT_VERSION . ' ' . NEXT_RELEASE, 'version');
     $seo = Wekit::V('seo');
     Wekit::setGlobal($seo ? $seo->getData() : array('title' => Wekit::C('site', 'info.name')), '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_');
 }
Example #3
0
 protected function postUpload($tmp_name, $filename)
 {
     if (strpos($filename, '..') !== false || strpos($filename, '.php.') !== false || preg_match('/\\.php$/', $filename)) {
         exit('illegal file type!');
     }
     WindFolder::mkRecur(dirname($filename));
     if (function_exists("move_uploaded_file") && @move_uploaded_file($tmp_name, $filename)) {
         @unlink($tmp_name);
         @chmod($filename, 0777);
         return filesize($filename);
     } elseif (@copy($tmp_name, $filename)) {
         @unlink($tmp_name);
         @chmod($filename, 0777);
         return filesize($filename);
     } elseif (is_readable($tmp_name)) {
         Wind::import('WIND:utility.WindFile');
         WindFile::write($filename, WindFile::read($tmp_name));
         @unlink($tmp_name);
         if (file_exists($filename)) {
             @chmod($filename, 0777);
             return filesize($filename);
         }
     }
     return false;
 }
Example #4
0
 public function clearFolder($moduleid)
 {
     if (!$moduleid) {
         return false;
     }
     $dir = $this->getSaveDir($moduleid);
     $store = Wind::getComponent('storage');
     //单独使用
     if (!$this->store instanceof PwStorageLocal) {
         $store->delete($dir, 0);
     } else {
         $dir = Wind::getRealDir('PUBLIC:') . PUBLIC_ATTACH . '/' . $dir;
     }
     WindFolder::rm($dir, true);
     return true;
 }
Example #5
0
 /**
  * 编译模板并返回编译后模板地址及内容
  * <pre>
  * <i>$output==true</i>返回编译文件绝对路径地址和内容,不生成编译文件;
  * <i>$output==false</i>返回编译文件绝对路径地址和内容,生成编译文件
  * </pre>
  * 
  * @param string $template 模板名称 必填
  * @param string $suffix 模板后缀 默认为空
  * @param boolean $readOnly 是否直接输出模板内容,接受两个值true,false 默认值为false
  * @param boolean $forceOutput 是否强制返回模板内容,默认为不强制
  * @return array(compileFile,content) <pre>
  *         <i>compileFile</i>模板编译文件绝对地址,
  *         <i>content</i>编译后模板输出内容,当<i>$output</i>
  *         为false时将content写入compileFile</pre>
  */
 public function compile($template, $suffix = '', $readOnly = false, $forceOutput = false)
 {
     list($templateFile, $compileFile, $this->currentThemeKey) = $this->windView->getViewTemplate($template, $suffix);
     if (!is_file($templateFile)) {
         throw new WindViewException('[viewer.resolver.WindViewerResolver.compile] ' . $templateFile, WindViewException::VIEW_NOT_EXIST);
     }
     if (!$this->checkReCompile($templateFile, $compileFile)) {
         return array($compileFile, $forceOutput || $readOnly ? WindFile::read($compileFile) : '');
     }
     /* @var $_windTemplate WindViewTemplate */
     $_windTemplate = Wind::getComponent('template');
     $_output = $_windTemplate->compile($templateFile, $this);
     if (false === $readOnly) {
         WindFolder::mkRecur(dirname($compileFile));
         WindFile::write($compileFile, $_output);
     }
     return array($compileFile, $_output);
 }
Example #6
0
 public function getNavType()
 {
     $navType = array();
     $dir = Wind::getRealDir('SRV:nav.srv.navtype.');
     $list = WindFolder::read($dir, WindFolder::READ_FILE);
     foreach ($list as $v) {
         $v = $dir . $v;
         if (!is_file($v)) {
             continue;
         }
         $types = @(include $v);
         foreach ($types as $type) {
             if (!isset($type['type'])) {
                 continue;
             }
             $navType[$type['type']] = $type['name'];
         }
     }
     return $navType;
 }
 public function moveUploadedFile($tmp_name, $filename)
 {
     if (strpos($filename, '..') !== false || strpos($filename, '.php.') !== false || preg_match('/\\.php$/i', $filename)) {
         return false;
     }
     WindFolder::mkRecur(dirname($filename));
     if (function_exists("move_uploaded_file") && @move_uploaded_file($tmp_name, $filename)) {
         @chmod($filename, 0777);
         return true;
     } elseif (@copy($tmp_name, $filename)) {
         @chmod($filename, 0777);
         return true;
     } elseif (is_readable($tmp_name)) {
         file_put_contents($filename, file_get_contents($tmp_name));
         if (file_exists($filename)) {
             @chmod($filename, 0777);
             return true;
         }
     }
     return false;
 }
Example #8
0
 public function doCompile()
 {
     $JS_DEV_PATH = Wind::getRealDir('PUBLIC:res.js.dev');
     $JS_BUILD_PATH = Wind::getRealDir('PUBLIC:res.js.build');
     Wind::import('Wind:utility.WindFolder');
     $files = $this->_getFiles($JS_DEV_PATH);
     foreach ($files as $file) {
         $newfile = $JS_BUILD_PATH . substr($file, strlen($JS_DEV_PATH));
         WindFolder::mkRecur(dirname($newfile));
         if (substr($file, -3) != '.js') {
             if (!copy($file, $newfile)) {
                 return new PwError('copy failed');
             }
             continue;
         }
         $content = WindFile::read($file);
         $compress = jscompress::pack($content);
         if (!WindFile::write($newfile, $compress)) {
             return new PwError('write failed');
         }
     }
 }
Example #9
0
 /**
  * @param string $stylePackage
  * @param booelan $isManifestChanged
  * @return boolean
  */
 private function _doCss($stylePackage)
 {
     $file = $stylePackage . '/' . $this->manifest;
     $dir = $stylePackage . '/' . $this->cssDevDir;
     $_dir = $stylePackage . '/' . $this->cssDir;
     WindFolder::mkRecur($_dir);
     $files = WindFolder::read($dir, WindFolder::READ_FILE);
     foreach ($files as $v) {
         if (WindFile::getSuffix($v) === 'css') {
             $dev_css = $dir . '/' . $v;
             //待编译文件
             $css = $_dir . '/' . $v;
             //编译后文件
             $data = WindFile::read($dir . '/' . $v);
             $_data = $this->_compress($data);
             if (WindFile::write($css, $_data) === false) {
                 return new PwError('STYLE:style.css.write.fail');
             }
         }
     }
     return true;
 }
Example #10
0
 public function moduleAction()
 {
     $moduleId = (int) $this->getInput('moduleid', 'post');
     Wind::import('SRV:design.bo.PwDesignModuleBo');
     $bo = new PwDesignModuleBo($moduleId);
     $module = $bo->getModule();
     if ($module['isused']) {
         $this->setTemplate('');
     }
     $bo->setStdId();
     $key = Wekit::load('design.srv.display.PwDesignDisplay')->bindDataKey($moduleId);
     $data[$key] = $bo->getData(true, false);
     $this->setOutput($data, '__design_data');
     list($theme, ) = $this->getForward()->getWindView()->getTheme();
     if (is_array($theme)) {
         list($theme, $pack) = $theme;
     }
     if (!$theme) {
         $theme = 'default';
     }
     WindFolder::rm(Wind::getRealDir('DATA:compile.template.' . $theme . '.design.segment.'), true);
     $this->setTemplate('TPL:design.segment.module');
 }
Example #11
0
 /**
  * 查找未安装的风格
  *
  * @return array 未安装的风格名
  */
 public function getUnInstalledThemes()
 {
     $config = Wekit::load('APPCENTER:service.srv.PwInstallApplication')->getConfig('style-type');
     $themes = array();
     foreach ($config as $k => $v) {
         $dir = Wind::getRealDir('THEMES:' . $v[1]);
         $files = WindFolder::read($dir, WindFolder::READ_DIR);
         foreach ($files as $file) {
             if (WindFile::isFile($dir . '/' . $file . '/' . $this->manifest)) {
                 $themes[$k][] = $file;
             }
         }
     }
     if (empty($themes)) {
         return array();
     }
     $styles = array();
     foreach ($themes as $k => $v) {
         $r = $this->_styleDs()->fetchStyleByAliasAndType($v, $k, 'alias');
         $r = array_diff($v, array_keys($r));
         $r && ($styles[$k] = $r);
     }
     return $styles;
 }
Example #12
0
 /**
  * 返回模板的编译文件绝对路径地址
  * 
  * 根据模板的逻辑名称,返回模板的绝对路径信息,支持命名空间方式定义模板信息.<code>
  * $template='templateName'; //return $compileDir/templateName.$ext
  * $template='subTemplateDir.templateName'; //return $compileDir/subTemplateDir_templateName.$ext
  * $template='namespace:templateName'; //return $compileDir/__external_subDir_templateName.$ext</code>
  * <note><b>注意:</b>$template为空则返回当前的模板的路径信息.</note>
  * @param string $template 模板名称, 默认值为空, 为空则返回当前模板的编译文件
  * @return string
  */
 public function getCompileFile($template = '')
 {
     if (!$this->compileDir) {
         return;
     }
     if ($this->compileDir == $this->templateDir) {
         throw new WindViewException('[wind.viewer.WindView.getCompileFile] the same directory compile and template.');
     }
     if (!$template) {
         $template = $this->templateName;
     }
     if (false !== ($pos = strpos($template, ':'))) {
         $template = str_replace('.', '_', '__external.' . substr($template, $pos + 1));
     }
     if (!empty($this->theme['theme']) && !empty($this->theme['package'])) {
         $template = $this->compileDir . '.' . $this->theme['theme'] . '.' . $template;
     } else {
         $template = $this->compileDir . '.' . $template;
     }
     $dir = Wind::getRealPath($template, false, true);
     WindFolder::mkRecur(dirname($dir));
     return $this->compileExt ? $dir . '.' . $this->compileExt : $dir;
 }
Example #13
0
 public function generate()
 {
     $addons = Wekit::load('APPS:appcenter.service.srv.PwInstallApplication')->getConfig('style-type');
     $base = str_replace('/', '.', $addons[$this->style_type][1]);
     $this->defaultDir = Wind::getRealDir('THEMES:' . $base . '.default');
     if (!is_dir($this->defaultDir)) {
         return new PwError('APPCENTER:generate.style.unsupport');
     }
     $this->baseDir = Wind::getRealDir('THEMES:' . $base . '.' . $this->alias);
     if (is_dir($this->baseDir)) {
         return new PwError('APPCENTER:alias.exist');
     }
     WindFolder::mkRecur($this->baseDir);
     Wind::import('APPS:appcenter.service.srv.helper.PwSystemHelper');
     $writable = PwSystemHelper::checkWriteAble($this->baseDir . '/');
     if (!$writable) {
         return new PwError('APPCENTER:generate.copy.fail');
     }
     PwApplicationHelper::copyRecursive($this->defaultDir, $this->baseDir);
     $file = $this->baseDir . '/Manifest.xml';
     Wind::import('WIND:parser.WindXmlParser');
     $parser = new WindXmlParser();
     $manifest = $parser->parse($file);
     $manifest['application']['name'] = $this->name;
     $manifest['application']['alias'] = $this->alias;
     $manifest['application']['description'] = $this->description;
     $manifest['application']['version'] = $this->version;
     $manifest['application']['pw-version'] = $this->pwversion;
     $manifest['application']['website'] = $this->website;
     $manifest['application']['author-name'] = $this->author;
     $manifest['application']['author-email'] = $this->email;
     $parser = new WindXmlParser();
     $manifest = str_replace('><', ">\n\t<", $parser->parseToXml(array('manifest' => $manifest), Wind::getApp()->getResponse()->getCharset()));
     WindFile::write($this->baseDir . '/Manifest.xml', $manifest);
     return 'THEMES:' . $base . '.' . $this->alias;
 }
Example #14
0
 private function _getPhps()
 {
     $files = WindFolder::read(PUBLIC_PATH, WindFolder::READ_FILE);
     $temp = array();
     foreach ($files as $file) {
         if (is_file(PUBLIC_PATH . $file) && '.php' === substr($file, -4) && !strncasecmp($file, 'update_', 7)) {
             $temp[substr($file, 7, 8)] = $file;
         }
     }
     ksort($temp);
     return array_values($temp);
 }
Example #15
0
 /**
  * 对模块进行删除
  * PS:不是真正的删除,记录为isused = 0状态
  */
 public function deleteAction()
 {
     $moduleid = (int) $this->getInput('moduleid', 'post');
     $module = $this->_getModuleDs()->getModule($moduleid);
     if (!$module || $module['page_id'] < 1) {
         $this->showError('operate.fail');
     }
     Wekit::load('design.PwDesignPermissions');
     $permissions = $this->_getPermissionsService()->getPermissionsForModule($this->loginUser->uid, $moduleid);
     if ($permissions < PwDesignPermissions::IS_DESIGN) {
         $this->showError("DESIGN:permissions.fail");
     }
     Wind::import('SRV:design.bo.PwDesignPageBo');
     $pageBo = new PwDesignPageBo($module['page_id']);
     if ($pageBo->getLock()) {
         $this->showError('DESIGN:page.edit.other.user');
     }
     Wind::import('SRV:design.dm.PwDesignModuleDm');
     $dm = new PwDesignModuleDm($moduleid);
     $dm->setIsused(0);
     $resource = $this->_getModuleDs()->updateModule($dm);
     if ($resource instanceof PwError) {
         $this->showError($resource->getError());
     }
     //if (!$this->_getModuleDs()->deleteModule($moduleid)) $this->showMessage("operate.fail");
     $this->_getDataDs()->deleteByModuleId($moduleid);
     Wekit::load('design.PwDesignPush')->deleteByModuleId($moduleid);
     //删除导入数据的模版内容
     $dir = Wind::getRealDir('THEMES:portal.local.');
     $path = $dir . $pageBo->getTplPath() . '/template/';
     $files = WindFolder::read($path, WindFolder::READ_FILE);
     foreach ($files as $file) {
         $filePath = $path . $file;
         $content = WindFile::read($filePath);
         if (!$content) {
             continue;
         }
         $tmp = preg_replace('/\\<pw-list\\s*id=\\"' . $moduleid . '\\"\\s*>(.+)<\\/pw-list>/isU', '', $content);
         if ($tmp != $content) {
             WindFile::write($filePath, $tmp);
         }
     }
     $this->showMessage("operate.success");
 }
 /**
  * 设置缓存目录
  * 
  * @param string $dir 缓存目录,必须是<b>可写可读</b>权限
  */
 public function setCacheDir($dir)
 {
     $_dir = Wind::getRealPath($dir, false, true);
     WindFolder::mkRecur($_dir);
     $this->cacheDir = realpath($_dir);
 }
Example #17
0
 public static function log($msg, $version, $start = false)
 {
     static $log;
     if (!$log) {
         $log = Wind::getRealDir('DATA:upgrade.log', true) . '/' . $version . '.log';
         WindFolder::mkRecur(dirname($log));
     }
     $status = $start ? WindFile::READWRITE : WindFile::APPEND_WRITEREAD;
     WindFile::write($log, "\r\n" . date('Y-m-d H:i') . '   ' . $msg, $status);
 }
Example #18
0
 /**
  * 备份
  */
 public function backUp($fileList)
 {
     $root = Wind::getRealDir('ROOT:', true);
     $dest = Wind::getRealDir('DATA:backup', true) . DIRECTORY_SEPARATOR . $this->local;
     foreach ($fileList as $v => $hash) {
         if (is_file($root . DIRECTORY_SEPARATOR . $v)) {
             WindFolder::mkRecur(dirname($dest . DIRECTORY_SEPARATOR . $v));
             $r = @copy($root . DIRECTORY_SEPARATOR . $v, $dest . DIRECTORY_SEPARATOR . $v);
             if (!$r) {
                 return new PwError('APPCENTER:upgrade.backup.fail');
             }
         }
     }
     $this->_log('back up file');
     return true;
 }
Example #19
0
 protected function writeFile($fileData)
 {
     $failArray = array();
     $dir = $this->tplPath;
     WindFolder::rm($dir, true);
     WindFolder::mk($dir);
     foreach ($fileData as $file) {
         WindFolder::mkRecur($dir . '/' . dirname($file['filename']));
         if (!WindFile::write($dir . '/' . $file['filename'], $file['data'])) {
             $failArray[] = $file['filename'];
         }
     }
     return $failArray;
 }
Example #20
0
 /**
  * 编译模板片段,并将模板片段放在name缓存文件中
  * 模板文件中允许存在如下三种形式:
  * <pre>
  * 1、第一种:
  * <hook-action name="hook1" args='a,b,c'>
  * <div>i am from hook1 {$a} |{$b}|{$c}</div>
  * </hook-action>
  * 如上将会被编译成:
  * function templateName_hook1($a, $b, $c){
  * }
  * 2、第二种:
  * <hook-action name="hook2">
  * <div> i am from hook2 {$data} </div>
  * </hook-action>
  * 如上将会编译成:
  * function templateName_hook2($data){
  * }
  * 3、第三种:
  * <div> i am from segment {$data}</div>
  * 如上将会被编译成:
  * function templateName($data) {
  * }
  * 
  * 模板标签:
  * <segment alias='' name='' args='' tpl='' />
  * tpl文件中的模板内容按照如上三种规则被编译之后,将会保存到__segment_alias文件中
  * 调用方法根据:
  * tpl_name来调用,如果func没有写,则调用方法为tpl,否则为tpl_func,传入参数为args
  * </pre>
  *
  * @param string $template
  * @param array $args
  * @param string $func
  * @param string $alias
  * @param WindViewResolve $viewer
  * @return 
  */
 public static function segment($template, $args, $func = '', $alias = '', $viewer = null)
 {
     if ($viewer instanceof WindViewerResolver) {
         self::$viewer = $viewer;
     }
     $_prefix = str_replace(array(':', "."), '_', $template);
     $alias = '__segment_' . strtolower($alias ? $alias : $_prefix);
     list($templateFile, $cacheCompileFile) = self::$viewer->getWindView()->getViewTemplate($template);
     $pathinfo = pathinfo($cacheCompileFile);
     $cacheCompileFile = $pathinfo['dirname'] . '/' . $alias . '.' . $pathinfo['extension'];
     $_method = strtoupper($func ? $_prefix . '_' . $func : $_prefix);
     if (WIND_DEBUG) {
         WindFolder::mkRecur(dirname($cacheCompileFile));
         WindFile::write($cacheCompileFile, '', WindFile::READWRITE);
     } else {
         if (!function_exists($_method) && is_file($cacheCompileFile)) {
             include $cacheCompileFile;
         }
         if (function_exists($_method)) {
             call_user_func_array($_method, $args);
             return;
         }
     }
     if (!($content = self::_resolveTemplate($templateFile, strtoupper($_prefix)))) {
         return;
     }
     $_content = array();
     foreach ($content as $method => $_item) {
         $_tmpArgs = '';
         foreach ($_item[1] as $_k) {
             $_tmpArgs .= '$' . trim($_k) . ',';
         }
         $windTemplate = Wind::getComponent('template');
         $_content[] = '<?php if (!function_exists("' . $method . '")) {function ' . $method . '(' . trim($_tmpArgs, ',') . '){?>';
         $_content[] = $windTemplate->compileStream($_item[0], self::$viewer);
         $_content[] = '<?php }}?>';
     }
     WindFolder::mkRecur(dirname($cacheCompileFile));
     WindFile::write($cacheCompileFile, implode("\r\n", $_content), WindFile::APPEND_WRITE);
     include $cacheCompileFile;
     call_user_func_array($_method, $args);
 }
 /**
  * 编辑版块信息
  * 
  * @return void
  */
 public function editAction()
 {
     $fid = $this->getInput('fid');
     Wind::import('SRV:forum.bo.PwForumBo');
     $forum = new PwForumBo($fid, true);
     if (!$forum->isForum(true)) {
         $this->showMessage('版块不存在', 'bbs/setforum/run', true);
     }
     $topicTypeService = Wekit::load('forum.PwTopicType');
     /* @var $topicTypeService PwTopicType */
     $topicTypes = $topicTypeService->getTopicTypesByFid($fid);
     $this->setOutput($topicTypes, 'topicTypes');
     //权限相关
     $userGroupService = Wekit::load('usergroup.PwUserGroups');
     /* @var $userGroupService PwUserGroups */
     $userGroups = $userGroupService->getClassifiedGroups();
     $groupTypes = $userGroupService->getTypeNames();
     $this->setOutput($userGroups, 'userGroups');
     $this->setOutput($groupTypes, 'groupTypes');
     //seo
     $seo = Wekit::load('seo.PwSeo')->getByModAndPageAndParam('bbs', 'thread', $fid);
     $this->setOutput($seo, 'seo');
     //版块域名
     $forumroot = Wekit::C('domain', 'forum.root');
     if ($forumroot) {
         $this->setOutput($forumroot, 'forumroot');
     }
     $domainKey = $forum->foruminfo['type'] == 'category' ? "bbs/cate/run?fid={$fid}" : "bbs/thread/run?fid={$fid}";
     $result = Wekit::load('domain.PwDomain')->getByDomainKey($domainKey);
     $forumdomain = isset($result['domain']) ? $result['domain'] : '';
     $this->setOutput($forumdomain, 'forumdomain');
     //版块风格
     $styles = Wekit::load('APPCENTER:service.PwStyle')->getStyleListByType('forum', 0);
     $this->setOutput($styles, 'styles');
     $p = array();
     foreach (array('allow_visit', 'allow_read', 'allow_post', 'allow_reply', 'allow_upload', 'allow_download') as $value) {
         $p[$value] = $forum->foruminfo[$value] ? explode(',', $forum->foruminfo[$value]) : array();
     }
     $creditset = $forum->foruminfo['settings_credit'] ? unserialize($forum->foruminfo['settings_credit']) : array();
     $password = $forum->foruminfo['password'] ? '******' : '';
     $_path = Wind::getRealDir('REP:mark.');
     $waterlist = WindFolder::read($_path);
     //forum list
     $this->setOutput($this->_getFroumService()->getForumOption(), 'forumList');
     Wind::import('SRV:credit.bo.PwCreditBo');
     $this->setOutput(PwCreditBo::getInstance()->cType, 'credittype');
     $this->setOutput(Wekit::load('forum.srv.PwThreadType')->getTtype(), 'threadtype');
     $this->setOutput($p, 'p');
     $this->setOutput($fid, 'fid');
     $this->setOutput($forum->foruminfo, 'foruminfo');
     $this->setOutput($forum->forumset, 'forumset');
     $this->setOutput($creditset, 'creditset');
     $this->setOutput($password, 'password');
     $this->setOutput($this->_getFroumService()->getForumOption($forum->foruminfo['parentid']), 'option_html');
     $this->setOutput($forum->foruminfo['type'] == 'category', 'isCate');
     $this->setOutput($waterlist, 'waterlist');
 }
Example #22
0
 public function clear()
 {
     if ($this->ftp) {
         $this->ftp->close();
     }
     WindFolder::clearRecur($this->tmpPath, true);
     Wekit::cache()->delete('system_patch_ftp');
 }
 /**
  * 复制目录
  *
  * @param string $fromFolder
  * @param string $toFolder
  * @return boolean
  */
 protected function copyRecur($fromFolder, $toFolder)
 {
     $dir = @opendir($fromFolder);
     if (!$dir) {
         return false;
     }
     WindFolder::mk($toFolder);
     while (false !== ($file = readdir($dir))) {
         if ($file != '.' && $file != '..') {
             if (is_dir($fromFolder . '/' . $file)) {
                 $this->copyRecur($fromFolder . '/' . $file, $toFolder . '/' . $file);
             } else {
                 @copy($fromFolder . '/' . $file, $toFolder . '/' . $file);
                 @chmod($toFolder . '/' . $file, 0777);
             }
         }
     }
     @closedir($dir);
     return true;
 }
Example #24
0
 /**
  * 获取字体列表
  *
  * @return array
  */
 protected static function getFontList()
 {
     $_path = Wind::getRealDir(self::$path . '.font');
     return WindFolder::read($_path, WindFolder::READ_FILE);
 }
Example #25
0
 public function scanAction()
 {
     $ext = Wind::getRealDir('EXT:', true);
     $dirs = WindFolder::read($ext, WindFolder::READ_DIR);
     $alias = array();
     foreach ($dirs as $file) {
         if (WindFile::isFile($ext . '/' . $file . '/Manifest.xml')) {
             $alias[] = $file;
         }
     }
     $result = $this->_appDs()->fetchByAlias($alias, 'alias');
     $to_install = array_diff($alias, array_keys($result));
     if (!$to_install) {
         $this->showMessage('success');
     }
 }
Example #26
0
 /**
  * 清除tpl缓存
  *
  * @return boolean
  */
 public function refreshTplCache()
 {
     WindFolder::rm(Wind::getRealDir('DATA:compile'), true);
     WindFolder::rm(Wind::getRealDir('DATA:design.template'), true);
     return true;
 }
Example #27
0
 /**
  * 更新缓存
  * 
  * @return boolean
  */
 public function updateCache()
 {
     $data = $this->_getWindidAreaDs()->fetchAll();
     $file = Wind::getRealPath('DATA:area.area.php', true);
     WindFolder::mk(dirname($file));
     WindFile::savePhpData($file, $data, true);
     return $data;
 }
Example #28
0
 /**
  * 清理安装过程中产生的临时信息
  *
  * step 5
  * 
  * @return void
  */
 public function clear()
 {
     list(, , $install) = $this->resolvedInstallation($this->tmpInstallLog);
     if (is_file($this->tmpInstallLog)) {
         WindFile::del($this->tmpInstallLog);
     }
     if ($install->getTmpPackage()) {
         WindFolder::rm($install->getTmpPackage(), true);
     }
     if ($install->getTmpPath()) {
         WindFolder::rm($install->getTmpPath(), true);
     }
 }
 /**
  * 获取水印文件列表
  *
  * @return array
  */
 protected static function getWaterMarkList()
 {
     $_path = Wind::getRealDir('REP:mark.');
     return WindFolder::read($_path);
 }
Example #30
0
 /**
  * 设置日志保存的路径
  * 
  * @param string $logFile 日志保存的路径
  * @return void
  */
 public function setLogDir($logDir)
 {
     $this->_logDir = Wind::getRealDir($logDir);
     WindFolder::mkRecur($this->_logDir);
 }