Documentation TYPO3 par Ameos

server_engines.php

00001 <?php
00002 /* $Id: server_engines.php,v 2.8 2005/03/05 21:34:23 rabus Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 
00009 require('./server_common.inc.php');
00010 require('./libraries/storage_engines.lib.php');
00011 
00012 
00016 require('./server_links.inc.php');
00017 
00018 
00032 define('PMA_ENGINE_DETAILS_TYPE_PLAINTEXT', 0);
00033 define('PMA_ENGINE_DETAILS_TYPE_SIZE',      1);
00034 define('PMA_ENGINE_DETAILS_TYPE_NUMERIC',   2); //Has no effect yet...
00035 define('PMA_ENGINE_DETAILS_TYPE_BOOLEAN',   3); // 'ON' or 'OFF'
00036 function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) {
00037     global $cfg;
00038 
00039     $spaces = '';
00040     for ($i = 0; $i < $indent; $i++) {
00041         $spaces .= '    ';
00042     }
00043 
00047     if (!empty($variables)) {
00048         $sql_query = 'SHOW '
00049                    . (PMA_MYSQL_INT_VERSION >= 40102 ? 'GLOBAL ' : '')
00050                    . 'VARIABLES'
00051                    . (empty($like) ? '' : ' LIKE \'' . $like . '\'')
00052                    . ';';
00053         $res = PMA_DBI_query($sql_query);
00054         $mysql_vars = array();
00055         while ($row = PMA_DBI_fetch_row($res)) {
00056             if (isset($variables[$row[0]])) $mysql_vars[$row[0]] = $row[1];
00057         }
00058         PMA_DBI_free_result($res);
00059         unset($res, $row, $sql_query);
00060     }
00061 
00062     if (empty($mysql_vars)) return $spaces . '<p>' . "\n"
00063                                  . $spaces . '    ' . $GLOBALS['strNoDetailsForEngine'] . "\n"
00064                                  . $spaces . '</p>' . "\n";
00065 
00066     $dt_table          = $spaces . '<table>' . "\n";
00067     $useBgcolorOne     = TRUE;
00068     $has_content       = FALSE;
00069 
00070     foreach ($variables as $var => $details) {
00071         if (!isset($mysql_vars[$var])) continue;
00072 
00073         if (!isset($details['type'])) $details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
00074         $is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC;
00075 
00076         $bgcolor = $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
00077 
00078         $dt_table     .= $spaces . '    <tr>' . "\n"
00079                        . $spaces . '        <td bgcolor="' . $bgcolor . '">' . "\n";
00080         if (!empty($variables[$var]['desc'])) {
00081             $dt_table .= $spaces . '            ' . PMA_showHint($details['desc']) . "\n";
00082         }
00083         $dt_table     .= $spaces . '        </td>' . "\n"
00084                        . $spaces . '        <td bgcolor="' . $bgcolor . '">' . "\n"
00085                        . $spaces . '            &nbsp;' . $details['title'] . '&nbsp;' . "\n"
00086                        . $spaces . '        </td>' . "\n"
00087                        . $spaces . '        <td bgcolor="' . $bgcolor . '"' . ($is_num ? ' align="right"' : '') . '>' . "\n"
00088                        . $spaces . '            &nbsp;';
00089         switch ($details['type']) {
00090             case PMA_ENGINE_DETAILS_TYPE_SIZE:
00091                 $parsed_size = PMA_formatByteDown($mysql_vars[$var]);
00092                 $dt_table .= $parsed_size[0] . '&nbsp;' . $parsed_size[1];
00093                 unset($parsed_size);
00094             break;
00095             default:
00096                 $dt_table .= htmlspecialchars($mysql_vars[$var]);
00097         }
00098         $dt_table     .= '&nbsp;' . "\n"
00099                       . $spaces . '        </td>' . "\n"
00100                       . $spaces . '    </tr>' . "\n";
00101         $useBgcolorOne = !$useBgcolorOne;
00102         $has_content   = TRUE;
00103     }
00104 
00105     if (!$has_content) return '';
00106 
00107     return $dt_table;
00108 }
00109 
00110 
00114 if (empty($engine) || empty($mysql_storage_engines[$engine])) {
00115 
00119     echo '<h2>' . "\n"
00120        . ($cfg['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 'b_engine.png" width="16" height="16" border="0" hspace="2" align="middle" />' : '' )
00121        . '    ' . $strStorageEngines . "\n"
00122        . '</h2>' . "\n";
00123 
00124 
00128     echo '<table>' . "\n"
00129        . '    <thead>' . "\n"
00130        . '        <tr>' . "\n"
00131        . '            <th>' . "\n"
00132        . '                ' . $strStorageEngine . "\n"
00133        . '            </th>' . "\n";
00134     if (PMA_MYSQL_INT_VERSION >= 40102) {
00135         echo '            <th>' . "\n"
00136            . '                ' . $strDescription . "\n"
00137            . '            </th>' . "\n";
00138     }
00139     echo '        </tr>' . "\n"
00140        . '    </thead>' . "\n"
00141        . '    <tbody>' . "\n";
00142 
00143 
00147     $useBgcolorOne = TRUE;
00148     $common_url = './server_engines.php?' . PMA_generate_common_url() . '&amp;engine=';
00149     foreach ($mysql_storage_engines as $engine => $details) {
00150         echo '        <tr' . ($details['Support'] == 'NO' || $details['Support'] == 'DISABLED' ? ' class="disabled"' : '') . '>' . "\n"
00151            . '            <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n"
00152            . '                <a href="' . $common_url . $engine . '">' . "\n"
00153            . '                    ' . htmlspecialchars($details['Engine']) . "\n"
00154            . '                </a>' . "\n"
00155            . '            </td>' . "\n";
00156         if (PMA_MYSQL_INT_VERSION >= 40102) {
00157             echo '            <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n"
00158                . '                ' . htmlspecialchars($details['Comment']) . "\n"
00159                . '            </td>' . "\n";
00160         }
00161         echo '        </tr>' . "\n";
00162         $useBgcolorOne = !$useBgcolorOne;
00163     }
00164     unset($useBgcolorOne, $common_url, $engine, $details);
00165     echo '    </tbody>' . "\n"
00166        . '</table>' . "\n";
00167 
00168 } else {
00169 
00174     $engine_plugin = PMA_StorageEngine::getEngine($engine);
00175     echo '<h2>' . "\n"
00176        . ($cfg['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 'b_engine.png" width="16" height="16" border="0" hspace="2" align="middle" />' : '' )
00177        . '    ' . htmlspecialchars($engine_plugin->getTitle()) . "\n"
00178        . '</h2>' . "\n\n";
00179     if (PMA_MYSQL_INT_VERSION >= 40102) {
00180         echo '<p>' . "\n"
00181            . '    <i>' . "\n"
00182            . '        ' . htmlspecialchars($engine_plugin->getComment()) . "\n"
00183            . '    </i>' . "\n"
00184            . '</p>' . "\n\n";
00185     }
00186     $infoPages = $engine_plugin->getInfoPages();
00187     if (!empty($infoPages) && is_array($infoPages)) {
00188         $common_url = './server_engines.php?' . PMA_generate_common_url() . '&amp;engine=' . urlencode($engine);
00189         echo '<p>' . "\n"
00190            . '    <b>[</b>' . "\n";
00191         if (empty($page)) {
00192             echo '    <b>' . $strServerTabVariables . '</b>' . "\n";
00193         } else {
00194             echo '    <a href="' . $common_url . '">' . $strServerTabVariables . '</a>' . "\n";
00195         }
00196         foreach ($infoPages as $current => $label) {
00197             echo '    <b>|</b>' . "\n";
00198             if (isset($page) && $page == $current) {
00199                 echo '    <b>' . $label . '</b>' . "\n";
00200             } else {
00201                 echo '    <a href="' . $common_url . '&amp;page=' . urlencode($current) . '">' . $label . '</a>' . "\n";
00202             }
00203         }
00204         unset($current, $label);
00205         echo '    <b>]</b>' . "\n"
00206            . '</p>' . "\n\n";
00207     }
00208     unset($infoPages, $page_output);
00209         if (!empty($page)) {
00210         $page_output = $engine_plugin->getPage($page);
00211     }
00212     if (!empty($page_output)) {
00213         echo $page_output;
00214     } else {
00215         echo '<p>' . "\n"
00216            . '    ' . $engine_plugin->getSupportInformationMessage() . "\n"
00217            . '</p>' . "\n"
00218            . PMA_generateEngineDetails($engine_plugin->getVariables(), $engine_plugin->getVariablesLikePattern());
00219     }
00220 }
00221 
00225 require_once('./footer.inc.php');
00226 
00227 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6