Browse Source

add api/config

master
filesite 2 years ago
parent
commit
b35c2951b4
  1. 9
      conf/app.php
  2. 24
      controller/ApiController.php

9
conf/app.php

@ -3,6 +3,7 @@
* Config * Config
*/ */
$configs = array( $configs = array(
'version' => '0.1.0',
'default_timezone' => 'Asia/Shanghai', //timezone 'default_timezone' => 'Asia/Shanghai', //timezone
//文档站皮肤 //文档站皮肤
@ -47,10 +48,10 @@ $configs = array(
//目前支持的皮肤 //目前支持的皮肤
'allowedThemes' => array( 'allowedThemes' => array(
'manual', 'manual' => '文档站',
'webdirectory', 'webdirectory' => '导航站',
'googleimage', 'googleimage' => '图片站',
'videoblog', 'videoblog' => '视频站',
), ),
//md5加密前缀 //md5加密前缀

24
controller/ApiController.php

@ -721,7 +721,7 @@ Class ApiController extends Controller {
$themeName = $this->post('theme', ''); $themeName = $this->post('theme', '');
$contentDirectory = $this->post('contentdir', ''); $contentDirectory = $this->post('contentdir', '');
$allowedThemes = FSC::$app['config']['allowedThemes']; $allowedThemes = array_keys( FSC::$app['config']['allowedThemes'] );
if (empty($themeName)) { if (empty($themeName)) {
$err = '参数不能为空!'; $err = '参数不能为空!';
return $this->renderJson(compact('code', 'msg', 'err', 'data'), $this->httpStatus['notAllowed']); return $this->renderJson(compact('code', 'msg', 'err', 'data'), $this->httpStatus['notAllowed']);
@ -779,4 +779,26 @@ Class ApiController extends Controller {
return $this->renderJson(compact('code', 'msg', 'err', 'data')); return $this->renderJson(compact('code', 'msg', 'err', 'data'));
} }
//config,获取系统配置信息
public function actionConfig() {
$code = 0;
$msg = $err = '';
$data = array();
$configs = FSC::$app['config'];
$data['version'] = $configs['version'];
$data['supportedThemes'] = $configs['allowedThemes'];
$data['currentTheme'] = $configs['theme'];
$data['admin_captcha'] = $configs['admin']['captcha'];
$data['admin_maxUploadFileSize'] = $configs['admin']['maxUploadFileSize'] * 1024*1024;
$data['admin_supportedFileTypes'] = $configs['admin']['allowedUploadFileTypes'];
$code = 1;
$msg = '';
$err = '';
return $this->renderJson(compact('code', 'msg', 'err', 'data'));
}
} }

Loading…
Cancel
Save