Source for file weblinks.searchbot.php
Documentation is available at weblinks.searchbot.php
* @author Mambo Foundation Inc see README.php
* @copyright Mambo Foundation Inc.
* See COPYRIGHT.php for copyright notices and details.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
* Mambo is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2 of the
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$_MAMBOTS->registerFunction( 'onSearch', 'botSearchWeblinks' );
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
$section =
T_('Web Links');
$wheres2[] =
"LOWER(a.url) LIKE '%$text%'";
$wheres2[] =
"LOWER(a.description) LIKE '%$text%'";
$wheres2[] =
"LOWER(a.title) LIKE '%$text%'";
$where =
'(' .
implode( ') OR (', $wheres2 ) .
')';
foreach ($words as $word) {
$wheres2[] =
"LOWER(a.url) LIKE '%$word%'";
$wheres2[] =
"LOWER(a.description) LIKE '%$word%'";
$wheres2[] =
"LOWER(a.title) LIKE '%$word%'";
$wheres[] =
implode( ' OR ', $wheres2 );
$where =
'(' .
implode( ($phrase ==
'all' ?
') AND (' :
') OR ('), $wheres ) .
')';
$order =
'b.title ASC, a.title ASC';
$query =
"SELECT a.title AS title,"
.
"\n a.description AS text,"
.
"\n a.date AS created,"
.
"\n CONCAT_WS( ' / ', '$section', b.title ) AS section,"
.
"\n '1' AS browsernav,"
.
"\n FROM #__weblinks AS a"
.
"\n INNER JOIN #__categories AS b ON b.id = a.catid AND b.access <= '$my->gid'"
$database->setQuery( $query );
$rows =
$database->loadObjectList();
Documentation generated on Mon, 05 May 2008 16:24:18 +0400 by phpDocumentor 1.4.0