benutze die gute alte Conflakes Suche von Kummer in C 4.8.8. Leider funktioniert dieses Modul nicht mit MR zusammen, es gibt immer wieder einen Sprung auf die Fehlerseite. Ist MR deaktiviert gehts... Hätte jemand einen Hinweis für die Änderungen in dem Modul, dass es mit MR geht?
Merci vorab und viele Grüsse
Kalrchen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : w3concepts.search.v1.0.1
* Author : Andreas Kummer
* Copyright : mumprecht & kummer w3concepts
* Created : 2004-12-29
* Modified : 2005-01-03
* ***********************************************/
class conFlakesSearch {
function conFlakesSearch() {
// Globale Variablen in Klassenkontext aufnehmen
$this->getGlobals();
// Defaultwerte setzen
$this->setDefault();
// Übergabeparameter in Klassenkontext aufnehmen
$this->importParameters();
// Datenbankverbindung herstellen
$this->db = new DB_Contenido;
$this->db2 = new DB_Contenido;
// Suchmaske ausgeben
echo $this->getSearchMask();
// Suche vornehmen
if (!empty($this->post['searchEntry'])) {
$this->doSearch();
$this->showResults();
}
}
function getGlobals() {
global $auth;
$this->classGlobal['auth'] = $auth;
}
function setDefault() {
// Tabellennamen festlegen
$this->tab['cache'] = 'conFlakes_Cache';
$this->tab['content'] = 'conFlakes_Content';
$this->tab['container'] = 'conFlakes_Container';
}
function importParameters() {
$this->get = array ();
if (!empty ($_GET))
foreach ($_GET as $key => $value) {
$this->get[$key] = $value;
}
$this->post = array ();
if (!empty ($_POST))
foreach ($_POST as $key => $value) {
$this->post[$key] = $value;
}
}
function getSearchMask() {
if (array_key_exists('searchEntry',$this->post)) {
$searchEntry = $this->post['searchEntry'];
} else {
$searchEntry = '';
}
$returnvalue = "<form style=\"display:inline;\" name=\"conFlakesSearch\" method=\"POST\" action=\"".$this->classGlobal[auth]->url()."\">";
$returnvalue .= "<div><input style=\"border:solid 1px #999; padding:3px;\" type=\"text\" name=\"searchEntry\" size=\"30\" value=\"$searchEntry\"/>";
$returnvalue .= ' <input type="submit" name="doSearch" value="suchen" /></div>';
if (!empty($this->post['logical']) && $this->post['logical'] == 'and') {
$returnvalue .= '<div style="margin-top:10px; margin-bottom:30px;"><fieldset><legend>Logische Verknüpfung der Suchbegriffe</legend><div style="margin-bottom:5px; margin-top:5px;"><input style="vertical-align:bottom;" type="radio" name="logical" value="and" checked="checked" /> UND (alle Begriffe sind vorhanden)</div>';
$returnvalue .= '<div><input style="vertical-align:bottom;" type="radio" name="logical" value="or" /> ODER (einer oder mehre Begriffe vorhanden)</div></fieldset></div>';
} else {
$returnvalue .= '<div style="margin-top:10px; margin-bottom:30px;"><fieldset><legend>Logische Verknüpfung der Suchbegriffe</legend><div style="margin-bottom:5px; margin-top:5px;"><input style="vertical-align:bottom;" type="radio" name="logical" value="and" /> UND (alle Begriffe sind vorhanden)</div>';
$returnvalue .= '<div><input style="vertical-align:bottom;" type="radio" name="logical" value="or" checked="checked" /> ODER (einer oder mehre Begriffe vorhanden)</div></fieldset></div>';
}
$returnvalue .= '</form>';
return $returnvalue;
}
function doSearch() {
global $cfg, $client, $lang;
$sql = "" .
"SELECT " .
" a.title, " .
" a.idart, " .
" a.summary, " .
" a.idartlang, " .
" b.idcat, " .
" count(*) AS ordervalue, " .
" a.lastmodified " .
"FROM {$cfg['tab']['art_lang']} AS a " .
"LEFT JOIN {$cfg['tab']['cat_art']} AS b ON a.idart = b.idart " .
"LEFT JOIN {$cfg['tab']['cat']} AS c ON b.idcat = c.idcat " .
"LEFT JOIN {$cfg['tab']['content']} AS d ON a.idartlang = d.idartlang " .
"LEFT JOIN {$this->tab['cache']} AS e ON (e.idart = a.idart AND e.idlang = a.idlang) " .
"LEFT JOIN {$this->tab['container']} AS f ON e.pk_cache = f.fk_cache " .
"LEFT JOIN {$this->tab['content']} AS g ON f.pk_container = g.fk_container " .
"WHERE " .
" c.idclient = $client " .
" AND a.idlang = $lang " .
" AND a.online = 1 ";
$searchString = str_replace('*','.*',trim(strtolower($this->post['searchEntry'])));
if ($this->post['logical'] == 'or') {
// Suchbegriffe sind logisch ODER-verknüpft
$regExpression = "(".str_replace(" ", ")|(", $searchString).")";
$s = ereg_replace("ü", "%FC", $regExpression);
$s = ereg_replace("ä", "%E4", $s);
$s = ereg_replace("ö", "%F6", $s);
$regExpression .= " | $s";
$whereClause = " " .
"AND (" .
" d.value REGEXP '{$regExpression}' " .
" OR a.title REGEXP '{$regExpression}' " .
" OR a.summary REGEXP '{$regExpression}' " .
" OR g.value REGEXP '{$regExpression}' " .
" OR d.value REGEXP '{$s}' " .
" OR a.title REGEXP '{$s}' " .
" OR a.summary REGEXP '{$s}' " .
" OR g.value REGEXP '{$s}' " .
" ) ";
} else {
// Suchbegriffe sind logisch UND-verknüpft
$searchStrings = explode(' ',$searchString);
$whereClause = '';
foreach ($searchStrings as $search) {
$regExpression = "($search)";
$s = ereg_replace("ü", "%FC", $regExpression);
$s = ereg_replace("ä", "%E4", $s);
$s = ereg_replace("ö", "%F6", $s);
// $regExpression .= " | $s";
$whereClause .= " " .
"AND (" .
" d.value REGEXP '{$regExpression}' " .
" OR a.title REGEXP '{$regExpression}' " .
" OR a.summary REGEXP '{$regExpression}' " .
" OR g.value REGEXP '{$regExpression}' " .
" OR d.value REGEXP '{$s}' " .
" OR a.title REGEXP '{$s}' " .
" OR a.summary REGEXP '{$s}' " .
" OR g.value REGEXP '{$s}' " .
" ) ";
}
}
$sql = $sql.$whereClause;
$sql = $sql." " .
"GROUP BY " .
" a.title, " .
" a.idart, " .
" a.summary, " .
" a.idartlang, " .
" b.idcat, " .
" a.lastmodified " .
"ORDER BY " .
" ordervalue DESC";
$this->db->query($sql);
$this->searchResults = array();
while ($this->db->next_record()) {
$this->searchResults[$this->db->f('idartlang')] = array('idart'=>$this->db->f('idart'),'idcat'=>$this->db->f('idcat'),'title'=>$this->db->f('title'),'summary'=>$this->db->f('summary'),'lastmodified'=>$this->db->f('lastmodified'));
}
}
function showResults() {
global $sess, $cfgClient, $client, $lang;
// Ausgabe der Suchresultate
if (!empty($this->searchResults)) {
// Ausgabe der Resultate
$counter = 0;
foreach ($this->searchResults as $result) {
$counter++;
$link = $link = $sess->url($cfgClient[$client]['path']['htmlpath']."front_content.php?client=$client&lang=$lang&idcat={$result['idcat']}&idart={$result['idart']}");
echo '<div style="margin-bottom:15px;">';
echo "<div style=\"margin-bottom:5px;\"><a href=\"$link\"><span style=\"font-weight:bold; font-size:120%\">{$result['title']}</span></a></div>";
echo "<div style=\"margin-bottom:5px;\">{$result['summary']}</div>";
echo "<div style=\"font-size:50%\">Letztmals aktualisiert: {$result['lastmodified']}</div>";
echo '</div>';
}
} else {
// Ausgabe der Meldung, dass keine Seiten gefunden worden sind.
echo '<div>Die Suche ergab keine Resultate. Versuchen Sie es bitte mit anderen Suchbegriffen.</div>';
}
}
}
$conFlakesSearch = new conFlakesSearch();
?>