forked from team/site
fix homepage link logic
- double check index existence - clean up indentation
This commit is contained in:
parent
e5b70b80b3
commit
bc975a6581
48
index.php
48
index.php
|
@ -65,6 +65,7 @@ $parser = Tildeverse\Wiki\Parser::factory();
|
|||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<h1>~news~</h1>
|
||||
|
||||
<?php foreach (array_slice(array_reverse(glob("news/pages/*.md")), 0, 4) as $page):
|
||||
$parsed = $parser->parse(file_get_contents($page));
|
||||
$yaml = $parsed->getYAML();
|
||||
|
@ -73,13 +74,9 @@ $parser = Tildeverse\Wiki\Parser::factory();
|
|||
<div class="list-group">
|
||||
<div class="list-group-item">
|
||||
<h3 class="list-group-item-heading"><?=$yaml["title"]?></h3>
|
||||
<em>
|
||||
<a href="/news/<?=basename($page, ".md")?>"><?=$yaml["date"]?></a>
|
||||
</em>
|
||||
<em><a href="/news/<?=basename($page, ".md")?>"><?=$yaml["date"]?></a></em>
|
||||
•
|
||||
<em>
|
||||
<a href="/~<?=$yaml["author"]?>/"><?=$yaml["author"]?></a>
|
||||
</em>
|
||||
<em><a href="/~<?=$yaml["author"]?>/"><?=$yaml["author"]?></a></em>
|
||||
<hr>
|
||||
<div class="list-group-item-text"><?=$parsed->getContent()?></div>
|
||||
</div>
|
||||
|
@ -89,7 +86,7 @@ $parser = Tildeverse\Wiki\Parser::factory();
|
|||
|
||||
<div class="list-group">
|
||||
<div class="list-group-item">
|
||||
<p class="list-group-item-text"><a href="/news/">news archive here...</a></p>
|
||||
<p class="list-group-item-text"><a href="/news/">news archive...</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -120,25 +117,42 @@ $parser = Tildeverse\Wiki\Parser::factory();
|
|||
<p><em><a href="/tilde.24h.html"><i class="fa fa-clock-o"></i> recent updates</a></em></p>
|
||||
<p>if you're not listed here, make some changes to your page</p>
|
||||
<p><a href="/users/">all users</a></p>
|
||||
<br><br>
|
||||
<div class="list-group">
|
||||
<ul>
|
||||
<?php
|
||||
foreach (glob("/home/*") as $user):
|
||||
if (!is_dir("$user/public_html")
|
||||
|| (file_exists("$user/public_html/index.php")
|
||||
&& in_array(sha1_file("$user/public_html/index.php"),
|
||||
// these are the sha1s of two previous default pages
|
||||
["ca32714c33abb57430583ad07efec6097ae1a044", "f190ba3a1ed796a20bea83304e45e799420c0716"])))
|
||||
continue;
|
||||
$user = basename($user); ?>
|
||||
<?php foreach (glob("/home/*/public_html", GLOB_ONLYDIR) as $user):
|
||||
if (
|
||||
(
|
||||
// make sure we have an index page
|
||||
!is_file("$user/index.html")
|
||||
&& !is_file("$user/index.htm")
|
||||
&& !is_file("$user/index.cgi")
|
||||
&& !is_file("$user/index.php")
|
||||
)
|
||||
|| (
|
||||
// if it's php, compare the hash to the default page
|
||||
is_file("$user/index.php")
|
||||
&& in_array(
|
||||
sha1_file("$user/index.php"),
|
||||
[
|
||||
// these are the sha1s of two previous pages
|
||||
"ca32714c33abb57430583ad07efec6097ae1a044",
|
||||
"f190ba3a1ed796a20bea83304e45e799420c0716"
|
||||
]
|
||||
)
|
||||
)
|
||||
) continue;
|
||||
$user = basename(dirname($user));
|
||||
$usercount++; ?>
|
||||
|
||||
<li style="list-style: none; margin-left: -40px;">
|
||||
<a href="/~<?=$user?>/" class="list-group-item">
|
||||
<h6 class="list-group-item-heading">~<?=$user?></h6>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<p>users who have updated their homepages: <?=$usercount?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -13,12 +13,12 @@ $services = [
|
|||
'webring' => ['fa' => 'life-ring', 'url' => '/ring/'],
|
||||
];
|
||||
|
||||
$nav = isset($navbar);
|
||||
$nav = isset($navbar) && $navbar;
|
||||
unset($navbar);
|
||||
|
||||
foreach ($services as $name => $service) { ?>
|
||||
<?php if ($nav) echo '<li>'; ?>
|
||||
<a href="<?=$service['url']?>" <?php if (!$nav) echo 'class="btn btn-default"'; ?>><i class="fa fa-<?=$service['fa']?>"></i> ~<?=$name?>~</a>
|
||||
<?php if ($nav) echo '</li>'; ?>
|
||||
<a href="<?=$service['url']?>" <?php if (!$nav) echo 'class="btn btn-default"'; ?>><i class="fa fa-<?=$service['fa']?>"></i> <?=$name?></a>
|
||||
<?php if ($nav) echo '</li>' . PHP_EOL; ?>
|
||||
<?php }
|
||||
|
||||
|
|
Loading…
Reference in New Issue