home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / phpMyAdmin / tbl_move_copy.php < prev    next >
PHP Script  |  2008-06-23  |  2KB  |  83 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  *
  5.  * @version $Id: tbl_move_copy.php 11027 2007-12-30 20:59:57Z lem9 $
  6.  */
  7.  
  8. /**
  9.  * Gets some core libraries
  10.  */
  11. require_once './libraries/common.inc.php';
  12. require_once './libraries/Table.class.php';
  13.  
  14. // Check parameters
  15.  
  16. PMA_checkParameters(array('db', 'table'));
  17.  
  18. /**
  19.  * Defines the url to return to in case of error in a sql statement
  20.  */
  21. $err_url = 'tbl_sql.php?' . PMA_generate_common_url($db, $table);
  22.  
  23.  
  24. /**
  25.  * Selects the database to work with
  26.  */
  27. PMA_DBI_select_db($db);
  28.  
  29. /** 
  30.  * $target_db could be empty in case we came from an input field 
  31.  * (when there are many databases, no drop-down)
  32.  */
  33. if (empty($target_db)) {
  34.     $target_db = $db;
  35. }
  36.  
  37. /**
  38.  * A target table name has been sent to this script -> do the work
  39.  */
  40. if (isset($new_name) && trim($new_name) != '') {
  41.     if ($db == $target_db && $table == $new_name) {
  42.         $message   = (isset($submit_move) ? $strMoveTableSameNames : $strCopyTableSameNames);
  43.     } else {
  44.         PMA_Table::moveCopy($db, $table, $target_db, $new_name, $what, isset($submit_move), 'one_table');
  45.         $js_to_run = 'functions.js';
  46.         $message   = (isset($submit_move) ? $strMoveTableOK : $strCopyTableOK);
  47.         $message   = sprintf($message, htmlspecialchars($table), htmlspecialchars($new_name));
  48.         $reload    = 1;
  49.         /* Check: Work on new table or on old table? */
  50.         if (isset($submit_move)) {
  51.             $db        = $target_db;
  52.             $table     = $new_name;
  53.         } else {
  54.             $pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
  55.             if (isset($switch_to_new) && $switch_to_new == 'true') {
  56.                 PMA_setCookie('pma_switch_to_new', 'true');
  57.                 $db        = $target_db;
  58.                 $table     = $new_name;
  59.             } else {
  60.                 PMA_removeCookie('pma_switch_to_new');
  61.             }
  62.         }
  63.     }
  64.     require_once './libraries/header.inc.php';
  65. } // end is target table name
  66.  
  67.  
  68. /**
  69.  * No new name for the table!
  70.  */
  71. else {
  72.     require_once './libraries/header.inc.php';
  73.     PMA_mysqlDie($strTableEmpty, '', '', $err_url);
  74. }
  75.  
  76.  
  77. /**
  78.  * Back to the calling script
  79.  */
  80.  
  81. require './tbl_sql.php';
  82. ?>
  83.