/**
  * 检查缓存文件是否有效
  * 如果无效则需要重新编译
  * @access public
  * @param string $tmplTemplateFile 模板文件名
  * @return boolean
  */
 protected function checkCache($tmplTemplateFile, $prefix = '')
 {
     if (!C('TMPL_CACHE_ON')) {
         // 优先对配置设定检测
         return false;
     }
     $tmplCacheFile = C('CACHE_PATH') . $prefix . md5($tmplTemplateFile) . C('TMPL_CACHFILE_SUFFIX');
     if (!Storage::has($tmplCacheFile)) {
         return false;
     } elseif (filemtime($tmplTemplateFile) > Storage::get($tmplCacheFile, 'mtime')) {
         // 模板文件如果有更新则缓存需要更新
         return false;
     } elseif (C('TMPL_CACHE_TIME') != 0 && time() > Storage::get($tmplCacheFile, 'mtime') + C('TMPL_CACHE_TIME')) {
         // 缓存是否在有效期
         return false;
     }
     // 开启布局模板
     if (C('LAYOUT_ON')) {
         $layoutFile = THEME_PATH . C('LAYOUT_NAME') . C('TMPL_TEMPLATE_SUFFIX');
         if (filemtime($layoutFile) > Storage::get($tmplCacheFile, 'mtime')) {
             return false;
         }
     }
     // 缓存有效
     return true;
 }
 public function index()
 {
     if (Storage::has('./Data/install.lock')) {
         $this->error('已经安装过,请删除Data/install.lock再安装');
     }
     $this->display();
 }
示例#3
0
 public function index()
 {
     if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
         $this->error('已经成功安装了OneThink,请不要重复安装!');
     }
     $this->display();
 }
         $layoutFile = THEME_PATH . C('LAYOUT_NAME') . C('TMPL_TEMPLATE_SUFFIX');
         if (filemtime($layoutFile) > Storage::get($tmplCacheFile, 'mtime')) {
             return false;
         }
     }
     // 缓存有效
     return true;
 }
 /**
 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'));
     }
 }
 protected function _initialize()
 {
     if (session('step') === null) {
         session('step', 0);
     }
     if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
         $this->error('已经成功安装了系统,请不要重复安装!', U('Home/Index/index'));
     }
 }
 protected function _initialize()
 {
     if (session('step') === null) {
         $this->redirect('Index/index');
     }
     if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
         $this->error('已经成功安装了Zcms,请不要重复安装!');
     }
 }
 public function index()
 {
     if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
         $this->error('已经成功安装了WeiPHP,请不要重复安装!');
     }
     session('step', 0);
     session('error', false);
     $this->display();
 }
 public function index()
 {
     if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
         $this->error('已经成功安装了系统,请不要重复安装!', U('Index/error'));
     }
     session_destroy();
     session_start();
     session('step', 0);
     session('error', false);
     $this->display();
 }
 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();
 }
 protected function _initialize()
 {
     $no_verify = array('index', 'step1', 'complete');
     if (in_array(ACTION_NAME, $no_verify)) {
         return true;
     }
     if (Storage::has(APP_PATH . 'Common/Conf/install.lock')) {
         $this->error('已经成功安装了本系统,请不要重复安装!', U('Home/Index/index'));
     } elseif ($_SERVER[ENV_PRE . 'DEV_MODE'] === 'true') {
         $this->error('系统处于开发模式,无需安装!', U('Home/Index/index'));
     }
 }
 /**
  * 获取模块列表
  * @param string $addon_dir
  * @author jry <*****@*****.**>
  */
 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;
 }
