Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, September 20, 2019

File: [Platon] / wolboard / archive.php (download)

Revision 1.1, Tue May 14 15:55:44 2002 UTC (17 years, 4 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.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top