<?php

# Pitchfork authentication page
# Include the UI Processor...
include 'includes/pitchfork-class-interface.php';
$auth_UI = new UserInterface();
$auth_UI->set_page_title("Login");
$auth_UI->load_header();
if ($_REQUEST['access'] == 'denied') {
    $auth_UI->special = $auth_UI->load('password-wrong', false);
} else {
    $auth_UI->special = $auth_UI->load('password-prompt', false);
}
$auth_UI->load('prompt-login');
$auth_UI->load_footer();
$auth_UI->return_UI();
# Part of Pitchfork.
    $mask = $Cfg_FolderLoc;
    $index_UI->zip_hash = Listing::hash_gen($Cfg_FolderLoc);
    $index_UI->previous_href = "";
} else {
    $context = Listing::find_hash($_REQUEST['mask'], $Cfg_FolderLoc);
    $mask = $context['current_dir'];
    $index_UI->zip_hash = $_REQUEST['mask'];
}
if ($mask != $Cfg_FolderLoc) {
    $index_UI->previous_href = "pitchfork-application-index.php?mask=" . $context['previous_dir'];
} else {
    $index_UI->previous_href = "pitchfork-application-index.php";
}
# Set a title for this page (that will appear in the browser window title and on the page)
if ($hash == $Cfg_FolderLoc) {
    $index_UI->set_page_title("Index of all files");
} else {
    $index_UI->set_page_title("Index of " . end(explode('/', $mask)));
}
# Detect the browser and see if they can be trusted with the javascript
//if(strpos($browser,"MSIE 6.0")==true){}
//else {$index_UI -> include_js("pitchfork-quicktime-playback.js");}
# Include the page header that contains all the DOCTYPES / javascript / stylesheet
$index_UI->load_header();
$dir_result = $list->ls_dir($mask, $recurse);
if ($list->directory_empty) {
    $index_UI->load("directory-empty");
} else {
    $index_UI->load('index');
    $index_UI->append("<div id=\"browser-div\">");
    $index_UI->append($dir_result);