Editing of multiple records at once.
This is a hook-in to the 'delete multiple records' and basically just wraps all data in some kind of Ueber-Array. It should be compatible with single records editing. I tried various combinations already and it seems to work. But this can heavily break stuff, so expect this to be EXPERIMENTAL! We should only release RC1 after this has been thoroughly tested (will do so in the next days by myself). What maybe needs fixing is the way of evaluating $goto/ $err_url and similars. As I am not much into that redirection stuff, maybe one can see if I did something wrong in the area.
This commit is contained in:
@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2003-12-04 Garvin Hicking <grinch@supergarv.de>
|
||||||
|
* browse_foreigner.php, mult_submits.inc.php, tbl_change.php,
|
||||||
|
tbl_replace.php, tbl_replace_fields.php, tbl_row_delete,
|
||||||
|
libraries/display_tbl.lib.php, libraries/display_tbl_links.lib.php:
|
||||||
|
Multi row edit via checkboxes in browse mode is now available.
|
||||||
|
This means, you can edit multiple records at once now.
|
||||||
|
|
||||||
2003-12-02 Marc Delisle <lem9@users.sourceforge.net>
|
2003-12-02 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* libraries/display_tbl.lib.php: the constant used to check
|
* libraries/display_tbl.lib.php: the constant used to check
|
||||||
if the transformation function is included no longer exists
|
if the transformation function is included no longer exists
|
||||||
|
@@ -43,8 +43,8 @@ PMA_setFontSizes();
|
|||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
self.focus();
|
self.focus();
|
||||||
function formupdate(field, key) {
|
function formupdate(field, key) {
|
||||||
if (opener && opener.document && opener.document.insertForm && opener.document.insertForm.elements['field_' + field + '[]']) {
|
if (opener && opener.document && opener.document.insertForm && opener.document.insertForm.elements['field_' + field + '<?php echo (isset($pk) ? '[multi_edit][' . $pk . ']' : ''); ?>[]']) {
|
||||||
opener.document.insertForm.elements['field_' + field + '[]'].value = key;
|
opener.document.insertForm.elements['field_' + field + '<?php echo (isset($pk) ? '[multi_edit][' . $pk . ']' : ''); ?>[]'].value = key;
|
||||||
self.close();
|
self.close();
|
||||||
} else {
|
} else {
|
||||||
alert('<?php echo PMA_jsFormat($strWindowNotFound); ?>');
|
alert('<?php echo PMA_jsFormat($strWindowNotFound); ?>');
|
||||||
@@ -78,6 +78,16 @@ require('./libraries/get_foreign.lib.php');
|
|||||||
<form action="browse_foreigners.php" method="post">
|
<form action="browse_foreigners.php" method="post">
|
||||||
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
||||||
<input type="hidden" name="field" value="<?php echo urlencode($field); ?>" />
|
<input type="hidden" name="field" value="<?php echo urlencode($field); ?>" />
|
||||||
|
<?php
|
||||||
|
if (isset($pk)) {
|
||||||
|
$pk_uri = '&pk=' . $pk;
|
||||||
|
?>
|
||||||
|
<input type="hidden" name="pk" value="<?php echo $pk; ?>" />
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
$pk_uri = '';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<?php
|
<?php
|
||||||
@@ -93,7 +103,7 @@ $nbTotalPage = @ceil($the_total / $session_max_rows);
|
|||||||
|
|
||||||
if ($the_total > $per_page) {
|
if ($the_total > $per_page) {
|
||||||
$gotopage = '<br />' . $GLOBALS['strPageNumber']
|
$gotopage = '<br />' . $GLOBALS['strPageNumber']
|
||||||
. '<select name="goToPage" onChange="goToUrl(this, \'browse_foreigners.php?field=' . urlencode($field) . '&' . PMA_generate_common_url($db, $table) . '&\');">';
|
. '<select name="goToPage" onChange="goToUrl(this, \'browse_foreigners.php?field=' . urlencode($field) . '&' . PMA_generate_common_url($db, $table) . $pk_uri . '\');">';
|
||||||
if ($nbTotalPage < 200) {
|
if ($nbTotalPage < 200) {
|
||||||
$firstPage = 1;
|
$firstPage = 1;
|
||||||
$lastPage = $nbTotalPage;
|
$lastPage = $nbTotalPage;
|
||||||
|
@@ -1488,7 +1488,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
|
|||||||
|
|
||||||
if (!empty($del_url)) {
|
if (!empty($del_url)) {
|
||||||
$vertical_display['row_delete'][$row_no] .= ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n"
|
$vertical_display['row_delete'][$row_no] .= ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n"
|
||||||
. ' <input type="checkbox" name="rows_to_delete[]" value="' . $del_query . '" />' . "\n"
|
. ' <input type="checkbox" name="rows_to_delete[' . $uva_condition . ']" value="' . $del_query . '" />' . "\n"
|
||||||
. ' </td>' . "\n";
|
. ' </td>' . "\n";
|
||||||
} else {
|
} else {
|
||||||
unset($vertical_display['row_delete'][$row_no]);
|
unset($vertical_display['row_delete'][$row_no]);
|
||||||
@@ -1862,15 +1862,22 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
|
|||||||
/* Opera has trouble with <input type="image"> */
|
/* Opera has trouble with <input type="image"> */
|
||||||
/* IE has trouble with <button> */
|
/* IE has trouble with <button> */
|
||||||
if (PMA_USR_BROWSER_AGENT != 'IE') {
|
if (PMA_USR_BROWSER_AGENT != 'IE') {
|
||||||
echo ' <button class="mult_submit" type="submit" name="submit_mult" value="row_delete" title="' . $delete_text . '">' . "\n"
|
echo ' <button class="mult_submit" type="submit" name="submit_mult" value="row_edit" title="' . $GLOBALS['strEdit'] . '">' . "\n"
|
||||||
|
. '<img src="./images/button_edit.png" title="' . $GLOBALS['strEdit'] . '" alt="' . $GLOBALS['strEdit'] . '" width="11" height="13" />' . (($propicon == 'both') ? ' ' . $GLOBALS['strEdit'] : '') . "\n"
|
||||||
|
. '</button>';
|
||||||
|
|
||||||
|
echo ' <button class="mult_submit" type="submit" name="submit_mult" value="row_delete" title="' . $delete_text . '">' . "\n"
|
||||||
. '<img src="./images/button_drop.png" title="' . $delete_text . '" alt="' . $delete_text . '" width="11" height="13" />' . (($propicon == 'both') ? ' ' . $delete_text : '') . "\n"
|
. '<img src="./images/button_drop.png" title="' . $delete_text . '" alt="' . $delete_text . '" width="11" height="13" />' . (($propicon == 'both') ? ' ' . $delete_text : '') . "\n"
|
||||||
. '</button>';
|
. '</button>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo ' <input type="image" name="submit_mult" value="row_delete" title="' . $delete_text . '" src="./images/button_drop.png" />' . (($propicon == 'both') ? ' ' . $delete_text : '');
|
echo ' <input type="image" name="submit_mult_edit" value="row_edit" title="' . $GLOBALS['strEdit'] . '" src="./images/button_edit.png" />' . (($propicon == 'both') ? ' ' . $GLOBALS['strEdit'] : '');
|
||||||
|
echo ' <input type="image" name="submit_mult" value="row_delete" title="' . $delete_text . '" src="./images/button_drop.png" />' . (($propicon == 'both') ? ' ' . $delete_text : '');
|
||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
} else {
|
} else {
|
||||||
echo ' <input type="submit" name="submit_mult" value="row_delete" title="' . $delete_text . '" />' . "\n";
|
echo ' <input type="submit" name="submit_mult" value="row_edit" title="' . $GLOBALS['strEdit'] . '" />' . "\n";
|
||||||
|
echo ' <input type="submit" name="submit_mult" value="row_delete" title="' . $delete_text . '" />' . "\n";
|
||||||
}
|
}
|
||||||
echo '<input type="hidden" name="sql_query" value="' . $sql_query . '" />' . "\n";
|
echo '<input type="hidden" name="sql_query" value="' . $sql_query . '" />' . "\n";
|
||||||
echo '<input type="hidden" name="pos" value="' . $pos . '" />' . "\n";
|
echo '<input type="hidden" name="pos" value="' . $pos . '" />' . "\n";
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
if (!empty($del_url)) {
|
if (!empty($del_url)) {
|
||||||
echo ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n"
|
echo ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n"
|
||||||
. ' <input type="checkbox" name="rows_to_delete[]" value="' . $del_query . '" />' . "\n"
|
. ' <input type="checkbox" name="rows_to_delete[' . $uva_condition . ']" value="' . $del_query . '" />' . "\n"
|
||||||
. ' </td>' . "\n";
|
. ' </td>' . "\n";
|
||||||
}
|
}
|
||||||
if (!empty($edit_url)) {
|
if (!empty($edit_url)) {
|
||||||
|
@@ -86,21 +86,23 @@ if (!empty($submit_mult) && !empty($what)) {
|
|||||||
// Builds the query
|
// Builds the query
|
||||||
$full_query = '';
|
$full_query = '';
|
||||||
$selected_cnt = count($selected);
|
$selected_cnt = count($selected);
|
||||||
for ($i = 0; $i < $selected_cnt; $i++) {
|
$i = 0;
|
||||||
|
foreach($selected AS $idx => $sval) {
|
||||||
|
$i++;
|
||||||
switch ($what) {
|
switch ($what) {
|
||||||
case 'row_delete':
|
case 'row_delete':
|
||||||
$full_query .= htmlspecialchars(urldecode($selected[$i]))
|
$full_query .= htmlspecialchars(urldecode($sval))
|
||||||
. ';<br />';
|
. ';<br />';
|
||||||
break;
|
break;
|
||||||
case 'drop_db':
|
case 'drop_db':
|
||||||
$full_query .= 'DROP DATABASE '
|
$full_query .= 'DROP DATABASE '
|
||||||
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
|
. PMA_backquote(htmlspecialchars(urldecode($sval)))
|
||||||
. ';<br />';
|
. ';<br />';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'drop_tbl':
|
case 'drop_tbl':
|
||||||
$full_query .= (empty($full_query) ? 'DROP TABLE ' : ', ')
|
$full_query .= (empty($full_query) ? 'DROP TABLE ' : ', ')
|
||||||
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
|
. PMA_backquote(htmlspecialchars(urldecode($sval)))
|
||||||
. (($i == $selected_cnt - 1) ? ';<br />' : '');
|
. (($i == $selected_cnt - 1) ? ';<br />' : '');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -110,7 +112,7 @@ if (!empty($submit_mult) && !empty($what)) {
|
|||||||
} else {
|
} else {
|
||||||
$full_query .= 'DELETE FROM ';
|
$full_query .= 'DELETE FROM ';
|
||||||
}
|
}
|
||||||
$full_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
|
$full_query .= PMA_backquote(htmlspecialchars(urldecode($sval)))
|
||||||
. ';<br />';
|
. ';<br />';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -119,11 +121,11 @@ if (!empty($submit_mult) && !empty($what)) {
|
|||||||
$full_query .= 'ALTER TABLE '
|
$full_query .= 'ALTER TABLE '
|
||||||
. PMA_backquote(htmlspecialchars($table))
|
. PMA_backquote(htmlspecialchars($table))
|
||||||
. '<br /> DROP '
|
. '<br /> DROP '
|
||||||
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
|
. PMA_backquote(htmlspecialchars(urldecode($sval)))
|
||||||
. ',';
|
. ',';
|
||||||
} else {
|
} else {
|
||||||
$full_query .= '<br /> DROP '
|
$full_query .= '<br /> DROP '
|
||||||
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
|
. PMA_backquote(htmlspecialchars(urldecode($sval)))
|
||||||
. ',';
|
. ',';
|
||||||
}
|
}
|
||||||
if ($i == $selected_cnt-1) {
|
if ($i == $selected_cnt-1) {
|
||||||
@@ -148,8 +150,8 @@ if (!empty($submit_mult) && !empty($what)) {
|
|||||||
} else {
|
} else {
|
||||||
echo PMA_generate_common_hidden_inputs();
|
echo PMA_generate_common_hidden_inputs();
|
||||||
}
|
}
|
||||||
for ($i = 0; $i < $selected_cnt; $i++) {
|
foreach($selected AS $idx => $sval) {
|
||||||
echo ' <input type="hidden" name="selected[]" value="' . htmlspecialchars($selected[$i]) . '" />' . "\n";
|
echo ' <input type="hidden" name="selected[]" value="' . htmlspecialchars($sval) . '" />' . "\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<input type="hidden" name="query_type" value="<?php echo $what; ?>" />
|
<input type="hidden" name="query_type" value="<?php echo $what; ?>" />
|
||||||
|
188
tbl_change.php
188
tbl_change.php
@@ -81,14 +81,24 @@ echo '<br />';
|
|||||||
PMA_mysql_select_db($db);
|
PMA_mysql_select_db($db);
|
||||||
$table_def = PMA_mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table));
|
$table_def = PMA_mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table));
|
||||||
if (isset($primary_key)) {
|
if (isset($primary_key)) {
|
||||||
|
if (is_array($primary_key)) {
|
||||||
|
$primary_key_array = $primary_key;
|
||||||
|
} else {
|
||||||
|
$primary_key_array = array(0 => $primary_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
$row = array();
|
||||||
|
$result = array();
|
||||||
|
foreach($primary_key_array AS $rowcount => $primary_key) {
|
||||||
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
|
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
|
||||||
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
|
$result[$rowcount] = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
|
||||||
$row = PMA_mysql_fetch_array($result);
|
$row[$rowcount] = PMA_mysql_fetch_array($result[$rowcount]);
|
||||||
|
$primary_keys[$rowcount] = $primary_key;
|
||||||
|
|
||||||
// No row returned
|
// No row returned
|
||||||
if (!$row) {
|
if (!$row[$rowcount]) {
|
||||||
unset($row);
|
unset($row[$rowcount]);
|
||||||
unset($primary_key);
|
unset($primary_key_array[$rowcount]);
|
||||||
$goto_cpy = $goto;
|
$goto_cpy = $goto;
|
||||||
$goto = 'tbl_properties.php?'
|
$goto = 'tbl_properties.php?'
|
||||||
. PMA_generate_common_url($db, $table)
|
. PMA_generate_common_url($db, $table)
|
||||||
@@ -108,8 +118,7 @@ if (isset($primary_key)) {
|
|||||||
}
|
}
|
||||||
} // end if (no record returned)
|
} // end if (no record returned)
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1';
|
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1';
|
||||||
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
|
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
|
||||||
unset($row);
|
unset($row);
|
||||||
@@ -154,28 +163,15 @@ document.onkeydown = onKeyDownArrowsHandler;
|
|||||||
<input type="hidden" name="err_url" value="<?php echo urlencode($err_url); ?>" />
|
<input type="hidden" name="err_url" value="<?php echo urlencode($err_url); ?>" />
|
||||||
<input type="hidden" name="sql_query" value="<?php echo isset($sql_query) ? urlencode($sql_query) : ''; ?>" />
|
<input type="hidden" name="sql_query" value="<?php echo isset($sql_query) ? urlencode($sql_query) : ''; ?>" />
|
||||||
<?php
|
<?php
|
||||||
if (isset($primary_key)) {
|
if (isset($primary_key_array)) {
|
||||||
|
foreach($primary_key_array AS $primary_key) {
|
||||||
?>
|
?>
|
||||||
<input type="hidden" name="primary_key" value="<?php echo urlencode($primary_key); ?>" />
|
<input type="hidden" name="primary_key[]" value="<?php echo urlencode($primary_key); ?>" />
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
|
||||||
|
|
||||||
<table border="<?php echo $cfg['Border']; ?>">
|
|
||||||
<tr>
|
|
||||||
<th><?php echo $strField; ?></th>
|
|
||||||
<th><?php echo $strType; ?></th>
|
|
||||||
<?php
|
|
||||||
if ($cfg['ShowFunctionFields']) {
|
|
||||||
echo ' <th>' . $strFunction . '</th>' . "\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<th><?php echo $strNull; ?></th>
|
|
||||||
<th><?php echo $strValue; ?></th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
if ($cfg['PropertiesIconic'] == true) {
|
if ($cfg['PropertiesIconic'] == true) {
|
||||||
// We need to copy the value or else the == 'both' check will always return true
|
// We need to copy the value or else the == 'both' check will always return true
|
||||||
$propicon = (string)$cfg['PropertiesIconic'];
|
$propicon = (string)$cfg['PropertiesIconic'];
|
||||||
@@ -202,6 +198,44 @@ $fields_cnt = mysql_num_rows($table_def);
|
|||||||
// Set a flag here because the 'if' would not be valid in the loop
|
// Set a flag here because the 'if' would not be valid in the loop
|
||||||
// if we set a value in some field
|
// if we set a value in some field
|
||||||
$insert_mode = (!isset($row) ? TRUE : FALSE);
|
$insert_mode = (!isset($row) ? TRUE : FALSE);
|
||||||
|
$loop_array = (isset($row) ? $row : array(0 => array(0 => 0)));
|
||||||
|
|
||||||
|
while ($trow = PMA_mysql_fetch_array($table_def)) {
|
||||||
|
$trow_table_def[] = $trow;
|
||||||
|
}
|
||||||
|
|
||||||
|
$o_rows = 0;
|
||||||
|
foreach($loop_array AS $vrowcount => $vrow) {
|
||||||
|
$vresult = (isset($result) && is_array($result) && isset($result[$vrowcount]) ? $result[$vrowcount] : $result);
|
||||||
|
?>
|
||||||
|
<table border="<?php echo $cfg['Border']; ?>">
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $strField; ?></th>
|
||||||
|
<th><?php echo $strType; ?></th>
|
||||||
|
<?php
|
||||||
|
if ($cfg['ShowFunctionFields']) {
|
||||||
|
echo ' <th>' . $strFunction . '</th>' . "\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<th><?php echo $strNull; ?></th>
|
||||||
|
<th><?php echo $strValue; ?></th>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if ($insert_mode) {
|
||||||
|
$vkey = '';
|
||||||
|
$browse_foreigners_uri = '';
|
||||||
|
} else {
|
||||||
|
$vkey = '[multi_edit][' . urlencode($primary_keys[$vrowcount]) . ']';
|
||||||
|
$browse_foreigners_uri = '&pk=' . urlencode($primary_keys[$vrowcount]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// garvin: For looping on multiple rows, we need to reset any variable used inside the loop to indicate sth.
|
||||||
|
unset($timestamp_seen);
|
||||||
|
unset($first_timestamp);
|
||||||
|
|
||||||
|
// Sets a multiplier used for input-field counts (as zero cannot be used, advance the counter plus one)
|
||||||
|
$m_rows = $o_rows + 1;
|
||||||
|
|
||||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||||
// Display the submit button after every 15 lines --swix
|
// Display the submit button after every 15 lines --swix
|
||||||
@@ -219,7 +253,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
} // end if
|
} // end if
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
$row_table_def = PMA_mysql_fetch_array($table_def);
|
$row_table_def = $trow_table_def[$i];
|
||||||
$row_table_def['True_Type'] = preg_replace('@\(.*@s', '', $row_table_def['Type']);
|
$row_table_def['True_Type'] = preg_replace('@\(.*@s', '', $row_table_def['Type']);
|
||||||
|
|
||||||
$field = $row_table_def['Field'];
|
$field = $row_table_def['Field'];
|
||||||
@@ -244,16 +278,16 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
&& (!isset($row_table_def['Default']))) {
|
&& (!isset($row_table_def['Default']))) {
|
||||||
// INSERT case
|
// INSERT case
|
||||||
if ($insert_mode) {
|
if ($insert_mode) {
|
||||||
$row[$rowfield] = date('Y-m-d H:i:s', time());
|
$vrow[$rowfield] = date('Y-m-d H:i:s', time());
|
||||||
}
|
}
|
||||||
// UPDATE case with an empty and not NULL value under PHP4
|
// UPDATE case with an empty and not NULL value under PHP4
|
||||||
else if (empty($row[$rowfield]) && is_null($row[$rowfield])) {
|
else if (empty($vrow[$rowfield]) && is_null($vrow[$rowfield])) {
|
||||||
$row[$rowfield] = date('Y-m-d H:i:s', time());
|
$vrow[$rowfield] = date('Y-m-d H:i:s', time());
|
||||||
} // end if... else if...
|
} // end if... else if...
|
||||||
}
|
}
|
||||||
$len = (preg_match('@float|double@', $row_table_def['Type']))
|
$len = (preg_match('@float|double@', $row_table_def['Type']))
|
||||||
? 100
|
? 100
|
||||||
: @mysql_field_len($result, $i);
|
: @mysql_field_len($vresult, $i);
|
||||||
$first_timestamp = 0;
|
$first_timestamp = 0;
|
||||||
|
|
||||||
$bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
|
$bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
|
||||||
@@ -299,30 +333,30 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
|
|
||||||
// Prepares the field value
|
// Prepares the field value
|
||||||
$real_null_value = FALSE;
|
$real_null_value = FALSE;
|
||||||
if (isset($row)) {
|
if (isset($vrow)) {
|
||||||
if (!isset($row[$rowfield])
|
if (!isset($vrow[$rowfield])
|
||||||
|| (function_exists('is_null') && is_null($row[$rowfield]))) {
|
|| (function_exists('is_null') && is_null($vrow[$rowfield]))) {
|
||||||
$real_null_value = TRUE;
|
$real_null_value = TRUE;
|
||||||
$row[$rowfield] = '';
|
$vrow[$rowfield] = '';
|
||||||
$special_chars = '';
|
$special_chars = '';
|
||||||
$data = $row[$rowfield];
|
$data = $vrow[$rowfield];
|
||||||
} else {
|
} else {
|
||||||
// loic1: special binary "characters"
|
// loic1: special binary "characters"
|
||||||
if ($is_binary || $is_blob) {
|
if ($is_binary || $is_blob) {
|
||||||
$row[$rowfield] = str_replace("\x00", '\0', $row[$rowfield]);
|
$vrow[$rowfield] = str_replace("\x00", '\0', $vrow[$rowfield]);
|
||||||
$row[$rowfield] = str_replace("\x08", '\b', $row[$rowfield]);
|
$vrow[$rowfield] = str_replace("\x08", '\b', $vrow[$rowfield]);
|
||||||
$row[$rowfield] = str_replace("\x0a", '\n', $row[$rowfield]);
|
$vrow[$rowfield] = str_replace("\x0a", '\n', $vrow[$rowfield]);
|
||||||
$row[$rowfield] = str_replace("\x0d", '\r', $row[$rowfield]);
|
$vrow[$rowfield] = str_replace("\x0d", '\r', $vrow[$rowfield]);
|
||||||
$row[$rowfield] = str_replace("\x1a", '\Z', $row[$rowfield]);
|
$vrow[$rowfield] = str_replace("\x1a", '\Z', $vrow[$rowfield]);
|
||||||
} // end if
|
} // end if
|
||||||
$special_chars = htmlspecialchars($row[$rowfield]);
|
$special_chars = htmlspecialchars($vrow[$rowfield]);
|
||||||
$data = $row[$rowfield];
|
$data = $vrow[$rowfield];
|
||||||
} // end if... else...
|
} // end if... else...
|
||||||
// loic1: if a timestamp field value is not included in an update
|
// loic1: if a timestamp field value is not included in an update
|
||||||
// statement MySQL auto-update it to the current timestamp
|
// statement MySQL auto-update it to the current timestamp
|
||||||
$backup_field = ($row_table_def['True_Type'] == 'timestamp')
|
$backup_field = ($row_table_def['True_Type'] == 'timestamp')
|
||||||
? ''
|
? ''
|
||||||
: '<input type="hidden" name="fields_prev[' . urlencode($field) . ']" value="' . urlencode($row[$rowfield]) . '" />';
|
: '<input type="hidden" name="fields_prev' . $vkey . '[' . urlencode($field) . ']" value="' . urlencode($vrow[$rowfield]) . '" />';
|
||||||
} else {
|
} else {
|
||||||
// loic1: display default values
|
// loic1: display default values
|
||||||
if (!isset($row_table_def['Default'])) {
|
if (!isset($row_table_def['Default'])) {
|
||||||
@@ -353,7 +387,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<select name="funcs[<?php echo urlencode($field); ?>]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($fields_cnt + $i + 1); ?>" id="field_<?php echo $i; ?>_1">
|
<select name="funcs<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($fields_cnt + ($i * $m_rows) + 1); ?>" id="field_<?php echo $i * $m_rows; ?>_1">
|
||||||
<option></option>
|
<option></option>
|
||||||
<?php
|
<?php
|
||||||
echo "\n";
|
echo "\n";
|
||||||
@@ -422,13 +456,13 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
|
echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
|
||||||
if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary))
|
if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary))
|
||||||
&& $row_table_def['Null'] == 'YES') {
|
&& $row_table_def['Null'] == 'YES') {
|
||||||
echo ' <input type="checkbox" tabindex="' . ((2 * $fields_cnt) + $i + 1) . '"'
|
echo ' <input type="checkbox" tabindex="' . ((2 * $fields_cnt) + ($i * $m_rows) + 1) . '"'
|
||||||
. ' name="fields_null[' . urlencode($field) . ']"';
|
. ' name="fields_null[' . urlencode($field) . ']"';
|
||||||
//if ($data == 'NULL' && !$first_timestamp) {
|
//if ($data == 'NULL' && !$first_timestamp) {
|
||||||
if ($real_null_value && !$first_timestamp) {
|
if ($real_null_value && !$first_timestamp) {
|
||||||
echo ' checked="checked"';
|
echo ' checked="checked"';
|
||||||
}
|
}
|
||||||
echo ' id="field_' . $i . '_2"';
|
echo ' id="field_' . ($i * $m_rows) . '_2"';
|
||||||
$onclick = ' onclick="if (this.checked) {nullify(';
|
$onclick = ' onclick="if (this.checked) {nullify(';
|
||||||
if (strstr($row_table_def['True_Type'], 'enum')) {
|
if (strstr($row_table_def['True_Type'], 'enum')) {
|
||||||
if (strlen($row_table_def['Type']) > 20) {
|
if (strlen($row_table_def['Type']) > 20) {
|
||||||
@@ -459,11 +493,11 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
?>
|
?>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<?php echo $backup_field . "\n"; ?>
|
<?php echo $backup_field . "\n"; ?>
|
||||||
<input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="foreign" />
|
<input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="foreign" />
|
||||||
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo $i; ?>_1" />
|
<input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo ($i * $m_rows); ?>_1" />
|
||||||
<input type="text" name="field_<?php echo md5($field); ?>[]" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3" value="<?php echo htmlspecialchars($data); ?>" />
|
<input type="text" name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $mrows); ?>_3" value="<?php echo htmlspecialchars($data); ?>" />
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes\'); return false" href="browse_foreigners.php?<?php echo PMA_generate_common_url($db, $table); ?>&field=<?php echo urlencode($field); ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
|
document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes\'); return false" href="browse_foreigners.php?<?php echo PMA_generate_common_url($db, $table); ?>&field=<?php echo urlencode($field) . $browse_foreigners_uri; ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
|
||||||
</script>
|
</script>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
@@ -471,9 +505,9 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
?>
|
?>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<?php echo $backup_field . "\n"; ?>
|
<?php echo $backup_field . "\n"; ?>
|
||||||
<input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="foreign" />
|
<input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="foreign" />
|
||||||
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo $i; ?>_1" />
|
<input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo $i; ?>_1" />
|
||||||
<select name="field_<?php echo md5($field); ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3">
|
<select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3">
|
||||||
<?php echo PMA_foreignDropdown($disp, $foreign_field, $foreign_display, $data, 100); ?>
|
<?php echo PMA_foreignDropdown($disp, $foreign_field, $foreign_display, $data, 100); ?>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@@ -487,8 +521,8 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="4" align="right" bgcolor="<?php echo $bgcolor; ?>">
|
<td colspan="4" align="right" bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<?php echo $backup_field . "\n"; ?>
|
<?php echo $backup_field . "\n"; ?>
|
||||||
<textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo ($cfg['TextareaRows']*2); ?>" cols="<?php echo ($cfg['TextareaCols']*2); ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo $i; ?>_3"
|
<textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo ($cfg['TextareaRows']*2); ?>" cols="<?php echo ($cfg['TextareaCols']*2); ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($i * $m_rows); ?>_3"
|
||||||
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>"><?php echo $special_chars; ?></textarea>
|
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>"><?php echo $special_chars; ?></textarea>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@@ -496,8 +530,8 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
?>
|
?>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<?php echo $backup_field . "\n"; ?>
|
<?php echo $backup_field . "\n"; ?>
|
||||||
<textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo $i; ?>_3"
|
<textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($i * $m_rows); ?>_3"
|
||||||
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>"><?php echo $special_chars; ?></textarea>
|
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>"><?php echo $special_chars; ?></textarea>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
echo "\n";
|
echo "\n";
|
||||||
@@ -510,8 +544,8 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
$enum_cnt = count($enum);
|
$enum_cnt = count($enum);
|
||||||
?>
|
?>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="enum" />
|
<input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="enum" />
|
||||||
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" />
|
<input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" />
|
||||||
<?php
|
<?php
|
||||||
echo "\n" . ' ' . $backup_field;
|
echo "\n" . ' ' . $backup_field;
|
||||||
|
|
||||||
@@ -519,7 +553,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
if (strlen($row_table_def['Type']) > 20) {
|
if (strlen($row_table_def['Type']) > 20) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
<select name="field_<?php echo md5($field); ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3">
|
<select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<?php
|
<?php
|
||||||
echo "\n";
|
echo "\n";
|
||||||
@@ -547,14 +581,14 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
// Removes automatic MySQL escape format
|
// Removes automatic MySQL escape format
|
||||||
$enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
|
$enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
|
||||||
echo ' ';
|
echo ' ';
|
||||||
echo '<input type="radio" name="field_' . md5($field) . '[]" value="' . urlencode($enum_atom) . '" id="field_' . $i . '_3_' . $j . '" onclick="if (typeof(document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) . ']\']) != \'undefined\') {document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) .']\'].checked = false}"';
|
echo '<input type="radio" name="field_' . md5($field) . $vkey . '[]" value="' . urlencode($enum_atom) . '" id="field_' . ($i*$m_rows) . '_3_' . $j . '" onclick="if (typeof(document.forms[\'insertForm\'].elements[\'fields_null' . str_replace('"', '\"', $vkey) . '[' . urlencode($field) . ']\']) != \'undefined\') {document.forms[\'insertForm\'].elements[\'fields_null' . str_replace('"', '\"', $vkey) . '[' . urlencode($field) .']\'].checked = false}"';
|
||||||
if ($data == $enum_atom
|
if ($data == $enum_atom
|
||||||
|| ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
|
|| ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
|
||||||
&& isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
|
&& isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
|
||||||
echo ' checked="checked"';
|
echo ' checked="checked"';
|
||||||
}
|
}
|
||||||
echo 'tabindex="' . ($i + 1) . '" />' . "\n";
|
echo 'tabindex="' . (($i * $m_rows) + 1) . '" />' . "\n";
|
||||||
echo ' <label for="field_' . $i . '_3_' . $j . '">' . htmlspecialchars($enum_atom) . '</label>' . "\n";
|
echo ' <label for="field_' . ($i * $m_rows) . '_3_' . $j . '">' . htmlspecialchars($enum_atom) . '</label>' . "\n";
|
||||||
} // end for
|
} // end for
|
||||||
|
|
||||||
} // end else
|
} // end else
|
||||||
@@ -578,9 +612,9 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
?>
|
?>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<?php echo $backup_field . "\n"; ?>
|
<?php echo $backup_field . "\n"; ?>
|
||||||
<input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="set" />
|
<input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="set" />
|
||||||
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" />
|
<input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" />
|
||||||
<select name="field_<?php echo md5($field); ?>[]" size="<?php echo $size; ?>" multiple="multiple" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3">
|
<select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" size="<?php echo $size; ?>" multiple="multiple" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3">
|
||||||
<?php
|
<?php
|
||||||
echo "\n";
|
echo "\n";
|
||||||
for ($j = 0; $j < $countset; $j++) {
|
for ($j = 0; $j < $countset; $j++) {
|
||||||
@@ -613,16 +647,16 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
<input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="protected" />
|
<input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="protected" />
|
||||||
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" />
|
<input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" />
|
||||||
<?php
|
<?php
|
||||||
} else if ($is_blob) {
|
} else if ($is_blob) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<?php echo $backup_field . "\n"; ?>
|
<?php echo $backup_field . "\n"; ?>
|
||||||
<textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo $i; ?>_3"
|
<textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($i*$m_rows); ?>_3"
|
||||||
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" ><?php echo $special_chars; ?></textarea>
|
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" ><?php echo $special_chars; ?></textarea>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -636,7 +670,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
?>
|
?>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<?php echo $backup_field . "\n"; ?>
|
<?php echo $backup_field . "\n"; ?>
|
||||||
<input type="text" name="fields[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3" />
|
<input type="text" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3" />
|
||||||
<?php
|
<?php
|
||||||
} // end if...elseif...else
|
} // end if...elseif...else
|
||||||
|
|
||||||
@@ -645,7 +679,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
// (displayed whatever value the ProtectBinary has)
|
// (displayed whatever value the ProtectBinary has)
|
||||||
|
|
||||||
if ($is_upload && $is_blob) {
|
if ($is_upload && $is_blob) {
|
||||||
echo '<input type="file" name="fields_upload_' . urlencode($field) . '" class="textfield" id="field_' . $i . '_3" />';
|
echo '<input type="file" name="fields_upload_' . urlencode($field) . $vkey . '" class="textfield" id="field_' . ($i * $m_rows) . '_3" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($cfg['UploadDir'])) {
|
if (!empty($cfg['UploadDir'])) {
|
||||||
@@ -659,7 +693,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
if ($is_first == 0) {
|
if ($is_first == 0) {
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo ' <i>' . $strOr . '</i>' . ' ' . $strWebServerUploadDirectory . ' :<br />' . "\n";
|
echo ' <i>' . $strOr . '</i>' . ' ' . $strWebServerUploadDirectory . ' :<br />' . "\n";
|
||||||
echo ' <select size="1" name="fields_uploadlocal_' . urlencode($field) . '">' . "\n";
|
echo ' <select size="1" name="fields_uploadlocal_' . urlencode($field) . $vkey . '">' . "\n";
|
||||||
echo ' <option value="" selected="selected"></option>' . "\n";
|
echo ' <option value="" selected="selected"></option>' . "\n";
|
||||||
} // end if (is_first)
|
} // end if (is_first)
|
||||||
echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
|
echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
|
||||||
@@ -699,13 +733,13 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
if ($is_char && isset($cfg['CharEditing']) && ($cfg['CharEditing'] == 'textarea')) {
|
if ($is_char && isset($cfg['CharEditing']) && ($cfg['CharEditing'] == 'textarea')) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
<textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['CharTextareaRows']; ?>" cols="<?php echo $cfg['CharTextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo $i; ?>_3"
|
<textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['CharTextareaRows']; ?>" cols="<?php echo $cfg['CharTextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($i * $m_rows); ?>_3"
|
||||||
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" ><?php echo $special_chars; ?></textarea>
|
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" ><?php echo $special_chars; ?></textarea>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
<input type="text" name="fields[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3" />
|
<input type="text" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3" />
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
@@ -719,8 +753,10 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
<?php
|
<?php
|
||||||
echo "\n";
|
echo "\n";
|
||||||
} // end for
|
} // end for
|
||||||
|
$o_rows++;
|
||||||
|
echo ' </table><br />';
|
||||||
|
} // end foreach on multi-edit
|
||||||
?>
|
?>
|
||||||
</table>
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<table cellpadding="5">
|
<table cellpadding="5">
|
||||||
|
@@ -58,7 +58,7 @@ if (isset($err_url)) {
|
|||||||
$err_url = urldecode($err_url);
|
$err_url = urldecode($err_url);
|
||||||
} else {
|
} else {
|
||||||
$err_url = str_replace('&', '&', $goto)
|
$err_url = str_replace('&', '&', $goto)
|
||||||
. (empty($primary_key) ? '' : '&primary_key=' . $primary_key);
|
. (empty($primary_key) ? '' : '&primary_key=' . (is_array($primary_key) ? $primary_key[0] : $primary_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resets tables defined in the configuration file
|
// Resets tables defined in the configuration file
|
||||||
@@ -73,32 +73,45 @@ $seen_binary = FALSE;
|
|||||||
* Prepares the update of a row
|
* Prepares the update of a row
|
||||||
*/
|
*/
|
||||||
if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
||||||
|
$loop_array = (is_array($primary_key) ? $primary_key : array(0 => $primary_key));
|
||||||
|
PMA_mysql_select_db($db);
|
||||||
|
$query = array();
|
||||||
|
$message = '';
|
||||||
|
|
||||||
|
foreach($loop_array AS $primary_key_index => $enc_primary_key) {
|
||||||
// Restore the "primary key" to a convenient format
|
// Restore the "primary key" to a convenient format
|
||||||
$primary_key = urldecode($primary_key);
|
$primary_key = urldecode($enc_primary_key);
|
||||||
|
|
||||||
// Defines the SET part of the sql query
|
// Defines the SET part of the sql query
|
||||||
$valuelist = '';
|
$valuelist = '';
|
||||||
|
|
||||||
foreach($fields AS $key => $val) {
|
// Map multi-edit keys to single-level arrays, dependent on how we got the fields
|
||||||
|
$me_fields = (isset($fields['multi_edit']) ? $fields['multi_edit'][$enc_primary_key] : $fields);
|
||||||
|
$me_fields_prev = (isset($fields_prev['multi_edit']) ? $fields_prev['multi_edit'][$enc_primary_key] : $fields_prev);
|
||||||
|
$me_funcs = (isset($funcs['multi_edit']) ? $funcs['multi_edit'][$enc_primary_key] : $funcs);
|
||||||
|
$me_fields_type = (isset($fields_type['multi_edit']) ? $fields_type['multi_edit'][$enc_primary_key] : $fields_type);
|
||||||
|
$me_fields_null = (isset($fields_null['multi_edit']) ? $fields_null['multi_edit'][$enc_primary_key] : $fields_null);
|
||||||
|
|
||||||
|
foreach($me_fields AS $key => $val) {
|
||||||
$encoded_key = $key;
|
$encoded_key = $key;
|
||||||
$key = urldecode($key);
|
$key = urldecode($key);
|
||||||
|
|
||||||
require('./tbl_replace_fields.php');
|
require('./tbl_replace_fields.php');
|
||||||
|
|
||||||
// No change for this column and no MySQL function is used -> next column
|
// No change for this column and no MySQL function is used -> next column
|
||||||
if (empty($funcs[$encoded_key])
|
if (empty($me_funcs[$encoded_key])
|
||||||
&& isset($fields_prev) && isset($fields_prev[$encoded_key])
|
&& isset($me_fields_prev) && isset($me_fields_prev[$encoded_key])
|
||||||
&& ("'" . PMA_sqlAddslashes(urldecode($fields_prev[$encoded_key])) . "'" == $val)) {
|
&& ("'" . PMA_sqlAddslashes(urldecode($me_fields_prev[$encoded_key])) . "'" == $val)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!empty($val)) {
|
else if (!empty($val)) {
|
||||||
if (empty($funcs[$encoded_key])) {
|
if (empty($me_funcs[$encoded_key])) {
|
||||||
$valuelist .= PMA_backquote($key) . ' = ' . $val . ', ';
|
$valuelist .= PMA_backquote($key) . ' = ' . $val . ', ';
|
||||||
} else if ($val == '\'\''
|
} else if ($val == '\'\''
|
||||||
&& (preg_match('@^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$@', $funcs[$encoded_key]))) {
|
&& (preg_match('@^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$@', $me_funcs[$encoded_key]))) {
|
||||||
$valuelist .= PMA_backquote($key) . ' = ' . $funcs[$encoded_key] . '(), ';
|
$valuelist .= PMA_backquote($key) . ' = ' . $me_funcs[$encoded_key] . '(), ';
|
||||||
} else {
|
} else {
|
||||||
$valuelist .= PMA_backquote($key) . ' = ' . $funcs[$encoded_key] . "($val), ";
|
$valuelist .= PMA_backquote($key) . ' = ' . $me_funcs[$encoded_key] . "($val), ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end while
|
} // end while
|
||||||
@@ -106,13 +119,14 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
|||||||
// Builds the sql update query
|
// Builds the sql update query
|
||||||
$valuelist = preg_replace('@, $@', '', $valuelist);
|
$valuelist = preg_replace('@, $@', '', $valuelist);
|
||||||
if (!empty($valuelist)) {
|
if (!empty($valuelist)) {
|
||||||
PMA_mysql_select_db($db);
|
$query[] = 'UPDATE ' . PMA_backquote($table) . ' SET ' . $valuelist . ' WHERE' . $primary_key
|
||||||
$query = 'UPDATE ' . PMA_backquote($table) . ' SET ' . $valuelist . ' WHERE' . $primary_key
|
|
||||||
. ' LIMIT 1';
|
. ' LIMIT 1';
|
||||||
$message = $strAffectedRows . ' ';
|
$message = $strAffectedRows . ' <br />';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($valuelist)) {
|
||||||
// No change -> move back to the calling script
|
// No change -> move back to the calling script
|
||||||
else {
|
|
||||||
$message = $strNoModification;
|
$message = $strNoModification;
|
||||||
if ($is_gotofile) {
|
if ($is_gotofile) {
|
||||||
$js_to_run = 'functions.js';
|
$js_to_run = 'functions.js';
|
||||||
@@ -130,41 +144,52 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
|||||||
* Prepares the insert of a row
|
* Prepares the insert of a row
|
||||||
*/
|
*/
|
||||||
else {
|
else {
|
||||||
|
$loop_array = (isset($primary_key) && is_array($primary_key) ? $primary_key : array(0 => (isset($primary_key) ? $primary_key : null)));
|
||||||
|
$query = array();
|
||||||
|
$message = '';
|
||||||
PMA_mysql_select_db($db);
|
PMA_mysql_select_db($db);
|
||||||
|
|
||||||
|
foreach($loop_array AS $primary_key_index => $enc_primary_key) {
|
||||||
$fieldlist = '';
|
$fieldlist = '';
|
||||||
$valuelist = '';
|
$valuelist = '';
|
||||||
|
|
||||||
|
$me_fields = (isset($fields['multi_edit']) ? $fields['multi_edit'][$enc_primary_key] : $fields);
|
||||||
|
$me_fields_prev = (isset($fields_prev['multi_edit']) ? $fields_prev['multi_edit'][$enc_primary_key] : $fields_prev);
|
||||||
|
$me_funcs = (isset($funcs['multi_edit']) ? $funcs['multi_edit'][$enc_primary_key] : $funcs);
|
||||||
|
$me_fields_type = (isset($fields_type['multi_edit']) ? $fields_type['multi_edit'][$enc_primary_key] : $fields_type);
|
||||||
|
$me_fields_null = (isset($fields_null['multi_edit']) ? $fields_null['multi_edit'][$enc_primary_key] : $fields_null);
|
||||||
|
|
||||||
// garvin: Get, if sent, any protected fields to insert them here:
|
// garvin: Get, if sent, any protected fields to insert them here:
|
||||||
if (isset($fields_type) && is_array($fields_type) && isset($primary_key)) {
|
if (isset($me_fields_type) && is_array($me_fields_type) && isset($enc_primary_key)) {
|
||||||
$prot_local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . urldecode($primary_key);
|
$prot_local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . urldecode($enc_primary_key);
|
||||||
$prot_result = PMA_mysql_query($prot_local_query) or PMA_mysqlDie('', $prot_local_query, '', $err_url);
|
$prot_result = PMA_mysql_query($prot_local_query) or PMA_mysqlDie('', $prot_local_query, '', $err_url);
|
||||||
$prot_row = PMA_mysql_fetch_array($prot_result);
|
$prot_row = PMA_mysql_fetch_array($prot_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($fields AS $key => $val) {
|
foreach($me_fields AS $key => $val) {
|
||||||
$encoded_key = $key;
|
$encoded_key = $key;
|
||||||
$key = urldecode($key);
|
$key = urldecode($key);
|
||||||
$fieldlist .= PMA_backquote($key) . ', ';
|
$fieldlist .= PMA_backquote($key) . ', ';
|
||||||
|
|
||||||
require('./tbl_replace_fields.php');
|
require('./tbl_replace_fields.php');
|
||||||
|
|
||||||
if (empty($funcs[$encoded_key])) {
|
if (empty($me_funcs[$encoded_key])) {
|
||||||
$valuelist .= $val . ', ';
|
$valuelist .= $val . ', ';
|
||||||
} else if (($val == '\'\''
|
} else if (($val == '\'\''
|
||||||
&& preg_match('@^(UNIX_TIMESTAMP|RAND|LAST_INSERT_ID)$@', $funcs[$encoded_key]))
|
&& preg_match('@^(UNIX_TIMESTAMP|RAND|LAST_INSERT_ID)$@', $me_funcs[$encoded_key]))
|
||||||
|| preg_match('@^(NOW|CURDATE|CURTIME|USER)$@', $funcs[$encoded_key])) {
|
|| preg_match('@^(NOW|CURDATE|CURTIME|USER)$@', $me_funcs[$encoded_key])) {
|
||||||
$valuelist .= $funcs[$encoded_key] . '(), ';
|
$valuelist .= $me_funcs[$encoded_key] . '(), ';
|
||||||
} else {
|
} else {
|
||||||
$valuelist .= $funcs[$encoded_key] . '(' . $val . '), ';
|
$valuelist .= $me_funcs[$encoded_key] . '(' . $val . '), ';
|
||||||
}
|
}
|
||||||
} // end while
|
} // end while
|
||||||
|
|
||||||
// Builds the sql insert query
|
// Builds the sql insert query
|
||||||
$fieldlist = preg_replace('@, $@', '', $fieldlist);
|
$fieldlist = preg_replace('@, $@', '', $fieldlist);
|
||||||
$valuelist = preg_replace('@, $@', '', $valuelist);
|
$valuelist = preg_replace('@, $@', '', $valuelist);
|
||||||
$query = 'INSERT INTO ' . PMA_backquote($table) . ' (' . $fieldlist . ') VALUES (' . $valuelist . ')';
|
$query[] = 'INSERT INTO ' . PMA_backquote($table) . ' (' . $fieldlist . ') VALUES (' . $valuelist . ')';
|
||||||
$message = $strInsertedRows . ' ';
|
$message = $strInsertedRows . ' ';
|
||||||
|
}
|
||||||
} // end row insertion
|
} // end row insertion
|
||||||
|
|
||||||
|
|
||||||
@@ -172,22 +197,37 @@ else {
|
|||||||
* Executes the sql query and get the result, then move back to the calling
|
* Executes the sql query and get the result, then move back to the calling
|
||||||
* page
|
* page
|
||||||
*/
|
*/
|
||||||
$sql_query = $query . ';';
|
$sql_query = implode(';', $query) . ';';
|
||||||
$result = PMA_mysql_query($query);
|
$total_affected_rows = 0;
|
||||||
|
|
||||||
|
foreach($query AS $query_index => $single_query) {
|
||||||
|
$result = PMA_mysql_query($single_query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
if ($cfg['IgnoreMultiSubmitErrors']) {
|
||||||
|
$message .= PMA_mysql_error();
|
||||||
|
} else {
|
||||||
$error = PMA_mysql_error();
|
$error = PMA_mysql_error();
|
||||||
require_once('./header.inc.php');
|
require_once('./header.inc.php');
|
||||||
PMA_mysqlDie($error, '', '', $err_url);
|
PMA_mysqlDie($error, '', '', $err_url);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (@mysql_affected_rows()) {
|
if (@mysql_affected_rows()) {
|
||||||
$message .= @mysql_affected_rows();
|
$total_affected_rows += @mysql_affected_rows;
|
||||||
} else {
|
|
||||||
$message = $strModifications;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$insert_id = mysql_insert_id();
|
$insert_id = mysql_insert_id();
|
||||||
if ($insert_id != 0) {
|
if ($insert_id != 0) {
|
||||||
$message .= '<br />'.$strInsertedRowId . ' ' . $insert_id;
|
$message .= '<br />'.$strInsertedRowId . ' ' . $insert_id;
|
||||||
}
|
}
|
||||||
|
} // end if
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($total_affected_rows != 0) {
|
||||||
|
$message .= '<br />' . $total_affected_rows;
|
||||||
|
} else {
|
||||||
|
$message .= $strModifications;
|
||||||
|
}
|
||||||
|
|
||||||
if ($is_gotofile) {
|
if ($is_gotofile) {
|
||||||
if ($goto == 'db_details.php' && !empty($table)) {
|
if ($goto == 'db_details.php' && !empty($table)) {
|
||||||
unset($table);
|
unset($table);
|
||||||
@@ -208,5 +248,4 @@ if (!$result) {
|
|||||||
header('Location: ' . $cfg['PmaAbsoluteUri'] . $goto . '&disp_message=' . urlencode($message) . $add_query);
|
header('Location: ' . $cfg['PmaAbsoluteUri'] . $goto . '&disp_message=' . urlencode($message) . $add_query);
|
||||||
}
|
}
|
||||||
exit();
|
exit();
|
||||||
} // end if
|
|
||||||
?>
|
?>
|
||||||
|
@@ -26,13 +26,18 @@ PMA_checkParameters(array('db','encoded_key'));
|
|||||||
// binary file is uploaded, thus bypassing further manipulation of $val.
|
// binary file is uploaded, thus bypassing further manipulation of $val.
|
||||||
|
|
||||||
$check_stop = false;
|
$check_stop = false;
|
||||||
if (isset(${'fields_upload_' . $encoded_key}) && ${'fields_upload_' . $encoded_key} != 'none'){
|
|
||||||
|
// Check if a multi-edit row was found
|
||||||
|
${'me_fields_upload_' . $encoded_key} = (isset($enc_primary_key) && isset(${'fields_upload_' . $encoded_key}['multi_edit']) ? ${'fields_upload_' . $encoded_key}['multi_edit'][$enc_primary_key] : ${'fields_upload_' . $encoded_key});
|
||||||
|
${'me_fields_uploadlocal_' . $encoded_key} = (isset($enc_primary_key) && isset(${'fields_uploadlocal_' . $encoded_key}['multi_edit']) ? ${'fields_uploadlocal_' . $encoded_key}['multi_edit'][$enc_primary_key] : ${'fields_uploadlocal_' . $encoded_key});
|
||||||
|
|
||||||
|
if (isset(${'me_fields_upload_' . $encoded_key}) && ${'me_fields_upload_' . $encoded_key} != 'none'){
|
||||||
// garvin: This fields content is a blob-file upload.
|
// garvin: This fields content is a blob-file upload.
|
||||||
|
|
||||||
if (!empty(${'fields_upload_' . $encoded_key})) {
|
if (!empty(${'me_fields_upload_' . $encoded_key})) {
|
||||||
// garvin: The blob-field is not empty. Check what we have there.
|
// garvin: The blob-field is not empty. Check what we have there.
|
||||||
|
|
||||||
$data_file = ${'fields_upload_' . $encoded_key};
|
$data_file = ${'me_fields_upload_' . $encoded_key};
|
||||||
|
|
||||||
if (is_uploaded_file($data_file)) {
|
if (is_uploaded_file($data_file)) {
|
||||||
// garvin: A valid uploaded file is found. Look into the file...
|
// garvin: A valid uploaded file is found. Look into the file...
|
||||||
@@ -56,11 +61,11 @@ if (isset(${'fields_upload_' . $encoded_key}) && ${'fields_upload_' . $encoded_k
|
|||||||
// void
|
// void
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif (!empty(${'fields_uploadlocal_' . $encoded_key})) {
|
} elseif (!empty(${'me_fields_uploadlocal_' . $encoded_key})) {
|
||||||
if (substr($cfg['UploadDir'], -1) != '/') {
|
if (substr($cfg['UploadDir'], -1) != '/') {
|
||||||
$cfg['UploadDir'] .= '/';
|
$cfg['UploadDir'] .= '/';
|
||||||
}
|
}
|
||||||
$file_to_upload = $cfg['UploadDir'] . preg_replace('@\.\.*@', '.', ${'fields_uploadlocal_' . $encoded_key});
|
$file_to_upload = $cfg['UploadDir'] . preg_replace('@\.\.*@', '.', ${'me_fields_uploadlocal_' . $encoded_key});
|
||||||
|
|
||||||
// A local file will be uploaded.
|
// A local file will be uploaded.
|
||||||
$open_basedir = @ini_get('open_basedir');
|
$open_basedir = @ini_get('open_basedir');
|
||||||
@@ -110,8 +115,18 @@ if (!$check_stop) {
|
|||||||
|
|
||||||
// f i e l d v a l u e i n t h e f o r m
|
// f i e l d v a l u e i n t h e f o r m
|
||||||
|
|
||||||
if (isset($fields_type[$encoded_key])) $type = $fields_type[$encoded_key];
|
if (isset($me_fields_type[$encoded_key])) $type = $me_fields_type[$encoded_key];
|
||||||
else $type = '';
|
else $type = '';
|
||||||
|
|
||||||
|
$f = 'field_' . md5($key);
|
||||||
|
$t_fval = $$f;
|
||||||
|
|
||||||
|
if (isset($t_fval['multi_edit'][$enc_primary_key])) {
|
||||||
|
$fval = &$t_fval['multi_edit'][$enc_primary_key];
|
||||||
|
} else {
|
||||||
|
$fval = &$t_fval;
|
||||||
|
}
|
||||||
|
|
||||||
switch (strtolower($val)) {
|
switch (strtolower($val)) {
|
||||||
// let users type NULL or null to input this string and not a NULL value
|
// let users type NULL or null to input this string and not a NULL value
|
||||||
//case 'null':
|
//case 'null':
|
||||||
@@ -120,9 +135,8 @@ if (!$check_stop) {
|
|||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'enum':
|
case 'enum':
|
||||||
// if we have an enum, then construct the value
|
// if we have an enum, then construct the value
|
||||||
$f = 'field_' . md5($key);
|
if (!empty($fval)) {
|
||||||
if (!empty($$f)) {
|
$val = implode(',', $fval);
|
||||||
$val = implode(',', $$f);
|
|
||||||
if ($val == 'null') {
|
if ($val == 'null') {
|
||||||
// void
|
// void
|
||||||
} else {
|
} else {
|
||||||
@@ -136,9 +150,8 @@ if (!$check_stop) {
|
|||||||
break;
|
break;
|
||||||
case 'set':
|
case 'set':
|
||||||
// if we have a set, then construct the value
|
// if we have a set, then construct the value
|
||||||
$f = 'field_' . md5($key);
|
if (!empty($fval)) {
|
||||||
if (!empty($$f)) {
|
$val = implode(',', $fval);
|
||||||
$val = implode(',', $$f);
|
|
||||||
// the data here is not urlencoded!
|
// the data here is not urlencoded!
|
||||||
//$val = "'" . PMA_sqlAddslashes(urldecode($val)) . "'";
|
//$val = "'" . PMA_sqlAddslashes(urldecode($val)) . "'";
|
||||||
$val = "'" . PMA_sqlAddslashes($val) . "'";
|
$val = "'" . PMA_sqlAddslashes($val) . "'";
|
||||||
@@ -148,9 +161,8 @@ if (!$check_stop) {
|
|||||||
break;
|
break;
|
||||||
case 'foreign':
|
case 'foreign':
|
||||||
// if we have a foreign key, then construct the value
|
// if we have a foreign key, then construct the value
|
||||||
$f = 'field_' . md5($key);
|
if (!empty($fval)) {
|
||||||
if (!empty($$f)) {
|
$val = implode(',', $fval);
|
||||||
$val = implode(',', $$f);
|
|
||||||
if ($val == 'null') {
|
if ($val == 'null') {
|
||||||
// void
|
// void
|
||||||
} else {
|
} else {
|
||||||
@@ -196,7 +208,7 @@ if (!$check_stop) {
|
|||||||
// Was the Null checkbox checked for this field?
|
// Was the Null checkbox checked for this field?
|
||||||
// (if there is a value, we ignore the Null checkbox: this could
|
// (if there is a value, we ignore the Null checkbox: this could
|
||||||
// be possible if Javascript is disabled in the browser)
|
// be possible if Javascript is disabled in the browser)
|
||||||
if (isset($fields_null) && isset($fields_null[$encoded_key])
|
if (isset($me_fields_null) && isset($me_fields_null[$encoded_key])
|
||||||
&& $val=="''") {
|
&& $val=="''") {
|
||||||
$val = 'NULL';
|
$val = 'NULL';
|
||||||
}
|
}
|
||||||
|
@@ -13,9 +13,34 @@ require_once('./header.inc.php');
|
|||||||
// workaround for IE problem:
|
// workaround for IE problem:
|
||||||
if (isset($submit_mult_x)) {
|
if (isset($submit_mult_x)) {
|
||||||
$submit_mult = 'row_delete';
|
$submit_mult = 'row_delete';
|
||||||
|
} elseif (isset($submit_mult_edit_x)) {
|
||||||
|
$submit_mult = 'row_edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!empty($submit_mult) && isset($rows_to_delete) && is_array($rows_to_delete))
|
// garvin: If the 'Ask for confirmation' button was pressed, this can only come from 'delete' mode,
|
||||||
|
// so we set it straight away.
|
||||||
|
if (isset($mult_btn)) {
|
||||||
|
$submit_mult = 'row_delete';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($submit_mult)) {
|
||||||
|
switch($submit_mult) {
|
||||||
|
case 'row_edit':
|
||||||
|
if (isset($rows_to_delete) && is_array($rows_to_delete)) {
|
||||||
|
$primary_key = array();
|
||||||
|
// garvin: As we got the fields to be edited from the 'rows_to_delete' checkbox, we use the index of it as the
|
||||||
|
// indicating primary key. Then we built the array which is used for the tbl_change.php script.
|
||||||
|
foreach($rows_to_delete AS $i_primary_key => $del_query) {
|
||||||
|
$primary_key[] = urldecode($i_primary_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
include './tbl_change.php';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'row_delete':
|
||||||
|
default:
|
||||||
|
if ((isset($rows_to_delete) && is_array($rows_to_delete))
|
||||||
|| isset($mult_btn)) {
|
|| isset($mult_btn)) {
|
||||||
$action = 'tbl_row_delete.php';
|
$action = 'tbl_row_delete.php';
|
||||||
$err_url = 'tbl_row_delete.php?' . PMA_generate_common_url($db, $table);
|
$err_url = 'tbl_row_delete.php?' . PMA_generate_common_url($db, $table);
|
||||||
@@ -56,4 +81,7 @@ require('./sql.php');
|
|||||||
* Displays the footer
|
* Displays the footer
|
||||||
*/
|
*/
|
||||||
require_once('./footer.inc.php');
|
require_once('./footer.inc.php');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user