[ Index ]

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

title

Body

[close]

/include/inc_tmpl/ -> files.public.list.tmpl.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  // ----------------------------------------------------------------
  25  // obligate check for phpwcms constants
  26  if (!defined('PHPWCMS_ROOT')) {
  27     die("You Cannot Access This Script Directly, Have a Nice Day.");
  28  }
  29  // ----------------------------------------------------------------
  30  
  31  
  32  //Default for listing public files
  33  $vor = 0;
  34  if(isset($pklapp)) unset($pklapp);
  35  
  36  if(isset($_GET["all"])) {
  37      if($_GET["all"] == "close") {
  38          if(isset($_SESSION["pklapp"])) unset($_SESSION["pklapp"]);
  39      }
  40  }            
  41  
  42  if(isset($_SESSION["pklapp"])) $pklapp = $_SESSION["pklapp"]; 
  43  
  44  if(isset($_GET["pklapp"])) {
  45      list($pklapp_id, $pklapp_value) = explode("|", $_GET["pklapp"]);
  46      $pklapp[$pklapp_id] = intval($pklapp_value);
  47      $_SESSION["pklapp"] = $pklapp; //Rückgabe des Aktuellen Array mit Aufklappwerten in die Session
  48      mysql_query("UPDATE ".DB_PREPEND."phpwcms_user SET usr_var_publicfile='".serialize($_SESSION["pklapp"])."' WHERE usr_id=".$_SESSION["wcs_user_id"], $db);
  49  }
  50  $_SESSION["list_zaehler"] = 0; //Zähler für die Public-Listenfunktion setzen
  51              
  52  //Feststellen, ob überhaupt Dateien/Ordner des Users vorhanden sind
  53  $sql = "SELECT COUNT(f_id) FROM ".DB_PREPEND."phpwcms_file WHERE f_public=1 AND f_aktiv=1 AND f_trash=0 LIMIT 1;";
  54  if($result = mysql_query($sql, $db) or die ("error while counting user files")) {
  55      if($row = mysql_fetch_row($result)) {
  56          $count_user_files = $row[0];
  57      }
  58      mysql_free_result($result);
  59  }
  60  
  61  if(isset($count_user_files) && $count_user_files) { //Wenn überhaupt Public-Dateien vorhanden, dann Listing
  62      //Beginn Tabelle für Public Dateilisting
  63      echo "<table width=\"538\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
  64      echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" width=\"1\" height=\"1\"></td></tr>\n";
  65  
  66      //Prüfen, für welche User überhaupt Public Files vorhanden sind
  67      $sql = "SELECT DISTINCT ".DB_PREPEND."phpwcms_file.f_uid, ".DB_PREPEND."phpwcms_user.usr_login, ".DB_PREPEND."phpwcms_user.usr_name ".
  68             "FROM ".DB_PREPEND."phpwcms_file INNER JOIN ".DB_PREPEND."phpwcms_user ON ".DB_PREPEND."phpwcms_file.f_uid=".DB_PREPEND."phpwcms_user.usr_id ".
  69             "WHERE ".DB_PREPEND."phpwcms_file.f_public=1 AND ".DB_PREPEND."phpwcms_file.f_aktiv=1 AND ".DB_PREPEND."phpwcms_file.f_trash=0 ".
  70             "ORDER BY ".DB_PREPEND."phpwcms_user.usr_name, ".DB_PREPEND."phpwcms_user.usr_login;";
  71  
  72      if($result = mysql_query($sql, $db) or die ("error while browsing user's public files")) {
  73          $user_counter=0;
  74          while($row = mysql_fetch_array($result)) {
  75              //Prüfen
  76              $pklapp_status = isset($pklapp[ "u".$row["f_uid"] ]) ? true_false($pklapp[ "u".$row["f_uid"] ]) : 1;
  77              $root_user_id = intval($row["f_uid"]);
  78              $user_naming = html_specialchars($row["usr_name"]." (".$row["usr_login"].")");
  79              $count = "<img src=\"img/leer.gif\" width=\"2\" height=\"1\">".
  80                       "<a href=\"phpwcms.php?do=files&f=1&pklapp=u".$row["f_uid"].
  81                       "|".$pklapp_status."\">".on_off($pklapp_status, "\n".$BL['be_fpublic_user'].": ".$user_naming, 0)."</a>";
  82  
  83              //Aufbau der Zeile mit den Benutzerinfos
  84              if($user_counter) {
  85                  //Trennende blaue Tabellen-Zeile zwischen unterschiedlicghen Public Users
  86                  echo "<tr><td colspan=\"2\"><img src=\"img/lines/line-lightgrey-dotted-538.gif\" height=\"1\" width=\"538\"></td></tr>\n";
  87                  echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\"></td></tr>\n";
  88              }
  89              echo "<tr bgcolor=\"#D8E4E9\"><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"2\" width=\"1\"></td></tr>\n"; //Abstand vor
  90              echo "<tr bgcolor=\"#D8E4E9\">\n"; //Einleitung Tabellenzeile
  91              echo "<td width=\"488\" class=\"msglist\">"; //Einleiten der Tabellenzelle
  92              echo $count."<img src=\"img/leer.gif\" height=\"1\" width=\"".($vor+6)."\" border=\"0\"><img src=\"img/icons/user_zu.gif\" border=\"0\">";
  93              echo "<img src=\"img/leer.gif\" height=\"1\" width=\"5\"><strong>".$user_naming."</strong></td>\n"; //Schließen Zelle 1. Spalte
  94              echo "<td width=\"50\" align=\"right\" class=\"msglist\">"; //Zelle 2. Spalte - vorgesehen für Buttons/Tasten Edit etc.
  95              echo "<img src=\"img/leer.gif\" width=\"50\" height=\"1\">"; //Spacer
  96              echo "</td>\n"; 
  97              echo "</tr>\n"; //Abschluss Tabellenzeile
  98              //Aufbau trennende Tabellen-Zeile  bgcolor:#EBF2F4
  99              echo "<tr bgcolor=\"#D8E4E9\"><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"2\" width=\"1\"></td></tr>\n"; //Abstand nach
 100              echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\"></td></tr>\n"; //Trennlinie
 101  
 102              if(!$pklapp_status) {
 103                  list_public(0, $db, 18, "phpwcms.php?do=files&f=1", $row["f_uid"], $_SESSION["wcs_user_thumb"], $phpwcms);
 104  
 105                  //Root files anzeigen
 106                  $file_sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_pid=0 AND f_uid=".$root_user_id.
 107                              " AND f_public=1 AND f_aktiv=1 AND f_kid=1 AND f_trash=0 ORDER BY f_name;";
 108                  if($file_result = mysql_query($file_sql, $db) or die ("error while listing files")) {
 109                      $file_durchlauf = 0;
 110                      while($file_row = mysql_fetch_array($file_result)) {
 111                          $filename = html_specialchars($file_row["f_name"]);
 112                          if(!$file_durchlauf) { //Aufbau der Zeile zum Einfließen der Filelisten-Tabelle
 113                              echo "<tr bgcolor=\"#F5F8F9\"><td colspan=\"2\"><table width=\"538\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; 
 114                          } else {
 115                              echo "<tr bgcolor=\"#FFFFFF\"><td colspan=\"5\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\"></td></tr>\n";
 116                          }
 117                          echo "<tr>\n";
 118                          echo "<td width=\"37\" class=\"msglist\"><img src=\"img/leer.gif\" height=\"1\" width=\"37\" border=\"0\"></td>\n";
 119                          echo "<td width=\"13\" class=\"msglist\">";
 120                          echo "<img src=\"img/icons/small_".extimg($file_row["f_ext"])."\" border=\"0\"";
 121                          echo ' onmouseover="Tip(\'ID: '.$file_row["f_id"].'\');" alt=""';
 122                          echo "></td>\n";
 123                          echo "<td width=\"473\" class=\"msglist\"><img src=\"img/leer.gif\" height=\"1\" width=\"5\">"; //438-$vor
 124                          //echo "<a href=\"fileinfo_public.php?fid=".$file_row["f_id"];
 125                          echo "<a href=\"fileinfo.php?public&amp;fid=".$file_row["f_id"];
 126                          echo "\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars=yes,resizable=yes,width=500,height=400',1);return document.MM_returnValue;\">";
 127                          echo $filename."</a>";
 128  
 129                          echo "</td>\n";
 130                          echo "<td width=\"15\" align=\"right\" class=\"msglist\">";
 131                          echo "<a href=\"include/inc_act/act_download.php?pl=1&dl=".$file_row["f_id"];
 132                           echo "\" target=\"_blank\" title=\"".$BL['be_fprivfunc_dlfile'].": ".$filename."\">";
 133                           echo "<img src=\"img/button/download_disc.gif\" border=\"0\"></a>"; //target='_blank'
 134                          echo "<img src=\"img/leer.gif\" width=\"2\" height=\"1\">"; //Spacer
 135                          echo "</td>\n";
 136                          //Ende Aufbau
 137                          echo "</tr>\n";
 138                          
 139                          if($_SESSION["wcs_user_thumb"]) {
 140              
 141                              $thumb_image = get_cached_image(
 142                                   array(    "target_ext"    =>    $file_row["f_ext"],
 143                                          "image_name"    =>    $file_row["f_hash"] . '.' . $file_row["f_ext"],
 144                                          "thumb_name"    =>    md5($file_row["f_hash"].$phpwcms["img_list_width"].$phpwcms["img_list_height"].$phpwcms["sharpen_level"])
 145                                        )
 146                                  );
 147  
 148                              if($thumb_image != false) {
 149                              
 150                                  echo "<tr>\n";
 151                                  echo "<td width=\"37\"><img src=\"img/leer.gif\" height=\"1\" width=\"37\" border=\"0\"></td>\n";
 152                                  echo "<td width=\"13\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\"></td>\n<td width=\"";
 153                                  echo "473\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\"><a href=\"fileinfo.php?public&amp;fid=";
 154                                  echo $file_row["f_id"]."\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars=";
 155                                  echo "yes,resizable=yes,width=500,height=400',1); return document.MM_returnValue;\">";
 156                                  echo '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3]."></a></td>\n";    
 157                                  echo "<td width=\"15\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\"></td>\n</tr>\n";
 158                                  echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" height=\"2\" width=\"1\" border=\"0\"></td>\n</tr>\n";
 159          
 160                              }
 161                  
 162                          }
 163                          
 164                          /*
 165                          if($file_row["f_thumb_list"] && $_SESSION["wcs_user_thumb"]) { //Wenn List Preview Image verfügbar
 166                              echo "<tr>\n";
 167                              echo "<td width=\"37\"><img src=\"img/leer.gif\" height=\"1\" width=\"37\" border=\"0\"></td>\n";
 168                              echo "<td width=\"13\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\"></td>\n<td width=\"";
 169                              //echo "473\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\"><a href=\"fileinfo_public.php?fid="; //523
 170                              echo "473\"><img src=\"img/leer.gif\" height=\"1\" width=\"6\"><a href=\"fileinfo.php?public&amp;fid=";
 171                              echo $file_row["f_id"]."\" target=\"_blank\" onclick=\"flevPopupLink(this.href,'filedetail','scrollbars=";
 172                              echo "yes,resizable=yes,width=500,height=400',1); return document.MM_returnValue;\">";
 173                              echo "<img src=\"".$phpwcms["file_tmp"].$phpwcms["dir_thlist"].$file_row["f_thumb_list"]."\" border=\"0\"></a></td>\n";
 174                              echo "<td width=\"15\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" border=\"0\"></td>\n</tr>\n";
 175                              echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" height=\"2\" width=\"1\" border=\"0\"></td>\n</tr>\n";
 176                          }
 177                          */
 178                          $file_durchlauf++;
 179                      }
 180                      if($file_durchlauf) { //Abschluss der Filelisten-Tabelle
 181                          echo "</table>\n";
 182                          echo "<tr><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\"></td></tr>\n";
 183                      }
 184                  } //Ende Liste Dateien
 185  
 186                  //Ende Anzeige root files public
 187              }
 188              $user_counter++;
 189          }
 190      }
 191      echo "</table>\n"; //Ende Tabelle
 192  } else { //Wenn keinerlei Datensatz innerhalb Files durchlaufen wurde, dann
 193      echo "<img src=\"img/leer.gif\" width=\"1\" height=\"6\"><br />".$BL['be_fpublic_nofiles']."&nbsp;&nbsp;";
 194      echo "[<a href=\"phpwcms.php?do=files&f=0&mkdir=0\">".$BL['be_fpriv_button']."</a>]";
 195      echo "<br /><img src=\"img/leer.gif\" width=\"1\" height=\"6\">";
 196  }
 197  ?>


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