Exemplo n.º 1
0
 function MasterObject(&$config)
 {
     if (!$config['widget_enable']) {
         $msg = 'Widget功能没有启用';
         if (get_param('in_ajax')) {
             widget_error($msg);
         } else {
             exit($msg);
         }
     }
     $this->Config = $config;
     $this->Get =& $_GET;
     $this->Post =& $_POST;
     $this->Module = get_param('mod');
     $this->Code = get_param('code');
     $this->DatabaseHandler =& Obj::registry('DatabaseHandler');
     $this->MemberHandler = jclass('member');
     $this->MemberHandler->init();
     if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
         widget_error($this->MemberHandler->GetError(), 203);
     }
     Obj::register("MemberHandler", $this->MemberHandler);
     define("FORMHASH", substr(md5(substr(time(), 0, -4) . $this->Config['auth_key']), 0, 16));
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         if ($this->Post["FORMHASH"] != FORMHASH) {
         }
     }
 }
Exemplo n.º 2
0
 function initMemberHandler()
 {
     $this->MemberHandler = jclass('member');
     $member = $this->MemberHandler->init();
     Obj::register("MemberHandler", $this->MemberHandler);
     return $member;
 }
Exemplo n.º 3
0
 function MasterObject(&$config, $auto_run = false)
 {
     if (!$config['wap']) {
         include ROOT_PATH . 'wap/include/error_wap.php';
         exit;
     }
     $this->Config = $config;
     require_once ROOT_PATH . 'wap/include/func/wap_global.func.php';
     $this->Get =& $_GET;
     $this->Post =& $_POST;
     $this->Module = get_param('mod');
     $this->Code = get_param('code');
     $this->DatabaseHandler =& Obj::registry('DatabaseHandler');
     $this->MemberHandler = jclass('member');
     $this->MemberHandler->init();
     if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
         $member_error = $this->MemberHandler->GetError();
         $member_error = array_iconv($this->Config['charset'], 'utf-8', $member_error);
         $this->Messager($member_error, null);
     }
     if (!in_array($this->Module, array('member', 'login', 'other'))) {
         $visit_rets = $this->MemberHandler->visit();
         if ($visit_rets['error']) {
             $this->Messager(null, 'index.php?mod=login&referer=' . urlencode('index.php?' . $_SERVER['QUERY_STRING']));
         }
     }
     $this->Title = $this->MemberHandler->CurrentAction['name'];
     Obj::register("MemberHandler", $this->MemberHandler);
     if ($this->auto_run || $auto_run) {
         $this->auto_run();
     }
 }
Exemplo n.º 4
0
 function TopicBbsLogic()
 {
     $this->MemberHandler =& Obj::registry("MemberHandler");
     $this->TopicLogic = jlogic('topic');
     if ($GLOBALS['_J']['config']['dzbbs_enable'] && ($config['dzbbs'] = jconf::get('dzbbs'))) {
         $this->BbsDatabase = new jishigou_mysql($config['dzbbs']['db_host'], $config['dzbbs']['db_port']);
         $this->BbsDatabase->Charset($config['dzbbs']['charset']);
         $this->BbsDatabase->doConnect($config['dzbbs']['db_user'], $config['dzbbs']['db_pass'], $config['dzbbs']['db_name'], $GLOBALS['_J']['config']['db_persist']);
         Obj::register('BbsDatabase', $this->BbsDatabase);
         define('BBS_TB_PRE', $config['dzbbs']['db_pre']);
         define('BBS_API_URL', $config['dzbbs']['db_url']);
         define('BBS_ENABLE', $config['dzbbs']['enable']);
         define('DZ_BBS_VER', $config['dzbbs']['dz_ver']);
         $this->BbsType = 'discuz';
     } elseif ($GLOBALS['_J']['config']['phpwind_enable'] && $GLOBALS['_J']['config']['pwbbs_enable']) {
         $config['phpwind'] = jconf::get('phpwind');
         $this->BbsDatabase = new jishigou_mysql($config['phpwind']['pw_db_host']);
         $this->BbsDatabase->Charset($config['phpwind']['pw_db_charset']);
         $this->BbsDatabase->doConnect($config['phpwind']['pw_db_user'], $config['phpwind']['pw_db_password'], $config['phpwind']['pw_db_name'], $GLOBALS['_J']['config']['db_persist']);
         Obj::register('BbsDatabase', $this->BbsDatabase);
         define('BBS_TB_PRE', $config['phpwind']['pw_db_table_prefix']);
         define('BBS_API_URL', $config['phpwind']['pw_api']);
         define('BBS_ENABLE', $config['phpwind']['enable']);
         $this->BbsType = 'phpwind';
     }
 }
