<?php
//
// Copyright (C) 2003 Jan de Graaff
// All rights reserved.
//
// This program uses parts of the original Simpleboard Application
// 0.7.0b written by Josh Levine; http://www.joshlevine.net
//
// This source file is part of the SimpleBoard Component, a Mambo 4.5
// custom Component By Jan de Graaff - http://tsmf.jigsnet.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// Please note that the GPL states that any headers in files and
// Copyright notices as well as credits in headers, source files
// and output (screens, prints, etc.) can not be removed.
// You can extend them with your own credits, though...
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
// The "GNU General Public License" (GPL) is available at
// http://www.gnu.org/copyleft/gpl.html.
//
// Dont allow direct linking
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

require_once( "$sbp/search-html.php" );
//require_once( "sb_search.php" );
$searchword= mosGetParam( $_REQUEST, 'searchword', '' );
$searchuser= mosGetParam( $_REQUEST, 'searchuser', '' );
$usersearch= mosGetParam( $_REQUEST, 'usersearch', '0' );
$usersearch=(int)$usersearch;
if ($usersearch) $searchword=$searchuser;

?>
  <p>
  <table border="0" width="100%" align="center">
    <?php include ($sbp.'/searchbox.php');?>
    <tr>
      <td align="center">
        <b><font size="2"><?=$board_title;?></font></b>
        <?php echo $sbConfig['board_offline'] ? '<br /><font color="red">' ._FORUM_IS_OFFLINE. '</font>' : '&nbsp;' ;?>
      </td>
    </tr>
  </table>

  <center>
  <a href="index.php?option=com_simpleboard&Itemid=<?php echo $Itemid;?>"> <?php echo _HOME; ?></a>
  <?php
    if ($my_id != 0)
    {
      ?>
      | <a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=userprofile&do=show');?>"><?php echo _GEN_MYPROFILE;?></a>
      <?php
    }
  ?>

  | <a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=latest');?>"><?php echo _GEN_LATEST_POSTS;?></a>
  | <a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=faq');?>"><?php echo _GEN_HELP;?></a>
  </form>
  </p>
  </center>
<?php

$gid = $my->gid;


search_html::openhtml( htmlspecialchars( $searchword ) );


//$searchword = mosGetParam( $_REQUEST, 'searchword', '' );
$searchword = $database->getEscaped( trim( $searchword ) );


$search_ignore = array();
@include "$mosConfig_absolute_path/language/$mosConfig_lang.ignore.php";


if (!$searchword) {
   search_html::message( _NOKEYWORD );
} else if (in_array( $searchword, $search_ignore )) {
   search_html::message( _IGNOREKEYWORD );
} else {
   search_html::searchintro( htmlspecialchars( $searchword ) );


   $totalRows = 0;


   //*****************************************************
   //other searches part a
   require_once( "$sbp/sb_search.php" );
   $forumcount = forumsearch_html::search($database, htmlspecialchars($searchword), false, 0,$usersearch);
   $n = $n + $forumcount;


   $forumcount = forumsearch_html::search($database, htmlspecialchars($searchword), true, $forumcount, $usersearch);
   $totalRows = $totalRows + $forumcount;
   if($forumcount>0){
      echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" >";
      echo "<tr><td>&nbsp;</td></tr>";
      echo "</table>";
   }
   //other searches part b end
   //*****************************************************


   search_html::conclusion( $totalRows, htmlspecialchars( $searchword ) );
}
?>