Browse Source

fix bug

pull/71/head
xiaoz 3 years ago
parent
commit
329d85e9b4
  1. 6
      class/Api.php
  2. 8
      controller/index.php
  3. 2
      templates/default/info.json

6
class/Api.php

@ -980,7 +980,7 @@ class Api {
if( file_exists("templates/".$template."/config.json") ) { if( file_exists("templates/".$template."/config.json") ) {
$config_file = "templates/".$template."/config.json"; $config_file = "templates/".$template."/config.json";
} }
else if(data/templates/".$template."/config.json) { else if( file_exists("data/templates/".$template."/config.json") ) {
$config_file = "data/templates/".$template."/config.json"; $config_file = "data/templates/".$template."/config.json";
} }
else if( file_exists("templates/".$template."/info.json") ) { else if( file_exists("templates/".$template."/info.json") ) {
@ -995,12 +995,14 @@ class Api {
//如果是info.json,则特殊处理下 //如果是info.json,则特殊处理下
if ( strstr($config_file,"info.json") ) { if ( strstr($config_file,"info.json") ) {
$config_content = json_decode($config_content);
$theme_config = $config_content->config; $theme_config = $config_content->config;
} }
else{ else{
$theme_config = $config_content; $theme_config = $config_content;
}
$theme_config = json_decode($theme_config); $theme_config = json_decode($theme_config);
}
$this->return_json(200,$theme_config,""); $this->return_json(200,$theme_config,"");
} }
/** /**

8
controller/index.php

@ -167,7 +167,7 @@ $site = unserialize($site);
if( file_exists("templates/".$template."/config.json") ) { if( file_exists("templates/".$template."/config.json") ) {
$config_file = "templates/".$template."/config.json"; $config_file = "templates/".$template."/config.json";
} }
else if(data/templates/".$template."/config.json) { else if( file_exists("data/templates/".$template."/config.json") ) {
$config_file = "data/templates/".$template."/config.json"; $config_file = "data/templates/".$template."/config.json";
} }
else if( file_exists("templates/".$template."/info.json") ) { else if( file_exists("templates/".$template."/info.json") ) {
@ -181,12 +181,14 @@ else {
$config_content = @file_get_contents($config_file); $config_content = @file_get_contents($config_file);
//如果是info.json,则特殊处理下 //如果是info.json,则特殊处理下
if ( strstr($config_file,"info.json") ) { if ( strstr($config_file,"info.json") ) {
$config_content = json_decode($config_content);
$theme_config = $config_content->config; $theme_config = $config_content->config;
} }
else{ else{
$theme_config = $config_content; $config_content = $config_content;
$theme_config = json_decode($config_content);
} }
$theme_config = json_decode($config_content);
//判断文件夹是否存在 //判断文件夹是否存在
if( is_dir('templates/'.$template) ){ if( is_dir('templates/'.$template) ){

2
templates/default/info.json

@ -10,6 +10,6 @@
"config": { "config": {
"full_width_mode":"off", "full_width_mode":"off",
"link_description":"show", "link_description":"show",
"favicon": "offline" "favicon": "online"
} }
} }
Loading…
Cancel
Save