From 274dcdc1d38eaaad1b096b5df7d360e0f0603f41 Mon Sep 17 00:00:00 2001
From: chengkun <chengkun@ishangstudy.com>
Date: Tue, 20 May 2025 18:03:04 +0800
Subject: [PATCH] 提交
---
admin/model/config.class.php | 215 ++++++++++++++++++++++++++---------------------------
1 files changed, 105 insertions(+), 110 deletions(-)
diff --git a/admin/model/config.class.php b/admin/model/config.class.php
index 96314ab..3dad9af 100644
--- a/admin/model/config.class.php
+++ b/admin/model/config.class.php
@@ -1,40 +1,33 @@
<?php
-/*
- * $Author :PHPYUN开发团队
- *
- * 官网: http://www.phpyun.com
- *
- * 版权所有 2009-2021 宿迁鑫潮信息技术有限公司,并保留所有权利。
- *
- * 软件声明:未经授权前提下,不得用于商业运营、二次开发以及任何形式的再次发布。
- */
-class config_controller extends adminCommon{
+
+class config_controller extends adminCommon {
+
/**
* 系统-网站设置
*/
- function index_action(){
- if (strpos($this->config['sy_weburl'], 'https') !== false) {
+ function index_action() {
+ if (strpos($this->config['sy_weburl'], 'https') !== FALSE) {
$this->config['mapurl'] = 'https://api.map.baidu.com/api?v=2.0&ak=' . $this->config['map_key'] . '&s=1';
} else {
$this->config['mapurl'] = 'http://api.map.baidu.com/api?v=2.0&ak=' . $this->config['map_key'];
}
- if ($this->config['sy_ossurl'] == ''){
- $this->config['sy_ossurl'] = $this->config['sy_weburl'];
+ if ($this->config['sy_ossurl'] == '') {
+ $this->config['sy_ossurl'] = $this->config['sy_weburl'];
}
$this->yunset("config", $this->config);
-
+
$this->yunset('sphinxSearchd', $sphinxSearchd);
$this->yuntpl(array('admin/admin_web_config'));
}
-
+
/**
* 系统-网站设置-网站logo
*/
- function save_logo_action(){
+ function save_logo_action() {
if ($_POST['waterconfig']) {
$this->web_config();
@@ -42,61 +35,62 @@
$this->ACT_layer_msg('网站LOGO配置设置成功!', 9, $_SERVER['HTTP_REFERER'], 2, 1);
}
}
-
+
// 保存
- function save_action(){
+ function save_action() {
+// var_dump($_POST);exit;
if ($_POST['config']) {
- if ($_POST['config'] == 'uploadconfig'){
+ if ($_POST['config'] == 'uploadconfig') {
// 上传参数为空,保存默认值
- if (!$_POST['pic_maxsize'] || ($_POST['pic_maxsize'] == '' || $_POST['pic_maxsize'] < 1)){
+ if (!$_POST['pic_maxsize'] || ($_POST['pic_maxsize'] == '' || $_POST['pic_maxsize'] < 1)) {
$_POST['pic_maxsize'] = 5;
}
- if (!$_POST['file_maxsize'] || ($_POST['file_maxsize'] == '' || $_POST['file_maxsize'] < 1)){
+ if (!$_POST['file_maxsize'] || ($_POST['file_maxsize'] == '' || $_POST['file_maxsize'] < 1)) {
$_POST['file_maxsize'] = 5;
}
-
- if (!$_POST['pic_type']){
+
+ if (!$_POST['pic_type']) {
$_POST['pic_type'] = 'jpg,png,jpeg,bmp,gif';
- }else{
- $pic_type = explode(',',str_replace(' ','',$_POST['pic_type']));
-
- //禁止后台设定可执行程序后缀
- foreach($pic_type as $pickey => $picvalue){
-
- $new_pic_type = strtolower(str_replace('.','',trim($picvalue)));
- if(in_array($new_pic_type,array('php','asp','aspx','jsp','exe','do'))){
-
- unset($pic_type[$pickey]);
- }
- }
- $_POST['pic_type'] = implode(',',$pic_type);
- }
- if (!$_POST['file_type']){
+ } else {
+ $pic_type = explode(',', str_replace(' ', '', $_POST['pic_type']));
+
+ //禁止后台设定可执行程序后缀
+ foreach ($pic_type as $pickey => $picvalue) {
+
+ $new_pic_type = strtolower(str_replace('.', '', trim($picvalue)));
+ if (in_array($new_pic_type, array('php', 'asp', 'aspx', 'jsp', 'exe', 'do'))) {
+
+ unset($pic_type[$pickey]);
+ }
+ }
+ $_POST['pic_type'] = implode(',', $pic_type);
+ }
+ if (!$_POST['file_type']) {
$_POST['file_type'] = 'rar,zip,doc,docx,xls';
- }else{
- $file_type = explode(',',str_replace(' ','',$_POST['file_type']));
-
- //禁止后台设定可执行程序后缀
- foreach($file_type as $filekey => $filevalue){
-
- $new_file_type = strtolower(str_replace('.','',trim($filevalue)));
- if(in_array($new_file_type,array('php','asp','aspx','jsp','exe','do'))){
-
- unset($file_type[$filekey]);
- }
- }
- $_POST['file_type'] = implode(',',$file_type);
- }
- if (!$_POST['wmark_position']){
+ } else {
+ $file_type = explode(',', str_replace(' ', '', $_POST['file_type']));
+
+ //禁止后台设定可执行程序后缀
+ foreach ($file_type as $filekey => $filevalue) {
+
+ $new_file_type = strtolower(str_replace('.', '', trim($filevalue)));
+ if (in_array($new_file_type, array('php', 'asp', 'aspx', 'jsp', 'exe', 'do'))) {
+
+ unset($file_type[$filekey]);
+ }
+ }
+ $_POST['file_type'] = implode(',', $file_type);
+ }
+ if (!$_POST['wmark_position']) {
$_POST['wmark_position'] = 1;
}
}
unset($_POST['config']);
unset($_POST['pytoken']);
if (isset($_POST['map_key'])) {
- if (strpos($this->config['sy_weburl'], 'https') !== false) {
+ if (strpos($this->config['sy_weburl'], 'https') !== FALSE) {
$_POST['mapurl'] = 'https://api.map.baidu.com/api?v=2.0&ak=' . $_POST['map_key'] . '&s=1';
} else {
@@ -105,34 +99,34 @@
}
if (!empty($_POST['sy_weburl'])) {
$weburl = trim($_POST['sy_weburl']);
- if (stripos($weburl, 'http') === false){
+ if (stripos($weburl, 'http') === FALSE) {
$this->layer_msg('网站地址缺少http://或https://', 8, 1, '');
}
// 保存域名时,相关的内容要重新保存,防止域名或http头改变后,有关功能异常
- if (!empty($this->config['map_key'])){
+ if (!empty($this->config['map_key'])) {
// 百度地图地址
- $protocol = getprotocol($weburl);
- $_POST['mapurl'] = $protocol . 'api.map.baidu.com/api?v=2.0&ak=' . $this->config['map_key'] . '&s=1';
+ $protocol = getprotocol($weburl);
+ $_POST['mapurl'] = $protocol . 'api.map.baidu.com/api?v=2.0&ak=' . $this->config['map_key'] . '&s=1';
}
- if (!empty($this->config['sy_indexdomain'])){
+ if (!empty($this->config['sy_indexdomain'])) {
// 分站默认域名
- $protocol = getprotocol($weburl);
- $indexUrl = parse_url($this->config['sy_indexdomain']);
- $indexPath = !empty($indexUrl['path']) ? $indexUrl['path'] : '';
- $_POST['sy_indexdomain'] = $protocol . $indexUrl['host'] . $indexPath;
+ $protocol = getprotocol($weburl);
+ $indexUrl = parse_url($this->config['sy_indexdomain']);
+ $indexPath = !empty($indexUrl['path']) ? $indexUrl['path'] : '';
+ $_POST['sy_indexdomain'] = $protocol . $indexUrl['host'] . $indexPath;
}
- if (file_exists(DATA_PATH.'/api/alipay/alipay_data.php')){
+ if (file_exists(DATA_PATH . '/api/alipay/alipay_data.php')) {
// 支付宝配置参数中网站域名,跟随调整
- @include(DATA_PATH.'api/alipay/alipay_data.php');
- if (!empty($alipaydata)){
- $alipaydata['sy_weburl'] = $weburl;
- made_web(DATA_PATH.'api/alipay/alipay_data.php',ArrayToString($alipaydata),'alipaydata');
+ @include(DATA_PATH . 'api/alipay/alipay_data.php');
+ if (!empty($alipaydata)) {
+ $alipaydata['sy_weburl'] = $weburl;
+ made_web(DATA_PATH . 'api/alipay/alipay_data.php', ArrayToString($alipaydata), 'alipaydata');
}
}
}
- $configM = $this->MODEL('config');
+ $configM = $this->MODEL('config');
- $configM -> setConfig($_POST);
+ $configM->setConfig($_POST);
// 判断验证字符
if ($_POST['code_strlength'] < 5) {
@@ -143,11 +137,11 @@
}
}
}
-
+
// 加载模板缓存
- function settplcache_action(){
- include (CONFIG_PATH . "db.data.php");
- include (PLUS_PATH . "cache.config.php");
+ function settplcache_action() {
+ include(CONFIG_PATH . "db.data.php");
+ include(PLUS_PATH . "cache.config.php");
$modelconfig = $arr_data['modelconfig'];
foreach ($modelconfig as $key => $value) {
@@ -161,12 +155,12 @@
'admin/admin_tplcache'
));
}
-
+
// 保存设置模板缓存
- function savetplcache_action(){
+ function savetplcache_action() {
if ($_POST["config"]) {
unset($_POST["config"]);
- include (CONFIG_PATH . "db.data.php");
+ include(CONFIG_PATH . "db.data.php");
$modelconfig = array_keys($arr_data['modelconfig']);
$config_new = array();
foreach ($_POST as $key => $v) {
@@ -180,24 +174,24 @@
$this->ACT_layer_msg("模块缓存设置修改成功!", 9, "index.php?m=config&c=settplcache", 2, 1);
}
}
-
+
// 刷新sphinx主索引
- function refresh_sphinx_main_index_action(){
- require_once (APP_PATH . 'app/include/cron/sphinx_indexer_main.php');
+ function refresh_sphinx_main_index_action() {
+ require_once(APP_PATH . 'app/include/cron/sphinx_indexer_main.php');
echo '1';
exit();
}
-
+
// 开启sphinx时,检查searchd是否运行,生成sphinx.conf配置文件
- function check_usesphinx_action(){
- include_once (LIB_PATH . "sphinx.class.php");
- $useSphinx = false;
+ function check_usesphinx_action() {
+ include_once(LIB_PATH . "sphinx.class.php");
+ $useSphinx = FALSE;
if (sphinx::isRun($this->config['sphinxhost'], $this->config['sphinxport'])) {
- $useSphinx = true;
+ $useSphinx = TRUE;
}
if ($useSphinx) {
- require_once (LIB_PATH . 'sphinxhelper.class.php');
+ require_once(LIB_PATH . 'sphinxhelper.class.php');
$helper = new sphinxhelper();
$helper->generateConf();
echo '1';
@@ -207,19 +201,19 @@
exit();
}
}
-
+
// 生成sphinx.conf配置文件
- function generate_conf_action(){
- require_once (LIB_PATH . 'sphinxhelper.class.php');
+ function generate_conf_action() {
+ require_once(LIB_PATH . 'sphinxhelper.class.php');
$helper = new sphinxhelper();
$helper->generateConf();
echo '1';
exit();
}
-
+
// 启动/停止sphinx的searchd搜索服务
- public function sphinx_searchd_action(){
- if (! isset($_POST['status']) || ($_POST['status'] != 'start' && $_POST['status'] != 'stop')) {
+ public function sphinx_searchd_action() {
+ if (!isset($_POST['status']) || ($_POST['status'] != 'start' && $_POST['status'] != 'stop')) {
echo '2';
exit();
}
@@ -240,36 +234,37 @@
echo '1';
exit();
}
+
//后台专用,layui上传图片公共方法
- function layui_upload_action()
- {
+ function layui_upload_action() {
- if($_FILES['file']['tmp_name']){
-
- $data = array(
- 'name' => $_POST['name'],
- 'path' => $_POST['path'],
- 'imgid' => $_POST['imgid'],
- 'file' => $_FILES['file']
+ if ($_FILES['file']['tmp_name']) {
+
+ $data = array(
+ 'name' => $_POST['name'],
+ 'path' => $_POST['path'],
+ 'imgid' => $_POST['imgid'],
+ 'file' => $_FILES['file']
);
-
- $UploadM=$this->MODEL('upload');
+
+ $UploadM = $this->MODEL('upload');
$return = $UploadM->layUpload($data);
- if (!empty($_POST['name']) && $return['code'] == 0){
+ if (!empty($_POST['name']) && $return['code'] == 0) {
// 后台上传logo后,重新生成缓存
$this->web_config();
}
- }else{
- $return = array(
- 'code' => 1,
- 'msg' => '请上传文件',
- 'data' => array()
+ } else {
+ $return = array(
+ 'code' => 1,
+ 'msg' => '请上传文件',
+ 'data' => array()
);
}
echo json_encode($return);
}
}
+
?>
\ No newline at end of file
--
Gitblit v1.9.0