home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / phpMyAdmin / libraries / db_links.inc.php < prev    next >
Encoding:
PHP Script  |  2008-06-23  |  4.0 KB  |  143 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  *
  5.  * @version $Id: db_links.inc.php 11326 2008-06-17 21:32:48Z lem9 $
  6.  */
  7. if (! defined('PHPMYADMIN')) {
  8.     exit;
  9. }
  10.  
  11. /**
  12.  *
  13.  */
  14. require_once './libraries/common.inc.php';
  15.  
  16. require_once './libraries/relation.lib.php';
  17. /**
  18.  * Gets the relation settings
  19.  */
  20. $cfgRelation = PMA_getRelationsParam();
  21.  
  22. /**
  23.  * If coming from a Show MySQL link on the home page,
  24.  * put something in $sub_part
  25.  */
  26. if (empty($sub_part)) {
  27.     $sub_part = '_structure';
  28. }
  29.  
  30. /**
  31.  * Checks for superuser privileges
  32.  */
  33. $is_superuser = PMA_isSuperuser();
  34.  
  35. /**
  36.  * Prepares links
  37.  */
  38. // Drop link if allowed
  39. // rabus: Don't even try to drop information_schema. You won't be able to. Believe me. You won't.
  40. // nijel: Don't allow to easilly drop mysql database, RFE #1327514.
  41. if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_information_schema && ($db != 'mysql')) {
  42.     $tab_drop['link'] = 'sql.php';
  43.     $tab_drop['args']['sql_query']  = 'DROP DATABASE ' . PMA_backquote($db);
  44.     $tab_drop['args']['zero_rows']  = sprintf($GLOBALS['strDatabaseHasBeenDropped'], htmlspecialchars(PMA_backquote($db)));
  45.     $tab_drop['args']['goto']       = 'main.php';
  46.     $tab_drop['args']['back']       = 'db' . $sub_part . '.php';
  47.     $tab_drop['args']['reload']     = 1;
  48.     $tab_drop['args']['purge']      = 1;
  49.     $tab_drop['attr'] = 'onclick="return confirmLinkDropDB(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"';
  50. }
  51.  
  52. /**
  53.  * export, search and qbe links if there is at least one table
  54.  */
  55. if ($num_tables == 0) {
  56.     $tab_qbe['warning'] = $strDbIsEmpty;
  57.     $tab_search['warning'] = $strDbIsEmpty;
  58.     $tab_export['warning'] = $strDbIsEmpty;
  59. }
  60.  
  61. $tab_structure['link']  = 'db_structure.php';
  62. $tab_structure['text']  = $GLOBALS['strStructure'];
  63. $tab_structure['icon']  = 'b_props.png';
  64.  
  65. $tab_sql['link']        = 'db_sql.php';
  66. $tab_sql['args']['db_query_force'] = 1;
  67. $tab_sql['text']        = $GLOBALS['strSQL'];
  68. $tab_sql['icon']        = 'b_sql.png';
  69.  
  70. $tab_export['text']     = $GLOBALS['strExport'];
  71. $tab_export['icon']     = 'b_export.png';
  72. $tab_export['link']     = 'db_export.php';
  73.  
  74. $tab_search['text']     = $GLOBALS['strSearch'];
  75. $tab_search['icon']     = 'b_search.png';
  76. $tab_search['link']     = 'db_search.php';
  77.  
  78. $tab_qbe['text']        = $GLOBALS['strQBE'];
  79. $tab_qbe['icon']        = 's_db.png';
  80. $tab_qbe['link']        = 'db_qbe.php';
  81.  
  82. if ($cfgRelation['designerwork']) {
  83.     $tab_designer['text']   = $GLOBALS['strDesigner'];
  84.     $tab_designer['icon']   = 'b_relations.png';
  85.     $tab_designer['link']   = 'pmd_general.php';
  86. }
  87.  
  88. if (! $db_is_information_schema) {
  89.     $tab_import['link']     = 'db_import.php';
  90.     $tab_import['text']     = $GLOBALS['strImport'];
  91.     $tab_import['icon']     = 'b_import.png';
  92.     $tab_drop['text']       = $GLOBALS['strDrop'];
  93.     $tab_drop['icon']       = 'b_deltbl.png';
  94.     $tab_drop['class']      = 'caution';
  95.     $tab_operation['link']  = 'db_operations.php';
  96.     $tab_operation['text']  = $GLOBALS['strOperations'];
  97.     $tab_operation['icon']  = 'b_tblops.png';
  98.     if ($is_superuser) {
  99.         $tab_privileges['link'] = 'server_privileges.php';
  100.         $tab_privileges['args']['checkprivs']       = $db;
  101.         // stay on database view
  102.         $tab_privileges['args']['viewing_mode'] = 'db';
  103.         $tab_privileges['text'] = $GLOBALS['strPrivileges'];
  104.         $tab_privileges['icon'] = 's_rights.png';
  105.     }
  106. }
  107.  
  108. /**
  109.  * Displays tab links
  110.  */
  111. $tabs = array();
  112. $tabs[] =& $tab_structure;
  113. $tabs[] =& $tab_sql;
  114. $tabs[] =& $tab_search;
  115. $tabs[] =& $tab_qbe;
  116. $tabs[] =& $tab_export;
  117. if (! $db_is_information_schema) {
  118.     $tabs[] =& $tab_import;
  119.     if ($cfgRelation['designerwork']) {
  120.         $tabs[] =& $tab_designer;
  121.     }
  122.     $tabs[] =& $tab_operation;
  123.     if ($is_superuser) {
  124.         $tabs[] =& $tab_privileges;
  125.     }
  126.     if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
  127.         $tabs[] =& $tab_drop;
  128.     }
  129. }
  130.  
  131. echo PMA_getTabs($tabs);
  132. unset($tabs);
  133.  
  134. /**
  135.  * Displays a message
  136.  */
  137. if (!empty($message)) {
  138.     PMA_showMessage($message);
  139.     unset($message);
  140. }
  141. ?>
  142. <br />
  143.