Merge remote-tracking branch 'origin/master'

This commit is contained in:
Michal Čihař 2012-04-14 05:44:06 +02:00
commit cdef4b2ef7
50 changed files with 567 additions and 332 deletions

View File

@ -126,7 +126,8 @@ foreach ($tables as $table) {
$show_create_table = PMA_DBI_fetch_value(
'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
0, 1);
0, 1
);
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
}

View File

@ -186,8 +186,9 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
if (! PMA_Table::moveCopy(
$db, $each_table, $newname, $each_table,
isset($this_what) ? $this_what : 'data', $move, 'db_copy')
) {
isset($this_what) ? $this_what : 'data',
$move, 'db_copy'
)) {
$_error = true;
// $sql_query is filled by PMA_Table::moveCopy()
$sql_query = $back . $sql_query;
@ -279,8 +280,10 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
$get_fields = array('user', 'label', 'query');
$where_fields = array('dbase' => $db);
$new_fields = array('dbase' => $newname);
PMA_Table::duplicateInfo('bookmarkwork', 'bookmark', $get_fields,
$where_fields, $new_fields);
PMA_Table::duplicateInfo(
'bookmarkwork', 'bookmark', $get_fields,
$where_fields, $new_fields
);
}
if (! $_error && $move) {
@ -565,8 +568,10 @@ echo __('Remove database');
}
echo ' <label for="select_db_collation">' . __('Collation') . ':</label>' . "\n"
. ' </legend>' . "\n"
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION,
'db_collation', 'select_db_collation', $db_collation, false, 3)
. PMA_generateCharsetDropdownBox(
PMA_CSDROPDOWN_COLLATION, 'db_collation',
'select_db_collation', $db_collation, false, 3
)
. '</fieldset>'
. '<fieldset class="tblFooters">'
. ' <input type="submit" name="submitcollation"'

View File

@ -204,11 +204,13 @@ if (isset($_REQUEST['submit_search'])) {
// Displays search string
echo '<br />' . "\n"
.'<table class="data">' . "\n"
.'<caption class="tblHeaders">' . "\n"
.sprintf(__('Search results for "<i>%s</i>" %s:'),
$searched, $option_str) . "\n"
.'</caption>' . "\n";
. '<table class="data">' . "\n"
. '<caption class="tblHeaders">' . "\n"
. sprintf(
__('Search results for "<i>%s</i>" %s:'),
$searched, $option_str
) . "\n"
. '</caption>' . "\n";
$num_search_result_total = 0;
$odd_row = true;
@ -224,8 +226,10 @@ if (isset($_REQUEST['submit_search'])) {
$sql_query .= $newsearchsqls['select_count'];
echo '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">'
.'<td>' . sprintf(_ngettext('%1$s match inside table <i>%2$s</i>', '%1$s matches inside table <i>%2$s</i>', $res_cnt), $res_cnt,
htmlspecialchars($each_table)) . "</td>\n";
. '<td>' . sprintf(
_ngettext('%1$s match inside table <i>%2$s</i>', '%1$s matches inside table <i>%2$s</i>', $res_cnt),
$res_cnt, htmlspecialchars($each_table)
) . "</td>\n";
if ($res_cnt > 0) {
$this_url_params['sql_query'] = $newsearchsqls['select_fields'];
@ -238,7 +242,7 @@ if (isset($_REQUEST['submit_search'])) {
?>
<td> <a name="delete_search" href="<?php echo $delete_result_path; ?>" onclick="deleteResult('<?php echo $delete_result_path ?>' , ' <?php printf(__('Delete the matches for the %s table?'), htmlspecialchars($each_table)); ?>','<?php echo ($GLOBALS['cfg']['AjaxEnable']); ?>');return false;" ><?php echo __('Delete') ?></a> </td>
<?php
} else {
} else {
echo '<td>&nbsp;</td>' . "\n"
.'<td>&nbsp;</td>' . "\n";
}// end if else
@ -249,8 +253,10 @@ if (isset($_REQUEST['submit_search'])) {
echo '</table>' . "\n";
if (count($tables_selected) > 1) {
echo '<p>' . sprintf(_ngettext('<b>Total:</b> <i>%s</i> match', '<b>Total:</b> <i>%s</i> matches', $num_search_result_total),
$num_search_result_total) . '</p>' . "\n";
echo '<p>' . sprintf(
_ngettext('<b>Total:</b> <i>%s</i> match', '<b>Total:</b> <i>%s</i> matches', $num_search_result_total),
$num_search_result_total
) . '</p>' . "\n";
}
} // end 1.

View File

@ -7,7 +7,7 @@
/* PHP 5.4 stores upload progress data only in the default session.
* After calling session_name(), we won't find the progress data anymore.
* The bug should be somewhere in
* https://github.com/php/php-src/blob/master/ext/session/session.c#L2342
@ -21,14 +21,15 @@
*/
if (version_compare(PHP_VERSION, '5.4.0', '>=')
&& ini_get('session.upload_progress.enabled')) {
&& ini_get('session.upload_progress.enabled')
) {
if (!isset($_POST['session_upload_progress'])) {
$sessionupload = array();
$prefix = ini_get('session.upload_progress.prefix');
session_start();
foreach($_SESSION as $key => $value) {
foreach ($_SESSION as $key => $value) {
// only copy session-prefixed data
if (substr($key, 0, strlen($prefix)) == $prefix) {
$sessionupload[$key] = $value;
@ -50,8 +51,10 @@ if (version_compare(PHP_VERSION, '5.4.0', '>=')
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
'session_upload_progress=' . rawurlencode(serialize($sessionupload)));
curl_setopt(
$ch, CURLOPT_POSTFIELDS,
'session_upload_progress=' . rawurlencode(serialize($sessionupload))
);
curl_setopt($ch, CURLOPT_COOKIE, $headers['Cookie']);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
@ -75,7 +78,7 @@ if (isset($_POST['session_upload_progress'])) {
// then write sessionupload back into the loaded session
$sessionupload = unserialize($_POST['session_upload_progress']);
foreach($sessionupload as $key => $value) {
foreach ($sessionupload as $key => $value) {
$_SESSION[$key] = $value;
}
}

View File

@ -401,7 +401,8 @@ PMA_printJsValue(
);
/* l10n: Display text for current month link in calendar */
PMA_printJsValue("$.datepicker.regional['']['currentText']", __('Today'));
PMA_printJsValue("$.datepicker.regional['']['monthNames']",
PMA_printJsValue(
"$.datepicker.regional['']['monthNames']",
array(
__('January'),
__('February'),
@ -414,8 +415,11 @@ PMA_printJsValue("$.datepicker.regional['']['monthNames']",
__('September'),
__('October'),
__('November'),
__('December')));
PMA_printJsValue("$.datepicker.regional['']['monthNamesShort']",
__('December')
)
);
PMA_printJsValue(
"$.datepicker.regional['']['monthNamesShort']",
array(
/* l10n: Short month name */
__('Jan'),
@ -440,8 +444,11 @@ PMA_printJsValue("$.datepicker.regional['']['monthNamesShort']",
/* l10n: Short month name */
__('Nov'),
/* l10n: Short month name */
__('Dec')));
PMA_printJsValue("$.datepicker.regional['']['dayNames']",
__('Dec')
)
);
PMA_printJsValue(
"$.datepicker.regional['']['dayNames']",
array(
__('Sunday'),
__('Monday'),
@ -449,8 +456,11 @@ PMA_printJsValue("$.datepicker.regional['']['dayNames']",
__('Wednesday'),
__('Thursday'),
__('Friday'),
__('Saturday')));
PMA_printJsValue("$.datepicker.regional['']['dayNamesShort']",
__('Saturday')
)
);
PMA_printJsValue(
"$.datepicker.regional['']['dayNamesShort']",
array(
/* l10n: Short week day name */
__('Sun'),
@ -465,8 +475,11 @@ PMA_printJsValue("$.datepicker.regional['']['dayNamesShort']",
/* l10n: Short week day name */
__('Fri'),
/* l10n: Short week day name */
__('Sat')));
PMA_printJsValue("$.datepicker.regional['']['dayNamesMin']",
__('Sat')
)
);
PMA_printJsValue(
"$.datepicker.regional['']['dayNamesMin']",
array(
/* l10n: Minimal week day name */
__('Su'),
@ -481,7 +494,9 @@ PMA_printJsValue("$.datepicker.regional['']['dayNamesMin']",
/* l10n: Minimal week day name */
__('Fr'),
/* l10n: Minimal week day name */
__('Sa')));
__('Sa')
)
);
/* l10n: Column header for week of the year in calendar */
PMA_printJsValue("$.datepicker.regional['']['weekHeader']", __('Wk'));

View File

@ -730,10 +730,11 @@ class PMA_Config
PMA_fatalError(
sprintf(
function_exists('__')
? __('Existing configuration file (%s) is not readable.')
: 'Existing configuration file (%s) is not readable.',
$this->getSource())
);
? __('Existing configuration file (%s) is not readable.')
: 'Existing configuration file (%s) is not readable.',
$this->getSource()
)
);
return false;
}
}

View File

@ -194,7 +194,8 @@ class PMA_Table
"SELECT TABLE_NAME
FROM information_schema.VIEWS
WHERE TABLE_SCHEMA = '" . PMA_sqlAddSlashes($db) . "'
AND TABLE_NAME = '" . PMA_sqlAddSlashes($table) . "'");
AND TABLE_NAME = '" . PMA_sqlAddSlashes($table) . "'"
);
return $result ? true : false;
}
@ -368,8 +369,11 @@ class PMA_Table
$query = PMA_backquote($name) . ' ' . $type;
if ($length != ''
&& !preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|'
. 'MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN|UUID)$@i', $type)) {
&& ! preg_match(
'@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|'
. 'MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN|UUID)$@i', $type
)
) {
$query .= '(' . $length . ')';
}
@ -1534,8 +1538,12 @@ class PMA_Table
// there is no $table_create_time, or
// supplied $table_create_time is older than current create time,
// so don't save
return PMA_Message::error(sprintf(
__('Cannot save UI property "%s". The changes made will not be persistent after you refresh this page. Please check if the table structure has been changed.'), $property));
return PMA_Message::error(
sprintf(
__('Cannot save UI property "%s". The changes made will not be persistent after you refresh this page. Please check if the table structure has been changed.'),
$property
)
);
}
}
// save the value

