Opublikowany przez:
familie
2006-03-23 12:58:21
if (count($docs)>0) { ?>Resultat echo $docs[0][0] . "-" . $docs[count($docs)-1][0]; ?> av totalt echo number_format($hits, 0, " ", " "); ?> sökträffar (söktid echo $run_time; ?> sekunder)
} else { ?> Ingen sökträff! } ?> if (!empty($stopwords)) { ?>
OBS: Det går inte att söka på echo "'" . ov(str_replace(" ", ", ", $stopwords)) . "'"; ?> (se nedan*) } ?> |
$communitylist = array();
$communitylist[5] = "Allmänna diskussioner";
$communitylist[1] = "Planerar barn";
$communitylist[7] = "Svårt att få barn";
$communitylist[2] = "Väntar barn";
$communitylist[3] = "Förälder";
$communitylist[6] = "Pappagrupp";
$communitylist[4] = "Känsliga rummet";
$forumlist = array();
$fid = db_query("SELECT * FROM forums");
while ($f = db_fetch_object($fid)) {
$forumlist["$f->forum"] = $f->title;
}
//Remove stopwords in all of the query parameters and put them in an array
$xstopwords = explode(" ", strtolower(trim($stopwords)));
$tempQ = strtolower(trim($Q));
$tempQPhrase = strtolower(trim($QPhrase));
$tempQWithout = strtolower(trim($QWithout));
$tempQAny = strtolower(trim($QAny));
for ($i=0; $i < count($xstopwords); $i++) {
$tempQ = str_replace(" ", " ", str_replace($xstopwords[$i], "", $tempQ));
$tempQPhrase = str_replace(" ", " ", str_replace($xstopwords[$i], "", $tempQPhrase));
$tempQWithout = str_replace(" ", " ", str_replace($xstopwords[$i], "", $tempQWithout));
$tempQAny = str_replace(" ", " ", str_replace($xstopwords[$i], "", $tempQAny));
}
$aQ = explode(" ", $tempQ);
$aQPhrase = explode(" ", $tempQPhrase);
$aQWithout = explode(" ", $tempQWithout);
$aQAny = explode(" ", $tempQAny);
//Iterate through page result
foreach ($docs as $doc) {
if ($doc[6] == "forum") {
preg_match("/^\/Forum-([0-9]+)-([0-9F]+)\/m([0-9]+)(-([0-9]+))?\.html/i", $doc[2], $matches);
if (isset($matches[1])) { $Xcommunity = $matches[1]; }
if (isset($matches[2])) { $Xforum = $matches[2]; }
if (isset($matches[3])) { $Xmessage = $matches[3]; }
if (isset($matches[5])) { $page = $matches[5]; }
//Output title/subject
echo "" . ov($doc[3]) . " "; //Fetch the first message that got a hit $tid = db_query("SELECT forum_threads.* FROM forum_threads WHERE message='$Xmessage'"); if ($rt = db_fetch_object($tid)) { //Go through this thread and try to find the first message that got a hit $mid = db_query("SELECT body FROM $rt->db WHERE parent='$Xmessage' ORDER BY created LIMIT 1"); $msg_nr = 0; $msghit = ""; while ($r = db_fetch_object($mid)) { $msg_nr++; $t = removeEvilTags($r->body, ""); //In case we do not find the hit in this thread, we save the first message we got if (empty($msghit) && !empty($t)) { $msghit = $t; } //Check if all words in the query has been found $found = true; for ($i; $i < count($aQ); $i++) { if (empty($aQ[$i])) { continue; } if (strpos($t, $aQ[$i]) === false) { $found = false; } if (!$found) { break; } } if ($found) { $msghit = $t; break; } } echo ov(wrap_long_words(get_focus($msghit, 160), 40)) . " "; echo "$_SERVER[HTTP_HOST]$doc[2] "; echo ""; echo "Forum: " . ov($communitylist["$Xcommunity"]) . " - " . ov($forumlist["$Xforum"]) . " "; $created_by = strtr($rt->created_by, "\"'", " "); if ($created_by != "Anonym" && $created_by <> " ") { $user_link = "/krypin/" . get_normalized_string($rt->created_by) . "/presentation.php"; } else { $user_link = ""; } echo "Trådstart: " . o(display_date($rt->created, 2)) . ""; echo " av "; if (!empty($user_link)) { echo "" . ov($created_by) . " "; } else { echo "" . o($created_by) . " "; } $replied_by = strtr($rt->nick, "\"'", " "); if (!empty($replied_by) && $replied_by != "Anonym") { $user_link = "/krypin/" . get_normalized_string($rt->nick) . "/presentation.php"; } else { $user_link = ""; } echo "Senaste svar: "; if ($rt->latest <> $rt->created) { echo ""; if ($rt->latest>date('Y-m-d H:i:s', time()+240)) { echo o("Fäst av moderator"); } else { echo o(display_date($rt->latest, 2)); } echo ""; echo " av "; if (!empty($user_link)) { echo "" . ov($replied_by) . ""; } else { echo "" . o($replied_by) . ""; } } else { echo "(Ingen har svarat)"; } echo " "; } } elseif ($doc[6] == "trade") { preg_match("/^\/Annonser\/\?details=([0-9]+)/i", $doc[2], $matches); if (isset($matches[1])) { $id= $matches[1]; } echo "" . ov($doc[3]) . " "; $mid = db_query("SELECT trade.* FROM trade WHERE trade.id = $id AND active = 1"); if ($r = db_fetch_object($mid)) { $t = removeEvilTags($r->description, ""); echo ov(wrap_long_words(get_focus($t, 160), 40)) . " "; } echo "$_SERVER[HTTP_HOST]$doc[2] "; echo ""; if ($r->trade == "kop") { $trade = "Köpes"; } elseif ($r->trade == "salj") { $trade = "Säljes"; } else { $trade = ""; } echo "Typ: $trade Ort: " . ov($r->area) . " Inlaggd: " . o(display_date($r->created, 2)) . ""; echo " "; } elseif ($doc[6] == "presentation") { preg_match("/^\/krypin\/(.+)\/presentation\.php/i", $doc[2], $matches); if (isset($matches[1])) { $normalized_nick = $matches[1]; } //echo "$doc[0] "; echo "" . ov($doc[3]) . " "; $mid = db_query("SELECT user_presentations.*, users.nick FROM users, user_presentations WHERE users.userid = user_presentations.userid AND users.normalized_nick='$normalized_nick'"); if ($r = db_fetch_object($mid)) { $t = removeEvilTags($r->text, ""); echo ov(wrap_long_words(get_focus($t, 160), 40)) . " "; } echo "$_SERVER[HTTP_HOST]$doc[2] "; echo ""; echo "Medlem: " . ov($r->nick) . " Storlek: $doc[7]"; echo " "; } } ?> |
Nie masz konta? Zaloguj się, aby pisać swoje własne artykuły.