id) { require( "../../../../../administrator/includes/auth.php" ); } if ($my->id && ($my->gid == 2 || ($my->gid >= 19 && $my->gid <= 25))) { require('config.inc.php'); $refresh_dirs = false; $clear_upload = false; $err = false; if (isset($_REQUEST['refresh'])) { $refresh_dirs = true; } if (isset($_REQUEST['file'])) { $file = str_replace('\\', '/', $_REQUEST['file']); $file = str_replace('../', '', $file); $file = str_replace('./', '', $file); $file = str_replace('/', '', $file); } else { $file = ''; } if (isset($_REQUEST['path'])) { $path = str_replace('\\', '/', $_REQUEST['path']); $path = str_replace('../', '', $path); $path = str_replace('./', '', $path); if ('/' != substr($path,0,1)) $path = '/'.$path; if ('/' != substr($path,-1,1)) $path = $path.'/'; } else { $path = '/'; } $MY_FILE = $file; $MY_PATH = $path; $paths = explode('/', $MY_PATH); $MY_UP_PATH = '/'; for($i=0; $i 0) $MY_UP_PATH .= $path.'/'; } function deleteFile($Path, $File) { global $MY_ALLOW_DELETE_FILE, $MY_MESSAGES, $MY_DOCUMENT_ROOT ; if (!$MY_ALLOW_DELETE_FILE) return ($MY_MESSAGES['nopermtodeletefile']); $delFile = $MY_DOCUMENT_ROOT.$Path.$File; if (!(is_file($delFile))) return ($MY_MESSAGES['filenotfound']); if (!(unlink($delFile))) return ($MY_MESSAGES['unlinkfailed']); return false; } function deleteFolder($Path, $Folder) { global $MY_ALLOW_DELETE_FOLDER, $MY_MESSAGES, $MY_DOCUMENT_ROOT, $refresh_dirs; if (!$MY_ALLOW_DELETE_FOLDER) return ($MY_MESSAGES['nopermtodeletefolder']); $delFolder = str_replace('\\','/',$MY_DOCUMENT_ROOT.$Path.$Folder); if (!(is_dir($delFolder))) return ($MY_MESSAGES['foldernotfound']); $d = @dir($delFolder); $i = 0; while (false !== ($entry = $d->read())) { if ($entry != '.' && $entry != '..') $i++; //continue, break to skip further dirlist ?? } if ($i > 0) return ($MY_MESSAGES['foldernotempty']); if (!rmdir($delFolder)) return ($MY_MESSAGES['rmdirfailed']); $refresh_dirs = true; return false; } function createFolder($Path, $Folder) { global $MY_ALLOW_CREATE_FOLDER, $MY_MESSAGES, $MY_DOCUMENT_ROOT, $refresh_dirs; if (!$MY_ALLOW_CREATE_FOLDER) return ($MY_MESSAGES['nopermtocreatefolder']); if (!(is_dir($MY_DOCUMENT_ROOT.$Path))) return ($MY_MESSAGES['pathnotfound']); if ( 0 == strlen($Folder)) return ($MY_MESSAGES['foldernamemissing']); $newFolder = $MY_DOCUMENT_ROOT.$Path.$Folder; if (is_dir($newFolder)) return ($MY_MESSAGES['folderalreadyexists']); if (!(@mkdir($newFolder,0755))) return ($MY_MESSAGES['mkdirfailed']); chmod($newFolder,0755); $refresh_dirs = true; return false; } function uploadFile($Path, $File) { global $MY_ALLOW_UPLOAD_FILE, $MY_MESSAGES, $MY_DOCUMENT_ROOT, $clear_upload; global $MY_ALLOW_EXTENSIONS, $MY_DENY_EXTENSIONS, $MY_MAX_FILE_SIZE ; if (!$MY_ALLOW_UPLOAD_FILE) return ($MY_MESSAGES['nopermtoupload']); if (!(is_dir($MY_DOCUMENT_ROOT.$Path))) return ($MY_MESSAGES['pathnotfound']); $newFile = $MY_DOCUMENT_ROOT.$Path.$File['name']; $parts = explode('.', $File['name']); $ext = strtolower($parts[count($parts)-1]); if (is_array($MY_DENY_EXTENSIONS )) { if (in_array($ext, $MY_DENY_EXTENSIONS)) return ($MY_MESSAGES['extnotallowed']); } if (is_array($MY_ALLOW_EXTENSIONS )) { if (!in_array($ext, $MY_ALLOW_EXTENSIONS)) return ($MY_MESSAGES['extnotallowed']); } if ($MY_MAX_FILE_SIZE) { if ($File['size'] > $MY_MAX_FILE_SIZE) return ($MY_MESSAGES['filesizeexceedlimit']); } if (!is_file($File['tmp_name'])) return ($MY_MESSAGES['filenotuploaded']); move_uploaded_file($File['tmp_name'], $newFile); chmod($newFile, 0666); $clear_upload = true; return false; } if (isset($_REQUEST['deleteFile'])) $err = deleteFile($MY_PATH, $MY_FILE); if (isset($_REQUEST['deleteFolder'])) $err = deleteFolder($MY_PATH, $MY_FILE); if (isset($_REQUEST['createFolder'])) $err = createFolder($MY_PATH, $MY_FILE); if (isset($_FILES['uploadFile']) && is_array($_FILES['uploadFile'])) $err = uploadFile($MY_PATH, $_FILES['uploadFile']); function dirs($dir,$abs_path) { $d = dir($dir); $dirs = array(); while (false !== ($entry = $d->read())) { if(is_dir($dir.'/'.$entry) && substr($entry,0,1) != '.') { $path['path'] = $dir.'/'.$entry; $path['name'] = $entry; $dirs[$entry] = $path; } } $d->close(); ksort($dirs); for($i=0; $i= 1024 && $size < 1024*1024) { return sprintf('%01.2f',$size/1024.0).' KB'; } else { return sprintf('%01.2f',$size/(1024.0*1024)).' MB'; } } function parse_time($timestamp) { global $MY_DATETIME_FORMAT; return date($MY_DATETIME_FORMAT, $timestamp); } function parse_icon($ext) { switch (strtolower($ext)) { case 'doc': return 'doc_small.gif'; case 'xls': return 'xls_small.gif'; case 'ppt': return 'ppt_small.gif'; case 'html': return 'html_small.gif'; case 'pdf': return 'pdf_small.gif'; case 'rar': return 'rar_small.gif'; case 'zip': return 'zip_small.gif'; case 'gz': return 'gz_small.gif'; case 'mov': return 'mov_small.gif'; case 'txt': return 'txt_small.gif'; case 'png': return 'png_small.gif'; case 'jpg': return 'jpg_small.gif'; case 'gif': return 'gif_small.gif'; default: return 'def_small.gif'; } } function draw_no_results() { global $MY_MESSAGES; echo '
'; echo $MY_MESSAGES['nofiles']; echo '
'; } function draw_no_dir() { global $MY_MESSAGES; global $MY_DOCUMENT_ROOT; echo '
'; echo $MY_MESSAGES['configproblem']." ".$MY_DOCUMENT_ROOT; echo '
'; } ?> File Browser '.$MY_MESSAGES['type'].' '.$MY_MESSAGES['name'].' '.$MY_MESSAGES['size'].' '.$MY_MESSAGES['datemodified'].'   '; $t_folders = ' '; $t_files='
'; $entries_cnt = 0; while (false !== ($entry = $d->read())) { if(substr($entry,0,1) != '.') { $relativePath = $MY_PATH.$entry; $absolutePath = $MY_DOCUMENT_ROOT.$relativePath; if (is_dir($absolutePath)) { $entries_cnt++; $time = filemtime($absolutePath); $t_folders .= ''; } else { $entries_cnt++; $ext = substr(strrchr($entry, '.'), 1); if (is_array($MY_LIST_EXTENSIONS)) { if (!in_array($ext, $MY_LIST_EXTENSIONS)) continue; } $size = filesize($absolutePath); $time = filemtime($absolutePath); $parsed_size = parse_size($size); $parsed_time = parse_time($time); $parsed_icon = 'images/ext/'.parse_icon($ext); $t_files .= ''; } } } $d->close(); $t_folders .= '
'.$entry.' '.$MY_MESSAGES['folder'].' '.parse_time($time).' '; if ($MY_ALLOW_DELETE_FOLDER) { $t_folders .= ''; } else { $t_folders .= ' '; } $t_folders .= ' '.$MY_MESSAGES['folder'].' '.$time.'
'.$entry.' '.$parsed_size.' '.$parsed_time.' '; if ($MY_ALLOW_DELETE_FILE) { $t_files .= ''; } else { $t_files .= ' '; } $t_files .= ' '.$ext.' '.$size.' '.$time.'
'; $t_files .= ' '; if ($entries_cnt) { echo $t_header."\n
".$t_folders."\n".$t_files."
"; ?>