Exemplo n.º 1
0
function getAlbumPreview($dir)
{
    $previewFile = DATA_DIR . "/{$dir}/albumpreview";
    if (is_file("{$previewFile}.jpg")) {
        return "{$previewFile}.jpg";
    } else {
        if (is_file("{$previewFile}.empty")) {
            return "";
        } else {
            if (is_file("{$previewFile}.png")) {
                return "{$previewFile}.png";
            } else {
                # config to allow group writable files
                umask(DATA_UMASK);
                # create the thumbs directory recursively
                if (!is_dir(dirname($previewFile))) {
                    mkdir(dirname($previewFile), 0777, true);
                }
                // no preview: look for a preview in current dir, write it, return it
                foreach (scandir($dir) as $file) {
                    if ($file != '.' and $file != '..') {
                        $ext = strtolower(substr($file, -4));
                        if ($ext == ".jpg" or $ext == ".png") {
                            $thumb = getPreview("{$dir}/{$file}");
                            copy($thumb, $previewFile . $ext);
                            return $previewFile . $ext;
                        } else {
                            if (is_dir("{$dir}/{$file}")) {
                                $subPreview = getAlbumPreview("{$dir}/{$file}");
                                if ($subPreview) {
                                    $myPreview = dirname($previewFile) . "/" . basename($subPreview);
                                    copy($subPreview, $myPreview);
                                    return $myPreview;
                                }
                            }
                        }
                    }
                }
                // nothing found. create empty file
                touch("{$previewFile}.empty");
                return "";
            }
        }
    }
}
Exemplo n.º 2
0
}
if (isset($_GET['get_size'])) {
    echo @getSizeFromCache($_GET['get_size']);
    return;
}
if (isset($_GET['phpinfo'])) {
    phpinfo();
    return;
}
// end page get
$root = clearRoot(glob(PATH_TO_DISPLAY . '*/'), $dirs_to_ignore);
foreach ($root as &$path) {
    $structure = array();
    $structure['name'] = $path;
    $structure['url'] = PATH_TO_DISPLAY . $path;
    $structure['img'] = getPreview($path);
    $path = $structure;
}
// main code vhost
$vhost_include_not_define = true;
if (($apache_conf = glob(WAMP_PATH . 'bin/apache/apache*/conf/httpd.conf')) > 0 || $custom_vhost_path_config) {
    $apache_conf = realpath(isset($apache_conf[0]) ? $apache_conf[0] : null);
    if ($vhostIsEnable = vhostIsEnable($apache_conf) ||  isset($custom_vhost_path_config)) {
        $vhosts_path = isset($custom_vhost_path_config) ? array($custom_vhost_path_config) : glob(WAMP_PATH . 'vhost/*.conf');
        $vhosts = array();
        foreach ($vhosts_path as &$vhost) {
            $vhosts = array_merge($vhosts, getVhosts($vhost, $vhost_to_ignore));
        }
        // use apache_get_version
        if (!IS_WINDOWS) {
            $vhost_default_conf = <<<VHOST