Hallo deejey,
danke für deine Antwort.
Habe das mit phpmyadmin verglichen und genau nach dieser Zeile findet er nichts mehr. Das mit der Reihenfolge habe ich dabei nicht beachtet...
Hier der Bot:
PHP-Code:
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$mainframe->registerEvent( 'onSearch', 'plgSearchAuto' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchAutoAreas' );
/**
* @return array An array of search areas
*/
function &plgSearchAutoAreas() {
static $areas = array(
'auto' => 'GWH-Archiv'
);
return $areas;
}
function plgSearchAuto( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchAutoAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'auto');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ($text == '') {
return array();
}
$section = JText::_( 'Auto' );
$wheres = array();
switch ($phrase)
{
case 'exact':
$text = $db->getEscaped($text);
$wheres2 = array();
$wheres2[] = "LOWER(a.text) LIKE '%$text%'";
$wheres2[] = "LOWER(a.hersteller) LIKE '%$text%'";
$where = '(' . implode( ') OR (', $wheres2 ) . ')';
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wheres = array();
foreach ($words as $word) {
$word = $db->getEscaped($word);
$wheres2 = array();
$wheres2[] = "LOWER(a.text) LIKE '%$word%'";
$wheres2[] = "LOWER(a.hersteller) LIKE '%$word%'";
$wheres[] = implode( ' OR ', $wheres2 );
}
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
break;
}
switch ( $ordering )
{
default:
$order = 'a.text ASC';
break;
}
$query = "SELECT * FROM #__auto AS a"
. "\n WHERE ( $where )"
. "\n AND published = '1'"
. "\n ORDER BY $order";
;
//echo $query; die();
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_auto&view=auto';
}
return $rows;
}
?>
Lesezeichen