issue/activity: ignore missing author
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 12 Jan 2021 04:46:17 +0000 (05:46 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 27 Apr 2021 00:48:25 +0000 (02:48 +0200)
Silence PHP warnings for system (eg p2000) notifications.

auth.inc.php
widget/issue/activity.php

index b22ed5bf998aed0f7458ed3d727ac5606e391404..34c83db0c9bd9d5952b7b023878a7d915f07ba53 100644 (file)
@@ -14,7 +14,7 @@ class User
                        throw new Exception("Gebruiker niet gevonden in $dir");
                }
                $this->dir = $dir;
-               $this->login = basename($dir);
+               $this->login = preg_replace('{.*/}', '', $dir);
        }
 
        function __get($col)
index cd99e486916af3e58e888fdc1ed6080fd226a9de..f986a53de5653d46a71774df380fa6f8af733149 100644 (file)
@@ -14,7 +14,6 @@ print '<dl class="replies">';
 
 $group = NULL;
 while ($row = $query->fetch()) {
-       $rowuser = new User("profile/{$row->author}");
        if ($group !== $row->issue) {
                $group = $row->issue;
                print '<dt>';
@@ -25,8 +24,11 @@ while ($row = $query->fetch()) {
                print '</dt>';
        }
        print '<dd>';
-       printf('<strong>%s</strong> <small class="date">%s</small>',
-               $rowuser->html, showdate(preg_split('/\D/', $row->created))
+       if ($row->author and $rowuser = new User("profile/{$row->author}")) {
+               printf('<strong>%s</strong> ', $rowuser->html);
+       }
+       printf('<small class="date">%s</small>',
+               showdate(preg_split('/\D/', $row->created))
        );
        printf("\n\t<blockquote>%s</blockquote>", $row->message);
        print "</dd>\n";