function Title_Files($Files, $Recursive = true)
{
    global $MDR;
    foreach ($Files as $File => $Title) {
        if (is_array($Title) && (!$Recursive || empty($Title))) {
            unset($Files[$File]);
        } else {
            if (is_array($Title)) {
                $Files[$File] = Title_Files($Title, $Recursive);
            } else {
                if (empty($Title)) {
                    require_once $MDR['Core'] . '/function.url_to_title.php';
                    $Files[$File] = url_to_title($File);
                }
            }
        }
    }
    return $Files;
}
Exemple #2
0
     // Header
     require_once $MDR['Core'] . '/function.url_to_title.php';
     $page['title'] = url_to_title(basename($Request['Directory']));
     include $Templates['Header'];
     echo '<div class="row docs-index">';
     require_once $MDR['Core'] . '/function.url_to_title.php';
     $Title = url_to_title($Request['Trimmed']);
     if (!empty($Title)) {
         echo '<h2>' . $Title . '</h2>';
     }
     // Find Suitable Files
     require_once $MDR['Core'] . '/function.find_files.php';
     $Files = Find_Files($Request['Directory']);
     ksort($Files);
     require_once $MDR['Core'] . '/function.title_files.php';
     $Files = Title_Files($Files);
     // List suitable files, or error accordingly.
     if (empty($Files)) {
         // Don't 404, because the directory does exist.
         echo '<h3>' . $Lang['en']['NO_FILES_IN_DIRECTORY'] . '</h3>';
     } else {
         require_once $MDR['Core'] . '/function.list_files.php';
         echo List_Files($Files);
     }
     // Footer
     echo '</div>';
     include $Templates['Footer'];
 } else {
     // Render the file
     if (is_readable($Request['Directory'])) {
         // Apparently this isn't a directory, just a poorly named file.