View File

@ -143,7 +143,8 @@ class PMA_Theme
} else {
trigger_error(
sprintf(__('No valid image path for theme %s found!'), $this->getName()),
E_USER_ERROR);
E_USER_ERROR
);
return false;
}
}
@ -339,9 +340,9 @@ class PMA_Theme
echo '<p>';
echo '<a target="_top" class="take_theme" '
.'name="' . htmlspecialchars($this->getId()) . '" '
. 'href="index.php'.PMA_generate_common_url(array(
'set_theme' => $this->getId()
)) . '">';
. 'href="index.php'. PMA_generate_common_url(
array('set_theme' => $this->getId())
) . '">';
if (@file_exists($this->getPath() . '/screen.png')) {
// if screen exists then output

View File

@ -151,7 +151,8 @@ class PMA_Theme_Manager
__('Theme %s not found!'),
htmlspecialchars($theme)
),
E_USER_ERROR);
E_USER_ERROR
);
return false;
}
@ -197,8 +198,11 @@ class PMA_Theme_Manager
*/
function setThemeCookie()
{
$GLOBALS['PMA_Config']->setCookie($this->getThemeCookieName(), $this->theme->id,
$this->theme_default);
$GLOBALS['PMA_Config']->setCookie(
$this->getThemeCookieName(),
$this->theme->id,
$this->theme_default
);
// force a change of a dummy session variable to avoid problems
// with the caching of phpmyadmin.css.php
$GLOBALS['PMA_Config']->set('theme-update', $this->theme->id);
@ -214,9 +218,12 @@ class PMA_Theme_Manager
{
if (! is_dir($folder)) {
trigger_error(
sprintf(__('Theme path not found for theme %s!'),
htmlspecialchars($folder)),
E_USER_ERROR);
sprintf(
__('Theme path not found for theme %s!'),
htmlspecialchars($folder)
),
E_USER_ERROR
);
return false;
}
@ -252,7 +259,8 @@ class PMA_Theme_Manager
} else {
trigger_error(
'phpMyAdmin-ERROR: cannot open themes folder: ' . $this->getThemesPath(),
E_USER_WARNING);
E_USER_WARNING
);
return false;
} // end check for themes directory

View File

@ -526,8 +526,9 @@ function PMA_auth_set_user()
// Duration = one month for username
$GLOBALS['PMA_Config']->setCookie(
'pmaUser-' . $GLOBALS['server'],
PMA_blowfish_encrypt($cfg['Server']['user'],
PMA_get_blowfish_secret())
PMA_blowfish_encrypt(
$cfg['Server']['user'], PMA_get_blowfish_secret()
)
);
// Duration = as configured

View File

@ -43,7 +43,8 @@ function PMA_lang_name($canonical_path, $type = 'name', $default = 'key')
$lang_key = str_replace(
array('Servers/1/', '/'),
array('Servers/', '_'),
$canonical_path) . '_' . $type;
$canonical_path
) . '_' . $type;
return isset($GLOBALS["strConfig$lang_key"])
? ($type == 'desc' ? PMA_lang($lang_key) : $GLOBALS["strConfig$lang_key"])
: ($default == 'key' ? $lang_key : $default);

View File

@ -300,9 +300,11 @@ function validate_pmadb($path, $values)
$error = true;
}
if (!$error) {
$test = test_db_connection($values['Servers/1/extension'], $values['Servers/1/connect_type'],
$test = test_db_connection(
$values['Servers/1/extension'], $values['Servers/1/connect_type'],
$values['Servers/1/host'], $values['Servers/1/port'], $values['Servers/1/socket'],
$values['Servers/1/controluser'], $values['Servers/1/controlpass'], 'Server_pmadb');
$values['Servers/1/controluser'], $values['Servers/1/controlpass'], 'Server_pmadb'
);
if ($test !== true) {
$result = array_merge($result, $test);
}

View File

@ -233,8 +233,11 @@ if (isset($_GET['sql_query'])) {
}
$message = new PMA_Message(__('This value is interpreted using %1$sstrftime%2$s, so you can use time formatting strings. Additionally the following transformations will happen: %3$s. Other text will be kept as is. See the %4$sFAQ%5$s for details.'));
$message->addParam('<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php')). '" target="documentation" title="'
. __('Documentation') . '">', false);
$message->addParam(
'<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php'))
. '" target="documentation" title="' . __('Documentation') . '">',
false
);
$message->addParam('</a>', false);
$message->addParam($trans);
$message->addParam('<a href="Documentation.html#faq6_27" target="documentation">', false);
@ -250,17 +253,26 @@ if (isset($_GET['sql_query'])) {
echo htmlspecialchars($_GET['filename_template']);
} else {
if ($export_type == 'database') {
echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
'pma_db_filename_template',
$GLOBALS['cfg']['Export']['file_template_database']));
echo htmlspecialchars(
$GLOBALS['PMA_Config']->getUserValue(
'pma_db_filename_template',
$GLOBALS['cfg']['Export']['file_template_database']
)
);
} elseif ($export_type == 'table') {
echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
'pma_table_filename_template',
$GLOBALS['cfg']['Export']['file_template_table']));
echo htmlspecialchars(
$GLOBALS['PMA_Config']->getUserValue(
'pma_table_filename_template',
$GLOBALS['cfg']['Export']['file_template_table']
)
);
} else {
echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
'pma_server_filename_template',
$GLOBALS['cfg']['Export']['file_template_server']));
echo htmlspecialchars(
$GLOBALS['PMA_Config']->getUserValue(
'pma_server_filename_template',
$GLOBALS['cfg']['Export']['file_template_server']
)
);
}
}
echo '"';

View File

