server_engines.lib.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * functions for displaying server engines
  5. *
  6. * @usedby server_engines.php
  7. *
  8. * @package PhpMyAdmin
  9. */
  10. if (! defined('PHPMYADMIN')) {
  11. exit;
  12. }
  13. /**
  14. * setup HTML for server Engines information
  15. *
  16. * @return string
  17. */
  18. function PMA_getHtmlForServerEngines()
  19. {
  20. /**
  21. * Did the user request information about a certain storage engine?
  22. */
  23. $html = '';
  24. if (empty($_REQUEST['engine'])
  25. || ! PMA_StorageEngine::isValid($_REQUEST['engine'])
  26. ) {
  27. $html .= PMA_getHtmlForAllServerEngines();
  28. } else {
  29. $html .= PMA_getHtmlForSpecifiedServerEngines();
  30. }
  31. return $html;
  32. }
  33. /**
  34. * setup HTML for server all Engines information
  35. *
  36. * @return string
  37. */
  38. function PMA_getHtmlForAllServerEngines()
  39. {
  40. /**
  41. * Displays the table header
  42. */
  43. $html = '<table class="noclick">' . "\n"
  44. . '<thead>' . "\n"
  45. . '<tr><th>' . __('Storage Engine') . '</th>' . "\n"
  46. . ' <th>' . __('Description') . '</th>' . "\n"
  47. . '</tr>' . "\n"
  48. . '</thead>' . "\n"
  49. . '<tbody>' . "\n";
  50. /**
  51. * Listing the storage engines
  52. */
  53. $odd_row = true;
  54. foreach (PMA_StorageEngine::getStorageEngines() as $engine => $details) {
  55. $html .= '<tr class="'
  56. . ($odd_row ? 'odd' : 'even')
  57. . ($details['Support'] == 'NO' || $details['Support'] == 'DISABLED'
  58. ? ' disabled' : '')
  59. . '">' . "\n"
  60. . ' <td><a rel="newpage" href="server_engines.php'
  61. . PMA_URL_getCommon(array('engine' => $engine)) . '">' . "\n"
  62. . ' ' . htmlspecialchars($details['Engine']) . "\n"
  63. . ' </a></td>' . "\n"
  64. . ' <td>' . htmlspecialchars($details['Comment']) . '</td>' . "\n"
  65. . '</tr>' . "\n";
  66. $odd_row = !$odd_row;
  67. }
  68. unset($odd_row, $engine, $details);
  69. $html .= '</tbody>' . "\n"
  70. . '</table>' . "\n";
  71. return $html;
  72. }
  73. /**
  74. * setup HTML for a given Storage Engine
  75. *
  76. * @return string
  77. */
  78. function PMA_getHtmlForSpecifiedServerEngines()
  79. {
  80. /**
  81. * Displays details about a given Storage Engine
  82. */
  83. $html = '';
  84. $engine_plugin = PMA_StorageEngine::getEngine($_REQUEST['engine']);
  85. $html .= '<h2>' . "\n"
  86. . PMA_Util::getImage('b_engine.png')
  87. . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n"
  88. . ' ' . PMA_Util::showMySQLDocu($engine_plugin->getMysqlHelpPage())
  89. . "\n" . '</h2>' . "\n\n";
  90. $html .= '<p>' . "\n"
  91. . ' <em>' . "\n"
  92. . ' ' . htmlspecialchars($engine_plugin->getComment()) . "\n"
  93. . ' </em>' . "\n"
  94. . '</p>' . "\n\n";
  95. $infoPages = $engine_plugin->getInfoPages();
  96. if (! empty($infoPages) && is_array($infoPages)) {
  97. $html .= '<p>' . "\n"
  98. . ' <strong>[</strong>' . "\n";
  99. if (empty($_REQUEST['page'])) {
  100. $html .= ' <strong>' . __('Variables') . '</strong>' . "\n";
  101. } else {
  102. $html .= ' <a href="server_engines.php'
  103. . PMA_URL_getCommon(array('engine' => $_REQUEST['engine']))
  104. . '">' . __('Variables') . '</a>' . "\n";
  105. }
  106. foreach ($infoPages as $current => $label) {
  107. $html .= ' <strong>|</strong>' . "\n";
  108. if (isset($_REQUEST['page']) && $_REQUEST['page'] == $current) {
  109. $html .= ' <strong>' . $label . '</strong>' . "\n";
  110. } else {
  111. $html .= ' <a href="server_engines.php'
  112. . PMA_URL_getCommon(
  113. array('engine' => $_REQUEST['engine'], 'page' => $current)
  114. )
  115. . '">' . htmlspecialchars($label) . '</a>' . "\n";
  116. }
  117. }
  118. unset($current, $label);
  119. $html .= ' <strong>]</strong>' . "\n"
  120. . '</p>' . "\n\n";
  121. }
  122. unset($infoPages, $page_output);
  123. if (! empty($_REQUEST['page'])) {
  124. $page_output = $engine_plugin->getPage($_REQUEST['page']);
  125. }
  126. if (! empty($page_output)) {
  127. $html .= $page_output;
  128. } else {
  129. $html .= '<p> ' . $engine_plugin->getSupportInformationMessage() . "\n"
  130. . '</p>' . "\n"
  131. . $engine_plugin->getHtmlVariables();
  132. }
  133. return $html;
  134. }
  135. ?>