getHeader(); $scripts = $header->getScripts(); $scripts->addFile('jquery/jquery-ui-timepicker-addon.js'); $scripts->addFile('tbl_change.js'); // the next one needed because sql.php may do a "goto" to tbl_structure.php $scripts->addFile('tbl_structure.js'); $scripts->addFile('indexes.js'); $scripts->addFile('gis_data_editor.js'); /** * Set ajax_reload in the response if it was already set */ if (isset($ajax_reload) && $ajax_reload['reload'] === true) { $response->addJSON('ajax_reload', $ajax_reload); } /** * Sets globals from $_POST */ $post_params = array( 'bkm_all_users', 'fields', 'store_bkm' ); foreach ($post_params as $one_post_param) { if (isset($_POST[$one_post_param])) { $GLOBALS[$one_post_param] = $_POST[$one_post_param]; } } /** * Sets globals from $_GET */ $get_params = array( 'id_bookmark', 'label', 'sql_query' ); foreach ($get_params as $one_get_param) { if (isset($_GET[$one_get_param])) { $GLOBALS[$one_get_param] = $_GET[$one_get_param]; } } if (isset($_REQUEST['printview'])) { $GLOBALS['printview'] = $_REQUEST['printview']; } if (!isset($_SESSION['is_multi_query'])) { $_SESSION['is_multi_query'] = false; } /** * Defines the url to return to in case of error in a sql statement */ // Security checkings if (! empty($goto)) { $is_gotofile = preg_replace('@^([^?]+).*$@s', '\\1', $goto); if (! @file_exists('' . $is_gotofile)) { unset($goto); } else { $is_gotofile = ($is_gotofile == $goto); } } else { if (empty($table)) { $goto = $cfg['DefaultTabDatabase']; } else { $goto = $cfg['DefaultTabTable']; } $is_gotofile = true; } // end if if (! isset($err_url)) { $err_url = (! empty($back) ? $back : $goto) . '?' . PMA_generate_common_url($db) . ((strpos(' ' . $goto, 'db_') != 1 && strlen($table)) ? '&table=' . urlencode($table) : '' ); } // end if // Coming from a bookmark dialog if (isset($fields['query'])) { $sql_query = $fields['query']; } // This one is just to fill $db if (isset($fields['dbase'])) { $db = $fields['dbase']; } /** * During grid edit, if we have a relational field, show the dropdown for it * * Logic taken from libraries/DisplayResults.class.php * * This doesn't seem to be the right place to do this, but I can't think of any * better place either. */ if (isset($_REQUEST['get_relational_values']) && $_REQUEST['get_relational_values'] == true ) { $column = $_REQUEST['column']; $foreigners = PMA_getForeigners($db, $table, $column); $display_field = PMA_getDisplayField( $foreigners[$column]['foreign_db'], $foreigners[$column]['foreign_table'] ); $foreignData = PMA_getForeignData($foreigners, $column, false, '', ''); if ($_SESSION['tmp_user_values']['relational_display'] == 'D' && isset($display_field) && strlen($display_field) && isset($_REQUEST['relation_key_or_display_column']) && $_REQUEST['relation_key_or_display_column'] ) { $curr_value = $_REQUEST['relation_key_or_display_column']; } else { $curr_value = $_REQUEST['curr_value']; } if ($foreignData['disp_row'] == null) { //Handle the case when number of values //is more than $cfg['ForeignKeyMaxLimit'] $_url_params = array( 'db' => $db, 'table' => $table, 'field' => $column ); $dropdown = '' . htmlspecialchars($_REQUEST['curr_value']) . '' . '' . __('Browse foreign values') . ''; } else { $dropdown = PMA_foreignDropdown( $foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], $curr_value, $cfg['ForeignKeyMaxLimit'] ); $dropdown = ''; } $response = PMA_Response::getInstance(); $response->addJSON('dropdown', $dropdown); exit; } /** * Just like above, find possible values for enum fields during grid edit. * * Logic taken from libraries/DisplayResults.class.php */ if (isset($_REQUEST['get_enum_values']) && $_REQUEST['get_enum_values'] == true) { $field_info_query = PMA_DBI_get_columns_sql($db, $table, $_REQUEST['column']); $field_info_result = PMA_DBI_fetch_result( $field_info_query, null, null, null, PMA_DBI_QUERY_STORE ); $values = PMA_Util::parseEnumSetValues($field_info_result[0]['Type']); $dropdown = ''; foreach ($values as $value) { $dropdown .= '