[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_lib/ -> files.public-functions.inc.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 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  //Funktionen zum Listen der privaten Dateien
  25  
  26  function list_public($pid, $dbcon, $vor, $zieldatei, $userID, $show_thumb=1, $phpwcms) {
  27      $klapp = $_SESSION["pklapp"];
  28      $pid = intval($pid);
  29      //Folder Listing für Public files
  30      $sql = "SELECT f_id, f_name FROM ".DB_PREPEND."phpwcms_file WHERE ".
  31             "f_pid=".intval($pid)." AND ".
  32             "f_public=1 AND f_aktiv=1 AND ".
  33             "f_uid=".intval($userID)." AND ".
  34             "f_kid=0 AND f_trash=0 ORDER BY f_sort, f_name";
  35      $result = mysql_query($sql, $dbcon);
  36      while($row = mysql_fetch_array($result)) {
  37          
  38          $dirname = html_specialchars($row["f_name"]);
  39          
  40          //Ermitteln des Aufklappwertes
  41          $klapp_status = isset($klapp[$row["f_id"]]) ? true_false($klapp[$row["f_id"]]) : 0;
  42          
  43          //Ermitteln, ob überhaupt abhängige Dateien/Ordner existieren
  44          $count_sql = "SELECT COUNT(f_id) FROM ".DB_PREPEND."phpwcms_file WHERE ".
  45                       "f_pid=".$row["f_id"]." AND ".
  46                       "f_uid=".intval($userID)." AND ".
  47                       "f_public=1 AND f_aktiv=1 AND ".
  48                       "f_trash=0 LIMIT 1";
  49          if($count_result = mysql_query($count_sql, $dbcon)) {
  50              if($count_row = mysql_fetch_row($count_result)) {
  51                  $count = "<img src=\"img/leer.gif\" width=\"2\" height=\"1\">".
  52                           "<a href=\"".$zieldatei."&pklapp=".$row["f_id"].
  53                           "|".$klapp_status."\">".on_off($klapp_status, $dirname, 0)."</a>";
  54                  $count_wert = $count_row[0];
  55              }
  56              mysql_free_result($count_result);
  57          }
  58          
  59          //Aufbau der Zeile
  60          echo "<tr bgcolor=\"#EBF2F4\"><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\"></td></tr>\n"; //Abstand vor
  61          echo "<tr bgcolor=\"#EBF2F4\">\n"; //Einleitung Tabellenzeile
  62          echo "<td width=\"488\" class='msglist'>"; //Einleiten der Tabellenzelle
  63          echo $count."<img src=\"img/leer.gif\" height=\"1\" width=\"".($vor+6)."\" border=\"0\"><img src=\"img/icons/folder_zu.gif\" border=\"0\">"; //Zellinhalt 1. Spalte
  64          echo "<img src=\"img/leer.gif\" height=\"1\" width=\"5\"><strong>".$dirname; //Zellinhalt 1. Spalte Fortsetzung
  65          echo "</strong></td>\n"; //Schließen Zelle 1. Spalte
  66          //Zelle 2. Spalte - vorgesehen für Buttons/Tasten Edit etc.
  67          echo "<td width=\"50\" align=\"right\" class=\"msglist\">";
  68          echo "<img src=\"img/leer.gif\" width=\"50\" height=\"1\">"; //Spacer
  69          echo "</td>\n"; 
  70          echo "</tr>\n"; //Abschluss Tabellenzeile
  71          
  72          //Aufbau trennende Tabellen-Zeile
  73          echo "<tr bgcolor=\"#EBF2F4\"><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\"></td></tr>\n"; //Abstand nach
  74          echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\"></td></tr>\n"; //Trennlinie<img src='img/lines/line-lightgrey-dotted-538.gif'>
  75          
  76          //Weiter, wenn Unterstruktur
  77          if(!$klapp_status && $count_wert) { //$vor."<img src='img/leer.gif' height=1 width=18 border=0>"
  78              list_public($row["f_id"], $dbcon, $vor+18, $zieldatei, $userID, $show_thumb, $phpwcms);
  79              
  80              //Listing eventuell im Verzeichnis enthaltener Dateien
  81              $file_sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_pid=".$row["f_id"]." AND f_uid=".intval($userID).
  82                          " AND f_public=1 AND f_aktiv=1 AND f_kid=1 AND f_trash=0 ORDER BY f_sort, f_name";
  83              if($file_result = mysql_query($file_sql, $dbcon) or die ("error while listing files")) {
  84                  $file_durchlauf = 0;
  85                  while($file_row = mysql_fetch_array($file_result)) {
  86                      $filename = html_specialchars($file_row["f_name"]);
  87                      if(!$file_durchlauf) { //Aufbau der Zeile zum Einfließen der Filelisten-Tabelle
  88                          echo "<tr bgcolor=\"#F5F8F9\"><td colspan=\"2\"><table width=\"538\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; 
  89                      } else {
  90                          echo "<tr bgcolor=\"#FFFFFF\"><td colspan=\"5\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\"></td></tr>\n";
  91                      }
  92                      echo "<tr>\n";
  93                      echo "<td width=\"".($vor+37)."\" class=\"msglist\"><img src=\"img/leer.gif\" height=\"1\" width=\"".($vor+37)."\" border=\"0\"></td>\n";
  94                      echo "<td width=\"13\" class=\"msglist\">";
  95                      echo "<img src=\"img/icons/small_".extimg($file_row["f_ext"])."\" border=\"0\"";
  96      
  97                      echo ' onmouseover="Tip(\'ID: '.$file_row["f_id"].'&lt;br&gt;Sort: '.$file_row["f_sort"].'\');" alt=""';
  98                      
  99                      echo "></td>\n";
 100                      echo "<td width=\"".(473-$vor)."\" class=\"msglist\"><img src=\"img/leer.gif\" height=\"1\" width=\"5\">"; //438-$vor
 101                      echo "<a href=\"fileinfo.php?public&amp;fid=".$file_row["f_id"];
 102                      echo "\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars=yes,resizable=yes,width=500,height=400',1);return document.MM_returnValue;\">";
 103                      echo $filename."</a>";
 104                      echo "</td>\n";
 105                      echo "<td width=\"15\" align=\"right\" class=\"msglist\">";
 106                      echo "<a href=\"include/inc_act/act_download.php?pl=1&dl=".$file_row["f_id"];
 107                      echo "\" target=\"_blank\" title=\"".$GLOBALS['BL']['be_fprivfunc_dlfile'].": ".$filename."\">";
 108                      echo "<img src=\"img/button/download_disc.gif\" border=0></a>"; //target='_blank'
 109                      echo "<img src=\"img/leer.gif\" width=\"2\" height=\"1\">"; //Spacer
 110                      echo "</td>\n";
 111                      //Ende Aufbau
 112                      echo "</tr>\n";
 113                      
 114                      
 115                      if($_SESSION["wcs_user_thumb"]) {
 116              
 117                          $thumb_image = get_cached_image(
 118                                   array(    "target_ext"    =>    $file_row["f_ext"],
 119                                          "image_name"    =>    $file_row["f_hash"] . '.' . $file_row["f_ext"],
 120                                          "thumb_name"    =>    md5($file_row["f_hash"].$phpwcms["img_list_width"].$phpwcms["img_list_height"].$phpwcms["sharpen_level"])
 121                                        )
 122                                  );
 123  
 124                          if($thumb_image != false) {
 125                              
 126                              echo "<tr>\n";
 127                              echo "<td width=\"".($vor+37)."\"><img src=\"img/leer.gif\" height=\"1\" width=\"".($vor+37)."\" border=\"0\"></td>\n";
 128                              echo "<td width=\"13\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\"></td>\n<td width=\"";
 129                              echo (473-$vor)."\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\"><a href=\"fileinfo.php?public&amp;fid=";
 130                              echo $file_row["f_id"]."\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars=";
 131                              echo "yes,resizable=yes,width=500,height=400',1); return document.MM_returnValue;\">";
 132                              echo '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3];
 133                              
 134                              echo ' onmouseover="Tip(\'ID: '.$file_row["f_id"].'\');" alt=""';
 135                              
 136                              echo "></a></td>\n";    
 137                              echo "<td width=\"15\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\"></td>\n</tr>\n";
 138                              echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" height=\"2\" width=\"1\" border=\"0\"></td>\n</tr>\n";
 139          
 140                          }
 141                  
 142                      }
 143  
 144                      $file_durchlauf++;
 145                  }
 146                  if($file_durchlauf) { //Abschluss der Filelisten-Tabelle
 147                      echo "</table>\n";
 148                      echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\"></td></tr>\n";
 149                  }
 150              } //Ende Liste Dateien
 151          }
 152          //Zaehler mitführen
 153          $_SESSION["list_zaehler"]++;
 154      }
 155      mysql_free_result($result);
 156      return $vor;
 157  }
 158  
 159  function true_false($wert) {
 160      //Wechselt den Wahr/Falsch wert zum Gegenteil: 1=>0 und 0=>1
 161      return (intval($wert)) ? 0 : 1;
 162  }
 163  
 164  function on_off($wert, $string, $art = 1) {
 165      //Erzeugt das Status-Zeichen für Klapp-Auf/Zu
 166      //Wenn Art = 1 dann als Zeichen, ansonsten als Bild
 167      if($wert) {
 168          return ($art == 1) ? "+" : "<img src=\"img/symbols/klapp_zu.gif\" border=\"0\" title=\"".$GLOBALS['BL']['be_fprivfunc_opendir']." ".$string."\">";
 169      } else {
 170          return ($art == 1) ? "-" : "<img src=\"img/symbols/klapp_auf.gif\" border=\"0\" title=\"".$GLOBALS['BL']['be_fprivfunc_closedir']." ".$string."\">";
 171      }
 172  }
 173  
 174  function list_public_root($wert) {
 175      //Checken ob public root files für user gezeigt werden sollen
 176      return ($wert) ? 1 : 0;
 177  }
 178  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7