public function getModelList() { $modelList = array(); $list = WindFolder::read(Wind::getRealDir('SRV:design.srv.model'), WindFolder::READ_DIR); $_configParser = Wind::getComponent('configParser'); foreach ($list as $model) { $configPath = Wind::getRealPath('SRV:design.srv.model.' . $model . '.config'); if (!is_file($configPath)) { continue; } $config = $_configParser->parse($configPath); if (!isset($config['model'])) { continue; } $modelList[$config['model']] = array('name' => $config['name'], 'type' => $config['type']); } return $modelList; }
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; }
/** * @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; }
/** * 查找未安装的风格 * * @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; }
/** * 获取水印文件列表 * * @return array */ protected static function getWaterMarkList() { $_path = Wind::getRealDir('REP:mark.'); return WindFolder::read($_path); }
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); }
/** * 对模块进行删除 * 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"); }
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'); } }
/** * 编辑版块信息 * * @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'); }
/** * 获取字体列表 * * @return array */ protected static function getFontList() { $_path = Wind::getRealDir(self::$path . '.font'); return WindFolder::read($_path, WindFolder::READ_FILE); }
private function _getCronFileList() { $dir = Wind::getRealPath(trim('SRV:cron.srv.do.'), false); $fileList = WindFolder::read($dir); foreach ((array) $fileList as $k => $file) { if (Pw::substrs($file, 8, 0, false) != 'PwCronDo') { unset($fileList[$k]); } } return $fileList; }
/** * 读取目录 * * @return multitype:string */ private function _read() { $ext = Wind::getRealDir('EXT:', true); $dirs = WindFolder::read($ext, WindFolder::READ_DIR); $manifests = array(); $result = array_keys($this->_appDs()->fetchByAlias($dirs, 'alias')); /* * $to_install = array_diff($dirs, $result); foreach ($to_install as * $pack) { if ($pack[0] == '.') continue; $this->_toinstall($ext . * DIRECTORY_SEPARATOR . $pack); } */ foreach ($result as $k) { $manifest = $ext . DIRECTORY_SEPARATOR . $k . DIRECTORY_SEPARATOR . 'Manifest.xml'; if (!is_file($manifest)) { continue; } $manifests[$k] = $manifest; } return $manifests; }
/** * 导入数据表 * * @return void */ public function importAction() { list($file, $dir) = $this->getInput(array('file', 'dir')); list($step, $count, $isdir) = $this->getInput(array('step', 'count', 'isdir')); !$dir && $this->showError('BACKUP:name.empty'); $siteState = Wekit::C('site', 'visit.state'); if ($siteState != 2) { $this->showError('BACKUP:site.isopen'); } if (!$count) { $count = 1; $files = WindFolder::read(WindSecurity::escapePath($this->_bakupDir . $dir)); foreach ($files as $v) { if (preg_match("/^{$dir}\\_\\d+\\.(sql|zip)\$/i", $v)) { $count++; } } } !$step && ($step = 1); !$isdir ? $this->_getBackupService()->bakinSql($this->_bakupDir . $dir . '/' . $file) : $this->_getBackupService()->backinData($dir, $step); $i = $step; $step++; if ($count > 1 && $step <= $count) { $referer = 'admin/backup/backup/import?' . "step={$step}&file={$file}&dir={$dir}&isdir={$isdir}&count={$count}"; $this->showMessage(array('BACKUP:bakup_import', array('{i}' => $i)), $referer, true); } $this->showMessage('success', 'admin/backup/backup/restore'); }
public static function readRecursive($dir) { static $files = array(); $objects = WindFolder::read($dir); foreach ($objects as $v) { if ($v[0] == '.') { continue; } $object = $dir . '/' . $v; if (is_dir($object)) { self::readRecursive($dir . '/' . $v); } else { $files[] = $object; } } return $files; }
/** * 读取表情列表 * * @param stting $folder */ public function getFolderIconList($folder) { $folder = $this->getEmotionPath() . '/' . $folder; return WindFolder::read($folder, WindFolder::READ_FILE); }