示例#1
0
function showContent($path)
{
    if ($handle = opendir($path)) {
        while (false !== ($file = readdir($handle))) {
            if ($file == '.' || $file == '..' || valid_extension($file)) {
                // echo "hidden<br>";
            } else {
                $fName = htmlspecialchars($file, ENT_QUOTES);
                $file = $path . "/" . $file;
                $file = htmlspecialchars($file, ENT_QUOTES);
                $fileurl = str_replace(" ", "%20", $file);
                if (is_file($file)) {
                    echo "<li class='music' data-icon='false'><a class='musicfile' href='#' data-src='" . $_ENV['domain'] . $fileurl . "'><h3>" . $fName . "</h3>" . "<p class='size ui-li-aside'> " . format_size(filesize($file)) . "</p></a></li>";
                } elseif (is_dir($file)) {
                    echo "<li class='folder'><a href='" . $_SERVER['SCRIPT_NAME'] . "?path=" . $file . "'>";
                    if (file_exists($file . "/" . $_ENV['coverart'])) {
                        $folderart = $_ENV['domain'] . $fileurl . "/" . $_ENV['coverart'];
                        echo "<img src='{$folderart}'>";
                    } else {
                        echo "<img src='images/jewelcase_empty.png'>";
                    }
                    echo "<h3>{$fName}</h3></a></li>";
                }
            }
        }
        closedir($handle);
    }
}
示例#2
0
function get_cache_file()
{
    global $quality;
    static $cache_file;
    if (!$cache_file) {
        $frags = split("\\.", $_REQUEST['src']);
        $ext = strtolower($frags[count($frags) - 1]);
        if (!valid_extension($ext)) {
            $ext = 'jpg';
        }
        $cachename = get_request('src', 'timthumb') . get_request('w', 100) . get_request('h', 100) . get_request('zc', 1) . get_request('9', 80);
        $cache_file = md5($cachename) . '.' . $ext;
    }
    return $cache_file;
}
示例#3
0
function dir_files($dir, $thefile = false, $ext = false)
{
    //if (preg_match("$", $dir, $tra))	$dir = substr($dir, 0, -1);
    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                if ($file != ".." && $file != ".") {
                    if ($thefile) {
                        if ($thefile == str_replace("." . file_extension($file), "", $file)) {
                            if ($ext) {
                                if (valid_extension($file, $ext)) {
                                    $return[] = $file;
                                }
                            } else {
                                $return[] = $file;
                            }
                        }
                    } else {
                        if ($ext) {
                            if (valid_extension($file, $ext)) {
                                $return[] = $file;
                            }
                        } else {
                            $return[] = $file;
                        }
                    }
                }
            }
            closedir($dh);
        }
    }
    if (count($return)) {
        return $return;
    } else {
        return false;
    }
}