예제 #1
0
 public function select_tpl()
 {
     //模板目录
     $stylePath = ROOT_PATH . 'template/' . C("WEB_STYLE") . '/';
     $path = Q("request.path", $stylePath);
     $file = Dir::tree($path, "html");
     foreach ($file as $n => $v) {
         if ($v['type'] == 'dir') {
             $file[$n]['path'] = $v['path'];
         } else {
             $file[$n]['path'] = str_replace($stylePath, '', $v['path']);
         }
     }
     $history = "";
     if ($dir = Q("get.path")) {
         if ($dir == $stylePath) {
             $history = "";
         } else {
             $history = __METH__ . '&path=' . dirname($dir);
         }
     }
     $this->assign("history", $history);
     $this->assign("file", $file);
     $this->display();
 }
 public function getFileList()
 {
     //风格目录
     $stylePath = ROOT_PATH . 'template/' . C("WEB_STYLE") . '/';
     $path = Q("request.path", '', "urldecode");
     if ($path) {
         $history = __ACTION__ . '&path=' . urlencode(dirname($path));
         $dir = $path;
     } else {
         $history = '';
         $dir = $stylePath;
     }
     $file = Dir::tree($dir, "html");
     foreach ($file as $n => $v) {
         if ($v['type'] == 'dir') {
             $file[$n]['url'] = __ACTION__ . '&path=' . urlencode($v['path']);
         } else {
             $startPos = strrpos($stylePath, C("WEB_STYLE")) + strlen(C("WEB_STYLE")) + 1;
             $file[$n]['path'] = substr($v['path'], $startPos);
         }
     }
     $this->assign('history', $history);
     $this->assign('file', $file);
     echo $this->fetch();
     exit;
 }
 public function styleList()
 {
     $style = array();
     $dirs = Dir::tree('template');
     foreach ($dirs as $tpl) {
         $xml = $tpl['path'] . '/config.xml';
         if (!is_file($xml)) {
             continue;
         }
         if (!($config = Xml::toArray(file_get_contents($xml)))) {
             continue;
         }
         $tpl['name'] = isset($config['name']) ? $config['name'][0] : '';
         //模型名
         $tpl['author'] = isset($config['author']) ? $config['author'][0] : '';
         //作者
         $tpl['image'] = isset($config['image']) ? __ROOT__ . '/template/' . $tpl['filename'] . '/' . $config['image'][0] : __CONTROLLER_TPL__ . '/img/preview.jpg';
         //预览图
         $tpl['email'] = isset($config['email']) ? $config['email'][0] : '';
         //邮箱
         $tpl['current'] = C("WEB_STYLE") == $tpl['filename'] ? 1 : 0;
         //正在使用的模板
         $style[] = $tpl;
     }
     $this->assign('style', $style);
     $this->display();
 }
예제 #4
0
 public function set_db()
 {
     if (IS_POST) {
         if (!mysql_connect($_POST['DB_HOST'], $_POST['DB_USER'], $_POST['DB_PASSWORD'])) {
             $this->error('数据库帐号或密码错误');
         }
         //创建数据库
         mysql_query("CREATE DATABASE IF NOT EXISTS " . $_POST['DB_DATABASE'] . ' CHARSET UTF8');
         //数据库连接正常
         C($_POST);
         $db_prefix = $_POST['DB_PREFIX'];
         $db = M();
         //导入数据
         $files = Dir::tree('db');
         foreach ($files as $f) {
             require $f['path'];
         }
         //修改配置文件
         $config = array('DB_HOST' => $_POST['DB_HOST'], 'DB_PORT' => $_POST['DB_PORT'], 'DB_USER' => $_POST['DB_USER'], 'DB_PASSWORD' => $_POST['DB_PASSWORD'], 'DB_DATABASE' => $_POST['DB_DATABASE'], 'DB_PREFIX' => $_POST['DB_PREFIX']);
         $data = "<?php\nif(!defined('HDPHP_PATH'))exit;\nreturn " . var_export($config, true) . ";\n?>";
         file_put_contents('../data/config/db.inc.php', $data);
         //更新管理员信息
         $db->table('admin')->save(array('aid' => 1, 'username' => $_POST['username'], 'password' => md5($_POST['password'])));
         touch('lock.php');
         $this->root = dirname(__ROOT__);
         $this->display('success');
     } else {
         $this->display();
     }
 }
예제 #5
0
파일: Module.php 프로젝트: houdunwang/hdcms
 public function prepared()
 {
     $modules = Db::table('modules')->lists('name');
     $dirs = Dir::tree('addons');
     //本地模块
     $locality = [];
     foreach ($dirs as $d) {
         if ($d['type'] == 'dir' && is_file($d['path'] . '/manifest.xml')) {
             $xml = Xml::toArray(file_get_contents($d['path'] . '/manifest.xml'));
             //去除已经安装的模块
             if (!in_array($xml['manifest']['application']['name']['@cdata'], $modules)) {
                 //预览图片
                 $x['cover'] = is_file($d['path'] . '/cover.jpg') ? $d['path'] . '/cover.jpg' : 'resource/images/nopic_small.jpg';
                 $x['name'] = $xml['manifest']['application']['name']['@cdata'];
                 $x['title'] = $xml['manifest']['application']['title']['@cdata'];
                 $x['version'] = $xml['manifest']['application']['version']['@cdata'];
                 $x['detail'] = $xml['manifest']['application']['detail']['@cdata'];
                 $x['author'] = $xml['manifest']['application']['author']['@cdata'];
                 $x['locality'] = !is_file('addons/' . $x['name'] . '/cloud.hd') ? 1 : 0;
                 $locality[$x['name']] = $x;
             }
         }
     }
     return view()->with('locality', $locality);
 }
 /**
  * 选择模板
  */
 public function selectTemplate()
 {
     if (!($dir = Q('dir'))) {
         $dir = 'Template/' . C('WEB_STYLE');
     }
     $file = Dir::tree($dir, 'html');
     $this->assign('id', Q('id'));
     $this->assign('file', $file);
     $this->display();
 }
