[ Index ] |
PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2012 Oliver Georgi <oliver@phpwcms.de> // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 // ---------------------------------------------------------------- 24 // obligate check for phpwcms constants 25 if (!defined('PHPWCMS_ROOT')) { 26 die("You Cannot Access This Script Directly, Have a Nice Day."); 27 } 28 // ---------------------------------------------------------------- 29 30 31 32 //Suche template 33 34 if(isset($_POST["file_aktion"]) && intval($_POST["file_aktion"]) == 1) { 35 $search_string = explode(" ", clean_slweg($_POST["file_search"])); 36 if(sizeof($search_string)) { 37 foreach($search_string as $key => $value) { 38 if(trim($value)) $search["key"][$key] = trim($value); 39 } 40 unset($search_string); 41 if(isset($search["key"]) && sizeof($search["key"])) { 42 //check for AND or OR 43 $search["andor"] = (intval($_POST["file_andor"])) ? 1 : 0; 44 $search["which"] = intval($_POST["file_which"]); 45 switch($search["which"]) { 46 case 0: $search["which"]="f_public=0 AND f_uid=".$_SESSION["wcs_user_id"]; break; 47 case 1: $search["which"]="f_public=1"; break; 48 default: $search["which"]="(f_public=1 OR (f_public=0 AND f_uid=".$_SESSION["wcs_user_id"]."))"; break; 49 } 50 51 $file_key = get_list_of_file_keywords(); //Auslesen der File Schlüsselwörter 52 53 //Aufbau des eigentlichen Suchstrings 54 $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_aktiv=1 AND f_trash=0 AND f_kid=1 AND "; 55 $sql.= $search["which"].";"; //ob public oder private order keine Angabe 56 if($result = mysql_query($sql, $db) or die ("error while running search")) { 57 while($row = mysql_fetch_array($result)) { 58 $search["string"] = $row["f_name"]." ".$row["f_shortinfo"]." ".$row["f_longinfo"]; 59 $search["string"] = str_replace("\r\n", " ", $search["string"]); 60 $search["string"] = str_replace("\n", " ", $search["string"]); 61 $search["string"] .= add_keywords_to_search ($file_key, $row["f_keywords"]); //fügt freie Keywords zum Suchstring hinzu 62 63 foreach($search["key"] as $value) { 64 if(preg_match("/".preg_quote($value,"/")."/i", $search["string"])) { 65 if($search["andor"]) { 66 if(!isset($search["result"][$row["f_id"]])) {; //AND clause 67 $search["result"][$row["f_id"]] = 1; 68 } else { 69 $search["result"][$row["f_id"]]++; 70 } 71 } else { 72 $search["result"][$row["f_id"]] = 1; //OR clause 73 } 74 } 75 } 76 } 77 if(isset($search["result"]) && sizeof($search["result"]) && $search["andor"]) { 78 //Prüfen, ob die AND bedingung erfüllt ist 79 //gilt nur, wenn Anzahl Suchworte = Anzahl Funde im String 80 $search["count_key"] = sizeof($search["key"]); 81 foreach($search["result"] as $key => $value) { 82 if($search["count_key"] != $value) unset($search["result"][$key]); 83 } 84 } 85 } 86 } else { 87 $search["error"][1] = $BL['be_fsearch_err1']; 88 } 89 } else { 90 $search["error"][1] = $BL['be_fsearch_err1']; 91 } 92 } 93 94 ?> 95 <form action="phpwcms.php?do=files&f=3" method="post" enctype="multipart/form-data" name="searchfile" id="searchfile"> 96 <input name="file_aktion" type="hidden" id="file_aktion" value="1" /> 97 <table width="538" border="0" cellpadding="0" cellspacing="0" bgcolor='#EBF2F4' summary=""> 98 <tr><td colspan="2" valign="top"><img src="img/leer.gif" alt="" width="1" height="5" /></td></tr> 99 <tr> 100 <td width="67" rowspan="3" align="right" valign="top"><img src="img/leer.gif" alt="" width="10" height="1" /><img src="img/symbole/lupe_suche.gif" alt="" width="23" height="21" /><img src="img/leer.gif" alt="" width="10" height="1" /></td> 101 <td width="471" class="title"><?php echo $BL['be_fsearch_title'] ?></td> 102 </tr> 103 <tr><td valign="top"><img src="img/leer.gif" alt="" width="1" height="4" /></td></tr> 104 <tr><td class="v09"><?php echo $BL['be_fsearch_infotext'] ?></td></tr> 105 <tr> 106 <td colspan="2" valign="top"><img src="img/leer.gif" alt="" width="1" height="6" /></td> 107 </tr> 108 <?php if(isset($search["error"])) { //fehler suche anfang ?> 109 <tr> 110 <td valign="top"> </td> 111 <td valign="top" class="error"><?php 112 $zz=0; 113 foreach($search["error"] as $value) { 114 if($zz) echo "<br />"; 115 echo html_specialchars($value); 116 $zz++; 117 } 118 ?></td> 119 </tr> 120 <tr><td colspan="2" valign="top"><img src="img/leer.gif" alt="" width="1" height="6" /></td></tr> 121 <?php } //fehler suche ende ?> 122 <tr> 123 <td align="right" class="v09"><?php echo $BL['be_fsearch_searchlabel'] ?>: </td> 124 <td><table border="0" cellpadding="0" cellspacing="0" summary=""> 125 <tr> 126 <td> 127 <input name="file_search" type="text" class="v10" id="file_search" style="font-weight: bold; width: 300px;" value="<?php if(isset($_POST["file_search"])) echo html_specialchars(trim($_POST["file_search"])); ?>" size="40" maxlength="250" /><script language="JavaScript" type="text/javascript"> 128 <!-- 129 document.searchfile.file_search.focus(); 130 //--> 131 </script><img src="img/leer.gif" alt="" width="2" height="1" /></td> 132 <td><select name="file_andor" id="file_andor" class="v10" style="width: 50px;"> 133 <?php 134 135 $s1 = isset($_POST["file_andor"]) ? $_POST["file_andor"] : 1; 136 $s2 = isset($_POST["file_which"]) ? $_POST["file_which"] : 2; 137 138 ?> 139 <option value="1" <?php is_selected("1", $s1) ?>><?php echo $BL['be_fsearch_and'] ?></option> 140 <option value="0" <?php is_selected("0", $s1) ?>><?php echo $BL['be_fsearch_or'] ?></option> 141 </select><img src="img/leer.gif" alt="" width="2" height="1" /></td> 142 <td><select name="file_which" id="file_which" class="v10" style="width: 75px;"> 143 <option value="2" <?php is_selected("2", $s2) ?>><?php echo $BL['be_fsearch_all'] ?></option> 144 <option value="0" <?php is_selected("0", $s2) ?>><?php echo $BL['be_fsearch_personal'] ?></option> 145 <option value="1" <?php is_selected("1", $s2) ?>><?php echo $BL['be_fsearch_public'] ?></option> 146 </select><img src="img/leer.gif" alt="" width="5" height="1" /></td> 147 <td><input name="submit" type="image" id="submit" src="img/button/go_search.gif" alt="<?php echo $BL['be_fsearch_startsearch'] ?>" width="22" height="14" border="0" /></td> 148 </tr> 149 </table></td> 150 </tr> 151 <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td> 152 </tr> 153 <tr><td colspan="2" bgcolor="#9BBECA"><img src="img/leer.gif" alt="" width="1" height="4" /></td> 154 </tr> 155 </table> 156 </form> 157 <?php 158 159 if(isset($search["result"])) { 160 //Beginn Tabelle für Dateilisting 161 echo "<table width=\"538\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; 162 echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" width=\"1\" height=\"1\" /></td></tr>\n"; 163 164 $sl=0; $search["filelist"] = " "; 165 foreach($search["result"] as $key => $value) { 166 if($sl) $search["filelist"] .=" OR "; 167 $search["filelist"] .= "f_id=".intval($key); 168 $sl++; 169 } 170 171 //Listing der gefundenen Dateien 172 $file_sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE (". 173 ( (trim($search["filelist"])) ? $search["filelist"] : 0 ). 174 ") AND f_kid=1 AND f_trash=0 ORDER BY f_name;"; 175 if($file_result = mysql_query($file_sql, $db) or die ("error while listing files")) { 176 $file_durchlauf = 0; 177 while($file_row = mysql_fetch_array($file_result)) { 178 $filename = html_specialchars($file_row["f_name"]); 179 if(!$file_durchlauf) { //Aufbau der Zeile zum Einfließen der Filelisten-Tavbelle 180 echo "<tr bgcolor=\"#F5F8F9\"><td colspan=\"2\"><table width=\"538\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; 181 } else { 182 echo "<tr bgcolor=\"#FFFFFF\"><td colspan=\"5\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" /></td></tr>\n"; 183 } 184 echo "<tr>\n"; 185 echo "<td width=\"6\" class=\"msglist\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\" border=\"0\" /></td>\n"; 186 echo "<td width=\"13\" class=\"msglist\">"; 187 echo "<img src=\"img/icons/small_".extimg($file_row["f_ext"])."\" border=\"0\"></td>\n"; 188 echo "<td width=\"504\" class=\"msglist\"><img src=\"img/leer.gif\" height=\"1\" width=\"5\" />"; 189 //echo "<a href=\"fileinfo_public.php?fid=".$file_row["f_id"]; 190 echo "<a href=\"fileinfo.php?public&fid=".$file_row["f_id"]; 191 echo "\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars=yes,resizable=yes,width=500,height=400',1);return document.MM_returnValue;\">"; 192 echo $filename."</a>"; 193 194 echo "</td>\n"; 195 echo "<td width=\"15\" align=\"right\" class=\"msglist\">"; 196 echo "<a href=\"include/inc_act/act_download.php?pl=1&dl=".$file_row["f_id"]. 197 "\" target=\"_blank\" title=\"".$BL['be_fprivfunc_dlfile'].": ".$filename."\" target=\"_blank\">". 198 "<img src=\"img/button/download_disc.gif\" border=\"0\" /></a>"; 199 echo "<img src=\"img/leer.gif\" width=\"2\" height=\"1\" />"; //Spacer 200 echo "</td>\n"; 201 //Ende Aufbau 202 echo "</tr>\n"; 203 204 if($_SESSION["wcs_user_thumb"]) { 205 206 $thumb_image = get_cached_image( 207 array( "target_ext" => $file_row["f_ext"], 208 "image_name" => $file_row["f_hash"] . '.' . $file_row["f_ext"], 209 "thumb_name" => md5($file_row["f_hash"].$phpwcms["img_list_width"].$phpwcms["img_list_height"].$phpwcms["sharpen_level"]) 210 ) 211 ); 212 213 if($thumb_image != false) { 214 215 echo "<tr>\n"; 216 echo "<td width=\"6\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\" border=\"0\"></td>\n"; 217 echo "<td width=\"13\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\"></td>\n<td width=\""; 218 echo "504\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\"><a href=\"fileinfo.php?public&fid="; 219 echo $file_row["f_id"]."\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars="; 220 echo "yes,resizable=yes,width=500,height=400',1); return document.MM_returnValue;\">"; 221 echo '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3]."></a></td>\n"; 222 echo "<td width=\"15\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\"></td>\n</tr>\n"; 223 echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" height=\"2\" width=\"1\" border=\"0\"></td>\n</tr>\n"; 224 225 } 226 227 } 228 229 /* 230 if($file_row["f_thumb_list"] && $_SESSION["wcs_user_thumb"]) { //Wenn List Preview Image verfügbar 231 echo "<tr>\n"; 232 echo "<td width=\"6\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\" border=\"0\"></td>\n"; 233 echo "<td width=\"13\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\"></td>\n<td width=\""; 234 //echo "504\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\"><a href=\"fileinfo_public.php?fid="; 235 echo "504\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\"><a href=\"fileinfo.php?public&fid="; 236 echo $file_row["f_id"]."\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars="; 237 echo "yes,resizable=yes,width=500,height=400',1); return document.MM_returnValue;\">"; 238 echo "<img src=\"".$phpwcms["file_tmp"].$phpwcms["dir_thlist"].$file_row["f_thumb_list"]."\" border=\"0\"></a></td>\n"; 239 echo "<td width=\"15\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\"></td>\n</tr>\n"; 240 echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" height=\"2\" width=\"1\" border=\"0\"></td>\n</tr>\n"; 241 } 242 */ 243 $file_durchlauf++; 244 } 245 if($file_durchlauf) { //Abschluss der Filelisten-Tabelle 246 echo "</table>\n"; 247 echo "<tr bgcolor=\"#F5F8F9\"><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\"></td></tr>\n"; //Abstand vor 248 } else { 249 echo "<tr><td colspan=\"2\">"; 250 echo "<img src=\"img/leer.gif\" width=\"1\" height=\"6\"><br /><span class=\"error\" style=\"font-weight: bold;\">"; 251 echo " ".$BL['be_fsearch_nonfound']; 252 echo "</span><br /><img src=\"img/leer.gif\" width=\"1\" height=\"10\"></td></tr>\n"; 253 } 254 } //Ende Liste Dateien 255 256 echo "</table>\n"; //Ende Tabelle 257 258 } else { 259 //kein gültiges Suchergebnis 260 if(isset($search["string"])) { 261 echo "<img src=\"img/leer.gif\" width=\"1\" height=\"6\"><br /><span class=\"error\" style=\"font-weight: bold;\">"; 262 echo " ".$BL['be_fsearch_nonfound']; 263 echo "</span><br /><img src=\"img/leer.gif\" width=\"1\" height=\"6\">"; 264 } else { 265 echo "<img src=\"img/leer.gif\" width=\"1\" height=\"6\"><br />"; 266 echo " ".$BL['be_fsearch_fillin']; 267 echo "<br /><img src=\"img/leer.gif\" width=\"1\" height=\"6\">"; 268 } 269 } 270 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Jan 29 16:31:14 2012 | Cross-referenced by PHPXref 0.7.1 |