示例#13
0
 /**
  * 获取主题列表
  * @param string $addon_dir
  * @author jry <*****@*****.**>
  */
 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;
 }
 /**
  * 获取模块列表
  * @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;
 }
 public function index()
 {
     if (is_file('/Conf/user.php')) {
         // 已经安装过了 执行更新程序
         //session('update',true);
         $msg = '请删除install.lock文件后再运行安装程序!';
     } else {
         $msg = '已经成功安装,请不要重复安装!';
     }
     if (Storage::has('Conf/install.lock')) {
         $this->error($msg);
     }
     $this->display();
 }
 public function index()
 {
     if (is_file(APP_PATH . 'User/Conf/config.php')) {
         // 已经安装过了 执行更新程序
         session('update', true);
         $msg = '请删除install.lock文件后再运行升级!';
     } else {
         $msg = '已经成功安装了PhPluSer,请不要重复安装!';
     }
     if (Storage::has('./Data/install.lock')) {
         $this->error($msg);
     }
     $this->display();
 }
 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);
         }
     }
 }
示例#18
0
 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();
 }
示例#19
0
 protected function _initialize()
 {
     if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
         $this->error('已经成功安装了Amango,请不要重复安装!');
     }
 }
示例#20
0
 /**
  * 获取模块列表
  * @param string $addon_dir
  * @author jry <*****@*****.**>
  */
 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 asc')->select();
     if ($installed_module_list) {
         foreach ($installed_module_list as &$module) {
             $new_module_list[$module['name']] = $module;
             $new_module_list[$module['name']]['admin_menu'] = json_decode($module['admin_menu'], true);
         }
         // 系统已经安装的模块信息与文件夹下模块信息合并
         $module_list = array_merge($module_list, $new_module_list);
     }
     foreach ($module_list as &$val) {
         switch ($val['status']) {
             case '-2':
                 // 损坏
                 $val['status_icon'] = '<span class="text-danger">删除记录</span>';
                 $val['right_button']['damaged']['title'] = '删除记录';
                 $val['right_button']['damaged']['attribute'] = 'class="label label-danger ajax-get" href="' . U('setStatus', array('status' => 'delete', 'ids' => $val['id'])) . '"';
                 break;
             case '-1':
                 // 未安装
                 $val['status_icon'] = '<i class="fa fa-download text-success"></i>';
                 $val['right_button']['install_before']['title'] = '安装';
                 $val['right_button']['install_before']['attribute'] = 'class="label label-success" href="' . U('install_before', array('name' => $val['name'])) . '"';
                 break;
             case '0':
                 // 禁用
                 $val['status_icon'] = '<i class="fa fa-ban text-danger"></i>';
                 $val['right_button']['update_info']['title'] = '更新菜单';
                 $val['right_button']['update_info']['attribute'] = 'class="label label-info ajax-get no-refresh" href="' . U('updateInfo', array('id' => $val['id'])) . '"';
                 $val['right_button']['forbid']['title'] = '启用';
                 $val['right_button']['forbid']['attribute'] = 'class="label label-success ajax-get" href="' . U('setStatus', array('status' => 'resume', 'ids' => $val['id'])) . '"';
                 $val['right_button']['uninstall_before']['title'] = '卸载';
                 $val['right_button']['uninstall_before']['attribute'] = 'class="label label-danger " href="' . U('uninstall_before', array('id' => $val['id'])) . '"';
                 break;
             case '1':
                 // 正常
                 $val['status_icon'] = '<i class="fa fa-check text-success"></i>';
                 $val['right_button']['update_info']['title'] = '更新菜单';
                 $val['right_button']['update_info']['attribute'] = 'class="label label-info ajax-get no-refresh" href="' . U('updateInfo', array('id' => $val['id'])) . '"';
                 if (!$val['is_system']) {
                     $val['right_button']['forbid']['title'] = '禁用';
                     $val['right_button']['forbid']['attribute'] = 'class="label label-warning ajax-get" href="' . U('setStatus', array('status' => 'forbid', 'ids' => $val['id'])) . '"';
                     $val['right_button']['uninstall_before']['title'] = '卸载';
                     $val['right_button']['uninstall_before']['attribute'] = 'class="label label-danger " href="' . U('uninstall_before', array('id' => $val['id'])) . '"';
                 }
                 break;
         }
     }
     return $module_list;
 }
示例#21
0
/**
 * 文件是否存在
 * @param string $filename  文件名
 * @return boolean  
 */
function file_exist($filename, $type = '')
{
    switch (STORAGE_TYPE) {
        case 'Sae':
            $arr = explode('/', ltrim($filename, './'));
            $domain = array_shift($arr);
            $filePath = implode('/', $arr);
            $s = new SaeStorage();
            return $s->fileExists($domain, $filePath);
            break;
        default:
            return \Think\Storage::has($filename, $type);
    }
}
 protected function _initialize()
 {
     if (Storage::has(APP_PATH . 'Common/Conf/install.lock')) {
         $this->error('已经成功安装了Gms管理系统,请不要重复安装!');
     }
 }
示例#23
0
 /**
  * 删除文件
  */
 public function fileDelete($filename)
 {
     $filename = urldecode($filename);
     $filename = preg_replace("/\\.+/", '.', $filename);
     //屏蔽非法路径
     $filename = $this->fileBathPath . $filename;
     if (\Think\Storage::has($filename)) {
         if (\Think\Storage::unlink($filename)) {
             $this->success('操作成功');
         }
     }
     $this->error('操作失败');
 }
示例#24
0
/**
 * 文件是否存在
 * @param string $filename  文件名
 * @param string $type     其他参数
 * @return boolean  
 */
function file_exist($filename, $type = '')
{
    switch (strtoupper(C('FILE_UPLOAD_TYPE'))) {
        case 'SAE':
            $arr = explode('/', ltrim($filename, './'));
            $domain = array_shift($arr);
            $filePath = implode('/', $arr);
            $s = new SaeStorage();
            return $s->fileExists($domain, $filePath);
            break;
        case 'FTP':
            $storage = new \Common\Plugin\Ftp();
            return $storage->has($filename);
            break;
        default:
            return \Think\Storage::has($filename, $type);
    }
}
 protected function _initialize()
 {
     if (Storage::has('./Data/install.lock')) {
         $this->error('已经成功安装了PhPluSer,请不要重复安装!');
     }
 }
 protected function _initialize()
 {
     if (Storage::has('Conf/install.lock')) {
         $this->error('已经成功安装,请不要重复安装!');
     }
 }