home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / tbl_row_delete.php < prev    next >
Encoding:
PHP Script  |  2004-02-24  |  3.2 KB  |  102 lines

  1. <?php
  2. /* $Id: tbl_row_delete.php,v 2.4.4.3 2004/02/24 19:49:27 lem9 Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4. require_once('./libraries/grab_globals.lib.php');
  5. require_once('./libraries/common.lib.php');
  6. require_once('./libraries/mysql_charsets.lib.php');
  7.  
  8. /**
  9.  * Drop multiple rows if required
  10.  */
  11.  
  12. // workaround for IE problem:
  13. if (isset($submit_mult_x)) {
  14.     $submit_mult = 'row_delete';
  15. } elseif (isset($submit_mult_edit_x)) {
  16.     $submit_mult = 'row_edit';
  17. }
  18.  
  19. // garvin: If the 'Ask for confirmation' button was pressed, this can only come from 'delete' mode,
  20. // so we set it straight away.
  21. if (isset($mult_btn)) {
  22.     $submit_mult = 'row_delete';
  23. }
  24.  
  25. if ($submit_mult == 'row_edit') {
  26.     $js_to_run = 'tbl_change.js';
  27. }
  28.  
  29. if ($submit_mult == 'row_delete') {
  30.     $js_to_run = 'functions.js';
  31. }
  32.  
  33. require_once('./header.inc.php');
  34.  
  35. if (!empty($submit_mult)) {
  36.     switch($submit_mult) {
  37.         case 'row_edit':
  38.             if (isset($rows_to_delete) && is_array($rows_to_delete)) {
  39.                 $primary_key = array();
  40.                 // garvin: As we got the fields to be edited from the 'rows_to_delete' checkbox, we use the index of it as the
  41.                 // indicating primary key. Then we built the array which is used for the tbl_change.php script.
  42.                 foreach($rows_to_delete AS $i_primary_key => $del_query) {
  43.                     $primary_key[] = urldecode($i_primary_key);
  44.                 }
  45.                 
  46.                 include './tbl_change.php';
  47.             }
  48.             break;
  49.         
  50.         case 'row_delete':
  51.         default:
  52.             if ((isset($rows_to_delete) && is_array($rows_to_delete))
  53.                 || isset($mult_btn)) {
  54.                 $action = 'tbl_row_delete.php';
  55.                 $err_url = 'tbl_row_delete.php?' . PMA_generate_common_url($db, $table);
  56.                 if (!isset($mult_btn)) {
  57.                     $original_sql_query = $sql_query;
  58.                     $original_url_query = $url_query;
  59.                     $original_pos       = $pos;
  60.                 }
  61.                 require('./mult_submits.inc.php');
  62.             }
  63.             $url_query = PMA_generate_common_url($db, $table)
  64.                        . '&goto=tbl_properties.php';
  65.             
  66.             
  67.             /**
  68.              * Show result of multi submit operation
  69.              */
  70.             if ((!empty($submit_mult) && isset($rows_to_delete))
  71.                 || isset($mult_btn)) {
  72.                 PMA_showMessage($strSuccess);
  73.             }
  74.             
  75.             if (isset($original_sql_query)) {
  76.                 $sql_query = $original_sql_query;
  77.             }
  78.             
  79.             if (isset($original_url_query)) {
  80.                 $url_query = $original_url_query;
  81.             }
  82.             
  83.             if (isset($original_pos)) {
  84.                 $pos       = $original_pos;
  85.             }
  86.             
  87.             // this is because sql.php could call tbl_properties_structure
  88.             // which would think it needs to call mult_submits.inc.php:
  89.             unset($submit_mult);
  90.             unset($mult_btn);
  91.  
  92.             require('./sql.php');
  93.             
  94.             /**
  95.              * Displays the footer
  96.              */
  97.             require_once('./footer.inc.php');
  98.         break;
  99.     }
  100. }
  101. ?>
  102.