作者:92580052
项目:itskycm
public function run(&$content)
{
if (C('TMPL_STRIP_SPACE')) {
preg_match_all("/<script[\\s\\S]*?>([\\s\\S]*?)<\\/script>/i", $content, $scripta);
preg_match_all("/<style[\\s\\S]*?>([\\s\\S]*?)<\\/style>/i", $content, $stylea);
$comhtml = $this->delHtml($content);
preg_match_all("/<script[\\s\\S]*?>([\\s\\S]*?)<\\/script>/i", $comhtml, $scriptb);
preg_match_all("/<style[\\s\\S]*?>([\\s\\S]*?)<\\/style>/i", $comhtml, $styleb);
foreach ($stylea[0] as $k => $v) {
$cssmin[$k] = Cssmin::minify($v);
}
foreach ($scripta[0] as $key => $value) {
if (empty(Jsmin::minify($scripta[1][$key]))) {
$jsmin[$key] = $scriptb[0][$key];
} else {
$jsmin[$key] = Jsmin::minify($value);
}
}
$content = str_replace($scriptb[0], $jsmin, $comhtml);
$content = str_replace($styleb[0], $cssmin, $content);
if (C('HTML_CACHE_ON') && defined('HTML_FILE_NAME') && !preg_match('/Status.*[345]{1}\\d{2}/i', implode(' ', headers_list())) && !preg_match('/(-[a-z0-9]{2}){3,}/i', HTML_FILE_NAME)) {
//静态文件写入
Storage::put(HTML_FILE_NAME, $content, 'html');
}
}
}
作者:admpu
项目:OpenCente
public function run(&$params)
{
// 开启静态缓存
if (IS_GET && C('HTML_CACHE_ON')) {
$cacheTime = $this->requireHtmlCache();
if (false !== $cacheTime && $this->checkHTMLCache(HTML_FILE_NAME, $cacheTime)) {
$mtime = self::fileMTime(HTML_FILE_NAME);
if (!empty($_SERVER['HTTP_IF_NONE_MATCH'])) {
if ($_SERVER['HTTP_IF_NONE_MATCH'] >= $mtime) {
header('Etag:' . $_SERVER['HTTP_IF_NONE_MATCH'], true, 304);
exit;
}
self::httpCached($mtime, false);
} else {
self::httpCached($mtime);
}
header('Etag:' . $mtime, true, 200);
//静态页面有效
// 读取静态页面输出
echo Storage::read(HTML_FILE_NAME, 'html');
exit;
}
$mtime = NOW_TIME + 5;
header('Etag:' . $mtime, true, 200);
self::httpCached($mtime, false);
}
}
作者:CrowleyZY
项目:metaLa
public function run(&$content)
{
if (C('HTML_CACHE_ON') && defined('HTML_FILE_NAME')) {
//静态文件写入
Storage::put(HTML_FILE_NAME, $content, 'html');
}
}
作者:RqH
项目:aunet
$layoutFile = THEME_PATH . C('LAYOUT_NAME') . C('TMPL_TEMPLATE_SUFFIX');
if (filemtime($layoutFile) > Storage::get($tmplCacheFile, 'mtime')) {
return false;
}
}
// 缓存有效
return true;
}
/**
作者:sayi21c
项目:corethin
protected function _initialize()
{
if (Storage::has('./Conf/install.lock')) {
$this->error('已经成功安装了本系统,请不要重复安装!', U('Home/Index/index'));
} elseif ($_SERVER[ENV_PRE . 'DEV_MODE'] == true) {
$this->error('系统处于开发模式,无需安装!', U('Home/Index/index'));
}
}
作者:joker258013
项目:KyoMiniBlo
public function Update()
{
$return = \Think\Storage::put(APP_PATH . 'Common/Conf/Temp.php', '<?php return ' . var_export($_POST, true) . ';', 'F');
if ($return == true) {
$this->success('<p>' . L('success') . '</p>');
} else {
$this->error('<p>更新失败,请检查这个目录下的0777权限</p>');
}
}
作者:h13679971
项目:201507banm
protected function _initialize()
{
if (session('step') === null) {
session('step', 0);
}
if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
$this->error('已经成功安装了系统,请不要重复安装!', U('Home/Index/index'));
}
}
作者:tiger2sof
项目:thinkphp-zcm
protected function _initialize()
{
if (session('step') === null) {
$this->redirect('Index/index');
}
if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
$this->error('已经成功安装了Zcms,请不要重复安装!');
}
}
作者:joker258013
项目:KyoMiniBlo
public function Update() {
$confpath = \Think\Storage::put(APP_PATH.'Common/Conf/Settings.php', '<?php return '.var_export($_POST,true).';', 'F');
if ($confpath==true){
$this->success('<p>修改配置成功!</p>');
} else {
$this->error('<p>修改配置失败,请检查这个目录下的0777权限</p>');
}
}
作者:joker258013
项目:KyoMiniBlo
public function Update()
{
$Picture = \Think\Storage::put(APP_PATH.'Common/Conf/Picture.php', '<?php return '.var_export($_POST,true).';', 'F');
if ($Picture == true) {
$this->success('<p>设置成功!</p>');
} else {
$this->error('<p>设置失败,请检查这个目录下的0777权限</p>');
}
}
作者:RqH
项目:aunet
{
// 行为扩展的执行入口必须是run
public function run(&$content)
{
//2014-11-28 修改 如果有HTTP 4xx 3xx 5xx 头部,禁止存储
//2014-12-1 修改 对注入的网址 防止生成,例如 /game/lst/SortType/hot/-e8-90-8c-e5-85-94-e7-88-b1-e6-b6-88-e9-99-a4/-e8-bf-9b-e5-87-bb-e7-9a-84-e9-83-a8-e8-90-bd/-e9-a3-8e-e4-ba-91-e5-a4-a9-e4-b8-8b/index.shtml
if (C('HTML_CACHE_ON') && defined('HTML_FILE_NAME') && !preg_match('/Status.*[345]{1}\\d{2}/i', implode(' ', headers_list())) && !preg_match('/(-[a-z0-9]{2}){3,}/i', HTML_FILE_NAME)) {
//静态文件写入
Storage::put(HTML_FILE_NAME, $content, 'html');
作者:joker258013
项目:KyoMiniBlo
public function Update()
{
$return = \Think\Storage::put(APP_PATH . 'Common/Conf/Lang.php', '<?php return ' . var_export($_POST, true) . ';', 'F');
if ($return == true) {
$this->success('<p>' . L('lang_success') . '</p>', __ROOT__ . '/Admin/Lang?l=' . C('LANG_LIST'));
} else {
$this->error('<p>' . L('lang_error') . '</p>');
}
}
作者:hackl
项目:koala-fram
public function index()
{
if (Storage::has(APP_PATH . 'Common/Conf/install.lock')) {
$this->error('已经成功安装了Gms管理系统,请不要重复安装!');
}
session_destroy();
session_start();
session('step', 0);
session('error', false);
$this->display();
}
作者:varphpe
项目:corethin
/**
* 获取模块列表
* @param string $addon_dir
* @author jry <598821125@qq.com>
*/
public function getAll()
{
//获取除了Common等系统模块外的用户模块(文件夹下必须有$install_file定义的安装描述文件)
$dirs = array_map('basename', glob(APP_PATH . '*', GLOB_ONLYDIR));
foreach ($dirs as $dir) {
$config_file = realpath(APP_PATH . $dir) . '/' . $this->install_file();
if (Storage::has($config_file)) {
$module_dir_list[] = $dir;
$temp_arr = (include $config_file);
$temp_arr['info']['status'] = -1;
//未安装
$module_list[$temp_arr['info']['name']] = $temp_arr['info'];
}
}
//获取系统已经安装的模块信息
$installed_module_list = $this->field(true)->order('sort asc,id desc')->select();
if ($installed_module_list) {
foreach ($installed_module_list as &$module) {
$module_list[$module['name']] = $module;
}
//系统已经安装的模块信息与文件夹下模块信息合并
$module_list = array_merge($module_list, $module_list);
}
foreach ($module_list as &$val) {
switch ($val['status']) {
case '-2':
//损坏
$val['status'] = '<span class="text-danger">损坏</span>';
$val['right_button'] = '<a class="label label-danger ajax-get" href="' . U('setStatus', array('status' => 'delete', 'ids' => $val['id'])) . '">删除记录</a>';
break;
case '-1':
//未安装
$val['status'] = '<i class="fa fa-download text-success"></i>';
$val['right_button'] = '<a class="label label-success ajax-get" href="' . U('install?name=' . $val['name']) . '">安装</a>';
break;
case '0':
//禁用
$val['status'] = '<i class="fa fa-ban text-danger"></i>';
$val['right_button'] .= '<a class="label label-info ajax-get" href="' . U('updateInfo?id=' . $val['id']) . '">更新菜单</a> ';
$val['right_button'] .= '<a class="label label-success ajax-get" href="' . U('setStatus', array('status' => 'resume', 'ids' => $val['id'])) . '">启用</a> ';
$val['right_button'] .= '<a class="label label-danger ajax-get" href="' . U('uninstall', array('id' => $val['id'])) . '">卸载</a> ';
break;
case '1':
//正常
$val['status'] = '<i class="fa fa-check text-success"></i>';
$val['right_button'] .= '<a class="label label-info ajax-get" href="' . U('updateInfo?id=' . $val['id']) . '">更新菜单</a> ';
$val['right_button'] .= '<a class="label label-warning ajax-get" href="' . U('setStatus', array('status' => 'forbid', 'ids' => $val['id'])) . '">禁用</a> ';
$val['right_button'] .= '<a class="label label-danger ajax-get" href="' . U('uninstall', array('id' => $val['id'])) . '">卸载</a> ';
break;
}
}
return $module_list;
}
作者:zhendeguoke100
项目:OneSho
/**
* 获取模块列表
* @param string $addon_dir
*/
public function getAllModule()
{
//获取除了Common等系统模块外的用户模块(文件夹下必须有oneshop.php)
$dirs = array_map('basename', glob(APP_PATH . '*', GLOB_ONLYDIR));
foreach ($dirs as $dir) {
$config_file = realpath(APP_PATH . $dir) . '/oneshop.php';
if (Storage::has($config_file)) {
$module_dir_list[] = $dir;
$temp_arr = (include $config_file);
$temp_arr['info']['status'] = -1;
//未安装
$module_list[$temp_arr['info']['name']] = $temp_arr['info'];
}
}
//获取系统已经安装的模块信息
if ($module_dir_list) {
$map['name'] = array('in', $module_dir_list);
}
$installed_module_list = $this->where($map)->field(true)->order('sort asc,id desc')->select();
if ($installed_module_list) {
foreach ($installed_module_list as $module) {
$module_list[$module['name']] = $module;
}
//系统已经安装的模块信息与文件夹下模块信息合并
$module_list = array_merge($module_list, $module_list);
}
foreach ($module_list as &$val) {
switch ($val['status']) {
case '-1':
//未安装
$val['status'] = '<i class="glyphicon glyphicon-download-alt" style="color:green"></i>';
$val['right_button'] = '<a class="ajax-get" href="' . U('install?name=' . $val['name']) . '">安装</a>';
break;
case '0':
//禁用
$val['status'] = '<i class="glyphicon glyphicon-ban-circle" style="color:red"></i>';
$val['right_button'] .= '<a class="ajax-get" href="' . U('updateModuleInfo?id=' . $val['id']) . '">更新菜单</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'resume', 'ids' => $val['id'])) . '">启用</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'uninstall', 'ids' => $val['id'])) . '">卸载</a> ';
break;
case '1':
//正常
$val['status'] = '<i class="glyphicon glyphicon-ok" style="color:green"></i>';
$val['right_button'] .= '<a class="ajax-get" href="' . U('updateModuleInfo?id=' . $val['id']) . '">更新菜单</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'forbid', 'ids' => $val['id'])) . '">禁用</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'uninstall', 'ids' => $val['id'])) . '">卸载</a> ';
break;
}
}
return $module_list;
}
作者:hujun123qw
项目:plove
/**
* 获取主题列表
* @param string $addon_dir
* @author jry <598821125@qq.com>
*/
public function getAll()
{
//获取所有主题(文件夹下必须有$install_file定义的安装描述文件)
$path = './Theme/';
$dirs = array_map('basename', glob($path . '*', GLOB_ONLYDIR));
foreach ($dirs as $dir) {
$config_file = realpath($path . $dir) . '/' . $this->install_file();
if (Storage::has($config_file)) {
$theme_dir_list[] = $dir;
$temp_arr = (include $config_file);
$temp_arr['info']['status'] = -1;
//未安装
$theme_list[$temp_arr['info']['name']] = $temp_arr['info'];
}
}
// 获取系统已经安装的主题信息
if ($theme_dir_list) {
$map['name'] = array('in', $theme_dir_list);
} else {
return false;
}
$installed_theme_list = $this->where($map)->field(true)->order('sort asc,id desc')->select();
if ($installed_theme_list) {
foreach ($installed_theme_list as $theme) {
$theme_list[$theme['name']] = $theme;
}
//系统已经安装的主题信息与文件夹下主题信息合并
$theme_list = array_merge($theme_list, $theme_list);
}
foreach ($theme_list as &$val) {
switch ($val['status']) {
case '-1':
//未安装
$val['status'] = '<i class="fa fa-download" style="color:green"></i>';
$val['right_button'] = '<a class="label label-success ajax-get" href="' . U('install?name=' . $val['name']) . '">安装</a>';
break;
default:
$val['status'] = '<i class="fa fa-check" style="color:green"></i>';
if ($val['current']) {
$val['right_button'] .= '<span class="label label-success" href="#">我是当前主题</span> ';
} else {
$val['right_button'] .= '<a class="label label-danger ajax-get" href="' . U('setCurrent', array('id' => $val['id'])) . '">设为当前主题</a> ';
}
$val['right_button'] .= '<a class="label label-info ajax-get" href="' . U('updateInfo?id=' . $val['id']) . '">更新信息</a> ';
$val['right_button'] .= '<a class="label label-primary" href="' . U('edit?id=' . $val['id']) . '">编辑</a> ';
$val['right_button'] .= '<a class="label label-danger ajax-get" href="' . U('uninstall', array('id' => $val['id'])) . '">卸载</a> ';
break;
}
}
return $theme_list;
}
作者:zhendeguoke100
项目:OneSho
public function complete()
{
$step = session('step');
if (!$step) {
$this->error('请正确安装系统', U('index'));
} elseif ($step != 3) {
$this->error('请正确安装系统', U('Install/step' . $step));
}
//写入安装锁定文件
Storage::put(APP_PATH . 'Common/Conf/install.lock', 'lock');
session('step', null);
session('error', null);
$this->display();
}
作者:zhennon
项目:app_kno
public function run(&$content)
{
if (!APP_DEBUG && C('BUILD_LITE_RUNTIME')) {
$litefile = RUNTIME_PATH . APP_MODE . '~lite.php';
$runtimefile = RUNTIME_PATH . APP_MODE . '~runtime.php';
if (!Storage::has($litefile)) {
$defs = get_defined_constants(TRUE);
$content = Storage::read($runtimefile);
// $content .= 'namespace { $GLOBALS[\'_beginTime\'] = microtime(TRUE);';
$content .= compile(CORE_PATH . 'Think' . EXT);
$content .= 'namespace {' . $this->array_define($defs['user']) . 'Think\\Think::start();}';
Storage::put($litefile, $content);
}
}
}
作者:kuanglitan
项目:kl
public function complete()
{
$step = session('step');
if (!$step) {
$this->redirect('index');
} elseif ($step != 3) {
$this->redirect("Install/step{$step}");
}
Storage::put(MODULE_PATH . 'Data/install.lock', 'lock');
//创建配置文件
$this->assign('info', session('config_file'));
session('step', null);
session('error', null);
$this->display();
}
作者:fedke
项目:amang
public function index()
{
if (is_file(APP_PATH . 'User/Conf/config.php')) {
// 已经安装过了 执行更新程序
session('update', true);
$msg = '请删除install.lock文件后再运行升级!';
} else {
$msg = '已经成功安装了OneThink,请不要重复安装!';
}
if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
$this->error($msg);
}
session_destroy();
session_start();
session('step', 0);
session('error', false);
$this->display();
}