@ -156,12 +156,13 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine
. ' <tr>' . "\n"
. ' <th colspan="2">' . "\n"
. ' ' . __('Total') . "\n"
. ' : ' . PMA_formatNumber(
$status['Innodb_buffer_pool_pages_total'], 0)
. ' : ' . PMA_formatNumber($status['Innodb_buffer_pool_pages_total'], 0)
. '&nbsp;' . __('pages')
. ' / '
. join('&nbsp;',
PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n"
. join(
'&nbsp;',
PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])
) . "\n"
. ' </th>' . "\n"
. ' </tr>' . "\n"
. ' </tfoot>' . "\n"
@ -300,12 +301,12 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine
}
/**
*
* Gets the InnoDB plugin version number
* http://www.innodb.com/products/innodb_plugin
*
* Gets the InnoDB plugin version number
* http://www.innodb.com/products/innodb_plugin
* (do not confuse this with phpMyAdmin's storage engine plugins!)
*
* @return string the version number, or empty if not running as a plugin
* @return string the version number, or empty if not running as a plugin
*/
function getInnodbPluginVersion()
{
@ -313,13 +314,13 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine
}
/**
*
* Gets the InnoDB file format
*
* Gets the InnoDB file format
* (works only for the InnoDB plugin)
* http://www.innodb.com/products/innodb_plugin
* http://www.innodb.com/products/innodb_plugin
* (do not confuse this with phpMyAdmin's storage engine plugins!)
*
* @return string the InnoDB file format
* @return string the InnoDB file format
*/
function getInnodbFileFormat()
{
@ -327,13 +328,13 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine
}
/**
*
* Verifies if this server supports the innodb_file_per_table feature
*
* Verifies if this server supports the innodb_file_per_table feature
* (works only for the InnoDB plugin)
* http://www.innodb.com/products/innodb_plugin
* http://www.innodb.com/products/innodb_plugin
* (do not confuse this with phpMyAdmin's storage engine plugins!)
*
* @return boolean whether this feature is supported or not
* @return boolean whether this feature is supported or not
*/
function supportsFilePerTable()
{

View File

@ -312,17 +312,20 @@ if (isset($plugin_list)) {
if ($result) {
while ($row = PMA_DBI_fetch_row($result)) {
$tablePropertie = new TableProperty($row);
if ($tablePropertie->isPK())
$lines[] = $tablePropertie->formatXml(''
. ' <id name="#ucfirstName#" type="#dotNetObjectType#" unsaved-value="0">' . "\n"
if ($tablePropertie->isPK()) {
$lines[] = $tablePropertie->formatXml(
' <id name="#ucfirstName#" type="#dotNetObjectType#" unsaved-value="0">' . "\n"
. ' <column name="#name#" sql-type="#type#" not-null="#notNull#" unique="#unique#" index="PRIMARY"/>' . "\n"
. ' <generator class="native" />' . "\n"
. ' </id>');
else
$lines[] = $tablePropertie->formatXml(''
. ' <property name="#ucfirstName#" type="#dotNetObjectType#">' . "\n"
. ' </id>'
);
} else {
$lines[] = $tablePropertie->formatXml(
' <property name="#ucfirstName#" type="#dotNetObjectType#">' . "\n"
. ' <column name="#name#" sql-type="#type#" not-null="#notNull#" #indexName#/>' . "\n"
. ' </property>');
. ' </property>'
);
}
}
PMA_DBI_free_result($result);
}

View File

@ -56,16 +56,18 @@ if (isset($plugin_list)) {
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"
xmlns="http://www.w3.org/TR/REC-html40">
return PMA_exportOutputHandler(
'<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : 'utf-8') . '" />
</head>
<body>');
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : 'utf-8') . '" />
</head>
<body>'
);
}
/**

View File

@ -142,12 +142,13 @@ if (isset($plugin_list)) {
if ($export_struct) {
if (PMA_DRIZZLE) {
$result = PMA_DBI_fetch_result("
SELECT
$result = PMA_DBI_fetch_result(
"SELECT
'utf8' AS DEFAULT_CHARACTER_SET_NAME,
DEFAULT_COLLATION_NAME
FROM data_dictionary.SCHEMAS
WHERE SCHEMA_NAME = '" . PMA_sqlAddSlashes($db) . "'");
WHERE SCHEMA_NAME = '" . PMA_sqlAddSlashes($db) . "'"
);
} else {
$result = PMA_DBI_fetch_result('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME` = \''.PMA_sqlAddSlashes($db).'\' LIMIT 1');
}

View File

@ -23,11 +23,14 @@ if (! defined('PHPMYADMIN')) {
* for PMA_setHistory()
*/
if (! PMA_isValid($_REQUEST['no_history']) && empty($GLOBALS['error_message'])
&& ! empty($GLOBALS['sql_query'])) {
PMA_setHistory(PMA_ifSetOr($GLOBALS['db'], ''),
&& ! empty($GLOBALS['sql_query'])
) {
PMA_setHistory(
PMA_ifSetOr($GLOBALS['db'], ''),
PMA_ifSetOr($GLOBALS['table'], ''),
$GLOBALS['cfg']['Server']['user'],
$GLOBALS['sql_query']);
$GLOBALS['sql_query']
);
}
if ($GLOBALS['error_handler']->hasDisplayErrors()) {

View File

@ -78,7 +78,8 @@ function PMA_RTN_handleExport()
$export_data = PMA_DBI_get_definition(
$db,
$_GET['item_type'],
$_GET['item_name']);
$_GET['item_name']
);
PMA_RTE_handleExport($_GET['item_name'], $export_data);
}
}

View File

