コード例 #1
0
ファイル: master.mod.php プロジェクト: pf5512/phpstudy
	function Messager($message, $redirectto='',$time = 2,$return_msg=false,$js=null)
	{
		global $rewriteHandler,$__is_messager;
		$__is_messager=true;
		$this->MemberHandler->SaveActionToLog($this->Title);
		$to_title=($redirectto==='' or $redirectto==-1)?"返回上一页":"跳转到指定页面";
		if($redirectto===null)
		{
			$return_msg=$return_msg===false?" ":$return_msg;
		}
		else
		{
			$redirectto=($redirectto!=='')?$redirectto:($from_referer=referer());
			
			if (is_numeric($redirectto)!==false and $redirectto!==0)
			{
				if($time!==null){
					$url_redirect="<script language=\"JavaScript\" type=\"text/javascript\">\r\n";
					$url_redirect.=sprintf("window.setTimeout(\"history.go(%s)\",%s);\r\n",$redirectto,$time*1000);
					$url_redirect.="</script>\r\n";
				}
				$redirectto="javascript:history.go({$redirectto})";
			}
			else
			{
				if($rewriteHandler)
				{
					
					$redirectto = rewrite($redirectto);
				}
				if($message===null)
				{
					$redirectto=rawurldecode(HttpHandler::UnCleanVal(($redirectto)));
					header("Location: $redirectto"); #HEADER跳转
				}
				if($time!==null)
				{
					$url_redirect = $redirectto?'<meta http-equiv="refresh" content="' . $time . '; URL=' . $redirectto . '">':null;
				}
			}
		}
		$title="消息提示:".(is_array($message)?implode(',',$message):$message);

		$title=strip_tags($title);
		if($js!="")$js="<script language=\"JavaScript\" type=\"text/javascript\">{$js}</script>";
		$this->ShowHeader($title,array(),$url_redirect.$js);
		include_once handler('template')->file('@admin/messager');
		$this->ShowFooter();
		exit;
	}
コード例 #2
0
ファイル: setting.mod.php プロジェクト: pf5512/phpstudy
	function DoModifyNormal()
	{
		$this->CheckAdminPrivs('siteset');
		if($this->Post['site_enable']) {
			$this->IoHandler->WriteFile(CACHE_PATH . './site_enable.php',$this->Post['site_enable']);
		} else {
			@is_file(CACHE_PATH . './site_enable.php') && $this->IoHandler->DeleteFile(CACHE_PATH . './site_enable.php');
		}
		unset($this->Post['site_enable']);

		if($this->Post['user_forbid']) {
			$forbid_list = explode("\r\n",$this->Post['user_forbid']);
			$forbid_list = array_unique($forbid_list);
			$forbid = implode("\r\n",$forbid_list);
			$configHandler = new ConfigHandler();
			$configHandler->set('user',array('forbid'=>$forbid));
		}
		unset($this->Post['user_forbid']);
		extract($this->Post['config']);
		if($site_name=="")
		{
			$this->Messager("修改出现错误,站点名称不能为空");
		}
		if (!$_FILES['config']['error']['site_logo']) {
			$this->Post['config']['site_logo'] = IMAGE_PATH . 'site_logo.gif';
			if(!move_uploaded_file($_FILES['config']['tmp_name']['site_logo'],$this->Post['config']['site_logo'])) {
				@copy($_FILES['config']['tmp_name']['site_logo'],$this->Post['config']['site_logo']);
			}
			if (!is_file($this->Post['config']['site_logo'])) {
				unset($this->Post['config']['site_logo']);
			}
		}

		$this->Post['config']['thumbwidth'] = min(300,max(30,(int) $this->Post['config']['thumbwidth']));
		$this->Post['config']['thumbheight'] = min(300,max(30,(int) $this->Post['config']['thumbheight']));
		$this->Post['config']['watermark_position'] = (int) $this->Post['config']['watermark_position'];
		$this->Post['config']['tuangou_str'] = strip_tags(trim($this->Post['config']['tuangou_str']));

		include(CONFIG_PATH.'settings.php');


		$new_config=array_merge($config['settings'],$this->Post['config']);
		ksort($new_config);
		$new_config['copyright']=HttpHandler::UnCleanVal($new_config['copyright']);
		$new_config['tongji']=HttpHandler::UnCleanVal($new_config['tongji']);
		$result = ini('settings', $new_config);
		if($result!=false)
		{
			$this->Messager("配置修改成功");
		}
		else
		{
			$this->Messager("配置修改失败");
		}

	}
コード例 #3
0
ファイル: master.mod.php プロジェクト: pf5512/phpstudy
	function Messager($message, $redirectto='',$time = -1,$return_msg=false,$js=null)
	{
		global $rewriteHandler;
		if ($time==-1)$time=is_numeric($this->Config['msg_time'])?$this->Config['msg_time']:2;
		if($this->MemberHandler)$this->MemberHandler->SaveActionToLog($this->Title);
		$to_title=($redirectto==='' or $redirectto==-1)?"返回上一页":"跳转到指定页面";
		if($redirectto===null)
		{
			$return_msg=$return_msg===false?"&nbsp;":$return_msg;
		}
		else
		{
			$redirectto=($redirectto!=='')?$redirectto:($from_referer=referer());
			
			if (is_numeric($redirectto)!==false and $redirectto!==0)
			{
				if($time!==null){
					$url_redirect="<script language=\"JavaScript\" type=\"text/javascript\">\r\n";
					$url_redirect.=sprintf("window.setTimeout(\"history.go(%s)\",%s);\r\n",$redirectto,$time*1000);
					$url_redirect.="</script>\r\n";
				}
				$redirectto="javascript:history.go({$redirectto})";
			}
			else
			{
				if($rewriteHandler)
				{
					
					$redirectto = rewrite($redirectto);
				}
				else
				{
					if ($redirectto != '' && substr($redirectto, 0, 1) == '?')
					{
						$redirectto = $this->Config['site_url'].'/'.$redirectto;
					}
				}
				if($message===null)
				{
					$redirectto=rawurldecode(HttpHandler::UnCleanVal(($redirectto)));
					header("Location: $redirectto"); #HEADER跳转
				}
				if($time!==null)
				{
					$url_redirect = $redirectto?'<meta http-equiv="refresh" content="' . $time . '; URL=' . $redirectto . '">':null;
				}
			}
		}
		$title="消息提示:".(is_array($message)?implode(',',$message):$message);

		$title=strip_tags($title);
		if($js!="") {
			$js="<script language=\"JavaScript\" type=\"text/javascript\">{$js}</script>";
		}
		$additional_str = $url_redirect.$js;

		include_once $this->TemplateHandler->Template('messager');
		exit;
	}