kettek/index.php

111 lines
3.2 KiB
PHP

<?php
$pages = [
"proclib",
"QWiki",
"polymail",
"TODO",
"kettext",
"front",
"plans",
"news",
"netwine",
"dox",
"cirquit",
"petite_juliet",
"VAD",
"newsboy",
"about",
"utilities",
"ARK",
"noirchat"
];
$current_page = "news";
foreach ($pages as $page) {
foreach ($_GET as $get=>$value) {
if ($get == $page) {
$current_page = $page;
}
}
}
// Get our aphorism
$aphs = scandir('aphorism/');
$aphorism = "aphorism/".$aphs[2 + (date("d") % (count($aphs)-2))];
if ($current_page == "plans") {
if ($_GET["plans"] == '') {
$plans = scandir('plans/');
for ($i = 2; $i < count($plans); $i++) {
$post .= "<a href=?plans=".$plans[$i].">".$plans[$i]."</a><br />\n";
}
} else {
$plans = scandir('plans/');
for ($i = 2; $i < count($plans); $i++) {
if ($plans[$i] == $_GET['plans']) break;
}
$post .= "<h3>".$_GET['plans']."</h3>";
$post .= "<center>";
if ($i-1 >= 2) {
$post .= '<a href="?plans='.$plans[$i-1].'" class="surf">&lt;&lt; '.$plans[$i-1].'</a>';
}
$post .= ' <a href="?plans" class="surf">index</a> ';
if ($i+1 < count($plans)) {
$post .= '<a href="?plans='.$plans[$i+1].'" class="surf">'.$plans[$i+1].' &gt;&gt;</a>';
}
$post .= "</center>";
$post .= "<pre>".htmlentities(file_get_contents("plans/".$_GET['plans']))."</pre>";
}
} else if ($current_page == "dox") {
if ($_GET["dox"] == '') {
$dox = scandir('dox/');
for ($i = 2; $i < count($dox); $i++) {
$post .= "<a href=?dox=".$dox[$i].">".$dox[$i]."</a><br />\n";
}
} else {
$post .= '<a href="?dox" class="surf">Back to index</a><br />';
$post .= (file_get_contents("dox/".$_GET['dox']));
}
} else if ($current_page == "news") {
$news = scandir('news/');
array_shift($news);
array_shift($news);
rsort($news);
for ($i = 0; $i < count($news); $i++) {
$post .= (file_get_contents("news/".$news[$i]));
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>kettek</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/style_reset.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/style_pretty.css">
<!--<script type="text/javascript" src="javascript/folder.js"></script>-->
<script type="text/javascript" src="javascript/img2popup.js"></script>
<script type="text/javascript" src="javascript/history.js"></script>
<script type="text/javascript">window.onload = function() { img2popup.Go(); hist.Go(); };</script>
</head>
<body>
<div id="header">
<div class="min">
<a href="/kettek/"><div id="puss"></div></a>
<div class="qat_bubble"><?php include($aphorism); ?></div>
</div>
</div>
<div class="min">
<div id="menu">
<?php include 'menu.html' ?>
</div>
<div id="content">
<?php (file_exists('pages/'.$current_page.'.html') ? include 'pages/'.$current_page.'.html' : '')?>
<?php echo ($post ? $post : '') ?>
</div>
</div>
</body>
</html>