[ Index ]
 

Code source de phpMyAdmin 2.10.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> main.php (source)

   1  <?php
   2  /* $Id: main.php 9991 2007-02-14 21:18:38Z lem9 $ */
   3  // vim: expandtab sw=4 ts=4 sts=4:
   4  
   5  /**
   6   * Don't display the page heading
   7   */
   8  if (!defined('PMA_DISPLAY_HEADING')) {
   9      define('PMA_DISPLAY_HEADING', 0);
  10  }
  11  
  12  /**
  13   * Gets some core libraries and displays a top message if required
  14   */
  15  require_once  './libraries/common.lib.php';
  16  
  17  // Handles some variables that may have been sent by the calling script
  18  if (isset($db)) {
  19      unset($db);
  20  }
  21  if (isset($table)) {
  22      unset($table);
  23  }
  24  $show_query = '1';
  25  require_once  './libraries/header.inc.php';
  26  
  27  // Any message to display?
  28  if (! empty($message)) {
  29      PMA_showMessage($message);
  30      unset($message);
  31  }
  32  
  33  $common_url_query =  PMA_generate_common_url('', '');
  34  
  35  // this div is required for containing divs can be 50%
  36  echo '<div id="maincontainer">' . "\n";
  37  
  38  /**
  39   * Displays the mysql server related links
  40   */
  41  if ($server > 0) {
  42  
  43      require_once  './libraries/check_user_privileges.lib.php';
  44      // why this? a non-priv user should be able to change his
  45      // password if the configuration permits
  46      //$cfg['ShowChgPassword'] = $is_superuser = PMA_isSuperuser();
  47      $is_superuser = PMA_isSuperuser();
  48  
  49      if ($cfg['Server']['auth_type'] == 'config') {
  50          $cfg['ShowChgPassword'] = false;
  51      }
  52  }
  53  ?>
  54  
  55      <div id="mysqlmaininformation">
  56  <?php
  57  if ($server > 0) {
  58      // robbat2: Use the verbose name of the server instead of the hostname
  59      //          if a value is set
  60      $server_info = '';
  61      if (!empty($cfg['Server']['verbose'])) {
  62          $server_info .= htmlspecialchars($cfg['Server']['verbose']);
  63          if ($GLOBALS['cfg']['ShowServerInfo']) {
  64              $server_info .= ' (';
  65          }
  66      }
  67      if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
  68          $server_info .= PMA_DBI_get_host_info();
  69      }
  70  
  71      if (!empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
  72          $server_info .= ')';
  73      }
  74      // loic1: skip this because it's not a so good idea to display sockets
  75      //        used to everybody
  76      // if (!empty($cfg['Server']['socket']) && PMA_PHP_INT_VERSION >= 30010) {
  77      //     $server_info .= ':' . $cfg['Server']['socket'];
  78      // }
  79      $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
  80  
  81  
  82      // should we add the port info here?
  83      $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
  84                          ? $GLOBALS['cfg']['Server']['verbose']
  85                          : $GLOBALS['cfg']['Server']['host']);
  86      echo '<h1 xml:lang="en" dir="ltr">' . $short_server_info .'</h1>' . "\n";
  87      unset($short_server_info);
  88  } else {
  89      // Case when no server selected
  90      //echo '<h1 xml:lang="en" dir="ltr">MySQL</h1>' . "\n";
  91  }
  92  
  93  if ($server > 0) {
  94      echo '<ul>' . "\n";
  95  
  96      if ($GLOBALS['cfg']['ShowServerInfo']) {
  97          PMA_printListItem($strServerVersion . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_info');
  98          PMA_printListItem($strProtocolVersion . ': ' . PMA_DBI_get_proto_info(),
  99              'li_mysql_proto');
 100          PMA_printListItem($strServer . ': ' . $server_info, 'li_server_info');
 101          PMA_printListItem($strUser . ': ' . htmlspecialchars($mysql_cur_user_and_host),
 102              'li_user_info');
 103      } else {
 104          PMA_printListItem($strServerVersion . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_info');
 105          PMA_printListItem($strServer . ': ' . $server_info, 'li_server_info');
 106      }
 107  
 108      if ($cfg['AllowAnywhereRecoding'] && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
 109          echo '<li id="li_select_mysql_charset">';
 110          ?>
 111              <form method="post" action="index.php" target="_parent">
 112              <input type="hidden" name="server" value="<?php echo $server; ?>" />
 113              <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
 114              <?php echo $strMySQLCharset;?>:
 115              <select name="convcharset"  xml:lang="en" dir="ltr"
 116                  onchange="this.form.submit();">
 117          <?php
 118          foreach ($cfg['AvailableCharsets'] as $tmpcharset) {
 119              if ($convcharset == $tmpcharset) {
 120                  $selected = ' selected="selected"';
 121              } else {
 122                  $selected = '';
 123              }
 124              echo '            '
 125                 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
 126          }
 127          ?>
 128              </select>
 129              <noscript><input type="submit" value="<?php echo $strGo;?>" /></noscript>
 130              </form>
 131          </li>
 132          <?php
 133      } elseif (PMA_MYSQL_INT_VERSION >= 40100) {
 134          echo '    <li id="li_select_mysql_charset">';
 135          echo '        ' . $strMySQLCharset . ': '
 136             . '        <strong xml:lang="en" dir="ltr">'
 137             . '           ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
 138             . '           (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
 139             . '        </strong>' . "\n"
 140             . '    </li>' . "\n"
 141             . '    <li id="li_select_mysql_collation">';
 142          echo '        <form method="post" action="index.php" target="_parent">' . "\n"
 143             . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
 144             . '            <label for="select_collation_connection">' . "\n"
 145             . '                ' . $strMySQLConnectionCollation . ': ' . "\n"
 146             . '            </label>' . "\n"
 147             . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
 148             . '            <noscript><input type="submit" value="' . $strGo . '" /></noscript>' . "\n"
 149             // put the doc link in the form so that it appears on the same line
 150             . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . "\n"
 151             . '        </form>' . "\n"
 152             . '    </li>' . "\n";
 153      }
 154  
 155      if ($cfg['ShowCreateDb']) {
 156          echo '<li id="li_create_database">';
 157          require  './libraries/display_create_database.lib.php';
 158          echo '</li>' . "\n";
 159      }
 160  
 161      PMA_printListItem($strMySQLShowStatus, 'li_mysql_status',
 162          './server_status.php?' . $common_url_query);
 163      PMA_printListItem($strMySQLShowVars, 'li_mysql_variables',
 164          './server_variables.php?' . $common_url_query, 'show-variables');
 165      PMA_printListItem($strProcesses, 'li_mysql_processes',
 166          './server_processlist.php?' . $common_url_query, 'show-processlist');
 167  
 168      if (PMA_MYSQL_INT_VERSION >= 40100) {
 169          PMA_printListItem($strCharsetsAndCollations, 'li_mysql_collations',
 170              './server_collations.php?' . $common_url_query);
 171      }
 172  
 173      PMA_printListItem($strStorageEngines, 'li_mysql_engines',
 174          './server_engines.php?' . $common_url_query);
 175  
 176      if ($is_reload_priv) {
 177          PMA_printListItem($strReloadPrivileges, 'li_flush_privileges',
 178              './server_privileges.php?flush_privileges=1&amp;' . $common_url_query, 'flush');
 179      }
 180  
 181      if ($is_superuser) {
 182          PMA_printListItem($strPrivileges, 'li_mysql_privilegs',
 183              './server_privileges.php?' . $common_url_query);
 184      }
 185  
 186      $binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', null, PMA_DBI_QUERY_STORE);
 187      if ($binlogs) {
 188          if (PMA_DBI_num_rows($binlogs) > 0) {
 189              PMA_printListItem($strBinaryLog, 'li_mysql_binlogs',
 190                  './server_binlog.php?' . $common_url_query);
 191          }
 192          PMA_DBI_free_result($binlogs);
 193      }
 194      unset($binlogs);
 195  
 196      PMA_printListItem($strDatabases, 'li_mysql_databases',
 197          './server_databases.php?' . $common_url_query);
 198      PMA_printListItem($strExport, 'li_export',
 199          './server_export.php?' . $common_url_query);
 200      PMA_printListItem($strImport, 'li_import',
 201          './server_import.php?' . $common_url_query);
 202  
 203      /**
 204       * Change password
 205       *
 206       * @todo ? needs another message
 207       */
 208      if ($cfg['ShowChgPassword']) {
 209          PMA_printListItem($strChangePassword, 'li_change_password',
 210              './user_password.php?' . $common_url_query);
 211      } // end if
 212  
 213      // Logout for advanced authentication
 214      if ($cfg['Server']['auth_type'] != 'config') {
 215          $http_logout = ($cfg['Server']['auth_type'] == 'http')
 216                       ? '<a href="./Documentation.html#login_bug" target="documentation">'
 217                          . ($cfg['ReplaceHelpImg'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" alt="Info" />' : '(*)') . '</a>'
 218                       : '';
 219          PMA_printListItem('<strong>' . $strLogout . '</strong> ' . $http_logout,
 220              'li_log_out',
 221              './index.php?' . $common_url_query . '&amp;old_usr=' . urlencode($PHP_AUTH_USER), null, '_parent');
 222      } // end if
 223  
 224      echo '</ul>';
 225  } // end of if ($server > 0)
 226  ?>
 227  </div>
 228  <div id="pmamaininformation">
 229  <?php
 230  
 231  echo '<h1 xml:lang="en" dir="ltr">phpMyAdmin - ' . PMA_VERSION . '</h1>'
 232      . "\n";
 233  
 234  echo '<ul>' . "\n";
 235  
 236  /**
 237   * Displays the MySQL servers choice form
 238   */
 239  if (!$cfg['LeftDisplayServers'] && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
 240      echo '<li id="li_select_server">';
 241      require_once  './libraries/select_server.lib.php';
 242      PMA_select_server(true, true);
 243      echo '</li>';
 244  }
 245  
 246  if ($server > 0) {
 247      PMA_printListItem($strMysqlClientVersion . ': ' . PMA_DBI_get_client_info(),
 248          'li_mysql_client_version');
 249      PMA_printListItem($strUsedPhpExtensions . ': ' . $GLOBALS['cfg']['Server']['extension'],
 250          'li_used_php_extension');
 251  }
 252  
 253  // Displays language selection combo
 254  if (empty($cfg['Lang'])) {
 255      echo '<li id="li_select_lang">';
 256      require_once  './libraries/display_select_lang.lib.php';
 257      PMA_select_language();
 258      echo '</li>';
 259  }
 260  
 261  
 262  if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
 263    && $server != 0 && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
 264      echo '<li id="li_select_charset">';
 265      ?>
 266      <form method="post" action="index.php" target="_parent">
 267      <input type="hidden" name="server" value="<?php echo $server; ?>" />
 268      <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
 269      <?php echo $strMySQLCharset;?>:
 270      <select name="convcharset"  xml:lang="en" dir="ltr"
 271          onchange="this.form.submit();">
 272      <?php
 273      foreach ($cfg['AvailableCharsets'] AS $id => $tmpcharset) {
 274          if ($convcharset == $tmpcharset) {
 275              $selected = ' selected="selected"';
 276          } else {
 277              $selected = '';
 278          }
 279          echo '        '
 280             . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
 281      }
 282      ?>
 283      </select>
 284      <noscript><input type="submit" value="<?php echo $strGo;?>" /></noscript>
 285      </form>
 286      </li>
 287      <?php
 288  }
 289  
 290  // added by Michael Keck <mail_at_michaelkeck_dot_de>
 291  // ThemeManager if available
 292  
 293  if ($GLOBALS['cfg']['ThemeManager']) {
 294      echo '<li id="li_select_theme">';
 295      echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
 296      echo '</li>';
 297  }
 298  echo '<li id="li_select_fontsize">';
 299  echo PMA_Config::getFontsizeForm();
 300  echo '</li>';
 301  PMA_printListItem($strPmaDocumentation, 'li_pma_docs', 'Documentation.html', null, '_blank');
 302  PMA_printListItem($strPmaWiki, 'li_pma_docs', 'http://wiki.cihar.com', null, '_blank');
 303  
 304  if ($cfg['ShowPhpInfo']) {
 305      PMA_printListItem($strShowPHPInfo, 'li_phpinfo', './phpinfo.php?' . $common_url_query);
 306  }
 307  
 308  // does not work if no target specified, don't know why
 309  PMA_printListItem($strHomepageOfficial, 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank');
 310  ?>
 311      <li><bdo xml:lang="en" dir="ltr">
 312          [<a href="changelog.php" target="_blank">ChangeLog</a>]
 313          [<a href="http://svn.sourceforge.net/viewvc/phpmyadmin/"
 314              target="_blank">Subversion</a>]
 315          [<a href="http://sourceforge.net/mail/?group_id=23067"
 316              target="_blank">Lists</a>]
 317          </bdo>
 318      </li>
 319      </ul>
 320  </div>
 321  <?php
 322  /**
 323   * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
 324   * full height of the inner divs
 325   */
 326  ?>
 327  <br class="clearfloat" />
 328  <br class="clearfloat" />
 329  </div>
 330  
 331  <?php
 332  if (! empty($GLOBALS['PMA_errors']) && is_array($GLOBALS['PMA_errors'])) {
 333      foreach ($GLOBALS['PMA_errors'] as $error) {
 334          echo '<div class="error">' . $error . '</div>' . "\n";
 335      }
 336  }
 337  
 338  /**
 339   * Removed the "empty $cfg['PmaAbsoluteUri']" warning on 2005-08-23
 340   * See https://sourceforge.net/tracker/index.php?func=detail&aid=1257134&group_id=23067&atid=377411
 341   */
 342  
 343  /**
 344   * Warning if using the default MySQL privileged account
 345   * modified: 2004-05-05 mkkeck
 346   */
 347  if ($server != 0
 348      && $cfg['Server']['user'] == 'root'
 349      && $cfg['Server']['password'] == '') {
 350      echo '<div class="warning">' . $strInsecureMySQL . '</div>' . "\n";
 351  }
 352  
 353  /**
 354   * Warning for PHP 4.2.3
 355   * modified: 2004-05-05 mkkeck
 356   */
 357  
 358  if (PMA_PHP_INT_VERSION == 40203 && @extension_loaded('mbstring')) {
 359      echo '<div class="warning">' . $strPHP40203 . '</div>' . "\n";
 360  }
 361  
 362  /**
 363   * Nijel: As we try to hadle charsets by ourself, mbstring overloads just
 364   * break it, see bug 1063821.
 365   */
 366  
 367  if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
 368      echo '<div class="warning">' . $strMbOverloadWarning . '</div>' . "\n";
 369  }
 370  
 371  /**
 372   * Nijel: mbstring is used for handling multibyte inside parser, so it is good
 373   * to tell user something might be broken without it, see bug #1063149.
 374   */
 375  if ($GLOBALS['using_mb_charset'] && !@extension_loaded('mbstring')) {
 376      echo '<div class="warning">' . $strMbExtensionMissing . '</div>' . "\n";
 377  }
 378  
 379  /**
 380   * Warning for old PHP version
 381   * modified: 2004-05-05 mkkeck
 382   */
 383  
 384  if (PMA_PHP_INT_VERSION < 40100) {
 385      echo '<div class="warning">' . sprintf($strUpgrade, 'PHP', '4.1.0') . '</div>' . "\n";
 386  }
 387  
 388  /**
 389   * Warning for old MySQL version
 390   * modified: 2004-05-05 mkkeck
 391   */
 392  // not yet defined before the server choice
 393  if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION < 32332) {
 394      echo '<div class="warning">' . sprintf($strUpgrade, 'MySQL', '3.23.32') . '</div>' . "\n";
 395  }
 396  
 397  if (defined('PMA_WARN_FOR_MCRYPT')) {
 398      echo '<div class="warning">' . PMA_sanitize(sprintf($strCantLoad, 'mcrypt')) . '</div>' . "\n";
 399  }
 400  
 401  /**
 402   * prints list item for main page
 403   *
 404   * @param   string  $name   displayed text
 405   * @param   string  $id     id, used for css styles
 406   * @param   string  $url    make item as link with $url as target
 407   * @param   string  $mysql_help_page  display a link to MySQL's manual
 408   * @param   string  $target special target for $url
 409   */
 410  function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
 411  {
 412      echo '<li id="' . $id . '">';
 413      if (null !== $url) {
 414          echo '<a href="' . $url . '"';
 415          if (null !== $target) {
 416             echo ' target="' . $target . '"';
 417          }
 418          echo '>';
 419      }
 420  
 421      echo $name;
 422  
 423      if (null !== $url) {
 424          echo '</a>' . "\n";
 425      }
 426      if (null !== $mysql_help_page) {
 427          echo PMA_showMySQLDocu('', $mysql_help_page);
 428      }
 429      echo '</li>';
 430  }
 431  
 432  /**
 433   * Displays the footer
 434   */
 435  require_once  './libraries/footer.inc.php';
 436  ?>


Généré le : Mon Nov 26 15:18:20 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics