array(), 'message' => array() ); $newthumbqty = 0; // read folder contents if folder exists if(file_exists($tinybrowser['docroot'].$browsepath)) { // Read directory contents and populate $file array $dh = opendir($tinybrowser['docroot'].$browsepath); $file = array(); while (($filename = readdir($dh)) !== false) { // get file extension $nameparts = explode('.',$filename); $ext = end($nameparts); // filter directories and prohibited file types if($filename != '.' && $filename != '..' && !is_dir($tinybrowser['docroot'].$browsepath.$filename) && !in_array($ext, $tinybrowser['prohibited']) && ($typenow == 'file' || strpos(strtolower($tinybrowser['filetype'][$typenow]),strtolower($ext)))) { // search file name if search term entered if($findnow) $exists = strpos(strtolower($filename),strtolower($findnow)); // assign file details to array, for all files or those that match search if(!$findnow || ($findnow && $exists !== false)) { $file['name'][] = $filename; $file['sortname'][] = strtolower($filename); $file['modified'][] = filemtime($tinybrowser['docroot'].$browsepath.$filename); $file['size'][] = filesize($tinybrowser['docroot'].$browsepath.$filename); // image specific info or general if($typenow=='image' && $imginfo = getimagesize($tinybrowser['docroot'].$browsepath.$filename)) { $file['width'][] = $imginfo[0]; $file['height'][] = $imginfo[1]; $file['dimensions'][] = $imginfo[0] + $imginfo[1]; $file['type'][] = $imginfo['mime']; // Check a thumbnail exists if(!file_exists($tinybrowser['docroot'].$browsepath.'_thumbs/')) createfolder($tinybrowser['docroot'].$browsepath.'_thumbs/',$tinybrowser['unixpermissions']); $thumbimg = $tinybrowser['docroot'].$browsepath.'_thumbs/_'.$filename; if (!file_exists($thumbimg)) { $nothumbimg = $tinybrowser['docroot'].$browsepath.$filename; $mime = getimagesize($nothumbimg); $im = convert_image($nothumbimg,$mime['mime']); resizeimage($im,$tinybrowser['thumbsize'],$tinybrowser['thumbsize'],$thumbimg,$tinybrowser['thumbquality'],$mime['mime']); imagedestroy($im); $newthumbqty++; } } else { $file['width'][] = 'N/A'; $file['height'][] = 'N/A'; $file['dimensions'][] = 'N/A'; $file['type'][] = returnMIMEType($filename); } } } } closedir($dh); } // create file upload folder else { $success = createfolder($tinybrowser['docroot'].$browsepath,$tinybrowser['unixpermissions']); if($success) { if($typenow=='image') createfolder($tinybrowser['docroot'].$browsepath.'_thumbs/',$tinybrowser['unixpermissions']); $notify['type'][]='success'; $notify['message'][]=sprintf(TB_MSGMKDIR, $browsepath); } else { $notify['type'][]='error'; $notify['message'][]=sprintf(TB_MSGMKDIRFAIL, $browsepath); } } // Assign directory structure to array $browsedirs=array(); dirtree($browsedirs,$tinybrowser['filetype'][$typenow],$tinybrowser['docroot'],$tinybrowser['path'][$typenow]); // generate alert if new thumbnails created if($newthumbqty>0) { $notify['type'][]='info'; $notify['message'][]=sprintf(TB_MSGNEWTHUMBS, $newthumbqty); } // determine sort order $sortorder = ($sorttypenow == 'asc' ? SORT_ASC : SORT_DESC); $num_of_files = (isset($file['name']) ? count($file['name']) : 0); if($num_of_files>0) { // sort files by selected order sortfileorder($sortbynow,$sortorder,$file); } // determine pagination if($tinybrowser['pagination']>0) { $showpage_start = ($showpagenow ? ($_REQUEST['showpage']*$tinybrowser['pagination'])-$tinybrowser['pagination'] : 0); $showpage_end = $showpage_start+$tinybrowser['pagination']; if($showpage_end>$num_of_files) $showpage_end = $num_of_files; } else { $showpage_start = 0; $showpage_end = $num_of_files; } ?> TinyBrowser :: <?php echo TB_BROWSE; ?> > 0) alert($notify); form_open('foldertab',false,'tinybrowser.php','?type='.$typenow.$passviewtype.$passsortby.$passfeid); ?>
0) { $pagelimit = ceil($num_of_files/$tinybrowser['pagination'])+1; $page = array(); for($i=1;$i<$pagelimit;$i++) { $page[] = array($i,TB_PAGE.' '.$i); } if($i>2) form_select($page,'showpage',TB_SHOW,$showpagenow,true); } ?>
'.TB_DIMENSIONS.''; } else $imagehead = ''; echo '
' .'' .'' .$imagehead .'' .''; // show image thumbnails, unless detail view is selected if($typenow=='image' && $viewtypenow != 'detail') { echo '
'.TB_FILENAME.''.TB_SIZE.''.TB_TYPE.''.TB_DATE.'
'; for($i=$showpage_start;$i<$showpage_end;$i++) { echo ''; } } else { for($i=$showpage_start;$i<$showpage_end;$i++) { $alt = (IsOdd($i) ? 'r1' : 'r0'); echo ''; if($typenow=='image') echo ''.truncate_text($file['name'][$i],30).''; else echo ''.truncate_text($file['name'][$i],30).''; echo ''.bytestostring($file['size'][$i],1).''; if($typenow=='image') echo ''.$file['width'][$i].' x '.$file['height'][$i].''; echo ''.$file['type'][$i].'' .''.date($tinybrowser['dateformat'],$file['modified'][$i]).''."\n"; } echo '
'; } ?>