phpwcms PHP Cross Reference Content Management Systems

Source: /filebrowser.php - 698 lines - 25269 bytes - Summary - Text - Print

Description: phpwcms content management system

   1  <?php
   2  /**
   3   * phpwcms content management system
   4   *
   5   * @author Oliver Georgi <oliver@phpwcms.de>
   6   * @copyright Copyright (c) 2002-2014, Oliver Georgi
   7   * @license http://opensource.org/licenses/GPL-2.0 GNU GPL-2
   8   * @link http://www.phpwcms.de
   9   *
  10   **/
  11  
  12  /**
  13   * Sept. 2009
  14   * enhancement to enable phpwcms filebrowser support in FCK Editor
  15   * based on concept and work of Markus Köhl <www.pagewerkstatt.ch>
  16   *
  17   * April 2011
  18   * - enhancement to enable phpwcms filebrowser support in CKEditor
  19   *   based on concept and work of Markus Köhl <www.leanux.ch>
  20   * - Issue 265 based on TB's post
  21   */
  22  
  23  session_start();
  24  
  25  $phpwcms            = array();
  26  $phpwcms_root        = rtrim(str_replace('\\', '/', dirname(__FILE__)), '/');
  27  $js_files_all        = array();
  28  $js_files_select    = array();
  29  
  30  require($phpwcms_root.'/config/phpwcms/conf.inc.php');
  31  require ($phpwcms_root.'/include/inc_lib/default.inc.php');
  32  
  33  if( empty($_SESSION["wcs_user_lang"]) ) {
  34  
  35      session_destroy();
  36      headerRedirect( PHPWCMS_URL );
  37  
  38  } else {
  39  
  40      require (PHPWCMS_ROOT.'/include/inc_lang/backend/en/lang.inc.php');
  41      require (PHPWCMS_ROOT.'/include/inc_lang/backend/en/lang.ext.inc.php');
  42      $cust_lang = PHPWCMS_ROOT.'/include/inc_lang/backend/' . strtolower(substr($_SESSION["wcs_user_lang"], 0, 2)) . '/lang.inc.php';
  43      if(is_file($cust_lang)) {
  44          include($cust_lang);
  45      }
  46      $cust_lang = PHPWCMS_ROOT.'/include/inc_lang/backend/' . strtolower(substr($_SESSION["wcs_user_lang"], 0, 2)) . '/lang.ext.inc.php';
  47      if(is_file($cust_lang)) {
  48          include($cust_lang);
  49      }
  50  
  51  }
  52  
  53  // set target for article summary/list image
  54  if(isset($_GET['target'])) {
  55  
  56      switch($_GET['target']) {
  57  
  58          case 'list':    $_SESSION['filebrowser_image_target'] = '_list_';
  59                          break;
  60  
  61          default:         $_SESSION['filebrowser_image_target'] = '_';
  62      }
  63  
  64  } elseif(empty($_SESSION['filebrowser_image_target'])) {
  65  
  66      $_SESSION['filebrowser_image_target'] = '_';
  67  
  68  }
  69  
  70  if(isset($_GET['entry_id'])) {
  71      $_SESSION['filebrowser_image_entry_id'] = preg_replace('/[^a-z0-9_]/', '', $_GET['entry_id']);
  72  }
  73  if(isset($_GET['CKEditorFuncNum'])) {
  74      $_SESSION['CKEditorFuncNum'] = intval($_GET['CKEditorFuncNum']);
  75  }
  76  
  77  require_once  (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php');
  78  require_once  (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php');
  79  
  80  checkLogin();
  81  
  82  require_once  (PHPWCMS_ROOT.'/include/inc_lib/backend.functions.inc.php');
  83  require_once  (PHPWCMS_ROOT.'/include/inc_lib/imagick.convert.inc.php');
  84  
  85  $phpwcms_filestorage = PHPWCMS_FILES;
  86  
  87  $js_aktion = (isset($_GET["opt"])) ? intval($_GET["opt"]) : 0;
  88  
  89  switch($js_aktion) {
  90  
  91      case 0:
  92      case 1:
  93      case 3:
  94      case 7:
  95      case 8:
  96      case 5:
  97      case 11:
  98      case 17:    $titel        = $BL['IMAGE_TITLE'];
  99                  $filetype    = $BL['IMAGE_FILES'];
 100                  break;
 101  
 102      case 4:
 103      case 9:
 104      case 10:
 105      case 16:
 106      case 15:
 107      case 18:    $titel        = $BL['FILE_TITLE'];
 108                  $filetype    = $BL['FILES'];
 109                  break;
 110  
 111      case 2:
 112      case 6:
 113      case 12:
 114      case 13:
 115      case 14:    $titel        = $BL['MEDIA_TITLE'];
 116                  $filetype    = $BL['MEDIA_FILES'];
 117                  break;
 118  
 119  }
 120  
 121  if(isset($folder)) unset($folder);
 122  if(isset($_SESSION["folder"])) $folder = $_SESSION["folder"];
 123  if(isset($_GET["folder"])) {
 124      list($folder_id, $folder_value) = explode('|', $_GET["folder"]);
 125      $folder_value        = intval($folder_value);
 126      $folder[$folder_id] = $folder_value;
 127      $_SESSION["folder"] = $folder; // Return array with current opened folder session values
 128      if($folder_value) {
 129          $_SESSION["imgdir"] = $folder_id;
 130      }
 131  }
 132  $_SESSION["list_zaehler"] = 0;
 133  
 134  // Which folder is active
 135  if(isset($_GET["files"])) {
 136  
 137      $_SESSION["imgdir"] = intval($_GET["files"]);
 138  
 139  } elseif(!isset($_SESSION["imgdir"])) {
 140  
 141      $_SESSION["imgdir"] = 0;
 142  
 143  } elseif(isset($_SESSION["imgdir"])) {
 144  
 145      $_SESSION["imgdir"] = intval($_SESSION["imgdir"]);
 146  
 147  }
 148  
 149  //Does user have files and folders that can be used
 150  $sql = "SELECT COUNT(f_id) FROM ".DB_PREPEND."phpwcms_file WHERE f_aktiv=1 AND (f_public=1 OR f_uid=".$_SESSION["wcs_user_id"].") AND f_trash=0 LIMIT 1";
 151  if($result = mysql_query($sql, $db) or die ("error while counting private files")) {
 152      if($row = mysql_fetch_row($result)) $count_user_files = $row[0];
 153      mysql_free_result($result);
 154  }
 155  
 156  ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 157  <html xmlns="http://www.w3.org/1999/xhtml">
 158  <head>
 159  
 160      <title><?php echo $titel ?></title>
 161  
 162      <meta http-equiv="Content-Type" content="text/html; charset=<?php echo PHPWCMS_CHARSET ?>" />
 163  
 164      <link href="include/inc_css/phpwcms.css" rel="stylesheet" type="text/css" />
 165      <link href="include/inc_js/uploader/fileuploader.css" rel="stylesheet" type="text/css" />
 166      <link href="include/inc_css/autoSuggest.css" rel="stylesheet" type="text/css" />
 167      <script src="include/inc_js/phpwcms.js" type="text/javascript"></script>
 168      <script type="text/javascript">
 169  		function addFile(obj,text,value) {
 170              if(obj!=null && obj.options!=null) {
 171                  newOpt = new Option(text, value);
 172                  obj.options.length++;
 173                  obj.options[obj.length-1].text  = newOpt.text;
 174                  obj.options[obj.length-1].value = newOpt.value;
 175                  obj.options[obj.length-1].selected = false;
 176              }
 177          }
 178      </script>
 179      <script src="include/inc_js/jquery/jquery.min.js" type="text/javascript"></script>
 180      <script src="include/inc_js/uploader/fileuploader.min.js" type="text/javascript"></script>
 181      <script src="include/inc_js/jquery/jquery.autoSuggest.min.js" type="text/javascript"></script>
 182  </head>
 183  <body class="filebrowser">
 184  <div class="uploader filebrowser-uploader closed" id="filebrowser-uploader">
 185  
 186      <h1 class="title" id="fileupload-switch"><?php echo $BL['be_file_multiple_upload'] ?></h1>
 187  
 188      <div class="uploader-button" id="upload-file-select"></div>
 189  
 190      <div class="filebrowser-form">
 191          <p>
 192              <label class="chatlist"><?php echo $BL['be_ftptakeover_longinfo'] ?></label>
 193              <textarea cols="40" rows="3" id="file_longinfo"></textarea>
 194          </p>
 195          <p>
 196              <label class="chatlist"><?php echo $BL['be_copyright'] ?></label>
 197              <input name="file_copyright" type="text" id="file_copyright" size="40" maxlength="255" value="" />
 198          </p>
 199          <p>
 200              <label class="chatlist"><?php echo $BL['be_tags'] ?></label>
 201              <input type="text" id="file_tags_autosuggest" />
 202          </p>
 203  
 204          <div class="uploader-button qq-upload-button" id="upload-trigger-send"><?php echo $BL['be_files_upload'] ?></div>
 205      </div>
 206  
 207  </div>
 208  <table summary="" border="0" cellspacing="0" cellpadding="0" style="margin:4px;">
 209    <tr>
 210          <td bgcolor="#7C98A2"><img src="img/leer.gif" alt="" width="1" height="1" border="0" /></td>
 211          <td rowspan="4"><img src="img/leer.gif" alt="" width="5" height="1" border="0" /></td>
 212          <td bgcolor="#7C98A2"><img src="img/leer.gif" alt="" width="1" height="1" border="0" /></td>
 213    </tr>
 214    <tr>
 215      <td bgcolor="#7C98A2" class="msgreiter">&nbsp;<?php echo $BL['FOLDER_LIST'] ?>&nbsp;</td>
 216      <td bgcolor="#7C98A2" class="msgreiter">&nbsp;<?php echo $filetype ?>&nbsp;</td>
 217    </tr>
 218    <tr>
 219          <td bgcolor="#7C98A2"><img src="img/leer.gif" alt="" width="1" height="1" border="0" /></td>
 220          <td bgcolor="#7C98A2"><img src="img/leer.gif" alt="" width="1" height="1" border="0" /></td>
 221    </tr>
 222    <tr>
 223      <td valign="top"><?php
 224  
 225  if(!empty($count_user_files)) { //Listing in case of user files/folders
 226  
 227      echo '<table summary="" bgColor="#FCFDFD" border="0" cellspacing="0" cellpadding="0">'.LF;
 228  
 229      //Anzeige des Festplattensymbols
 230      $dirname = $BL['ROOT_DIR'];
 231      if(!isset($folder[0])) {
 232          $folder[0] = 0;
 233      }
 234      $folder_status = true_false($folder[0]);
 235      // Change based on Issue 265 by TB to allow file's uploader to select own items
 236      $count_sql = "SELECT COUNT(f_id) FROM ".DB_PREPEND."phpwcms_file WHERE f_pid=0 AND f_aktiv=1 AND f_trash=0 AND (f_public=1 OR f_uid=".$_SESSION["wcs_user_id"].") LIMIT 1";
 237  
 238      if($count_result = mysql_query($count_sql, $db)) {
 239          if($count_row = mysql_fetch_row($count_result)) {
 240              $count = '<img src="img/leer.gif" height="1" width="2" alt="" border="0" /><a href="filebrowser.php?opt='.$js_aktion.'&amp;folder=0'.
 241                       '%7C'.$folder_status.'">'.on_off($folder_status, $dirname, 0).'</a>';
 242              $count_wert = $count_row[0];
 243          }
 244          mysql_free_result($count_result);
 245      }
 246  
 247      // define current directory name
 248      $current_dirname = $dirname;
 249  
 250      $dirname    =  "<a href=\"filebrowser.php?opt=".$js_aktion."&amp;files=0\" title=\"".$BL['SHOW_FILES']."\">".$dirname."</a>";
 251      $bgcol        = (isset($row["f_id"]) && $row["f_id"] == $_SESSION["imgdir"]) ? ' bgcolor="#FED83F"' : '';
 252  
 253      echo '<tr'.$bgcol.'><td colspan="2"><img src="img/leer.gif" height="2" width="1" border="0" alt="" /></td></tr>'.LF; //Abstand vor
 254      echo '<tr'.$bgcol.'><td class="msglist" nowrap="nowrap">';
 255      echo $count.'<img src="img/leer.gif" height="1" width="4" border="0" alt="" /><img src="img/icons/harddisk_16x11.gif" border="0" alt="" />'; //Zellinhalt 1. Spalte
 256      echo '<img src="img/leer.gif" height="1" width="4" alt="" border="0" />'.$dirname.'</td><td><img src="img/leer.gif" height="1" width="5" border="0" alt="" /></td></tr>'.LF;
 257      //Aufbau trennende Tabellen-Zeile
 258      echo '<tr'.$bgcol.'><td colspan="2"><img src="img/leer.gif" height="1" width="1" border="0" alt="" /></td></tr>'.LF; //Abstand nach
 259      echo '<tr bgcolor="#CDDEE4"><td colspan="2"><img src="img/leer.gif" height="1" width="1" border="0" alt="" /></td></tr>'.LF;
 260  
 261      //Wenn überhaupt Ordner für User vorhanden, dann Listing
 262      if(!$folder_status && $count_wert) {
 263          folder_list(0, $db, 18, "filebrowser.php?opt=".$js_aktion."&amp;");
 264      }
 265  
 266      echo '</table>';
 267  } else {
 268      echo "no files available";
 269  }
 270  
 271      ?></td>
 272      <td valign="top"><?php
 273  
 274      //Tabelle
 275  
 276      echo '<table summary="" bgColor="#FFFFFF" width="100%" border="0" cellspacing="0" cellpadding="0">'.LF;
 277      $file_sql  = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_pid=".$_SESSION["imgdir"]." AND ";
 278      switch($js_aktion) {
 279  
 280          case 6:        $file_sql .= "f_ext IN ('swf', 'mp3', 'flv', 'mp4', 'm4v', 'f4v', 'jpg', 'jpeg', 'png', 'gif') AND ";
 281                      break;
 282  
 283                      // H.264
 284          case 12:    $file_sql .= "f_ext IN ('mp4', 'm4p', 'mov', 'm4p', 'm4a', 'm4v') AND ";
 285                      break;
 286  
 287                      // WebM
 288          case 13:    $file_sql .= "f_ext IN ('webm') AND ";
 289                      break;
 290  
 291                      // Ogg
 292          case 14:    $file_sql .= "f_ext IN ('ogg', 'ogv', 'oga', 'ogx') AND ";
 293                      break;
 294  
 295                      // Typical Doc files
 296          case 18:    $file_sql .= "f_ext IN ('pdf', 'doc', 'docx', 'txt', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'pages', 'key', 'numbers') AND ";
 297          case 15:    $entry_id  = empty($_SESSION['filebrowser_image_entry_id']) ? '' : $_SESSION['filebrowser_image_entry_id'];
 298                      break;
 299  
 300          case 11:
 301          case 17:
 302          case 8:        $entry_id  = empty($_SESSION['filebrowser_image_entry_id']) ? '' : $_SESSION['filebrowser_image_entry_id'];
 303          case 7:        $file_sql .= "f_ext IN ('jpeg', 'jpg', 'png', 'gif') AND ";
 304                      break;
 305  
 306          case 2:     $default_ext  = "f_ext IN ('aif', 'aiff', 'mov', 'movie', 'mp3', 'mpeg', 'mpeg4', ";
 307                      $default_ext .= "'mpeg2', 'wav', 'swf', 'ram', 'ra', 'wma', 'wmv', ";
 308                      $default_ext .= "'avi', 'au', 'midi', 'moov', 'rm', 'rpm', 'mid', 'midi')";
 309  
 310                      if(!empty($phpwcms["multimedia_ext"])) {
 311  
 312                          $allowed_ext = convertStringToArray(strtolower($phpwcms["multimedia_ext"]));
 313                          if(count($allowed_ext)) {
 314                              $default_ext = "f_ext IN ('".implode("', '", $allowed_ext) . "')";
 315                          }
 316  
 317                      }
 318  
 319                      $file_sql .= $default_ext." AND ";
 320  
 321                      break;
 322  
 323      }
 324      $file_sql .= "f_aktiv=1 AND f_kid=1 AND f_trash=0 AND ";
 325      $file_sql .= "(f_public=1 OR f_uid=".$_SESSION["wcs_user_id"].") ";
 326      $file_sql .= "ORDER BY f_sort, f_name";
 327  
 328      $ckeditor_action = empty($_SESSION['CKEditorFuncNum']) ? 3 : $_SESSION['CKEditorFuncNum'];
 329  
 330      if($file_result = mysql_query($file_sql, $db) or die ("error while listing files<br />".html_entities($file_sql))) {
 331          $file_durchlauf = 0;
 332  
 333          if(empty($_SESSION['image_browser_article'])) {
 334              $target_form = 'articlecontent';
 335          } else {
 336              $target_form = 'article';
 337          }
 338  
 339          while($file_row = mysql_fetch_array($file_result)) {
 340              $filename = html_specialchars($file_row["f_name"]);
 341  
 342              $thumb_image = true;
 343              if( !in_array($js_aktion, array(2, 4, 9, 10, 16, 18)) ) {
 344                  // check if file can have thumbnail - if so it can be choosen for usage
 345                  $thumb_image = get_cached_image(array(
 346                      "target_ext"    =>    $file_row["f_ext"],
 347                      "image_name"    =>    $file_row["f_hash"] . '.' . $file_row["f_ext"],
 348                      "thumb_name"    =>    md5($file_row["f_hash"].$phpwcms["img_list_width"].$phpwcms["img_list_height"].$phpwcms["sharpen_level"].$phpwcms['colorspace'])
 349                  ));
 350              }
 351  
 352              if($thumb_image != false || in_array($js_aktion, array(6, 10, 12, 13, 14, 16, 18))) {
 353  
 354                  $js_files_select[$file_durchlauf] = '      [' . $file_durchlauf .', ' . $file_row["f_id"] . ', "' . $filename . '"]';
 355                  $add_all = false;
 356  
 357  
 358                  switch($js_aktion) {
 359                      case 0:  $jst = empty($_SESSION['filebrowser_image_target']) ? '_' : $_SESSION['filebrowser_image_target'];
 360  
 361                               $js  = "window.opener.document.".$target_form.".cimage".$jst."name.value='".$filename."';";
 362                               $js .= "window.opener.document.".$target_form.".cimage".$jst."id.value='".$file_row["f_id"]."';";
 363                                break;
 364  
 365                      case 2:  $js  = "window.opener.document.articlecontent.cmedia_name.value='".$filename."';";
 366                               $js .= "window.opener.document.articlecontent.cmedia_id.value='".$file_row["f_id"]."';";
 367                                break;
 368  
 369                      case 6:
 370                      case 12:
 371                      case 13:
 372                      case 14: $js = "window.opener.setIdName('".$file_row["f_id"]."', '".$filename."', ".$js_aktion.");";
 373                                break;
 374  
 375                      case 18:
 376                      case 15: $js = "window.opener.setIdName('".$entry_id."', '".$file_row["f_id"]."', '".$filename."');";
 377                                break;
 378  
 379                      case 7:  $js = "window.opener.setImgIdName('".$file_row["f_id"]."', '".$filename."');";
 380                                break;
 381  
 382                      case 8:  $js = "window.opener.setImgIdName('".$entry_id."', '".$file_row["f_id"]."', '".$filename."');";
 383                                break;
 384  
 385                      case 4:  $js = "addFile(window.opener.document.articlecontent.cfile_list,'".$filename."','".$file_row["f_id"]."');";
 386                               $js_files_all[] = $js;
 387                               $add_all = true;
 388                               break;
 389  
 390                      case 9:  $js = "window.opener.addFile('".$file_row["f_id"]."', '".$filename."');";
 391                               $js_files_all[] = $js;
 392                               $add_all = true;
 393                               break;
 394  
 395                      case 5:  $js = "addFile(window.opener.img_field,'".$filename."','".$file_row["f_id"]."');";
 396                               $js_files_all[] = $js;
 397                               $add_all = true;
 398                               break;
 399  
 400                      //mod
 401                      case 10: $js  = "window.opener.SetUrl('download.php?f=".$file_row["f_hash"] . "&target=0');";
 402                               break;
 403  
 404                      case 11: $js  = "window.opener.SetUrl('img/cmsimage.php/".$phpwcms['img_prev_width']."x".$phpwcms['img_prev_height']."/" . $file_row["f_hash"] . '.' . $file_row["f_ext"] . "');";
 405                               break;
 406  
 407                      //CKEditor
 408                      case 16: $js  = "window.opener.CKEDITOR.tools.callFunction(".$ckeditor_action.", 'download.php?f=".$file_row["f_hash"] . "&target=0');";
 409                               break;
 410  
 411                      case 17: $js  = "window.opener.CKEDITOR.tools.callFunction(".$ckeditor_action.", 'img/cmsimage.php/".$phpwcms['img_prev_width']."x".$phpwcms['img_prev_height']."/" . $file_row["f_hash"] . '.' . $file_row["f_ext"] . "');";
 412                               break;
 413  
 414  
 415                      default: $js = "addFile(window.opener.document.articlecontent.cimage_list,'".$filename."','".$file_row["f_id"]."');";
 416                               $js_files_all[] = $js;
 417                               $add_all = true;
 418                  }
 419  
 420                  // show "add all files"
 421                  if($file_durchlauf === 0 && $add_all) {
 422  
 423                      echo '
 424                          <tr id="addAllFilesLink">
 425                              <td colspan="4" class="add_all_files"><a href="#" onclick="addAllFiles();return false;" title="' . $BL['ADD_ALL_FILES'] . '">' .
 426                                  $BL['ADD_ALL_FILES'] .    '
 427                                  <img src="img/button/add_9x9a.gif" alt="" border="0" />
 428                                  </a></td>
 429                          </tr>
 430                          <tr>
 431                              <td colspan="4" bgcolor="#CDDEE4"><img src="img/leer.gif" alt="" border="0" /></td>
 432                          </tr>
 433                            ';
 434  
 435                  }
 436  
 437                  echo '<tr><td colspan="4"><img src="img/leer.gif" width="1" height="2" border="0" alt="" /></td></tr>'.LF;
 438                  echo "<tr>\n<td><img src=\"img/icons/small_".extimg($file_row["f_ext"])."\" border=\"0\" alt=\"\" hspace=\"3\" vspace=\"1\" /></td>\n";
 439  
 440                  if($js_aktion != 4 && $js_aktion != 10 && $js_aktion != 16) {
 441                      echo "<td class=\"msglist\">".$filename."</td>\n<td><img src=\"img/leer.gif\" width=\"5\" height=\"1\" alt=\"\" border=\"0\" />";
 442                  } else {
 443                      echo "<td class=\"msglist\"><a href=\"#\" onclick=\"".$js."tmt_winControl('self','close()');\">".$filename."</a></td>\n<td align=\"right\">";
 444                  }
 445  
 446                  echo "<a href=\"#\" onclick=\"".$js."return false;\" title=\"".$BL['TAKE_IMAGE']."\">";
 447                  echo "<img src=\"img/button/add_9x9a.gif\" border=\"0\" alt=\"\" hspace=\"5\" vspace=\"2\" /></a></td>\n";
 448                  echo "<td><img src=\"img/leer.gif\" alt=\"\" border=\"0\" /></td>\n</tr>\n";
 449                  echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\" /></td></tr>\n";
 450                  if(!empty($thumb_image[0]) && in_array( $js_aktion, array(0, 1, 3, 5, 6, 7, 8, 10, 11, 17, 18) ) ) {
 451                      echo "<tr><td>&nbsp;</td>\n<td colspan=\"3\"><a href=\"#\" onclick=\"".$js;
 452                      echo "tmt_winControl('self','close()');\">";
 453                      echo '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3].' alt="" />';
 454                      echo "</a></td>\n</tr>\n";
 455                  }
 456                  echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" width=\"1\" height=\"2\" alt=\"\" border=\"0\" /></td></tr>\n";
 457                  echo "<tr><td colspan=\"4\" bgcolor=\"#CDDEE4\"><img src=\"img/leer.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\" /></td></tr>\n";
 458                  $file_durchlauf++;
 459              }
 460  
 461          }
 462          if(!$file_durchlauf) { //Abschluss der Filelisten-Tabelle
 463              echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" width=\"3\" height=\"2\" alt=\"\" border=\"0\" /></td></tr>\n";
 464              echo "<tr><td colspan=\"4\" class=\"msglist\">&nbsp;".$BL['NO_FILE']."&nbsp;&nbsp;</td></tr>\n";
 465              echo "<tr><td colspan=\"4\"><img src=\"img/leer.gif\" width=\"3\" height=\"2\" alt=\"\" border=\"0\" /></td></tr>\n";
 466          }
 467      } //Ende Liste Dateien
 468  
 469      echo "</table>";
 470  
 471      if( count($js_files_select) ) {
 472  
 473          echo LF . '<script type="text/javascript">';
 474          echo LF . SCRIPT_CDATA_START . LF;
 475  
 476          echo 'var files_all = new Array(' . LF;
 477          echo implode(','.LF, $js_files_select);
 478          echo LF . '    );';
 479          echo LF . 'var files_total = ' . $file_durchlauf . ';';
 480  
 481          echo LF . LF;
 482          echo 'function addAllFiles() {';
 483          echo LF . '    ';
 484          echo implode(LF . '    ', $js_files_all);
 485          echo LF . '    //if(closewin == true) tmt_winControl("self","close()");';
 486          echo LF . '    getObjectById("addAllFilesLink").style.display = "none";';
 487          echo LF . '    if(confirm("' . str_replace('{VAL}', $current_dirname, $BL['ADD_ALL_CONFIRM']) . '")) tmt_winControl("self","close()");';
 488          echo LF . '}' . LF;
 489  
 490          echo LF . SCRIPT_CDATA_END;
 491          echo LF . '</script>' . LF;
 492  
 493      }
 494  
 495      ?></td>
 496    </tr>
 497  </table>
 498  <script type="text/javascript">
 499  <!--
 500  $(function() {
 501  
 502      var fileuploader = $('#filebrowser-uploader'),
 503          fileuploadSwitch = $('#fileupload-switch'),
 504          uploadTrigger = $('#upload-trigger-send'),
 505          fileBrowserForm = $('div.filebrowser-form'),
 506          uploadFileCount = 0;
 507  
 508      fileuploadSwitch.click(function(){
 509          if(fileuploader.hasClass('closed')) {
 510              fileuploader.removeClass('closed');
 511              if(uploadFileCount) {
 512                  fileBrowserForm.show();
 513              }
 514          } else {
 515              fileBrowserForm.hide();
 516              fileuploader.addClass('closed');
 517          }
 518      });
 519  
 520      // File Uploading
 521      var uploader = new qq.FileUploader({
 522          element: $('#upload-file-select')[0],
 523          action: '<?php echo PHPWCMS_URL ?>include/inc_act/act_upload.php',
 524          multiple: true,
 525          autoUpload: false,
 526          uploadButtonText: '<?php echo $BL['be_fileuploader_uploadButtonText'] ?>',
 527          cancelButtonText: '<?php echo $BL['be_newsletter_button_cancel'] ?>',
 528          failUploadText: '<?php echo $BL['be_error_while_save'] ?>',
 529          dragText: '<?php echo $BL['be_fileuploader_dragText'] ?>',
 530          sizeLimit: <?php
 531  
 532              if(ini_get('post_max_size')) {
 533                  $post_max_size = return_bytes(ini_get('post_max_size'));
 534                  if($post_max_size < $phpwcms['file_maxsize']) {
 535                      $phpwcms['file_maxsize'] = $post_max_size;
 536                  }
 537              } else {
 538                  $post_max_size = $phpwcms['file_maxsize'];
 539              }
 540              if(ini_get('upload_max_filesize')) {
 541                  $upload_max_filesize = return_bytes(ini_get('upload_max_filesize'));
 542                  if($upload_max_filesize < $phpwcms['file_maxsize']) {
 543                      $phpwcms['file_maxsize'] = $upload_max_filesize;
 544                  }
 545              } else {
 546                  $upload_max_filesize = $phpwcms['file_maxsize'];
 547              }
 548  
 549              echo min($post_max_size, $upload_max_filesize, $phpwcms['file_maxsize']);
 550  
 551          ?>,
 552          messages: {
 553              typeError: "<?php echo $BL['be_fileuploader_typeError'] ?>",
 554              sizeError: "<?php echo $BL['be_fileuploader_sizeError'] ?>",
 555              minSizeError: "<?php echo $BL['be_fileuploader_minSizeError'] ?>",
 556              emptyError: "<?php echo $BL['be_fileuploader_emptyError'] ?>",
 557              noFilesError: "<?php echo $BL['be_fileuploader_noFilesError'] ?>",
 558              onLeave: "<?php echo $BL['be_fileuploader_onLeave'] ?>"
 559          },
 560          disableDefaultDropzone: false,
 561          onSubmit: function(id, fileName) {
 562              if(uploadFileCount == 0) {
 563                  fileBrowserForm.show();
 564              }
 565              uploadFileCount++;
 566          },
 567          onCancel: function(id, fileName) {
 568              uploadFileCount--;
 569              if(uploadFileCount == 0) {
 570                  fileBrowserForm.hide();
 571              }
 572          },
 573          onComplete: function(id, fileName, responseJSON) {
 574              if(responseJSON.success) {
 575                  uploadFileCount--;
 576                  if(uploadFileCount == 0) {
 577                      document.location.reload(true);
 578                  }
 579              }
 580          }
 581      });
 582  
 583      uploadTrigger.click(function() {
 584  
 585          uploader.setParams({
 586              file_dir: <?php echo $_SESSION["imgdir"] ?>,
 587              file_aktiv: 1,
 588              file_public: 1,
 589              file_longinfo: $('#file_longinfo').val(),
 590              file_copyright: $('#file_copyright').val(),
 591              file_tags: $('#as-values-keyword-autosuggest').val()
 592          });
 593  
 594          uploader.uploadStoredFiles();
 595      });
 596  
 597      $("#file_tags_autosuggest").autoSuggest('<?php echo PHPWCMS_URL ?>include/inc_act/ajax_connector.php', {
 598          selectedItemProp: "cat_name",
 599          selectedValuesProp: 'cat_name',
 600          searchObjProps: "cat_name",
 601          queryParam: 'value',
 602          extraParams: '&method=json&action=category',
 603          startText: '',
 604          neverSubmit: true,
 605          asHtmlID: 'keyword-autosuggest'
 606      });
 607  
 608  });
 609  
 610  
 611  </script>
 612  </body>
 613  </html>
 614  <?php
 615  
 616  function folder_list($pid, $dbcon, $vor, $zieldatei) {
 617      global $current_dirname;
 618      $folder = $_SESSION["folder"];
 619      $pid = intval($pid);
 620      $userID = intval($_SESSION["wcs_user_id"]);
 621      $sql = "SELECT f_id, f_name, f_aktiv, f_public FROM ".DB_PREPEND."phpwcms_file WHERE ".
 622             "f_pid=".intval($pid)." AND f_aktiv=1 AND f_kid=0 AND f_trash=0 AND ".
 623             "(f_public=1 OR f_uid=".$userID.") ORDER BY f_sort, f_name";
 624      $result = mysql_query($sql, $dbcon);
 625      while($row = mysql_fetch_array($result)) {
 626  
 627          $dirname = html_specialchars($row["f_name"]);
 628  
 629          //Ermitteln des Aufolderwertes
 630          if(!isset($folder[$row["f_id"]])) $folder[$row["f_id"]] = 0;
 631          $folder_status = true_false($folder[$row["f_id"]]);
 632  
 633          //Ermitteln, ob überhaupt abhängige Dateien/Ordner existieren
 634          $count_sql = "SELECT COUNT(f_id) FROM ".DB_PREPEND."phpwcms_file WHERE ".
 635                       "f_pid=".$row["f_id"]." AND f_trash=0 AND f_aktiv=1 AND ".
 636                       "(f_public=1 OR f_uid=".$userID.") LIMIT 1";
 637          if($count_result = mysql_query($count_sql, $dbcon)) {
 638              if($count_row = mysql_fetch_row($count_result)) {
 639                  $count = '<img src="img/leer.gif" height="1" width="2" alt="" border="0" /><a href="'.$zieldatei."folder=".$row["f_id"].
 640                           '%7C'.$folder_status.'">'.on_off($folder_status, $dirname, 0).'</a>';
 641                  $count_wert = $count_row[0];
 642              }
 643              mysql_free_result($count_result);
 644          }
 645  
 646          $dirname = '<a href="'.$zieldatei."files=".$row["f_id"].'" title="'.$GLOBALS['BL']['SHOW_FILES1'].'">'. $dirname . '</a>';
 647  
 648          if($row["f_id"] == $_SESSION["imgdir"]) {
 649              $bgcol = ' bgcolor="#FED83F"';
 650              $current_dirname = $row["f_name"];
 651          } else {
 652              $bgcol = '';
 653          }
 654  
 655          //Aufbau der Zeile
 656          echo "<tr".$bgcol."><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"2\" width=\"1\" alt=\"\" border=\"0\" /></td></tr>\n"; //Abstand vor
 657          echo "<tr".$bgcol."><td class=\"msglist\" nowrap=\"nowrap\">";
 658          echo $count."<img src=\"img/leer.gif\" height=\"1\" width=\"".($vor+6)."\" border=\"0\" alt=\"\" /><img src=\"img/icons/folder_zu.gif\" border=\"0\" alt=\"\" />"; //Zellinhalt 1. Spalte
 659          echo "<img src=\"img/leer.gif\" height=\"1\" width=\"5\" alt=\"\" border=\"0\" />".$dirname."</td><td><img src=\"img/leer.gif\" height=\"1\" width=\"5\" alt=\"\" border=\"0\" /></td></tr>\n";
 660          //Aufbau trennende Tabellen-Zeile
 661          echo "<tr".$bgcol."><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" alt=\"\" border=\"0\" /></td></tr>\n"; //Abstand nach
 662          echo "<tr bgcolor=\"#CDDEE4\"><td colspan=\"2\"><img src=\"img/leer.gif\" height=\"1\" width=\"1\" alt=\"\" border=\"0\" /></td></tr>\n"; //Trennlinie<img src='img/lines/line-lightgrey-dotted-538.gif'>
 663  
 664          //Weiter, wenn Unterstruktur
 665          if(!$folder_status && $count_wert) {
 666              folder_list($row["f_id"], $dbcon, $vor+18, $zieldatei); //, $userID
 667          }
 668  
 669          //Zaehler mitführen
 670          $_SESSION["list_zaehler"]++;
 671      }
 672      mysql_free_result($result);
 673  }
 674  
 675  function on_off($wert, $string, $art = 1) {
 676      //Erzeugt das Status-Zeichen für Klapp-Auf/Zu
 677      //Wenn Art = 1 dann als Zeichen, ansonsten als Bild
 678      if($wert) {
 679          if($art == 1) {
 680              return "+";
 681          } else {
 682              return "<img src=\"img/symbols/klapp_zu.gif\" border=\"0\" alt=\"\" title=\"".$GLOBALS['BL']['OPEN_DIR'].": ".$string."\" />";
 683          }
 684      } else {
 685          if($art == 1) {
 686              return "-";
 687          } else {
 688              return "<img src=\"img/symbols/klapp_auf.gif\" border=\"0\" alt=\"\" title=\"".$GLOBALS['BL']['CLOSE_DIR'].": ".$string."\" />";
 689          }
 690      }
 691  }
 692  
 693  function true_false($wert) {
 694      //Wechselt den Wahr/Falsch wert zum Gegenteil: 1=>0 und 0=>1
 695      if(intval($wert)) { return 0; } else { return 1; }
 696  }
 697  
 698  ?>

title

Description

title

Description

title

Description

title

title

Body