Ejemplo n.º 1
0
 /**
  * [do_save 保存配置]
  * @return [type] [description]
  */
 function do_save()
 {
     $config = iS::escapeStr($_POST['config']);
     iFS::allow_files($config['FS']['allow_ext']) or iPHP::alert("附件设置 > 允许上传类型设置不合法!");
     iFS::allow_files(trim($config['router']['html_ext'], '.')) or iPHP::alert('URL设置 > 文件后缀设置不合法!');
     $config['router']['html_ext'] = '.' . trim($config['router']['html_ext'], '.');
     $config['router']['URL'] = trim($config['router']['URL'], '/');
     $config['router']['public_url'] = rtrim($config['router']['public_url'], '/');
     $config['router']['user_url'] = rtrim($config['router']['user_url'], '/');
     $config['router']['tag_url'] = trim($config['router']['tag_url'], '/');
     $config['router']['DIR'] = rtrim($config['router']['DIR'], '/') . '/';
     $config['router']['html_dir'] = rtrim($config['router']['html_dir'], '/') . '/';
     $config['router']['tag_dir'] = rtrim($config['router']['tag_dir'], '/') . '/';
     $config['FS']['url'] = trim($config['FS']['url'], '/') . '/';
     foreach ((array) $config['open'] as $platform => $value) {
         if ($value['appid'] && $value['appkey']) {
             $config['open'][$platform]['enable'] = true;
         }
     }
     $config['apps'] = $this->apps;
     foreach ($config as $n => $v) {
         $this->set($v, $n, 0);
     }
     $this->write($config);
     iPHP::success('更新完成', 'js:1');
 }