diff --git a/htdocs/sql/tbl_change.php b/htdocs/sql/tbl_change.php deleted file mode 100755 --- a/htdocs/sql/tbl_change.php +++ /dev/null @@ -1,1062 +0,0 @@ -= 40100) { - $comments_map = PMA_getComments($db, $table); - } -} - -/** - * Displays top menu links - */ -require_once './libraries/tbl_links.inc.php'; - - -/** - * Get the analysis of SHOW CREATE TABLE for this table - */ -$show_create_table = PMA_DBI_fetch_value( - 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), - 0, 1); -$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); -unset($show_create_table); - -/** - * Get the list of the fields of the current table - */ -PMA_DBI_select_db($db); -$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE); -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(); - $found_unique_key = false; - foreach ($primary_key_array as $rowcount => $primary_key) { - $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';'; - $result[$rowcount] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE); - $row[$rowcount] = PMA_DBI_fetch_assoc($result[$rowcount]); - $primary_keys[$rowcount] = str_replace('\\', '\\\\', $primary_key); - - // No row returned - if (!$row[$rowcount]) { - unset($row[$rowcount], $primary_key_array[$rowcount]); - PMA_showMessage($strEmptyResultSet, $local_query); - echo "\n"; - require_once './libraries/footer.inc.php'; - } else { // end if (no record returned) - $meta = PMA_DBI_get_fields_meta($result[$rowcount]); - if ($tmp = PMA_getUniqueCondition($result[$rowcount], count($meta), $meta, $row[$rowcount], true)) { - $found_unique_key = true; - } - unset($tmp); - } - } -} else { - $result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE); - unset($row); -} - -// -// retrieve keys into foreign fields, if any -$cfgRelation = PMA_getRelationsParam(); -$foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE); - - -/** - * Displays the form - */ -// loic1: autocomplete feature of IE kills the "onchange" event handler and it -// must be replaced by the "onpropertychange" one in this case -$chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5) - ? 'onpropertychange' - : 'onchange'; -// Had to put the URI because when hosted on an https server, -// some browsers send wrongly this form to the http server. -?> - - - - - - - - -
> - - - - - $primary_key) { - echo ''. "\n"; - } -} -echo "\n"; - -if ($cfg['PropertiesIconic'] === true || $cfg['PropertiesIconic'] === 'both') { - if ($cfg['PropertiesIconic'] === 'both') { - $iconic_spacer = '
'; - } else { - $iconic_spacer = ''; - } - - $titles['Browse'] = $iconic_spacer . '' . $strBrowseForeignValues . ''; - - if ($cfg['PropertiesIconic'] === 'both') { - $titles['Browse'] .= ' ' . $strBrowseForeignValues . '
'; - } -} else { - $titles['Browse'] = $strBrowseForeignValues; -} - -// Set if we passed the first timestamp field -$timestamp_seen = 0; -$fields_cnt = PMA_DBI_num_rows($table_def); - -// Set a flag here because the 'if' would not be valid in the loop -// if we set a value in some field -$insert_mode = (!isset($row) ? TRUE : FALSE); -if ($insert_mode) { - $loop_array = array(); - for ($i = 0; $i < $cfg['InsertRows']; $i++) { - $loop_array[] = FALSE; - } -} else { - $loop_array = $row; -} - -while ($trow = PMA_DBI_fetch_assoc($table_def)) { - $trow_table_def[] = $trow; -} - -$tabindex = 0; -$tabindex_for_function = +3000; -$tabindex_for_null = +6000; -$tabindex_for_value = 0; -$o_rows = 0; -$biggest_max_file_size = 0; - -// user can toggle the display of Function column -// (currently does not work for multi-edits) -$url_params['db'] = $db; -$url_params['table'] = $table; -if (isset($primary_key)) { - $url_params['primary_key'] = trim($primary_key); -} -if (! empty($sql_query)) { - $url_params['sql_query'] = $sql_query; -} - -if (! $cfg['ShowFunctionFields']) { - $this_url_params = array_merge($url_params, - array('ShowFunctionFields' => 1)); - echo $strShow . ' : ' . $strFunction . '' . "\n"; -} - -foreach ($loop_array as $vrowcount => $vrow) { - if ($vrow === FALSE) { - unset($vrow); - } - - $jsvkey = $vrowcount; - $browse_foreigners_uri = '&pk=' . $vrowcount; - $vkey = '[multi_edit][' . $jsvkey . ']'; - - $vresult = (isset($result) && is_array($result) && isset($result[$vrowcount]) ? $result[$vrowcount] : $result); - if ($insert_mode && $vrowcount > 0) { - echo ''; - echo '
' . "\n"; - } -?> - - - - - 0)); - echo ' ' . "\n"; - } -?> - - - - d [Type] => datetime [Null] => YES [Key] => [Extra] => [True_Type] => datetime) - // but, look what we get if we switch to iso: (Default is NULL) - // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Default] => [Extra] => [True_Type] => datetime) - // so I force a NULL into it (I don't think it's possible - // to have an empty default value for DATETIME) - // then, the "if" after this one will work - if ($row_table_def['Type'] == 'datetime' - && !isset($row_table_def['Default']) - && isset($row_table_def['Null']) - && $row_table_def['Null'] == 'YES') { - $row_table_def['Default'] = null; - } - - if ($row_table_def['Type'] == 'datetime' - && (!isset($row_table_def['Default'])) - && (!is_null($row_table_def['Default']))) { - // INSERT case - if ($insert_mode) { - if (isset($vrow)) { - $vrow[$field] = date('Y-m-d H:i:s', time()); - } else { - $vrow = array($field => date('Y-m-d H:i:s', time())); - } - } - // UPDATE case with an empty and not NULL value under PHP4 - elseif (empty($vrow[$field]) && is_null($vrow[$field])) { - $vrow[$field] = date('Y-m-d H:i:s', time()); - } // end if... elseif... - } - $len = (preg_match('@float|double@', $row_table_def['Type'])) - ? 100 - : PMA_DBI_field_len($vresult, $i); - $first_timestamp = 0; - - $field_name = $field_html; - if (isset($comments_map[$field])) { - $field_name = '' . $field_name . ''; - } - - ?> - - - - - - - '; - } else { - // loic1: display default values - if (!isset($row_table_def['Default'])) { - $row_table_def['Default'] = ''; - $real_null_value = TRUE; - $data = ''; - } else { - $data = $row_table_def['Default']; - } - if ($row_table_def['True_Type'] == 'bit') { - $special_chars = PMA_printable_bit_value($row_table_def['Default'], $len); - } else { - $special_chars = htmlspecialchars($row_table_def['Default']); - } - $backup_field = ''; - } - - $idindex = ($o_rows * $fields_cnt) + $i + 1; - $tabindex = (($idindex - 1) * 3) + 1; - - // The function column - // ------------------- - // Change by Bernard M. Piller - // We don't want binary data to be destroyed - // Note: from the MySQL manual: "BINARY doesn't affect how the column is - // stored or retrieved" so it does not mean that the contents is - // binary - if ($cfg['ShowFunctionFields']) { - if (($cfg['ProtectBinary'] && $is_blob && !$is_upload) - || ($cfg['ProtectBinary'] == 'all' && $is_binary)) { - echo ' ' . "\n"; - } elseif (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) { - echo ' ' . "\n"; - } else { - ?> - - ' . "\n"; - if ($row_table_def['Null'] == 'YES') { - echo ' ' . "\n"; - - if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary))) { - - echo ' 20) { - $onclick .= '1, '; - } else { - $onclick .= '2, '; - } - } elseif (strstr($row_table_def['True_Type'], 'set')) { - $onclick .= '3, '; - } elseif ($foreigners && isset($foreigners[$field])) { - $onclick .= '4, '; - } else { - $onclick .= '5, '; - } - $onclick .= '\'' . PMA_escapeJsString($field_html) . '\', \'' . $field_md5 . '\', \'' . PMA_escapeJsString($vkey) . '\'); this.checked = true}; return true" />' . "\n"; - echo $onclick; - } else { - echo ' ' . "\n"; - } - } - echo ' ' . "\n"; - - // The value column (depends on type) - // ---------------- - - require './libraries/get_foreign.lib.php'; - - if (isset($foreign_link) && $foreign_link == true) { - ?> - - - - - - - - - - - 32000) { - echo ' ' . "\n"; - } - } elseif ($type == 'enum') { - $enum = PMA_getEnumSetOptions($row_table_def['Type']); - $enum_cnt = count($enum); - ?> - - - - - // We don't want binary data destroyed - elseif ($is_binary || $is_blob) { - if (($cfg['ProtectBinary'] && $is_blob) - || ($cfg['ProtectBinary'] == 'all' && $is_binary)) { - echo "\n"; - ?> - '; - - } // end elseif (binary or blob) - else { - // field size should be at least 4 and max 40 - $fieldsize = min(max($len, 4), 40); - ?> - - - - - - - -
'; -} // end foreach on multi-edit -?> -
- -
-
' . $strFunction . '
align="center">> - - ' . $strBinary . '-- - - - - - - - tabindex="" - id="field__3" - value="" /> - - - - - - -  
- - - - - - ' . $strTextAreaLength . ' - - - 20) { - echo "\n"; - ?> - - '; - echo '' . "\n"; - } // end for - - } // end else - echo "\n"; - ?> - - - - - - - - - - - - - - - - - - tabindex="" - id="field__3" /> - '; - echo ' '; - - // find maximum upload size, based on field type - /** - * @todo with functions this is not so easy, as you can basically - * process any data with function like MD5 - */ - $max_field_sizes = array( - 'tinyblob' => '256', - 'blob' => '65536', - 'mediumblob' => '16777216', - 'longblob' => '4294967296'); // yeah, really - - $this_field_max_size = $max_upload_size; // from PHP max - if ($this_field_max_size > $max_field_sizes[$type]) { - $this_field_max_size = $max_field_sizes[$type]; - } - echo PMA_displayMaximumUploadSize($this_field_max_size) . "\n"; - // do not generate here the MAX_FILE_SIZE, because we should - // put only one in the form to accommodate the biggest field - if ($this_field_max_size > $biggest_max_file_size) { - $biggest_max_file_size = $this_field_max_size; - } - } - - if (!empty($cfg['UploadDir'])) { - $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir'])); - if ($files === FALSE) { - echo ' ' . $strError . '
' . "\n"; - echo ' ' . $strWebServerUploadDirectoryError . "\n"; - } elseif (!empty($files)) { - echo "
\n"; - echo ' ' . $strOr . '' . ' ' . $strWebServerUploadDirectory . ':
' . "\n"; - echo ' ' . "\n"; - } - } // end if (web-server upload directory) - - echo '
- - - - - tabindex="" - id="field__3" /> - - - - - - - - - -
-   -
- - - - - - - - - - -
- - - -        - - -
- - - - -
- - 0) { - echo ' ' . PMA_generateHiddenMaxFileSize($biggest_max_file_size) . "\n"; - } ?> -
- - -
- - - - - $primary_key) { - echo ''. "\n"; - } - } - $tmp = '' . "\n"; - echo "\n" . sprintf($strRestartInsertion, $tmp); - unset($tmp); - echo '' . "\n"; - echo '
' . "\n"; -} - -/** - * Displays the footer - */ -require_once './libraries/footer.inc.php'; -?>