Subversion Repositories oidplus

Rev

Rev 1116 | Rev 1172 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1116 Rev 1130
Line 40... Line 40...
40
         * @param array $objects
40
         * @param array $objects
41
         * @return bool
41
         * @return bool
42
         * @throws OIDplusException
42
         * @throws OIDplusException
43
         */
43
         */
44
        public static function log(string $event, array $users, array $objects): bool {
44
        public static function log(string $event, array $users, array $objects): bool {
45
                $addr = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
45
                $addr = $_SERVER['REMOTE_ADDR'] ?? '';
46
                OIDplus::dbIsolated()->query("insert into ###log (addr, unix_ts, event) values (?, ?, ?)", array($addr, time(), $event));
46
                OIDplus::dbIsolated()->query("insert into ###log (addr, unix_ts, event) values (?, ?, ?)", array($addr, time(), $event));
47
                $log_id = OIDplus::dbIsolated()->insert_id();
47
                $log_id = OIDplus::dbIsolated()->insert_id();
48
                if ($log_id === 0) {
48
                if ($log_id === 0) {
49
                        $res = OIDplus::dbIsolated()->query("select max(id) as last_id from ###log");
49
                        $res = OIDplus::dbIsolated()->query("select max(id) as last_id from ###log");
50
                        if (!$res->any()) throw new OIDplusException(_L('Could not log event'));
50
                        if (!$res->any()) throw new OIDplusException(_L('Could not log event'));