ServerEnginesController.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Holds the PhpMyAdmin\Controllers\Server\ServerEnginesController
  5. *
  6. * @package PhpMyAdmin\Controllers
  7. */
  8. namespace PhpMyAdmin\Controllers\Server;
  9. use PhpMyAdmin\Controllers\Controller;
  10. use PhpMyAdmin\Server\Common;
  11. use PhpMyAdmin\StorageEngine;
  12. use PhpMyAdmin\Template;
  13. use PhpMyAdmin\Util;
  14. /**
  15. * Handles viewing storage engine details
  16. *
  17. * @package PhpMyAdmin\Controllers
  18. */
  19. class ServerEnginesController extends Controller
  20. {
  21. /**
  22. * Index action
  23. *
  24. * @return void
  25. */
  26. public function indexAction()
  27. {
  28. /**
  29. * Does the common work
  30. */
  31. require 'libraries/server_common.inc.php';
  32. /**
  33. * Displays the sub-page heading
  34. */
  35. $this->response->addHTML(
  36. Template::get('server/sub_page_header')->render([
  37. 'type' => 'engines',
  38. ])
  39. );
  40. /**
  41. * Did the user request information about a certain storage engine?
  42. */
  43. if (empty($_REQUEST['engine'])
  44. || ! StorageEngine::isValid($_REQUEST['engine'])
  45. ) {
  46. $this->response->addHTML($this->_getHtmlForAllServerEngines());
  47. } else {
  48. $engine = StorageEngine::getEngine($_REQUEST['engine']);
  49. $this->response->addHTML($this->_getHtmlForServerEngine($engine));
  50. }
  51. }
  52. /**
  53. * Return HTML with all Storage Engine information
  54. *
  55. * @return string
  56. */
  57. private function _getHtmlForAllServerEngines()
  58. {
  59. return Template::get('server/engines/engines')->render(
  60. array('engines' => StorageEngine::getStorageEngines())
  61. );
  62. }
  63. /**
  64. * Return HTML for a given Storage Engine
  65. *
  66. * @param StorageEngine $engine storage engine
  67. *
  68. * @return string
  69. */
  70. private function _getHtmlForServerEngine(StorageEngine $engine)
  71. {
  72. $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '';
  73. $pageOutput = ! empty($page) ? $engine->getPage($page) : '';
  74. /**
  75. * Displays details about a given Storage Engine
  76. */
  77. return Template::get('server/engines/engine')->render(
  78. array(
  79. 'title' => $engine->getTitle(),
  80. 'help_page' => $engine->getMysqlHelpPage(),
  81. 'comment' => $engine->getComment(),
  82. 'info_pages' => $engine->getInfoPages(),
  83. 'support' => $engine->getSupportInformationMessage(),
  84. 'variables' => $engine->getHtmlVariables(),
  85. 'page_output' => $pageOutput,
  86. 'page' => $page,
  87. 'engine' => $_REQUEST['engine'],
  88. )
  89. );
  90. }
  91. }