<? # $Workfile: search.php3$	$Revision: 8$	$Date: 08/21/00 16:47:28$
/* 
 *	W-AGORA
 *	-------
 *	File:		search.php3
 *	Usage:		display search form or perform search in forum
 *	Date:		December 1999
 *	version:	3.0.1
 *	Author:		Marc Druilhe <mdruilhe@araxe.fr>
 */

	$bn_action="search";
	$bn_action_mode="L";

	require ("./init.inc");

	$header_footer = ($bn_frames==0) ? true : false;

	/* Execute before_access program */
	if ($bn_before_access) {
			include "$bn_dir/$bn_before_access";
	}

	display_header ("search $bn_title", $header_footer);
	if (!$bn_search) {
		msgForm ("Sorry, search is not available into this forum ($bn)","","");
		display_footer ($header_footer);
	}

	if ($bn_search_engine == "none" || $bn_doc_type != "static")
		$dbsearch = 1;

	if($pattern) {
		$mess=addSlashes(stripSlashes($msg[22]));
		eval ("\$m=stripSlashes(\"$mess\");");
		if ($dbsearch) {
			$num = $db->search ($bn_db, $pattern, $casesensitive);
			if ($num < 1) {
	    		echo "<p><center><h2>"; DspMsg(30);echo "</center></h2>";

			} else {
				echo "<p><h2>$num" . Msg(29) . "</h2><p>";
				$l=addSlashes(stripSlashes($bn_search_header));
				eval ("echo stripSlashes(\"$l\");");
				$ret = $db->getChild (0, "search");
				$l=addSlashes(stripSlashes($bn_search_footer));
				eval ("echo stripSlashes(\"$l\");");
			}
		}
		else {
			include "$inc_dir/$bn_search_engine.$ext";
			$search->search ($pattern, $casesensitive);
		}
	}
	else {
?>
		<h2 align=CENTER><?DspMsg (27)?></h2>
		<br />
		<table width="600" align="center" cellpadding="0" cellspacing="0" border="0"><tr><td>
		<form action="<?php echo $WA_SELF?>" method=POST>
		<input type="hidden" name="bn" value="<?echo $bn?>">
		<p>
  		<?DspMsg(26)?> <input type="text" name="pattern" value="<?echo $pattern?>" size="30">
  		<input type="submit" value="<?DspMsg(28)?>">
		<?if ($dbsearch): ?>
  			<p><? DspMsg(67);?>
  			<input type="checkbox" name="casesensitive" value="1">
		<?endif; ?>
		</form>
		</td></tr></table>
<?
	}

# Display footer
# --------------
	display_footer ($header_footer);
?>
