Example #1
0
function file_paths($path)
{
    global $image_files;
    global $thumb_types;
    $content = get_dir_content($path);
    //remove . and ..
    array_shift($content);
    array_shift($content);
    foreach ($content as $key => $val) {
        $content_path = $path . $val;
        if (is_dir($content_path)) {
            file_paths($content_path . "/");
        } else {
            if (in_array(strrchr(basename($content_path), '.'), $thumb_types)) {
                $image_files[] = $content_path;
            }
        }
    }
}
Example #2
0
        echo display_error_message("<b>Please select a file to upload!</b>") . "<br />";
        break;
}
//Any upload error is displayed here -done
//Change excluded extensions to lowercase if $case_sensative_ext is disabled
if ($case_sensative_ext == 0) {
    foreach ($exclude_ext as $key => $val) {
        $exclude_ext[$key] = strtolower($val);
    }
}
//Initialize arrays
$folders = array();
$files = array();
//initialize arrays -done
//Get directory content seperatiung files and folders into 2 arrays and filtering them to remove those exlcluded
$dir_content = get_dir_content($dir_to_browse);
$folders['name'] = $dir_content['folders']['name'];
$folders['date'] = $dir_content['folders']['date'];
$folders['link'] = $dir_content['folders']['link'];
$files['name'] = $dir_content['files']['name'];
$files['size'] = $dir_content['files']['size'];
$files['date'] = $dir_content['files']['date'];
$files['link'] = $dir_content['files']['link'];
$images_detected = $dir_content['images_detected'];
$media_detected = $dir_content['media_detected'];
//The folder size calculation has not been placed inside the get_dir_content function so as not to affect it's speed. This is important becasue folder_size calls upon get_dir_content
if ($view_mode == 1) {
    if ($show_folder_size_http == 1 && $listing_mode == 0) {
        foreach ($folders['name'] as $key => $val) {
            $folders['size'][$key] = folder_size($dir_to_browse . $folders['name'][$key]);
        }
Example #3
0
<?php

//dirLIST v0.3.0 gallery file
error_reporting(0);
require 'functions.php';
require 'config.php';
$folder = '../' . $dir_to_browse . base64_decode($_GET['folder']);
if (!is_dir($folder)) {
    die("<b>Error:</b> Folder specified does not exist. This could be because you manually entered the folder name in the URL or you don't have permission to access this folder");
}
$content = get_dir_content($folder);
foreach ($content['files']['name'] as $key => $val) {
    if (in_array(strtolower(strrchr($val, '.')), array('.jpg', '.jpeg', '.png', '.gif'))) {
        $path = $folder . '/' . $val;
        $images_paths[] = $path;
        @($js_images_names .= '\'' . $val . '\', ');
        @($js_images_file_sizes .= '\'' . letter_size(filesize($path)) . '\', ');
        $dimensions = getimagesize($path);
        $images_widths[] = $dimensions[0];
        $images_heights[] = $dimensions[1];
        @($js_images_heights .= '\'' . $dimensions[1] . '\', ');
        @($js_images_widths .= '\'' . $dimensions[0] . '\', ');
        @($js_images_download_link .= '\'' . base64_encode($dir_to_browse . base64_decode($_GET['folder']) . '/' . $val) . '\', ');
    }
}
$js_images_names = substr($js_images_names, 0, -2);
$js_images_file_sizes = substr($js_images_file_sizes, 0, -2);
$js_images_heights = substr($js_images_heights, 0, -2);
$js_images_widths = substr($js_images_widths, 0, -2);
$js_images_download_link = substr($js_images_download_link, 0, -2);
?>
Example #4
0
function folder_size($path)
{
    $dir_content = get_dir_content($path . '/');
    foreach ($dir_content['files']['size'] as $val) {
        $total_size += $val;
    }
    foreach ($dir_content['folders']['name'] as $val) {
        $total_size += folder_size($path . '/' . $val);
    }
    return $total_size;
}
Example #5
0
function get_xml_dir_content($path = '', $options = '')
{
    global $CFG;
    $eol = "\n";
    $tab = "\t";
    // If not debug - compact the xml
    if ($CFG->debug === false) {
        $eol = '';
        $tab = '';
    }
    $return_str = '<?xml version="1.0" encoding="utf-8"?>' . $eol . '<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' . $eol;
    $path = realpath($CFG->imgUploadDir . $path);
    // Check path to target dir
    if ((file_exists($path) && is_dir($path) && is_subdir($CFG->imgUploadDir, $path) === true) === false || $CFG->browseSubDir === false) {
        $path = $CFG->imgUploadDir;
    }
    if ($CFG->browseSubDir === false && isset($options) && is_array($options)) {
        $options['dirs'] = false;
    }
    $cur_path = str_replace($CFG->imgUploadDir, '', realpath($path));
    $return_str .= $tab . '<path>';
    $dirnames = explode(DIRECTORY_SEPARATOR, $cur_path);
    foreach ($dirnames as $key => $val) {
        if (!empty($val)) {
            $return_str .= $eol . $tab . $tab . '<dir name="' . htmlentities(htmlentities($val, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8') . '" />';
        }
    }
    unset($dirnames);
    $return_str .= $eol . $tab . '</path>';
    $dir_content = get_dir_content($path, $options);
    if (!empty($dir_content['inf'])) {
        // Process additional info
        $return_str .= $eol . $tab . '<inf';
        foreach ($dir_content['inf'] as $key => $val) {
            $return_str .= ' ' . $key . '="' . htmlentities($val, ENT_QUOTES, 'UTF-8') . '"';
        }
        $return_str .= ' />';
    }
    if (!empty($dir_content['dirs'])) {
        // Process dir
        $return_str .= $eol . $tab . '<dirs>';
        foreach ($dir_content['dirs'] as $val) {
            $return_str .= $eol . $tab . $tab . '<dir';
            if (is_array($val)) {
                foreach ($val as $k => $v) {
                    $return_str .= ' ' . $k . '="' . htmlentities(htmlentities($v, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8') . '"';
                }
                $el_name = $val['name'];
            } else {
                $el_name = $val;
            }
            $return_str .= ' />';
        }
        $return_str .= $eol . $tab . '</dirs>';
    }
    if (!empty($dir_content['files'])) {
        // Process files
        $return_str .= $eol . $tab . '<files>';
        foreach ($dir_content['files'] as $val) {
            $return_str .= $eol . $tab . $tab . '<file';
            if (is_array($val)) {
                foreach ($val as $k => $v) {
                    $return_str .= ' ' . $k . '="' . htmlentities(htmlentities($v, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8') . '"';
                }
                $el_name = $val['name'];
            } else {
                $el_name = $val;
            }
            $return_str .= ' />';
        }
        $return_str .= $eol . $tab . '</files>';
    }
    $return_str .= $eol . '</response>';
    return $return_str;
}
Example #6
0
function from_scrach()
{
    isloged();
    $manga = get_dir_content("data/");
    foreach ($manga as $v2) {
        echo $v2;
        flush();
        mass_resize($v2);
    }
}