$pma->userlink = $userlink; $pma->controllink = $controllink; /** * some resetting has to be done when switching servers */ if (isset($_SESSION['tmp_user_values']['previous_server']) && $_SESSION['tmp_user_values']['previous_server'] != $GLOBALS['server']) { unset($_SESSION['tmp_user_values']['navi_limit_offset']); } $_SESSION['tmp_user_values']['previous_server'] = $GLOBALS['server']; } // end server connecting /** * check if profiling was requested and remember it * (note: when $cfg['ServerDefault'] = 0, constant is not defined) */ if (isset($_REQUEST['profiling']) && PMA_profilingSupported()) { $_SESSION['profiling'] = true; } elseif (isset($_REQUEST['profiling_form'])) { // the checkbox was unchecked unset($_SESSION['profiling']); } // library file for blobstreaming include_once './libraries/blobstreaming.lib.php'; // checks for blobstreaming plugins and databases that support // blobstreaming (by having the necessary tables for blobstreaming) checkBLOBStreamingPlugins(); } // end if !defined('PMA_MINIMUM_COMMON') // load user preferences $GLOBALS['PMA_Config']->loadUserPreferences(); // remove sensitive values from session
/** * Displays a form with the Profiling checkbox * * @param string $sql_query sql query * * @access public */ function PMA_profilingCheckbox($sql_query) { if (PMA_profilingSupported()) { echo '<form action="sql.php" method="post">' . "\n"; echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n"; echo '<input type="hidden" name="profiling_form" value="1" />' . "\n"; PMA_display_html_checkbox('profiling', __('Profiling'), isset($_SESSION['profiling']), true); echo '<noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n"; echo '</form>' . "\n"; } }
define('PMA_MULTIBYTE_ENCODING', 1); } // end if /** * save some settings in cookies * @todo should be done in PMA_Config */ PMA_setCookie('pma_lang', $GLOBALS['lang']); PMA_setCookie('pma_charset', $GLOBALS['convcharset']); PMA_setCookie('pma_collation_connection', $GLOBALS['collation_connection']); $_SESSION['PMA_Theme_Manager']->setThemeCookie(); /** * check if profiling was requested and remember it * (note: when $cfg['ServerDefault'] = 0, constant is not defined) */ if (PMA_profilingSupported() && isset($_REQUEST['profiling'])) { $_SESSION['profiling'] = true; } elseif (isset($_REQUEST['profiling_form'])) { // the checkbox was unchecked unset($_SESSION['profiling']); } } // end if !defined('PMA_MINIMUM_COMMON') // remove sensitive values from session $_SESSION['PMA_Config']->set('blowfish_secret', ''); $_SESSION['PMA_Config']->set('Servers', ''); $_SESSION['PMA_Config']->set('default_server', ''); if (!empty($__redirect) && in_array($__redirect, $goto_whitelist)) { /** * include subform target page */
exit; } unset($error); // Gets the number of rows affected/returned // (This must be done immediately after the query because // mysql_affected_rows() reports about the last query done) if (! $is_affected) { $num_rows = ($result) ? @PMA_DBI_num_rows($result) : 0; } elseif (! isset($num_rows)) { $num_rows = @PMA_DBI_affected_rows(); } // Grabs the profiling results if (isset($_SESSION['profiling']) && PMA_profilingSupported()) { $profiling_results = PMA_DBI_fetch_result('SHOW PROFILE;'); } // Checks if the current database has changed // This could happen if the user sends a query like "USE `database`;" /** * commented out auto-switching to active database - really required? * bug #1814718 win: table list disappears (mixed case db names) * https://sourceforge.net/support/tracker.php?aid=1814718 * @todo RELEASE test and comit or rollback before release $current_db = PMA_DBI_fetch_value('SELECT DATABASE()'); if ($db !== $current_db) { $db = $current_db; $reload = 1; }
if (!is_numeric($value)) { $value = "'" . $value . "'"; } if (!preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName'])) { PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value); } } $loggingVars = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES WHERE Variable_name IN ("general_log","slow_query_log","long_query_time","log_output")', 0, 1); exit(json_encode($loggingVars)); } if (isset($_REQUEST['query_analyzer'])) { $return = array(); if (strlen($_REQUEST['database'])) { PMA_DBI_select_db($_REQUEST['database']); } if ($profiling = PMA_profilingSupported()) { PMA_DBI_query('SET PROFILING=1;'); } // Do not cache query $query = preg_replace('/^(\\s*SELECT)/i', '\\1 SQL_NO_CACHE', $_REQUEST['query']); $result = PMA_DBI_try_query($query); $return['affectedRows'] = $GLOBALS['cached_affected_rows']; $result = PMA_DBI_try_query('EXPLAIN ' . $query); while ($row = PMA_DBI_fetch_assoc($result)) { $return['explain'][] = $row; } // In case an error happened $return['error'] = PMA_DBI_getError(); PMA_DBI_free_result($result); if ($profiling) { $return['profiling'] = array();
/** * Displays a form with the Profiling checkbox * * @param string $sql_query * @access public * * @author Marc Delisle */ function PMA_profilingCheckbox($sql_query) { if (PMA_profilingSupported()) { echo '<form action="sql.php" method="post">' . "\n"; echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n"; echo '<input type="hidden" name="profiling_form" value="1" />' . "\n"; echo '<input type="checkbox" name="profiling" id="profiling"' . (isset($_SESSION['profiling']) ? ' checked="checked"' : '') . ' onclick="this.form.submit();" /><label for="profiling">' . $GLOBALS['strProfiling'] . '</label>' . "\n"; echo '<noscript><input type="submit" value="' . $GLOBALS['strGo'] . '" /></noscript>' . "\n"; echo '</form>' . "\n"; } }
/** * Displays a form with the Profiling checkbox * * @param string $sql_query sql query * * @return void * * @access public */ function PMA_getProfilingForm($sql_query) { $retval = ''; if (PMA_profilingSupported()) { $retval .= '<form action="sql.php" method="post">' . "\n"; $retval .= PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); $retval .= '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n"; $retval .= '<input type="hidden" name="profiling_form" value="1" />' . "\n"; $retval .= PMA_getCheckbox('profiling', __('Profiling'), isset($_SESSION['profiling']), true); $retval .= ' </form>' . "\n"; } return $retval; }