server_plugins.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. *
  5. * @package PhpMyAdmin
  6. */
  7. /**
  8. * requirements
  9. */
  10. require_once 'libraries/common.inc.php';
  11. /**
  12. * JS includes
  13. */
  14. $response = PMA_Response::getInstance();
  15. $header = $response->getHeader();
  16. $scripts = $header->getScripts();
  17. $scripts->addFile('jquery/jquery.tablesorter.js');
  18. $scripts->addFile('server_plugins.js');
  19. /**
  20. * Does the common work
  21. */
  22. require 'libraries/server_common.inc.php';
  23. /**
  24. * Displays the sub-page heading
  25. */
  26. echo '<h2>' . "\n"
  27. . PMA_Util::getImage('b_engine.png')
  28. . "\n" . __('Plugins') . "\n"
  29. . '</h2>' . "\n";
  30. /**
  31. * Prepare plugin list
  32. */
  33. $sql = "SELECT p.plugin_name, p.plugin_type, p.is_active, m.module_name, m.module_library,
  34. m.module_version, m.module_author, m.module_description, m.module_license
  35. FROM data_dictionary.plugins p
  36. JOIN data_dictionary.modules m USING (module_name)
  37. ORDER BY m.module_name, p.plugin_type, p.plugin_name";
  38. $res = PMA_DBI_query($sql);
  39. $plugins = array();
  40. $modules = array();
  41. while ($row = PMA_DBI_fetch_assoc($res)) {
  42. $plugins[$row['plugin_type']][] = $row;
  43. $modules[$row['module_name']]['info'] = $row;
  44. $modules[$row['module_name']]['plugins'][$row['plugin_type']][] = $row;
  45. }
  46. PMA_DBI_free_result($res);
  47. // sort plugin list (modules are already sorted)
  48. ksort($plugins);
  49. /**
  50. * Displays the page
  51. */
  52. ?>
  53. <script type="text/javascript">
  54. pma_theme_image = '<?php echo $GLOBALS['pmaThemeImage']; ?>';
  55. </script>
  56. <div id="pluginsTabs">
  57. <ul>
  58. <li><a href="#plugins_plugins"><?php echo __('Plugins'); ?></a></li>
  59. <li><a href="#plugins_modules"><?php echo __('Modules'); ?></a></li>
  60. </ul>
  61. <div id="plugins_plugins">
  62. <div id="sectionlinks">
  63. <?php
  64. foreach ($plugins as $plugin_type => $plugin_list) {
  65. $key = 'plugins-' . preg_replace('/[^a-z]/', '', strtolower($plugin_type));
  66. echo '<a href="#' . $key . '">' . htmlspecialchars($plugin_type) . '</a>' . "\n";
  67. }
  68. ?>
  69. </div>
  70. <br />
  71. <?php
  72. foreach ($plugins as $plugin_type => $plugin_list) {
  73. $key = 'plugins-' . preg_replace('/[^a-z]/', '', strtolower($plugin_type));
  74. sort($plugin_list);
  75. ?>
  76. <table class="data_full_width" id="<?php echo $key; ?>">
  77. <caption class="tblHeaders">
  78. <a class="top" href="#serverinfo"><?php
  79. echo __('Begin');
  80. echo PMA_Util::getImage('s_asc.png');
  81. ?></a>
  82. <?php echo htmlspecialchars($plugin_type); ?>
  83. </caption>
  84. <thead>
  85. <tr>
  86. <th><?php echo __('Plugin'); ?></th>
  87. <th><?php echo __('Module'); ?></th>
  88. <th><?php echo __('Library'); ?></th>
  89. <th><?php echo __('Version'); ?></th>
  90. <th><?php echo __('Author'); ?></th>
  91. <th><?php echo __('License'); ?></th>
  92. </tr>
  93. </thead>
  94. <tbody>
  95. <?php
  96. $odd_row = false;
  97. foreach ($plugin_list as $plugin) {
  98. $odd_row = !$odd_row;
  99. ?>
  100. <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
  101. <th><?php echo htmlspecialchars($plugin['plugin_name']); ?></th>
  102. <td><?php echo htmlspecialchars($plugin['module_name']); ?></td>
  103. <td><?php echo htmlspecialchars($plugin['module_library']); ?></td>
  104. <td><?php echo htmlspecialchars($plugin['module_version']); ?></td>
  105. <td><?php echo htmlspecialchars($plugin['module_author']); ?></td>
  106. <td><?php echo htmlspecialchars($plugin['module_license']); ?></td>
  107. </tr>
  108. <?php
  109. }
  110. ?>
  111. </tbody>
  112. </table>
  113. <?php
  114. }
  115. ?>
  116. </div>
  117. <div id="plugins_modules">
  118. <table class="data_full_width">
  119. <thead>
  120. <tr>
  121. <th><?php echo __('Module'); ?></th>
  122. <th><?php echo __('Description'); ?></th>
  123. <th><?php echo __('Library'); ?></th>
  124. <th><?php echo __('Version'); ?></th>
  125. <th><?php echo __('Author'); ?></th>
  126. <th><?php echo __('License'); ?></th>
  127. </tr>
  128. </thead>
  129. <tbody>
  130. <?php
  131. $odd_row = false;
  132. foreach ($modules as $module_name => $module) {
  133. $odd_row = !$odd_row;
  134. ?>
  135. <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
  136. <th rowspan="2"><?php echo htmlspecialchars($module_name); ?></th>
  137. <td><?php echo htmlspecialchars($module['info']['module_description']); ?></td>
  138. <td><?php echo htmlspecialchars($module['info']['module_library']); ?></td>
  139. <td><?php echo htmlspecialchars($module['info']['module_version']); ?></td>
  140. <td><?php echo htmlspecialchars($module['info']['module_author']); ?></td>
  141. <td><?php echo htmlspecialchars($module['info']['module_license']); ?></td>
  142. </tr>
  143. <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
  144. <td colspan="5">
  145. <table>
  146. <tbody>
  147. <?php
  148. foreach ($module['plugins'] as $plugin_type => $plugin_list) {
  149. ?>
  150. <tr class="noclick">
  151. <td><b class="plugin-type"><?php echo htmlspecialchars($plugin_type); ?></b></td>
  152. <td>
  153. <?php
  154. for ($i = 0; $i < count($plugin_list); $i++) {
  155. echo ($i != 0 ? '<br />' : '') . htmlspecialchars($plugin_list[$i]['plugin_name']);
  156. if (!$plugin_list[$i]['is_active']) {
  157. echo ' <small class="attention">' . __('disabled') . '</small>';
  158. }
  159. }
  160. ?>
  161. </td>
  162. </tr>
  163. <?php
  164. }
  165. ?>
  166. </tbody>
  167. </table>
  168. </td>
  169. </tr>
  170. <?php
  171. }
  172. ?>
  173. </tbody>
  174. </table>
  175. </div>
  176. </div>