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 / tbl_links.inc.php < prev    next >
Encoding:
PHP Script  |  2008-06-23  |  4.3 KB  |  144 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  *
  5.  * @version $Id: tbl_links.inc.php 11326 2008-06-17 21:32:48Z lem9 $
  6.  */
  7. if (! defined('PHPMYADMIN')) {
  8.     exit;
  9. }
  10.  
  11. /**
  12.  * Check parameters
  13.  */
  14. require_once './libraries/common.inc.php';
  15.  
  16. PMA_checkParameters(array('db', 'table'));
  17.  
  18. /**
  19.  * Prepares links
  20.  */
  21. require_once './libraries/bookmark.lib.php';
  22.  
  23.  
  24. /**
  25.  * Set parameters for links
  26.  */
  27. if (empty($url_query)
  28. || (isset($_POST['table']) && isset($_POST['new_name']) && $_POST['table'] != $_POST['new_name'])) {
  29.     $url_query = PMA_generate_common_url($db, $table);
  30. }
  31. $url_params['db']    = $db;
  32. $url_params['table'] = $table;
  33.  
  34. /**
  35.  * Defines the urls to return to in case of error in a sql statement
  36.  */
  37. $err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url(array('db' => $db,));
  38. $err_url   = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params);
  39.  
  40. /**
  41.  * Displays headers
  42.  */
  43. $js_to_run = 'functions.js';
  44. require_once './libraries/header.inc.php';
  45.  
  46. /**
  47.  * Displays links
  48.  */
  49. $tabs = array();
  50.  
  51. $tabs['browse']['icon'] = 'b_browse.png';
  52. $tabs['browse']['text'] = $strBrowse;
  53. $tabs['browse']['link'] = 'sql.php';
  54. $tabs['browse']['args']['pos'] = 0;
  55.  
  56. $tabs['structure']['icon'] = 'b_props.png';
  57. $tabs['structure']['link'] = 'tbl_structure.php';
  58. $tabs['structure']['text'] = $strStructure;
  59.  
  60. $tabs['sql']['icon'] = 'b_sql.png';
  61. $tabs['sql']['link'] = 'tbl_sql.php';
  62. $tabs['sql']['text'] = $strSQL;
  63.  
  64. $tabs['search']['icon'] = 'b_search.png';
  65. $tabs['search']['text'] = $strSearch;
  66. $tabs['search']['link'] = 'tbl_select.php';
  67.  
  68. if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
  69.     $tabs['insert']['icon'] = 'b_insrow.png';
  70.     $tabs['insert']['link'] = 'tbl_change.php';
  71.     $tabs['insert']['text'] = $strInsert;
  72. }
  73.  
  74. $tabs['export']['icon'] = 'b_tblexport.png';
  75. $tabs['export']['link'] = 'tbl_export.php';
  76. $tabs['export']['args']['single_table'] = 'true';
  77. $tabs['export']['text'] = $strExport;
  78.  
  79. /**
  80.  * Don't display "Import", "Operations" and "Empty"
  81.  * for views and information_schema
  82.  */
  83. if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
  84.     $tabs['import']['icon'] = 'b_tblimport.png';
  85.     $tabs['import']['link'] = 'tbl_import.php';
  86.     $tabs['import']['text'] = $strImport;
  87.  
  88.     $tabs['operation']['icon'] = 'b_tblops.png';
  89.     $tabs['operation']['link'] = 'tbl_operations.php';
  90.     $tabs['operation']['text'] = $strOperations;
  91.  
  92.     $ln8_stt = (PMA_MYSQL_INT_VERSION >= 40000)
  93.              ? 'TRUNCATE TABLE '
  94.              : 'DELETE FROM ';
  95.     $tabs['empty']['link']  = 'sql.php';
  96.     $tabs['empty']['args']['reload']    = 1;
  97.     $tabs['empty']['args']['sql_query'] = $ln8_stt . PMA_backquote($table);
  98.     $tabs['empty']['args']['zero_rows'] = sprintf($strTableHasBeenEmptied, htmlspecialchars($table));
  99.     $tabs['empty']['attr']  = 'onclick="return confirmLink(this, \'' . $ln8_stt . PMA_jsFormat($table) . '\')"';
  100.     $tabs['empty']['args']['goto'] = 'tbl_structure.php';
  101.     $tabs['empty']['class'] = 'caution';
  102.     $tabs['empty']['icon'] = 'b_empty.png';
  103.     $tabs['empty']['text'] = $strEmpty;
  104.     if ($table_info_num_rows == 0) {
  105.         $tabs['empty']['warning'] = $strTableIsEmpty;
  106.     }
  107. }
  108.  
  109. /**
  110.  * no drop in information_schema
  111.  */
  112. if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
  113.     $tabs['drop']['icon'] = 'b_deltbl.png';
  114.     $tabs['drop']['link'] = 'sql.php';
  115.     $tabs['drop']['text'] = $strDrop;
  116.     $tabs['drop']['args']['reload']     = 1;
  117.     $tabs['drop']['args']['purge']      = 1;
  118.     $drop_command = 'DROP ' . ($tbl_is_view ? 'VIEW' : 'TABLE');
  119.     $tabs['drop']['args']['sql_query']  = $drop_command . ' ' . PMA_backquote($table);
  120.     $tabs['drop']['args']['goto']       = 'db_structure.php';
  121.     $tabs['drop']['args']['zero_rows']  = sprintf(($tbl_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped), htmlspecialchars($table));
  122.     $tabs['drop']['attr'] = 'onclick="return confirmLink(this, \'' . $drop_command . ' ' . PMA_jsFormat($table) . '\')"';
  123.     unset($drop_command);
  124.     $tabs['drop']['class'] = 'caution';
  125. }
  126.  
  127. if ($table_info_num_rows == 0 && !$tbl_is_view) {
  128.     $tabs['browse']['warning'] = $strTableIsEmpty;
  129.     $tabs['search']['warning'] = $strTableIsEmpty;
  130. }
  131.  
  132. echo PMA_getTabs($tabs);
  133. unset($tabs);
  134.  
  135. /**
  136.  * Displays a message
  137.  */
  138. if (!empty($message)) {
  139.     PMA_showMessage($message);
  140.     unset($message);
  141. }
  142.  
  143. ?><br />
  144.