From: Matteo Nastasi Date: Thu, 16 Apr 2020 09:50:01 +0000 (+0200) Subject: log_legal function usable without a valid user instance as parameter X-Git-Tag: v5.8.0~2 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=65b3ab569e06032a81b52a88ae109757bedc1b97;p=brisk.git log_legal function usable without a valid user instance as parameter --- diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 83620aa..4be9c87 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -3354,9 +3354,9 @@ function log_legal($curtime, $addr, $user, $where, $mesg) if (($fp = @fopen(LEGAL_PATH."/legal.log", 'a')) != FALSE) { /* Unix time | session | nickname | IP | where was | mesg */ - fwrite($fp, sprintf("%ld|%s|%s|%s|%s|%s|%s|\n", $curtime, $user->sess, - ($user->is_auth() ? 'A' : 'N'), - $user->name, $addr, $where , $mesg)); + fwrite($fp, sprintf("%ld|%s|%s|%s|%s|%s|%s|\n", $curtime, ($user ? $user->sess : "NOSESS"), + ($user ? ($user->is_auth() ? 'A' : 'N') : "U"), + ($user ? $user->name : "NO-USER"), $addr, $where , $mesg)); fclose($fp); } } diff --git a/web/Obj/sac-a-push.phh b/web/Obj/sac-a-push.phh index 6b347d4..1f9a70c 100644 --- a/web/Obj/sac-a-push.phh +++ b/web/Obj/sac-a-push.phh @@ -718,7 +718,7 @@ class Sac_a_push { $list_web_arr[intval($this->list_web[$i])] = $this->list_web[$i]; } - log_legal(time(), '127.0.0.1', 'BRISK', 'MAIN', 'LOG:START'); + log_legal(time(), '127.0.0.1', FALSE, 'MAIN', 'LOG:START'); $lastime = 0; $dump_users = TRUE; @@ -746,7 +746,7 @@ class Sac_a_push { $mtime_unfi = 100.0 * $mtsum_unfi / $mtime_diff; $mtime_mana = 100.0 * $mtsum_mana / $mtime_diff; - log_legal(time(), '127.0.0.1', 'BRISK', 'MAIN', + log_legal(time(), '127.0.0.1', FALSE, 'MAIN', sprintf('LOG:PROF: tot(%.3f) idle: %.2f read: %.2f garb: %.2f unfi: %.2f mana: %.2f', $mtime_diff, $mtime_idle, $mtime_read, $mtime_garb, $mtime_unfi, $mtime_mana )); @@ -755,7 +755,7 @@ class Sac_a_push { $mtsum_garb = 0.0; $mtsum_unfi = 0.0; $mtsum_mana = 0.0; - $mtime_begin = $mtime_end; + $mtime_start = $mtime_finish; } fprintf(STDERR, "\nIN LOOP: Current opened: %d pending_pages: %d\n", count($this->socks), count($this->pending_pages)); }