Ejemplo n.º 1
0
 public function in_data()
 {
     $table = $_POST['table'];
     if (empty($table)) {
         $this->msg('文件夹名尚未填写!', 0);
     }
     $dir = __ROOTDIR__ . '/data/form/' . $table;
     $config = @Xml::decode(file_get_contents($dir . '/form.xml'));
     $config = $config['config'];
     if (empty($config)) {
         $this->msg('无法获取模型配置!', 0);
     }
     if (!file_exists($dir) || !file_exists($dir . '/dbbak/')) {
         $this->msg($table . '目录不存在!或者目录结构错误!', 0);
     }
     if (model('form')->table_info($config['table'])) {
         $this->msg($table . '表单已经存在,无法重复导入!', 0);
     }
     //导入数据库
     $db = new Dbbak($this->config['DB_HOST'], $this->config['DB_USER'], $this->config['DB_PWD'], $this->config['DB_NAME'], 'utf8', $dir . '/dbbak/');
     if (!$db->importSql('', $config['prefix'], $this->config['DB_PREFIX'])) {
         $this->msg('数据库导入失败!', 0);
     }
     //修改关联信息
     $info = model('form')->associate_edit();
     $this->msg('模型导入完毕!', 1);
 }
Ejemplo n.º 2
0
 public function in_data()
 {
     $table = $_POST['table'];
     if (empty($table)) {
         $this->msg('文件夹名尚未填写!', 0);
     }
     $dir = __ROOTDIR__ . '/data/module/' . $table;
     $config = @Xml::decode(file_get_contents($dir . '/model.xml'));
     $config = $config['config'];
     if (empty($config)) {
         $this->msg('无法获取模型配置!', 0);
     }
     if (!file_exists($dir) || !file_exists($dir . '/file/') || !file_exists($dir . '/dbbak/')) {
         $this->msg($table . '目录不存在!或者目录结构错误!', 0);
     }
     if (model('model_manage')->search($config['model'])) {
         $this->msg($table . '模型已经存在,无法重复导入!', 0);
     }
     //复制文件
     if (!copy_dir($dir . '/file/', __ROOTDIR__)) {
         $this->msg('模型文件导入失败,可能网站目录没有写入权限!', 0);
     }
     //导入数据库
     $db = new Dbbak($this->config['DB_HOST'], $this->config['DB_USER'], $this->config['DB_PWD'], $this->config['DB_NAME'], 'utf8', $dir . '/dbbak/');
     if (!$db->importSql('', $config['prefix'], $this->config['DB_PREFIX'])) {
         $this->msg('数据库导入失败!', 0);
     }
     if (method_exists($info['model'], 'model_ini_in')) {
         model($info['model'])->model_ini_in();
     }
     $this->msg('模型导入完毕!', 1);
 }
Ejemplo n.º 3
0
 public function upgrade()
 {
     $dir = __ROOTDIR__ . '/data/update/';
     if (!file_exists($dir . '/ver.xml')) {
         $this->msg('升级信息文件不存在!', 0);
         return;
     }
     $xml = file_get_contents($dir . '/ver.xml');
     $info = Xml::decode($xml);
     $time = $info['ver']['vertime'];
     if ($time != $this->config['ver_date']) {
         $this->msg('该更新包不适合当前版本!', 0);
         return;
     }
     if (!copy_dir($dir . '/update', __ROOTDIR__, true)) {
         $this->msg('移动文件失败!', 0);
         return;
     }
     if ($info['ver']['sql'] == '1') {
         model('update')->index();
     }
     del_dir($dir);
     $this->msg('升级成功!清空手动清空所有缓存!');
 }
Ejemplo n.º 4
0
 protected function plugin_config()
 {
     $url = __ROOTDIR__ . '/plugins/' . $_GET['_module'] . '/config.xml';
     $config = Xml::decode(file_get_contents($url));
     return $config;
 }
Ejemplo n.º 5
0
 public function info($name)
 {
     $url = __ROOTDIR__ . '/plugins/' . $name . '/config.xml';
     $config = @Xml::decode(file_get_contents($url));
     return $config['config'];
 }