@ -130,9 +130,11 @@ function PMA_RTN_getRowForList($routine, $rowclass = '')
{
global $ajax_class, $url_query, $db, $titles;
$sql_drop = sprintf('DROP %s IF EXISTS %s',
$routine['ROUTINE_TYPE'],
PMA_backquote($routine['SPECIFIC_NAME']));
$sql_drop = sprintf(
'DROP %s IF EXISTS %s',
$routine['ROUTINE_TYPE'],
PMA_backquote($routine['SPECIFIC_NAME'])
);
$type_link = "item_type={$routine['ROUTINE_TYPE']}";
$retval = " <tr class='noclick $rowclass'>\n";

View File

@ -136,13 +136,13 @@ class PMA_DIA extends XMLWriter
<dia:attribute name="hguides"/>
<dia:attribute name="vguides"/>
</dia:composite>
</dia:attribute>');
$this->endElement();
$this->startElement('dia:layer');
$this->writeAttribute('name', 'Background');
$this->writeAttribute('visible', 'true');
$this->writeAttribute('active', 'true');
</dia:attribute>'
);
$this->endElement();
$this->startElement('dia:layer');
$this->writeAttribute('name', 'Background');
$this->writeAttribute('visible', 'true');
$this->writeAttribute('active', 'true');
}
/**

View File

@ -79,8 +79,9 @@ if ($showtable) {
: $showtable['Collation'];
if (null === $showtable['Rows']) {
$showtable['Rows'] = PMA_Table::countRecords($GLOBALS['db'],
$showtable['Name'], true);
$showtable['Rows'] = PMA_Table::countRecords(
$GLOBALS['db'], $showtable['Name'], true
);
}
$table_info_num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0;
$row_format = isset($showtable['Row_format']) ? $showtable['Row_format'] : '';

View File

@ -126,10 +126,12 @@ if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
$available_mime = PMA_getAvailableMIMEtypes();
$hint = '<br />' .
sprintf(__('For a list of available transformation options and their MIME type transformations, click on %stransformation descriptions%s'),
sprintf(
__('For a list of available transformation options and their MIME type transformations, click on %stransformation descriptions%s'),
'<a href="transformation_overview.php?'
. PMA_generate_common_url($db, $table) . '" target="_blank">',
'</a>');
'</a>'
);
$header_cells[] = __('MIME type');
@ -382,7 +384,8 @@ for ($i = 0; $i < $num_fields; $i++) {
$tmp_collation = empty($row['Collation']) ? null : $row['Collation'];
$content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(
PMA_CSDROPDOWN_COLLATION, 'field_collation[' . $i . ']',
'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, false);
'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, false
);
unset($tmp_collation);
$ci++;
@ -670,15 +673,20 @@ if ($action == 'tbl_create.php') {
<td width="25">&nbsp;</td>
<td>
<?php
echo PMA_StorageEngine::getHtmlSelect('tbl_storage_engine', null,
(isset($_REQUEST['tbl_storage_engine']) ? $_REQUEST['tbl_storage_engine'] : null));
echo PMA_StorageEngine::getHtmlSelect(
'tbl_storage_engine', null,
(isset($_REQUEST['tbl_storage_engine']) ? $_REQUEST['tbl_storage_engine'] : null)
);
?>
</td>
<td width="25">&nbsp;</td>
<td>
<?php
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation',
null, (isset($_REQUEST['tbl_collation']) ? $_REQUEST['tbl_collation'] : null), false, 3);
echo PMA_generateCharsetDropdownBox(
PMA_CSDROPDOWN_COLLATION, 'tbl_collation', null,
(isset($_REQUEST['tbl_collation']) ? $_REQUEST['tbl_collation'] : null),
false, 3
);
?>
</td>
</tr>

View File

@ -381,8 +381,10 @@ function PMA_displayDbList($ext_dblist, $offset, $count)
printf($href_left, $element_counter, $common_url_query);
printf($img_plus, $element_counter);
} else {
printf($href_left, $element_counter,
PMA_generate_common_url() . $url_dbgroup);
printf(
$href_left, $element_counter,
PMA_generate_common_url() . $url_dbgroup
);
printf($img_minus, $element_counter);
}
echo '</a>';
@ -514,12 +516,15 @@ function PMA_displayTableList($tables, $visible = false,
$element_counter++;
echo '<li>' . "\n";
if ($visible
&& ((isset($_REQUEST['tbl_group'])
&& (strpos($_REQUEST['tbl_group'], $group) === 0
&& ((isset($_REQUEST['tbl_group'])
&& (strpos($_REQUEST['tbl_group'], $group) === 0
|| strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
|| strpos($GLOBALS['table'], $group) === 0)) {
printf($href_left, $element_counter,
$GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full);
|| strpos($GLOBALS['table'], $group) === 0)
) {
printf(
$href_left, $element_counter,
$GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full
);
printf($img_minus, $element_counter);
} else {
printf($href_left, $element_counter, $common_url_query);
@ -551,13 +556,15 @@ function PMA_displayTableList($tables, $visible = false,
unset($table['tab' . $sep . 'group']);
unset($table['tab' . $sep . 'count']);
if ($visible &&
((isset($_REQUEST['tbl_group'])
if ($visible
&& ((isset($_REQUEST['tbl_group'])
&& (strpos($_REQUEST['tbl_group'], $group) === 0
|| strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
|| strpos($GLOBALS['table'], $group) === 0)) {
PMA_displayTableList($table, true,
$tab_group_full . $group, $table_db);
|| strpos($GLOBALS['table'], $group) === 0)
) {
PMA_displayTableList(
$table, true, $tab_group_full . $group, $table_db
);
} else {
PMA_displayTableList($table, false, '', $table_db);
}

View File

@ -317,8 +317,10 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
?>.png" alt="*" />
<?php
}
echo htmlspecialchars($tab_column[$t_n]["COLUMN_NAME"][$j]
. " : " . $tab_column[$t_n]["TYPE"][$j], ENT_QUOTES);
echo htmlspecialchars(
$tab_column[$t_n]["COLUMN_NAME"][$j] . " : " . $tab_column[$t_n]["TYPE"][$j],
ENT_QUOTES
);
?>
</div>
</td>

View File

@ -44,16 +44,18 @@ if (isset($mode)) {
if ('import' == $mode) {
PMA_query_as_controluser(
'UPDATE ' . $pma_table . ',' . $pmd_table .
' SET ' . $pmd_table . '.`x`= ' . $pma_table . '.`x` * '. $scale_q . ',
' . $pmd_table . '.`y`= ' . $pma_table . '.`y` * '. $scale_q .'
WHERE
' . $pmd_table . '.`db_name`=' . $pma_table . '.`db_name`
AND
' . $pmd_table . '.`table_name` = ' . $pma_table . '.`table_name`
AND
' . $pmd_table . '.`db_name`=\''. PMA_sqlAddSlashes($db) .'\'
AND pdf_page_number = ' . $pdf_page_number_q . ';', true, PMA_DBI_QUERY_STORE);
'UPDATE ' . $pma_table . ',' . $pmd_table .
' SET ' . $pmd_table . '.`x`= ' . $pma_table . '.`x` * '. $scale_q . ',
' . $pmd_table . '.`y`= ' . $pma_table . '.`y` * '. $scale_q .'
WHERE
' . $pmd_table . '.`db_name`=' . $pma_table . '.`db_name`
AND
' . $pmd_table . '.`table_name` = ' . $pma_table . '.`table_name`
AND
' . $pmd_table . '.`db_name`=\''. PMA_sqlAddSlashes($db) .'\'
AND pdf_page_number = ' . $pdf_page_number_q . ';',
true, PMA_DBI_QUERY_STORE
);
}
}
@ -77,9 +79,11 @@ echo '<fieldset><legend>' . __('Import/Export coordinates for PDF schema') . '</
$choices = array();
$table_info_result = PMA_query_as_controluser('SELECT * FROM '
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\'');
$table_info_result = PMA_query_as_controluser(
'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db'])
. '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
);
if (PMA_DBI_num_rows($table_info_result) > 0) {
echo '<p>' . __('Page') . ':';

View File

@ -19,20 +19,25 @@ if (! $cfgRelation['designerwork']) {
foreach ($t_x as $key => $value) {
$KEY = empty($IS_AJAX) ? urldecode($key) : $key; // table name decode (post PDF exp/imp)
list($DB,$TAB) = explode(".", $KEY);
PMA_query_as_controluser('DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']) . '
WHERE `db_name` = \'' . PMA_sqlAddSlashes($DB) . '\'
AND `table_name` = \'' . PMA_sqlAddSlashes($TAB) . '\'', true, PMA_DBI_QUERY_STORE);
PMA_query_as_controluser(
'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords'])
. ' WHERE `db_name` = \'' . PMA_sqlAddSlashes($DB) . '\''
. ' AND `table_name` = \'' . PMA_sqlAddSlashes($TAB) . '\'',
true, PMA_DBI_QUERY_STORE
);
PMA_query_as_controluser('INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']) . '
(db_name, table_name, x, y, v, h)
VALUES ('
. '\'' . PMA_sqlAddSlashes($DB) . '\', '
. '\'' . PMA_sqlAddSlashes($TAB) . '\', '
. '\'' . PMA_sqlAddSlashes($t_x[$key]) . '\', '
. '\'' . PMA_sqlAddSlashes($t_y[$key]) . '\', '
. '\'' . PMA_sqlAddSlashes($t_v[$key]) . '\', '
. '\'' . PMA_sqlAddSlashes($t_h[$key]) . '\''
. ')', true, PMA_DBI_QUERY_STORE);
PMA_query_as_controluser(
'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords'])
. ' (db_name, table_name, x, y, v, h)'
. ' VALUES ('
. '\'' . PMA_sqlAddSlashes($DB) . '\', '
. '\'' . PMA_sqlAddSlashes($TAB) . '\', '
. '\'' . PMA_sqlAddSlashes($t_x[$key]) . '\', '
. '\'' . PMA_sqlAddSlashes($t_y[$key]) . '\', '
. '\'' . PMA_sqlAddSlashes($t_v[$key]) . '\', '
. '\'' . PMA_sqlAddSlashes($t_h[$key]) . '\')',
true, PMA_DBI_QUERY_STORE
);
}
//----------------------------------------------------------------------------

View File

@ -42,8 +42,10 @@ if (isset($_POST['revert'])) {
$form_display->fixErrors();
// redirect
$url_params = array('form' => $form_param);
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'prefs_forms.php'
. PMA_generate_common_url($url_params, '&'));
PMA_sendHeaderLocation(
$cfg['PmaAbsoluteUri'] . 'prefs_forms.php'
. PMA_generate_common_url($url_params, '&')
);
exit;
}
@ -56,8 +58,10 @@ if ($form_display->process(false) && !$form_display->hasErrors()) {
// reload config
$GLOBALS['PMA_Config']->loadUserPreferences();
$hash = ltrim(filter_input(INPUT_POST, 'tab_hash'), '#');
PMA_userprefs_redirect($forms, $old_settings, 'prefs_forms.php', array(
'form' => $form_param), $hash);
PMA_userprefs_redirect(
$forms, $old_settings, 'prefs_forms.php',
array('form' => $form_param), $hash
);
exit;
} else {
$error = $result;

View File

@ -31,17 +31,21 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') ==
} else if (isset($_POST['submit_get_json'])) {
$settings = PMA_load_userprefs();
header('Content-Type: application/json');
echo json_encode(array(
'prefs' => json_encode($settings['config_data']),
'mtime' => $settings['mtime']));
echo json_encode(
array(
'prefs' => json_encode($settings['config_data']),
'mtime' => $settings['mtime']
)
);
return;
} else if (isset($_POST['submit_import'])) {
// load from JSON file
$json = '';
if (filter_input(INPUT_POST, 'import_type') == 'text_file'
&& isset($_FILES['import_file'])
&& $_FILES['import_file']['error'] == UPLOAD_ERR_OK
&& is_uploaded_file($_FILES['import_file']['tmp_name'])) {
&& isset($_FILES['import_file'])
&& $_FILES['import_file']['error'] == UPLOAD_ERR_OK
&& is_uploaded_file($_FILES['import_file']['tmp_name'])
) {
// read JSON from uploaded file
$open_basedir = @ini_get('open_basedir');
$file_to_unlink = '';

View File

@ -47,8 +47,10 @@ $config_writable = false;
$config_exists = false;
check_config_rw($config_readable, $config_writable, $config_exists);
if (!$config_writable || !$config_readable) {
messages_set('error', 'config_rw', __('Cannot load or save configuration'),
PMA_lang(__('Please create web server writable folder [em]config[/em] in phpMyAdmin top level directory as described in [a@Documentation.html#setup_script]documentation[/a]. Otherwise you will be only able to download or display it.')));
messages_set(
'error', 'config_rw', __('Cannot load or save configuration'),
PMA_lang(__('Please create web server writable folder [em]config[/em] in phpMyAdmin top level directory as described in [a@Documentation.html#setup_script]documentation[/a]. Otherwise you will be only able to download or display it.'))
);
}
//
// Check https connection
@ -90,13 +92,15 @@ if (!$is_https) {
<?php
// Check for done action info and set notice message if present
switch ($action_done) {
case 'config_saved':
/* Use uniqid to display this message every time configuration is saved */
messages_set('notice', uniqid('config_saved'), __('Configuration saved.'),
PMA_lang(__('Configuration saved to file config/config.inc.php in phpMyAdmin top level directory, copy it to top level one and delete directory config to use it.')));
break;
default:
break;
case 'config_saved':
/* Use uniqid to display this message every time configuration is saved */
messages_set(
'notice', uniqid('config_saved'), __('Configuration saved.'),
PMA_lang(__('Configuration saved to file config/config.inc.php in phpMyAdmin top level directory, copy it to top level one and delete directory config to use it.'))
);
break;
default:
break;
}
?>
@ -115,10 +119,13 @@ messages_show_html();
//
// Display server list
//
display_form_top('index.php', 'get', array(
'page' => 'servers',
'mode' => 'add'
));
display_form_top(
'index.php', 'get',
array(
'page' => 'servers',
'mode' => 'add'
)
);
?>
<div class="form">
<?php if ($cf->getServerCount() > 0): ?>
@ -185,8 +192,10 @@ foreach ($all_languages as $each_lang_key => $each_lang) {
$lang_name = PMA_langName($each_lang);
$opts['values'][$each_lang_key] = $lang_name;
}
display_input('DefaultLang', __('Default language'), '', 'select',
$cf->getValue('DefaultLang'), true, $opts);
display_input(
'DefaultLang', __('Default language'), '', 'select',
$cf->getValue('DefaultLang'), true, $opts
);
// Display server list
$opts = array(
@ -209,8 +218,10 @@ if ($cf->getServerCount() > 0) {
$opts['values']['1'] = __('- none -');
$opts['values_escaped'] = true;
}
display_input('ServerDefault', __('Default server'), '', 'select',
$cf->getValue('ServerDefault'), true, $opts);
display_input(
'ServerDefault', __('Default server'), '', 'select',
$cf->getValue('ServerDefault'), true, $opts
);
// Display EOL list
$opts = array(
@ -219,8 +230,10 @@ $opts = array(
'win' => 'Windows (\r\n)'),
'values_escaped' => true);
$eol = PMA_ifSetOr($_SESSION['eol'], (PMA_IS_WINDOWS ? 'win' : 'unix'));
display_input('eol', __('End of line'), '', 'select',
$eol, true, $opts);
display_input(
'eol', __('End of line'), '', 'select',
$eol, true, $opts
);
?>
<tr>
<td colspan="2" class="lastrow" style="text-align: left">

View File

@ -31,20 +31,23 @@ restore_error_handler();
// Save current language in a cookie, required since we use PMA_MINIMUM_COMMON
$GLOBALS['PMA_Config']->setCookie('pma_lang', $GLOBALS['lang']);
ConfigFile::getInstance()->setPersistKeys(array(
'DefaultLang',
'ServerDefault',
'UploadDir',
'SaveDir',
'Servers/1/verbose',
'Servers/1/host',
'Servers/1/port',
'Servers/1/socket',
'Servers/1/extension',
'Servers/1/connect_type',
'Servers/1/auth_type',
'Servers/1/user',
'Servers/1/password'));
ConfigFile::getInstance()->setPersistKeys(
array(
'DefaultLang',
'ServerDefault',
'UploadDir',
'SaveDir',
'Servers/1/verbose',
'Servers/1/host',
'Servers/1/port',
'Servers/1/socket',
'Servers/1/extension',
'Servers/1/connect_type',
'Servers/1/auth_type',
'Servers/1/user',
'Servers/1/password'
)
);
// allows for redirection even after sending some data
ob_start();

View File

@ -99,9 +99,11 @@ function PMA_version_check()
$connection_timeout = 3;
$url = 'http://phpmyadmin.net/home_page/version.php';
$context = stream_context_create(array(
'http' => array(
'timeout' => $connection_timeout)));
$context = stream_context_create(
array(
'http' => array('timeout' => $connection_timeout)
)
);
$data = @file_get_contents($url, null, $context);
if ($data === false) {
if (function_exists('curl_init')) {
@ -116,7 +118,8 @@ function PMA_version_check()
'error',
$message_id,
__('Version check'),
__('Neither URL wrapper nor CURL is available. Version check is not possible.'));
__('Neither URL wrapper nor CURL is available. Version check is not possible.')
);
return;
}
}
@ -126,7 +129,8 @@ function PMA_version_check()
'error',
$message_id,
__('Version check'),
__('Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.'));
__('Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.')
);
return;
}
@ -146,7 +150,8 @@ function PMA_version_check()
'error',
$message_id,
__('Version check'),
__('Got invalid version string from server'));
__('Got invalid version string from server')
);
return;
}
@ -156,7 +161,8 @@ function PMA_version_check()
'error',
$message_id,
__('Version check'),
__('Unparsable version string'));
__('Unparsable version string')
);
return;
}
@ -167,20 +173,23 @@ function PMA_version_check()
'notice',
$message_id,
__('Version check'),
sprintf(__('A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is %s, released on %s.'), $version, $date));
sprintf(__('A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is %s, released on %s.'), $version, $date)
);
} else {
if ($version_local % 100 == 0) {
messages_set(
'notice',
$message_id,
__('Version check'),
PMA_sanitize(sprintf(__('You are using Git version, run [kbd]git pull[/kbd] :-)[br]The latest stable version is %s, released on %s.'), $version, $date)));
PMA_sanitize(sprintf(__('You are using Git version, run [kbd]git pull[/kbd] :-)[br]The latest stable version is %s, released on %s.'), $version, $date))
);
} else {
messages_set(
'notice',
$message_id,
__('Version check'),
__('No newer stable version is available'));
__('No newer stable version is available')
);
}
}
}
@ -219,7 +228,8 @@ function version_to_int($version)
'notice',
'version_match',
__('Version check'),
'Unknown version part: ' . htmlspecialchars($matches[6]));
'Unknown version part: ' . htmlspecialchars($matches[6])
);
$added = 0;
break;
}
@ -318,7 +328,8 @@ function perform_config_checks()
'notice',
"Servers/$i/ssl",
$title,
__('You should use SSL connections if your database server supports it.'));
__('You should use SSL connections if your database server supports it.')
);
}
//
@ -331,7 +342,8 @@ function perform_config_checks()
'notice',
"Servers/$i/extension",
$title,
__('You should use mysqli for performance reasons.'));
__('You should use mysqli for performance reasons.')
);
}
//
@ -339,15 +351,17 @@ function perform_config_checks()
// warn about full user credentials if 'auth_type' is 'config'
//
if ($cf->getValue("Servers/$i/auth_type") == 'config'
&& $cf->getValue("Servers/$i/user") != ''
&& $cf->getValue("Servers/$i/password") != '') {
&& $cf->getValue("Servers/$i/user") != ''
&& $cf->getValue("Servers/$i/password") != ''
) {
$title = PMA_lang(PMA_lang_name('Servers/1/auth_type')) . " ($server_name)";
messages_set(
'notice',
"Servers/$i/auth_type",
$title,
PMA_lang($strServerAuthConfigMsg, $i) . ' ' .
PMA_lang($strSecurityInfoMsg, $i));
PMA_lang($strServerAuthConfigMsg, $i) . ' '
. PMA_lang($strSecurityInfoMsg, $i)
);
}
//
@ -356,14 +370,16 @@ function perform_config_checks()
// serious security flaw
//
if ($cf->getValue("Servers/$i/AllowRoot")
&& $cf->getValue("Servers/$i/AllowNoPassword")) {
&& $cf->getValue("Servers/$i/AllowNoPassword")
) {
$title = PMA_lang(PMA_lang_name('Servers/1/AllowNoPassword')) . " ($server_name)";
messages_set(
'notice',
"Servers/$i/AllowNoPassword",
$title,
__('You allow for connecting to the server without a password.') . ' ' .
PMA_lang($strSecurityInfoMsg, $i));
__('You allow for connecting to the server without a password.') . ' '
. PMA_lang($strSecurityInfoMsg, $i)
);
}
}
@ -378,7 +394,8 @@ function perform_config_checks()
'notice',
'blowfish_secret_created',
PMA_lang(PMA_lang_name('blowfish_secret')),
$strBlowfishSecretMsg);
$strBlowfishSecretMsg
);
} else {
$blowfish_warnings = array();
// check length
@ -398,7 +415,8 @@ function perform_config_checks()
'error',
'blowfish_warnings' . count($blowfish_warnings),
PMA_lang(PMA_lang_name('blowfish_secret')),
implode('<br />', $blowfish_warnings));
implode('<br />', $blowfish_warnings)
);
}
}
}
@ -412,7 +430,8 @@ function perform_config_checks()
'notice',
'ForceSSL',
PMA_lang(PMA_lang_name('ForceSSL')),
PMA_lang($strForceSSLNotice));
PMA_lang($strForceSSLNotice)
);
}
//
@ -424,7 +443,8 @@ function perform_config_checks()
'notice',
'AllowArbitraryServer',
PMA_lang(PMA_lang_name('AllowArbitraryServer')),
PMA_lang($strAllowArbitraryServerWarning));
PMA_lang($strAllowArbitraryServerWarning)
);
}
//
@ -432,7 +452,8 @@ function perform_config_checks()
// value greater than session.gc_maxlifetime will cause random session invalidation after that time
//
if ($cf->getValue('LoginCookieValidity') > 1440
|| $cf->getValue('LoginCookieValidity') > ini_get('session.gc_maxlifetime')) {
|| $cf->getValue('LoginCookieValidity') > ini_get('session.gc_maxlifetime')
) {
$message_type = $cf->getValue('LoginCookieValidity') > ini_get('session.gc_maxlifetime')
? 'error'
: 'notice';
@ -440,7 +461,8 @@ function perform_config_checks()
$message_type,
'LoginCookieValidity',
PMA_lang(PMA_lang_name('LoginCookieValidity')),
PMA_lang($strLoginCookieValidityWarning));
PMA_lang($strLoginCookieValidityWarning)
);
}
//
@ -452,7 +474,8 @@ function perform_config_checks()
'notice',
'LoginCookieValidity',
PMA_lang(PMA_lang_name('LoginCookieValidity')),
PMA_lang($strLoginCookieValidityWarning2));
PMA_lang($strLoginCookieValidityWarning2)
);
}
//
@ -465,7 +488,8 @@ function perform_config_checks()
'error',
'LoginCookieValidity',
PMA_lang(PMA_lang_name('LoginCookieValidity')),
PMA_lang($strLoginCookieValidityWarning3));
PMA_lang($strLoginCookieValidityWarning3)
);
}
//
@ -477,7 +501,8 @@ function perform_config_checks()
'notice',
'SaveDir',
PMA_lang(PMA_lang_name('SaveDir')),
PMA_lang($strDirectoryNotice));
PMA_lang($strDirectoryNotice)
);
}
//
@ -489,7 +514,8 @@ function perform_config_checks()
'notice',
'TempDir',
PMA_lang(PMA_lang_name('TempDir')),
PMA_lang($strDirectoryNotice));
PMA_lang($strDirectoryNotice)
);
}
//
@ -497,12 +523,14 @@ function perform_config_checks()
// requires zlib functions
//
if ($cf->getValue('GZipDump')
&& (@!function_exists('gzopen') || @!function_exists('gzencode'))) {
&& (@!function_exists('gzopen') || @!function_exists('gzencode'))
) {
messages_set(
'error',
'GZipDump',
PMA_lang(PMA_lang_name('GZipDump')),
PMA_lang($strGZipDumpWarning, 'gzencode'));
PMA_lang($strGZipDumpWarning, 'gzencode')
);
}
//
@ -510,7 +538,8 @@ function perform_config_checks()
// requires bzip2 functions
//
if ($cf->getValue('BZipDump')
&& (!@function_exists('bzopen') || !@function_exists('bzcompress'))) {
&& (!@function_exists('bzopen') || !@function_exists('bzcompress'))
) {
$functions = @function_exists('bzopen')
? '' :
'bzopen';
@ -521,7 +550,8 @@ function perform_config_checks()
'error',
'BZipDump',
PMA_lang(PMA_lang_name('BZipDump')),
PMA_lang($strBZipDumpWarning, $functions));
PMA_lang($strBZipDumpWarning, $functions)
);
}
//
@ -533,7 +563,8 @@ function perform_config_checks()
'error',
'ZipDump_import',
PMA_lang(PMA_lang_name('ZipDump')),
PMA_lang($strZipDumpImportWarning, 'zip_open'));
PMA_lang($strZipDumpImportWarning, 'zip_open')
);
}
//
@ -545,7 +576,8 @@ function perform_config_checks()
'error',
'ZipDump_export',
PMA_lang(PMA_lang_name('ZipDump')),
PMA_lang($strZipDumpExportWarning, 'gzcompress'));
PMA_lang($strZipDumpExportWarning, 'gzcompress')
);
}
}
?>

