/phpcms/modules/admin/templates/setting.tpl.php:
在代码:
- <div id="div_setting_1" class="contentList pad-10">
- <table width="100%" class="table_form">
后面另起一行:添加代码:
- <!-- Admpub: -->
- <tr>
- <th width="120">网站状态</th>
- <td class="y-bg"><input name="setconfig[website_is_closed]" value="2" type="radio"<?php echo ($website_is_closed==2) ? ' checked="checked"' : '';?> /> 仅供管理员访问<!-- Only admin -->
- <input name="setconfig[website_is_closed]" value="1" type="radio"<?php echo ($website_is_closed==1) ? ' checked="checked"' : '';?> /> 禁止所有人访问<!-- Ban all -->
- <input name="setconfig[website_is_closed]" value="0" type="radio" <?php echo (!$website_is_closed) ? ' checked="checked"' : '';?> /> 允许所有人访问<!-- Open to all --></td>
- </tr>
- <tr>
- <th width="120">关站提示信息</th>
- <td class="y-bg"><textarea rows="2" cols="20" id="tips" style="height:40px; width:80%" name="setconfig[off_site_because]"><?php echo htmlspecialchars($off_site_because);?></textarea> 支持HTML标签</td> //Vevb.com
- </tr>
- <!-- /Admpub -->
/phpcms/modules/admin/functions/global.func.php
在set_config()函数中,在代码:
if(in_array($k,array(
后面添加:
/*[SWH|+]:*/'website_is_closed','off_site_because',/*[SWH|+];*/
/phpcms/modules/admin/setting.php:
在代码:
set_config($_POST['setconfig']);
前面另起一行,添加代码:
- //[SWH|+]:
- if(!emptyempty($_POST['setconfig']['website_is_closed'])){
- $str='<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'" /><meta http-equiv="refresh" content="1;url=index.php" /><title></title></head><body></body></html>';
- if(pc_base::load_config('system','lock_ex')){
- file_put_contents(PHPCMS_PATH.'index.html', $str, LOCK_EX);
- }else{
- file_put_contents(PHPCMS_PATH.'index.html', $str);
- }
- }
- unset($str);
- //[SWH|+];
/index.php:
在代码:pc_base::creat_app();前面另起一行,添加代码:
- //[SWH|+]:
- switch(pc_base::load_config('system','website_is_closed')){
- case '2': //仅允许后台用户访问
- $session_storage = 'session_'.pc_base::load_config('system','session_storage');
- pc_base::load_sys_class($session_storage);
- if(!emptyempty($_SESSION['userid']) && !emptyempty($_SESSION['roleid'])){
- break;
- }
- case '1': //禁止所有人访问
- if($_GET['m']=='admin'){
- break; //可以访问后台
- }
- if(pc_base::load_config('system','off_site_because')!==''){
- echo nl2br(pc_base::load_config('system','off_site_because'));
- }
- exit;
- default: //向所有公开
- }
- //[SWH|+];
/caches/configs/system.php:
在文件末尾的代码:
);?>
前面添加:
- 'website_is_closed' => '0',
- 'off_site_because' => '',
完毕.
新闻热点
疑难解答