Пример #1
0
}
if (!defined("GALLERY_ROOT")) {
    define("GALLERY_ROOT", "");
}
$thumbdir = rtrim('../photos' . "/" . $_REQUEST["dir"], "/");
//$thumbdir = str_replace("/..", "", $thumbdir); // Prevent looking at any up-level folders
$currentdir = GALLERY_ROOT . $thumbdir;
//-----------------------
// READ FILES AND FOLDERS
//-----------------------
$files = array();
$dirs = array();
if ($handle = opendir($currentdir)) {
    while (false !== ($file = readdir($handle))) {
        // 1. LOAD FOLDERS
        if (is_directory($currentdir . "/" . $file)) {
            if ($file != "." && $file != ".." & $file != "cache") {
                checkpermissions($currentdir . "/" . $file);
                // Check for correct file permission
                // Set thumbnail to folder.jpg if found:
                if (file_exists("{$currentdir}/" . $file . "/folder.jpg")) {
                    $dirs[] = array("name" => $file, "date" => filemtime($currentdir . "/" . $file . "/folder.jpg"), "html" => "<li class='thumbnail'><a href='?dir=" . ltrim($_GET['dir'] . "/" . $file, "/") . "'><em>" . padstring($file, $label_max_length) . "</em><span></span><img src='" . GALLERY_ROOT . "phpThumb.php?src={$currentdir}/" . $file . "/folder.jpg&amp;w={$thumb_size}&amp;h={$thumb_size}&amp;zc=1'  alt='{$label_loading}' /></a></li>");
                } else {
                    // Set thumbnail to first image found (if any):
                    unset($firstimage);
                    $firstimage = getfirstImage("{$currentdir}/" . $file);
                    if ($firstimage != "") {
                        $dirs[] = array("name" => $file, "date" => filemtime($currentdir . "/" . $file), "html" => "<li class='thumbnail'>" . "<a href='?dir=" . ltrim($_GET['dir'] . "/" . $file, "/") . "'>" . "<img src='" . GALLERY_ROOT . "phpThumb.php?src={$thumbdir}/" . $file . "/" . $firstimage . "&amp;w={$thumb_size}&amp;h={$thumb_size}&amp;zc=1'  alt='{$label_loading}' /></a>" . "<a href='?dir=" . ltrim($_GET['dir'] . "/" . $file, "/") . "'>" . "<h5>" . padstring($file, $label_max_length) . "</h5>" . '</a>' . "</li>");
                    } else {
                        // If no folder.jpg or image is found, then display default icon:
                        $dirs[] = array("name" => $file, "date" => filemtime($currentdir . "/" . $file), "html" => "<li class='thumbnail'>" . "<a href='?dir=" . ltrim($_GET['dir'] . "/" . $file, "/") . "'>" . "<img src='" . GALLERY_ROOT . "images/folder_" . strtolower($folder_color) . ".png' width='{$thumb_size}' height='{$thumb_size}' alt='{$label_loading}' />" . "<h5>" . padstring($file, $label_max_length) . "</h5>" . "</li>");
Пример #2
0
<?php

/**
 * @author           Pierre-Henry Soria <*****@*****.**>
 * @copyright        (c) 2012-2015, Pierre-Henry Soria. All Rights Reserved.
 * @license          GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package          PH7 / Inc / Ajax
 */
namespace PH7;

define('PH7', 1);
require '_ajax.inc.php';
if (!empty($_POST['dir'])) {
    if (is_directory($_POST['dir'])) {
        echo '<p class="success">' . $LANG['yes_dir'] . '</p>';
    } else {
        echo '<p class="error">' . $LANG['no_dir'] . '</p>';
    }
}