View File

@ -167,16 +167,20 @@ if (isset($_REQUEST['do_save_data'])) {
// Update comment table for mime types [MIME]
if (isset($_REQUEST['field_mimetype'])
&& is_array($_REQUEST['field_mimetype'])
&& $cfg['BrowseMIME']) {
&& is_array($_REQUEST['field_mimetype'])
&& $cfg['BrowseMIME']
) {
foreach ($_REQUEST['field_mimetype'] as $fieldindex => $mimetype) {
if (isset($_REQUEST['field_name'][$fieldindex])
&& strlen($_REQUEST['field_name'][$fieldindex])) {
PMA_setMIME($db, $table,
&& strlen($_REQUEST['field_name'][$fieldindex])
) {
PMA_setMIME(
$db, $table,
$_REQUEST['field_name'][$fieldindex],
$mimetype,
$_REQUEST['field_transformation'][$fieldindex],
$_REQUEST['field_transformation_options'][$fieldindex]);
$_REQUEST['field_transformation_options'][$fieldindex]
);
}
}
}

View File

@ -241,8 +241,10 @@ if (isset($_REQUEST['do_save_data'])) {
$tbl_url_params['table'] = $table;
$is_show_stats = $cfg['ShowStats'];
$tbl_stats_result = PMA_DBI_query('SHOW TABLE STATUS FROM '
. PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddSlashes($table, true) . '\';');
$tbl_stats_result = PMA_DBI_query(
'SHOW TABLE STATUS FROM ' . PMA_backquote($db)
. ' LIKE \'' . PMA_sqlAddSlashes($table, true) . '\';'
);
$tbl_stats = PMA_DBI_fetch_assoc($tbl_stats_result);
PMA_DBI_free_result($tbl_stats_result);
unset($tbl_stats_result);

View File

@ -16,8 +16,10 @@ PMA_checkParameters(array('db', 'table', 'where_clause', 'transform_key'));
/* Select database */
if (!PMA_DBI_select_db($db)) {
PMA_mysqlDie(sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)),
'', '');
PMA_mysqlDie(
sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)),
'', ''
);
}
/* Check if table exists */

