⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cms_site.class.inc

📁 国外很不错的一个开源OA系统Group-Office
💻 INC
📖 第 1 页 / 共 5 页
字号:
<?php/*Copyright Intermesh 2003Author: Merijn Schering <mschering@intermesh.nl>Version: 1.0 Release date: 08 July 2003This program is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation; either version 2 of the License, or (at youroption) any later version.*/require_once($GO_MODULES->modules['cms']['class_path'].'cms.class.inc');load_basic_controls();load_control('date_picker');class cms_site extends cms {	var $site;	var $template;	var $publish_url;	var $publish_path;	var $publish_static = false;	var $template_file_replacements = array ();	var $folder_id;	var $file_id;	var $task;	var $cms_module;	var $return_to;			var $previous_file=null;	var $next_file=null;	var $tags = array (	'php', //important as first tag so it can produce tags that will be processed	'template',	'home',	'folders',	'rootfolders',	'files',	'path',	'icon',	'login',	'back',	'active_doc',	'document',	'folderlist',	'hot_items',	'languages',	'items',	'menu',	'treeview',	'filename',	'admin',	'logout',	'nextfile',	'previousfile'	);	function cms_site() {		global $GO_CONFIG, $GO_LANGUAGE, $GO_MODULES;		$this->db();		$this->folder_id = isset ($_REQUEST['folder_id']) ? $_REQUEST['folder_id'] : 0;		$this->file_id = isset ($_REQUEST['file_id']) ? $_REQUEST['file_id'] : 0;		$this->task = isset ($_REQUEST['task']) ? $_REQUEST['task'] : '';		$this->cms_module = $GO_MODULES->get_module('cms');		if($this->task=='logout')		{			global $GO_SECURITY;			$GO_SECURITY->logout();		}		$site_id = isset ($_REQUEST['site_id']) ? $_REQUEST['site_id'] : 0;		//If a site_id was passed then get it		if ($site_id > 0) {			$this->site = $this->get_site($site_id);		}else		{			/*			if no site_id was passed then we are not in Group-Office but somebody is			requesting the site through a domain. Try to get the site by domain.			Get the domain name without this page eg.			http://www.test.com/test/index.php?file_id=0&folder_id=9 becomes:			www.test.com/test			*/			$domain = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];			if (strpos($domain, basename($_SERVER['PHP_SELF'])) !== false) {				//chop off filename				$pos = strrpos($domain, '/');				if ($pos !== false) {					$domain = substr($domain, 0, $pos);				}			}			if (!$this->site = $this->get_site_by_domain($domain, true)) {				exit();			}		}		$this->template = $this->get_template($this->site['template_id']);		if(isset($_SESSION['GO_SESSION']['cms']['return_to']) && $_SESSION['GO_SESSION']['cms']['return_to'] != $this->get_uri())		{			$this->return_to = $_SESSION['GO_SESSION']['cms']['return_to'];		}else {			$this->return_to = $this->create_url($this->site['root_folder_id']);		}		//$_SESSION['GO_SESSION']['cms']['return_to']=$_SERVER['REQUEST_URI'];		$_SESSION['GO_SESSION']['cms']['return_to']=$this->get_uri();		$GLOBALS['GO_LANGUAGE']->set_language($this->site['language']);	}	function get_uri()	{		$uri = $_SERVER['PHP_SELF'].'?file_id='.$this->file_id.'&amp;folder_id='.$this->folder_id;		return $uri;	}	function get_login_uri($goto_url='')	{		$uri = add_params_to_url($this->get_uri(), 'task=login&amp;goto_url='.urlencode($goto_url));		return $uri;	}	function find_page($folder_id)	{		global $GO_SECURITY;		if($folder_id==0)		{			$folder_id=$this->site['root_folder_id'];		}		$files = $this->get_authorized_files($folder_id, $GO_SECURITY->user_id);				foreach($files as $file)		{			if (eregi('htm', $file['extension'])) {				return $file['id'];			}		}		$folders = $this->get_authorized_folders($folder_id, $GO_SECURITY->user_id);		if(!count($folders))		{			$folder = $this->get_folder($folder_id);			if(!$folder)			{				$folder_id=$this->site['root_folder_id'];			}else {				if($folder['parent_id']>0)				{					return $this->find_page($folder['parent_id']);				}			}		}		foreach($folders as $folder)		{			return $this->find_page($folder['id']);		}		return false;	}	function generate_header($doctype='', $title = '', $keywords = '', $description = '', $header_arguments='', $body_arguments='') {		global $GO_CONFIG, $charset;		$header = $doctype."\r\n".		'<html>'."\r\n".		'<head>'."\r\n".		'<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />'."\r\n".		'<meta name="robots" content="all,index,follow" />'."\r\n".		'<meta name="revisit-after" content="7 days" />'."\r\n".		'<meta name="keywords" content="'.$keywords.'" />'."\r\n".		'<meta name="description" content="'.$description.'" />'."\r\n".		'<meta name="Generator" content="Group-Office '.$GO_CONFIG->version.'" />'."\r\n".		'<title>'.$title.'</title>'."\r\n".		'<link href="'.$this->cms_module['url'].'stylesheet.php?template_id='.$this->site['template_id'].'" rel="stylesheet" type="text/css" />'."\r\n".		'<link href="'.$this->cms_module['url'].'stylesheet.php?print=true&amp;template_id='.$this->site['template_id'].'" rel="stylesheet" type="text/css" media="print" />'."\r\n";		$header .= $header_arguments;				$header .= $this->template['head'];		$header .= '<script type="text/javascript" src="'.$GO_CONFIG->host.'javascript/common.js"></script>'."\r\n".		'</head>'."\r\n".		'<body '.$body_arguments.'>'."\r\n".		"\r\n<!-- End of generated header --> \r\n\r\n";		return $header;	}	function generate_footer() {		return "\r\n\r\n<!-- Start of generated Footer --> \r\n\r\n".		'</body>'."\r\n".		'</html>'."\r\n";	}	function access_denied()	{		global $GO_CONFIG;		header('Location: '.$GO_CONFIG->host.'error_docs/403.php');		exit();	}	function authenticate($goto_url=null)	{		global $GO_SECURITY;		if(!$GO_SECURITY->logged_in())		{			if(!isset($goto_url))			{				$goto_url=$_SERVER['REQUEST_URI'];			}			if($this->template['login_template_item_id']>0)			{				header('Location: '.$_SERVER['PHP_SELF'].'?task=login&goto_url='.urlencode($goto_url).'&return_to='.urlencode($this->return_to));			}else {				$GO_SECURITY->authenticate(false,false);			}			exit();		}	}	function generate_page() {		global		$GO_CONFIG,		$GO_LANGUAGE,		$GO_SECURITY,		$GO_MODULES,		$cms_empty;		switch($this->task)		{			case 'logout':				$template_item=$this->get_template_item($this->template['login_template_item_id']);				$html = $this->generate_header($this->template['doctype']);				$template_content = $this->parse_template($template_item['content']);				$p = new html_element('p', $GLOBALS['cms_logged_out']);				$p->set_attribute('style','margin-top:10px;margin-bottom:10px;');				if(!empty($_REQUEST['goto_url']))				{					$input = new input('button','continue',$GLOBALS['cmdContinue']);					$input->set_attribute('onclick',"javascript:document.location='".smart_stripslashes($_REQUEST['goto_url'])."';");					$content = $p->get_html().$input->get_html();				}else {					$content = $p->get_html();				}				$html .= str_replace($this->get_tag('content', $template_content), $content, $template_content);				$html .= $this->generate_footer();				return $html;				break;			case 'login':				require($GO_LANGUAGE->get_base_language_file('login'));				if(isset($GO_MODULES->modules['webshop']))				{					require($GO_LANGUAGE->get_language_file('webshop'));				}				$login_task = isset($_REQUEST['login_task']) ? $_REQUEST['login_task'] : '';				$goto_url = !empty($_REQUEST['goto_url']) ? smart_stripslashes($_REQUEST['goto_url']) : $this->return_to;				$return_to = isset($_REQUEST['return_to']) ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER'];				if($login_task == 'login')				{					$username = smart_addslashes($_POST['username']);					$password = smart_addslashes($_POST['password']);					if (!$GLOBALS['GO_AUTH']->login($username, $password, $_SESSION['auth_source']))					{						$feedback = $login_bad_login;					}else {						header('Location: '.$goto_url);						exit();					}				}				$form = new form('login_form');				$form->add_html_element(new input('hidden','login_task', 'login', false));				$form->add_html_element(new input('hidden','task', 'login'));				$form->add_html_element(new input('hidden','goto_url', $goto_url));				$form->add_html_element(new input('hidden','return_to', $return_to));				$form->add_html_element(new input('hidden','file_id', $this->file_id));				$form->add_html_element(new input('hidden','folder_id', $this->folder_id));				if($GO_CONFIG->allow_registration)				{					$h2=new html_element('h2', $login_no_account);					$form->add_html_element($h2);					$p = new html_element('p', $login_no_account_text);					$form->add_html_element($p);					$href = 'javascript:document.login_form.task.value=\'register\';document.login_form.submit();';					$hyperlink = new hyperlink($href, sprintf($login_register, $GO_CONFIG->title));					$form->add_html_element($hyperlink);					$h2 = new html_element('h2',sprintf($login_to, $GO_CONFIG->title));					$h2->set_attribute('style','margin-top:20px;');					$form->add_html_element($h2);				}else {					$h2 = new html_element('h2',sprintf($login_to, $GO_CONFIG->title));					$form->add_html_element($h2);				}				$p = new html_element('p',$login_text);				/*if($GO_CONFIG->allow_registration)				{				$href = 'javascript:document.login_form.task.value=\'register\';document.login_form.submit();';				$hyperlink = new hyperlink($href, $login_here);				$p->innerHTML .= ' '.sprintf($login_register, $hyperlink->get_html());				}*/				$table = new table();				$row = new table_row();				$cell = new table_cell($p->get_html());				$cell->set_attribute('colspan','2');				if (isset($feedback))				{					$p = new html_element('p', $feedback);					$p->set_attribute('class', 'error');					$cell->add_html_element($p);				}				$row->add_cell($cell);				$table->add_row($row);				$row = new table_row();				$cell = new table_cell($login_username.':');				$cell->set_attribute('style', 'whitespace:nowrap;');				$row->add_cell($cell);				$cell = new table_cell();				$username = isset($_REQUEST['username']) ? $_REQUEST['username'] : '';				$input = new input('text', 'username', $username);				$input->set_attribute('style','width:200px');				$cell->innerHTML .= $input->get_html();				if (count($GLOBALS['auth_sources']) > 1)				{					$cookie_key = isset($_COOKIE['GO_AUTH_SOURCE_KEY']) ? $_COOKIE['GO_AUTH_SOURCE_KEY'] : '0';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -