login/edit: list user existence in tags
[minimedit.git] / avatars.php
index a305ec632e56cca310b18e115106c33c17c38927..ad2f8045535c42ad9e90362f3df9a8ab29d2fe0d 100644 (file)
@@ -1,12 +1,25 @@
 <?php
-$users = glob("profile/*");
+$basepath = 'profile';
+if ($Args) $basepath .= '/.tags' . $Args;
+$users = glob("$basepath/*/");
 if (!$users) return;
 
-print '<ul class="cat">';
+print '<ul class="gallery cat">';
 
 foreach ($users as $userdir) {
        $user = pathinfo($userdir, PATHINFO_FILENAME);
        $name = @file_get_contents("$userdir/name.txt") ?: ucfirst($user);
+       if (file_exists("$userdir/avatar.jpg")) {
+               $avatar = sprintf(
+                       '<img src="%s" alt="%s" />',
+                       "/thumb/100/profile/$user/avatar.jpg",
+                       $user
+               );
+               $name = sprintf(
+                       '<figure>%s<figcaption>%s</figcaption></figure>',
+                       $avatar, $name
+               );
+       }
        print '<li>'.$name;
 }