[ Index ]

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

title

Body

[close]

/include/inc_lib/ -> files.private-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  //Funktionen zum Listen der privaten Dateien
  24  
  25  function list_private($pid, $dbcon, $vor, $zieldatei, $userID, $cutID=0, $show_thumb=1, $phpwcms) {
  26      $cutID = intval($cutID);
  27      $klapp = $_SESSION["klapp"];
  28      $pid = intval($pid);
  29      $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE ".
  30             "f_pid=".intval($pid)." AND ".
  31             "f_uid=".intval($userID)." AND ".
  32             "f_kid=0 AND f_trash=0 ORDER BY f_sort, f_name";
  33      $result = mysql_query($sql, $dbcon);
  34      while($row = mysql_fetch_array($result)) {
  35          
  36          $dirname = html_specialchars($row["f_name"]);
  37          
  38          //Ermitteln des Aufklappwertes
  39          $klapp_status = isset($klapp[$row["f_id"]]) ? true_false($klapp[$row["f_id"]]) : 1;
  40          
  41          //Ermitteln, ob überhaupt abhängige Dateien/Ordner existieren
  42          $count_sql = "SELECT COUNT(f_id) FROM ".DB_PREPEND."phpwcms_file WHERE ".
  43                       "f_pid=".$row["f_id"]." AND ".
  44                       "f_uid=".intval($userID)." AND ".
  45                       "f_trash=0 LIMIT 1";
  46          if($count_result = mysql_query($count_sql, $dbcon)) {
  47              if($count_row = mysql_fetch_row($count_result)) {
  48                  $count = '<img src="img/leer.gif" width="2" height="1">'.
  49                           '<a href="'.$zieldatei."&amp;klapp=".$row["f_id"].
  50                           '%7C'.$klapp_status.'">'.on_off($klapp_status, $dirname, 0)."</a>"; // | = %7C
  51                  $count_wert = $count_row[0];
  52              }
  53              mysql_free_result($count_result);
  54          }
  55          
  56          //Aufbau der Zeile
  57          echo '<tr bgcolor="#EBF2F4"><td colspan="2"><img src="img/leer.gif" height="1" width="1" alt="" /></td></tr>'."\n"; //Abstand vor
  58          echo "<tr bgcolor=\"#EBF2F4\">\n"; //Einleitung Tabellenzeile
  59          echo "<td width=\"438\" class=\"msglist\">"; //Einleiten der Tabellenzelle
  60          echo $count."<img src=\"img/leer.gif\" height=\"1\" width=\"".($vor+6)."\" border=\"0\">";
  61          
  62          // Gallery status
  63          switch($row["f_gallerystatus"]) {
  64              
  65              case 2:        // gallery root dir
  66                          echo '<img src="img/icons/folder_galleryroot.gif" border="0" alt="'.$GLOBALS['BL']['be_gallery_root'].'" title="'.$GLOBALS['BL']['be_gallery_root'].'" />';
  67                          break;
  68              
  69              case 3:        // gallery subdir
  70                          echo '<img src="img/icons/folder_gallerysub.gif" border="0" alt="'.$GLOBALS['BL']['be_gallery_directory'].'" title="'.$GLOBALS['BL']['be_gallery_directory'].'" />';
  71                          break;
  72              
  73              default:    echo "<img src=\"img/icons/folder_zu.gif\" border=\"0\" alt=\"\" />";
  74          }
  75          
  76          echo "<img src=\"img/leer.gif\" height=\"1\" width=\"5\"><strong>".$dirname; //Zellinhalt 1. Spalte Fortsetzung
  77          echo "</strong></td>\n"; //Schließen Zelle 1. Spalte
  78          //Zelle 2. Spalte - vorgesehen für Buttons/Tasten Edit etc.
  79          echo "<td width=\"100\" align=\"right\" class=\"msglist\">";
  80          //Button zum Uploaden einer Datei in dieses Verzeichnisses
  81          echo "<a href=\"".$zieldatei."&amp;upload=".$row["f_id"]."\" title=\"".$GLOBALS['BL']['be_fprivfunc_upload'].": ".$dirname."\">";
  82          echo "<img src=\"img/button/upload_13x13.gif\" border=\"0\" alt=\"\" /></a>";        
  83          if(!$cutID) { //Button zum Erzeugen eines Neuen Unterverzeichnisses
  84              echo "<a href=\"".$zieldatei."&amp;mkdir=".$row["f_id"]."\" title=\"".$GLOBALS['BL']['be_fprivfunc_makenew'].": ".$dirname."\">";
  85              echo "<img src=\"img/button/add_13x13.gif\" border=\"0\" alt=\"\" /></a>";
  86          } else {  //Button zum Einfügen der Clipboard-Datei in das Verzeichnis
  87              echo "<a href=\"include/inc_act/act_file.php?paste=".$cutID.'%7C'.$row["f_id"].
  88                   "\" title=\"".$GLOBALS['BL']['be_fprivfunc_paste'].": ".$dirname."\">";
  89              echo "<img src=\"img/button/paste_13x13.gif\" border=\"0\" alt=\"\" /></a>";
  90          }
  91          //Button zum Bearbeiten des Verzeichnisses
  92          echo "<a href=\"".$zieldatei."&amp;editdir=".$row["f_id"]."\" title=\"".$GLOBALS['BL']['be_fprivfunc_edit'].": ".$dirname."\">";
  93          echo "<img src=\"img/button/edit_22x13.gif\" border=\"0\" alt=\"\" /></a>";
  94          //Button zum Umschalten zwischen Aktiv/Inaktiv
  95          echo "<a href=\"include/inc_act/act_file.php?aktiv=".$row["f_id"].'%7C'.true_false($row["f_aktiv"]).
  96               "\" title=\"".$GLOBALS['BL']['be_fprivfunc_cactive'].": ".$dirname."\">";
  97          echo "<img src=\"img/button/aktiv_12x13_".$row["f_aktiv"].".gif\" border=\"0\" alt=\"\" /></a>";
  98          //Button zum Umschalten zwischen Public/Non-Public
  99          echo "<a href=\"include/inc_act/act_file.php?public=".$row["f_id"].'%7C'.true_false($row["f_public"]).
 100               "\" title=\"".$GLOBALS['BL']['be_fprivfunc_cpublic'].": ".$dirname."\">";
 101          echo "<img src=\"img/button/public_12x13_".$row["f_public"].".gif\" border=\"0\" alt=\"\" /></a>";
 102          echo "<img src=\"img/leer.gif\" width=\"5\" height=\"1\">"; //Spacer
 103          //Button zum Löschen des Verzeichnisses, wenn leer
 104          if(!$count_wert) {
 105              echo "<a href=\"include/inc_act/act_file.php?delete=".$row["f_id"].'%7C'."9".
 106                   "\" title=\"".$GLOBALS['BL']['be_fprivfunc_deldir'].": ".$dirname."\" onclick=\"return confirm('".
 107                   $GLOBALS['BL']['be_fprivfunc_jsdeldir'] ." \\n[".$dirname."]? ');\">";
 108              echo "<img src=\"img/button/trash_13x13_1.gif\" border=\"0\" alt=\"\" /></a>";
 109          } else {
 110              echo "<img src=\"img/button/trash_13x13_0.gif\" title=\"";
 111              echo str_replace('{VAL}', $dirname, $GLOBALS['BL']['be_fprivfunc_notempty']).'" border="0" alt="" />';
 112          }
 113          echo "<img src=\"img/leer.gif\" width=\"2\" height=\"1\" border=\"0\" alt=\"\" />"; //Spacer
 114          echo "</td>\n"; 
 115          echo "</tr>\n"; //Abschluss Tabellenzeile
 116          
 117          //Aufbau trennende Tabellen-Zeile
 118          echo "<tr bgcolor=\"#EBF2F4\"><td colspan=\"2\"><img src=\"img/leer.gif\" border=\"0\" alt=\"\" /></td></tr>\n"; //Abstand nach
 119          echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" border=\"0\" alt=\"\" /></td></tr>\n"; //Trennlinie<img src='img/lines/line-lightgrey-dotted-538.gif'>
 120          
 121          //Weiter, wenn Unterstruktur
 122          if(!$klapp_status && $count_wert) { //$vor."<img src='img/leer.gif' height=1 width=18 border=0>"
 123              list_private($row["f_id"], $dbcon, $vor+18, $zieldatei, $userID, $cutID, $show_thumb, $phpwcms);
 124              
 125              //Listing eventuell im Verzeichnis enthaltener Dateien
 126              $file_sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_pid=".$row["f_id"].
 127                          " AND f_uid=".$userID." AND f_kid=1 AND f_trash=0 ORDER BY f_sort, f_name";
 128              if($file_result = mysql_query($file_sql, $dbcon) or die ("error while listing files")) {
 129                  $file_durchlauf = 0;
 130                  while($file_row = mysql_fetch_array($file_result)) {
 131                      $filename = html_specialchars($file_row["f_name"]);
 132                      if(!$file_durchlauf) { //Aufbau der Zeile zum Einfließen der Filelisten-Tavbelle
 133                          echo "<tr bgcolor=\"#F5F8F9\"><td colspan=\"2\"><table width=\"538\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; 
 134                          echo "<!-- start file list: private-functions //-->\n";
 135                      } else {
 136                          echo "<tr bgcolor=\"#FFFFFF\"><td colspan=\"5\"><img src=\"img/leer.gif\" border=\"0\" alt=\"\" /></td></tr>\n";
 137                      }
 138                      echo "<tr>\n";
 139                      echo "<td width=\"".($vor+37)."\" class=\"msglist\"><img src=\"img/leer.gif\" height=\"1\" width=\"".($vor+37)."\" border=\"0\" alt=\"\" /></td>\n";
 140                      echo "<td width=\"13\" class=\"msglist\">";
 141                      echo "<img src=\"img/icons/small_".extimg($file_row["f_ext"])."\" border=\"0\"";
 142                      echo ' onmouseover="Tip(\'ID: '.$file_row["f_id"].'&lt;br&gt;Sort: '.$file_row["f_sort"].'\');" alt=""';
 143                      echo " /></td>\n";
 144                      echo "<td width=\"".(388-$vor)."\" class=\"msglist\"><img src=\"img/leer.gif\" height=\"1\" width=\"5\" border=\"0\" alt=\"\" />";
 145                      echo "<a href=\"fileinfo.php?fid=".$file_row["f_id"];
 146                      echo "\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars=yes,resizable=yes,width=500,height=400',1);return document.MM_returnValue;\">";
 147                      echo $filename."</a></td>\n";
 148                      //Aufbauen Buttonleiste für jeweilige Datei
 149                      echo "<td width=\"100\" align=\"right\" class=\"msglist\">";
 150                      //Button zum Downloaden der Datei
 151                      echo "<a href=\"include/inc_act/act_download.php?dl=".$file_row["f_id"].
 152                           "\"  target=\"_blank\" title=\"".$GLOBALS['BL']['be_fprivfunc_dlfile'].": ".$filename."\">".
 153                           "<img src=\"img/button/download_disc.gif\" border=\"0\" alt=\"\" /></a>"; //target='_blank'
 154                      //Button zum Erzeugen eines Neuen Unterverzeichnisses
 155                      if($cutID == $file_row["f_id"]) {
 156                          echo "<img src=\"img/button/cut_13x13_1.gif\" border=\"0\" title=\"".$GLOBALS['BL']['be_fprivfunc_clipfile'].": ".$filename."\" alt=\"\" />";
 157                      } else {
 158                          echo "<a href=\"".$zieldatei."&amp;cut=".$file_row["f_id"]."\" title=\"".$GLOBALS['BL']['be_fprivfunc_cutfile'].": ".$filename."\">";
 159                          echo "<img src=\"img/button/cut_13x13_0.gif\" border=\"0\" alt=\"\" /></a>";
 160                      }
 161                      //Button zum Bearbeiten der Dateiinformationn
 162                      echo "<a href=\"".$zieldatei."&amp;editfile=".$file_row["f_id"]."\" title=\"".$GLOBALS['BL']['be_fprivfunc_editfile'].": ".$filename."\">";
 163                      echo "<img src=\"img/button/edit_22x13.gif\" border=\"0\" alt=\"\" /></a>";                    
 164                      //Button zum Umschalten zwischen Aktiv/Inaktiv
 165                      echo "<a href=\"include/inc_act/act_file.php?aktiv=".$file_row["f_id"].'%7C'.true_false($file_row["f_aktiv"]).
 166                            "\" title=\"".$GLOBALS['BL']['be_fprivfunc_cactivefile'].": ".$filename."\">";
 167                      echo "<img src=\"img/button/aktiv_12x13_".$file_row["f_aktiv"].".gif\" border=\"0\" alt=\"\" /></a>";
 168                      //Button zum Umschalten zwischen Public/Non-Public
 169                      echo "<a href=\"include/inc_act/act_file.php?public=".$file_row["f_id"].'%7C'.true_false($file_row["f_public"]).
 170                            "\" title=\"".$GLOBALS['BL']['be_fprivfunc_cpublicfile'].": ".$filename."\">";
 171                      echo "<img src=\"img/button/public_12x13_".$file_row["f_public"].".gif\" border=\"0\" alt=\"\" /></a>";
 172                      echo "<img src=\"img/leer.gif\" width=\"5\" height=\"1\">"; //Spacer                    
 173                      //Button zum Löschen der Datei
 174                      echo "<a href=\"include/inc_act/act_file.php?trash=".$file_row["f_id"].'%7C'."1".
 175                            "\" title=\"".$GLOBALS['BL']['be_fprivfunc_movetrash'].": ".$filename."\" onclick=\"return confirm('".
 176                           $GLOBALS['BL']['be_fprivfunc_jsmovetrash1']."\\n[".$filename."]\\n".$GLOBALS['BL']['be_fprivfunc_jsmovetrash2'].
 177                           "');\">".
 178                           "<img src=\"img/button/trash_13x13_1.gif\" border=\"0\" alt=\"\" /></a>";
 179                      echo "<img src=\"img/leer.gif\" width=\"2\" height=\"1\" border=\"0\" alt=\"\" />"; //Spacer
 180                      echo "</td>\n";
 181                      //Ende Aufbau
 182                      echo "</tr>\n";
 183                      
 184                      
 185                      if($_SESSION["wcs_user_thumb"]) {
 186          
 187                          // now try to get existing thumbnails or if not exists 
 188                          // build new based on default thumbnail listing sizes
 189              
 190                          // build thumbnail image name
 191                          $thumb_image = get_cached_image(
 192                                   array(    "target_ext"    =>    $file_row["f_ext"],
 193                                          "image_name"    =>    $file_row["f_hash"] . '.' . $file_row["f_ext"],
 194                                          "thumb_name"    =>    md5($file_row["f_hash"].$phpwcms["img_list_width"].$phpwcms["img_list_height"].$phpwcms["sharpen_level"])
 195                                        )
 196                                  );
 197  
 198                          if($thumb_image != false) {
 199                          
 200                          
 201                              echo "<tr>\n";
 202                              echo "<td width=\"".($vor+37)."\"><img src=\"img/leer.gif\" height=\"1\" width=\"".($vor+37)."\" border=\"0\" alt=\"\" /></td>\n";
 203                              echo "<td width=\"13\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\" alt=\"\" /></td>\n<td width=\"";
 204                              echo (388-$vor)."\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\" border=\"0\" alt=\"\" /><a href=\"fileinfo.php?fid=";
 205                              echo $file_row["f_id"]."\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars=";
 206                              echo "yes,resizable=yes,width=500,height=400',1); return document.MM_returnValue;\">";
 207                              echo '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3];
 208                              echo ' onmouseover="Tip(\'ID: '.$file_row["f_id"].'&lt;br&gt;Sort: '.$file_row["f_sort"].'\');" alt=""';
 209                              echo " /></a></td>\n";
 210                              echo "<td width=\"100\"><img src=\"img/leer.gif\" border=\"0\" alt=\"\" /></td>\n</tr>\n";
 211                              echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" height=\"2\" width=\"1\" border=\"0\" alt=\"\" /></td>\n</tr>\n";
 212                  
 213                          }
 214              
 215                      }
 216                      
 217              
 218                      $file_durchlauf++;
 219                  }
 220                  if($file_durchlauf) { //Abschluss der Filelisten-Tabelle
 221                      echo "</table>\n<!-- end file list: private-functions //-->\n";
 222                      echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" border=\"0\" alt=\"\" /></td></tr>\n";
 223                  }
 224              } //Ende Liste Dateien
 225          }
 226          
 227          //Zaehler mitführen
 228          $_SESSION["list_zaehler"]++;
 229      }
 230      mysql_free_result($result);
 231      return $vor;
 232  }
 233  
 234  function true_false($wert) {
 235      //Wechselt den Wahr/Falsch wert zum Gegenteil: 1=>0 und 0=>1
 236      return (intval($wert)) ? 0 : 1;
 237  }
 238  
 239  function on_off($wert, $string, $art = 1) {
 240      //Erzeugt das Status-Zeichen für Klapp-Auf/Zu
 241      //Wenn Art = 1 dann als Zeichen, ansonsten als Bild
 242      if($wert) {
 243          return ($art == 1) ? "+" : "<img src=\"img/symbols/klapp_zu.gif\" title=\"".$GLOBALS['BL']['be_fprivfunc_opendir'].": ".$string."\" border=\"0\" alt=\"\" />";
 244      } else {
 245          return ($art == 1) ? "-" : "<img src=\"img/symbols/klapp_auf.gif\" title=\"".$GLOBALS['BL']['be_fprivfunc_closedir'].": ".$string."\" border=\"0\" alt=\"\" />";
 246      }
 247  }
 248  ?>


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