The branch, master has been updated
via 3d1813c66c244ccc7571d467d4767a0169150489 (commit)
via 946b82a1fb23adff4a789c393df230f0e15e6bc9 (commit)
via 5c751cd1c033664ea830c1fd152f11ab826092d6 (commit)
from fd118e02d45cab28409e64837fdcc8367a5c9ce8 (commit)
- Log -----------------------------------------------------------------
commit 3d1813c66c244ccc7571d467d4767a0169150489
Author: Dieter Adriaenssens <ruleant(a)users.sourceforge.net>
Date: Thu Aug 25 23:04:03 2011 +0200
fix coding style, whitespace cleanup, docblocks
commit 946b82a1fb23adff4a789c393df230f0e15e6bc9
Author: Dieter Adriaenssens <ruleant(a)users.sourceforge.net>
Date: Thu Aug 25 22:41:40 2011 +0200
remove unused code
commit 5c751cd1c033664ea830c1fd152f11ab826092d6
Author: Dieter Adriaenssens <ruleant(a)users.sourceforge.net>
Date: Thu Aug 25 22:38:51 2011 +0200
make die() messages translatable, where possible
-----------------------------------------------------------------------
Summary of changes:
export.php | 4 +-
file_echo.php | 2 +-
libraries/Config.class.php | 79 +++++++++++++++---------
libraries/auth/cookie.auth.lib.php | 2 +-
libraries/common.inc.php | 4 +-
libraries/core.lib.php | 2 +-
libraries/header_http.inc.php | 2 +-
libraries/header_meta_style.inc.php | 2 +-
libraries/schema/Pdf_Relation_Schema.class.php | 5 --
pmd_relation_new.php | 2 -
setup/frames/form.inc.php | 4 +-
setup/index.php | 2 +-
setup/validate.php | 2 +-
13 files changed, 62 insertions(+), 50 deletions(-)
diff --git a/export.php b/export.php
index c5af244..aa64600 100644
--- a/export.php
+++ b/export.php
@@ -26,7 +26,7 @@ $type = $what;
// Check export type
if (! isset($export_list[$type])) {
- die('Bad type!');
+ die(__('Bad type!'));
}
/**
@@ -103,7 +103,7 @@ if ($export_type == 'server') {
} elseif ($export_type == 'table' && strlen($db) && strlen($table)) {
$err_url = 'tbl_export.php?' . PMA_generate_common_url($db, $table);
} else {
- die('Bad parameters!');
+ die(__('Bad parameters!'));
}
// Get the functions specific to the export type
diff --git a/file_echo.php b/file_echo.php
index 11a4487..bdfc173 100644
--- a/file_echo.php
+++ b/file_echo.php
@@ -18,7 +18,7 @@ if (isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
/* Check whether MIME type is allowed */
if (! isset($allowed[$_REQUEST['type']])) {
- die('Invalid export type');
+ die(__('Invalid export type'));
}
/*
diff --git a/libraries/Config.class.php b/libraries/Config.class.php
index 669bf32..49a3e1d 100644
--- a/libraries/Config.class.php
+++ b/libraries/Config.class.php
@@ -182,8 +182,7 @@ class PMA_Config
'@Opera(/| )([0-9].[0-9]{1,2})@',
$HTTP_USER_AGENT,
$log_version
- )
- ) {
+ )) {
$this->set('PMA_USR_BROWSER_VER', $log_version[2]);
$this->set('PMA_USR_BROWSER_AGENT', 'OPERA');
} elseif (preg_match(
@@ -196,8 +195,8 @@ class PMA_Config
} elseif (preg_match(
'@OmniWeb/([0-9].[0-9]{1,2})@',
$HTTP_USER_AGENT,
- $log_version)
- ) {
+ $log_version
+ )) {
$this->set('PMA_USR_BROWSER_VER', $log_version[1]);
$this->set('PMA_USR_BROWSER_AGENT', 'OMNIWEB');
// Konqueror 2.2.2 says Konqueror/2.2.2
@@ -205,8 +204,8 @@ class PMA_Config
} elseif (preg_match(
'@(Konqueror/)(.*)(;)@',
$HTTP_USER_AGENT,
- $log_version)
- ) {
+ $log_version
+ )) {
$this->set('PMA_USR_BROWSER_VER', $log_version[2]);
$this->set('PMA_USR_BROWSER_AGENT', 'KONQUEROR');
} elseif (preg_match(
@@ -223,8 +222,8 @@ class PMA_Config
} elseif (
preg_match('@Mozilla/([0-9].[0-9]{1,2})@',
$HTTP_USER_AGENT,
- $log_version)
- ) {
+ $log_version
+ )) {
$this->set('PMA_USR_BROWSER_VER', $log_version[1]);
$this->set('PMA_USR_BROWSER_AGENT', 'MOZILLA');
} else {
@@ -327,12 +326,12 @@ class PMA_Config
if (! preg_match(
'@([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})@',
phpversion(),
- $match)
- ) {
- preg_match(
- '@([0-9]{1,2}).([0-9]{1,2})@',
- phpversion(),
$match
+ )) {
+ preg_match(
+ '@([0-9]{1,2}).([0-9]{1,2})@',
+ phpversion(),
+ $match
);
}
if (isset($match) && ! empty($match[1])) {
@@ -457,11 +456,15 @@ class PMA_Config
* @todo check validity of $_COOKIE['pma_collation_connection']
*/
if (! empty($_COOKIE['pma_collation_connection'])) {
- $this->set('collation_connection',
- strip_tags($_COOKIE['pma_collation_connection']));
+ $this->set(
+ 'collation_connection',
+ strip_tags($_COOKIE['pma_collation_connection'])
+ );
} else {
- $this->set('collation_connection',
- $this->get('DefaultConnectionCollation'));
+ $this->set(
+ 'collation_connection',
+ $this->get('DefaultConnectionCollation')
+ );
}
// Now, a collation information could come from REQUEST
// (an example of this: the collation selector in main.php)
@@ -485,7 +488,9 @@ class PMA_Config
// will have everything avaiable in session cache
$server = isset($GLOBALS['server'])
? $GLOBALS['server']
- : (!empty($GLOBALS['cfg']['ServerDefault']) ? $GLOBALS['cfg']['ServerDefault'] : 0);
+ : (!empty($GLOBALS['cfg']['ServerDefault'])
+ ? $GLOBALS['cfg']['ServerDefault']
+ : 0);
$cache_key = 'server_' . $server;
if ($server > 0 && !defined('PMA_MINIMUM_COMMON')) {
$config_mtime = max($this->default_source_mtime, $this->source_mtime);
@@ -510,8 +515,14 @@ class PMA_Config
}
$config_data = $_SESSION['cache'][$cache_key]['userprefs'];
// type is 'db' or 'session'
- $this->set('user_preferences', $_SESSION['cache'][$cache_key]['userprefs_type']);
- $this->set('user_preferences_mtime', $_SESSION['cache'][$cache_key]['userprefs_mtime']);
+ $this->set(
+ 'user_preferences',
+ $_SESSION['cache'][$cache_key]['userprefs_type']
+ );
+ $this->set(
+ 'user_preferences_mtime',
+ $_SESSION['cache'][$cache_key]['userprefs_mtime']
+ );
// backup some settings
$org_fontsize = $this->settings['fontsize'];
@@ -584,7 +595,8 @@ class PMA_Config
if ((! isset($config_data['collation_connection'])
&& $GLOBALS['collation_connection'] != 'utf8_general_ci')
|| isset($config_data['collation_connection'])
- && $GLOBALS['collation_connection'] != $config_data['collation_connection']
+ && $GLOBALS['collation_connection']
+ != $config_data['collation_connection']
) {
$this->setUserValue(
null,
@@ -607,10 +619,12 @@ class PMA_Config
}
/**
- * Sets config value which is stored in user preferences (if available) or in a cookie.
+ * Sets config value which is stored in user preferences (if available)
+ * or in a cookie.
*
- * If user preferences are not yet initialized, option is applied to global config and
- * added to a update queue, which is processed by {@link loadUserPreferences()}
+ * If user preferences are not yet initialized, option is applied to
+ * global config and added to a update queue, which is processed
+ * by {@link loadUserPreferences()}
*
* @param string $cookie_name can be null
* @param string $cfg_path
@@ -686,7 +700,7 @@ class PMA_Config
{
// Refuse to work while there still might be some world writable dir:
if (is_dir('./config')) {
- die('Remove "./config" directory before using phpMyAdmin!');
+ die(__('Remove "./config" directory before using phpMyAdmin!'));
}
}
@@ -710,8 +724,9 @@ class PMA_Config
if (! is_readable($this->getSource())) {
$this->source_mtime = 0;
die(
- 'Existing configuration file ('
- . $this->getSource() . ') is not readable.'
+ sprintf(__('Existing configuration file (%d) is not readable.'),
+ $this->getSource()
+ )
);
}
@@ -734,7 +749,7 @@ class PMA_Config
$this->checkWebServerOs();
if ($this->get('PMA_IS_WINDOWS') == 0) {
$this->source_mtime = 0;
- die('Wrong permissions on configuration file, should not be world writable!');
+ die(__('Wrong permissions on configuration file, should not be world writable!'));
}
}
}
@@ -1011,9 +1026,9 @@ class PMA_Config
if ('off' == strtolower(ini_get('file_uploads'))) {
$this->set('enable_upload', false);
}
- } else {
+ } else {
$this->set('enable_upload', false);
- }
+ }
}
/**
@@ -1051,6 +1066,8 @@ class PMA_Config
}
/**
+ * Checks if protocol is https
+ *
* @return bool
*/
public function isHttps()
@@ -1129,6 +1146,8 @@ class PMA_Config
}
/**
+ * Get cookie path
+ *
* @return string
*/
public function getCookiePath()
diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php
index c2e50c0..2a3f7c1 100644
--- a/libraries/auth/cookie.auth.lib.php
+++ b/libraries/auth/cookie.auth.lib.php
@@ -32,7 +32,7 @@ if (function_exists('mcrypt_encrypt')) {
srand((double) microtime() * 1000000);
$td = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');
if ($td === false) {
- die('Failed to use Blowfish from mcrypt!');
+ die(__('Failed to use Blowfish from mcrypt!'));
}
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
$GLOBALS['PMA_Config']->setCookie('pma_mcrypt_iv', base64_encode($iv));
diff --git a/libraries/common.inc.php b/libraries/common.inc.php
index 26e7a01..085bcb2 100644
--- a/libraries/common.inc.php
+++ b/libraries/common.inc.php
@@ -144,7 +144,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
* protect against possible exploits - there is no need to have so much variables
*/
if (count($_REQUEST) > 1000) {
- die('possible exploit');
+ die(__('possible exploit'));
}
/**
@@ -153,7 +153,7 @@ if (count($_REQUEST) > 1000) {
*/
foreach ($GLOBALS as $key => $dummy) {
if (is_numeric($key)) {
- die('numeric key detected');
+ die(__('numeric key detected'));
}
}
unset($dummy);
diff --git a/libraries/core.lib.php b/libraries/core.lib.php
index 6379336..b4905c9 100644
--- a/libraries/core.lib.php
+++ b/libraries/core.lib.php
@@ -406,7 +406,7 @@ function PMA_arrayWalkRecursive(&$array, $function, $apply_to_keys_also = false)
{
static $recursive_counter = 0;
if (++$recursive_counter > 1000) {
- die('possible deep recursion attack');
+ die(__('possible deep recursion attack'));
}
foreach ($array as $key => $value) {
if (is_array($value)) {
diff --git a/libraries/header_http.inc.php b/libraries/header_http.inc.php
index 3b32915..4b4e454 100644
--- a/libraries/header_http.inc.php
+++ b/libraries/header_http.inc.php
@@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) {
*
*/
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
- die("GLOBALS overwrite attempt");
+ die(__("GLOBALS overwrite attempt"));
}
/**
diff --git a/libraries/header_meta_style.inc.php b/libraries/header_meta_style.inc.php
index 5e5c533..076035b 100644
--- a/libraries/header_meta_style.inc.php
+++ b/libraries/header_meta_style.inc.php
@@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) {
*
*/
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
- die("GLOBALS overwrite attempt");
+ die(__("GLOBALS overwrite attempt"));
}
/**
diff --git a/libraries/schema/Pdf_Relation_Schema.class.php b/libraries/schema/Pdf_Relation_Schema.class.php
index 6108375..ff1a000 100644
--- a/libraries/schema/Pdf_Relation_Schema.class.php
+++ b/libraries/schema/Pdf_Relation_Schema.class.php
@@ -587,11 +587,6 @@ class Table_Stats
$pdf->PMA_PDF_setXScale($this->x);
$pdf->SetFillColor(255);
}
- /*if ($pdf->PageNo() > 1) {
- $pdf->PMA_PDF_die(
- __('The scale factor is too small to fit the schema on one page')
- );
- } */
}
}
diff --git a/pmd_relation_new.php b/pmd_relation_new.php
index fbd6246..8566d2d 100644
--- a/pmd_relation_new.php
+++ b/pmd_relation_new.php
@@ -16,8 +16,6 @@ extract($_POST, EXTR_SKIP);
$tables = PMA_DBI_get_tables_full($db, $T1);
$type_T1 = strtoupper($tables[$T1]['ENGINE']);
$tables = PMA_DBI_get_tables_full($db, $T2);
-//print_r($tables);
-//die();
$type_T2 = strtoupper($tables[$T2]['ENGINE']);
// native foreign key
diff --git a/setup/frames/form.inc.php b/setup/frames/form.inc.php
index 61484b2..5d34034 100644
--- a/setup/frames/form.inc.php
+++ b/setup/frames/form.inc.php
@@ -22,7 +22,7 @@ require './libraries/config/setup.forms.php';
$formset_id = filter_input(INPUT_GET, 'formset');
$mode = filter_input(INPUT_GET, 'mode');
if (! isset($forms[$formset_id])) {
- die('Incorrect formset, check $formsets array in setup/frames/form.inc.php');
+ die(__('Incorrect formset, check $formsets array in setup/frames/form.inc.php'));
}
if (isset($GLOBALS['strConfigFormset_' . $formset_id])) {
@@ -33,4 +33,4 @@ foreach ($forms[$formset_id] as $form_name => $form) {
$form_display->registerForm($form_name, $form);
}
process_formset($form_display);
-?>
\ No newline at end of file
+?>
diff --git a/setup/index.php b/setup/index.php
index 99c7847..304e00f 100644
--- a/setup/index.php
+++ b/setup/index.php
@@ -19,7 +19,7 @@ if ($page === '') {
}
if (!file_exists("./setup/frames/$page.inc.php")) {
// it will happen only when enterung URL by hand, we don't care for these cases
- die('Wrong GET file attribute value');
+ die(__('Wrong GET file attribute value'));
}
// Handle done action info
diff --git a/setup/validate.php b/setup/validate.php
index beeba71..22bdccb 100644
--- a/setup/validate.php
+++ b/setup/validate.php
@@ -19,7 +19,7 @@ header('Content-type: application/json');
$vids = explode(',', filter_input(INPUT_POST, 'id'));
$values = json_decode(filter_input(INPUT_POST, 'values'));
if (!($values instanceof stdClass)) {
- die('Wrong data');
+ die(__('Wrong data'));
}
$values = (array)$values;
$result = PMA_config_validate($vids, $values, true);
hooks/post-receive
--
phpMyAdmin