[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

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

   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  //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"];
 143                      echo '&lt;br&gt;Name: '.html_specialchars($file_row["f_name"]);
 144                      if($file_row["f_copyright"]) {
 145                          echo '&lt;br&gt;&copy;: '.html_specialchars($file_row["f_copyright"]);
 146                      }
 147                      echo '\');" onmouseout="UnTip()" alt=""';
 148                      echo " /></td>\n";
 149                      echo "<td width=\"".(388-$vor)."\" class=\"msglist\"><img src=\"img/leer.gif\" height=\"1\" width=\"5\" border=\"0\" alt=\"\" />";
 150                      echo "<a href=\"fileinfo.php?fid=".$file_row["f_id"];
 151                      echo "\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars=yes,resizable=yes,width=500,height=400',1);return document.MM_returnValue;\">";
 152                      echo $filename."</a></td>\n";
 153                      //Aufbauen Buttonleiste für jeweilige Datei
 154                      echo "<td width=\"100\" align=\"right\" class=\"msglist\">";
 155                      //Button zum Downloaden der Datei
 156                      echo "<a href=\"include/inc_act/act_download.php?dl=".$file_row["f_id"].
 157                           "\"  target=\"_blank\" title=\"".$GLOBALS['BL']['be_fprivfunc_dlfile'].": ".$filename."\">".
 158                           "<img src=\"img/button/download_disc.gif\" border=\"0\" alt=\"\" /></a>"; //target='_blank'
 159                      //Button zum Erzeugen eines Neuen Unterverzeichnisses
 160                      if($cutID == $file_row["f_id"]) {
 161                          echo "<img src=\"img/button/cut_13x13_1.gif\" border=\"0\" title=\"".$GLOBALS['BL']['be_fprivfunc_clipfile'].": ".$filename."\" alt=\"\" />";
 162                      } else {
 163                          echo "<a href=\"".$zieldatei."&amp;cut=".$file_row["f_id"]."\" title=\"".$GLOBALS['BL']['be_fprivfunc_cutfile'].": ".$filename."\">";
 164                          echo "<img src=\"img/button/cut_13x13_0.gif\" border=\"0\" alt=\"\" /></a>";
 165                      }
 166                      //Button zum Bearbeiten der Dateiinformationn
 167                      echo "<a href=\"".$zieldatei."&amp;editfile=".$file_row["f_id"]."\" title=\"".$GLOBALS['BL']['be_fprivfunc_editfile'].": ".$filename."\">";
 168                      echo "<img src=\"img/button/edit_22x13.gif\" border=\"0\" alt=\"\" /></a>";                    
 169                      //Button zum Umschalten zwischen Aktiv/Inaktiv
 170                      echo "<a href=\"include/inc_act/act_file.php?aktiv=".$file_row["f_id"].'%7C'.true_false($file_row["f_aktiv"]).
 171                            "\" title=\"".$GLOBALS['BL']['be_fprivfunc_cactivefile'].": ".$filename."\">";
 172                      echo "<img src=\"img/button/aktiv_12x13_".$file_row["f_aktiv"].".gif\" border=\"0\" alt=\"\" /></a>";
 173                      //Button zum Umschalten zwischen Public/Non-Public
 174                      echo "<a href=\"include/inc_act/act_file.php?public=".$file_row["f_id"].'%7C'.true_false($file_row["f_public"]).
 175                            "\" title=\"".$GLOBALS['BL']['be_fprivfunc_cpublicfile'].": ".$filename."\">";
 176                      echo "<img src=\"img/button/public_12x13_".$file_row["f_public"].".gif\" border=\"0\" alt=\"\" /></a>";
 177                      echo "<img src=\"img/leer.gif\" width=\"5\" height=\"1\">"; //Spacer                    
 178                      //Button zum Löschen der Datei
 179                      echo "<a href=\"include/inc_act/act_file.php?trash=".$file_row["f_id"].'%7C'."1".
 180                            "\" title=\"".$GLOBALS['BL']['be_fprivfunc_movetrash'].": ".$filename."\" onclick=\"return confirm('".
 181                           $GLOBALS['BL']['be_fprivfunc_jsmovetrash1']."\\n[".$filename."]\\n".$GLOBALS['BL']['be_fprivfunc_jsmovetrash2'].
 182                           "');\">".
 183                           "<img src=\"img/button/trash_13x13_1.gif\" border=\"0\" alt=\"\" /></a>";
 184                      echo "<img src=\"img/leer.gif\" width=\"2\" height=\"1\" border=\"0\" alt=\"\" />"; //Spacer
 185                      echo "</td>\n";
 186                      //Ende Aufbau
 187                      echo "</tr>\n";
 188                      
 189                      
 190                      if($_SESSION["wcs_user_thumb"]) {
 191          
 192                          // now try to get existing thumbnails or if not exists 
 193                          // build new based on default thumbnail listing sizes
 194              
 195                          // build thumbnail image name
 196                          $thumb_image = get_cached_image(
 197                                   array(    "target_ext"    =>    $file_row["f_ext"],
 198                                          "image_name"    =>    $file_row["f_hash"] . '.' . $file_row["f_ext"],
 199                                          "thumb_name"    =>    md5($file_row["f_hash"].$phpwcms["img_list_width"].$phpwcms["img_list_height"].$phpwcms["sharpen_level"])
 200                                        )
 201                                  );
 202  
 203                          if($thumb_image != false) {
 204                          
 205                          
 206                              echo "<tr>\n";
 207                              echo "<td width=\"".($vor+37)."\"><img src=\"img/leer.gif\" height=\"1\" width=\"".($vor+37)."\" border=\"0\" alt=\"\" /></td>\n";
 208                              echo "<td width=\"13\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\" alt=\"\" /></td>\n<td width=\"";
 209                              echo (388-$vor)."\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\" border=\"0\" alt=\"\" /><a href=\"fileinfo.php?fid=";
 210                              echo $file_row["f_id"]."\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars=";
 211                              echo "yes,resizable=yes,width=500,height=400',1); return document.MM_returnValue;\">";
 212                              echo '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3].' ';
 213                              echo 'onmouseover="Tip(\'ID: '.$file_row["f_id"].'&lt;br&gt;Sort: '.$file_row["f_sort"];
 214                              echo '&lt;br&gt;Name: '.html_specialchars($file_row["f_name"]);
 215                              if($file_row["f_copyright"]) {
 216                                  echo '&lt;br&gt;&copy;: '.html_specialchars($file_row["f_copyright"]);
 217                              }
 218                              echo '\');" onmouseout="UnTip()" alt=""';
 219                              echo " /></a></td>\n";
 220                              echo "<td width=\"100\"><img src=\"img/leer.gif\" border=\"0\" alt=\"\" /></td>\n</tr>\n";
 221                              echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" height=\"2\" width=\"1\" border=\"0\" alt=\"\" /></td>\n</tr>\n";
 222                  
 223                          }
 224              
 225                      }
 226                      
 227              
 228                      $file_durchlauf++;
 229                  }
 230                  if($file_durchlauf) { //Abschluss der Filelisten-Tabelle
 231                      echo "</table>\n<!-- end file list: private-functions //-->\n";
 232                      echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" border=\"0\" alt=\"\" /></td></tr>\n";
 233                  }
 234              } //Ende Liste Dateien
 235          }
 236          
 237          //Zaehler mitführen
 238          $_SESSION["list_zaehler"]++;
 239      }
 240      mysql_free_result($result);
 241      return $vor;
 242  }
 243  
 244  function true_false($wert) {
 245      //Wechselt den Wahr/Falsch wert zum Gegenteil: 1=>0 und 0=>1
 246      return (intval($wert)) ? 0 : 1;
 247  }
 248  
 249  function on_off($wert, $string, $art = 1) {
 250      //Erzeugt das Status-Zeichen für Klapp-Auf/Zu
 251      //Wenn Art = 1 dann als Zeichen, ansonsten als Bild
 252      if($wert) {
 253          return ($art == 1) ? "+" : "<img src=\"img/symbols/klapp_zu.gif\" title=\"".$GLOBALS['BL']['be_fprivfunc_opendir'].": ".$string."\" border=\"0\" alt=\"\" />";
 254      } else {
 255          return ($art == 1) ? "-" : "<img src=\"img/symbols/klapp_auf.gif\" title=\"".$GLOBALS['BL']['be_fprivfunc_closedir'].": ".$string."\" border=\"0\" alt=\"\" />";
 256      }
 257  }
 258  ?>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1