Subversion Repositories oidplus

Rev

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

Rev 321 Rev 360
Line 48... Line 48...
48
                //       The problem is that first all public and then all RA plugins get loaded, not mixed by their priority
48
                //       The problem is that first all public and then all RA plugins get loaded, not mixed by their priority
49
                $res = OIDplus::db()->query("select lo.id, lo.unix_ts, lo.addr, lo.event, lu.severity from ###log lo ".
49
                $res = OIDplus::db()->query("select lo.id, lo.unix_ts, lo.addr, lo.event, lu.severity from ###log lo ".
50
                                            "left join ###log_object lu on lu.log_id = lo.id ".
50
                                            "left join ###log_object lu on lu.log_id = lo.id ".
51
                                            "where lu.object = ? " .
51
                                            "where lu.object = ? " .
52
                                            "order by lo.unix_ts desc", array($id));
52
                                            "order by lo.unix_ts desc", array($id));
53
                $text .= "<h2>Log messages for object ".htmlentities($id)."</h2>";
53
                $text .= '<h2>'._L('Log messages for object %1',htmlentities($id)).'</h2>';
54
                if ($res->num_rows() > 0) {
54
                if ($res->num_rows() > 0) {
55
                        $text .= '<pre>';
55
                        $text .= '<pre>';
56
                        while ($row = $res->fetch_array()) {
56
                        while ($row = $res->fetch_array()) {
57
                                $users = array();
57
                                $users = array();
58
                                $res2 = OIDplus::db()->query("select username, severity from ###log_user ".
58
                                $res2 = OIDplus::db()->query("select username, severity from ###log_user ".
Line 60... Line 60...
60
                                while ($row2 = $res2->fetch_array()) {
60
                                while ($row2 = $res2->fetch_array()) {
61
                                        $users[] = $row2['username'];
61
                                        $users[] = $row2['username'];
62
                                }
62
                                }
63
                                $users = count($users) > 0 ? ", ".implode('/',$users) : '';
63
                                $users = count($users) > 0 ? ", ".implode('/',$users) : '';
64
 
64
 
65
                                $addr = empty($row['addr']) ? 'no address' : $row['addr'];
65
                                $addr = empty($row['addr']) ? _L('no address') : $row['addr'];
66
 
66
 
67
                                $text .= '<span class="severity_'.$row['severity'].'">' . date('Y-m-d H:i:s', $row['unix_ts']) . ': ' . htmlentities($row["event"])." (" . htmlentities($addr.$users) . ")</span>\n";
67
                                $text .= '<span class="severity_'.$row['severity'].'">' . date('Y-m-d H:i:s', $row['unix_ts']) . ': ' . htmlentities($row["event"])." (" . htmlentities($addr.$users) . ")</span>\n";
68
                        }
68
                        }
69
                        $text .= '</pre>';
69
                        $text .= '</pre>';
70
 
70
 
71
                        // TODO: List logs in a table instead of a <pre> text
71
                        // TODO: List logs in a table instead of a <pre> text
72
                        // TODO: Load only X events and then re-load new events via AJAX when the user scrolls down
72
                        // TODO: Load only X events and then re-load new events via AJAX when the user scrolls down
73
                } else {
73
                } else {
74
                        $text .= '<p>Currently there are no log entries</p>';
74
                        $text .= '<p>'._L('Currently there are no log entries').'</p>';
75
                }
75
                }
76
 
76
 
77
        }
77
        }
78
 
78
 
79
        public function tree_search($request) {
79
        public function tree_search($request) {