Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 12. október 2024

Súbor: [Platon] / wolboard / archive.php (stiahnutie)

Revízia 1.1, Tue May 14 15:55:44 2002 UTC (22 years, 5 months ago) by karas9

Created archived files viewer
Sync. (ie. don't remember :))

<?


    // INITIALISATION

    $hist_dir = "history/";
    $self = $PHP_SELF;


    function archiver_good($a) {
        return (isset($a)
         && (
            (is_string($a) && ($a != "")) ||
            (!is_string($a) && ($a != 0))
            )
        );
    }

    function archiver_show_options($optnames, $optvalues, $selected) {
        if (!is_array($optvalues))
            return 0;

        $found = 0;
        $ret = "";
        for($i = 0; $i < sizeof($optvalues); $i++) {
            $ret .= "<option";
            if (archiver_good($optvalues[$i])) {
                $ret .= " value=\"".$optvalues[$i]."\"";
                if ($optvalues[$i] == $selected) {
                    $found++;
                    $ret .= " selected";
                }
            }
            $ret .= ">";
            if (archiver_good($optnames[$i]))
                $ret .= $optnames[$i];
            $ret .= "</option>\n";
        }
        if ((!$found) && archiver_good($selected))
            $ret .= "<option value=\"$selected\" selected>Custom</option>\n";
        echo $ret;
    }

    function get_archives($dir) {
        $ret = array();
        $d = opendir($dir);
        if (!$d)
            return $ret;
        while (($file = readdir($d)) !== false) {
            if (ereg("^([^0-9]*)([0-9]*)", $file, $regs)) {
                if (!ereg("^\.", $regs[1]))
                    $ret[$regs[1]][$regs[2]] = true;
            }
        }
        closedir($d);
        return $ret;
    }

?>
<html>
<head>
<title>Wol's Board Archive Viewer</title>
</head>
<body bgcolor=black text=white>
<form method=post>
<table width=100% align=center>
<tr>
<td>Select archive:</td>
<td><select name=archive>
<?
    $archives = get_archives($hist_dir);
    archiver_show_options(
        array_keys($archives),
        array_keys($archives),
        $archive
    );
?></select>
</td>
</tr>
<?
    if ($archive) {
?>
<tr><td>Select index:</td>
<td><select name=archive_no>
<?
        archiver_show_options(
            array_keys($archives[$archive]),
            array_keys($archives[$archive]),
            $archive_no
        );
?>
</td></tr>
<?
    }
?>
<tr><td colspan=2><input type=submit></td></tr>
</table>
</form>
<?

    if (archiver_good($archive) && archiver_good($archive_no))
        include "wolboard.php";
    
    
?>
</body>
</html>

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok