Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
44ed411ba2
@ -206,6 +206,8 @@ $js_messages['strAffectedRows'] = __('Affected rows:');
|
||||
$js_messages['strFailedParsingConfig'] = __('Failed parsing config file. It doesn\'t seem to be valid JSON code.');
|
||||
$js_messages['strFailedBuildingGrid'] = __('Failed building chart grid with imported config. Resetting to default config...');
|
||||
$js_messages['strImport'] = __('Import');
|
||||
$js_messages['strImportDialogTitle'] = __('Import monitor configuration');
|
||||
$js_messages['strImportDialogMessage'] = __('Please select the file you want to import');
|
||||
|
||||
$js_messages['strAnalyzeQuery'] = __('Analyse Query');
|
||||
|
||||
|
||||
@ -516,8 +516,8 @@ $(function() {
|
||||
});
|
||||
|
||||
$('a[href="#importMonitorConfig"]').click(function() {
|
||||
$('div#emptyDialog').attr('title', 'Import monitor configuration');
|
||||
$('div#emptyDialog').html('Please select the file you want to import:<br/><form action="file_echo.php?' + url_query + '&import=1" method="post" enctype="multipart/form-data">' +
|
||||
$('div#emptyDialog').attr('title', PMA_messages['strImportDialogTitle']);
|
||||
$('div#emptyDialog').html(PMA_messages['strImportDialogMessage'] + ':<br/><form action="file_echo.php?' + url_query + '&import=1" method="post" enctype="multipart/form-data">' +
|
||||
'<input type="file" name="file"> <input type="hidden" name="import" value="1"> </form>');
|
||||
|
||||
var dlgBtns = {};
|
||||
|
||||
@ -362,7 +362,8 @@ class PMA_Theme
|
||||
*
|
||||
* @return string CSS code.
|
||||
*/
|
||||
function getCssIEClearFilter() {
|
||||
function getCssIEClearFilter()
|
||||
{
|
||||
return PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 6 && PMA_USR_BROWSER_VER <= 8
|
||||
? 'filter: none'
|
||||
: '';
|
||||
|
||||
@ -328,7 +328,8 @@ class ConfigFile
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
public function getCanonicalPath($path) {
|
||||
public function getCanonicalPath($path)
|
||||
{
|
||||
return preg_replace('#^Servers/([\d]+)/#', 'Servers/1/', $path);
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,8 @@
|
||||
*/
|
||||
|
||||
// TODO: drizzle module segfaults while freeing resources, often. This allows at least for some development
|
||||
function _drizzle_shutdown_flush() {
|
||||
function _drizzle_shutdown_flush()
|
||||
{
|
||||
flush();
|
||||
}
|
||||
register_shutdown_function('_drizzle_shutdown_flush');
|
||||
@ -130,7 +131,7 @@ class PMA_Drizzle extends Drizzle
|
||||
|
||||
/**
|
||||
* Creates a new connection using unix domain socket
|
||||
*
|
||||
*
|
||||
* @param $uds
|
||||
* @param $user
|
||||
* @param $password
|
||||
@ -211,7 +212,7 @@ class PMA_DrizzleCon
|
||||
|
||||
/**
|
||||
* Pass calls of undefined methods to DrizzleCon object
|
||||
*
|
||||
*
|
||||
* @param $method
|
||||
* @param $args
|
||||
* @return mixed
|
||||
|
||||
@ -229,7 +229,8 @@ function PMA_DBI_free_result($result)
|
||||
*
|
||||
* @return bool false
|
||||
*/
|
||||
function PMA_DBI_more_results() {
|
||||
function PMA_DBI_more_results()
|
||||
{
|
||||
// N.B.: PHP's 'mysql' extension does not support
|
||||
// multi_queries so this function will always
|
||||
// return false. Use the 'mysqli' extension, if
|
||||
@ -242,7 +243,8 @@ function PMA_DBI_more_results() {
|
||||
*
|
||||
* @return bool false
|
||||
*/
|
||||
function PMA_DBI_next_result() {
|
||||
function PMA_DBI_next_result()
|
||||
{
|
||||
// N.B.: PHP's 'mysql' extension does not support
|
||||
// multi_queries so this function will always
|
||||
// return false. Use the 'mysqli' extension, if
|
||||
|
||||
@ -42,7 +42,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -53,7 +54,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
global $what;
|
||||
global $csv_terminated;
|
||||
global $csv_separator;
|
||||
@ -101,7 +103,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -113,7 +116,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -125,7 +129,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -141,7 +146,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $what;
|
||||
global $csv_terminated;
|
||||
global $csv_separator;
|
||||
|
||||
@ -41,7 +41,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
return PMA_exportOutputHandler('</body></html>');
|
||||
}
|
||||
|
||||
@ -52,7 +53,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
global $charset_of_file;
|
||||
return PMA_exportOutputHandler('<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:x="urn:schemas-microsoft-com:office:word"
|
||||
@ -74,7 +76,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return PMA_exportOutputHandler('<h1>' . __('Database') . ' ' . htmlspecialchars($db) . '</h1>');
|
||||
}
|
||||
|
||||
@ -86,7 +89,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -98,7 +102,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -42,7 +43,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -54,7 +56,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -66,7 +69,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -78,7 +82,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -94,7 +99,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
$columns = array_values($columns);
|
||||
$row_cnt = count($columns);
|
||||
|
||||
@ -40,7 +40,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
$GLOBALS['ods_buffer'] .= '</office:spreadsheet>'
|
||||
. '</office:body>'
|
||||
. '</office:document-content>';
|
||||
@ -57,7 +58,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
$GLOBALS['ods_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
|
||||
. '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
|
||||
. '<office:automatic-styles>'
|
||||
@ -107,7 +109,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -119,7 +122,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -131,7 +135,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -147,7 +152,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $what;
|
||||
|
||||
// Gets the data from the database
|
||||
|
||||
@ -39,7 +39,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -50,7 +51,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -62,7 +64,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return PMA_exportOutputHandler('===' . __('Database') . ' ' . $db . "\n\n");
|
||||
}
|
||||
|
||||
@ -74,7 +77,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -86,7 +90,8 @@ if (isset($plugin_list)) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,8 @@ if (isset($plugin_list)) {
|
||||
// Returns specified number of bytes from the buffer.
|
||||
// Buffer automatically fetches next chunk of data when the buffer falls short.
|
||||
// Sets $eof when $GLOBALS['finished'] is set and the buffer falls short.
|
||||
function readFromBuffer($length){
|
||||
function readFromBuffer($length)
|
||||
{
|
||||
global $buffer, $eof;
|
||||
|
||||
if (strlen($buffer) < $length) {
|
||||
|
||||
@ -149,7 +149,8 @@ function PMA_sanitize($message, $escape = false, $safe = false)
|
||||
* @return string the sanitized filename
|
||||
*
|
||||
*/
|
||||
function PMA_sanitize_filename($filename) {
|
||||
function PMA_sanitize_filename($filename)
|
||||
{
|
||||
$filename = preg_replace('/[^A-Za-z0-9_.-]/', '_', $filename);
|
||||
return $filename;
|
||||
}
|
||||
|
||||
@ -32,13 +32,15 @@ class WINNT
|
||||
|
||||
public $os = 'WINNT';
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// initialize the wmi object
|
||||
$objLocator = new COM('WbemScripting.SWbemLocator');
|
||||
$this->_wmi = $objLocator->ConnectServer();
|
||||
}
|
||||
|
||||
function loadavg() {
|
||||
function loadavg()
|
||||
{
|
||||
$loadavg = "";
|
||||
$sum = 0;
|
||||
$buffer = $this->_getWMI('Win32_Processor', array('LoadPercentage'));
|
||||
@ -52,7 +54,8 @@ class WINNT
|
||||
return array('loadavg' => $sum / count($buffer));
|
||||
}
|
||||
|
||||
private function _getWMI($strClass, $strValue = array()) {
|
||||
private function _getWMI($strClass, $strValue = array())
|
||||
{
|
||||
$arrData = array();
|
||||
$value = "";
|
||||
|
||||
@ -81,7 +84,8 @@ class WINNT
|
||||
}
|
||||
|
||||
|
||||
function memory() {
|
||||
function memory()
|
||||
{
|
||||
$buffer = $this->_getWMI("Win32_OperatingSystem", array('TotalVisibleMemorySize', 'FreePhysicalMemory'));
|
||||
$mem = Array();
|
||||
$mem['MemTotal'] = $buffer[0]['TotalVisibleMemorySize'];
|
||||
@ -108,13 +112,15 @@ class Linux
|
||||
{
|
||||
public $os = 'Linux';
|
||||
|
||||
function loadavg() {
|
||||
function loadavg()
|
||||
{
|
||||
$buf = file_get_contents('/proc/stat');
|
||||
$nums=preg_split("/\s+/", substr($buf, 0, strpos($buf, "\n")));
|
||||
return Array('busy' => $nums[1]+$nums[2]+$nums[3], 'idle' => intval($nums[4]));
|
||||
}
|
||||
|
||||
function memory() {
|
||||
function memory()
|
||||
{
|
||||
preg_match_all('/^(MemTotal|MemFree|Cached|Buffers|SwapCached|SwapTotal|SwapFree):\s+(.*)\s*kB/im', file_get_contents('/proc/meminfo'), $matches);
|
||||
|
||||
$mem = array_combine( $matches[1], $matches[2] );
|
||||
|
||||
@ -5,14 +5,15 @@
|
||||
* Has one option: the text to be appended (default '')
|
||||
*/
|
||||
|
||||
function PMA_transformation_text_plain__append_info() {
|
||||
function PMA_transformation_text_plain__append_info()
|
||||
{
|
||||
return array(
|
||||
'info' => __('Appends text to a string. The only option is the text to be appended (enclosed in single quotes, default empty string).'),
|
||||
);
|
||||
}
|
||||
|
||||
function PMA_transformation_text_plain__append($buffer, $options = array(), $meta = '') {
|
||||
|
||||
function PMA_transformation_text_plain__append($buffer, $options = array(), $meta = '')
|
||||
{
|
||||
if (! isset($options[0]) || $options[0] == '') {
|
||||
$options[0] = '';
|
||||
}
|
||||
|
||||
@ -63,7 +63,8 @@ foreach ($mysql_charsets as $current_charset) {
|
||||
. (empty($mysql_charsets_descriptions[$current_charset])
|
||||
? ''
|
||||
: ' (<i>' . htmlspecialchars(
|
||||
$mysql_charsets_descriptions[$current_charset]) . '</i>)' . "\n")
|
||||
$mysql_charsets_descriptions[$current_charset]
|
||||
) . '</i>)' . "\n")
|
||||
. ' </th>' . "\n"
|
||||
. '</tr>' . "\n";
|
||||
$odd_row = true;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
require 'libraries/server_common.inc.php';
|
||||
if (!PMA_DRIZZLE) {
|
||||
if (! PMA_DRIZZLE) {
|
||||
include_once 'libraries/replication.inc.php';
|
||||
} else {
|
||||
$replication_types = array();
|
||||
@ -57,7 +57,8 @@ if (empty($_REQUEST['sort_by'])) {
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['sort_order'])
|
||||
&& strtolower($_REQUEST['sort_order']) == 'desc') {
|
||||
&& strtolower($_REQUEST['sort_order']) == 'desc'
|
||||
) {
|
||||
$sort_order = 'desc';
|
||||
} else {
|
||||
$sort_order = 'asc';
|
||||
@ -78,7 +79,8 @@ if (isset($_REQUEST['drop_selected_dbs_x'])) {
|
||||
}
|
||||
|
||||
if ((isset($_REQUEST['drop_selected_dbs']) || isset($_REQUEST['query_type']))
|
||||
&& ($is_superuser || $cfg['AllowUserDropDatabase'])) {
|
||||
&& ($is_superuser || $cfg['AllowUserDropDatabase'])
|
||||
) {
|
||||
if (! isset($_REQUEST['selected_dbs']) && ! isset($_REQUEST['query_type'])) {
|
||||
$message = PMA_Message::error(__('No databases selected.'));
|
||||
} else {
|
||||
@ -131,8 +133,9 @@ if ($cfg['ShowCreateDb']) {
|
||||
* Gets the databases list
|
||||
*/
|
||||
if ($server > 0) {
|
||||
$databases = PMA_DBI_get_databases_full(null, $dbstats, null, $sort_by,
|
||||
$sort_order, $pos, true);
|
||||
$databases = PMA_DBI_get_databases_full(
|
||||
null, $dbstats, null, $sort_by, $sort_order, $pos, true
|
||||
);
|
||||
$databases_count = count($GLOBALS['pma']->databases);
|
||||
} else {
|
||||
$databases_count = 0;
|
||||
@ -203,7 +206,7 @@ if ($databases_count > 0) {
|
||||
echo ' <th>'. $name .'</th>' . "\n";
|
||||
}
|
||||
|
||||
if ($is_superuser && !PMA_DRIZZLE) {
|
||||
if ($is_superuser && ! PMA_DRIZZLE) {
|
||||
echo ' <th>' . ($cfg['PropertiesIconic'] ? '' : __('Action')) . "\n"
|
||||
. ' </th>' . "\n";
|
||||
}
|
||||
|
||||
@ -27,7 +27,8 @@ require 'libraries/server_links.inc.php';
|
||||
* Did the user request information about a certain storage engine?
|
||||
*/
|
||||
if (empty($_REQUEST['engine'])
|
||||
|| ! PMA_StorageEngine::isValid($_REQUEST['engine'])) {
|
||||
|| ! PMA_StorageEngine::isValid($_REQUEST['engine'])
|
||||
) {
|
||||
|
||||
/**
|
||||
* Displays the sub-page heading
|
||||
@ -70,7 +71,7 @@ if (empty($_REQUEST['engine'])
|
||||
$odd_row = !$odd_row;
|
||||
}
|
||||
|
||||
unset($odd_row, $engine, $details);
|
||||
unset($odd_row, $engine, $details);
|
||||
echo '</tbody>' . "\n"
|
||||
. '</table>' . "\n";
|
||||
|
||||
@ -92,15 +93,15 @@ if (empty($_REQUEST['engine'])
|
||||
. ' </em>' . "\n"
|
||||
. '</p>' . "\n\n";
|
||||
$infoPages = $engine_plugin->getInfoPages();
|
||||
if (!empty($infoPages) && is_array($infoPages)) {
|
||||
if (! empty($infoPages) && is_array($infoPages)) {
|
||||
echo '<p>' . "\n"
|
||||
. ' <strong>[</strong>' . "\n";
|
||||
if (empty($_REQUEST['page'])) {
|
||||
echo ' <strong>' . __('Variables') . '</strong>' . "\n";
|
||||
} else {
|
||||
echo ' <a href="server_engines.php'
|
||||
. PMA_generate_common_url(array('engine' => $_REQUEST['engine'])) . '">'
|
||||
. __('Variables') . '</a>' . "\n";
|
||||
. PMA_generate_common_url(array('engine' => $_REQUEST['engine']))
|
||||
. '">' . __('Variables') . '</a>' . "\n";
|
||||
}
|
||||
foreach ($infoPages as $current => $label) {
|
||||
echo ' <strong>|</strong>' . "\n";
|
||||
@ -109,7 +110,8 @@ if (empty($_REQUEST['engine'])
|
||||
} else {
|
||||
echo ' <a href="server_engines.php'
|
||||
. PMA_generate_common_url(
|
||||
array('engine' => $_REQUEST['engine'], 'page' => $current))
|
||||
array('engine' => $_REQUEST['engine'], 'page' => $current)
|
||||
)
|
||||
. '">' . htmlspecialchars($label) . '</a>' . "\n";
|
||||
}
|
||||
}
|
||||
@ -118,10 +120,10 @@ if (empty($_REQUEST['engine'])
|
||||
. '</p>' . "\n\n";
|
||||
}
|
||||
unset($infoPages, $page_output);
|
||||
if (!empty($_REQUEST['page'])) {
|
||||
if (! empty($_REQUEST['page'])) {
|
||||
$page_output = $engine_plugin->getPage($_REQUEST['page']);
|
||||
}
|
||||
if (!empty($page_output)) {
|
||||
if (! empty($page_output)) {
|
||||
echo $page_output;
|
||||
} else {
|
||||
echo '<p> ' . $engine_plugin->getSupportInformationMessage() . "\n"
|
||||
|
||||
@ -43,13 +43,16 @@ foreach ($GLOBALS['pma']->databases as $current_db) {
|
||||
} else {
|
||||
$is_selected = '';
|
||||
}
|
||||
} elseif (!empty($selectall) || (isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))) {
|
||||
} elseif (! empty($selectall)
|
||||
|| (isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))
|
||||
) {
|
||||
$is_selected = ' selected="selected"';
|
||||
} else {
|
||||
$is_selected = '';
|
||||
}
|
||||
$current_db = htmlspecialchars($current_db);
|
||||
$multi_values .= ' <option value="' . $current_db . '"' . $is_selected . '>' . $current_db . '</option>' . "\n";
|
||||
$multi_values .= ' <option value="' . $current_db . '"'
|
||||
. $is_selected . '>' . $current_db . '</option>' . "\n";
|
||||
} // end while
|
||||
$multi_values .= "\n";
|
||||
$multi_values .= '</select></div>';
|
||||
|
||||
@ -1652,14 +1652,15 @@ if (isset($_REQUEST['export']) || (isset($_REQUEST['submit_mult']) && $_REQUEST[
|
||||
foreach ($_REQUEST['selected_usr'] as $export_user) {
|
||||
$export_username = substr($export_user, 0, strpos($export_user, '&'));
|
||||
$export_hostname = substr($export_user, strrpos($export_user, ';') + 1);
|
||||
$response .= '# ' .
|
||||
sprintf(__('Privileges for %s'),
|
||||
'`' . htmlspecialchars($export_username) . '`@`' . htmlspecialchars($export_hostname) . '`')
|
||||
$response .= '# '
|
||||
. sprintf(
|
||||
__('Privileges for %s'),
|
||||
'`' . htmlspecialchars($export_username) . '`@`' . htmlspecialchars($export_hostname) . '`'
|
||||
)
|
||||
. "\n\n";
|
||||
$response .= PMA_getGrants($export_username, $export_hostname) . "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// export privileges for a single user
|
||||
$title = __('User') . ' `' . htmlspecialchars($username) . '`@`' . htmlspecialchars($hostname) . '`';
|
||||
$response .= PMA_getGrants($username, $hostname);
|
||||
|
||||
@ -40,8 +40,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
|
||||
exit(json_encode($ret));
|
||||
|
||||
// Query realtime chart
|
||||
case 'queries':
|
||||
case 'queries': // Query realtime chart
|
||||
if (PMA_DRIZZLE) {
|
||||
$sql = "SELECT concat('Com_', variable_name), variable_value
|
||||
FROM data_dictionary.GLOBAL_STATEMENTS
|
||||
@ -73,8 +72,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
|
||||
exit(json_encode($ret));
|
||||
|
||||
// Traffic realtime chart
|
||||
case 'traffic':
|
||||
case 'traffic': // Traffic realtime chart
|
||||
$traffic = PMA_DBI_fetch_result(
|
||||
"SHOW GLOBAL STATUS
|
||||
WHERE Variable_name = 'Bytes_received'
|
||||
@ -89,8 +87,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
|
||||
exit(json_encode($ret));
|
||||
|
||||
// Data for the monitor
|
||||
case 'chartgrid':
|
||||
case 'chartgrid': // Data for the monitor
|
||||
$ret = json_decode($_REQUEST['requiredData'], true);
|
||||
$statusVars = array();
|
||||
$serverVars = array();
|
||||
@ -113,13 +110,13 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
* Also do some white list filtering on the names
|
||||
*/
|
||||
case 'servervar':
|
||||
if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
|
||||
if (! preg_match('/[^a-zA-Z_]+/', $pName)) {
|
||||
$serverVars[] = $pName;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'statusvar':
|
||||
if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
|
||||
if (! preg_match('/[^a-zA-Z_]+/', $pName)) {
|
||||
$statusVars[] = $pName;
|
||||
}
|
||||
break;
|
||||
@ -144,9 +141,10 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
= $cpuload['idle'];
|
||||
$ret[$chart_id][$node_id][$point_id]['busy']
|
||||
= $cpuload['busy'];
|
||||
} else
|
||||
} else {
|
||||
$ret[$chart_id][$node_id][$point_id]['value']
|
||||
= $cpuload['loadavg'];
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -257,7 +255,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isset($return['sum'][$type])) {
|
||||
if (! isset($return['sum'][$type])) {
|
||||
$return['sum'][$type] = 0;
|
||||
}
|
||||
$return['sum'][$type] += $row['#'];
|
||||
@ -298,7 +296,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
preg_match('/^(\w+)\s/', $row['argument'], $match);
|
||||
$type = strtolower($match[1]);
|
||||
|
||||
if (!isset($return['sum'][$type])) {
|
||||
if (! isset($return['sum'][$type])) {
|
||||
$return['sum'][$type] = 0;
|
||||
}
|
||||
$return['sum'][$type] += $row['#'];
|
||||
@ -356,7 +354,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
if (isset($_REQUEST['logging_vars'])) {
|
||||
if (isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) {
|
||||
$value = PMA_sqlAddslashes($_REQUEST['varValue']);
|
||||
if (!is_numeric($value)) {
|
||||
if (! is_numeric($value)) {
|
||||
$value="'" . $value . "'";
|
||||
}
|
||||
|
||||
@ -467,7 +465,7 @@ if (isset($_REQUEST['flush'])) {
|
||||
/**
|
||||
* Kills a selected process
|
||||
*/
|
||||
if (!empty($_REQUEST['kill'])) {
|
||||
if (! empty($_REQUEST['kill'])) {
|
||||
if (PMA_DBI_try_query('KILL ' . $_REQUEST['kill'] . ';')) {
|
||||
$message = PMA_Message::success(__('Thread %s was successfully killed.'));
|
||||
} else {
|
||||
@ -1120,35 +1118,41 @@ function printServerTraffic()
|
||||
<tr class="odd">
|
||||
<th class="name"><?php echo __('Received'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
implode(' ',
|
||||
PMA_formatByteDown($server_status['Bytes_received'], 3, 1)); ?></td>
|
||||
implode(
|
||||
' ', PMA_formatByteDown($server_status['Bytes_received'], 3, 1)
|
||||
); ?></td>
|
||||
<td class="value"><?php echo
|
||||
implode(' ',
|
||||
PMA_formatByteDown(
|
||||
$server_status['Bytes_received'] * $hour_factor, 3, 1)); ?></td>
|
||||
implode(
|
||||
' ', PMA_formatByteDown($server_status['Bytes_received'] * $hour_factor, 3, 1)
|
||||
); ?></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<th class="name"><?php echo __('Sent'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
implode(' ',
|
||||
PMA_formatByteDown($server_status['Bytes_sent'], 3, 1)); ?></td>
|
||||
implode(
|
||||
' ', PMA_formatByteDown($server_status['Bytes_sent'], 3, 1)
|
||||
); ?></td>
|
||||
<td class="value"><?php echo
|
||||
implode(' ',
|
||||
PMA_formatByteDown(
|
||||
$server_status['Bytes_sent'] * $hour_factor, 3, 1)); ?></td>
|
||||
implode(
|
||||
' ', PMA_formatByteDown($server_status['Bytes_sent'] * $hour_factor, 3, 1)
|
||||
); ?></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<th class="name"><?php echo __('Total'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
implode(' ',
|
||||
implode(
|
||||
' ',
|
||||
PMA_formatByteDown(
|
||||
$server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1)
|
||||
$server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1
|
||||
)
|
||||
); ?></td>
|
||||
<td class="value"><?php echo
|
||||
implode(' ',
|
||||
implode(
|
||||
' ',
|
||||
PMA_formatByteDown(
|
||||
($server_status['Bytes_received'] + $server_status['Bytes_sent'])
|
||||
* $hour_factor, 3, 1)
|
||||
* $hour_factor, 3, 1
|
||||
)
|
||||
); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -1175,36 +1179,41 @@ function printServerTraffic()
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($server_status['Aborted_connects'], 4, 1, true); ?></td>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($server_status['Aborted_connects'] * $hour_factor,
|
||||
4, 2, true); ?></td>
|
||||
PMA_formatNumber(
|
||||
$server_status['Aborted_connects'] * $hour_factor, 4, 2, true
|
||||
); ?></td>
|
||||
<td class="value"><?php echo
|
||||
$server_status['Connections'] > 0
|
||||
? PMA_formatNumber(
|
||||
? PMA_formatNumber(
|
||||
$server_status['Aborted_connects'] * 100 / $server_status['Connections'],
|
||||
0, 2, true) . '%'
|
||||
: '--- '; ?></td>
|
||||
0, 2, true
|
||||
) . '%'
|
||||
: '--- '; ?></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<th class="name"><?php echo __('Aborted'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($server_status['Aborted_clients'], 4, 1, true); ?></td>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($server_status['Aborted_clients'] * $hour_factor,
|
||||
4, 2, true); ?></td>
|
||||
PMA_formatNumber(
|
||||
$server_status['Aborted_clients'] * $hour_factor, 4, 2, true
|
||||
); ?></td>
|
||||
<td class="value"><?php echo
|
||||
$server_status['Connections'] > 0
|
||||
? PMA_formatNumber(
|
||||
? PMA_formatNumber(
|
||||
$server_status['Aborted_clients'] * 100 / $server_status['Connections'],
|
||||
0, 2, true) . '%'
|
||||
: '--- '; ?></td>
|
||||
0, 2, true
|
||||
) . '%'
|
||||
: '--- '; ?></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<th class="name"><?php echo __('Total'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($server_status['Connections'], 4, 0); ?></td>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($server_status['Connections'] * $hour_factor,
|
||||
4, 2); ?></td>
|
||||
PMA_formatNumber(
|
||||
$server_status['Connections'] * $hour_factor, 4, 2
|
||||
); ?></td>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber(100, 0, 2); ?>%</td>
|
||||
</tr>
|
||||
@ -1214,7 +1223,7 @@ function printServerTraffic()
|
||||
|
||||
$url_params = array();
|
||||
|
||||
$show_full_sql = !empty($_REQUEST['full']);
|
||||
$show_full_sql = ! empty($_REQUEST['full']);
|
||||
if ($show_full_sql) {
|
||||
$url_params['full'] = 1;
|
||||
$full_text_link = 'server_status.php' . PMA_generate_common_url(array(), 'html', '?');
|
||||
@ -1579,7 +1588,7 @@ function printMonitor()
|
||||
<?php echo PMA_getImage('s_cog.png'); ?>
|
||||
<?php echo __('Settings'); ?>
|
||||
</a>
|
||||
<?php if (!PMA_DRIZZLE) { ?>
|
||||
<?php if (! PMA_DRIZZLE) { ?>
|
||||
<a href="#monitorInstructionsDialog">
|
||||
<?php echo PMA_getImage('b_help.png'); ?>
|
||||
<?php echo __('Instructions/Setup'); ?>
|
||||
@ -1729,7 +1738,7 @@ function printMonitor()
|
||||
<div id="emptyDialog" title="Dialog" style="display:none;">
|
||||
</div>
|
||||
|
||||
<?php if (!PMA_DRIZZLE) { ?>
|
||||
<?php if (! PMA_DRIZZLE) { ?>
|
||||
<div id="logAnalyseDialog" title="<?php echo __('Log statistics'); ?>" style="display:none;">
|
||||
<p> <?php echo __('Selected time range:'); ?>
|
||||
<input type="text" name="dateStart" class="datetimefield" value="" /> -
|
||||
|
||||
@ -315,8 +315,9 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
* Calculating the number of updates for each matching table
|
||||
*/
|
||||
if (isset($update_array[$i]) && isset($update_array[$i][0])
|
||||
&& !empty($matching_tables_keys[$i][0])
|
||||
&& isset($update_array[$i][0][$matching_tables_keys[$i][0]])) {
|
||||
&& ! empty($matching_tables_keys[$i][0])
|
||||
&& isset($update_array[$i][0][$matching_tables_keys[$i][0]])
|
||||
) {
|
||||
$num_of_updates = sizeof($update_array[$i]);
|
||||
} else {
|
||||
$num_of_updates = 0;
|
||||
@ -325,8 +326,9 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
* Calculating the number of insertions for each matching table
|
||||
*/
|
||||
if (isset($insert_array[$i]) && isset($insert_array[$i][0])
|
||||
&& !empty($matching_tables_keys[$i])
|
||||
&& isset($insert_array[$i][0][$matching_tables_keys[$i][0]])) {
|
||||
&& ! empty($matching_tables_keys[$i])
|
||||
&& isset($insert_array[$i][0][$matching_tables_keys[$i][0]])
|
||||
) {
|
||||
$num_of_insertions = sizeof($insert_array[$i]);
|
||||
} else {
|
||||
$num_of_insertions = 0;
|
||||
@ -386,7 +388,7 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
*/
|
||||
if ((isset($update_array[$i])
|
||||
|| isset($insert_array[$i]))
|
||||
&& !empty($matching_tables_keys[$i])
|
||||
&& ! empty($matching_tables_keys[$i])
|
||||
) {
|
||||
if (isset($update_array[$i][0][$matching_tables_keys[$i][0]])
|
||||
|| isset($insert_array[$i][0][$matching_tables_keys[$i][0]])
|
||||
@ -839,7 +841,7 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
$btn_structure_params = array($i, $num_alter_cols, $num_insert_cols,
|
||||
$num_remove_cols, $num_add_index, $num_remove_index);
|
||||
}
|
||||
if (!(in_array($i, $matching_table_data_diff))) {
|
||||
if (! (in_array($i, $matching_table_data_diff))) {
|
||||
if (isset($matching_tables_keys[$i][0])
|
||||
&& isset($update_array[$i][0][$matching_tables_keys[$i][0]])
|
||||
) {
|
||||
@ -1033,9 +1035,9 @@ if (isset($_REQUEST['synchronize_db'])) {
|
||||
$target_indexes = $_SESSION['target_indexes'];
|
||||
$uncommon_cols = $uncommon_columns;
|
||||
|
||||
/**
|
||||
* Display success message.
|
||||
*/
|
||||
/**
|
||||
* Display success message.
|
||||
*/
|
||||
echo '<div class="success">'
|
||||
. __('Target database has been synchronized with source database')
|
||||
. '</div>';
|
||||
@ -1219,9 +1221,9 @@ if (! isset($_REQUEST['submit_connect'])
|
||||
&& ! isset($_REQUEST['synchronize_db'])
|
||||
&& ! isset($_REQUEST['Table_ids'])
|
||||
) {
|
||||
/**
|
||||
* Displays the sub-page heading
|
||||
*/
|
||||
/**
|
||||
* Displays the sub-page heading
|
||||
*/
|
||||
echo '<h2>' . PMA_getImage('s_sync.png') . __('Synchronize') .'</h2>';
|
||||
|
||||
echo '<div id="serverstatus">
|
||||
@ -1293,17 +1295,18 @@ if (! isset($_REQUEST['submit_connect'])
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($tmp_server['verbose'])) {
|
||||
if (! empty($tmp_server['verbose'])) {
|
||||
$label = $tmp_server['verbose'];
|
||||
} else {
|
||||
$label = $tmp_server['host'];
|
||||
if (!empty($tmp_server['port'])) {
|
||||
if (! empty($tmp_server['port'])) {
|
||||
$label .= ':' . $tmp_server['port'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($loaded_dbi == 'drizzle' && $tmp_server['extension'] != 'drizzle'
|
||||
|| $loaded_dbi != 'drizzle' && $tmp_server['extension'] == 'drizzle') {
|
||||
|| $loaded_dbi != 'drizzle' && $tmp_server['extension'] == 'drizzle'
|
||||
) {
|
||||
// incompatible connection protocols
|
||||
$disabled = ' disabled="disabled"';
|
||||
$value = '';
|
||||
@ -1377,9 +1380,9 @@ if (! isset($_REQUEST['submit_connect'])
|
||||
unset($options_list);
|
||||
}
|
||||
echo '</td> </tr>
|
||||
</table>';
|
||||
}
|
||||
unset ($types, $type);
|
||||
</table>';
|
||||
}
|
||||
unset ($types, $type);
|
||||
|
||||
echo '
|
||||
</fieldset>
|
||||
|
||||
@ -34,46 +34,64 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
|
||||
if (isset($_REQUEST['type'])) {
|
||||
switch($_REQUEST['type']) {
|
||||
case 'getval':
|
||||
$varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="' . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM');
|
||||
if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
|
||||
&& $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte') {
|
||||
exit(implode(' ', PMA_formatByteDown($varValue[1], 3, 3)));
|
||||
}
|
||||
exit($varValue[1]);
|
||||
break;
|
||||
case 'getval':
|
||||
$varValue = PMA_DBI_fetch_single_row(
|
||||
'SHOW GLOBAL VARIABLES WHERE Variable_name="'
|
||||
. PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM'
|
||||
);
|
||||
if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
|
||||
&& $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte'
|
||||
) {
|
||||
exit(implode(' ', PMA_formatByteDown($varValue[1], 3, 3)));
|
||||
}
|
||||
exit($varValue[1]);
|
||||
break;
|
||||
|
||||
case 'setval':
|
||||
$value = $_REQUEST['varValue'];
|
||||
case 'setval':
|
||||
$value = $_REQUEST['varValue'];
|
||||
|
||||
if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
|
||||
&& $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte'
|
||||
&& preg_match('/^\s*(\d+(\.\d+)?)\s*(mb|kb|mib|kib|gb|gib)\s*$/i', $value, $matches)) {
|
||||
$exp = array('kb' => 1, 'kib' => 1, 'mb' => 2, 'mib' => 2, 'gb' => 3, 'gib' => 3);
|
||||
$value = floatval($matches[1]) * pow(1024, $exp[strtolower($matches[3])]);
|
||||
} else {
|
||||
$value = PMA_sqlAddslashes($value);
|
||||
}
|
||||
if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
|
||||
&& $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte'
|
||||
&& preg_match('/^\s*(\d+(\.\d+)?)\s*(mb|kb|mib|kib|gb|gib)\s*$/i', $value, $matches)
|
||||
) {
|
||||
$exp = array('kb' => 1, 'kib' => 1, 'mb' => 2, 'mib' => 2, 'gb' => 3, 'gib' => 3);
|
||||
$value = floatval($matches[1]) * pow(1024, $exp[strtolower($matches[3])]);
|
||||
} else {
|
||||
$value = PMA_sqlAddslashes($value);
|
||||
}
|
||||
|
||||
if (! is_numeric($value)) $value="'" . $value . "'";
|
||||
if (! is_numeric($value)) {
|
||||
$value="'" . $value . "'";
|
||||
}
|
||||
|
||||
if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName']) && PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value)) {
|
||||
// Some values are rounded down etc.
|
||||
$varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="' . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM');
|
||||
|
||||
exit(json_encode(array(
|
||||
'success' => true,
|
||||
'variable' => formatVariable($_REQUEST['varName'], $varValue[1])
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
exit(json_encode(array(
|
||||
'success' => false,
|
||||
'error' => __('Setting variable failed')
|
||||
))
|
||||
if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName'])
|
||||
&& PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value)
|
||||
) {
|
||||
// Some values are rounded down etc.
|
||||
$varValue = PMA_DBI_fetch_single_row(
|
||||
'SHOW GLOBAL VARIABLES WHERE Variable_name="'
|
||||
. PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM'
|
||||
);
|
||||
break;
|
||||
|
||||
exit(
|
||||
json_encode(
|
||||
array(
|
||||
'success' => true,
|
||||
'variable' => formatVariable($_REQUEST['varName'], $varValue[1])
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
exit(
|
||||
json_encode(
|
||||
array(
|
||||
'success' => false,
|
||||
'error' => __('Setting variable failed')
|
||||
)
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,8 @@ if (isset($_REQUEST['report_export'])) {
|
||||
* @return array filtered entries
|
||||
*
|
||||
*/
|
||||
function PMA_filter_tracking($data, $filter_ts_from, $filter_ts_to, $filter_users) {
|
||||
function PMA_filter_tracking($data, $filter_ts_from, $filter_ts_to, $filter_users)
|
||||
{
|
||||
$tmp_entries = array();
|
||||
$id = 0;
|
||||
foreach ( $data as $entry ) {
|
||||
|
||||
@ -31,7 +31,8 @@ class Advisor_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(Advisor::escapePercent($text), $expected);
|
||||
}
|
||||
|
||||
public function escapeStrings() {
|
||||
public function escapeStrings()
|
||||
{
|
||||
return array(
|
||||
array('80%', '80%%'),
|
||||
array('%s%', '%s%%'),
|
||||
|
||||
@ -57,7 +57,8 @@ class PMA_File_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($data, $file->getContent());
|
||||
}
|
||||
|
||||
public function compressedFiles() {
|
||||
public function compressedFiles()
|
||||
{
|
||||
return array(
|
||||
array('./test/test_data/test.gz', 'application/gzip'),
|
||||
array('./test/test_data/test.bz2', 'application/bzip2'),
|
||||
|
||||
@ -396,7 +396,8 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($this->object->isDisplayed(false));
|
||||
}
|
||||
|
||||
public function providerAffectedRows(){
|
||||
public function providerAffectedRows()
|
||||
{
|
||||
return array(array(1, '<div class="notice"> 1 row affected.</div>'));
|
||||
return array(array(2, '<div class="notice"> 2 rows affected.</div>'));
|
||||
return array(array(50000000000000, '<div class="notice"> 50000000000000 rows affected.</div>'));
|
||||
@ -416,7 +417,8 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase
|
||||
$this->object->display();
|
||||
}
|
||||
|
||||
public function providerInsertedRows(){
|
||||
public function providerInsertedRows()
|
||||
{
|
||||
return array(array(1, '<div class="notice"> 1 row inserted.</div>'));
|
||||
return array(array(2, '<div class="notice"> 2 rows inserted.</div>'));
|
||||
return array(array(50000000000000, '<div class="notice"> 50000000000000 rows inserted.</div>'));
|
||||
@ -436,7 +438,8 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase
|
||||
$this->object->display();
|
||||
}
|
||||
|
||||
public function providerDeletedRows(){
|
||||
public function providerDeletedRows()
|
||||
{
|
||||
return array(array(1, '<div class="notice"> 1 row deleted.</div>'));
|
||||
return array(array(2, '<div class="notice"> 2 rows deleted.</div>'));
|
||||
return array(array(50000000000000, '<div class="notice"> 50000000000000 rows deleted.</div>'));
|
||||
|
||||
@ -19,7 +19,8 @@ class PMA_browseUploadFile_test extends PHPUnit_Framework_TestCase
|
||||
/*
|
||||
* Data provider for test
|
||||
*/
|
||||
public function dataProvider() {
|
||||
public function dataProvider()
|
||||
{
|
||||
return array(
|
||||
array(10, __('B'), "10"),
|
||||
array(100, __('B'), "100"),
|
||||
@ -35,8 +36,8 @@ class PMA_browseUploadFile_test extends PHPUnit_Framework_TestCase
|
||||
* @dataProvider dataProvider
|
||||
* @return void
|
||||
*/
|
||||
function testBrowseUploadFile($size, $unit, $res){
|
||||
|
||||
function testBrowseUploadFile($size, $unit, $res)
|
||||
{
|
||||
$this->expectOutputString('<label for="radio_import_file">' . __("Browse your computer:") . '</label>'
|
||||
. '<div id="upload_form_status" style="display: none;"></div>'
|
||||
. '<div id="upload_form_status_info" style="display: none;"></div>'
|
||||
|
||||
@ -24,7 +24,8 @@ class PMA_buildActionTitles_test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['pmaThemeImage'] = 'theme/';
|
||||
}
|
||||
|
||||
function testBuildActionTitles(){
|
||||
function testBuildActionTitles()
|
||||
{
|
||||
$titles = array();
|
||||
|
||||
$titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse'));
|
||||
|
||||
@ -16,7 +16,8 @@ require_once 'libraries/common.lib.php';
|
||||
class PMA_contains_nonprintable_ascii extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
function dataProvider(){
|
||||
function dataProvider()
|
||||
{
|
||||
return array(
|
||||
array("normal string", 0),
|
||||
array("new\nline", 1),
|
||||
@ -29,7 +30,8 @@ class PMA_contains_nonprintable_ascii extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
function testContainsNonPrintableAscii($str, $res){
|
||||
function testContainsNonPrintableAscii($str, $res)
|
||||
{
|
||||
$this->assertEquals($res, PMA_contains_nonprintable_ascii($str));
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,8 @@ require_once 'libraries/common.lib.php';
|
||||
class PMA_convert_bit_default_value_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
function dataProvider(){
|
||||
function dataProvider()
|
||||
{
|
||||
return array(
|
||||
array("b'",""),
|
||||
array("b'01'","01"),
|
||||
@ -27,7 +28,8 @@ class PMA_convert_bit_default_value_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
function testConvert_bit_default_value_test($bit, $val){
|
||||
function testConvert_bit_default_value_test($bit, $val)
|
||||
{
|
||||
$this->assertEquals($val, PMA_convert_bit_default_value($bit));
|
||||
|
||||
}
|
||||
|
||||
@ -19,7 +19,8 @@ class PMA_displayMaximumUploadSize_test extends PHPUnit_Framework_TestCase
|
||||
/*
|
||||
* Data provider for test
|
||||
*/
|
||||
public function dataProvider() {
|
||||
public function dataProvider()
|
||||
{
|
||||
return array(
|
||||
array(10, __('B'), "10"),
|
||||
array(100, __('B'), "100"),
|
||||
@ -35,7 +36,8 @@ class PMA_displayMaximumUploadSize_test extends PHPUnit_Framework_TestCase
|
||||
* @dataProvider dataProvider
|
||||
* @return void
|
||||
*/
|
||||
function testMaximumUploadSize($size, $unit, $res){
|
||||
function testMaximumUploadSize($size, $unit, $res)
|
||||
{
|
||||
$this->assertEquals("(" . __('Max: '). $res . $unit .")", PMA_displayMaximumUploadSize($size));
|
||||
|
||||
}
|
||||
|
||||
@ -16,7 +16,8 @@ require_once 'libraries/common.lib.php';
|
||||
class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function escapeDataProvider() {
|
||||
public function escapeDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('\_test', '_test'),
|
||||
array('\_\\', '_\\'),
|
||||
@ -29,8 +30,8 @@ class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* PMA_escape_mysql_wildcards tests
|
||||
/**
|
||||
* PMA_escape_mysql_wildcards tests
|
||||
* @dataProvider escapeDataProvider
|
||||
*/
|
||||
|
||||
@ -39,8 +40,8 @@ class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($a, PMA_escape_mysql_wildcards($b));
|
||||
}
|
||||
|
||||
/**
|
||||
* PMA_unescape_mysql_wildcards tests
|
||||
/**
|
||||
* PMA_unescape_mysql_wildcards tests
|
||||
* @dataProvider escapeDataProvider
|
||||
*/
|
||||
|
||||
|
||||
@ -16,23 +16,23 @@ require_once 'libraries/common.lib.php';
|
||||
class PMA_extractValueFromFormattedSize_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
function testExtractValueFromFormattedSizeNoFormat(){
|
||||
|
||||
function testExtractValueFromFormattedSizeNoFormat()
|
||||
{
|
||||
$this->assertEquals(-1, PMA_extractValueFromFormattedSize(100));
|
||||
}
|
||||
|
||||
function testExtractValueFromFormattedSizeGB(){
|
||||
|
||||
function testExtractValueFromFormattedSizeGB()
|
||||
{
|
||||
$this->assertEquals(10737418240, PMA_extractValueFromFormattedSize("10GB"));
|
||||
}
|
||||
|
||||
function testExtractValueFromFormattedSizeMB(){
|
||||
|
||||
function testExtractValueFromFormattedSizeMB()
|
||||
{
|
||||
$this->assertEquals(15728640, PMA_extractValueFromFormattedSize("15MB"));
|
||||
}
|
||||
|
||||
function testExtractValueFromFormattedSizeK(){
|
||||
|
||||
function testExtractValueFromFormattedSizeK()
|
||||
{
|
||||
$this->assertEquals(262144, PMA_extractValueFromFormattedSize("256K"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,8 @@ class PMA_foreignKeySupported_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function foreignkeySupportedDataProvider() {
|
||||
public function foreignkeySupportedDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('MyISAM', false),
|
||||
array('innodb', true),
|
||||
@ -32,7 +33,8 @@ class PMA_foreignKeySupported_test extends PHPUnit_Framework_TestCase
|
||||
* foreign key supported test
|
||||
* @dataProvider foreignkeySupportedDataProvider
|
||||
*/
|
||||
public function testForeignkeySupported($a, $e) {
|
||||
public function testForeignkeySupported($a, $e)
|
||||
{
|
||||
$this->assertEquals($e, PMA_foreignkey_supported($a));
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,8 +28,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* storing globals and session
|
||||
*/
|
||||
public function setUp() {
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->tmpGlobals = $GLOBALS;
|
||||
$this->tmpSession = $_SESSION;
|
||||
|
||||
@ -38,8 +38,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* recovering globals and session
|
||||
*/
|
||||
public function tearDown() {
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
$GLOBALS = $this->tmpGlobals;
|
||||
$_SESSION = $this->tmpSession;
|
||||
|
||||
@ -50,7 +50,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function formatNumberDataProvider() {
|
||||
public function formatNumberDataProvider()
|
||||
{
|
||||
return array(
|
||||
array(10, 2, 2, '10 '),
|
||||
array(100, 2, 0, '100 '),
|
||||
@ -67,7 +68,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
|
||||
* format number test, globals are defined
|
||||
* @dataProvider formatNumberDataProvider
|
||||
*/
|
||||
public function testFormatNumber($a, $b, $c, $d) {
|
||||
public function testFormatNumber($a, $b, $c, $d)
|
||||
{
|
||||
$this->assertEquals($d, (string)PMA_formatNumber($a, $b, $c, false));
|
||||
}
|
||||
|
||||
@ -76,7 +78,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function formatByteDownDataProvider() {
|
||||
public function formatByteDownDataProvider()
|
||||
{
|
||||
return array(
|
||||
array(10, 2, 2, array('10', __('B'))),
|
||||
array(100, 2, 0, array('0', __('KiB'))),
|
||||
@ -92,7 +95,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
|
||||
* format byte test, globals are defined
|
||||
* @dataProvider formatByteDownDataProvider
|
||||
*/
|
||||
public function testFormatByteDown($a, $b, $c, $e) {
|
||||
public function testFormatByteDown($a, $b, $c, $e)
|
||||
{
|
||||
$result = PMA_formatByteDown($a, $b, $c);
|
||||
$result[0] = trim($result[0]);
|
||||
$this->assertEquals($e, $result);
|
||||
|
||||
@ -30,7 +30,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* storing globals and session
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp()
|
||||
{
|
||||
global $cfg;
|
||||
$this->tmpCfg = $cfg;
|
||||
}
|
||||
@ -38,19 +39,22 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* recovering globals and session
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg = $this->tmpCfg;
|
||||
}
|
||||
|
||||
function testFormatSQLNotArray(){
|
||||
function testFormatSQLNotArray()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = 'html';
|
||||
$sql = "SELECT * FROM tTable;";
|
||||
$this->assertEquals("<pre>\n$sql\n</pre>", PMA_formatSql($sql));
|
||||
}
|
||||
|
||||
function testFormatSQLfmTypeHtml_1(){
|
||||
function testFormatSQLfmTypeHtml_1()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = 'html';
|
||||
$cfg['MySQLManualType'] = 'none';
|
||||
@ -84,7 +88,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, PMA_formatSql($sql, $unparsed));
|
||||
}
|
||||
|
||||
function testFormatSQLfmTypeHtml_2(){
|
||||
function testFormatSQLfmTypeHtml_2()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = 'html';
|
||||
$cfg['MySQLManualType'] = 'none';
|
||||
@ -131,7 +136,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, PMA_formatSql($sql, $unparsed));
|
||||
}
|
||||
|
||||
function testFormatSQLfmTypeHtml_3(){
|
||||
function testFormatSQLfmTypeHtml_3()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = 'html';
|
||||
$cfg['MySQLManualType'] = 'none';
|
||||
@ -266,7 +272,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, PMA_formatSql($sql, $unparsed));
|
||||
}
|
||||
|
||||
function testFormatSQLfmTypeText_1(){
|
||||
function testFormatSQLfmTypeText_1()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = 'text';
|
||||
$cfg['MySQLManualType'] = 'none';
|
||||
@ -300,7 +307,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, PMA_formatSql($sql, $unparsed));
|
||||
}
|
||||
|
||||
function testFormatSQLfmTypeText_2(){
|
||||
function testFormatSQLfmTypeText_2()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = 'text';
|
||||
$cfg['MySQLManualType'] = 'none';
|
||||
@ -347,7 +355,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, PMA_formatSql($sql, $unparsed));
|
||||
}
|
||||
|
||||
function testFormatSQLfmTypeText_3(){
|
||||
function testFormatSQLfmTypeText_3()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = 'text';
|
||||
$cfg['MySQLManualType'] = 'none';
|
||||
@ -481,7 +490,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, PMA_formatSql($sql, $unparsed));
|
||||
}
|
||||
|
||||
function testFormatSQLfmTypeNone_1(){
|
||||
function testFormatSQLfmTypeNone_1()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = 'none';
|
||||
$cfg['MySQLManualType'] = 'none';
|
||||
@ -518,7 +528,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, PMA_formatSql($sql));
|
||||
}
|
||||
|
||||
function testFormatSQLfmTypeNone_2(){
|
||||
function testFormatSQLfmTypeNone_2()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = 'none';
|
||||
$cfg['MySQLManualType'] = 'none';
|
||||
@ -568,7 +579,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, PMA_formatSql($sql));
|
||||
}
|
||||
|
||||
function testFormatSQLfmTypeNone_3(){
|
||||
function testFormatSQLfmTypeNone_3()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = 'none';
|
||||
$cfg['MySQLManualType'] = 'none';
|
||||
@ -705,7 +717,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, PMA_formatSql($sql));
|
||||
}
|
||||
|
||||
function testFormatSQLWithoutType(){
|
||||
function testFormatSQLWithoutType()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['SQP']['fmtType'] = '';
|
||||
$cfg['MySQLManualType'] = 'none';
|
||||
@ -735,7 +748,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEmpty(PMA_formatSql($sql));
|
||||
}
|
||||
|
||||
function testFormatSQLError(){
|
||||
function testFormatSQLError()
|
||||
{
|
||||
global $SQP_errorString;
|
||||
$SQP_errorString = true;
|
||||
$sql = array("raw" => "& \" < >");
|
||||
|
||||
@ -19,7 +19,8 @@ class PMA_generateHiddenMaxFileSize_test extends PHPUnit_Framework_TestCase
|
||||
/*
|
||||
* Data provider for test
|
||||
*/
|
||||
public function dataProvider() {
|
||||
public function dataProvider()
|
||||
{
|
||||
return array(
|
||||
array(10),
|
||||
array("100"),
|
||||
@ -34,7 +35,8 @@ class PMA_generateHiddenMaxFileSize_test extends PHPUnit_Framework_TestCase
|
||||
* @dataProvider dataProvider
|
||||
* @return void
|
||||
*/
|
||||
function test_generateHiddenMaxFileSize($size){
|
||||
function test_generateHiddenMaxFileSize($size)
|
||||
{
|
||||
$this->assertEquals(PMA_generateHiddenMaxFileSize($size),
|
||||
'<input type="hidden" name="MAX_FILE_SIZE" value="' .$size . '" />');
|
||||
}
|
||||
|
||||
@ -21,8 +21,8 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
}
|
||||
|
||||
function testGetIconWithoutPropertiesIconic(){
|
||||
|
||||
function testGetIconWithoutPropertiesIconic()
|
||||
{
|
||||
$GLOBALS['cfg']['PropertiesIconic'] = false;
|
||||
|
||||
$this->assertEquals(
|
||||
@ -31,8 +31,8 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
function testGetIconWithPropertiesIconic(){
|
||||
|
||||
function testGetIconWithPropertiesIconic()
|
||||
{
|
||||
$GLOBALS['cfg']['PropertiesIconic'] = true;
|
||||
|
||||
$this->assertEquals(
|
||||
@ -41,8 +41,8 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
function testGetIconAlternate(){
|
||||
|
||||
function testGetIconAlternate()
|
||||
{
|
||||
$GLOBALS['cfg']['PropertiesIconic'] = true;
|
||||
$alternate_text = 'alt_str';
|
||||
|
||||
@ -53,8 +53,8 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
function testGetIconWithForceText(){
|
||||
|
||||
function testGetIconWithForceText()
|
||||
{
|
||||
$GLOBALS['cfg']['PropertiesIconic'] = true;
|
||||
$alternate_text = 'alt_str';
|
||||
|
||||
|
||||
@ -16,7 +16,8 @@ require_once 'libraries/common.lib.php';
|
||||
class PMA_getTitleForTarget_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
function dataProvider(){
|
||||
function dataProvider()
|
||||
{
|
||||
return array(
|
||||
array('tbl_structure.php', __('Structure')),
|
||||
array('tbl_sql.php', __('SQL'),),
|
||||
@ -34,8 +35,8 @@ class PMA_getTitleForTarget_test extends PHPUnit_Framework_TestCase
|
||||
* @dataProvider dataProvider
|
||||
* @return void
|
||||
*/
|
||||
function testGetTitleForTarget($target, $result){
|
||||
|
||||
function testGetTitleForTarget($target, $result)
|
||||
{
|
||||
$this->assertEquals($result, PMA_getTitleForTarget($target));
|
||||
}
|
||||
|
||||
|
||||
@ -33,8 +33,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* storing globals and session
|
||||
*/
|
||||
public function setUp() {
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->tmpGlobals = $GLOBALS;
|
||||
$this->tmpSession = $_SESSION;
|
||||
$this->tmpTimezone = date_default_timezone_get();
|
||||
@ -44,8 +44,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* recovering globals and session
|
||||
*/
|
||||
public function tearDown() {
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
$GLOBALS = $this->tmpGlobals;
|
||||
$_SESSION = $this->tmpSession;
|
||||
date_default_timezone_set($this->tmpTimezone);
|
||||
@ -57,7 +57,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function localisedDateDataProvider() {
|
||||
public function localisedDateDataProvider()
|
||||
{
|
||||
return array(
|
||||
array(1227455558, '', 'Nov 23, 2008 at 03:52 PM'),
|
||||
array(1227455558, '%Y-%m-%d %H:%M:%S %a', '2008-11-23 15:52:38 Sun')
|
||||
@ -68,7 +69,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
|
||||
* localised date test, globals are defined
|
||||
* @dataProvider localisedDateDataProvider
|
||||
*/
|
||||
public function testLocalisedDate($a, $b, $e) {
|
||||
public function testLocalisedDate($a, $b, $e)
|
||||
{
|
||||
$this->assertEquals($e, PMA_localisedDate($a, $b));
|
||||
}
|
||||
|
||||
@ -77,7 +79,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function timespanFormatDataProvider() {
|
||||
public function timespanFormatDataProvider()
|
||||
{
|
||||
return array(
|
||||
array(1258, '0 days, 0 hours, 20 minutes and 58 seconds'),
|
||||
array(821958, '9 days, 12 hours, 19 minutes and 18 seconds')
|
||||
@ -88,7 +91,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
|
||||
* localised timestamp test, globals are defined
|
||||
* @dataProvider timespanFormatDataProvider
|
||||
*/
|
||||
public function testTimespanFormat($a, $e) {
|
||||
public function testTimespanFormat($a, $e)
|
||||
{
|
||||
$GLOBALS['timespanfmt'] = '%s days, %s hours, %s minutes and %s seconds';
|
||||
|
||||
$this->assertEquals($e, PMA_timespanFormat($a));
|
||||
|
||||
@ -21,7 +21,8 @@ class PMA_printableBitValue_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function printableBitValueDataProvider() {
|
||||
public function printableBitValueDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('testtest', 64, '0111010001100101011100110111010001110100011001010111001101110100'),
|
||||
array('test', 32, '01110100011001010111001101110100')
|
||||
@ -33,7 +34,8 @@ class PMA_printableBitValue_test extends PHPUnit_Framework_TestCase
|
||||
* @dataProvider printableBitValueDataProvider
|
||||
*/
|
||||
|
||||
public function testPrintableBitValue($a, $b, $e) {
|
||||
public function testPrintableBitValue($a, $b, $e)
|
||||
{
|
||||
$this->assertEquals($e, PMA_printable_bit_value($a, $b));
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* sqlAddslashes test
|
||||
*/
|
||||
public function testAddSlashes() {
|
||||
public function testAddSlashes()
|
||||
{
|
||||
$string = "\'test''\''\'\r\t\n";
|
||||
|
||||
$this->assertEquals("\\\\\\\\\'test\'\'\\\\\\\\\'\'\\\\\\\\\'\\r\\t\\n", PMA_sqlAddSlashes($string, true, true, true));
|
||||
@ -38,7 +39,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function unQuoteProvider() {
|
||||
public function unQuoteProvider()
|
||||
{
|
||||
return array(
|
||||
array('"test\'"', "test'"),
|
||||
array("'test''", "test'"),
|
||||
@ -51,7 +53,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
|
||||
* unQuote test
|
||||
* @dataProvider unQuoteProvider
|
||||
*/
|
||||
public function testUnQuote($param, $expected) {
|
||||
public function testUnQuote($param, $expected)
|
||||
{
|
||||
$this->assertEquals($expected, PMA_unQuote($param));
|
||||
}
|
||||
|
||||
@ -60,7 +63,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function unQuoteSelectedProvider() {
|
||||
public function unQuoteSelectedProvider()
|
||||
{
|
||||
return array(
|
||||
array('"test\'"', "test'"),
|
||||
array("'test''", "'test''"),
|
||||
@ -73,7 +77,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
|
||||
* unQuote test with chosen quote
|
||||
* @dataProvider unQuoteSelectedProvider
|
||||
*/
|
||||
public function testUnQuoteSelectedChar($param, $expected) {
|
||||
public function testUnQuoteSelectedChar($param, $expected)
|
||||
{
|
||||
$this->assertEquals($expected, PMA_unQuote($param, '"'));
|
||||
}
|
||||
|
||||
@ -82,7 +87,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function backquoteDataProvider() {
|
||||
public function backquoteDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('0', '`0`'),
|
||||
array('test', '`test`'),
|
||||
@ -95,7 +101,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
|
||||
* backquote test with different param $do_it (true, false)
|
||||
* @dataProvider backquoteDataProvider
|
||||
*/
|
||||
public function testBackquote($a, $b) {
|
||||
public function testBackquote($a, $b)
|
||||
{
|
||||
// Test bypass quoting (used by dump functions)
|
||||
$this->assertEquals($a, PMA_backquote($a, false));
|
||||
|
||||
@ -103,7 +110,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($b, PMA_backquote($a));
|
||||
}
|
||||
|
||||
public function testBackquoteForbidenWords() {
|
||||
public function testBackquoteForbidenWords()
|
||||
{
|
||||
global $PMA_SQPdata_forbidden_word;
|
||||
|
||||
foreach ($PMA_SQPdata_forbidden_word as $forbidden) {
|
||||
|
||||
@ -31,8 +31,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* storing globals and session
|
||||
*/
|
||||
public function setUp() {
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
global $GLOBALS, $_SESSION;
|
||||
$this->tmpGlobals = $GLOBALS;
|
||||
$this->tmpSession = $_SESSION;
|
||||
@ -44,7 +44,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function flipStringDataProvider() {
|
||||
public function flipStringDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('test', "t<br />\ne<br />\ns<br />\nt"),
|
||||
array('te ;st', "t<br />\ne<br />\n <br />\n;<br />\ns<br />\nt")
|
||||
@ -56,7 +57,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
|
||||
* @dataProvider flipStringDataProvider
|
||||
*/
|
||||
|
||||
public function testFlipString($a, $e) {
|
||||
public function testFlipString($a, $e)
|
||||
{
|
||||
$this->assertEquals($e, PMA_flipstring($a));
|
||||
}
|
||||
|
||||
@ -65,7 +67,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function userDirDataProvider() {
|
||||
public function userDirDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('/var/pma_tmp/%u/', "/var/pma_tmp/root/"),
|
||||
array('/home/%u/pma', "/home/root/pma/")
|
||||
@ -77,7 +80,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
|
||||
* @dataProvider userDirDataProvider
|
||||
*/
|
||||
|
||||
public function testUserDirString($a, $e) {
|
||||
public function testUserDirString($a, $e)
|
||||
{
|
||||
$GLOBALS['cfg']['Server']['user'] = 'root';
|
||||
|
||||
$this->assertEquals($e, PMA_userDir($a));
|
||||
@ -88,7 +92,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function replaceBinaryContentsDataProvider() {
|
||||
public function replaceBinaryContentsDataProvider()
|
||||
{
|
||||
return array(
|
||||
array("\x000", '\00'),
|
||||
array("\x08\x0a\x0d\x1atest", '\b\n\r\Ztest'),
|
||||
@ -101,7 +106,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
|
||||
* @dataProvider replaceBinaryContentsDataProvider
|
||||
*/
|
||||
|
||||
public function testReplaceBinaryContents($a, $e) {
|
||||
public function testReplaceBinaryContents($a, $e)
|
||||
{
|
||||
$this->assertEquals($e, PMA_replace_binary_contents($a));
|
||||
}
|
||||
|
||||
@ -110,7 +116,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function duplicateFirstNewlineDataProvider() {
|
||||
public function duplicateFirstNewlineDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('test', 'test'),
|
||||
array("\r\ntest", "\n\r\ntest"),
|
||||
@ -124,7 +131,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
|
||||
* @dataProvider duplicateFirstNewlineDataProvider
|
||||
*/
|
||||
|
||||
public function testDuplicateFirstNewline($a, $e) {
|
||||
public function testDuplicateFirstNewline($a, $e)
|
||||
{
|
||||
$this->assertEquals($e, PMA_duplicateFirstNewline($a));
|
||||
}
|
||||
|
||||
|
||||
@ -35,30 +35,35 @@ class PMA_checkPageValidity_test extends PHPUnit_Framework_TestCase
|
||||
'user_password.php',
|
||||
);
|
||||
|
||||
function testGotoNowhere(){
|
||||
function testGotoNowhere()
|
||||
{
|
||||
$page = null;
|
||||
$this->assertFalse(PMA_checkPageValidity($page, null));
|
||||
}
|
||||
|
||||
function testGotoWhitelist(){
|
||||
function testGotoWhitelist()
|
||||
{
|
||||
$page = 'export.php';
|
||||
|
||||
$this->assertTrue(PMA_checkPageValidity($page, $this->goto_whitelist));
|
||||
}
|
||||
|
||||
function testGotoNotInWhitelist(){
|
||||
function testGotoNotInWhitelist()
|
||||
{
|
||||
$page = 'shell.php';
|
||||
|
||||
$this->assertFalse(PMA_checkPageValidity($page, $this->goto_whitelist));
|
||||
}
|
||||
|
||||
function testGotoWhitelistPage(){
|
||||
function testGotoWhitelistPage()
|
||||
{
|
||||
$page = 'main.php?sql.php&test=true';
|
||||
|
||||
$this->assertTrue(PMA_checkPageValidity($page, $this->goto_whitelist));
|
||||
}
|
||||
|
||||
function testGotoWhitelistEncodedPage(){
|
||||
function testGotoWhitelistEncodedPage()
|
||||
{
|
||||
$page = 'main.php%3Fsql.php%26test%3Dtrue';
|
||||
|
||||
$this->assertTrue(PMA_checkPageValidity($page, $this->goto_whitelist));
|
||||
|
||||
@ -33,7 +33,8 @@ class PMA_getLinks_test extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function providerLinkURL(){
|
||||
public function providerLinkURL()
|
||||
{
|
||||
return array(
|
||||
array('http://wiki.phpmyadmin.net', './url.php?url=http%3A%2F%2Fwiki.phpmyadmin.net&server=99&lang=en&token=token'),
|
||||
array('https://wiki.phpmyadmin.net', './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net&server=99&lang=en&token=token'),
|
||||
@ -45,7 +46,8 @@ class PMA_getLinks_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @dataProvider providerLinkURL
|
||||
*/
|
||||
public function testPMA_linkURL($link, $url){
|
||||
public function testPMA_linkURL($link, $url)
|
||||
{
|
||||
$this->assertEquals(PMA_linkURL($link), $url);
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,8 @@ require_once 'libraries/core.lib.php';
|
||||
|
||||
class PMA_securePath extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testReplaceDots(){
|
||||
public function testReplaceDots()
|
||||
{
|
||||
$this->assertEquals(PMA_securePath('../../../etc/passwd'), './././etc/passwd');
|
||||
$this->assertEquals(PMA_securePath('/var/www/../phpmyadmin'), '/var/www/./phpmyadmin');
|
||||
$this->assertEquals(PMA_securePath('./path/with..dots/../../file..php'), './path/with.dots/././file.php');
|
||||
|
||||
@ -15,14 +15,16 @@ require_once 'libraries/core.lib.php';
|
||||
class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
function testMissingExtention(){
|
||||
function testMissingExtention()
|
||||
{
|
||||
$ext = 'php_ext';
|
||||
$this->setExpectedException('PHPUnit_Framework_Error',
|
||||
'The [a@'.PMA_getPHPDocLink('book.' . $ext . '.php').'@Documentation][em]'.$ext.'[/em][/a] extension is missing. Please check your PHP configuration.');
|
||||
PMA_warnMissingExtension($ext);
|
||||
}
|
||||
|
||||
function testMissingExtentionFatal(){
|
||||
function testMissingExtentionFatal()
|
||||
{
|
||||
$ext = 'php_ext';
|
||||
$warn = 'The <a href="' . PMA_getPHPDocLink('book.' . $ext . '.php') . '" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.';
|
||||
|
||||
@ -34,7 +36,8 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertGreaterThan(0, strpos($printed, $warn));
|
||||
}
|
||||
|
||||
function testMissingExtentionFatalWithExtra(){
|
||||
function testMissingExtentionFatalWithExtra()
|
||||
{
|
||||
$ext = 'php_ext';
|
||||
$extra = 'Appended Extra String';
|
||||
|
||||
@ -48,7 +51,8 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertGreaterThan(0, strpos($printed, $warn));
|
||||
}
|
||||
|
||||
function testMissingExtentionWithExtra(){
|
||||
function testMissingExtentionWithExtra()
|
||||
{
|
||||
$ext = 'php_ext';
|
||||
$extra = 'Appended Extra String';
|
||||
$this->setExpectedException('PHPUnit_Framework_Error',
|
||||
|
||||
@ -21,7 +21,8 @@ class PMA_JS_Escape_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, PMA_getJsValue($key, $value));
|
||||
}
|
||||
|
||||
public function variables() {
|
||||
public function variables()
|
||||
{
|
||||
return array(
|
||||
array('foo', true, "foo = true;\n"),
|
||||
array('foo', false, "foo = false;\n"),
|
||||
|
||||
@ -46,7 +46,8 @@ class ParsingTest extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @dataProvider data_provider_test_npgettext
|
||||
*/
|
||||
public function test_npgettext($number, $expected) {
|
||||
public function test_npgettext($number, $expected)
|
||||
{
|
||||
$parser = new gettext_reader(NULL);
|
||||
$result = $parser->npgettext("context",
|
||||
"%d pig went to the market\n",
|
||||
@ -54,7 +55,8 @@ class ParsingTest extends PHPUnit_Framework_TestCase
|
||||
$number);
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
public static function data_provider_test_npgettext() {
|
||||
public static function data_provider_test_npgettext()
|
||||
{
|
||||
return array(
|
||||
array(1, "%d pig went to the market\n"),
|
||||
array(2, "%d pigs went to the market\n"),
|
||||
|
||||
@ -31,7 +31,8 @@ class Helper
|
||||
}
|
||||
}
|
||||
|
||||
public static function getBrowserString() {
|
||||
public static function getBrowserString()
|
||||
{
|
||||
$browserString = self::$config->getCurrentBrowser();
|
||||
return $browserString;
|
||||
}
|
||||
|
||||
@ -67,12 +67,13 @@ require './libraries/footer.inc.php';
|
||||
|
||||
/**
|
||||
* Send the message as an ajax request
|
||||
*
|
||||
*
|
||||
* @param array $change_password_message
|
||||
* @param string $sql_query
|
||||
* @return void
|
||||
*/
|
||||
function PMA_getChangePassMessage($change_password_message, $sql_query = '') {
|
||||
function PMA_getChangePassMessage($change_password_message, $sql_query = '')
|
||||
{
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
/**
|
||||
* If in an Ajax request, we don't need to show the rest of the page
|
||||
@ -88,10 +89,11 @@ function PMA_getChangePassMessage($change_password_message, $sql_query = '') {
|
||||
|
||||
/**
|
||||
* Generate the message
|
||||
*
|
||||
* @return array error value and message
|
||||
*
|
||||
* @return array error value and message
|
||||
*/
|
||||
function PMA_setChangePasswordMsg() {
|
||||
function PMA_setChangePasswordMsg()
|
||||
{
|
||||
$error = false;
|
||||
$message = PMA_Message::success(__('The profile has been updated.'));
|
||||
|
||||
@ -109,19 +111,20 @@ function PMA_setChangePasswordMsg() {
|
||||
|
||||
/**
|
||||
* Change the password
|
||||
*
|
||||
*
|
||||
* @param string $password
|
||||
* @param string $message
|
||||
* @param array $change_password_message
|
||||
* @return void
|
||||
*/
|
||||
function PMA_changePassword($password, $message, $change_password_message) {
|
||||
function PMA_changePassword($password, $message, $change_password_message)
|
||||
{
|
||||
// Defines the url to return to in case of error in the sql statement
|
||||
$_url_params = array();
|
||||
$hashing_function = PMA_changePassHashingFunction();
|
||||
$sql_query = 'SET password = ' . (($password == '') ? '\'\'' : $hashing_function . '(\'***\')');
|
||||
PMA_ChangePassUrlParamsAndSubmitQuery($password, $_url_params, $sql_query, $hashing_function);
|
||||
|
||||
|
||||
$new_url_params = PMA_changePassAuthType($_url_params, $password);
|
||||
PMA_getChangePassMessage($change_password_message, $sql_query);
|
||||
PMA_changePassDisplayPage($message, $sql_query, $new_url_params);
|
||||
@ -129,10 +132,11 @@ function PMA_changePassword($password, $message, $change_password_message) {
|
||||
|
||||
/**
|
||||
* Generate the hashing function
|
||||
*
|
||||
*
|
||||
* @return string $hashing_function
|
||||
*/
|
||||
function PMA_changePassHashingFunction() {
|
||||
function PMA_changePassHashingFunction()
|
||||
{
|
||||
if (PMA_isValid($_REQUEST['pw_hash'], 'identical', 'old')) {
|
||||
$hashing_function = 'OLD_PASSWORD';
|
||||
} else {
|
||||
@ -143,14 +147,15 @@ function PMA_changePassHashingFunction() {
|
||||
|
||||
/**
|
||||
* Generate the error url and submit the query
|
||||
*
|
||||
*
|
||||
* @param string $password
|
||||
* @param array $_url_params
|
||||
* @param string $sql_query
|
||||
* @param string $hashing_function
|
||||
* @return void
|
||||
*/
|
||||
function PMA_ChangePassUrlParamsAndSubmitQuery($password, $_url_params, $sql_query, $hashing_function) {
|
||||
function PMA_ChangePassUrlParamsAndSubmitQuery($password, $_url_params, $sql_query, $hashing_function)
|
||||
{
|
||||
$err_url = 'user_password.php' . PMA_generate_common_url($_url_params);
|
||||
$local_query = 'SET password = ' . (($password == '') ? '\'\'' : $hashing_function . '(\'' . PMA_sqlAddSlashes($password) . '\')');
|
||||
$result = @PMA_DBI_try_query($local_query)
|
||||
@ -159,12 +164,13 @@ function PMA_ChangePassUrlParamsAndSubmitQuery($password, $_url_params, $sql_que
|
||||
|
||||
/**
|
||||
* Change password authentication type
|
||||
*
|
||||
*
|
||||
* @param array $_url_params
|
||||
* @param string $password
|
||||
* @return array $_url_params
|
||||
*/
|
||||
function PMA_changePassAuthType($_url_params, $password) {
|
||||
function PMA_changePassAuthType($_url_params, $password)
|
||||
{
|
||||
/**
|
||||
* Changes password cookie if required
|
||||
* Duration = till the browser is closed for password (we don't want this to be saved)
|
||||
@ -184,13 +190,14 @@ function PMA_changePassAuthType($_url_params, $password) {
|
||||
|
||||
/**
|
||||
* Display the page
|
||||
*
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $sql_query
|
||||
* @param array $_url_params
|
||||
* @return void
|
||||
*/
|
||||
function PMA_changePassDisplayPage($message, $sql_query, $_url_params) {
|
||||
function PMA_changePassDisplayPage($message, $sql_query, $_url_params)
|
||||
{
|
||||
include_once './libraries/header.inc.php';
|
||||
echo '<h1>' . __('Change password') . '</h1>' . "\n\n";
|
||||
PMA_showMessage($message, $sql_query, 'success');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user