Subversion Repositories oidplus

Rev

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