Exemplo n.º 5
0
 function TopicCmsLogic()
 {
     $this->MemberHandler =& Obj::registry("MemberHandler");
     $this->TopicLogic = jlogic('topic');
     if ($GLOBALS['_J']['config']['dedecms_enable'] && ($config['dedecms'] = jconf::get('dedecms'))) {
         $this->CmsDatabase = new jishigou_mysql($config['dedecms']['db_host'], $config['dedecms']['db_port']);
         $this->CmsDatabase->Charset($config['dedecms']['charset']);
         $this->CmsDatabase->doConnect($config['dedecms']['db_user'], $config['dedecms']['db_pass'], $config['dedecms']['db_name'], $GLOBALS['_J']['config']['db_persist']);
         Obj::register('CmsDatabase', $this->CmsDatabase);
         define('CMS_TB_PRE', $config['dedecms']['db_pre']);
         define('CMS_API_URL', $config['dedecms']['db_url']);
         define('CMS_ENABLE', $config['dedecms']['enable']);
     }
 }
Exemplo n.º 6
0
 private function _init_user($init_user = 0)
 {
     if (($this->init_user || $init_user) && !isset($this->var['object_user'])) {
         $this->var['object_user'] = jclass('member');
         $this->var['object_user']->init();
         Obj::register('MemberHandler', $this->var['object_user']);
     }
 }
Exemplo n.º 7
0
	function initMemberHandler()
	{
		include_once LIB_PATH.'member.han.php';
		list($password,$secques,$uid)=explode("\t",authcode($this->CookieHandler->GetVar('auth'),'DECODE'));
		$this->MemberHandler=new MemberHandler($this);
		$member=$this->MemberHandler->FetchMember($uid,$password,$secques);
		Obj::register("MemberHandler",$this->MemberHandler);
		return $member;
	}
Exemplo n.º 8
0
 function MasterObject(&$config)
 {
     require_once ROOT_PATH . 'mobile/include/func/mobile.func.php';
     $config['client_type'] = '';
     $user_agent = $_SERVER['HTTP_USER_AGENT'];
     if (empty($user_agent)) {
         exit('Access Denied');
     }
     $pc_browser = false;
     if (preg_match("/android/i", $user_agent)) {
         $config['client_type'] = "android";
     } else {
         if (preg_match("/iphone/i", $user_agent)) {
             $config['client_type'] = "iphone";
         } else {
             $pc_browser = true;
         }
     }
     $config['is_mobile_client'] = false;
     if (isset($_GET['JSG_SESSION']) && isset($_GET['iv']) && isset($_GET['app_key']) && isset($_GET['app_secret']) && isset($_GET['bt'])) {
         $config['is_mobile_client'] = true;
         define("IS_MOBILE_CLIENT", true);
     }
     define("CLIENT_TYPE", $config['client_type']);
     $config['sys_version'] = sys_version();
     $config['sys_published'] = SYS_PUBLISHED;
     if (!$config['mobile_url']) {
         $config['mobile_url'] = $config['site_url'] . "/mobile";
     }
     if (!$config['topic_length']) {
         $config['topic_length'] = 140;
     }
     $this->Config = $config;
     $this->Config = array_merge($this->Config, Mobile::config());
     define("CHARSET", $this->Config['charset']);
     Obj::register('config', $this->Config);
     $this->Get =& $_GET;
     $this->Post =& $_POST;
     $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->DatabaseHandler =& Obj::registry('DatabaseHandler');
     $uid = 0;
     $password = '';
     $authcode = '';
     $implicit_pass = true;
     if (!empty($this->Get['JSG_SESSION']) && $config['is_mobile_client']) {
         $authcode = $this->Get['JSG_SESSION'];
         $authcode = rawurldecode($authcode);
         $implicit_pass = false;
     } else {
         $authcode = jsg_getcookie('auth');
     }
     if (!empty($authcode)) {
         list($password, $uid) = explode("\t", authcode($authcode, 'DECODE'));
     }
     $this->MemberHandler = jclass('member');
     $MemberFields = $this->MemberHandler->FetchMember($uid, $password);
     if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
         Mobile::show_message(411);
         exit;
     }
     if (!in_array($this->Module, array('member', 'login', 'wechat'))) {
         $visit_rets = $this->MemberHandler->visit();
         if ($visit_rets['error']) {
             Mobile::show_message(411);
             exit;
         }
     }
     $this->Title = $this->MemberHandler->CurrentAction['name'];
     Obj::register("MemberHandler", $this->MemberHandler);
     $rets = jsg_member_login_extract();
     if ($rets) {
         if (MEMBER_ID < 1) {
             $func = $rets['login_direct'];
         } else {
             $func = $rets['logout_direct'];
         }
         if ($func && function_exists($func)) {
             $ret = $func();
         }
     }
     if (MEMBER_ID > 0) {
         jsg_member_login_set_status($MemberFields);
     }
     if ($this->Config['extcredits_enable']) {
         if (MEMBER_ID > 0 && jsg_getcookie('login_credits') + 3600 < time()) {
             update_credits_by_action('login', MEMBER_ID);
             jsg_setcookie('login_credits', time(), 3600);
         }
     }
 }