예제 #7
0
 public function index()
 {
     $file = Dir::tree(APP_PATH . "backup");
     $dir = array();
     foreach ($file as $f) {
         if (is_dir($f['path'])) {
             $dir[] = $f;
         }
     }
     $this->assign("dir", $dir);
     $this->display();
 }
예제 #8
0
 public function index()
 {
     $data = Dir::tree('template');
     // p($data);
     $dirs = array();
     foreach ($data as $d) {
         if (is_file($d['path'] . '/config.php')) {
             $d['active'] = $d['filename'] == C('web.style') ? 'class="active"' : '';
             $d = array_merge($d, require $d['path'] . '/config.php');
             $dirs[] = $d;
         }
     }
     View::with('dirs', $dirs)->make();
 }
예제 #9
0
 public function index()
 {
     $data = Dir::tree('template');
     // p($data);
     $array = [];
     foreach ($data as $k => $v) {
         if ($v['filename'] == C('web2.style')) {
             $v['class'] = "class='active'";
         } else {
             $v['class'] = "";
         }
         // $array[] = $v;
         if (is_file($v['path'] . '/config.php')) {
             $array[] = array_merge($v, require $v['path'] . '/config.php');
         }
     }
     // p($array);
     View::with('data', $array)->make();
 }
예제 #10
0
 /**
  * 插件列表
  */
 public function plugin_list()
 {
     $Model = K("Plugin");
     $dir = Dir::tree('hd/Plugin');
     $plugin = array();
     if (!empty($dir)) {
         foreach ($dir as $d) {
             //插件应用名
             $app = $d['name'];
             $conf = (require "hd/Plugin/{$app}/Config/config.php");
             $conf['app'] = $app;
             //转为小写,方便视图调用
             $conf = array_change_key_case_d($conf);
             $plugin[$d['name']] = $conf;
             $plugin[$d['name']]['dirname'] = $app;
             //是否安装
             $installed = $Model->where("app='{$app}'")->find();
             $plugin[$d['name']]['installed'] = $installed ? 1 : 0;
         }
     }
     $this->assign("plugin", $plugin);
     $this->display();
 }
예제 #11
0
파일: Backup.php 프로젝트: arnold1119/cms
 public function recoveryInit($config)
 {
     F('_recovery_', '[del]');
     if (!is_dir($config['dir'])) {
         $this->error = '目录不存在';
         return false;
     }
     foreach (Dir::tree($config['dir']) as $f) {
         if ($f['basename'] == 'config.php' || $f['basename'] == 'structure.php' || $f['basename'] == 'lock.php') {
             //不运行执行的文件
             continue;
         } else {
             $file[] = $f['path'];
         }
     }
     $cache['config'] = $config;
     $cache['file'] = $file;
     $cache['totalfile'] = count($file);
     F('_recovery_', $cache);
     //还原表结构
     require $config['dir'] . '/structure.php';
     return true;
 }
예제 #12
0
 /**
  * 备份列表
  * @return [type] [description]
  */
 public function backList()
 {
     $dirs = Dir::tree('Backup');
     $this->assign('dirs', $dirs);
     $this->display();
 }
예제 #13
0
 public function index()
 {
     $data = Dir::tree('Backup');
     View::with('data', $data)->make();
 }
예제 #14
0
 public function show_dir()
 {
     $dirName = Q("get.dir_name") ? Q("get.dir_name", '', "urldecode") : 'template/' . C("WEB_STYLE");
     $this->dirs = Dir::tree($dirName, 'html');
     $this->display();
 }
예제 #15
0
 public function index()
 {
     $data = Dir::tree('backup');
     $this->data = $data;
     $this->display();
 }
예제 #16
0
 public function show_dir()
 {
     $dir_name = "template/" . (Q("get.dir_name") ? Q("get.dir_name") : C("WEB_STYLE"));
     $this->dirs = Dir::tree($dir_name, 'html');
     $this->display();
 }
예제 #17
0
 public function prepared()
 {
     $modules = $this->db->lists('name');
     $dirs = \Dir::tree('theme');
     //本地模板
     $locality = [];
     foreach ($dirs as $d) {
         if ($d['type'] == 'dir' && is_file($d['path'] . '/manifest.xml')) {
             if ($xml = Xml::toArray(file_get_contents($d['path'] . '/manifest.xml'))) {
                 //本地模板
                 $thumb = $xml['manifest']['application']['thumb']['@cdata'];
                 //去除已经安装的模板
                 if (!in_array($xml['manifest']['application']['name']['@cdata'], $modules)) {
                     //预览图片
                     $x['thumb'] = is_file($d['path'] . '/' . $thumb) ? $d['path'] . '/' . $thumb : 'resource/images/nopic_small.jpg';
                     $x['name'] = $xml['manifest']['application']['name']['@cdata'];
                     $x['title'] = $xml['manifest']['application']['title']['@cdata'];
                     $x['version'] = $xml['manifest']['application']['version']['@cdata'];
                     $x['resume'] = $xml['manifest']['application']['resume']['@cdata'];
                     $x['author'] = $xml['manifest']['application']['author']['@cdata'];
                     $x['locality'] = !is_file('theme/' . $x['name'] . '/cloud.hd') ? 1 : 0;
                     $locality[$x['name']] = $x;
                 }
             }
         }
     }
     return view()->with('locality', $locality);
 }