Subversion Repositories oidplus

Rev

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

Rev 1273 Rev 1278
Line 61... Line 61...
61
         * @param bool $handled
61
         * @param bool $handled
62
         * @return void
62
         * @return void
63
         * @throws OIDplusException
63
         * @throws OIDplusException
64
         */
64
         */
65
        public function gui(string $id, array &$out, bool &$handled) {
65
        public function gui(string $id, array &$out, bool &$handled) {
66
                $tmp = explode('$',$id);
66
                $parts = explode('$',$id,2);
67
                $classname = $tmp[1] ?? '';
67
                $subpage = $parts[1] ?? '';
68
 
68
 
69
                $parts = explode('.',$tmp[0],2);
-
 
70
                if ($parts[0] != 'oidplus:rest_api_information_admin') return;
69
                if ($parts[0] == 'oidplus:rest_api_information_admin') {
71
                $handled = true;
70
                        $handled = true;
72
 
71
 
73
                if (str_starts_with($classname, 'endpoints:')) {
72
                        if (str_starts_with($subpage, 'endpoints:')) {
-
 
73
                                // Note: This page can be accessed WITHOUT login!
74
                        $plugin = OIDplus::getPluginByOid(explode(':',$classname)[1]);
74
                                $plugin = OIDplus::getPluginByOid(explode(':',$subpage)[1]);
75
                        if (!$plugin || !($plugin instanceof INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_9)) throw new OIDplusException(_L("No endpoints for this plugin found"), null, 404);
75
                                if (!$plugin || !($plugin instanceof INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_9)) throw new OIDplusException(_L("No endpoints for this plugin found"), null, 404);
76
                        $out['title'] = _L('REST API').' - '.$plugin->getManifest()->getName() . ' ' . _L('Endpoints');
76
                                $out['title'] = _L('REST API').' - '.$plugin->getManifest()->getName() . ' ' . _L('Endpoints');
77
                        $out['icon'] = file_exists(__DIR__.'/img/endpoints_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/endpoints_icon.png' : '';
77
                                $out['icon'] = file_exists(__DIR__.'/img/endpoints_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/endpoints_icon.png' : '';
-
 
78
                                $out['text'] = '';
-
 
79
                                if (OIDplus::authUtils()->isAdminLoggedIn()) {
78
                        $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:rest_api_information_admin').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>';
80
                                        $out['text'] .= '<p><a '.OIDplus::gui()->link('oidplus:rest_api_information_admin').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>';
-
 
81
                                }
79
                        $out['text'] .= $plugin->restApiInfo('html');
82
                                $out['text'] .= $plugin->restApiInfo('html');
80
                } else {
83
                        } else {
81
                        $out['title'] = _L('REST API');
84
                                $out['title'] = _L('REST API');
82
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
85
                                $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
83
 
86
 
Line 133... Line 136...
133
                                $out['text'] .= '<p>'._L('All tokens generated before %1 have been blacklisted.',date('d F Y, H:i:s',$bl_time+1)).'</p>';
136
                                        $out['text'] .= '<p>'._L('All tokens generated before %1 have been blacklisted.',date('d F Y, H:i:s',$bl_time+1)).'</p>';
134
                        }
137
                                }
135
                        $out['text'] .= '<button type="button" name="btn_blacklist_jwt" id="btn_blacklist_jwt" class="btn btn-danger btn-xs" onclick="OIDplusPageAdminRestApi.blacklistJWT()">'._L('Blacklist all previously generated tokens').'</button>';
138
                                $out['text'] .= '<button type="button" name="btn_blacklist_jwt" id="btn_blacklist_jwt" class="btn btn-danger btn-xs" onclick="OIDplusPageAdminRestApi.blacklistJWT()">'._L('Blacklist all previously generated tokens').'</button>';
136
                }
139
                        }
137
        }
140
                }
-
 
141
        }
138
 
142
 
139
        /**
143
        /**
140
         * @param array $json
144
         * @param array $json
141
         * @param string|null $ra_email
145
         * @param string|null $ra_email
142
         * @param bool $nonjs
146
         * @param bool $nonjs