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

📄 search.php

📁 极限网络智能办公系统—MYOA26—100%—源程序。
💻 PHP
字号:
<?php

require( "./inc/inc.php" );
echo $nocache;
$jsquota = $exceeded ? "true" : "false";
$jssource = "\r\n<script language=\"JavaScript\">\r\nfunction newmsg() { location = 'newmsg.php?pag={$pag}&folder=".urlencode( $folder )."&sid={$sid}&tid={$tid}&lid={$lid}'; }\r\nfunction folderlist() { location = 'folders.php?folder=".urlencode( $folder )."&sid={$sid}&tid={$tid}&lid={$lid}'}\r\nfunction goend() { location = 'logout.php?sid={$sid}&tid={$tid}&lid={$lid}'; }\r\nfunction goinbox() { location = 'msglist.php?folder=inbox&sid={$sid}&tid={$tid}&lid={$lid}'; }\r\nfunction emptytrash() {\tlocation = 'folders.php?empty=trash&folder=".urlencode( $folder )."&goback=true&sid={$sid}&tid={$tid}&lid={$lid}';}\r\nfunction addresses() { location = 'addressbook.php?sid={$sid}&tid={$tid}&lid={$lid}'; }\r\nfunction prefs() { location = 'preferences.php?sid={$sid}&tid={$tid}&lid={$lid}'; }\r\nno_quota  = {$jsquota};\r\nquota_msg = '".ereg_replace( "'", "\\'", $quota_exceeded )."';\r\nfunction readmsg(ix,read,folder) {\r\n\tif(!read && no_quota)\r\n\t\talert(quota_msg)\r\n\telse\r\n\t\tlocation = 'readmsg.php?folder='+folder+'&pag={$pag}&ix='+ix+'&sid={$sid}&tid={$tid}&lid={$lid}'; \r\n}\r\n\r\n</script>\r\n";
$smarty->assign( "umSid", $sid );
$smarty->assign( "umLid", $lid );
$smarty->assign( "umJS", $jssource );
$smarty->assign( "umInputFrom", $srcFrom );
$smarty->assign( "umInputSubject", $srcSubject );
$smarty->assign( "umInputBody", $srcBody );
if ( $srcFrom != "" || $srcSubject != "" || $srcBody != "" )
{
	$boxes = $sess['folders'];
	$n = 0;
	for ( ;	$n < count( $boxes );	++$n	)
	{
		$entry = $boxes[$n]['name'];
		if ( !is_array( $sess['headers'][base64_encode( strtolower( $entry ) )] ) )
		{
			if ( !$UM->mail_connected( ) )
			{
				if ( !$UM->mail_connect( ) )
				{
					header( "Location: error.php?err=1&sid={$sid}&tid={$tid}&lid={$lid}\r\n" );
				}
				if ( !$UM->mail_auth( ) )
				{
					header( "Location: badlogin.php?sid={$sid}&tid={$tid}&lid={$lid}\r\n" );
					exit( );
				}
			}
			$thisbox = $UM->mail_list_msgs( $entry );
			$sess['headers'][base64_encode( strtolower( $entry ) )] = $thisbox;
		}
		else
		{
			$thisbox = $sess['headers'][base64_encode( strtolower( $entry ) )];
		}
	}
	if ( $UM->mail_connected( ) )
	{
		$UM->mail_disconnect( );
		$SS->save( $sess );
	}
	$boxlist = $sess['headers'];
	function build_regex( $strSearch )
	{
		$strSearch = trim( $strSearch );
		if ( $strSearch != "" )
		{
			$strSearch = quotemeta( $strSearch );
			$arSearch = split( " ", $strSearch );
			unset( $strSearch );
			$n = 0;
			for ( ;	$n < count( $arSearch );	++$n	)
			{
				if ( $strSearch )
				{
					$strSearch .= "|(".$arSearch[$n].")";
				}
				else
				{
					$strSearch .= "(".$arSearch[$n].")";
				}
			}
		}
		return $strSearch;
	}
	if ( trim( $srcBody ) != "" )
	{
		$get_body = 1;
	}
	$search_results = array( );
	$start = $smarty->_get_microtime( );
	$UM->use_html = false;
	if ( $srcFrom != "" )
	{
		$srcFrom = build_regex( $srcFrom );
	}
	if ( $srcSubject != "" )
	{
		$srcSubject = build_regex( $srcSubject );
	}
	if ( $srcBody != "" )
	{
		$srcBody = build_regex( $srcBody );
	}
	while ( list( $current_folder, $messages ) = each( $boxlist ) )
	{
		$current_folder = base64_decode( $current_folder );
		$z = 0;
		for ( ;	$z < count( $messages );	++$z	)
		{
			$email = $messages[$z];
			$localname = $email['localname'];
			if ( $get_body && file_exists( $localname ) )
			{
				$thisfile = $UM->_read_file( $localname );
				$email = $UM->decode( $thisfile );
				unset( $thisfile );
			}
			$found = false;
			if ( $srcFrom != "" )
			{
				$from = $email['from'];
				$srcString = $from[0]['name']." ".$from[0]['mail'];
				if ( eregi( $srcFrom, $srcString ) )
				{
					$found = true;
				}
			}
			if ( $srcSubject != "" && !$found )
			{
				$srcString = $email['subject'];
				if ( eregi( $srcSubject, $srcString ) )
				{
					$found = true;
				}
			}
			if ( $srcBody != "" && !$found )
			{
				$srcString = strip_tags( $email['body'] );
				if ( eregi( $srcBody, $srcString ) )
				{
					$found = true;
				}
			}
			if ( $found )
			{
				$messages[$z]['ix'] = $z;
				$headers[] = $messages[$z];
			}
		}
	}
	$messagelist = array( );
	$i = 0;
	for ( ;	$i < count( $headers );	++$i	)
	{
		$mnum = $headers[$i]['id'];
		$read = eregi( "\\SEEN", $headers[$i]['flags'] ) ? "true" : "false";
		$readlink = "javascript:readmsg(".$headers[$i]['ix'].",{$read},'".urlencode( $headers[$i]['folder'] )."')";
		$composelink = "newmsg.php?folder={$folder}&nameto=".htmlspecialchars( $headers[$i]['from'][0]['name'] )."&mailto=".htmlspecialchars( $headers[$i]['from'][0]['mail'] )."&sid={$sid}&tid={$tid}&lid={$lid}";
		$composelinksent = "newmsg.php?folder={$folder}&nameto=".htmlspecialchars( $headers[$i]['to'][0]['name'] )."&mailto=".htmlspecialchars( $headers[$i]['to'][0]['name'] )."&sid={$sid}&tid={$tid}&lid={$lid}";
		$folderlink = "msglist.php?folder=".urlencode( $headers[$i]['folder'] )."&tid={$tid}&lid={$lid}&sid={$sid}";
		$from = $headers[$i]['from'][0]['name'];
		$to = $headers[$i]['to'][0]['name'];
		$subject = $headers[$i]['subject'];
		if ( !eregi( "\\SEEN", $headers[$i]['flags'] ) )
		{
			$msg_img = "./images/msg_unread.gif";
		}
		else if ( eregi( "\\ANSWERED", $headers[$i]['flags'] ) )
		{
			$msg_img = "./images/msg_answered.gif";
		}
		else
		{
			$msg_img = "./images/msg_read.gif";
		}
		$prior = $headers[$i]['priority'];
		if ( $prior == 1 || $prior == 2 )
		{
			$img_prior = "&nbsp;<img src=\"./images/prior_low.gif\" width=5 height=11 border=0 alt=\"\">";
		}
		else if ( $prior == 4 || $prior == 5 )
		{
			$img_prior = "&nbsp;<img src=\"./images/prior_high.gif\" width=5 height=11 border=0 alt=\"\">";
		}
		else
		{
			$img_prior = "";
		}
		$msg_img = "&nbsp;<img src=\"{$msg_img}\" width=14 height=14 border=0 alt=\"\">";
		$checkbox = "<input type=\"checkbox\" name=\"msg_{$i}\" value=1>";
		$attachimg = $headers[$i]['attach'] ? "&nbsp;<img src=images/attach.gif border=0>" : "";
		$date = $headers[$i]['date'];
		$size = ceil( $headers[$i]['size'] / 1024 );
		$index = count( $messagelist );
		$messagelist[$index]['read'] = $read;
		$messagelist[$index]['readlink'] = $readlink;
		$messagelist[$index]['composelink'] = $composelink;
		$messagelist[$index]['composelinksent'] = $composelinksent;
		$messagelist[$index]['folderlink'] = $folderlink;
		$messagelist[$index]['from'] = $from;
		$messagelist[$index]['to'] = $to;
		$messagelist[$index]['subject'] = $subject;
		$messagelist[$index]['date'] = $date;
		$messagelist[$index]['statusimg'] = $msg_img;
		$messagelist[$index]['checkbox'] = $checkbox;
		$messagelist[$index]['attachimg'] = $attachimg;
		$messagelist[$index]['priorimg'] = $img_prior;
		$messagelist[$index]['size'] = $size;
		$messagelist[$index]['folder'] = $headers[$i]['folder'];
	}
	$smarty->assign( "umMessageList", $messagelist );
	unset( $headers );
	$smarty->assign( "umDoSearch", 1 );
}
else
{
	$smarty->assign( "umDoSearch", 0 );
}
$smarty->display( "neotech.net/search.htm" );
?>

⌨️ 快捷键说明

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