2019-07-07 01:39:54 +00:00
|
|
|
<?php
|
2025-02-14 02:03:39 +00:00
|
|
|
$html_skel = '/etc/skel/public_html/index.html';
|
|
|
|
|
2019-07-07 01:39:54 +00:00
|
|
|
print "<!-- Begin autogen userdir list -->";
|
|
|
|
print "<ul style='list-style: none; margin-left: -40px;'>";
|
2025-02-14 02:03:39 +00:00
|
|
|
|
|
|
|
foreach (glob("/home/*") as $userpath) {
|
|
|
|
if (is_dir("$userpath/public_html")) {
|
|
|
|
$user = basename($userpath);
|
2025-04-26 19:17:26 +00:00
|
|
|
|
|
|
|
// Use @ to suppress warnings in case the user directory/files are not readable.
|
2025-02-14 02:03:39 +00:00
|
|
|
$skeletonMatch = (@sha1_file($html_skel) === @sha1_file("$userpath/public_html/index.html"));
|
|
|
|
$isEmptyPubhtml = (@count(@scandir("$userpath/public_html")) === 2); // 2 => "." and ".."
|
|
|
|
|
|
|
|
if ($skeletonMatch || $isEmptyPubhtml) {
|
2025-04-26 19:17:26 +00:00
|
|
|
// If it matches the skeleton index.html or is empty, display without a link
|
2025-02-14 02:03:39 +00:00
|
|
|
print "<li>~$user</li>\n";
|
|
|
|
} else {
|
2025-04-26 19:17:26 +00:00
|
|
|
// Otherwise, link to the user's directory
|
2025-02-14 02:03:39 +00:00
|
|
|
print "<li><a href='$site_root/~$user/'>~$user</a></li>\n";
|
|
|
|
}
|
2021-11-18 16:13:06 +00:00
|
|
|
}
|
2025-02-14 02:03:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print "</ul></div>\n<!-- End Autgen userdir list -->";
|
2019-07-07 01:39:54 +00:00
|
|
|
?>
|