| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      /**
 
     | 
  
  
    | 
      3
     | 
    
       *
 
     | 
  
  
    | 
      4
     | 
    
       * @category        admin
 
     | 
  
  
    | 
      5
     | 
    
       * @package         media
 
     | 
  
  
    | 
      6
     | 
    
       * @author          WebsiteBaker Project
 
     | 
  
  
    | 
      7
     | 
    
       * @copyright       Ryan Djurovich
 
     | 
  
  
    | 
      8
     | 
    
       * @copyright       WebsiteBaker Org. e.V.
 
     | 
  
  
    | 
      9
     | 
    
       * @link            http://websitebaker.org/
 
     | 
  
  
    | 
      10
     | 
    
       * @license         http://www.gnu.org/licenses/gpl.html
 
     | 
  
  
    | 
      11
     | 
    
       * @platform        WebsiteBaker 2.8.3
 
     | 
  
  
    | 
      12
     | 
    
       * @requirements    PHP 5.3.6 and higher
 
     | 
  
  
    | 
      13
     | 
    
       * @version         $Id: browse.php 2 2017-07-02 15:14:29Z Manuela $
 
     | 
  
  
    | 
      14
     | 
    
       * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/admin/media/browse.php $
 
     | 
  
  
    | 
      15
     | 
    
       * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
 
     | 
  
  
    | 
      16
     | 
    
       *
 
     | 
  
  
    | 
      17
     | 
    
       */
 
     | 
  
  
    | 
      18
     | 
    
      
 
     | 
  
  
    | 
      19
     | 
    
      // Create admin object
 
     | 
  
  
    | 
      20
     | 
    
      if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
     | 
  
  
    | 
      21
     | 
    
      if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
     | 
  
  
    | 
      22
     | 
    
      
 
     | 
  
  
    | 
      23
     | 
    
      
 
     | 
  
  
    | 
      24
     | 
    
      $admin = new admin('Media', 'media', false);
     | 
  
  
    | 
      25
     | 
    
      
 
     | 
  
  
    | 
      26
     | 
    
      $starttime = explode(" ", microtime());
     | 
  
  
    | 
      27
     | 
    
      $starttime = $starttime[0]+$starttime[1];
 
     | 
  
  
    | 
      28
     | 
    
      
 
     | 
  
  
    | 
      29
     | 
    
      // Include the WB functions file
 
     | 
  
  
    | 
      30
     | 
    
      if(!function_exists('check_media_path')) { require(WB_PATH.'/framework/functions.php'); }
     | 
  
  
    | 
      31
     | 
    
      include ('parameters.php');
     | 
  
  
    | 
      32
     | 
    
      
 
     | 
  
  
    | 
      33
     | 
    
      // check if theme language file exists for the language set by the user (e.g. DE, EN)
 
     | 
  
  
    | 
      34
     | 
    
      if(file_exists(THEME_PATH .'/languages/EN.php')) {
     | 
  
  
    | 
      35
     | 
    
      require(THEME_PATH .'/languages/EN.php');
 
     | 
  
  
    | 
      36
     | 
    
      }
 
     | 
  
  
    | 
      37
     | 
    
      if(file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
     | 
  
  
    | 
      38
     | 
    
          require(THEME_PATH .'/languages/'.LANGUAGE .'.php');
 
     | 
  
  
    | 
      39
     | 
    
      }
 
     | 
  
  
    | 
      40
     | 
    
      
 
     | 
  
  
    | 
      41
     | 
    
      // Byte convert for filesize
 
     | 
  
  
    | 
      42
     | 
    
      function byte_convert($bytes) {
     | 
  
  
    | 
      43
     | 
    
          $symbol = array(' bytes', ' KB', ' MB', ' GB', ' TB');
     | 
  
  
    | 
      44
     | 
    
          $exp = 0;
 
     | 
  
  
    | 
      45
     | 
    
          $converted_value = 0;
 
     | 
  
  
    | 
      46
     | 
    
          if( $bytes > 0 ) {
     | 
  
  
    | 
      47
     | 
    
              $exp = floor( log($bytes)/log(1024) );
 
     | 
  
  
    | 
      48
     | 
    
              $converted_value = ( $bytes/pow(1024,floor($exp)) );
 
     | 
  
  
    | 
      49
     | 
    
          }
 
     | 
  
  
    | 
      50
     | 
    
          return sprintf( '%.2f '.$symbol[$exp], $converted_value );
 
     | 
  
  
    | 
      51
     | 
    
      }
 
     | 
  
  
    | 
      52
     | 
    
      
 
     | 
  
  
    | 
      53
     | 
    
      // Get file extension
 
     | 
  
  
    | 
      54
     | 
    
      function get_filetype($fname) {
     | 
  
  
    | 
      55
     | 
    
          $pathinfo = pathinfo($fname);
 
     | 
  
  
    | 
      56
     | 
    
          $extension = (isset($pathinfo['extension'])) ? strtolower($pathinfo['extension']) : '';
 
     | 
  
  
    | 
      57
     | 
    
          return $extension;
 
     | 
  
  
    | 
      58
     | 
    
      }
 
     | 
  
  
    | 
      59
     | 
    
      
 
     | 
  
  
    | 
      60
     | 
    
      // Get file extension for icons
 
     | 
  
  
    | 
      61
     | 
    
      function get_filetype_icon($fname) {
     | 
  
  
    | 
      62
     | 
    
          $pathinfo = pathinfo($fname);
 
     | 
  
  
    | 
      63
     | 
    
          $extension = (isset($pathinfo['extension'])) ? strtolower($pathinfo['extension']) : '';
 
     | 
  
  
    | 
      64
     | 
    
          if (file_exists(THEME_PATH.'/images/files/'.$extension.'.png')) {
     | 
  
  
    | 
      65
     | 
    
              return $extension;
 
     | 
  
  
    | 
      66
     | 
    
          } else {
     | 
  
  
    | 
      67
     | 
    
              return 'blank_16';
 
     | 
  
  
    | 
      68
     | 
    
          }
 
     | 
  
  
    | 
      69
     | 
    
      }
 
     | 
  
  
    | 
      70
     | 
    
      
 
     | 
  
  
    | 
      71
     | 
    
      function ToolTip($name, $detail = '')
 
     | 
  
  
    | 
      72
     | 
    
      {
     | 
  
  
    | 
      73
     | 
    
      //    parse_str($name, $array);
 
     | 
  
  
    | 
      74
     | 
    
      //    $name = $array['img'];
 
     | 
  
  
    | 
      75
     | 
    
          $parts = explode(".", $name);
     | 
  
  
    | 
      76
     | 
    
          $ext = strtolower( end($parts));
 
     | 
  
  
    | 
      77
     | 
    
          if (strpos('.gif.jpg.jpeg.png.bmp.', $ext))
     | 
  
  
    | 
      78
     | 
    
          {
     | 
  
  
    | 
      79
     | 
    
              $retVal = 'onmouseover="return overlib('.
     | 
  
  
    | 
      80
     | 
    
                  '\'<img src=\\\''.($name).'\\\''.
 
     | 
  
  
    | 
      81
     | 
    
                  'alt=\\\'\\\' '.
 
     | 
  
  
    | 
      82
     | 
    
                  'maxwidth=\\\'300\\\' '.
 
     | 
  
  
    | 
      83
     | 
    
                  'maxheight=\\\'300\\\' />\','.
 
     | 
  
  
    | 
      84
     | 
    
      //            '>\','.
 
     | 
  
  
    | 
      85
     | 
    
      //            'CAPTION,\''.basename($name).'\','.
 
     | 
  
  
    | 
      86
     | 
    
                  'FGCOLOR,\'#ffffff\','.
 
     | 
  
  
    | 
      87
     | 
    
                  'BGCOLOR,\'#557c9e\','.
 
     | 
  
  
    | 
      88
     | 
    
                  'BORDER,1,'.
 
     | 
  
  
    | 
      89
     | 
    
                  'FGCOLOR, \'#ffffff\','.
 
     | 
  
  
    | 
      90
     | 
    
                  'BGCOLOR,\'#557c9e\','.
 
     | 
  
  
    | 
      91
     | 
    
                  'CAPTIONSIZE,\'12px\','.
 
     | 
  
  
    | 
      92
     | 
    
                  'CLOSETEXT,\'X\','.
 
     | 
  
  
    | 
      93
     | 
    
                  'CLOSECOLOR,\'#ffffff\','.
 
     | 
  
  
    | 
      94
     | 
    
                  'CLOSESIZE,\'14px\','.
 
     | 
  
  
    | 
      95
     | 
    
                  'VAUTO,'.
 
     | 
  
  
    | 
      96
     | 
    
                  'HAUTO,'.
 
     | 
  
  
    | 
      97
     | 
    
                  ''.
 
     | 
  
  
    | 
      98
     | 
    
      //            'STICKY,'.
 
     | 
  
  
    | 
      99
     | 
    
                  'MOUSEOFF,'.
 
     | 
  
  
    | 
      100
     | 
    
                  'WRAP,'.
 
     | 
  
  
    | 
      101
     | 
    
                  'CELLPAD,5'.
 
     | 
  
  
    | 
      102
     | 
    
                  ''.
 
     | 
  
  
    | 
      103
     | 
    
                  ''.
 
     | 
  
  
    | 
      104
     | 
    
                  ''.
 
     | 
  
  
    | 
      105
     | 
    
                  ')" onmouseout="return nd()"';
 
     | 
  
  
    | 
      106
     | 
    
              return $retVal;
 
     | 
  
  
    | 
      107
     | 
    
      //        return ('onmouseover="return overlib(\'<img src=\\\''.($name).'\\\' maxwidth=\\\'600\\\'  maxheight=\\\'600\\\'>\',BORDER,1,FGCOLOR, \'#ffffff\',VAUTO,WIDTH)" onmouseout="return nd()" ');
     | 
  
  
    | 
      108
     | 
    
          } else {
     | 
  
  
    | 
      109
     | 
    
              return '';
 
     | 
  
  
    | 
      110
     | 
    
          }
 
     | 
  
  
    | 
      111
     | 
    
      }
 
     | 
  
  
    | 
      112
     | 
    
      
 
     | 
  
  
    | 
      113
     | 
    
      function fsize($size) {
     | 
  
  
    | 
      114
     | 
    
         if($size == 0) return("0 Bytes");
     | 
  
  
    | 
      115
     | 
    
         $filesizename = array(" bytes", " kB", " MB", " GB", " TB");
     | 
  
  
    | 
      116
     | 
    
         return round($size/pow(1024, ($i = floor(log($size, 1024)))), 1) . $filesizename[$i];
 
     | 
  
  
    | 
      117
     | 
    
      }
 
     | 
  
  
    | 
      118
     | 
    
      
 
     | 
  
  
    | 
      119
     | 
    
      // Setup template object, parse vars to it, then parse it
 
     | 
  
  
    | 
      120
     | 
    
      // Create new template object
 
     | 
  
  
    | 
      121
     | 
    
      $template = new Template(dirname($admin->correct_theme_source('media_browse.htt')));
     | 
  
  
    | 
      122
     | 
    
      $template->set_file('page', 'media_browse.htt');
     | 
  
  
    | 
      123
     | 
    
      $template->set_block('page', 'main_block', 'main');
     | 
  
  
    | 
      124
     | 
    
      // Get the current dir
 
     | 
  
  
    | 
      125
     | 
    
      //$currentHome = $admin->get_home_folder();
 
     | 
  
  
    | 
      126
     | 
    
      $currentHome = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? $admin->get_home_folder() : '';
     | 
  
  
    | 
      127
     | 
    
      
 
     | 
  
  
    | 
      128
     | 
    
      // set directory if you call from menu
 
     | 
  
  
    | 
      129
     | 
    
      $directory =    (($currentHome) AND (!array_key_exists('dir',$_GET)))
     | 
  
  
    | 
      130
     | 
    
                      ?
 
     | 
  
  
    | 
      131
     | 
    
                      $currentHome
 
     | 
  
  
    | 
      132
     | 
    
                      :
 
     | 
  
  
    | 
      133
     | 
    
                      $admin->strip_slashes($admin->get_get('dir')) ;
     | 
  
  
    | 
      134
     | 
    
      
 
     | 
  
  
    | 
      135
     | 
    
      // check for correct directory
 
     | 
  
  
    | 
      136
     | 
    
      if ($currentHome && stripos(WB_PATH.MEDIA_DIRECTORY.$directory,WB_PATH.MEDIA_DIRECTORY.$currentHome)===false) {
     | 
  
  
    | 
      137
     | 
    
          $directory = $currentHome;
 
     | 
  
  
    | 
      138
     | 
    
      }
 
     | 
  
  
    | 
      139
     | 
    
      if($directory == '/' OR $directory == '\\') {$directory = '';}
     | 
  
  
    | 
      140
     | 
    
      
 
     | 
  
  
    | 
      141
     | 
    
      $sBackLink = WB_PATH.MEDIA_DIRECTORY.$directory;
 
     | 
  
  
    | 
      142
     | 
    
      if(!is_readable( $sBackLink )) {
     | 
  
  
    | 
      143
     | 
    
      $directory = dirname($directory);
 
     | 
  
  
    | 
      144
     | 
    
      // reload parent page to rebuild the dropdowns
 
     | 
  
  
    | 
      145
     | 
    
      echo "<script type=\"text/javascript\">
 
     | 
  
  
    | 
      146
     | 
    
      <!--
 
     | 
  
  
    | 
      147
     | 
    
      // Get the location object
 
     | 
  
  
    | 
      148
     | 
    
      var locationObj = document.location;
 
     | 
  
  
    | 
      149
     | 
    
      // Set the value of the location object
 
     | 
  
  
    | 
      150
     | 
    
      parent.document.location = 'index.php';
 
     | 
  
  
    | 
      151
     | 
    
      -->
 
     | 
  
  
    | 
      152
     | 
    
      </script>";
 
     | 
  
  
    | 
      153
     | 
    
      }
 
     | 
  
  
    | 
      154
     | 
    
      
 
     | 
  
  
    | 
      155
     | 
    
      $dir_backlink = 'browse.php?dir='.$directory;
 
     | 
  
  
    | 
      156
     | 
    
      
 
     | 
  
  
    | 
      157
     | 
    
      // Check to see if it contains ../
 
     | 
  
  
    | 
      158
     | 
    
      if (!check_media_path($directory)) {
     | 
  
  
    | 
      159
     | 
    
          // $admin->print_header();
 
     | 
  
  
    | 
      160
     | 
    
          $admin->print_error($MESSAGE['MEDIA_DIR_DOT_DOT_SLASH']);
 
     | 
  
  
    | 
      161
     | 
    
      }
 
     | 
  
  
    | 
      162
     | 
    
      
 
     | 
  
  
    | 
      163
     | 
    
      if(!file_exists(WB_PATH.MEDIA_DIRECTORY.$directory)) {
     | 
  
  
    | 
      164
     | 
    
          // $admin->print_header();
 
     | 
  
  
    | 
      165
     | 
    
          $admin->print_error($MESSAGE['MEDIA_DIR_DOES_NOT_EXIST']);
 
     | 
  
  
    | 
      166
     | 
    
      }
 
     | 
  
  
    | 
      167
     | 
    
      
 
     | 
  
  
    | 
      168
     | 
    
      // Check to see if the user wanted to go up a directory into the parent folder
 
     | 
  
  
    | 
      169
     | 
    
      if($admin->get_get('up') == 1) {
     | 
  
  
    | 
      170
     | 
    
          $parent_directory = dirname($directory);
 
     | 
  
  
    | 
      171
     | 
    
          header("Location: browse.php?dir=$parent_directory");
     | 
  
  
    | 
      172
     | 
    
          exit(0);
 
     | 
  
  
    | 
      173
     | 
    
      }
 
     | 
  
  
    | 
      174
     | 
    
      
 
     | 
  
  
    | 
      175
     | 
    
      if ($_SESSION['GROUP_ID'] != 1 && (isset($pathsettings['global']['admin_only']) && $pathsettings['global']['admin_only']) ) { // Only show admin the settings link
     | 
  
  
    | 
      176
     | 
    
          $template->set_var('DISPLAY_SETTINGS', 'hide');
     | 
  
  
    | 
      177
     | 
    
      }
 
     | 
  
  
    | 
      178
     | 
    
      
 
     | 
  
  
    | 
      179
     | 
    
      // Workout the parent dir link
 
     | 
  
  
    | 
      180
     | 
    
      $parent_dir_link = ADMIN_URL.'/media/browse.php?dir='.$directory.'&up=1';
 
     | 
  
  
    | 
      181
     | 
    
      // Workout if the up arrow should be shown
 
     | 
  
  
    | 
      182
     | 
    
      if(($directory == '') or ($directory==$currentHome)) {
     | 
  
  
    | 
      183
     | 
    
          $display_up_arrow = 'hide';
 
     | 
  
  
    | 
      184
     | 
    
      } else {
     | 
  
  
    | 
      185
     | 
    
          $display_up_arrow = '';
 
     | 
  
  
    | 
      186
     | 
    
      }
 
     | 
  
  
    | 
      187
     | 
    
      
 
     | 
  
  
    | 
      188
     | 
    
      // Insert values
 
     | 
  
  
    | 
      189
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      190
     | 
    
                          'THEME_URL' => THEME_URL,
 
     | 
  
  
    | 
      191
     | 
    
                          // 'THEME_URL' => '',
 
     | 
  
  
    | 
      192
     | 
    
                          'CURRENT_DIR' => $directory,
 
     | 
  
  
    | 
      193
     | 
    
                          'PARENT_DIR_LINK' => $parent_dir_link,
 
     | 
  
  
    | 
      194
     | 
    
                          'DISPLAY_UP_ARROW' => $display_up_arrow,
 
     | 
  
  
    | 
      195
     | 
    
                          'INCLUDE_PATH' => WB_URL.'/include'
 
     | 
  
  
    | 
      196
     | 
    
                      )
 
     | 
  
  
    | 
      197
     | 
    
                  );
 
     | 
  
  
    | 
      198
     | 
    
      
 
     | 
  
  
    | 
      199
     | 
    
      // Get home folder not to show
 
     | 
  
  
    | 
      200
     | 
    
      //$home_folders = get_home_folders();
 
     | 
  
  
    | 
      201
     | 
    
      $home_folders = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? get_home_folders() : array();
     | 
  
  
    | 
      202
     | 
    
      
 
     | 
  
  
    | 
      203
     | 
    
      // Generate list
 
     | 
  
  
    | 
      204
     | 
    
      $template->set_block('main_block', 'list_block', 'list');
     | 
  
  
    | 
      205
     | 
    
      
 
     | 
  
  
    | 
      206
     | 
    
      $usedFiles = array();
 
     | 
  
  
    | 
      207
     | 
    
      // require_once(ADMIN_PATH.'/media/dse.php');
 
     | 
  
  
    | 
      208
     | 
    
      // $filename =  $currentdir;
 
     | 
  
  
    | 
      209
     | 
    
      if(!empty($currentdir)) {
     | 
  
  
    | 
      210
     | 
    
          $usedFiles = $Dse->getMatchesFromDir( $currentdir, DseTwo::RETURN_USED);
 
     | 
  
  
    | 
      211
     | 
    
      }
 
     | 
  
  
    | 
      212
     | 
    
      
 
     | 
  
  
    | 
      213
     | 
    
      $DIR  = array();
 
     | 
  
  
    | 
      214
     | 
    
      $FILE = array();
 
     | 
  
  
    | 
      215
     | 
    
      // Check for potentially malicious files
 
     | 
  
  
    | 
      216
     | 
    
      $forbidden_file_types  = preg_replace( '/\s*[,;\|#]\s*/','|',RENAME_FILES_ON_UPLOAD);
 
     | 
  
  
    | 
      217
     | 
    
      if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
     | 
  
  
    | 
      218
     | 
    
          // Loop through the files and dirs an add to list
 
     | 
  
  
    | 
      219
     | 
    
         while (false !== ($file = readdir($handle))) {
     | 
  
  
    | 
      220
     | 
    
              $info = pathinfo($file);
 
     | 
  
  
    | 
      221
     | 
    
              $ext = isset($info['extension']) ? $info['extension'] : '';
 
     | 
  
  
    | 
      222
     | 
    
              if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
     | 
  
  
    | 
      223
     | 
    
                  if( !preg_match('/'.$forbidden_file_types.'$/i', $ext) ) {
     | 
  
  
    | 
      224
     | 
    
                      if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
     | 
  
  
    | 
      225
     | 
    
      //                    if( !isset($home_folders[$directory.'/'.$file]) ) {
     | 
  
  
    | 
      226
     | 
    
                          if(!isset($home_folders[$directory.'/'.$file]) || $currentHome =='' )
 
     | 
  
  
    | 
      227
     | 
    
                          {
     | 
  
  
    | 
      228
     | 
    
                              $DIR[] = $file;
 
     | 
  
  
    | 
      229
     | 
    
                          }
 
     | 
  
  
    | 
      230
     | 
    
                      } else {
     | 
  
  
    | 
      231
     | 
    
                          $FILE[] = $file;
 
     | 
  
  
    | 
      232
     | 
    
                      }
 
     | 
  
  
    | 
      233
     | 
    
                  }
 
     | 
  
  
    | 
      234
     | 
    
              }
 
     | 
  
  
    | 
      235
     | 
    
          }
 
     | 
  
  
    | 
      236
     | 
    
      closedir($handle);
 
     | 
  
  
    | 
      237
     | 
    
      }
 
     | 
  
  
    | 
      238
     | 
    
          $iSortFlags = ((version_compare(PHP_VERSION, '5.4.0', '<'))?SORT_REGULAR:SORT_NATURAL|SORT_FLAG_CASE);
 
     | 
  
  
    | 
      239
     | 
    
          sort($DIR, $iSortFlags);
 
     | 
  
  
    | 
      240
     | 
    
          sort($FILE, $iSortFlags);
 
     | 
  
  
    | 
      241
     | 
    
          $aListDir = array_merge($DIR,$FILE);
 
     | 
  
  
    | 
      242
     | 
    
          // Now parse these values to the template
 
     | 
  
  
    | 
      243
     | 
    
          $temp_id = 0;
 
     | 
  
  
    | 
      244
     | 
    
          $row_bg_color = 'FFF';
 
     | 
  
  
    | 
      245
     | 
    
          if(isset($aListDir)) {
     | 
  
  
    | 
      246
     | 
    
              foreach($aListDir AS $name)
 
     | 
  
  
    | 
      247
     | 
    
              {
     | 
  
  
    | 
      248
     | 
    
                  $sFileName = WB_PATH.'/'.MEDIA_DIRECTORY.$directory.'/'.$name;
 
     | 
  
  
    | 
      249
     | 
    
                  if (is_dir($sFileName)){
     | 
  
  
    | 
      250
     | 
    
                  $link_name = str_replace(' ', '%20', $name);
     | 
  
  
    | 
      251
     | 
    
                  $temp_id++;
 
     | 
  
  
    | 
      252
     | 
    
                  $template->set_var(array(
 
     | 
  
  
    | 
      253
     | 
    
                                      'NAME' => $name,
 
     | 
  
  
    | 
      254
     | 
    
                                      'NAME_SLASHED' => addslashes($name),
 
     | 
  
  
    | 
      255
     | 
    
                                      'TEMP_ID' => $admin->getIDKEY($temp_id),
 
     | 
  
  
    | 
      256
     | 
    
                                      // 'TEMP_ID' => $temp_id,
 
     | 
  
  
    | 
      257
     | 
    
                                      'LINK' => "browse.php?dir=$directory/$link_name",
 
     | 
  
  
    | 
      258
     | 
    
                                      'LINK_TARGET' => '_self',
 
     | 
  
  
    | 
      259
     | 
    
                                      'ROW_BG_COLOR' => $row_bg_color,
 
     | 
  
  
    | 
      260
     | 
    
                                      'FT_ICON' => THEME_URL.'/images/folder_16.png',
 
     | 
  
  
    | 
      261
     | 
    
                                      'FILETYPE_ICON' => THEME_URL.'/images/folder_16.png',
 
     | 
  
  
    | 
      262
     | 
    
                                      'MOUSEOVER' => '',
 
     | 
  
  
    | 
      263
     | 
    
                                      'IMAGEDETAIL' => '',
 
     | 
  
  
    | 
      264
     | 
    
                                      'SIZE' => '--',
 
     | 
  
  
    | 
      265
     | 
    
                                      'DATE' => '',
 
     | 
  
  
    | 
      266
     | 
    
                                      'PREVIEW' => '',
 
     | 
  
  
    | 
      267
     | 
    
                                      'IMAGE_TITLE' => $name,
 
     | 
  
  
    | 
      268
     | 
    
                                      'IMAGE_EXIST' => 'blank_16.gif'
 
     | 
  
  
    | 
      269
     | 
    
                                  )
 
     | 
  
  
    | 
      270
     | 
    
                              );
 
     | 
  
  
    | 
      271
     | 
    
                  $template->parse('list', 'list_block', true);
     | 
  
  
    | 
      272
     | 
    
                  // Code to alternate row colors
 
     | 
  
  
    | 
      273
     | 
    
                  $row_bg_color = (($row_bg_color == 'FFF') ?'ECF1F3':'FFF');
 
     | 
  
  
    | 
      274
     | 
    
          }else {
     | 
  
  
    | 
      275
     | 
    
              $filepreview = array('jpg','gif','tif','tiff','png','txt','css','js','cfg','conf','pdf','zip','gz','doc');
     | 
  
  
    | 
      276
     | 
    
                  $size = filesize(WB_PATH.'/'.MEDIA_DIRECTORY.$directory.'/'.$name);
 
     | 
  
  
    | 
      277
     | 
    
                  $bytes = byte_convert($size);
 
     | 
  
  
    | 
      278
     | 
    
                  $fdate = filemtime(WB_PATH.'/'.MEDIA_DIRECTORY.$directory.'/'.$name);
 
     | 
  
  
    | 
      279
     | 
    
                  $date = gmdate(DATE_FORMAT.' '.TIME_FORMAT, $fdate);
 
     | 
  
  
    | 
      280
     | 
    
                  $filetypeicon = get_filetype_icon(WB_URL.MEDIA_DIRECTORY.$directory.'/'.$name);
 
     | 
  
  
    | 
      281
     | 
    
                  $filetype = get_filetype(WB_URL.MEDIA_DIRECTORY.$directory.'/'.$name);
 
     | 
  
  
    | 
      282
     | 
    
      
 
     | 
  
  
    | 
      283
     | 
    
                  if (in_array($filetype, $filepreview)) {
     | 
  
  
    | 
      284
     | 
    
                      $preview = 'preview';
 
     | 
  
  
    | 
      285
     | 
    
                  } else {
     | 
  
  
    | 
      286
     | 
    
                      $preview = '';
 
     | 
  
  
    | 
      287
     | 
    
                  }
 
     | 
  
  
    | 
      288
     | 
    
                  $temp_id++;
 
     | 
  
  
    | 
      289
     | 
    
                  $imgdetail = '';
 
     | 
  
  
    | 
      290
     | 
    
                  // $icon = THEME_URL.'/images/blank_16.gif';
 
     | 
  
  
    | 
      291
     | 
    
                  $icon = '';
 
     | 
  
  
    | 
      292
     | 
    
                  $tooltip = '';
 
     | 
  
  
    | 
      293
     | 
    
                  if (!$pathsettings['global']['show_thumbs']) {
     | 
  
  
    | 
      294
     | 
    
                      $info = getimagesize(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name);
 
     | 
  
  
    | 
      295
     | 
    
                      if ($info[0]) {
     | 
  
  
    | 
      296
     | 
    
                          $imgdetail = fsize(filesize(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name)).'<br /> '.$info[0].' x '.$info[1].' px';
 
     | 
  
  
    | 
      297
     | 
    
                          $icon = 'thumb.php?t=1&img='.$directory.'/'.$name;
 
     | 
  
  
    | 
      298
     | 
    
                          $tooltip = ToolTip('thumb.php?t=2&img='.$directory.'/'.$name);
     | 
  
  
    | 
      299
     | 
    
                      }
 
     | 
  
  
    | 
      300
     | 
    
                  }
 
     | 
  
  
    | 
      301
     | 
    
                  $filetype_url = THEME_URL.'/images/files/'.$filetypeicon.'.png';
 
     | 
  
  
    | 
      302
     | 
    
                  $template->set_var(array(
 
     | 
  
  
    | 
      303
     | 
    
                                      'NAME' => $name,
 
     | 
  
  
    | 
      304
     | 
    
                                      'NAME_SLASHED' => addslashes($name),
 
     | 
  
  
    | 
      305
     | 
    
                                      'TEMP_ID' => $admin->getIDKEY($temp_id),
 
     | 
  
  
    | 
      306
     | 
    
                                      // 'TEMP_ID' => $temp_id,
 
     | 
  
  
    | 
      307
     | 
    
                                      'LINK' => WB_URL.MEDIA_DIRECTORY.$directory.'/'.$name,
 
     | 
  
  
    | 
      308
     | 
    
                                      'LINK_TARGET' => '_blank',
 
     | 
  
  
    | 
      309
     | 
    
                                      'ROW_BG_COLOR' => $row_bg_color,
 
     | 
  
  
    | 
      310
     | 
    
                                      'FT_ICON' => empty($icon) ? $filetype_url : $icon,
 
     | 
  
  
    | 
      311
     | 
    
                                      'FILETYPE_ICON' => $filetype_url,
 
     | 
  
  
    | 
      312
     | 
    
                                      'MOUSEOVER' => $tooltip,
 
     | 
  
  
    | 
      313
     | 
    
                                      'IMAGEDETAIL' => $imgdetail,
 
     | 
  
  
    | 
      314
     | 
    
                                      'SIZE' => $bytes,
 
     | 
  
  
    | 
      315
     | 
    
                                      'DATE' => $date,
 
     | 
  
  
    | 
      316
     | 
    
                                      'PREVIEW' => $preview,
 
     | 
  
  
    | 
      317
     | 
    
                                      'IMAGE_TITLE' => $name,
 
     | 
  
  
    | 
      318
     | 
    
                                      'IMAGE_EXIST' =>  'blank_16.gif'
 
     | 
  
  
    | 
      319
     | 
    
                                  )
 
     | 
  
  
    | 
      320
     | 
    
                              );
 
     | 
  
  
    | 
      321
     | 
    
                  $template->parse('list', 'list_block', true);
     | 
  
  
    | 
      322
     | 
    
                  // Code to alternate row colors
 
     | 
  
  
    | 
      323
     | 
    
                  if($row_bg_color == 'FFF') {
     | 
  
  
    | 
      324
     | 
    
                      $row_bg_color = 'ECF1F3';
 
     | 
  
  
    | 
      325
     | 
    
                  } else {
     | 
  
  
    | 
      326
     | 
    
                      $row_bg_color = 'FFF';
 
     | 
  
  
    | 
      327
     | 
    
                  }
 
     | 
  
  
    | 
      328
     | 
    
          }
 
     | 
  
  
    | 
      329
     | 
    
              } #foreach
 
     | 
  
  
    | 
      330
     | 
    
          }
 
     | 
  
  
    | 
      331
     | 
    
      
 
     | 
  
  
    | 
      332
     | 
    
      // If no files are in the media folder say so
 
     | 
  
  
    | 
      333
     | 
    
      if($temp_id == 0) {
     | 
  
  
    | 
      334
     | 
    
          $template->set_var('DISPLAY_LIST_TABLE', 'hide');
     | 
  
  
    | 
      335
     | 
    
      } else {
     | 
  
  
    | 
      336
     | 
    
          $template->set_var('DISPLAY_NONE_FOUND', 'hide');
     | 
  
  
    | 
      337
     | 
    
      }
 
     | 
  
  
    | 
      338
     | 
    
      
 
     | 
  
  
    | 
      339
     | 
    
      //if($currentHome=='') {
     | 
  
  
    | 
      340
     | 
    
      if( !in_array($admin->get_username(), explode('/',$directory)) ) {
     | 
  
  
    | 
      341
     | 
    
      // Insert permissions values
 
     | 
  
  
    | 
      342
     | 
    
          if($admin->get_permission('media_rename') != true) {
     | 
  
  
    | 
      343
     | 
    
              $template->set_var('DISPLAY_RENAME', 'hide');
     | 
  
  
    | 
      344
     | 
    
          }
 
     | 
  
  
    | 
      345
     | 
    
          if($admin->get_permission('media_delete') != true) {
     | 
  
  
    | 
      346
     | 
    
              $template->set_var('DISPLAY_DELETE', 'hide');
     | 
  
  
    | 
      347
     | 
    
          }
 
     | 
  
  
    | 
      348
     | 
    
      }
 
     | 
  
  
    | 
      349
     | 
    
      
 
     | 
  
  
    | 
      350
     | 
    
      // Insert language text and messages
 
     | 
  
  
    | 
      351
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      352
     | 
    
                          'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
 
     | 
  
  
    | 
      353
     | 
    
                          'TEXT_CURRENT_FOLDER' => $TEXT['CURRENT_FOLDER'],
 
     | 
  
  
    | 
      354
     | 
    
                          'TEXT_RELOAD' => $TEXT['RELOAD'],
 
     | 
  
  
    | 
      355
     | 
    
                          'TEXT_RENAME' => $TEXT['RENAME'],
 
     | 
  
  
    | 
      356
     | 
    
                          'TEXT_DELETE' => $TEXT['DELETE'],
 
     | 
  
  
    | 
      357
     | 
    
                          'TEXT_SIZE' => $TEXT['SIZE'],
 
     | 
  
  
    | 
      358
     | 
    
                          'TEXT_DATE' => $TEXT['DATE'],
 
     | 
  
  
    | 
      359
     | 
    
                          'TEXT_NAME' => $TEXT['NAME'],
 
     | 
  
  
    | 
      360
     | 
    
                          'TEXT_TYPE' => $TEXT['TYPE'],
 
     | 
  
  
    | 
      361
     | 
    
                          'TEXT_UP' => $TEXT['UP'],
 
     | 
  
  
    | 
      362
     | 
    
                          'NONE_FOUND' => $MESSAGE['MEDIA_NONE_FOUND'],
 
     | 
  
  
    | 
      363
     | 
    
                          'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
 
     | 
  
  
    | 
      364
     | 
    
                          'CONFIRM_DELETE' => $MESSAGE['MEDIA_CONFIRM_DELETE']
 
     | 
  
  
    | 
      365
     | 
    
                      )
 
     | 
  
  
    | 
      366
     | 
    
                  );
 
     | 
  
  
    | 
      367
     | 
    
      
 
     | 
  
  
    | 
      368
     | 
    
      // Parse template object
 
     | 
  
  
    | 
      369
     | 
    
      $template->parse('main', 'main_block', false);
     | 
  
  
    | 
      370
     | 
    
      $template->pparse('output', 'page');
     | 
  
  
    | 
      371
     | 
    
      /*
 
     | 
  
  
    | 
      372
     | 
    
      $endtime=explode(" ", microtime());
     | 
  
  
    | 
      373
     | 
    
      $endtime=$endtime[0]+$endtime[1];
 
     | 
  
  
    | 
      374
     | 
    
      $debugVMsg = '';
 
     | 
  
  
    | 
      375
     | 
    
      if($admin->ami_group_member('1') ) {
     | 
  
  
    | 
      376
     | 
    
          $debugVMsg  = "<p>Mask loaded in ".round($endtime - $starttime,6)." Sec,  ";
 
     | 
  
  
    | 
      377
     | 
    
          $debugVMsg .= "Memory in use ".number_format(memory_get_usage(true), 0, ',', '.')." Byte,  ";
 
     | 
  
  
    | 
      378
     | 
    
          $debugVMsg .= sizeof(get_included_files())." included files</p>";
 
     | 
  
  
    | 
      379
     | 
    
          // $debugVMsg = print_message($debugVMsg,'#','debug',-1,false);
 
     | 
  
  
    | 
      380
     | 
    
          print $debugVMsg.'<br />';
 
     | 
  
  
    | 
      381
     | 
    
       }
 
     | 
  
  
    | 
      382
     | 
    
      */
 
     |