Esempio n. 1
0
function page(){
	$tpl=new templates();
	$sock=new sockets();
	$XapianSearchTitle=$sock->GET_INFO("XapianSearchTitle");
	if($XapianSearchTitle==null){$XapianSearchTitle="Xapian Desktop {search}";}
	$XapianRemoveLangage=$sock->GET_INFO("XapianRemoveLangage");
	$XapianRemoveLogon=$sock->GET_INFO("XapianRemoveLogon");	
	

	
	if(!is_numeric($XapianRemoveLangage)){$XapianRemoveLangage=0;}
	if(!is_numeric($XapianRemoveLogon)){$XapianRemoveLogon=0;}	
	
	$XapianSearchTitle=$tpl->_ENGINE_parse_body("$XapianSearchTitle");
	$p=new pagebuilder();
	$page=CurrentPageName();
	$search=$tpl->_ENGINE_parse_body("{search}");
	$languageF=$tpl->_ENGINE_parse_body("{language}");
	$js=$p->jsArtica();
	$info=null;
	$cssJq=$p->JqueryUiCss("artica-theme");
	$Yahoo=$p->YahooBody();
	if (!extension_loaded('xapian')) {
		$s=php_ini_path();
		echo $tpl->_ENGINE_parse_body("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-gb\" lang=\"en-gb\">
		<head>
			<title>$XapianSearchTitle</title>
			<link rel=\"stylesheet\" type=\"text/css\" rel=\"styleSheet\"  href=\"/ressources/templates/default/blurps.css\" />
			<link rel=\"stylesheet\" type=\"text/css\" href=\"$page?css=yes\" />
			<link href='http://fonts.googleapis.com/css?family=Questrial' rel='stylesheet' type='text/css'>
			
		</head>
		<body >
		
			<center style='margin:90px'>
				<table style='width:99%' class=form>
				<tr>
					<td width=1% valign='top'><img src='img/error-128.png'></td>
					<td valign='top' style='font-size:18px;font-family:Arial,Tahoma'>{ERROR_XAPIAN_NOEXTSION}
					</td>
				</tr>
				</table>
				<div style='width:620px;margin-top:20px' class=form>$s</div>
			</center>
			
		</center>
		</body>
		</html>
		");
		return;
		
	}
	
	$l["none"]="none";
	$l["danish"]="danish";
	$l["dutch"]="dutch";
	$l["english"]="english";
	$l["finnish"]="finnish";
	$l["french"]="french";
	$l["german"]="german";
	$l["german2"]="german2";
	$l["hungarian"]="hungarian";
	$l["italian"]="italian";
	$l["kraaij_pohlmann"]="kraaij_pohlmann";
	$l["lovins"]="lovins";
	$l["norwegian"]="norwegian";
	$l["porter"]="porter";
	$l["portuguese"]="portuguese";
	$l["romanian"]="romanian";
	$l["russian"]="russian";
	$lang="english";
	$language=Field_array_Hash($l,"lang",$_COOKIE["XAPIAN-LANG"],null,null,0,"font-size:14px");
	$login=$tpl->_ENGINE_parse_body("{login}");
	$logged_as=$tpl->_ENGINE_parse_body("{logged_as}");
	$disconnect=$tpl->_ENGINE_parse_body("{disconnect}");
	if($_COOKIE["uid"]==null){
		$logon="<a href=\"javascript:Blurz();\" OnClick=\"javascript:Loadjs('$page?logon-js=yes')\" style='text-decoration:underline;font-weight:bold'>$login</a>";
		
	}else{
		$logon="<span style='font-weight:bold'>$logged_as: {$_COOKIE["uid"]}</span>&nbsp;<a href=\"javascript:Blurz();\" OnClick=\"javascript:Loadjs('$page?loggoff-js=yes')\" style='text-decoration:underline;font-weight:bold'>$disconnect</a>";
		
		if($_COOKIE["uid"]<>null){
			if(!is_dir("/usr/share/artica-postfix/LocalDatabases/xapian-{$_COOKIE["uid"]}")){
				$info=$tpl->_ENGINE_parse_body("&nbsp;<i style='font-size:11px'>{your_home_dir_seems_not_indexed}:$HomDirectory</i>");
			}	
		}		
		
	}
	
	$langs[]="<td width=1% nowrap>$languageF:</td>";
	$langs[]="<td width=1% nowrap>$language</td>";
	
	if($XapianRemoveLangage==1){$langs=array();}
	$infos="<td width=1% nowrap>$logon$info</td>";
	if($XapianRemoveLogon==1){$infos=null;$scriptfel="Delete_Cookie('uid', '/', '');";}
	
	
	$html="
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-gb\" lang=\"en-gb\">
	<head>
		<title>$XapianSearchTitle</title>
		<link rel=\"stylesheet\" type=\"text/css\" rel=\"styleSheet\"  href=\"/ressources/templates/default/blurps.css\" />
		<link rel=\"stylesheet\" type=\"text/css\" href=\"$cssJq\" />
		
		<link rel=\"stylesheet\" type=\"text/css\" href=\"$page?css=yes\" />
		<link href='http://fonts.googleapis.com/css?family=Questrial' rel='stylesheet' type='text/css'>
				
		$js
	</head>
	<body style='background-color:transparent'>
	$Yahoo
	<center style='margin-top:10px'>
	<table class=form style=' width: 99%;padding:50px'>
	<tr>
		<td style='font-size:22px;font-weight:bold;padding-top:15px' nowrap width=1% valign='top'>$XapianSearchTitle:</td>
		<td width=99% align='left'><input type='text' id='xapsearch' value='{$_COOKIE["XAP-SEARCH"]}' 
		style='font-size:18px;font-weight:bold;border:2px solid #CCCCCC;width:550px;padding:8px'
		OnKeyPress=\"javascript:InstantSearchQueryPress(event);\"
		>
		<table style='width:5%'>
		<tr>
			". @implode("\n", $langs)."
			$infos
		</tr>
		</table>
	</td>
	
</tr>
</table>
<div id='xapresults'></div>
	<script>
	var x_InstantSearchSave= function (obj) {
		var res=obj.responseText;
		document.getElementById('xapresults').innerHTML=res;
	}		
	
function InstantSearchQuery(){
		var xapsearch=document.getElementById('xapsearch').value;
		if(xapsearch.length<2){return;}
		var pp=encodeURIComponent(xapsearch);
		var XHR = new XHRConnection();
		document.getElementById('xapresults').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>';
		XHR.appendData('xapsearch',pp);
		if(document.getElementById('lang')){
			XHR.appendData('language',document.getElementById('lang').value);
			Set_Cookie('XAPIAN-LANG', document.getElementById('lang').value, '3600', '/', '', '');
		}
		Set_Cookie('XAP-SEARCH', document.getElementById('xapsearch').value, '3600', '/', '', '');
		XHR.sendAndLoad('$page', 'POST',x_InstantSearchSave);
		 		
	}
	
	
	
	function InstantSearchQueryPress(e){
		if(checkEnter(e)){InstantSearchQuery();}
	}
	
	InstantSearchQuery();
	$scriptfel	
	</script>	
	
</html>";

	
echo $html;
	
}