Пример #1
0
 public function off()
 {
     $temp = $this->segment(4);
     if (!isset($this->templates[$temp])) {
         _message("没有这个模板");
     }
     EditConfig("system", "templates_name", $temp);
     _message("操作成功!");
 }
Пример #2
0
 public function edit()
 {
     $temp = $this->segment(4);
     if (!isset($this->templates[$temp])) {
         _message("没有这个模板");
     }
     $template = $this->templates[$temp];
     if (!is_writable(G_CONFIG . 'templates.inc.php')) {
         _message('Please chmod  templates  to 0777 !');
     }
     if (isset($_POST['dosubmit'])) {
         $new_template['name'] = htmlspecialchars($_POST['name']);
         $new_template['dir'] = htmlspecialchars($_POST['dir']);
         $new_template['html'] = htmlspecialchars($_POST['html']);
         $new_template['author'] = htmlspecialchars($_POST['author']);
         unset($this->templates[$temp]);
         $this->templates[$new_template['dir']] = $new_template;
         $html = "<?php \n defined('G_IN_SYSTEM') or exit('No permission resources.');";
         $html .= "\n return " . var_export($this->templates, true);
         $html .= "\n ?>";
         $ok = file_put_contents(G_CONFIG . 'templates.inc.php', $html);
         if ($template['html'] != $new_template['html']) {
             $rename_html = @rename(G_TEMPLATES . $template['dir'] . DIRECTORY_SEPARATOR . $template['html'], G_TEMPLATES . $template['dir'] . DIRECTORY_SEPARATOR . $new_template['html']);
             if (!$rename_html) {
                 _message("没有权限重命名:" . $template['html']);
             }
         }
         if ($template['dir'] != $new_template['dir']) {
             $rename_dir = @rename(G_TEMPLATES . $template['dir'], G_TEMPLATES . $new_template['dir']);
             if (!$rename_dir) {
                 _message("没有权限重命名:" . $template['dir']);
             }
         }
         if ($this->thistemp == $temp) {
             EditConfig("system", "templates_name", $new_template['dir']);
         }
         if ($ok) {
             echo "<script>\n\t\t\t\talert('修改成功');\n\t\t\t\twindow.location.href='" . G_MODULE_PATH . '/template/init' . "';\n\t\t\t\t</script>";
         }
     }
     include $this->tpl(ROUTE_M, 'template.edit');
 }
Пример #3
0
 public function upload()
 {
     if (isset($_POST['dosubmit'])) {
         $up_image_type = htmlspecialchars($_POST['up_image_type']);
         $up_soft_type = htmlspecialchars($_POST['up_soft_type']);
         $up_media_type = htmlspecialchars($_POST['up_media_type']);
         $upsize = intval($_POST['upsize']);
         $up_image_type = trim($up_image_type, ',');
         $up_soft_type = trim($up_soft_type, ',');
         $up_media_type = trim($up_media_type, ',');
         EditConfig("upload", "upsize", $upsize, 'xiao');
         EditConfig("upload", "up_image_type", $up_image_type, 'xiao');
         EditConfig("upload", "up_soft_type", $up_soft_type, 'xiao');
         EditConfig("upload", "up_media_type", $up_media_type, 'xiao');
         _message("操作成功!");
     }
     $web = System::load_sys_config('upload');
     /*	
     	$up_image_type = implode(',',$web['up_image_type']);
     	$up_soft_type = implode(',',$web['up_soft_type']);
     	$up_media_type = implode(',',$web['up_media_type']);
     */
     $up_image_type = $web['up_image_type'];
     $up_soft_type = $web['up_soft_type'];
     $up_media_type = $web['up_media_type'];
     include $this->tpl(ROUTE_M, 'config.upload');
 }