System.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <?php
  2. namespace app\admin\controller;
  3. use think\Db;
  4. use think\Config;
  5. use think\Cache;
  6. use think\View;
  7. class System extends Base
  8. {
  9. public function test_email()
  10. {
  11. $post = input();
  12. $conf = [
  13. 'host' => $post['host'],
  14. 'username' => $post['username'],
  15. 'password' => $post['password'],
  16. 'port' => $post['port'],
  17. 'nick' => $post['nick'],
  18. 'test' => $post['test'],
  19. ];
  20. $this->label_maccms();
  21. $res = mac_send_mail($conf['test'], $GLOBALS['config']['email']['tpl']['test_title'], $GLOBALS['config']['email']['tpl']['test_body'], $conf);
  22. if ($res['code']==1) {
  23. return json(['code' => 1, 'msg' => lang('test_ok')]);
  24. }
  25. return json(['code' => 1001, 'msg' => lang('test_err').':'.$res['msg']]);
  26. }
  27. public function test_cache()
  28. {
  29. $param = input();
  30. if (!isset($param['type']) || empty($param['host']) || empty($param['port'])) {
  31. return $this->error(lang('param_err'));
  32. }
  33. $options = [
  34. 'type' => $param['type'],
  35. 'port' => $param['port'],
  36. 'username' => $param['username'],
  37. 'password' => $param['password']
  38. ];
  39. $hd = Cache::connect($options);
  40. $hd->set('test', 'test');
  41. return json(['code' => 1, 'msg' => lang('test_ok')]);
  42. }
  43. public function config()
  44. {
  45. if (Request()->isPost()) {
  46. $config = input();
  47. $validate = \think\Loader::validate('Token');
  48. if(!$validate->check($config)){
  49. return $this->error($validate->getError());
  50. }
  51. unset($config['__token__']);
  52. $ads_dir='ads';
  53. $mob_ads_dir='ads';
  54. $path = ROOT_PATH .'template/'.$config['site']['template_dir'].'/info.ini';
  55. $cc = Config::load($path,'ini');
  56. if(!empty($cc['adsdir'])){
  57. $ads_dir = $cc['adsdir'];
  58. }
  59. $path = ROOT_PATH .'template/'.$config['site']['mob_template_dir'].'/info.ini';
  60. $cc = Config::load($path,'ini');
  61. if(!empty($cc['adsdir'])){
  62. $mob_ads_dir = $cc['adsdir'];
  63. }
  64. $config['site']['ads_dir'] = $ads_dir;
  65. $config['site']['mob_ads_dir'] = $mob_ads_dir;
  66. if(empty($config['app']['cache_flag'])){
  67. $config['app']['cache_flag'] = substr(md5(time()),0,10);
  68. }
  69. $config['app']['search_vod_rule'] = join('|', $config['app']['search_vod_rule']);
  70. $config['app']['search_art_rule'] = join('|', $config['app']['search_art_rule']);
  71. $config['extra'] = [];
  72. if(!empty($config['app']['extra_var'])){
  73. $extra_var = str_replace(array(chr(10),chr(13)), array('','#'),$config['app']['extra_var']);
  74. $tmp = explode('#',$extra_var);
  75. foreach($tmp as $a){
  76. if(strpos($a,'$$$')!==false){
  77. $tmp2 = explode('$$$',$a);
  78. $config['extra'][$tmp2[0]] = $tmp2[1];
  79. }
  80. }
  81. unset($tmp,$tmp2);
  82. }
  83. $config_new['site'] = $config['site'];
  84. $config_new['app'] = $config['app'];
  85. $config_new['extra'] = $config['extra'];
  86. $config_old = config('maccms');
  87. $config_new = array_merge($config_old, $config_new);
  88. $tj = $config_new['site']['site_tj'];
  89. if(strpos($tj,'document.w') ===false){
  90. $tj = 'document.write(\'' . str_replace("'","\'",$tj) . '\')';
  91. }
  92. $res = @fwrite(fopen('./static/js/tj.js', 'wb'), $tj);
  93. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  94. if ($res === false) {
  95. return $this->error(lang('save_err'));
  96. }
  97. return $this->success(lang('save_ok'));
  98. }
  99. $templates = glob('./template' . '/*', GLOB_ONLYDIR);
  100. foreach ($templates as $k => &$v) {
  101. $v = str_replace('./template/', '', $v);
  102. }
  103. $this->assign('templates', $templates);
  104. $langs = glob('./application/lang/*.php');
  105. foreach ($langs as $k => &$v) {
  106. $v = str_replace(['./application/lang/','.php'],['',''],$v);
  107. }
  108. $this->assign('langs', $langs);
  109. $usergroup = Db::name('group')->select();
  110. $this->assign('usergroup', $usergroup);
  111. $editors = mac_extends_list('editor');
  112. $this->assign('editors',$editors);
  113. $config = config('maccms');
  114. $this->assign('config', $config);
  115. $this->assign('title', lang('admin/system/config/title'));
  116. return $this->fetch('admin@system/config');
  117. }
  118. public function configurl()
  119. {
  120. if (Request()->isPost()) {
  121. $config = input();
  122. $config_new['view'] = $config['view'];
  123. $config_new['path'] = $config['path'];
  124. $config_new['rewrite'] = $config['rewrite'];
  125. //写路由规则文件
  126. $route = [];
  127. $route['__pattern__'] = [
  128. 'id'=>'[\s\S]*?',
  129. 'ids'=>'[\s\S]*?',
  130. 'wd' => '[\s\S]*',
  131. 'en'=>'[\s\S]*?',
  132. 'state' => '[\s\S]*?',
  133. 'area' => '[\s\S]*',
  134. 'year'=>'[\s\S]*?',
  135. 'lang' => '[\s\S]*?',
  136. 'letter'=>'[\s\S]*?',
  137. 'actor' => '[\s\S]*?',
  138. 'director' => '[\s\S]*?',
  139. 'tag' => '[\s\S]*?',
  140. 'class' => '[\s\S]*?',
  141. 'order'=>'[\s\S]*?',
  142. 'by'=>'[\s\S]*?',
  143. 'file'=>'[\s\S]*?',
  144. 'name'=>'[\s\S]*?',
  145. 'url'=>'[\s\S]*?',
  146. 'type'=>'[\s\S]*?',
  147. 'sex' => '[\s\S]*?',
  148. 'version' => '[\s\S]*?',
  149. 'blood' => '[\s\S]*?',
  150. 'starsign' => '[\s\S]*?',
  151. 'page'=>'\d+',
  152. 'ajax'=>'\d+',
  153. 'tid'=>'\d+',
  154. 'mid'=>'\d+',
  155. 'rid'=>'\d+',
  156. 'pid'=>'\d+',
  157. 'sid'=>'\d+',
  158. 'nid'=>'\d+',
  159. 'uid'=>'\d+',
  160. 'level'=>'\d+',
  161. 'score'=>'\d+',
  162. 'limit'=>'\d+',
  163. ];
  164. $rows = explode(chr(13), str_replace(chr(10), '', $config['rewrite']['route']));
  165. foreach ($rows as $r) {
  166. if (strpos($r, '=>') !== false) {
  167. $a = explode('=>', $r);
  168. $rule = [];
  169. if (strpos($a, ':id') !== false) {
  170. //$rule['id'] = '\w+';
  171. }
  172. $route[trim($a[0])] = [trim($a[1]), [], $rule];
  173. }
  174. }
  175. $res = mac_arr2file(APP_PATH . 'route.php', $route);
  176. if ($res === false) {
  177. return $this->error(lang('write_err_route'));
  178. }
  179. //写扩展配置
  180. $config_old = config('maccms');
  181. $config_new = array_merge($config_old, $config_new);
  182. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  183. if ($res === false) {
  184. return $this->error(lang('write_err_config'));
  185. }
  186. return $this->success(lang('save_ok'));
  187. }
  188. $this->assign('config', config('maccms'));
  189. $this->assign('title', lang('admin/system/configurl/title'));
  190. return $this->fetch('admin@system/configurl');
  191. }
  192. public function configuser()
  193. {
  194. if (Request()->isPost()) {
  195. $config = input();
  196. $validate = \think\Loader::validate('Token');
  197. if(!$validate->check($config)){
  198. return $this->error($validate->getError());
  199. }
  200. unset($config['__token__']);
  201. $config_new['user'] = $config['user'];
  202. $config_old = config('maccms');
  203. $config_new = array_merge($config_old, $config_new);
  204. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  205. if ($res === false) {
  206. return $this->error(lang('save_err'));
  207. }
  208. return $this->success(lang('save_ok'));
  209. }
  210. $this->assign('config', config('maccms'));
  211. $this->assign('title', lang('admin/system/configuser/title'));
  212. return $this->fetch('admin@system/configuser');
  213. }
  214. public function configupload()
  215. {
  216. if (Request()->isPost()){
  217. $config = input();
  218. $config_new['upload'] = $config['upload'];
  219. $config_old = config('maccms');
  220. $config_new = array_merge($config_old, $config_new);
  221. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  222. if ($res === false) {
  223. return $this->error(lang('save_err'));
  224. }
  225. return $this->success(lang('save_ok'));
  226. }
  227. $this->assign('config', config('maccms'));
  228. $extends = mac_extends_list('upload');
  229. $this->assign('extends',$extends);
  230. $this->assign('title', lang('admin/system/configupload/title'));
  231. return $this->fetch('admin@system/configupload');
  232. }
  233. public function configcomment()
  234. {
  235. if (Request()->isPost()) {
  236. $config = input();
  237. $config_new['gbook'] = $config['gbook'];
  238. $config_new['comment'] = $config['comment'];
  239. $config_old = config('maccms');
  240. $config_new = array_merge($config_old, $config_new);
  241. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  242. if ($res === false) {
  243. return $this->error(lang('save_err'));
  244. }
  245. return $this->success(lang('save_ok'));
  246. }
  247. $this->assign('config', config('maccms'));
  248. $this->assign('title', lang('admin/system/configcomment/title'));
  249. return $this->fetch('admin@system/configcomment');
  250. }
  251. public function configweixin()
  252. {
  253. if (Request()->isPost()) {
  254. $config = input();
  255. $config_new['weixin'] = $config['weixin'];
  256. $config_old = config('maccms');
  257. $config_new = array_merge($config_old, $config_new);
  258. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  259. if ($res === false) {
  260. return $this->error(lang('save_err'));
  261. }
  262. return $this->success(lang('save_ok'));
  263. }
  264. $this->assign('config', config('maccms'));
  265. $this->assign('title', lang('admin/system/configweixin/title'));
  266. return $this->fetch('admin@system/configweixin');
  267. }
  268. public function configpay()
  269. {
  270. if (Request()->isPost()) {
  271. $config = input();
  272. $config_new['pay'] = $config['pay'];
  273. $config_old = config('maccms');
  274. $config_new = array_merge($config_old, $config_new);
  275. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  276. if ($res === false) {
  277. return $this->error(lang('save_err'));
  278. }
  279. return $this->success(lang('save_ok'));
  280. }
  281. $this->assign('http_type',$GLOBALS['http_type']);
  282. $this->assign('config', config('maccms'));
  283. $extends = mac_extends_list('pay');
  284. $this->assign('extends',$extends);
  285. $this->assign('title', lang('admin/system/configpay/title'));
  286. return $this->fetch('admin@system/configpay');
  287. }
  288. public function configconnect()
  289. {
  290. if (Request()->isPost()) {
  291. $config = input();
  292. $config_new['connect'] = $config['connect'];
  293. $config_old = config('maccms');
  294. $config_new = array_merge($config_old, $config_new);
  295. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  296. if ($res === false) {
  297. return $this->error(lang('save_err'));
  298. }
  299. return $this->success(lang('save_ok'));
  300. }
  301. $this->assign('config', config('maccms'));
  302. $this->assign('title', lang('admin/system/configconnect/title'));
  303. return $this->fetch('admin@system/configconnect');
  304. }
  305. public function configemail()
  306. {
  307. if (Request()->isPost()) {
  308. $config = input();
  309. $config_new['email'] = $config['email'];
  310. $config_old = config('maccms');
  311. $config_new = array_merge($config_old, $config_new);
  312. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  313. if ($res === false) {
  314. return $this->error(lang('save_err'));
  315. }
  316. return $this->success(lang('save_ok'));
  317. }
  318. $this->assign('config', config('maccms'));
  319. $extends = mac_extends_list('email');
  320. $this->assign('extends',$extends);
  321. $this->assign('title', lang('admin/system/configemail/title'));
  322. return $this->fetch('admin@system/configemail');
  323. }
  324. public function configsms()
  325. {
  326. if (Request()->isPost()) {
  327. $config = input();
  328. $config_new['sms'] = $config['sms'];
  329. $config_old = config('maccms');
  330. $config_new = array_merge($config_old, $config_new);
  331. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  332. if ($res === false) {
  333. return $this->error(lang('save_err'));
  334. }
  335. return $this->success(lang('save_ok'));
  336. }
  337. $extends = mac_extends_list('sms');
  338. $this->assign('extends',$extends);
  339. $this->assign('config', config('maccms'));
  340. $this->assign('title', lang('admin/system/configsms/title'));
  341. return $this->fetch('admin@system/configsms');
  342. }
  343. public function configapi()
  344. {
  345. if (Request()->isPost()) {
  346. $config = input();
  347. $config_new['api'] = $config['api'];
  348. $config_new['api']['vod']['auth'] = mac_replace_text($config_new['api']['vod']['auth'], 2);
  349. $config_new['api']['art']['auth'] = mac_replace_text($config_new['api']['art']['auth'], 2);
  350. $config_new['api']['actor']['auth'] = mac_replace_text($config_new['api']['actor']['auth'], 2);
  351. $config_old = config('maccms');
  352. $config_new = array_merge($config_old, $config_new);
  353. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  354. if ($res === false) {
  355. return $this->error(lang('save_err'));
  356. }
  357. return $this->success(lang('save_ok'));
  358. }
  359. $this->assign('config', config('maccms'));
  360. $this->assign('title', lang('admin/system/configapi/title'));
  361. return $this->fetch('admin@system/configapi');
  362. }
  363. public function configinterface()
  364. {
  365. if (Request()->isPost()) {
  366. $config = input();
  367. $validate = \think\Loader::validate('Token');
  368. if(!$validate->check($config)){
  369. return $this->error($validate->getError());
  370. }
  371. unset($config['__token__']);
  372. if($config['interface']['status']==1 && strlen($config['interface']['pass']) < 16){
  373. return $this->error(lang('admin/system/configinterface/pass_check'));
  374. }
  375. $config_new['interface'] = $config['interface'];
  376. $config_new['interface']['vodtype'] = mac_replace_text($config_new['interface']['vodtype'], 2);
  377. $config_new['interface']['arttype'] = mac_replace_text($config_new['interface']['arttype'], 2);
  378. $config_old = config('maccms');
  379. $config_new = array_merge($config_old, $config_new);
  380. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  381. if ($res === false) {
  382. return $this->error(lang('save_err'));
  383. }
  384. //保存缓存
  385. mac_interface_type();
  386. return $this->success(lang('save_ok'));
  387. }
  388. $this->assign('config', config('maccms'));
  389. $this->assign('title', lang('admin/system/configinterface/title'));
  390. return $this->fetch('admin@system/configinterface');
  391. }
  392. public function configcollect()
  393. {
  394. if (Request()->isPost()) {
  395. $config = input();
  396. $config_new['collect'] = $config['collect'];
  397. if (empty($config_new['collect']['vod']['inrule'])) {
  398. $config_new['collect']['vod']['inrule'] = ['a'];
  399. }
  400. if (empty($config_new['collect']['vod']['uprule'])) {
  401. $config_new['collect']['vod']['uprule'] = [];
  402. }
  403. if (empty($config_new['collect']['art']['inrule'])) {
  404. $config_new['collect']['art']['inrule'] = ['a'];
  405. }
  406. if (empty($config_new['collect']['art']['uprule'])) {
  407. $config_new['collect']['art']['uprule'] = [];
  408. }
  409. if (empty($config_new['collect']['actor']['inrule'])) {
  410. $config_new['collect']['actor']['inrule'] = ['a'];
  411. }
  412. if (empty($config_new['collect']['actor']['uprule'])) {
  413. $config_new['collect']['actor']['uprule'] = [];
  414. }
  415. if (empty($config_new['collect']['role']['inrule'])) {
  416. $config_new['collect']['role']['inrule'] = ['a'];
  417. }
  418. if (empty($config_new['collect']['role']['uprule'])) {
  419. $config_new['collect']['role']['uprule'] = [];
  420. }
  421. if (empty($config_new['collect']['website']['inrule'])) {
  422. $config_new['collect']['website']['inrule'] = ['a'];
  423. }
  424. if (empty($config_new['collect']['website']['uprule'])) {
  425. $config_new['collect']['website']['uprule'] = [];
  426. }
  427. if (empty($config_new['collect']['comment']['inrule'])) {
  428. $config_new['collect']['comment']['inrule'] = ['a'];
  429. }
  430. if (empty($config_new['collect']['comment']['uprule'])) {
  431. $config_new['collect']['comment']['uprule'] = [];
  432. }
  433. $config_new['collect']['vod']['inrule'] = ',' . join(',', $config_new['collect']['vod']['inrule']);
  434. $config_new['collect']['vod']['uprule'] = ',' . join(',', $config_new['collect']['vod']['uprule']);
  435. $config_new['collect']['art']['inrule'] = ',' . join(',', $config_new['collect']['art']['inrule']);
  436. $config_new['collect']['art']['uprule'] = ',' . join(',', $config_new['collect']['art']['uprule']);
  437. $config_new['collect']['actor']['inrule'] = ',' . join(',', $config_new['collect']['actor']['inrule']);
  438. $config_new['collect']['actor']['uprule'] = ',' . join(',', $config_new['collect']['actor']['uprule']);
  439. $config_new['collect']['role']['inrule'] = ',' . join(',', $config_new['collect']['role']['inrule']);
  440. $config_new['collect']['role']['uprule'] = ',' . join(',', $config_new['collect']['role']['uprule']);
  441. $config_new['collect']['website']['inrule'] = ',' . join(',', $config_new['collect']['website']['inrule']);
  442. $config_new['collect']['website']['uprule'] = ',' . join(',', $config_new['collect']['website']['uprule']);
  443. $config_new['collect']['comment']['inrule'] = ',' . join(',', $config_new['collect']['comment']['inrule']);
  444. $config_new['collect']['comment']['uprule'] = ',' . join(',', $config_new['collect']['comment']['uprule']);
  445. $config_new['collect']['vod']['namewords'] = mac_replace_text($config_new['collect']['vod']['namewords'], 2);
  446. $config_new['collect']['vod']['thesaurus'] = mac_replace_text($config_new['collect']['vod']['thesaurus'], 2);
  447. $config_new['collect']['vod']['words'] = mac_replace_text($config_new['collect']['vod']['words'], 2);
  448. $config_new['collect']['art']['thesaurus'] = mac_replace_text($config_new['collect']['art']['thesaurus'], 2);
  449. $config_new['collect']['art']['words'] = mac_replace_text($config_new['collect']['art']['words'], 2);
  450. $config_new['collect']['actor']['thesaurus'] = mac_replace_text($config_new['collect']['actor']['thesaurus'], 2);
  451. $config_new['collect']['actor']['words'] = mac_replace_text($config_new['collect']['actor']['words'], 2);
  452. $config_new['collect']['role']['thesaurus'] = mac_replace_text($config_new['collect']['role']['thesaurus'], 2);
  453. $config_new['collect']['role']['words'] = mac_replace_text($config_new['collect']['role']['words'], 2);
  454. $config_new['collect']['website']['thesaurus'] = mac_replace_text($config_new['collect']['website']['thesaurus'], 2);
  455. $config_new['collect']['website']['words'] = mac_replace_text($config_new['collect']['website']['words'], 2);
  456. $config_new['collect']['comment']['thesaurus'] = mac_replace_text($config_new['collect']['comment']['thesaurus'], 2);
  457. $config_new['collect']['comment']['words'] = mac_replace_text($config_new['collect']['comment']['words'], 2);
  458. $config_old = config('maccms');
  459. $config_new = array_merge($config_old, $config_new);
  460. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  461. if ($res === false) {
  462. return $this->error(lang('save_err'));
  463. }
  464. return $this->success(lang('save_ok'));
  465. }
  466. $this->assign('config', config('maccms'));
  467. $this->assign('title', lang('admin/system/configcollect/title'));
  468. return $this->fetch('admin@system/configcollect');
  469. }
  470. public function configplay()
  471. {
  472. if (Request()->isPost()) {
  473. $config = input();
  474. $validate = \think\Loader::validate('Token');
  475. if(!$validate->check($config)){
  476. return $this->error($validate->getError());
  477. }
  478. unset($config['__token__']);
  479. $config_new['play'] = $config['play'];
  480. $config_old = config('maccms');
  481. $config_new = array_merge($config_old, $config_new);
  482. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  483. if ($res === false) {
  484. return $this->error(lang('save_err'));
  485. }
  486. $path = './static/js/playerconfig.js';
  487. if (!file_exists($path)) {
  488. $path .= '.bak';
  489. }
  490. $fc = @file_get_contents($path);
  491. $jsb = mac_get_body($fc, '//参数开始', '//参数结束');
  492. $content = 'MacPlayerConfig=' . json_encode($config['play']) . ';';
  493. $fc = str_replace($jsb, "\r\n" . $content . "\r\n", $fc);
  494. $res = @fwrite(fopen('./static/js/playerconfig.js', 'wb'), $fc);
  495. if ($res === false) {
  496. return $this->error(lang('save_err'));
  497. }
  498. return $this->success(lang('save_ok'));
  499. }
  500. $fp = './static/js/playerconfig.js';
  501. if (!file_exists($fp)) {
  502. $fp .= '.bak';
  503. }
  504. $fc = file_get_contents($fp);
  505. $jsb = trim(mac_get_body($fc, '//参数开始', '//参数结束'));
  506. $jsb = substr($jsb, 16, strlen($jsb) - 17);
  507. $play = json_decode($jsb, true);
  508. $this->assign('play', $play);
  509. $this->assign('title', lang('admin/system/configplay/title'));
  510. return $this->fetch('admin@system/configplay');
  511. }
  512. public function configseo()
  513. {
  514. if (Request()->isPost()) {
  515. $config = input();
  516. $validate = \think\Loader::validate('Token');
  517. if(!$validate->check($config)){
  518. return $this->error($validate->getError());
  519. }
  520. unset($config['__token__']);
  521. $config_new['seo'] = $config['seo'];
  522. $config_old = config('maccms');
  523. $config_new = array_merge($config_old, $config_new);
  524. $res = mac_arr2file(APP_PATH . 'extra/maccms.php', $config_new);
  525. if ($res === false) {
  526. return $this->error(lang('save_err'));
  527. }
  528. return $this->success(lang('save_ok'));
  529. }
  530. $this->assign('config', config('maccms'));
  531. $this->assign('title', lang('admin/system/configseo/title'));
  532. return $this->fetch('admin@system/configseo');
  533. }
  534. }