diff --git a/index.php b/index.php
index 291dff2..d06778f 100644
--- a/index.php
+++ b/index.php
@@ -1,6 +1,6 @@
-
+
-
welcome to tilde.club
Questions? See the official FAQ.
@@ -171,7 +170,6 @@ if (isset($_GET['notice'])) {
if you're not seeing yourself listed here, change your page from the default.
users with recently updated pages within the last month are highlighted in a lighter color.
list all users
-
0 ? $indexFiles[0] : null;
+ // Retrieve from cache file if available
+ $cache_file = 'cache/homepages_list.html';
- if (!$index || in_array(sha1_file($index), $page_shas)) continue;
+ if (file_exists($cache_file) and time() - filemtime($cache_file) < 86400)
+ {
+ $homepages_list = file_get_contents($cache_file);
+ }
+ // Cache not available or expired
+ else
+ {
+ $homepages_list = '';
- // Check if the index pages were updated in the last month
- $recentChange = false;
+ foreach (glob("/home/*") as $user) {
+ // Look for index files with common extensions
+ $indexFiles = glob("$user/public_html/index.{html,htm,php}", GLOB_BRACE);
+ $index = count($indexFiles) > 0 ? $indexFiles[0] : null;
- foreach ($indexFiles as $file) {
- if (filemtime($file) > $oneMonthAgo) {
- $recentChange = true;
- break;
+ if (!$index || in_array(sha1_file($index), $page_shas)) continue;
+
+ // Check if the index pages were updated in the last month
+ $recentChange = false;
+
+ foreach ($indexFiles as $file) {
+ if (filemtime($file) > $oneMonthAgo) {
+ $recentChange = true;
+ break;
+ }
}
- }
- $user = basename($user);
- $class = $recentChange ? 'recently-updated' : '';
-
- echo '- ~'.$user.'
';
- }
+ $user = basename($user);
+ $class = $recentChange ? 'recently-updated' : '';
+
+ $homepages_list .= '- ~'.$user.'
';
+ }
+
+ $homepages_list .= '
';
+
+ // Save cache file
+ $save_cache = file_put_contents($cache_file, $homepages_list);
+ }
+
+ echo $homepages_list;
?>
-
-
-
+