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 24... Line 24...
24
        }
24
        }
25
 
25
 
26
        public function gui($id, &$out, &$handled) {
26
        public function gui($id, &$out, &$handled) {
27
                if ($id === 'oidplus:well_known_oids') {
27
                if ($id === 'oidplus:well_known_oids') {
28
                        $handled = true;
28
                        $handled = true;
29
                        $out['title'] = 'Well known OIDs';
29
                        $out['title'] = _L('Well known OIDs');
30
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
30
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
31
 
31
 
32
                        if (!OIDplus::authUtils()::isAdminLoggedIn()) {
32
                        if (!OIDplus::authUtils()::isAdminLoggedIn()) {
33
                                $out['icon'] = 'img/error_big.png';
33
                                $out['icon'] = 'img/error_big.png';
34
                                $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as administrator.</p>';
34
                                $out['text'] = '<p>'._L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login')).'</p>';
35
                                return;
35
                                return;
36
                        }
36
                        }
37
 
37
 
38
                        $out['text'] = '<p><abbr title="These ID names can only be edited in the database directly (Tables ###asn1id and ###iri). Usually, there is no need to do this, though.">How to edit these IDs?</abbr></p>';
38
                        $out['text'] = '<p><abbr title="'._L('These ID names can only be edited in the database directly (Tables ###asn1id and ###iri). Usually, there is no need to do this, though.').'">'._L('How to edit these IDs?').'</abbr></p>';
39
 
39
 
40
                        $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">';
40
                        $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">';
41
                        $out['text'] .= '<table class="table table-bordered table-striped">';
41
                        $out['text'] .= '<table class="table table-bordered table-striped">';
42
                        $out['text'] .= '       <tr>';
42
                        $out['text'] .= '       <tr>';
43
                        $out['text'] .= '            <th>OID</th>';
43
                        $out['text'] .= '            <th>'._L('OID').'</th>';
44
                        $out['text'] .= '            <th>ASN.1 identifiers (comma sep.)</th>';
44
                        $out['text'] .= '            <th>'._L('ASN.1 identifiers (comma sep.)').'</th>';
45
                        $out['text'] .= '            <th>IRI identifiers (comma sep.)</th>';
45
                        $out['text'] .= '            <th>'._L('IRI identifiers (comma sep.)').'</th>';
46
                        $out['text'] .= '       </tr>';
46
                        $out['text'] .= '       </tr>';
47
 
47
 
48
                        $res = OIDplus::db()->query("select a.oid from (select oid from ###asn1id where well_known = '1' union select oid from ###iri where well_known = '1') a order by ".OIDplus::db()->natOrder('oid'));
48
                        $res = OIDplus::db()->query("select a.oid from (select oid from ###asn1id where well_known = '1' union select oid from ###iri where well_known = '1') a order by ".OIDplus::db()->natOrder('oid'));
49
                        while ($row = $res->fetch_array()) {
49
                        while ($row = $res->fetch_array()) {
50
                                $asn1ids = array();
50
                                $asn1ids = array();
51
                                $res2 = OIDplus::db()->query("select name, standardized from ###asn1id where oid = ?", array($row['oid']));
51
                                $res2 = OIDplus::db()->query("select name, standardized from ###asn1id where oid = ?", array($row['oid']));
52
                                while ($row2 = $res2->fetch_array()) {
52
                                while ($row2 = $res2->fetch_array()) {
53
                                        $asn1ids[] = $row2['name'].($row2['standardized'] ? ' (standardized)' : '');
53
                                        $asn1ids[] = $row2['name'].($row2['standardized'] ? ' ('._L('standardized').')' : '');
54
                                }
54
                                }
55
 
55
 
56
                                $iris = array();
56
                                $iris = array();
57
                                $res2 = OIDplus::db()->query("select name, longarc from ###iri where oid = ?", array($row['oid']));
57
                                $res2 = OIDplus::db()->query("select name, longarc from ###iri where oid = ?", array($row['oid']));
58
                                while ($row2 = $res2->fetch_array()) {
58
                                while ($row2 = $res2->fetch_array()) {
59
                                        $iris[] = $row2['name'].($row2['longarc'] ? ' (long arc)' : '');
59
                                        $iris[] = $row2['name'].($row2['longarc'] ? ' ('._L('long arc').')' : '');
60
                                }
60
                                }
61
 
61
 
62
                                $out['text'] .= '<tr>';
62
                                $out['text'] .= '<tr>';
63
                                $out['text'] .= '     <td>'.htmlentities(explode(':',$row['oid'])[1]).'</td>';
63
                                $out['text'] .= '     <td>'.htmlentities(explode(':',$row['oid'])[1]).'</td>';
64
                                $out['text'] .= '     <td>'.htmlentities(implode(', ', $asn1ids)).'</td>';
64
                                $out['text'] .= '     <td>'.htmlentities(implode(', ', $asn1ids)).'</td>';
Line 81... Line 81...
81
                }
81
                }
82
 
82
 
83
                $json[] = array(
83
                $json[] = array(
84
                        'id' => 'oidplus:well_known_oids',
84
                        'id' => 'oidplus:well_known_oids',
85
                        'icon' => $tree_icon,
85
                        'icon' => $tree_icon,
86
                        'text' => 'Well known OIDs'
86
                        'text' => _L('Well known OIDs')
87
                );
87
                );
88
 
88
 
89
                return true;
89
                return true;
90
        }
90
        }
91
 
91