function MasterObject(&$config) { global $rewriteHandler; $config['v'] = SYS_VERSION.SYS_RELEASE; $this->Config=$config; Obj::register('config', $this->Config); $this->Get = &$_GET; $this->Post = &$_POST; $this->Cookie = &$_COOKIE; $this->Session = &$_SESSION; $this->Request = &$_REQUEST; $this->Server = &$_SERVER; $this->Files = &$_FILES; $this->Module = trim($this->Post['mod']?$this->Post['mod']:$this->Get['mod']); $this->Code = trim($this->Post['code']?$this->Post['code']:$this->Get['code']); $this->OPC = trim($this->Post['op']?$this->Post['op']:$this->Get['op']); if ($this->Code == '') { $this->Code = ini('settings.default_code'); } $GLOBALS['iframe'] = ''; require_once LIB_PATH . 'cookie.han.php'; $this->CookieHandler = handler('cookie'); Obj::register('CookieHandler',$this->CookieHandler); if(false == in_array($this->Module, array('downapp', 'wap')) && false === X_IS_AJAX) { if(false != ($get_ignore_jump = get('ignore_jump'))) { $this->CookieHandler->SetVar('ignore_jump', time()); } $ignore_jump = ($get_ignore_jump ? $get_ignore_jump : $this->CookieHandler->GetVar('ignore_jump')); if(false == $ignore_jump && $_SERVER['HTTP_USER_AGENT'] && false != preg_match('~(MicroMessenger|iPhone|Android|Mobile)~i', $_SERVER['HTTP_USER_AGENT'], $match)) { header('Location: index.php?mod=downapp'); } } $__navs = ConfigHandler::get('nav'); foreach ($__navs as $i => $nav) { $curClass = ''; if (strpos($nav['url'], $this->Module)>0 && strpos($nav['url'], $this->Code)>0) { $curClass = 'current'; } elseif (strpos($nav['url'], $this->Module)>0 && $this->Code === false) { $curClass = 'current'; } elseif ($this->Module=='index' && $this->Code=='' && strpos($nav['url'], 'mod')==false && strpos($nav['url'], 'code')==false && substr($nav['url'], 0, 4) != 'http') { $curClass = 'current'; } $__navs[$i]['class'] = $curClass; if ($rewriteHandler) { $__navs[$i]['url'] = $rewriteHandler->formatURL($nav['url']); } } $this->Config['__navs'] = $__navs; $this->TemplateHandler = handler('template'); Obj::register('TemplateHandler',$this->TemplateHandler); $this->DatabaseHandler = dbc(); Obj::register('DatabaseHandler',$this->DatabaseHandler); require_once LIB_PATH . 'member.han.php'; $uid = 0;$password = '';$secques = ''; if($authcode=$this->CookieHandler->GetVar('auth')) { list($password,$secques,$uid)=explode("\t",authcode($authcode,'DECODE')); } $this->MemberHandler= handler('member'); $this->MemberHandler->FetchMember($uid,$password,$secques); $this->Title=$this->MemberHandler->CurrentAction['name']; Obj::register("MemberHandler",$this->MemberHandler); $ipbanned=ConfigHandler::get('access','ipbanned'); if(!empty($ipbanned) && preg_match("~^({$ipbanned})~",$_SERVER['REMOTE_ADDR'])) { $this->Messager("您的IP已经被禁止访问。",null); } unset($ipbanned); if(MEMBER_ID<1 && (int)$this->Config['robot']['turnon']==1) { include_once LOGIC_PATH.'robot.logic.php'; $RobotLogic=new RobotLogic(); define("ROBOT_NAME",$RobotLogic->isRobot()); if(ROBOT_NAME!==false) { if ($this->Config['robot']['list'][ROBOT_NAME]['disallow']) { exit('Access Denied'); } $RobotLogic->statistic(); if(isset($this->Config['robot']['list'][ROBOT_NAME]['show_ad']) && (int)$this->Config['robot']['list'][ROBOT_NAME]['show_ad']==0) { unset($this->Config['ad']); } include_once LOGIC_PATH.'robot_log.logic.php'; $RobotLogLogic=new RobotLogLogic(ROBOT_NAME); $RobotLogLogic->statistic(); unset($RobotLogLogic); } unset($RobotLogic); } unset($this->Config['robot']); define("FORMHASH",substr(md5(substr(time(), 0, -7).$_SERVER['HTTP_HOST'].$this->Config['auth_key'].$_SERVER['HTTP_USER_AGENT']),0,16)); if($_SERVER['REQUEST_METHOD']=="POST" && $this->Module!='callback' && $this->Module!='misc' && $this->Module!='upload' && $this->Module!='address') { if($this->Post["FORMHASH"]!=FORMHASH || strpos($_SERVER["HTTP_REFERER"],$_SERVER["HTTP_HOST"])===false) { X_IS_AJAX || $this->Messager("请求无效",null); } } }