Update users.php

This commit is contained in:
deepend-tildeclub 2025-04-26 13:17:26 -06:00 committed by GitHub
parent b4b26fcc67
commit 2ae6c8c2b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -7,13 +7,16 @@ print "<ul style='list-style: none; margin-left: -40px;'>";
foreach (glob("/home/*") as $userpath) {
if (is_dir("$userpath/public_html")) {
$user = basename($userpath);
// Use @ to suppress warnings in case the user directory/files are not readable.
$skeletonMatch = (@sha1_file($html_skel) === @sha1_file("$userpath/public_html/index.html"));
$isEmptyPubhtml = (@count(@scandir("$userpath/public_html")) === 2); // 2 => "." and ".."
if ($skeletonMatch || $isEmptyPubhtml) {
// If it matches the skeleton index.html or is empty, display without a link
print "<li>~$user</li>\n";
} else {
// Otherwise, link to the user's directory
print "<li><a href='$site_root/~$user/'>~$user</a></li>\n";
}
}