Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $baseDir = "Nightly";
- $return_arr = array();
- define("ONE_K", 1024);
- define("KB", ONE_K);
- define("MB", ONE_K * KB);
- define("GB", ONE_K * MB);
- define("TB", ONE_K * GB);
- function formatBytes($size, $precision = 2)
- {
- $base = log($size) / log(1024);
- $suffixes = array('', 'k', 'M', 'G', 'T');
- return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
- }
- if(isset($clean['basedir'])) {
- echo $baseDir;
- }
- if(isset($_GET['device'])) {
- $device = $_GET['device'];
- $folder = $_GET['folder'];
- if(is_dir($baseDir . "/" . $device . "/" . $folder)){
- $row_array = array();
- $return_arr = array();
- $json = array();
- if ($handle = opendir($baseDir . "/" . $device . "/" . $folder)) {
- $path = $baseDir . "/" . $device . "/" . $folder;
- while (false !== ($file = readdir($handle))) {
- if($file == "." or $file == ".." || $file == ".htaccess" || $file == ".users"){
- } else {
- $row_array['filename'] = $file;
- if(is_file($path . "/" . $file)) {
- $filePath = $$path . "/" . $file;
- $filesize = filesize($path . "/" . $file);
- $actfile = "http://www.drdevs.com/devs/teamliquid/" . $path . "/" . $file;
- $row_array['filesize'] = formatBytes($filesize);
- $path = "$dev" . "/" . "$device" . "/" . "$file";
- $row_array['downloads'] = $actfile;
- }
- array_push($return_arr,$row_array);
- }
- }
- sort($return_arr);
- $json['dev_info'] = $return_arr;
- closedir($handle);
- }
- echo json_encode($json);
- }
- exit;
- }
- if(isset($_GET['dev'])) {
- $dev = $clean['dev'];
- if(is_dir($baseDir . "/" . $dev)){
- $row_array = array();
- $json = array();
- if ($handle = opendir($baseDir . "/" . $dev)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." or $file == ".." || $file == ".htaccess" || $file == ".users"){
- } else {
- $row_array['device'] = $file;
- if(is_file($baseDir . "/" . "$dev" . "/" . $file)) {
- $filesize = filesize($baseDir . "/" . $dev . "/" . $file);
- $row_array['filesize'] = formatBytes($filesize);
- $path = "$dev" . "$device" . "/" . "$file";
- $row_array['downloads'] = $row['downloads'];
- }
- array_push($return_arr,$row_array);
- }
- }
- sort($return_arr);
- $json['dev_info'] = $return_arr;
- closedir($handle);
- }
- echo json_encode($json);
- }
- exit;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment