Subversion Repositories oidplus

Rev

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

Rev 148 Rev 150
Line 41... Line 41...
41
                if (explode('$',$id)[0] == 'oidplus:ra_log') {
41
                if (explode('$',$id)[0] == 'oidplus:ra_log') {
42
                        $handled = true;
42
                        $handled = true;
43
 
43
 
44
                        $ra_email = explode('$',$id)[1];
44
                        $ra_email = explode('$',$id)[1];
45
 
45
 
46
                        $res = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."ra where email = '".OIDplus::db()->real_escape_string($ra_email)."'");
46
                        $res = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."ra where email = ?", array($ra_email));
47
                        if (OIDplus::db()->num_rows($res) == 0) {
47
                        if (OIDplus::db()->num_rows($res) == 0) {
48
                                $out['icon'] = 'img/error_big.png';
48
                                $out['icon'] = 'img/error_big.png';
49
                                $out['text'] = 'RA <b>'.htmlentities($ra_email).'</b> does not exist';
49
                                $out['text'] = 'RA <b>'.htmlentities($ra_email).'</b> does not exist';
50
                                return $out;
50
                                return $out;
51
                        }
51
                        }
Line 59... Line 59...
59
                        $out['title'] = "Log entries for RA $ra_email";
59
                        $out['title'] = "Log entries for RA $ra_email";
60
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? 'plugins/'.basename(dirname(__DIR__)).'/'.basename(__DIR__).'/icon_big.png' : '';
60
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? 'plugins/'.basename(dirname(__DIR__)).'/'.basename(__DIR__).'/icon_big.png' : '';
61
 
61
 
62
                        $res = OIDplus::db()->query("select lo.unix_ts, lo.addr, lo.event from ".OIDPLUS_TABLENAME_PREFIX."log lo ".
62
                        $res = OIDplus::db()->query("select lo.unix_ts, lo.addr, lo.event from ".OIDPLUS_TABLENAME_PREFIX."log lo ".
63
                                                    "left join ".OIDPLUS_TABLENAME_PREFIX."log_user lu on lu.log_id = lo.id ".
63
                                                    "left join ".OIDPLUS_TABLENAME_PREFIX."log_user lu on lu.log_id = lo.id ".
64
                                                    "where lu.user = '".OIDplus::db()->real_escape_string($ra_email)."' " .
64
                                                    "where lu.user = ? " .
65
                                                                                "order by lo.unix_ts desc");
65
                                                    "order by lo.unix_ts desc", array($ra_email));
66
                        if (OIDplus::db()->num_rows($res) > 0) {
66
                        if (OIDplus::db()->num_rows($res) > 0) {
67
                                $out['text'] = '<pre>';
67
                                $out['text'] = '<pre>';
68
                                while ($row = OIDplus::db()->fetch_array($res)) {
68
                                while ($row = OIDplus::db()->fetch_array($res)) {
69
                                        $addr = empty($row['addr']) ? 'no address' : $row['addr'];
69
                                        $addr = empty($row['addr']) ? 'no address' : $row['addr'];
70
 
70