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