Move common code into a function
[phpmyadmin/ammaryasirr.git] / server_engines.php
blob4eb53122862ddbd24d9d13382f51b227d2d67c3b
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * display list of server engines and additonal information about them
6 * @package phpMyAdmin
7 */
9 /**
10 * no need for variables importing
11 * @ignore
13 if (! defined('PMA_NO_VARIABLES_IMPORT')) {
14 define('PMA_NO_VARIABLES_IMPORT', true);
17 /**
18 * requirements
20 require_once './libraries/common.inc.php';
22 /**
23 * Does the common work
25 require './libraries/server_common.inc.php';
26 require './libraries/StorageEngine.class.php';
29 /**
30 * Displays the links
32 require './libraries/server_links.inc.php';
34 /**
35 * Did the user request information about a certain storage engine?
37 if (empty($_REQUEST['engine'])
38 || ! PMA_StorageEngine::isValid($_REQUEST['engine'])) {
40 /**
41 * Displays the sub-page heading
43 echo '<h2>' . "\n"
44 . ($GLOBALS['cfg']['MainPageIconic']
45 ? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"'
46 .' width="16" height="16" alt="" />' : '')
47 . "\n" . __('Storage Engines') . "\n"
48 . '</h2>' . "\n";
51 /**
52 * Displays the table header
54 echo '<table>' . "\n"
55 . '<thead>' . "\n"
56 . '<tr><th>' . __('Storage Engine') . '</th>' . "\n"
57 . ' <th>' . __('Description') . '</th>' . "\n"
58 . '</tr>' . "\n"
59 . '</thead>' . "\n"
60 . '<tbody>' . "\n";
63 /**
64 * Listing the storage engines
66 $odd_row = true;
67 foreach (PMA_StorageEngine::getStorageEngines() as $engine => $details) {
68 echo '<tr class="noclick '
69 . ($odd_row ? 'odd' : 'even')
70 . ($details['Support'] == 'NO' || $details['Support'] == 'DISABLED'
71 ? ' disabled'
72 : '')
73 . '">' . "\n"
74 . ' <td><a href="./server_engines.php'
75 . PMA_generate_common_url(array('engine' => $engine)) . '">' . "\n"
76 . ' ' . htmlspecialchars($details['Engine']) . "\n"
77 . ' </a></td>' . "\n"
78 . ' <td>' . htmlspecialchars($details['Comment']) . '</td>' . "\n"
79 . '</tr>' . "\n";
80 $odd_row = !$odd_row;
83 $PMA_Config = $GLOBALS['PMA_Config'];
84 if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST')) {
85 // Special case for PBMS daemon which is not listed as an engine
86 echo '<tr class="noclick '
87 . ($odd_row ? 'odd' : 'even')
88 . '">' . "\n"
89 . ' <td><a href="./server_engines.php'
90 . PMA_generate_common_url(array('engine' => "PBMS")) . '">' . "\n"
91 . ' ' . "PBMS\n"
92 . ' </a></td>' . "\n"
93 . ' <td>' . htmlspecialchars("PrimeBase MediaStream (PBMS) daemon") . '</td>' . "\n"
94 . '</tr>' . "\n";
97 unset($odd_row, $engine, $details);
98 echo '</tbody>' . "\n"
99 . '</table>' . "\n";
101 } else {
104 * Displays details about a given Storage Engine
107 $engine_plugin = PMA_StorageEngine::getEngine($_REQUEST['engine']);
108 echo '<h2>' . "\n"
109 . ($GLOBALS['cfg']['MainPageIconic']
110 ? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"'
111 .' width="16" height="16" alt="" />' : '')
112 . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n"
113 . ' ' . PMA_showMySQLDocu('', $engine_plugin->getMysqlHelpPage()) . "\n"
114 . '</h2>' . "\n\n";
115 echo '<p>' . "\n"
116 . ' <em>' . "\n"
117 . ' ' . htmlspecialchars($engine_plugin->getComment()) . "\n"
118 . ' </em>' . "\n"
119 . '</p>' . "\n\n";
120 $infoPages = $engine_plugin->getInfoPages();
121 if (!empty($infoPages) && is_array($infoPages)) {
122 echo '<p>' . "\n"
123 . ' <strong>[</strong>' . "\n";
124 if (empty($_REQUEST['page'])) {
125 echo ' <strong>' . __('Variables') . '</strong>' . "\n";
126 } else {
127 echo ' <a href="./server_engines.php'
128 . PMA_generate_common_url(array('engine' => $_REQUEST['engine'])) . '">'
129 . __('Variables') . '</a>' . "\n";
131 foreach ($infoPages as $current => $label) {
132 echo ' <strong>|</strong>' . "\n";
133 if (isset($_REQUEST['page']) && $_REQUEST['page'] == $current) {
134 echo ' <strong>' . $label . '</strong>' . "\n";
135 } else {
136 echo ' <a href="./server_engines.php'
137 . PMA_generate_common_url(
138 array('engine' => $_REQUEST['engine'], 'page' => $current))
139 . '">' . htmlspecialchars($label) . '</a>' . "\n";
142 unset($current, $label);
143 echo ' <strong>]</strong>' . "\n"
144 . '</p>' . "\n\n";
146 unset($infoPages, $page_output);
147 if (!empty($_REQUEST['page'])) {
148 $page_output = $engine_plugin->getPage($_REQUEST['page']);
150 if (!empty($page_output)) {
151 echo $page_output;
152 } else {
153 echo '<p> ' . $engine_plugin->getSupportInformationMessage() . "\n"
154 . '</p>' . "\n"
155 . $engine_plugin->getHtmlVariables();
160 * Sends the footer
162 require './libraries/footer.inc.php';