// All rights reserved. This script is part of PHPWCMS. The PHPWCMS web content management system 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; either version 2 of the License, or (at your option) any later version. The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html A copy is found in the textfile GPL.txt and important notices to the license from the author is found in LICENSE.txt distributed with these scripts. This script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This copyright notice MUST APPEAR in all copies of the script! *************************************************************************************/ // ---------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ---------------------------------------------------------------- //Suche template if(isset($_POST["file_aktion"]) && intval($_POST["file_aktion"]) == 1) { $search_string = explode(" ", clean_slweg($_POST["file_search"])); if(sizeof($search_string)) { foreach($search_string as $key => $value) { if(trim($value)) $search["key"][$key] = trim($value); } unset($search_string); if(isset($search["key"]) && sizeof($search["key"])) { //check for AND or OR $search["andor"] = (intval($_POST["file_andor"])) ? 1 : 0; $search["which"] = intval($_POST["file_which"]); switch($search["which"]) { case 0: $search["which"]="f_public=0 AND f_uid=".$_SESSION["wcs_user_id"]; break; case 1: $search["which"]="f_public=1"; break; default: $search["which"]="(f_public=1 OR (f_public=0 AND f_uid=".$_SESSION["wcs_user_id"]."))"; break; } $file_key = get_list_of_file_keywords(); //Auslesen der File Schlüsselwörter //Aufbau des eigentlichen Suchstrings $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_aktiv=1 AND f_trash=0 AND f_kid=1 AND "; $sql.= $search["which"].";"; //ob public oder private order keine Angabe if($result = mysql_query($sql, $db) or die ("error while running search")) { while($row = mysql_fetch_array($result)) { $search["string"] = $row["f_name"]." ".$row["f_shortinfo"]." ".$row["f_longinfo"]; $search["string"] = str_replace("\r\n", " ", $search["string"]); $search["string"] = str_replace("\n", " ", $search["string"]); $search["string"] .= add_keywords_to_search ($file_key, $row["f_keywords"]); //fügt freie Keywords zum Suchstring hinzu foreach($search["key"] as $value) { if(preg_match("/".preg_quote($value,"/")."/i", $search["string"])) { if($search["andor"]) { if(!isset($search["result"][$row["f_id"]])) {; //AND clause $search["result"][$row["f_id"]] = 1; } else { $search["result"][$row["f_id"]]++; } } else { $search["result"][$row["f_id"]] = 1; //OR clause } } } } if(isset($search["result"]) && sizeof($search["result"]) && $search["andor"]) { //Prüfen, ob die AND bedingung erfüllt ist //gilt nur, wenn Anzahl Suchworte = Anzahl Funde im String $search["count_key"] = sizeof($search["key"]); foreach($search["result"] as $key => $value) { if($search["count_key"] != $value) unset($search["result"][$key]); } } } } else { $search["error"][1] = $BL['be_fsearch_err1']; } } else { $search["error"][1] = $BL['be_fsearch_err1']; } } ?>
  "; echo html_specialchars($value); $zz++; } ?>
" size="40" maxlength="250" />
\n"; echo "\n"; $sl=0; $search["filelist"] = " "; foreach($search["result"] as $key => $value) { if($sl) $search["filelist"] .=" OR "; $search["filelist"] .= "f_id=".intval($key); $sl++; } //Listing der gefundenen Dateien $file_sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE (". ( (trim($search["filelist"])) ? $search["filelist"] : 0 ). ") AND f_kid=1 AND f_trash=0 ORDER BY f_name;"; if($file_result = mysql_query($file_sql, $db) or die ("error while listing files")) { $file_durchlauf = 0; while($file_row = mysql_fetch_array($file_result)) { $filename = html_specialchars($file_row["f_name"]); if(!$file_durchlauf) { //Aufbau der Zeile zum Einfließen der Filelisten-Tavbelle echo "\n"; } else { echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; //Ende Aufbau echo "\n"; if($_SESSION["wcs_user_thumb"]) { $thumb_image = get_cached_image( array( "target_ext" => $file_row["f_ext"], "image_name" => $file_row["f_hash"] . '.' . $file_row["f_ext"], "thumb_name" => md5($file_row["f_hash"].$phpwcms["img_list_width"].$phpwcms["img_list_height"].$phpwcms["sharpen_level"]) ) ); if($thumb_image != false) { echo "\n"; echo "\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; } } /* if($file_row["f_thumb_list"] && $_SESSION["wcs_user_thumb"]) { //Wenn List Preview Image verfügbar echo "\n"; echo "\n"; echo "\n\n"; echo "\n\n"; echo "\n\n"; } */ $file_durchlauf++; } if($file_durchlauf) { //Abschluss der Filelisten-Tabelle echo "
"; echo ""; //echo ""; echo $filename.""; echo ""; echo "". ""; echo ""; //Spacer echo "
"; echo '
"; echo "
\n"; echo "\n"; //Abstand vor } else { echo ""; echo "
"; echo "    ".$BL['be_fsearch_nonfound']; echo "
\n"; } } //Ende Liste Dateien echo "\n"; //Ende Tabelle } else { //kein gültiges Suchergebnis if(isset($search["string"])) { echo "
"; echo "    ".$BL['be_fsearch_nonfound']; echo "
"; } else { echo "
"; echo "    ".$BL['be_fsearch_fillin']; echo "
"; } } ?>