Update users.php

fixes user listing.
This commit is contained in:
deepend-tildeclub 2025-02-13 19:03:39 -07:00 committed by GitHub
parent b882fd6bf3
commit a959fe100f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 12 deletions

View File

@ -1,17 +1,23 @@
<?php
$html_skel='/etc/skel/public_html/index.html';
$html_skel = '/etc/skel/public_html/index.html';
print "<!-- Begin autogen userdir list -->";
print "<ul style='list-style: none; margin-left: -40px;'>";
foreach (glob("/home/*") as $userpath):
if (is_dir("$userpath/public_html"))
{
$user = basename($userpath);
if(sha1_file($html_skel) == sha1_file("$userpath/public_html/index.html") || count(scandir("$userpath/public_html")) == 2)
print"<li>~$user</li>\n";
else
print"<li><a href='$site_root/~$user/'>~$user</a></li>\n";
foreach (glob("/home/*") as $userpath) {
if (is_dir("$userpath/public_html")) {
$user = basename($userpath);
$skeletonMatch = (@sha1_file($html_skel) === @sha1_file("$userpath/public_html/index.html"));
$isEmptyPubhtml = (@count(@scandir("$userpath/public_html")) === 2); // 2 => "." and ".."
if ($skeletonMatch || $isEmptyPubhtml) {
print "<li>~$user</li>\n";
} else {
print "<li><a href='$site_root/~$user/'>~$user</a></li>\n";
}
}
endforeach;
print "</ul></div>
<!-- End Autgen userdir list -->";
}
print "</ul></div>\n<!-- End Autgen userdir list -->";
?>