Front page | Contact Vaalimaa | Search   
2) { $haku = new search($_GET["haku"]); $haku->cmfsSearch(1); $haku->fileIndexSearch(); //$haku->searchFromOtherTables("News","header,ingress,text","ingress","header","index.php?page=show_news&m=3&s=1","news_id"); //$haku->searchFromOtherTables("events","header,ingress,content","ingress","header","index.php?page=show_event&m=3&s=2&calenderEvent=1","id","id",false,false); //$haku->calcRelevancy(); echo $haku->printOutput(); print '


« New search'; print '

« Front page'; } else { print 'Search query must be at least 3 characters long.'; print '


« New search'; print '

« Front page'; } } else { print 'Search

'; print 'Please fill in your search query.

'; print '
'; print '
'; } /* VANHA HAKU, jätetään vielä tähän jos joku tarvii if(isset($_GET["haku"]) && (strlen(trim($_GET["haku"]))>2)) { $cn=$session->getDBConnection(); $today=getdate(); if ($today["mon"]<10) $today["mon"]="0" . $today["mon"]; if ($today["mday"]<10) $today["mday"]="0" . $today["mday"]; $mod_date= $today["year"] . "-" . $today["mon"] . "-" . $today["mday"] . " " . $today["hours"] . ":" . $today["minutes"]; $haku=$_GET["haku"]; $haut=split(' ', trim($haku," ")); $muunnokset=array(0=>array("ä","ö","å","Ä","Ö","Å"),1=>array("ä","ö","å","Ä","Ö","Å")); $SQL1="SELECT c.link_data,c.name,f.data,c.id FROM cmfs AS c, files AS f WHERE c.owners<>'-1' AND c.type='file' AND c.id=f.fid"; $SQL2="SELECT c.name, c.id, c.type FROM cmfs AS c, search_keywords AS s WHERE c.owners<>'-1' AND (c.type='ext_img' OR c.type='ext_file') AND c.id=s.fid"; $SQL3="SELECT id,header,ingress,expire,archive FROM News WHERE status=100"; $SQL4="SELECT id,header,ingress FROM events WHERE status=100"; foreach ($haut as $val) { if ($val!="") { $SQL1.= " AND f.data LIKE '%" . rawurlencode(str_replace($muunnokset[0],$muunnokset[1],$val)) . "%'"; $SQL2.=" AND s.keywords LIKE '%" . inputShield($val) . "%'"; $SQL3.= " AND (header like '%" . inputShield($val) . "%' or ingress like '%" . inputShield($val) . "%' or text like '%" . inputShield($val) . "%')"; $SQL4.= " AND (header like '%" . inputShield($val) . "%' or ingress like '%" . inputShield($val) . "%' or text like '%" . inputShield($val) . "%')"; } } //Oikeudet $auth=$session->getAuth(); $user=$auth->getuser(); $res=$cn->query("SELECT gid FROM site_user_groups WHERE uid=" . $user->getId()); $groupit=""; while($row=$res->nextRow()) { $groupit.="(FIND_IN_SET('" . $row["gid"] . "', c.site_owners)>0) OR "; } $SQL1.=" AND (".$groupit."(FIND_IN_SET('1', c.site_owners)>0))"; $SQL2.=" AND (".$groupit."(FIND_IN_SET('1', c.site_owners)>0))"; $SQL3.=" AND releasequery($SQL1); $res2=$cn->query($SQL2); $res3=$cn->query($SQL3); $res4=$cn->query($SQL4); print 'Haku

'; print 'Haku sanalla: "' . $_GET["haku"] . '"

'; $search=false; if ($res1->numRows() > 0) { while($row = $res1->nextRow()) { print '' . str_replace(".html","",$row["name"]) . '
'; $ingress=str_replace("
"," ",strip_tags(rawurldecode($row["data"]))); $ingress=strstr(strtolower($ingress),strtolower(str_replace($muunnokset[0],$muunnokset[1],$haut[0]))); print substr($ingress,0,150) . '...

'; } $search=true; } if ($res2->numRows() > 0) { while($row = $res2->nextRow()) { if ($row["type"]=="ext_img") { print '' . $row["name"] . '

'; } $search=true; } if ($res3->numRows() > 0) { while($row = $res3->nextRow()) { if ($row["expire"]<$mod_date && $row["archive"]==1) { print '' . $row["header"] . '
'; print substr($row["ingress"],0,150) . '...

'; } if ($row["expire"]>$mod_date) { print '' . $row["header"] . '
'; print substr($row["ingress"],0,150) . '...

'; } } $search=true; } if ($res4->numRows() > 0) { while($row = $res4->nextRow()) { print '' . $row["header"] . '
'; print substr($row["ingress"],0,150) . '...

'; } $search=true; } if($search==false) print 'Hakusanalla ei löytynyt yhtään dokumenttia'; } else { print 'Hakusanan tulee olla vähintään 3 merkkiä pitkä'; } */ ?>
Copyright 2005 | Site design Nitro