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_row_action.php < prev    next >
PHP Script  |  2008-06-23  |  4KB  |  151 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  *
  5.  * @version $Id: tbl_row_action.php 10398 2007-05-15 11:16:10Z cybot_tm $
  6.  */
  7.  
  8. /**
  9.  *
  10.  */
  11. require_once './libraries/common.inc.php';
  12. require_once './libraries/mysql_charsets.lib.php';
  13.  
  14. /**
  15.  * No rows were selected => show again the query and tell that user.
  16.  */
  17. if ((!isset($rows_to_delete) || !is_array($rows_to_delete)) && !isset($mult_btn)) {
  18.     $disp_message = $strNoRowsSelected;
  19.     $disp_query = '';
  20.     require './sql.php';
  21.     require_once './libraries/footer.inc.php';
  22. }
  23.  
  24. /**
  25.  * Drop multiple rows if required
  26.  */
  27.  
  28. // workaround for IE problem:
  29. if (isset($submit_mult_delete_x)) {
  30.     $submit_mult = 'row_delete';
  31. } elseif (isset($submit_mult_change_x)) {
  32.     $submit_mult = 'row_edit';
  33. } elseif (isset($submit_mult_export_x)) {
  34.     $submit_mult = 'row_export';
  35. }
  36.  
  37. // garvin: If the 'Ask for confirmation' button was pressed, this can only come from 'delete' mode,
  38. // so we set it straight away.
  39. if (isset($mult_btn)) {
  40.     $submit_mult = 'row_delete';
  41. }
  42.  
  43. switch($submit_mult) {
  44.     case 'row_delete':
  45.     case 'row_edit':
  46.     case 'row_export':
  47.         // leave as is
  48.         break;
  49.  
  50.     case $GLOBALS['strExport']:
  51.         $submit_mult = 'row_export';
  52.         break;
  53.  
  54.     case $GLOBALS['strDelete']:
  55.     case $GLOBALS['strKill']:
  56.         $submit_mult = 'row_delete';
  57.         break;
  58.  
  59.     default:
  60.     case $GLOBALS['strEdit']:
  61.         $submit_mult = 'row_edit';
  62.         break;
  63. }
  64.  
  65. if ($submit_mult == 'row_edit') {
  66.     $js_to_run = 'tbl_change.js';
  67. }
  68.  
  69. if ($submit_mult == 'row_delete' || $submit_mult == 'row_export') {
  70.     $js_to_run = 'functions.js';
  71. }
  72.  
  73. require_once './libraries/header.inc.php';
  74.  
  75. if (!empty($submit_mult)) {
  76.     switch($submit_mult) {
  77.         case 'row_edit':
  78.             $primary_key = array();
  79.             // garvin: As we got the fields to be edited from the 'rows_to_delete' checkbox, we use the index of it as the
  80.             // indicating primary key. Then we built the array which is used for the tbl_change.php script.
  81.             foreach ($rows_to_delete AS $i_primary_key => $del_query) {
  82.                 $primary_key[] = urldecode($i_primary_key);
  83.             }
  84.  
  85.             $active_page = 'tbl_change.php';
  86.             include './tbl_change.php';
  87.             break;
  88.  
  89.         case 'row_export':
  90.             // Needed to allow SQL export
  91.             $single_table = TRUE;
  92.  
  93.             $primary_key = array();
  94.             //$sql_query = urldecode($sql_query);
  95.             // garvin: As we got the fields to be edited from the 'rows_to_delete' checkbox, we use the index of it as the
  96.             // indicating primary key. Then we built the array which is used for the tbl_change.php script.
  97.             foreach ($rows_to_delete AS $i_primary_key => $del_query) {
  98.                 $primary_key[] = urldecode($i_primary_key);
  99.             }
  100.  
  101.             $active_page = 'tbl_export.php';
  102.             include './tbl_export.php';
  103.             break;
  104.  
  105.         case 'row_delete':
  106.         default:
  107.             $action = 'tbl_row_action.php';
  108.             $err_url = 'tbl_row_action.php?' . PMA_generate_common_url($db, $table);
  109.             if (! isset($mult_btn)) {
  110.                 $original_sql_query = $sql_query;
  111.                 $original_url_query = $url_query;
  112.             }
  113.             require './libraries/mult_submits.inc.php';
  114.             $url_query = PMA_generate_common_url($db, $table)
  115.                        . '&goto=tbl_sql.php';
  116.  
  117.  
  118.             /**
  119.              * Show result of multi submit operation
  120.              */
  121.             // sql_query is not set when user does not confirm multi-delete
  122.             if ((!empty($submit_mult) || isset($mult_btn)) && ! empty($sql_query)) {
  123.                 $disp_message = $strSuccess;
  124.                 $disp_query = $sql_query;
  125.             }
  126.  
  127.             if (isset($original_sql_query)) {
  128.                 $sql_query = $original_sql_query;
  129.             }
  130.  
  131.             if (isset($original_url_query)) {
  132.                 $url_query = $original_url_query;
  133.             }
  134.  
  135.             // this is because sql.php could call tbl_structure
  136.             // which would think it needs to call mult_submits.inc.php:
  137.             unset($submit_mult);
  138.             unset($mult_btn);
  139.  
  140.             $active_page = 'sql.php';
  141.             require './sql.php';
  142.  
  143.             /**
  144.              * Displays the footer
  145.              */
  146.             require_once './libraries/footer.inc.php';
  147.         break;
  148.     }
  149. }
  150. ?>
  151.