Exemplo n.º 9
0
 static function &object()
 {
     static $db = null;
     if (empty($db)) {
         $db =& Obj::registry('DatabaseHandler');
         if (empty($db)) {
             include ROOT_PATH . 'setting/settings.php';
             $db = jclass('jishigou/mysql');
             $db->do_connect($config['db_host'], $config['db_port'], $config['db_user'], $config['db_pass'], $config['charset'], $config['db_name'], isset($config['db_persist']) ? $config['db_persist'] : $config['db_pconnect']);
             Obj::register('DatabaseHandler', $db);
         }
     }
     return $db;
 }
Exemplo n.º 10
0
	function MasterObject(&$config)
	{
		$config['v'] = SYS_VERSION.SYS_RELEASE;
				$this->Config=$config;		Obj::register('config',$this->Config);

				$this->ajhAuthKey = $this->Config['auth_key'] . $_SERVER['HTTP_USER_AGENT'] . '_IN_ADMIN_PANEL_' . date('Y-m-Y-m') . '_' . $this->Config['safe_key'];

				$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);

				$this->TemplateHandler = handler('template');
		Obj::register('TemplateHandler',$this->TemplateHandler);

		
		
		$this->DatabaseHandler = dbc();
		Obj::register('DatabaseHandler',$this->DatabaseHandler);
				require_once LIB_PATH . 'member.han.php';
		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);

						$access=ConfigHandler::get('access');
		if(!empty($access['ipbanned']) && preg_match("~^({$access['ipbanned']})~",$_SERVER['REMOTE_ADDR']))
		{
			$this->Messager("您的IP已经被禁止访问",null);
		}
				if(!empty($access['admincp']) && !preg_match("~^({$access['admincp']})~",$_SERVER['REMOTE_ADDR']))
		{
			$this->Messager("您当前的IP在不在后台允许的IP里,无法访问后台。",null);
		}


		if(MEMBER_ID<1)
		{
			$this->Messager("请先在前台进行<a href='index.php?mod=account&code=login'><b>登录</b></a>",null);
		}
		$this->CheckAdminPrivs();

				if(!($this->Config['close_second_verify_enable']) && $this->Module!='login')
		{
			unset($ajhAuth,$_pwd,$_uid);
			if(($ajhAuth = $this->CookieHandler->GetVar('ajhAuth'))) {
				list($_pwd,$_uid) = explode("\t",authcode($ajhAuth,'DECODE',$this->ajhAuthKey));
			}
			if (!$ajhAuth || !$_pwd || $_pwd!=$this->MemberHandler->MemberFields['password'] || $_uid < 1 || $_uid!=MEMBER_ID) {
				$this->Messager(null,'admin.php?mod=login');
			}
		}

		$this->Title=$this->MemberHandler->CurrentAction['name'];		Obj::register("MemberHandler",$this->MemberHandler);

				define("FORMHASH",substr(md5(substr(time(), 0, -7).$_SERVER['HTTP_USER_AGENT'].$_SERVER['HTTP_HOST'].$this->Config['auth_key'].date('Y-m-d')),0,16));
		if($_SERVER['REQUEST_METHOD']=="POST")
		{
			if(($this->Post['FORMHASH']!=FORMHASH || strpos($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST'])===false)) {
				$this->Messager("请求无效", null);
			}
		}

		$this->actionName();

	}
Exemplo n.º 11
0
	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);
			}
		}

	}