public function __construct() { $this->logfile = Wind::getRealPath(Wekit::app()->logFile, true); if (!WindFile::isFile($this->logfile)) { WindFile::write($this->logfile, "<?php die;?>\n"); } }
public function doCompile() { $config = Wekit::load('APPCENTER:service.srv.PwInstallApplication')->getConfig('style-type'); foreach ($config as $k => $v) { $dir = Wind::getRealDir('THEMES:' . $v[1]); $files = WindFolder::read($dir, WindFolder::READ_DIR); foreach ($files as $v) { $manifest = $dir . '/' . $v . '/' . $this->manifest; if (!WindFile::isFile($manifest)) { continue; } if (($r = $this->_doCss($dir . '/' . $v)) instanceof PwError) { return $r; } } } }
/** * 查找未安装的风格 * * @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; }
protected function getCacheArea() { $file = Wind::getRealPath('DATA:area.area.php', true); if (WindFile::isFile($file)) { return include $file; } return $this->updateCache(); }
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'); } }
public function doimportAction() { Wind::import('SRV:upload.action.PwWordUpload'); Wind::import('LIB:upload.PwUpload'); $bhv = new PwWordUpload(); $upload = new PwUpload($bhv); if (($result = $upload->check()) === true) { $result = $upload->execute(); } if ($result !== true) { $error = $result->getError(); if (is_array($error)) { list($error, ) = $error; if ($error == 'upload.ext.error') { $this->showError('WORD:ext.error'); } } $this->showError($result->getError()); } $source = $bhv->getAbsoluteFile(); if (!WindFile::isFile($source)) { $this->showError('operate.fail'); } $content = WindFile::read($source); pw::deleteAttach($bhv->dir . $bhv->filename, 0, $bhv->isLocal); $content = explode("\n", $content); if (!$content) { $this->showError('WORD:import.data.empty'); } $wordService = $this->_getWordService(); $typeMap = $this->_getWordDS()->getTypeMap(); Wind::import('SRV:word.dm.PwWordDm'); foreach ($content as $value) { list($word, $type, $replace) = $this->_parseTextUseInImport($value, $typeMap); if (!$word || !$type || $wordService->isExistWord($word)) { continue; } $dm = new PwWordDm(); /* @var $dm PwWordDm */ $dm->setWord($word)->setWordType($type); $replace = $this->_getWordDS()->isReplaceWord($type) ? $replace ? $replace : '****' : ''; $dm->setWordReplace($replace); $this->_getWordDS()->add($dm); } $this->_getWordFilter()->updateCache(); $this->showMessage('success'); }
/** * 递归的删除目录 * * @param string $dir 目录 * @param Boolean $delFolder 是否删除目录 */ public static function clearRecur($dir, $delFolder = false) { if (!self::isDir($dir)) { return false; } if (!($handle = @opendir($dir))) { return false; } while (false !== ($file = readdir($handle))) { if ('.' === $file || '..' === $file) { continue; } $_path = $dir . '/' . $file; if (self::isDir($_path)) { self::clearRecur($_path, $delFolder); } elseif (WindFile::isFile($_path)) { WindFile::del($_path); } } $delFolder && @rmdir($dir); @closedir($handle); return true; }
/** * 修改主标题 * Enter description here ... * @param string $name * @param string $repace */ public function replaceTitle($name, $repace, $tpl = 'index') { if (!$tpl) { return false; } $file = $this->dir . $tpl . '.htm'; if (!WindFile::isFile($file)) { $file = $this->commonDir . $tpl . '.htm'; } $content = $this->read($file); if (preg_match_all('/\\<pw-title\\s*id=\\"(\\w+)\\"\\s*[>|\\/>](.+)<\\/pw-title>/isU', $content, $matches)) { foreach ($matches[1] as $k => $v) { if ($v != $name) { continue; } $_html = '<pw-title id="' . $name . '">' . $repace . '</pw-list>'; $content = str_replace($matches[0][$k], $_html, $content); } } $this->write($content, $file); }
/** * 检查目录 * * @return array */ private function _checkDatabase() { if (!WindFile::isFile($this->_getDatabaseFile()) || !WindFile::isFile($this->_getTableSqlFile())) { $this->showError('INSTALL:database_config_noexists'); } if (!$this->_checkWriteAble($this->_getDatabaseFile())) { $this->showError('INSTALL:error_777_database'); } if (!$this->_checkWriteAble($this->_getFounderFile())) { $this->showError('INSTALL:error_777_founder'); } /*if (!$this->_checkWriteAble($this->_getWindidFile())) { $this->showError('INSTALL:error_777_windid'); }*/ $database = (include $this->_getTempFile()); if (!$database['founder']) { $this->showError('INSTALL:database_config_error'); } return $database; }
private static function _outFlash() { if (!class_exists('SWFBitmap')) { return false; } self::_getCodeLenth(); self::_creatImage(); self::_setRandBackground(); self::_creatBackground(); //self::_setPicBackground(); self::_setRandFont(); self::_setRandGraph(); self::_writeImage(); self::_setRandDistortion(); $_tmpPath = Wind::getRealDir('DATA:tmp.'); $_tmp = $_tmpPath . WindUtility::generateRandStr(8) . '.png'; imagepng(self::$_image, $_tmp); if (!WindFile::isFile($_tmp)) { return false; } imagedestroy(self::$_image); $bit = new SWFBitmap($_tmp); $shape = new SWFShape(); $shape->setRightFill($shape->addFill($bit)); $shape->drawLine($bit->getWidth(), 0); $shape->drawLine(0, $bit->getHeight()); $shape->drawLine(-$bit->getWidth(), 0); $shape->drawLine(0, -$bit->getHeight()); $movie = new SWFMovie(); $movie->setDimension($bit->getWidth(), $bit->getHeight()); $flash = $movie->add($shape); header("Pragma:no-cache"); header("Cache-control:no-cache"); header('Content-type: application/x-shockwave-flash'); $movie->output(); WindFolder::clear($_tmpPath); }