Subversion Repositories oidplus

Rev

Rev 1206 | Rev 1211 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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