0byt3m1n1
Path:
/
data
/
applications
/
aps
/
mambo
/
4.6.5-1
/
standard
/
htdocs
/
mambots
/
search
/
[
Home
]
File: contacts.searchbot.php
<?php /** * @package Mambo * @author Mambo Foundation Inc see README.php * @copyright Mambo Foundation Inc. * See COPYRIGHT.php for copyright notices and details. * @license GNU/GPL Version 2, see LICENSE.php * 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 License. */ /** 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', 'botSearchContacts' ); /** * Contacts Search method * * 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 */ function botSearchContacts( $text, $phrase='', $ordering='' ) { global $database, $my; $text = trim( $text ); if ($text == '') { return array(); } $section = T_('Contact'); switch ( $ordering ) { case 'alpha': $order = 'a.name ASC'; break; case 'category': $order = 'b.title ASC, a.name ASC'; break; case 'popular': case 'newest': case 'oldest': default: $order = 'a.name DESC'; } $database->setQuery("SELECT id FROM #__menu WHERE link LIKE 'index.php?option=com_contact%' ORDER BY LENGTH(link)"); $citemid = $database->loadResult(); $query = "SELECT a.name AS title," . "\n CONCAT_WS( ', ', a.name, a.con_position, a.misc ) AS text," . "\n '' AS created," . "\n CONCAT_WS( ' / ', '$section', b.title ) AS section," . "\n '2' AS browsernav," . "\n CONCAT( 'index.php?option=com_contact&task=view&Itemid=$citemid&contact_id=', a.id ) AS href" . "\n FROM #__contact_details AS a" . "\n INNER JOIN #__categories AS b ON b.id = a.catid AND b.access <= '$my->gid'" . "\n WHERE ( a.name LIKE '%$text%'" . "\n OR a.misc LIKE '%$text%'" . "\n OR a.con_position LIKE '%$text%'" . "\n OR a.address LIKE '%$text%'" . "\n OR a.suburb LIKE '%$text%'" . "\n OR a.state LIKE '%$text%'" . "\n OR a.country LIKE '%$text%'" . "\n OR a.postcode LIKE '%$text%'" . "\n OR a.telephone LIKE '%$text%'" . "\n OR a.fax LIKE '%$text%' )" . "\n AND a.published = '1'" . "\n ORDER BY $order" ; $database->setQuery( $query ); $rows = $database->loadObjectList(); return $rows; } ?>
© 2017 -
ZeroByte.ID
.