tildeweblogs/index.php

25 lines
1.9 KiB
PHP
Raw Normal View History

2021-04-09 17:11:51 +00:00
<?php include "blog_config.php";
if($custom_css!=False){if(file_exists($custom_css)){$custom_css="<link rel='stylesheet' href='$custom_css'>";}else{$custom_css="";}}else{$custom_css="";}
2021-04-09 17:33:34 +00:00
$style="body{text-align:center;font-family:monospace;}p{font-size:large;}a#logo{color:black;text-decoration:none;}.notlogo{margin:5px 0 0 0;}#article{text-align:left;margin:1px 30%;font-size:large;}@media screen and (max-width: 600px){#article{margin:1px 10%;}}footer{margin:1em 0 0 0;}";
2021-04-09 17:23:28 +00:00
$footer="</div><footer>pwd by <a href='https://tildegit.org/lucas/tildeweblogs'>~weblogs</a></footer></body></html>";
2021-04-09 17:11:51 +00:00
if(isset($_GET["p"])){
function notfound($errno, $errstr){die("Error!\nPost not found");}
set_error_handler("notfound");
header("Content-type: text/html");
$post=$_GET["p"]-1;
2021-04-09 18:13:25 +00:00
echo "<!DOCTYPE html><html><head><!--~weblogs v1--><meta name='viewport' content='width=device-width,initial-scale=1'><title>".$posts[$post][1]." | $title</title><style>$style</style>$custom_css</head><body><a id='logo' href='?'><h1>$title</h1></a><div class='notlogo'>";
2021-04-09 17:11:51 +00:00
if(strpos($posts[$post][1],"\n")){$html_log=str_replace("\n","<br>",$posts[$post][2]);}else{$html_log=$posts[$post][1];}
2021-04-09 18:13:25 +00:00
echo "<h2>".$posts[$post][1]."</h2>Published on ".$posts[$post][0]."<br><br><div id='article'>$html_log</div>";
2021-04-09 17:30:18 +00:00
if($utterances!=False){echo "<br>$utterances";}
2021-04-09 17:11:51 +00:00
echo $footer;
}else{
header("Content-type: text/html");
2021-04-09 17:22:04 +00:00
if($website!=False){$website="<p><a href='$website'>Website</a></p>";}else{$website="";}
2021-04-09 18:13:25 +00:00
echo "<!DOCTYPE html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><title>$title</title><style>$style</style>$custom_css</head><body><a id='logo' href='?'><h1>$title</h1></a>$website<div class='notlogo'>";
2021-04-09 17:11:51 +00:00
$a=count($posts)-1;$ao=0;$next=$a+1;
while($ao < count($posts)){
echo "<p><b><a href='?p=$next'>".$posts[$a][1]."</a></b> ".$posts[$a][0]."</p>";
$a--; $ao++; $next--;
}
echo $footer;
} ?>