Rev 1099 | Rev 1130 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
635 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
1086 | daniel-mar | 5 | * Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft |
635 | daniel-mar | 6 | * |
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
1050 | daniel-mar | 20 | namespace ViaThinkSoft\OIDplus; |
635 | daniel-mar | 21 | |
1086 | daniel-mar | 22 | // phpcs:disable PSR1.Files.SideEffects |
23 | \defined('INSIDE_OIDPLUS') or die; |
||
24 | // phpcs:enable PSR1.Files.SideEffects |
||
25 | |||
635 | daniel-mar | 26 | class OIDplusPageAdminPlugins extends OIDplusPagePluginAdmin { |
27 | |||
1116 | daniel-mar | 28 | /** |
29 | * @param bool $html |
||
30 | * @return void |
||
31 | */ |
||
32 | public function init(bool $html=true) { |
||
635 | daniel-mar | 33 | } |
34 | |||
1116 | daniel-mar | 35 | /** |
36 | * @param $out |
||
37 | * @return void |
||
38 | */ |
||
828 | daniel-mar | 39 | private function pluginTableHead(&$out) { |
40 | $out['text'] .= ' <tr>'; |
||
41 | $out['text'] .= ' <th width="30%">'._L('Class name').'</th>'; |
||
42 | $out['text'] .= ' <th width="30%">'._L('Plugin name').'</th>'; |
||
43 | $out['text'] .= ' <th width="10%">'._L('Version').'</th>'; |
||
44 | $out['text'] .= ' <th width="15%">'._L('Author').'</th>'; |
||
45 | $out['text'] .= ' <th width="15%">'._L('License').'</th>'; |
||
46 | $out['text'] .= ' </tr>'; |
||
47 | } |
||
48 | |||
1116 | daniel-mar | 49 | /** |
50 | * @param $out |
||
51 | * @param $plugin |
||
52 | * @param $modifier |
||
53 | * @param $na_reason |
||
54 | * @return void |
||
55 | */ |
||
828 | daniel-mar | 56 | private function pluginTableLine(&$out, $plugin, $modifier=0, $na_reason='') { |
1099 | daniel-mar | 57 | $html_reason = empty($na_reason) ? '' : ' ('.htmlentities($na_reason).')'; |
828 | daniel-mar | 58 | $out['text'] .= ' <tr>'; |
59 | if ($modifier == 0) { |
||
60 | // normal line |
||
1099 | daniel-mar | 61 | $out['text'] .= ' <td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a>'.$html_reason.'</td>'; |
828 | daniel-mar | 62 | } else if ($modifier == 1) { |
63 | // active |
||
1099 | daniel-mar | 64 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'><b>'.htmlentities(get_class($plugin)).'</b>'.$html_reason.'</a></td>'; |
828 | daniel-mar | 65 | } else if ($modifier == 2) { |
66 | // not available with reason |
||
1099 | daniel-mar | 67 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'><font color="gray">'.htmlentities(get_class($plugin)).'</font></a><font color="gray">'.$html_reason.'</font></td>'; |
828 | daniel-mar | 68 | } |
69 | $out['text'] .= ' <td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
||
70 | $out['text'] .= ' <td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
71 | $out['text'] .= ' <td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
72 | $out['text'] .= ' <td>' . htmlentities(empty($plugin->getManifest()->getLicense()) ? _L('n/a') : $plugin->getManifest()->getLicense()) . '</td>'; |
||
73 | $out['text'] .= ' </tr>'; |
||
74 | } |
||
75 | |||
1116 | daniel-mar | 76 | /** |
77 | * @param string $id |
||
78 | * @param array $out |
||
79 | * @param bool $handled |
||
80 | * @return void |
||
81 | * @throws OIDplusConfigInitializationException |
||
82 | * @throws OIDplusException |
||
83 | */ |
||
84 | public function gui(string $id, array &$out, bool &$handled) { |
||
635 | daniel-mar | 85 | $tmp = explode('$',$id); |
86 | $classname = isset($tmp[1]) ? $tmp[1] : null; |
||
87 | |||
88 | $parts = explode('.',$tmp[0],2); |
||
89 | if (!isset($parts[1])) $parts[1] = ''; |
||
90 | if ($parts[0] != 'oidplus:system_plugins') return; |
||
91 | $handled = true; |
||
92 | $out['title'] = _L('Installed plugins'); |
||
801 | daniel-mar | 93 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 94 | |
95 | if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
||
800 | daniel-mar | 96 | $out['icon'] = 'img/error.png'; |
635 | daniel-mar | 97 | $out['text'] = '<p>'._L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')).'</p>'; |
98 | return; |
||
99 | } |
||
100 | |||
101 | if (!is_null($classname)) { |
||
102 | $plugin = OIDplus::getPluginByClassName($classname); |
||
103 | if (is_null($plugin)) { |
||
800 | daniel-mar | 104 | $out['icon'] = 'img/error.png'; |
635 | daniel-mar | 105 | $out['text'] = '<p>'._L('Plugin %1 not found.',$classname).'</p>'; |
106 | return; |
||
107 | } |
||
108 | |||
109 | $out['title'] = empty($plugin->getManifest()->getName()) ? htmlentities($classname) : htmlentities($plugin->getManifest()->getName()); |
||
801 | daniel-mar | 110 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 111 | |
112 | $back_link = 'oidplus:system_plugins'; |
||
1050 | daniel-mar | 113 | if (get_parent_class($classname) == OIDplusPagePluginPublic::class) $back_link = 'oidplus:system_plugins.pages.public'; |
114 | if (get_parent_class($classname) == OIDplusPagePluginRa::class) $back_link = 'oidplus:system_plugins.pages.ra'; |
||
115 | if (get_parent_class($classname) == OIDplusPagePluginAdmin::class) $back_link = 'oidplus:system_plugins.pages.admin'; |
||
116 | if (get_parent_class($classname) == OIDplusObjectTypePlugin::class) $back_link = 'oidplus:system_plugins.objects'; |
||
117 | if (get_parent_class($classname) == OIDplusDatabasePlugin::class) $back_link = 'oidplus:system_plugins.database'; |
||
118 | if (get_parent_class($classname) == OIDplusSqlSlangPlugin::class) $back_link = 'oidplus:system_plugins.sql'; |
||
119 | if (get_parent_class($classname) == OIDplusAuthPlugin::class) $back_link = 'oidplus:system_plugins.auth'; |
||
120 | if (get_parent_class($classname) == OIDplusLoggerPlugin::class) $back_link = 'oidplus:system_plugins.logger'; |
||
121 | if (get_parent_class($classname) == OIDplusLanguagePlugin::class) $back_link = 'oidplus:system_plugins.language'; |
||
122 | if (get_parent_class($classname) == OIDplusDesignPlugin::class) $back_link = 'oidplus:system_plugins.design'; |
||
123 | if (get_parent_class($classname) == OIDplusCaptchaPlugin::class) $back_link = 'oidplus:system_plugins.captcha'; |
||
635 | daniel-mar | 124 | $out['text'] = '<p><a '.OIDplus::gui()->link($back_link).'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
125 | |||
126 | $out['text'] .= '<div><label class="padding_label">'._L('Class name').'</label><b>'.htmlentities($classname).'</b></div>'. |
||
127 | '<div><label class="padding_label">'._L('Location').'</label><b>'.htmlentities($plugin->getPluginDirectory()).'</b></div>'. |
||
128 | '<div><label class="padding_label">'._L('Plugin type').'</label><b>'.htmlentities(get_parent_class($classname)).'</b></div>'. |
||
129 | '<div><label class="padding_label">'._L('Plugin name').'</label><b>'.htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()).'</b></div>'. |
||
828 | daniel-mar | 130 | '<div><label class="padding_label">'._L('Author').'</label><b>'.htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()).'</b></div>'. |
131 | '<div><label class="padding_label">'._L('License').'</label><b>'.htmlentities(empty($plugin->getManifest()->getLicense()) ? _L('n/a') : $plugin->getManifest()->getLicense()).'</b></div>'. |
||
132 | '<div><label class="padding_label">'._L('Version').'</label><b>'.htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()).'</b></div>'. |
||
635 | daniel-mar | 133 | '<div><label class="padding_label">'._L('Plugin OID').'</label><b>'.htmlentities(empty($plugin->getManifest()->getOid()) ? _L('n/a') : $plugin->getManifest()->getOid()).'</b></div>'. |
134 | (!empty(trim($plugin->getManifest()->getHtmlDescription())) ? '<br><p><b>'._L('Additional information').':</b></p>' : ''). |
||
135 | $plugin->getManifest()->getHtmlDescription(); |
||
136 | } else { |
||
137 | $show_pages_public = false; |
||
138 | $show_pages_ra = false; |
||
139 | $show_pages_admin = false; |
||
140 | $show_db_active = false; |
||
141 | $show_db_inactive = false; |
||
142 | $show_sql_active = false; |
||
143 | $show_sql_inactive = false; |
||
144 | $show_obj_active = false; |
||
145 | $show_obj_inactive = false; |
||
146 | $show_auth = false; |
||
147 | $show_logger = false; |
||
148 | $show_language = false; |
||
149 | $show_design_active = false; |
||
150 | $show_design_inactive = false; |
||
703 | daniel-mar | 151 | $show_captcha_active = false; |
152 | $show_captcha_inactive = false; |
||
635 | daniel-mar | 153 | |
154 | if ($parts[1] == '') { |
||
155 | $out['title'] = _L('Installed plugins'); |
||
801 | daniel-mar | 156 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 157 | $show_pages_public = true; |
158 | $show_pages_ra = true; |
||
159 | $show_pages_admin = true; |
||
160 | $show_db_active = true; |
||
161 | $show_db_inactive = true; |
||
162 | $show_sql_active = true; |
||
163 | $show_sql_inactive = true; |
||
164 | $show_obj_active = true; |
||
165 | $show_obj_inactive = true; |
||
166 | $show_auth = true; |
||
167 | $show_logger = true; |
||
168 | $show_language = true; |
||
169 | $show_design_active = true; |
||
170 | $show_design_inactive = true; |
||
703 | daniel-mar | 171 | $show_captcha_active = true; |
172 | $show_captcha_inactive = true; |
||
635 | daniel-mar | 173 | } else if ($parts[1] == 'pages') { |
174 | $out['title'] = _L('Page plugins'); |
||
801 | daniel-mar | 175 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 176 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
177 | $show_pages_public = true; |
||
178 | $show_pages_ra = true; |
||
179 | $show_pages_admin = true; |
||
180 | } else if ($parts[1] == 'pages.public') { |
||
181 | $out['title'] = _L('Public page plugins'); |
||
801 | daniel-mar | 182 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 183 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins.pages').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
184 | $show_pages_public = true; |
||
185 | } else if ($parts[1] == 'pages.ra') { |
||
186 | $out['title'] = _L('RA page plugins'); |
||
801 | daniel-mar | 187 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 188 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins.pages').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
189 | $show_pages_ra = true; |
||
190 | } else if ($parts[1] == 'pages.admin') { |
||
191 | $out['title'] = _L('Admin page plugins'); |
||
801 | daniel-mar | 192 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 193 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins.pages').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
194 | $show_pages_admin = true; |
||
195 | } else if ($parts[1] == 'objects') { |
||
196 | $out['title'] = _L('Object type plugins'); |
||
801 | daniel-mar | 197 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 198 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
199 | $show_obj_active = true; |
||
200 | $show_obj_inactive = true; |
||
201 | } else if ($parts[1] == 'objects.enabled') { |
||
202 | $out['title'] = _L('Object type plugins (enabled)'); |
||
801 | daniel-mar | 203 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 204 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
205 | $show_obj_active = true; |
||
206 | } else if ($parts[1] == 'objects.disabled') { |
||
207 | $out['title'] = _L('Object type plugins (disabled)'); |
||
801 | daniel-mar | 208 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 209 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
210 | $show_obj_inactive = true; |
||
211 | } else if ($parts[1] == 'database') { |
||
212 | $out['title'] = _L('Database provider plugins'); |
||
801 | daniel-mar | 213 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 214 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
215 | $show_db_active = true; |
||
216 | $show_db_inactive = true; |
||
217 | } else if ($parts[1] == 'database.enabled') { |
||
218 | $out['title'] = _L('Database provider plugins (active)'); |
||
801 | daniel-mar | 219 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 220 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
221 | $show_db_active = true; |
||
222 | } else if ($parts[1] == 'database.disabled') { |
||
223 | $out['title'] = _L('Database provider plugins (inactive)'); |
||
801 | daniel-mar | 224 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 225 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
226 | $show_db_inactive = true; |
||
227 | } else if ($parts[1] == 'sql') { |
||
228 | $out['title'] = _L('SQL slang plugins'); |
||
801 | daniel-mar | 229 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 230 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
231 | $show_sql_active = true; |
||
232 | $show_sql_inactive = true; |
||
233 | } else if ($parts[1] == 'sql.enabled') { |
||
234 | $out['title'] = _L('SQL slang plugins (active)'); |
||
801 | daniel-mar | 235 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 236 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
237 | $show_sql_active = true; |
||
238 | } else if ($parts[1] == 'sql.disabled') { |
||
239 | $out['title'] = _L('SQL slang plugins (inactive)'); |
||
801 | daniel-mar | 240 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 241 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
242 | $show_sql_inactive = true; |
||
243 | } else if ($parts[1] == 'auth') { |
||
244 | $out['title'] = _L('RA authentication'); |
||
801 | daniel-mar | 245 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 246 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
247 | $show_auth = true; |
||
248 | } else if ($parts[1] == 'logger') { |
||
249 | $out['title'] = _L('Logger'); |
||
801 | daniel-mar | 250 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 251 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
252 | $show_logger = true; |
||
253 | } else if ($parts[1] == 'language') { |
||
254 | $out['title'] = _L('Languages'); |
||
801 | daniel-mar | 255 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 256 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
257 | $show_language = true; |
||
258 | } else if ($parts[1] == 'design') { |
||
259 | $out['title'] = _L('Designs'); |
||
801 | daniel-mar | 260 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
635 | daniel-mar | 261 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
262 | $show_design_active = true; |
||
263 | $show_design_inactive = true; |
||
703 | daniel-mar | 264 | } else if ($parts[1] == 'captcha') { |
265 | $out['title'] = _L('CAPTCHA plugins'); |
||
801 | daniel-mar | 266 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
703 | daniel-mar | 267 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
268 | $show_captcha_active = true; |
||
269 | $show_captcha_inactive = true; |
||
270 | } else if ($parts[1] == 'captcha.enabled') { |
||
271 | $out['title'] = _L('CAPTCHA plugins (active)'); |
||
801 | daniel-mar | 272 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
703 | daniel-mar | 273 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
274 | $show_captcha_active = true; |
||
275 | } else if ($parts[1] == 'captcha.disabled') { |
||
276 | $out['title'] = _L('CAPTCHA plugins (inactive)'); |
||
801 | daniel-mar | 277 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
703 | daniel-mar | 278 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
279 | $show_captcha_inactive = true; |
||
635 | daniel-mar | 280 | } else { |
281 | $out['title'] = _L('Error'); |
||
800 | daniel-mar | 282 | $out['icon'] = 'img/error.png'; |
635 | daniel-mar | 283 | $out['text'] = '<p>'._L('Invalid arguments').'</p>'; |
284 | $out['text'] .= '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
||
285 | return; |
||
286 | } |
||
287 | |||
288 | $pp_public = array(); |
||
289 | $pp_ra = array(); |
||
290 | $pp_admin = array(); |
||
291 | |||
292 | foreach (OIDplus::getPagePlugins() as $plugin) { |
||
293 | if (is_subclass_of($plugin, OIDplusPagePluginPublic::class)) { |
||
294 | $pp_public[] = $plugin; |
||
295 | } |
||
296 | if (is_subclass_of($plugin, OIDplusPagePluginRa::class)) { |
||
297 | $pp_ra[] = $plugin; |
||
298 | } |
||
299 | if (is_subclass_of($plugin, OIDplusPagePluginAdmin::class)) { |
||
300 | $pp_admin[] = $plugin; |
||
301 | } |
||
302 | } |
||
303 | |||
304 | if ($show_pages_public) { |
||
305 | if (count($plugins = $pp_public) > 0) { |
||
306 | $out['text'] .= '<h2>'._L('Public page plugins').'</h2>'; |
||
307 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
308 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 309 | $this->pluginTableHead($out); |
635 | daniel-mar | 310 | foreach ($plugins as $plugin) { |
828 | daniel-mar | 311 | $this->pluginTableLine($out, $plugin); |
635 | daniel-mar | 312 | } |
313 | $out['text'] .= '</table>'; |
||
314 | $out['text'] .= '</div></div>'; |
||
315 | } |
||
316 | } |
||
317 | |||
318 | if ($show_pages_ra) { |
||
319 | if (count($plugins = $pp_ra) > 0) { |
||
320 | $out['text'] .= '<h2>'._L('RA page plugins').'</h2>'; |
||
321 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
322 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 323 | $this->pluginTableHead($out); |
635 | daniel-mar | 324 | foreach ($plugins as $plugin) { |
828 | daniel-mar | 325 | $this->pluginTableLine($out, $plugin); |
635 | daniel-mar | 326 | } |
327 | $out['text'] .= '</table>'; |
||
328 | $out['text'] .= '</div></div>'; |
||
329 | } |
||
330 | } |
||
331 | |||
332 | if ($show_pages_admin) { |
||
333 | if (count($plugins = $pp_admin) > 0) { |
||
334 | $out['text'] .= '<h2>'._L('Admin page plugins').'</h2>'; |
||
335 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
336 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 337 | $this->pluginTableHead($out); |
635 | daniel-mar | 338 | foreach ($plugins as $plugin) { |
828 | daniel-mar | 339 | $this->pluginTableLine($out, $plugin); |
635 | daniel-mar | 340 | } |
341 | $out['text'] .= '</table>'; |
||
342 | $out['text'] .= '</div></div>'; |
||
343 | } |
||
344 | } |
||
345 | |||
346 | if ($show_obj_active || $show_obj_inactive) { |
||
347 | $enabled = $show_obj_active ? OIDplus::getObjectTypePluginsEnabled() : array(); |
||
348 | $disabled = $show_obj_inactive ? OIDplus::getObjectTypePluginsDisabled() : array(); |
||
349 | if (count($plugins = array_merge($enabled, $disabled)) > 0) { |
||
350 | $out['text'] .= '<h2>'._L('Object types').'</h2>'; |
||
351 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
352 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 353 | $this->pluginTableHead($out); |
635 | daniel-mar | 354 | foreach ($plugins as $plugin) { |
355 | if (in_array($plugin, $enabled)) { |
||
828 | daniel-mar | 356 | $this->pluginTableLine($out, $plugin, 0); |
635 | daniel-mar | 357 | } else { |
828 | daniel-mar | 358 | $this->pluginTableLine($out, $plugin, 2, _L('disabled')); |
635 | daniel-mar | 359 | } |
360 | } |
||
361 | $out['text'] .= '</table>'; |
||
362 | $out['text'] .= '</div></div>'; |
||
363 | } |
||
364 | } |
||
365 | |||
366 | if ($show_db_active || $show_db_inactive) { |
||
367 | if (count($plugins = OIDplus::getDatabasePlugins()) > 0) { |
||
368 | $out['text'] .= '<h2>'._L('Database providers').'</h2>'; |
||
369 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
370 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 371 | $this->pluginTableHead($out); |
635 | daniel-mar | 372 | foreach ($plugins as $plugin) { |
373 | $active = $plugin::id() == OIDplus::baseConfig()->getValue('DATABASE_PLUGIN'); |
||
374 | if ($active && !$show_db_active) continue; |
||
375 | if (!$active && !$show_db_inactive) continue; |
||
1048 | daniel-mar | 376 | $this->pluginTableLine($out, $plugin, $active?1:0, _L('active')); |
635 | daniel-mar | 377 | } |
378 | $out['text'] .= '</table>'; |
||
379 | $out['text'] .= '</div></div>'; |
||
380 | } |
||
381 | } |
||
382 | |||
383 | if ($show_sql_active || $show_sql_inactive) { |
||
384 | if (count($plugins = OIDplus::getSqlSlangPlugins()) > 0) { |
||
385 | $out['text'] .= '<h2>'._L('SQL slang plugins').'</h2>'; |
||
386 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
387 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 388 | $this->pluginTableHead($out); |
635 | daniel-mar | 389 | foreach ($plugins as $plugin) { |
390 | $active = $plugin::id() == OIDplus::db()->getSlang()->id(); |
||
391 | if ($active && !$show_sql_active) continue; |
||
392 | if (!$active && !$show_sql_inactive) continue; |
||
1048 | daniel-mar | 393 | $this->pluginTableLine($out, $plugin, $active?1:0, _L('active')); |
635 | daniel-mar | 394 | } |
395 | $out['text'] .= '</table>'; |
||
396 | $out['text'] .= '</div></div>'; |
||
397 | } |
||
398 | } |
||
399 | |||
400 | if ($show_auth) { |
||
401 | if (count($plugins = OIDplus::getAuthPlugins()) > 0) { |
||
402 | $out['text'] .= '<h2>'._L('RA authentication providers').'</h2>'; |
||
403 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
404 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 405 | $this->pluginTableHead($out); |
635 | daniel-mar | 406 | foreach ($plugins as $plugin) { |
1099 | daniel-mar | 407 | $default = OIDplus::getDefaultRaAuthPlugin(true)->getManifest()->getOid() === $plugin->getManifest()->getOid(); |
408 | |||
409 | $reason_hash = ''; |
||
410 | $can_hash = $plugin->availableForHash($reason_hash); |
||
411 | |||
412 | $reason_verify = ''; |
||
413 | $can_verify = $plugin->availableForHash($reason_verify); |
||
414 | |||
415 | if ($can_hash && !$can_verify) { |
||
416 | $note = _L('Only hashing, no verification'); |
||
1116 | daniel-mar | 417 | if (!empty($reason_verify)) $note .= '. '.$reason_verify; |
1099 | daniel-mar | 418 | $modifier = $default ? 1 : 0; |
1088 | daniel-mar | 419 | } |
1099 | daniel-mar | 420 | else if (!$can_hash && $can_verify) { |
421 | $note = _L('Only verification, no hashing'); |
||
1116 | daniel-mar | 422 | if (!empty($reason_hash)) $note .= '. '.$reason_hash; |
1099 | daniel-mar | 423 | $modifier = $default ? 1 : 0; |
424 | } |
||
425 | else if (!$can_hash && !$can_verify) { |
||
426 | $note = _L('Not available on this system'); |
||
427 | $app1 = ''; |
||
428 | $app2 = ''; |
||
1116 | daniel-mar | 429 | if (!empty($reason_verify)) $app1 = $reason_verify; |
430 | if (!empty($reason_hash)) $app2 = $reason_hash; |
||
1099 | daniel-mar | 431 | if ($app1 != $app2) { |
432 | $note .= '. '.$app1.'. '.$app2; |
||
433 | } else { |
||
434 | $note .= '. '.$app1; |
||
435 | } |
||
436 | $modifier = 2; |
||
437 | } |
||
438 | else /*if ($can_hash && $can_verify)*/ { |
||
439 | $modifier = $default ? 1 : 0; |
||
440 | $note = ''; |
||
441 | } |
||
442 | |||
443 | $this->pluginTableLine($out, $plugin, $modifier, htmlentities($note)); |
||
635 | daniel-mar | 444 | } |
445 | $out['text'] .= '</table>'; |
||
446 | $out['text'] .= '</div></div>'; |
||
447 | } |
||
448 | } |
||
449 | |||
450 | if ($show_logger) { |
||
451 | if (count($plugins = OIDplus::getLoggerPlugins()) > 0) { |
||
452 | $out['text'] .= '<h2>'._L('Logger plugins').'</h2>'; |
||
453 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
454 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 455 | $this->pluginTableHead($out); |
635 | daniel-mar | 456 | foreach ($plugins as $plugin) { |
457 | $reason = ''; |
||
828 | daniel-mar | 458 | if ($plugin->available($reason)) { |
459 | $this->pluginTableLine($out, $plugin, 0); |
||
1088 | daniel-mar | 460 | } else if ($reason) { |
461 | $this->pluginTableLine($out, $plugin, 2, _L('not available: %1',htmlentities($reason))); |
||
635 | daniel-mar | 462 | } else { |
1088 | daniel-mar | 463 | $this->pluginTableLine($out, $plugin, 2, _L('not available')); |
635 | daniel-mar | 464 | } |
465 | } |
||
466 | $out['text'] .= '</table>'; |
||
467 | $out['text'] .= '</div></div>'; |
||
468 | } |
||
469 | } |
||
470 | |||
471 | if ($show_language) { |
||
472 | if (count($plugins = OIDplus::getLanguagePlugins()) > 0) { |
||
473 | $out['text'] .= '<h2>'._L('Languages').'</h2>'; |
||
474 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
475 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 476 | $this->pluginTableHead($out); |
635 | daniel-mar | 477 | foreach ($plugins as $plugin) { |
1048 | daniel-mar | 478 | $default = OIDplus::getDefaultLang() === $plugin->getLanguageCode(); |
479 | $this->pluginTableLine($out, $plugin, $default?1:0, _L('default')); |
||
635 | daniel-mar | 480 | } |
481 | $out['text'] .= '</table>'; |
||
482 | $out['text'] .= '</div></div>'; |
||
483 | } |
||
484 | } |
||
485 | |||
486 | if ($show_design_active || $show_design_inactive) { |
||
487 | if (count($plugins = OIDplus::getDesignPlugins()) > 0) { |
||
488 | $out['text'] .= '<h2>'._L('Designs').'</h2>'; |
||
489 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
490 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 491 | $this->pluginTableHead($out); |
635 | daniel-mar | 492 | foreach ($plugins as $plugin) { |
493 | $active = OIDplus::config()->getValue('design') === basename($plugin->getPluginDirectory()); |
||
494 | if ($active && !$show_design_active) continue; |
||
495 | if (!$active && !$show_design_inactive) continue; |
||
1048 | daniel-mar | 496 | $this->pluginTableLine($out, $plugin, $active?1:0, _L('active')); |
635 | daniel-mar | 497 | } |
498 | $out['text'] .= '</table>'; |
||
499 | $out['text'] .= '</div></div>'; |
||
500 | } |
||
501 | } |
||
703 | daniel-mar | 502 | |
503 | if ($show_captcha_active || $show_captcha_inactive) { |
||
504 | if (count($plugins = OIDplus::getCaptchaPlugins()) > 0) { |
||
505 | $out['text'] .= '<h2>'._L('CAPTCHA plugins').'</h2>'; |
||
506 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
507 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
828 | daniel-mar | 508 | $this->pluginTableHead($out); |
703 | daniel-mar | 509 | foreach ($plugins as $plugin) { |
704 | daniel-mar | 510 | $captcha_plugin_name = OIDplus::getActiveCaptchaPluginId(); |
703 | daniel-mar | 511 | $active = $plugin::id() == $captcha_plugin_name; |
512 | if ($active && !$show_captcha_active) continue; |
||
513 | if (!$active && !$show_captcha_inactive) continue; |
||
1048 | daniel-mar | 514 | $this->pluginTableLine($out, $plugin, $active?1:0, _L('active')); |
703 | daniel-mar | 515 | } |
516 | $out['text'] .= '</table>'; |
||
517 | $out['text'] .= '</div></div>'; |
||
518 | } |
||
519 | } |
||
635 | daniel-mar | 520 | } |
521 | } |
||
522 | |||
1116 | daniel-mar | 523 | /** |
524 | * @param array $json |
||
525 | * @param string|null $ra_email |
||
526 | * @param bool $nonjs |
||
527 | * @param string $req_goto |
||
528 | * @return bool |
||
529 | * @throws OIDplusConfigInitializationException |
||
530 | * @throws OIDplusException |
||
531 | */ |
||
532 | public function tree(array &$json, string $ra_email=null, bool $nonjs=false, string $req_goto=''): bool { |
||
635 | daniel-mar | 533 | if (!OIDplus::authUtils()->isAdminLoggedIn()) return false; |
534 | |||
800 | daniel-mar | 535 | if (file_exists(__DIR__.'/img/main_icon16.png')) { |
801 | daniel-mar | 536 | $tree_icon = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon16.png'; |
635 | daniel-mar | 537 | } else { |
538 | $tree_icon = null; // default icon (folder) |
||
539 | } |
||
540 | |||
541 | $tree_icon_pages = $tree_icon; // TODO |
||
542 | $tree_icon_pages_public = $tree_icon; // TODO |
||
543 | $tree_icon_pages_ra = $tree_icon; // TODO |
||
544 | $tree_icon_pages_admin = $tree_icon; // TODO |
||
545 | $tree_icon_db_active = $tree_icon; // TODO |
||
546 | $tree_icon_db_inactive = $tree_icon; // TODO |
||
547 | $tree_icon_sql_active = $tree_icon; // TODO |
||
548 | $tree_icon_sql_inactive = $tree_icon; // TODO |
||
549 | $tree_icon_obj_active = $tree_icon; // TODO |
||
550 | $tree_icon_obj_inactive = $tree_icon; // TODO |
||
551 | $tree_icon_auth = $tree_icon; // TODO |
||
552 | $tree_icon_logger = $tree_icon; // TODO |
||
553 | $tree_icon_language = $tree_icon; // TODO |
||
554 | $tree_icon_design_active = $tree_icon; // TODO |
||
555 | $tree_icon_design_inactive = $tree_icon; // TODO |
||
703 | daniel-mar | 556 | $tree_icon_captcha_active = $tree_icon; // TODO |
557 | $tree_icon_captcha_inactive = $tree_icon; // TODO |
||
635 | daniel-mar | 558 | |
559 | $pp_public = array(); |
||
560 | $pp_ra = array(); |
||
561 | $pp_admin = array(); |
||
562 | |||
563 | foreach (OIDplus::getPagePlugins() as $plugin) { |
||
564 | if (is_subclass_of($plugin, OIDplusPagePluginPublic::class)) { |
||
565 | $pp_public[] = $plugin; |
||
566 | } |
||
567 | if (is_subclass_of($plugin, OIDplusPagePluginRa::class)) { |
||
568 | $pp_ra[] = $plugin; |
||
569 | } |
||
570 | if (is_subclass_of($plugin, OIDplusPagePluginAdmin::class)) { |
||
571 | $pp_admin[] = $plugin; |
||
572 | } |
||
573 | } |
||
574 | |||
575 | |||
576 | $public_plugins = array(); |
||
577 | foreach ($pp_public as $plugin) { |
||
578 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
579 | |||
580 | $public_plugins[] = array( |
||
581 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
582 | 'icon' => $tree_icon_pages_public, |
||
583 | 'text' => $txt, |
||
584 | ); |
||
585 | } |
||
586 | $ra_plugins = array(); |
||
587 | foreach ($pp_ra as $plugin) { |
||
588 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
589 | |||
590 | $ra_plugins[] = array( |
||
591 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
592 | 'icon' => $tree_icon_pages_ra, |
||
593 | 'text' => $txt, |
||
594 | ); |
||
595 | } |
||
596 | $admin_plugins = array(); |
||
597 | foreach ($pp_admin as $plugin) { |
||
598 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
599 | |||
600 | $admin_plugins[] = array( |
||
601 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
602 | 'icon' => $tree_icon_pages_admin, |
||
603 | 'text' => $txt, |
||
604 | ); |
||
605 | } |
||
606 | $db_plugins = array(); |
||
607 | foreach (OIDplus::getDatabasePlugins() as $plugin) { |
||
608 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
609 | |||
610 | if ($plugin::id() == OIDplus::baseConfig()->getValue('DATABASE_PLUGIN')) { |
||
611 | $db_plugins[] = array( |
||
612 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
613 | 'icon' => $tree_icon_db_active, |
||
614 | 'text' => $txt, |
||
615 | ); |
||
616 | } else { |
||
617 | $db_plugins[] = array( |
||
618 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
619 | 'icon' => $tree_icon_db_inactive, |
||
620 | 'text' => '<font color="gray">'.$txt.'</font>', |
||
621 | ); |
||
622 | } |
||
623 | } |
||
624 | $sql_plugins = array(); |
||
625 | foreach (OIDplus::getSqlSlangPlugins() as $plugin) { |
||
626 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
627 | |||
628 | if ($plugin::id() == OIDplus::db()->getSlang()->id()) { |
||
629 | $sql_plugins[] = array( |
||
630 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
703 | daniel-mar | 631 | 'icon' => $tree_icon_sql_active, |
635 | daniel-mar | 632 | 'text' => $txt, |
633 | ); |
||
634 | } else { |
||
635 | $sql_plugins[] = array( |
||
636 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
703 | daniel-mar | 637 | 'icon' => $tree_icon_sql_inactive, |
635 | daniel-mar | 638 | 'text' => '<font color="gray">'.$txt.'</font>', |
639 | ); |
||
640 | } |
||
641 | } |
||
642 | $obj_plugins = array(); |
||
643 | $enabled = OIDplus::getObjectTypePluginsEnabled(); |
||
644 | $disabled = OIDplus::getObjectTypePluginsDisabled(); |
||
645 | foreach (array_merge($enabled, $disabled) as $plugin) { |
||
646 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
647 | if (in_array($plugin, $enabled)) { |
||
648 | $obj_plugins[] = array( |
||
649 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
650 | 'icon' => $tree_icon_obj_active, |
||
651 | 'text' => $txt, |
||
652 | ); |
||
653 | } else { |
||
654 | $obj_plugins[] = array( |
||
655 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
656 | 'icon' => $tree_icon_obj_inactive, |
||
657 | 'text' => '<font color="gray">'.$txt.'</font>', |
||
658 | ); |
||
659 | } |
||
660 | } |
||
661 | $auth_plugins = array(); |
||
662 | foreach (OIDplus::getAuthPlugins() as $plugin) { |
||
663 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
664 | |||
1088 | daniel-mar | 665 | $reason = ''; |
1099 | daniel-mar | 666 | if (!$plugin->availableForHash($reason) && !$plugin->availableForVerify($reason)) $txt = '<font color="gray">'.$txt.'</font>'; |
1088 | daniel-mar | 667 | |
635 | daniel-mar | 668 | $auth_plugins[] = array( |
669 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
670 | 'icon' => $tree_icon_auth, |
||
671 | 'text' => $txt, |
||
672 | ); |
||
673 | } |
||
674 | $logger_plugins = array(); |
||
675 | foreach (OIDplus::getLoggerPlugins() as $plugin) { |
||
676 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
677 | |||
678 | $reason = ''; |
||
679 | if (!$plugin->available($reason)) $txt = '<font color="gray">'.$txt.'</font>'; |
||
680 | |||
681 | $logger_plugins[] = array( |
||
682 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
683 | 'icon' => $tree_icon_logger, |
||
684 | 'text' => $txt, |
||
685 | ); |
||
686 | } |
||
687 | $language_plugins = array(); |
||
688 | foreach (OIDplus::getLanguagePlugins() as $plugin) { |
||
689 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
690 | |||
691 | $language_plugins[] = array( |
||
692 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
693 | 'icon' => $tree_icon_language, |
||
694 | 'text' => $txt, |
||
695 | ); |
||
696 | } |
||
697 | $design_plugins = array(); |
||
698 | foreach (OIDplus::getDesignPlugins() as $plugin) { |
||
699 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
700 | |||
701 | $active = OIDplus::config()->getValue('design') === basename($plugin->getPluginDirectory()); |
||
702 | if ($active) { |
||
703 | $design_plugins[] = array( |
||
704 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
705 | 'icon' => $tree_icon_design_active, |
||
706 | 'text' => $txt, |
||
707 | ); |
||
708 | } else { |
||
709 | $design_plugins[] = array( |
||
710 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
711 | 'icon' => $tree_icon_design_inactive, |
||
712 | 'text' => '<font color="gray">'.$txt.'</font>', |
||
713 | ); |
||
714 | } |
||
715 | } |
||
703 | daniel-mar | 716 | $captcha_plugins = array(); |
717 | foreach (OIDplus::getCaptchaPlugins() as $plugin) { |
||
718 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
719 | |||
704 | daniel-mar | 720 | $captcha_plugin_name = OIDplus::getActiveCaptchaPluginId(); |
703 | daniel-mar | 721 | if ($plugin::id() == $captcha_plugin_name) { |
722 | $captcha_plugins[] = array( |
||
723 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
724 | 'icon' => $tree_icon_captcha_active, |
||
725 | 'text' => $txt, |
||
726 | ); |
||
727 | } else { |
||
728 | $captcha_plugins[] = array( |
||
729 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
730 | 'icon' => $tree_icon_captcha_inactive, |
||
731 | 'text' => '<font color="gray">'.$txt.'</font>', |
||
732 | ); |
||
733 | } |
||
734 | } |
||
635 | daniel-mar | 735 | $json[] = array( |
736 | 'id' => 'oidplus:system_plugins', |
||
737 | 'icon' => $tree_icon, |
||
738 | 'text' => _L('Plugins'), |
||
739 | 'children' => array( |
||
740 | array( |
||
741 | 'id' => 'oidplus:system_plugins.pages', |
||
742 | 'icon' => $tree_icon, |
||
743 | 'text' => _L('Page plugins'), |
||
744 | 'children' => array( |
||
745 | array( |
||
746 | 'id' => 'oidplus:system_plugins.pages.public', |
||
747 | 'icon' => $tree_icon, |
||
748 | 'text' => _L('Public'), |
||
749 | 'children' => $public_plugins |
||
750 | ), |
||
751 | array( |
||
752 | 'id' => 'oidplus:system_plugins.pages.ra', |
||
753 | 'icon' => $tree_icon, |
||
754 | 'text' => _L('RA'), |
||
755 | 'children' => $ra_plugins |
||
756 | ), |
||
757 | array( |
||
758 | 'id' => 'oidplus:system_plugins.pages.admin', |
||
759 | 'icon' => $tree_icon, |
||
760 | 'text' => _L('Admin'), |
||
761 | 'children' => $admin_plugins |
||
762 | ) |
||
763 | ) |
||
764 | ), |
||
765 | array( |
||
766 | 'id' => 'oidplus:system_plugins.objects', |
||
767 | 'icon' => $tree_icon, |
||
768 | 'text' => _L('Object types'), |
||
769 | 'children' => $obj_plugins |
||
770 | ), |
||
771 | array( |
||
772 | 'id' => 'oidplus:system_plugins.database', |
||
773 | 'icon' => $tree_icon, |
||
774 | 'text' => _L('Database providers'), |
||
775 | 'children' => $db_plugins |
||
776 | ), |
||
777 | array( |
||
778 | 'id' => 'oidplus:system_plugins.sql', |
||
779 | 'icon' => $tree_icon, |
||
780 | 'text' => _L('SQL slangs'), |
||
781 | 'children' => $sql_plugins |
||
782 | ), |
||
783 | array( |
||
784 | 'id' => 'oidplus:system_plugins.auth', |
||
785 | 'icon' => $tree_icon, |
||
786 | 'text' => _L('RA authentication'), |
||
787 | 'children' => $auth_plugins |
||
788 | ), |
||
789 | array( |
||
790 | 'id' => 'oidplus:system_plugins.logger', |
||
791 | 'icon' => $tree_icon, |
||
792 | 'text' => _L('Logger'), |
||
793 | 'children' => $logger_plugins |
||
794 | ), |
||
795 | array( |
||
796 | 'id' => 'oidplus:system_plugins.language', |
||
797 | 'icon' => $tree_icon, |
||
798 | 'text' => _L('Languages'), |
||
799 | 'children' => $language_plugins |
||
800 | ), |
||
801 | array( |
||
802 | 'id' => 'oidplus:system_plugins.design', |
||
803 | 'icon' => $tree_icon, |
||
804 | 'text' => _L('Designs'), |
||
805 | 'children' => $design_plugins |
||
703 | daniel-mar | 806 | ), |
807 | array( |
||
808 | 'id' => 'oidplus:system_plugins.captcha', |
||
809 | 'icon' => $tree_icon, |
||
810 | 'text' => _L('CAPTCHA plugins'), |
||
811 | 'children' => $captcha_plugins |
||
635 | daniel-mar | 812 | ) |
813 | ) |
||
814 | ); |
||
815 | |||
816 | return true; |
||
817 | } |
||
818 | |||
1116 | daniel-mar | 819 | /** |
820 | * @param string $request |
||
821 | * @return array|false |
||
822 | */ |
||
823 | public function tree_search(string $request) { |
||
635 | daniel-mar | 824 | // Not required, because all sub-nodes are loaded at the same time; no lazy-loading |
825 | return false; |
||
826 | } |
||
1048 | daniel-mar | 827 | } |