home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 February (DVD) / PCWorld_2008-02_DVD.iso / v cisle / PHP / PHP.exe / xampp-win32-1.6.5-installer.exe / phpMyAdmin / libraries / tbl_links.inc.php < prev    next >
Encoding:
PHP Script  |  2007-12-20  |  4.2 KB  |  140 lines

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