|
/**
* 时间段设置检测
* @param $periods - 那种时间段 $settings[$periods] $settings['postbanperiods'] $settings['postmodperiods']
* @param $showmessage - 是否提示信息
* @return 返回检查结果
*/
function periodscheck($periods, $showmessage = 1) {
global $_G;
if(($periods == 'postmodperiods' || $periods == 'postbanperiods') && ($_G['setting']['postignorearea'] || $_G['setting']['postignoreip'])) {
if($_G['setting']['postignoreip']) {
foreach(explode("\n", $_G['setting']['postignoreip']) as $ctrlip) {
if(preg_match("/^(".preg_quote(($ctrlip = trim($ctrlip)), '/').")/", $_G['clientip'])) {
return false;
break;
}
}
}
if($_G['setting']['postignorearea']) {
$location = $whitearea = '';
require_once libfile('function/misc');
$location = trim(convertip($_G['clientip'], "./"));
if($location) {
$whitearea = preg_quote(trim($_G['setting']['postignorearea']), '/');
$whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
$whitearea = '.*'.$whitearea.'.*';
$whitearea = '/^('.str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea).')$/i';
if(@preg_match($whitearea, $location)) {
return false;
}
}
}
}
if(!$_G['group']['disableperiodctrl'] && $_G['setting'][$periods]) {
$now = dgmdate(TIMESTAMP, 'G.i', $_G['setting']['timeoffset']);
foreach(explode("\r\n", str_replace(':', '.', $_G['setting'][$periods])) as $period) {
list($periodbegin, $periodend) = explode('-', $period);
if(($periodbegin > $periodend && ($now >= $periodbegin || $now < $periodend)) || ($periodbegin < $periodend && $now >= $periodbegin && $now < $periodend)) {
$banperiods = str_replace("\r\n", ', ', $_G['setting'][$periods]);
if($showmessage) {
showmessage('period_nopermission', NULL, array('banperiods' => $banperiods), array('login' => 1));
} else {
return TRUE;
}
}
}
}
return FALSE;
}
|
获得 花仙子卡 一张
卡片说明:君山 遇到 [斯文的小言] 被赠与 1 铜钥匙.
卡片效果:获得 1 铜钥匙
|