View File

@ -17,8 +17,9 @@ require_once 'libraries/tbl_common.php';
$fields = array();
foreach (PMA_DBI_get_columns_full($db, $table) as $row) {
if (preg_match('@^(set|enum)\((.+)\)$@i', $row['Type'], $tmp)) {
$tmp[2] = substr(preg_replace('@([^,])\'\'@', '\\1\\\'',
',' . $tmp[2]), 1);
$tmp[2] = substr(
preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1
);
$fields[$row['Field']] = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
} else {
$fields[$row['Field']] = $row['Type'];

View File

@ -47,8 +47,10 @@ if (PMA_isValid($_REQUEST['new_name'])) {
}
$result = false;
} else {
$result = PMA_Table::moveCopy($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name'],
$_REQUEST['what'], isset($_REQUEST['submit_move']), 'one_table');
$result = PMA_Table::moveCopy(
$db, $table, $_REQUEST['target_db'], $_REQUEST['new_name'],
$_REQUEST['what'], isset($_REQUEST['submit_move']), 'one_table'
);
if (isset($_REQUEST['submit_move'])) {
$message = PMA_Message::success(__('Table %s has been moved to %s.'));

View File

@ -108,7 +108,8 @@ foreach ($the_tables as $key => $table) {
$show_create_table = PMA_DBI_fetch_value(
'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
0, 1);
0, 1
);
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
// Check if we can use Relations

View File

@ -521,18 +521,22 @@ if (count($columns) > 0) {
// For ON DELETE and ON UPDATE, the default action
// is RESTRICT as per MySQL doc; however, a SHOW CREATE TABLE
// won't display the clause if it's set as RESTRICT.
PMA_generate_dropdown('ON DELETE',
PMA_generate_dropdown(
'ON DELETE',
'on_delete[' . $myfield_md5 . ']',
$options_array,
isset($existrel_foreign[$myfield]['on_delete']) ? $existrel_foreign[$myfield]['on_delete']: 'RESTRICT');
isset($existrel_foreign[$myfield]['on_delete']) ? $existrel_foreign[$myfield]['on_delete']: 'RESTRICT'
);
echo '</span>' . "\n"
.'<span class="formelement">' . "\n";
PMA_generate_dropdown('ON UPDATE',
PMA_generate_dropdown(
'ON UPDATE',
'on_update[' . $myfield_md5 . ']',
$options_array,
isset($existrel_foreign[$myfield]['on_update']) ? $existrel_foreign[$myfield]['on_update']: 'RESTRICT');
isset($existrel_foreign[$myfield]['on_update']) ? $existrel_foreign[$myfield]['on_update']: 'RESTRICT'
);
echo '</span>' . "\n";
} else {
echo __('No index defined!');

View File

@ -137,8 +137,9 @@ $fields = (array) PMA_DBI_get_columns($db, $table, null, true);
// in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910).
$show_create_table = PMA_DBI_fetch_value(
'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
0, 1);
'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
0, 1
);
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
/**
@ -193,7 +194,7 @@ $i = 0;
echo '"table" />';
} ?>
<table id="tablestructure" class="data<?php
<table id="tablestructure" class="data<?php
if ($GLOBALS['cfg']['PropertiesIconic'] === true) echo ' PropertiesIconic'; ?>">
<thead>
<tr>
@ -209,7 +210,7 @@ $i = 0;
<?php if ($db_is_information_schema || $tbl_is_view) { ?>
<th><?php echo __('View'); ?></th>
<?php } else { /* see tbl_structure.js, function moreOptsMenuResize() */ ?>
<th colspan="<?php
<th colspan="<?php
$colspan = 9;
if (PMA_DRIZZLE) {
$colspan -= 2;
@ -402,7 +403,7 @@ foreach ($fields as $row) {
echo "\n";
?>
</td>
<?php
<?php
if (!PMA_DRIZZLE) { ?>
<td class="spatial replaced_by_more center">
@ -689,8 +690,10 @@ if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' != $tbl_storage_
<form action="tbl_indexes.php" method="post">
<?php
echo PMA_generate_common_hidden_inputs($db, $table);
echo sprintf(__('Create an index on &nbsp;%s&nbsp;columns'),
'<input type="text" size="2" name="added_fields" value="1" />');
echo sprintf(
__('Create an index on &nbsp;%s&nbsp;columns'),
'<input type="text" size="2" name="added_fields" value="1" />'
);
?>
<input type="hidden" name="create_index" value="1" />
<input class="add_index<?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' ajax' : '');?>" type="submit" value="<?php echo __('Go'); ?>" />

View File

@ -171,11 +171,13 @@ if (isset($_REQUEST['submit_create_version'])) {
$tracking_set = rtrim($tracking_set, ',');
if (PMA_Tracker::createVersion($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'], $tracking_set )) {
$msg = PMA_Message::success(sprintf(
__('Version %1$s was created, tracking for %2$s is active.'),
htmlspecialchars($_REQUEST['version']),
htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table'])
));
$msg = PMA_Message::success(
sprintf(
__('Version %1$s was created, tracking for %2$s is active.'),
htmlspecialchars($_REQUEST['version']),
htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table'])
)
);
$msg->display();
}
}
@ -183,11 +185,13 @@ if (isset($_REQUEST['submit_create_version'])) {
// Deactivate tracking
if (isset($_REQUEST['submit_deactivate_now'])) {
if (PMA_Tracker::deactivateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])) {
$msg = PMA_Message::success(sprintf(
__('Tracking for %1$s was deactivated at version %2$s.'),
htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']),
htmlspecialchars($_REQUEST['version'])
));
$msg = PMA_Message::success(
sprintf(
__('Tracking for %1$s was deactivated at version %2$s.'),
htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']),
htmlspecialchars($_REQUEST['version'])
)
);
$msg->display();
}
}
@ -195,11 +199,13 @@ if (isset($_REQUEST['submit_deactivate_now'])) {
// Activate tracking
if (isset($_REQUEST['submit_activate_now'])) {
if (PMA_Tracker::activateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])) {
$msg = PMA_Message::success(sprintf(
__('Tracking for %1$s was activated at version %2$s.'),
htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']),
htmlspecialchars($_REQUEST['version'])
));
$msg = PMA_Message::success(
sprintf(
__('Tracking for %1$s was activated at version %2$s.'),
htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']),
htmlspecialchars($_REQUEST['version'])
)
);
$msg->display();
}
}
@ -207,7 +213,7 @@ if (isset($_REQUEST['submit_activate_now'])) {
// Export as SQL execution
if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'execution') {
foreach ($entries as $entry) {
$sql_result = PMA_DBI_query( "/*NOTRACK*/\n" . $entry['statement'] );
$sql_result = PMA_DBI_query("/*NOTRACK*/\n" . $entry['statement']);
}
$msg = PMA_Message::success(__('SQL statements executed.'));
$msg->display();

View File

@ -18,8 +18,10 @@ class Environment_test extends PHPUnit_Framework_TestCase
{
public function testPhpVersion()
{
$this->assertTrue(version_compare('5.2', phpversion(), '<='),
'phpMyAdmin requires PHP 5.2 or above');
$this->assertTrue(
version_compare('5.2', phpversion(), '<='),
'phpMyAdmin requires PHP 5.2 or above'
);
}
public function testMySQL()

View File

@ -54,8 +54,13 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
$GLOBALS['footnotes'][$key]['nr'] = $nr;
$GLOBALS['footnotes'][$key]['instance'] = $instance;
$this->assertEquals(sprintf('<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>',
$nr, $instance + 1, $nr), PMA_showHint('test'));
$this->assertEquals(
sprintf(
'<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>',
$nr, $instance + 1, $nr
),
PMA_showHint('test')
);
}
/**
@ -69,8 +74,10 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
$GLOBALS['footnotes'][$key]['nr'] = $nr;
$GLOBALS['footnotes'][$key]['instance'] = $instance;
$this->assertEquals(sprintf('[sup]%d[/sup]', $nr),
PMA_showHint('test', true));
$this->assertEquals(
sprintf('[sup]%d[/sup]', $nr),
PMA_showHint('test', true)
);
}
/**
@ -124,8 +131,10 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
$nr = 1;
$instance = 1;
$oMock = $this->getMock('PMA_Message',
array('setMessage', 'setNumber', 'getHash', 'getLevel'));
$oMock = $this->getMock(
'PMA_Message',
array('setMessage', 'setNumber', 'getHash', 'getLevel')
);
$oMock->setMessage('test');
$oMock->setNumber($nr);
@ -134,8 +143,13 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
$GLOBALS['footnotes'][$key]['nr'] = $nr;
$GLOBALS['footnotes'][$key]['instance'] = $instance;
$this->assertEquals(sprintf('<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>',
$nr, $instance + 1, $nr), PMA_showHint($oMock));
$this->assertEquals(
sprintf(
'<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>',
$nr, $instance + 1, $nr
),
PMA_showHint($oMock)
);
}
/**
@ -146,12 +160,20 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
$nr = 1;
$instance = 1;
$oMock = $this->getMock('PMA_Message',
array('setMessage', 'setNumber', 'getHash', 'getLevel', 'getNumber'));
$oMock = $this->getMock(
'PMA_Message',
array('setMessage', 'setNumber', 'getHash', 'getLevel', 'getNumber')
);
$oMock->setMessage('test');
$oMock->setNumber($nr);
$this->assertEquals(sprintf('<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>', $nr, $instance, $nr), PMA_showHint($oMock, false));
$this->assertEquals(
sprintf(
'<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>',
$nr, $instance, $nr
),
PMA_showHint($oMock, false)
);
$key = $oMock->getHash();

View File

@ -17,19 +17,23 @@ class PMA_blowfish_test extends PHPUnit_Framework_TestCase
{
$secret = '$%ÄüfuDFRR';
$string = '12345678';
$this->assertEquals($string,
PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
$this->assertEquals(
$string,
PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret)
);
}
public function testEncryptDecryptChars()
{
$secret = '$%ÄüfuDFRR';
$string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³';
$this->assertEquals($string,
PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
$this->assertEquals(
$string,
PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret)
);
}
/* Due to differences in the initialization factor, these tests are not portable between systems.
/* Due to differences in the initialization factor, these tests are not portable between systems.
public function testEncrypt()
{
$secret = '$%ÄüfuDFRR';

View File

@ -15,32 +15,42 @@ class PMA_transformation_getOptions_test extends PHPUnit_Framework_TestCase
{
public function testDefault()
{
$this->assertEquals(array('option1 ', ' option2 '),
PMA_transformation_getOptions("option1 , option2 "));
$this->assertEquals(
array('option1 ', ' option2 '),
PMA_transformation_getOptions("option1 , option2 ")
);
}
public function testQuoted()
{
$this->assertEquals(array('option1', ' option2'),
PMA_transformation_getOptions("'option1' ,' option2' "));
$this->assertEquals(
array('option1', ' option2'),
PMA_transformation_getOptions("'option1' ,' option2' ")
);
}
public function testComma()
{
$this->assertEquals(array('2,3', ' ,, option ,,'),
PMA_transformation_getOptions("'2,3' ,' ,, option ,,' "));
$this->assertEquals(
array('2,3', ' ,, option ,,'),
PMA_transformation_getOptions("'2,3' ,' ,, option ,,' ")
);
}
public function testEmptyOptions()
{
$this->assertEquals(array('', '', ''),
PMA_transformation_getOptions("'',,"));
$this->assertEquals(
array('', '', ''),
PMA_transformation_getOptions("'',,")
);
}
public function testEmpty()
{
$this->assertEquals(array(),
PMA_transformation_getOptions(''));
$this->assertEquals(
array(),
PMA_transformation_getOptions('')
);
}
}
?>

View File

@ -38,12 +38,14 @@ class PMA_browseUploadFile_test extends PHPUnit_Framework_TestCase
*/
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>'
. '<input type="file" name="import_file" id="input_import_file" />'
. "(" . __('Max: '). $res . $unit .")" . "\n"
. '<input type="hidden" name="MAX_FILE_SIZE" value="' .$size . '" />' . "\n");
$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>'
. '<input type="file" name="import_file" id="input_import_file" />'
. "(" . __('Max: '). $res . $unit .")" . "\n"
. '<input type="hidden" name="MAX_FILE_SIZE" value="' .$size . '" />' . "\n"
);
PMA_browseUploadFile($size);
}

View File

@ -37,7 +37,9 @@ class PMA_generateHiddenMaxFileSize_test extends PHPUnit_Framework_TestCase
*/
function test_generateHiddenMaxFileSize($size)
{
$this->assertEquals(PMA_generateHiddenMaxFileSize($size),
'<input type="hidden" name="MAX_FILE_SIZE" value="' .$size . '" />');
$this->assertEquals(
PMA_generateHiddenMaxFileSize($size),
'<input type="hidden" name="MAX_FILE_SIZE" value="' . $size . '" />'
);
}
}

View File

@ -39,7 +39,8 @@ class PMA_showMessage_test extends PHPUnit_Framework_TestCase
$GLOBALS['sql_query'] = "SELECT * FROM tblPatient ";
$this->expectOutputString("<script type=\"text/javascript\">
$this->expectOutputString(
"<script type=\"text/javascript\">
//<![CDATA[
if (window.parent.updateTableTitle) window.parent.updateTableTitle('db.tbl', ' ()');
//]]>
@ -57,7 +58,8 @@ class PMA_showMessage_test extends PHPUnit_Framework_TestCase
<a href=\"import.php?db=db&amp;table=tbl&amp;sql_query=SELECT+%2A+FROM+tblPatient+&amp;show_query=1&amp;show_as_php=1&amp;server=server&amp;lang=en&amp;token=647a62ad301bf9025e3b13bc7caa02cb\" >Create PHP Code</a>
] [
<a href=\"import.php?db=db&amp;table=tbl&amp;sql_query=SELECT+%2A+FROM+tblPatient+&amp;show_query=1&amp;server=server&amp;lang=en&amp;token=647a62ad301bf9025e3b13bc7caa02cb\" >Refresh</a>
]</div></div>");
]</div></div>"
);
echo PMA_showMessage("msg");

View File

@ -18,8 +18,10 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
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.');
$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);
}
@ -55,8 +57,10 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
{
$ext = 'php_ext';
$extra = 'Appended Extra String';
$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.'.' '.$extra);
$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.'.' '.$extra
);
PMA_warnMissingExtension($ext, false, $extra);
$this->assertTrue(true);
}

View File

@ -155,8 +155,10 @@ if (@file_exists($pmaThemeImage . 'logo_right.png')) {
?>
<h1>
<?php
echo sprintf(__('Welcome to %s'),
'<bdo dir="ltr" lang="en">phpMyAdmin ' . PMA_VERSION . '</bdo>');
echo sprintf(
__('Welcome to %s'),
'<bdo dir="ltr" lang="en">phpMyAdmin ' . PMA_VERSION . '</bdo>'
);
?>
</h1>