File: /web/data/www.tbbprovision.com/application/admin/controllers/SiteConfigController.class.php
<?php
/**
* 系统设置
* Created by PhpStorm.
* User: Administrator
* Date: 2017/4/9
* Time: 21:34
*/
class SiteConfigController extends Controller
{
function __construct($controller, $action, $module)
{
parent::__construct($controller, $action, $module);
$this->check_manage_login();
// 权限验证
$this->check_permission();
$this->manage_init();
}
/**
* 网站基本设置页面加载
*/
public function baseset_action()
{
$site_config = str::str_code($this->model('SiteConfig')->table('config')->where('1')->selectAll());
$list = array();
foreach((array)$site_config as $k=>$v){
$list[$v['field_key']] = $v['field_value'];
}
$this->assign('site_config',$list);
$this->render();
}
public function baseset_post_action()
{
try{
$data['site_name'] = f::post('site_name');
$data['seo_title'] = f::post('seo_title');
$data['seo_keyword'] = f::post('seo_keyword');
$data['seo_description'] = f::post('seo_description');
$data['right_slogan'] = f::post('right_slogan');
$data['news_audit'] = f::post('news_audit');
$data['page_load_animate_type'] = f::post('page_load_animate_type');
$data['open_sound'] = f::post('open_sound');
$data['close_copy'] = (int)f::post('close_copy');
$data['company_info'] = f::post('company_info');
$data['filter_ip'] = f::post('filter_ip'); //IP黑名单
$data['trust_ip'] = f::post('trust_ip'); //ip白名单
//LOGO
$logo_path = f::post('logo_path');
$old_logo_path = f::post('old_logo_path');
$data['logo_path'] = $old_logo_path;
if(is_file(APP_PATH.$logo_path) && $logo_path != $old_logo_path){
$logo_path = file::move_file($logo_path,'base_set/'.date('Ym/d/'),'',0);
//将新图片加入系统文件管理
f::file_to_manage($logo_path,'网站LOGO');
}
$data['logo_path'] = $logo_path;
foreach((array)$data as $k=>$v){
$this->model('SiteConfig')->table('config')->where("field_key='{$k}'")->update(array("field_value"=>$v));
}
$this->model('SiteConfig')->add_log('更新网站基本设置',$data);
f::e_json('更新成功');
}catch (Exception $e){
exit($e->getMessage());
}
}
}