Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Adriaenssens <ruleant@users.sourceforge.net>2011-09-05 16:28:17 +0400
committerDieter Adriaenssens <ruleant@users.sourceforge.net>2011-09-05 16:28:17 +0400
commit94c6836f8b16129a64383ac03beb4a9639ba9559 (patch)
treee05636d430dc9c001bbdf61bd80f2c8f9cc623cd
parente2864a383efd0b2c18c7c0967e315f07ccf5cf96 (diff)
fix coding style : control structures
-rw-r--r--db_datadict.php2
-rw-r--r--db_operations.php9
-rw-r--r--db_printview.php5
-rw-r--r--db_search.php3
-rw-r--r--export.php25
-rw-r--r--libraries/auth/swekey/swekey.auth.lib.php45
-rw-r--r--libraries/common.inc.php3
-rw-r--r--libraries/database_interface.lib.php4
-rw-r--r--libraries/db_links.inc.php3
-rw-r--r--tbl_chart.php2
-rw-r--r--tbl_export.php2
-rw-r--r--tbl_relation.php2
-rw-r--r--tbl_replace.php2
-rw-r--r--tbl_select.php11
-rw-r--r--tbl_structure.php6
-rw-r--r--tbl_tracking.php2
-rw-r--r--test/classes/PMA_Config_test.php34
-rw-r--r--test/libraries/common/PMA_quoting_slashing_test.php2
-rw-r--r--test/libraries/core/PMA_getLinks_test.php3
-rw-r--r--test/libraries/core/PMA_headerLocation_test_disabled.php6
-rw-r--r--test/selenium/PmaSeleniumLoginTest.php2
21 files changed, 71 insertions, 102 deletions
diff --git a/db_datadict.php b/db_datadict.php
index f580e21e5a..fc5de9046c 100644
--- a/db_datadict.php
+++ b/db_datadict.php
@@ -59,7 +59,7 @@ PMA_DBI_select_db($db);
$tables = PMA_DBI_get_tables($db);
$count = 0;
-foreach($tables as $table) {
+foreach ($tables as $table) {
$comments = PMA_getComments($db, $table);
echo '<div>' . "\n";
diff --git a/db_operations.php b/db_operations.php
index 0bd9eef585..c9430d1352 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -161,9 +161,10 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
// for importing via the mysql client or our Import feature)
$triggers = PMA_DBI_get_triggers($db, $each_table, '');
- if (! PMA_Table::moveCopy($db, $each_table, $newname, $each_table,
- isset($this_what) ? $this_what : 'data', $move, 'db_copy'))
- {
+ if (! PMA_Table::moveCopy(
+ $db, $each_table, $newname, $each_table,
+ isset($this_what) ? $this_what : 'data', $move, 'db_copy')
+ ) {
$_error = true;
// $sql_query is filled by PMA_Table::moveCopy()
$sql_query = $back . $sql_query;
@@ -273,7 +274,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
$message = PMA_Message::success(__('Database %s has been renamed to %s'));
$message->addParam($db);
$message->addParam($newname);
- } elseif (! $_error) {
+ } elseif (! $_error) {
$message = PMA_Message::success(__('Database %s has been copied to %s'));
$message->addParam($db);
$message->addParam($newname);
diff --git a/db_printview.php b/db_printview.php
index e25341128f..2ede085bdb 100644
--- a/db_printview.php
+++ b/db_printview.php
@@ -92,9 +92,8 @@ echo '<br />';
// 1. No table
if ($num_tables == 0) {
echo __('No tables found in database.');
-}
-// 2. Shows table informations on mysql >= 3.23.03
-else {
+} else {
+// 2. Shows table information
?>
<table>
<thead>
diff --git a/db_search.php b/db_search.php
index c76e5d80dc..a9817ba2cc 100644
--- a/db_search.php
+++ b/db_search.php
@@ -258,8 +258,7 @@ if (isset($_REQUEST['submit_search'])) {
*/
if ($GLOBALS['is_ajax_request'] == true) {
exit;
-}
-else {
+} else {
echo '</div>';//end searchresults div
}
diff --git a/export.php b/export.php
index aa64600459..e26427d536 100644
--- a/export.php
+++ b/export.php
@@ -155,9 +155,8 @@ function PMA_exportOutputHandler($line)
// as bzipped
if ($GLOBALS['compression'] == 'bzip' && @function_exists('bzcompress')) {
$dump_buffer = bzcompress($dump_buffer);
- }
- // as a gzipped file
- elseif ($GLOBALS['compression'] == 'gzip' && @function_exists('gzencode')) {
+ } elseif ($GLOBALS['compression'] == 'gzip' && @function_exists('gzencode')) {
+ // as a gzipped file
// without the optional parameter level because it bug
$dump_buffer = gzencode($dump_buffer);
}
@@ -632,15 +631,13 @@ if (!empty($asfile)) {
$zipfile -> addFile($dump_buffer, substr($filename, 0, -4));
$dump_buffer = $zipfile -> file();
}
- }
- // 2. as a bzipped file
- elseif ($compression == 'bzip') {
+ } elseif ($compression == 'bzip') {
+ // 2. as a bzipped file
if (@function_exists('bzcompress')) {
$dump_buffer = bzcompress($dump_buffer);
}
- }
- // 3. as a gzipped file
- elseif ($compression == 'gzip') {
+ } elseif ($compression == 'gzip') {
+ // 3. as a gzipped file
if (@function_exists('gzencode') && !@ini_get('zlib.output_compression')) {
// without the optional parameter level because it bug
$dump_buffer = gzencode($dump_buffer);
@@ -672,13 +669,11 @@ if (!empty($asfile)) {
} else {
echo $dump_buffer;
}
-}
-/**
- * Displays the dump...
- */
-else {
+} else {
/**
- * Close the html tags and add the footers in dump is displayed on screen
+ * Displays the dump...
+ *
+ * Close the html tags and add the footers if dump is displayed on screen
*/
echo '</textarea>' . "\n"
. ' </form>' . "\n";
diff --git a/libraries/auth/swekey/swekey.auth.lib.php b/libraries/auth/swekey/swekey.auth.lib.php
index db60e13401..c748a53efc 100644
--- a/libraries/auth/swekey/swekey.auth.lib.php
+++ b/libraries/auth/swekey/swekey.auth.lib.php
@@ -23,13 +23,11 @@ function Swekey_auth_check()
$_SESSION['SWEKEY']['VALID_SWEKEYS'] = array();
$valid_swekeys = explode("\n", @file_get_contents($confFile));
foreach ($valid_swekeys as $line) {
- if (preg_match("/^[0-9A-F]{32}:.+$/", $line) != false)
- {
+ if (preg_match("/^[0-9A-F]{32}:.+$/", $line) != false) {
$items = explode(":", $line);
if (count($items) == 2)
$_SESSION['SWEKEY']['VALID_SWEKEYS'][$items[0]] = trim($items[1]);
- }
- else if (preg_match("/^[A-Z_]+=.*$/", $line) != false) {
+ } elseif (preg_match("/^[A-Z_]+=.*$/", $line) != false) {
$items = explode("=", $line);
$_SESSION['SWEKEY']['CONF_'.trim($items[0])] = trim($items[1]);
}
@@ -125,8 +123,7 @@ function Swekey_auth_error()
Swekey_EnableTokenCache($_SESSION['SWEKEY']['CONF_ENABLE_TOKEN_CACHE']);
$caFile = $_SESSION['SWEKEY']['CONF_CA_FILE'];
- if (empty($caFile))
- {
+ if (empty($caFile)) {
$caFile = __FILE__;
$pos = strrpos($caFile, '/');
if ($pos === false)
@@ -137,10 +134,11 @@ function Swekey_auth_error()
// echo "<!-- exists -->\n";
}
- if (file_exists($caFile))
+ if (file_exists($caFile)) {
Swekey_SetCAFile($caFile);
- else if (! empty($caFile) && (substr($_SESSION['SWEKEY']['CONF_SERVER_CHECK'], 0, 8) == "https://"))
+ } elseif (! empty($caFile) && (substr($_SESSION['SWEKEY']['CONF_SERVER_CHECK'], 0, 8) == "https://")) {
return "Internal Error: CA File $caFile not found";
+ }
$result = null;
$swekey_id = $_GET['swekey_id'];
@@ -150,21 +148,18 @@ function Swekey_auth_error()
unset($_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY']);
if (! isset($_SESSION['SWEKEY']['RND_TOKEN'])) {
unset($swekey_id);
- }
- else {
+ } else {
if (strlen($swekey_id) == 32) {
$res = Swekey_CheckOtp($swekey_id, $_SESSION['SWEKEY']['RND_TOKEN'], $swekey_otp);
unset($_SESSION['SWEKEY']['RND_TOKEN']);
if (! $res) {
$result = __('Hardware authentication failed') . ' (' . Swekey_GetLastError() . ')';
- }
- else {
+ } else {
$_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY'] = $swekey_id;
$_SESSION['SWEKEY']['FORCE_USER'] = $_SESSION['SWEKEY']['VALID_SWEKEYS'][$swekey_id];
return null;
}
- }
- else {
+ } else {
$result = __('No valid authentication key plugged');
if ($_SESSION['SWEKEY']['CONF_DEBUG'])
{
@@ -173,9 +168,9 @@ function Swekey_auth_error()
unset($_SESSION['SWEKEY']['CONF_LOADED']); // reload the conf file
}
}
- }
- else
+ } else {
unset($_SESSION['SWEKEY']);
+ }
$_SESSION['SWEKEY']['RND_TOKEN'] = Swekey_GetFastRndToken();
if (strlen($_SESSION['SWEKEY']['RND_TOKEN']) != 64) {
@@ -186,12 +181,9 @@ function Swekey_auth_error()
if (! isset($swekey_id)) {
?>
<script>
- if (key.length != 32)
- {
+ if (key.length != 32) {
window.location.search="?swekey_id=" + key + "&token=<?php echo $_SESSION[' PMA_token ']; ?>";
- }
- else
- {
+ } else {
var url = "" + window.location;
if (url.indexOf("?") > 0)
url = url.substr(0, url.indexOf("?"));
@@ -225,10 +217,11 @@ function Swekey_login($input_name, $input_go)
if (isset($_SESSION['SWEKEY']) && $_SESSION['SWEKEY']['ENABLED']) {
echo '<script type="text/javascript">';
- if (empty($_SESSION['SWEKEY']['FORCE_USER']))
+ if (empty($_SESSION['SWEKEY']['FORCE_USER'])) {
echo 'var user = null;';
- else
+ } else {
echo 'var user = "'.$_SESSION['SWEKEY']['FORCE_USER'].'";';
+ }
?>
function open_swekey_site()
@@ -265,8 +258,7 @@ function Swekey_login($input_name, $input_go)
}
}
-if (!empty($_GET['session_to_unset']))
-{
+if (!empty($_GET['session_to_unset'])) {
session_write_close();
session_id($_GET['session_to_unset']);
session_start();
@@ -276,8 +268,7 @@ if (!empty($_GET['session_to_unset']))
exit;
}
-if (isset($_GET['swekey_reset']))
-{
+if (isset($_GET['swekey_reset'])) {
unset($_SESSION['SWEKEY']);
}
diff --git a/libraries/common.inc.php b/libraries/common.inc.php
index 085bcb22b1..390325d930 100644
--- a/libraries/common.inc.php
+++ b/libraries/common.inc.php
@@ -1032,8 +1032,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
*/
if (isset($_REQUEST['grid_edit']) && $_REQUEST['grid_edit'] == true) {
$GLOBALS['grid_edit'] = true;
-}
-else {
+} else {
$GLOBALS['grid_edit'] = false;
}
diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php
index 37103f916b..709e15fc74 100644
--- a/libraries/database_interface.lib.php
+++ b/libraries/database_interface.lib.php
@@ -499,8 +499,8 @@ function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = fals
foreach ($each_tables as $table_name => $each_table) {
if ('comment' === $tbl_is_group
- && 0 === strpos($each_table['Comment'], $table))
- {
+ && 0 === strpos($each_table['Comment'], $table)
+ ) {
// remove table from list
unset($each_tables[$table_name]);
continue;
diff --git a/libraries/db_links.inc.php b/libraries/db_links.inc.php
index d2cc823d00..ed30283ef4 100644
--- a/libraries/db_links.inc.php
+++ b/libraries/db_links.inc.php
@@ -61,8 +61,7 @@ $tab_search['text'] = __('Search');
$tab_search['icon'] = 'ic_b_search';
$tab_search['link'] = 'db_search.php';
-if (PMA_Tracker::isActive())
-{
+if (PMA_Tracker::isActive()) {
$tab_tracking['text'] = __('Tracking');
$tab_tracking['icon'] = 'ic_eye';
$tab_tracking['link'] = 'db_tracking.php';
diff --git a/tbl_chart.php b/tbl_chart.php
index 6131ff2b3d..8caa38e609 100644
--- a/tbl_chart.php
+++ b/tbl_chart.php
@@ -24,7 +24,7 @@ $GLOBALS['js_include'][] = 'highcharts/highcharts.js';
/* Files required for chart exporting */
$GLOBALS['js_include'][] = 'highcharts/exporting.js';
/* < IE 9 doesn't support canvas natively */
-if(PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
+if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
$GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
}
$GLOBALS['js_include'][] = 'canvg/canvg.js';
diff --git a/tbl_export.php b/tbl_export.php
index 6a7d03ff05..a2ce305d6d 100644
--- a/tbl_export.php
+++ b/tbl_export.php
@@ -54,7 +54,7 @@ if (! empty($sql_query)) {
$wheres[] = '(' . implode(') OR (',$where_clause) . ')';
}
- if (!empty($analyzed_sql[0]['where_clause'])) {
+ if (!empty($analyzed_sql[0]['where_clause'])) {
$wheres[] = $analyzed_sql[0]['where_clause'];
}
diff --git a/tbl_relation.php b/tbl_relation.php
index dcaf32348c..6bebd284ee 100644
--- a/tbl_relation.php
+++ b/tbl_relation.php
@@ -387,7 +387,7 @@ if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_type)) {
$columns = PMA_DBI_get_columns($db, $table);
if (count($columns) > 0) {
- foreach($columns as $row) {
+ foreach ($columns as $row) {
$save_row[] = $row;
}
$saved_row_cnt = count($save_row);
diff --git a/tbl_replace.php b/tbl_replace.php
index 460908e350..bc9c27cf16 100644
--- a/tbl_replace.php
+++ b/tbl_replace.php
@@ -520,7 +520,7 @@ if ($GLOBALS['is_ajax_request'] == true) {
$edited_values = array();
parse_str($_REQUEST['transform_fields_list'], $edited_values);
- foreach($mime_map as $transformation) {
+ foreach ($mime_map as $transformation) {
$include_file = PMA_securePath($transformation['transformation']);
$column_name = $transformation['column_name'];
diff --git a/tbl_select.php b/tbl_select.php
index f2eb2d7f3a..00cecfe70c 100644
--- a/tbl_select.php
+++ b/tbl_select.php
@@ -252,14 +252,11 @@ echo PMA_generate_html_tabs(PMA_tbl_getSubTabs(), $url_params, '', 'topmenu2');
</fieldset>
<?php
-}
-
-
+} else {
+ /**
+ * Selection criteria have been submitted -> do the work
+ */
-/**
- * Selection criteria have been submitted -> do the work
- */
-else {
// Builds the query
$sql_query = 'SELECT ' . (isset($distinct) ? 'DISTINCT ' : '');
diff --git a/tbl_structure.php b/tbl_structure.php
index 4c3842ca44..e86636cf13 100644
--- a/tbl_structure.php
+++ b/tbl_structure.php
@@ -352,8 +352,7 @@ foreach ($fields as $row) {
} else {
echo $row['Default'];
}
- }
- else {
+ } else {
echo '<i>' . _pgettext('None for default','None') . '</i>';
} ?></td>
<td nowrap="nowrap"><?php echo strtoupper($row['Extra']); ?></td>
@@ -631,8 +630,7 @@ if (! $tbl_is_view && ! $db_is_information_schema) {
echo PMA_showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n";
}
- if (PMA_Tracker::isActive())
- {
+ if (PMA_Tracker::isActive()) {
echo '<a href="tbl_tracking.php?' . $url_query . '">';
echo PMA_getIcon('eye.png', __('Track table'));
echo '</a>';
diff --git a/tbl_tracking.php b/tbl_tracking.php
index 4430cf0974..6148bbbd3d 100644
--- a/tbl_tracking.php
+++ b/tbl_tracking.php
@@ -643,7 +643,7 @@ if ($last_version > 0) {
<?php
$style = 'odd';
PMA_DBI_data_seek($sql_result, 0);
- while($version = PMA_DBI_fetch_array($sql_result)) {
+ while ($version = PMA_DBI_fetch_array($sql_result)) {
if ($version['tracking_active'] == 1) {
$version_status = __('active');
} else {
diff --git a/test/classes/PMA_Config_test.php b/test/classes/PMA_Config_test.php
index 3340957810..9a5bf7845b 100644
--- a/test/classes/PMA_Config_test.php
+++ b/test/classes/PMA_Config_test.php
@@ -130,8 +130,7 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
$this->object->set('GD2Available',$prevIsGb2Val);
- if (!@function_exists('imagecreatetruecolor'))
- {
+ if (!@function_exists('imagecreatetruecolor')) {
$this->object->checkGd2();
$this->assertEquals(0, $this->object->get('PMA_IS_GD2'), 'Function imagecreatetruecolor does not exist, PMA_IS_GD2 should be 0');
}
@@ -178,23 +177,19 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
{
$this->object->checkWebServerOs();
- if (defined('PHP_OS'))
- {
- switch (PHP_OS)
- {
- case stristr(PHP_OS,'win'):
- $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PHP_OS equals: ' . PHP_OS . ' PMA_IS_WINDOWS should be 1');
- break;
- case stristr(PHP_OS, 'OS/2'):
- $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PHP_OS is OS/2 PMA_IS_WINDOWS should be 1 (No file permissions like Windows)');
- break;
- case stristr(PHP_OS, 'Linux'):
- $this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'));
- break;
+ if (defined('PHP_OS')) {
+ switch (PHP_OS) {
+ case stristr(PHP_OS,'win'):
+ $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PHP_OS equals: ' . PHP_OS . ' PMA_IS_WINDOWS should be 1');
+ break;
+ case stristr(PHP_OS, 'OS/2'):
+ $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PHP_OS is OS/2 PMA_IS_WINDOWS should be 1 (No file permissions like Windows)');
+ break;
+ case stristr(PHP_OS, 'Linux'):
+ $this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'));
+ break;
}
- }
- else
- {
+ } else {
$this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'), 'PMA_IS_WINDOWS Default to Unix or Equiv');
define('PHP_OS','Windows');
@@ -432,8 +427,7 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
'PMA_USR_BROWSER_AGENT'
);
- foreach ($defines as $define)
- {
+ foreach ($defines as $define) {
$this->assertTrue(defined($define));
$this->assertEquals(constant($define), $this->object->get($define));
}
diff --git a/test/libraries/common/PMA_quoting_slashing_test.php b/test/libraries/common/PMA_quoting_slashing_test.php
index d4e7104bdf..3f27a8e507 100644
--- a/test/libraries/common/PMA_quoting_slashing_test.php
+++ b/test/libraries/common/PMA_quoting_slashing_test.php
@@ -106,7 +106,7 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
public function testBackquoteForbidenWords() {
global $PMA_SQPdata_forbidden_word;
- foreach ($PMA_SQPdata_forbidden_word as $forbidden){
+ foreach ($PMA_SQPdata_forbidden_word as $forbidden) {
$this->assertEquals("`" . $forbidden . "`", PMA_backquote($forbidden, false));
}
}
diff --git a/test/libraries/core/PMA_getLinks_test.php b/test/libraries/core/PMA_getLinks_test.php
index 5930608f09..5d96725076 100644
--- a/test/libraries/core/PMA_getLinks_test.php
+++ b/test/libraries/core/PMA_getLinks_test.php
@@ -52,8 +52,7 @@ class PMA_getLinks_test extends PHPUnit_Framework_TestCase
if (file_exists('./js/'.$filename)) {
$mod = filemtime('./js/'.$filename);
- }
- else{
+ } else {
$this->fail("JS file doesn't exists.");
}
$this->assertEquals(PMA_includeJS($filename), '<script src="./js/'.$filename.'?ts='.$mod.'" type="text/javascript"></script>'. "\n");
diff --git a/test/libraries/core/PMA_headerLocation_test_disabled.php b/test/libraries/core/PMA_headerLocation_test_disabled.php
index b2f522db3b..147386ad81 100644
--- a/test/libraries/core/PMA_headerLocation_test_disabled.php
+++ b/test/libraries/core/PMA_headerLocation_test_disabled.php
@@ -105,8 +105,7 @@ class PMA_headerLocation_test extends PHPUnit_Extensions_OutputTestCase
if (defined('PMA_IS_IIS')) {
$this->oldIISvalue = PMA_IS_IIS;
runkit_constant_redefine('PMA_IS_IIS', NULL);
- }
- else {
+ } else {
runkit_constant_add('PMA_IS_IIS', NULL);
}
@@ -116,8 +115,7 @@ class PMA_headerLocation_test extends PHPUnit_Extensions_OutputTestCase
if (defined('SID')) {
$this->oldSIDvalue = SID;
runkit_constant_redefine('SID', NULL);
- }
- else {
+ } else {
runkit_constant_add('SID', NULL);
}
diff --git a/test/selenium/PmaSeleniumLoginTest.php b/test/selenium/PmaSeleniumLoginTest.php
index dc0fc802d6..1a5d22d622 100644
--- a/test/selenium/PmaSeleniumLoginTest.php
+++ b/test/selenium/PmaSeleniumLoginTest.php
@@ -21,7 +21,7 @@ class PmaSeleniumLoginTest extends PmaSeleniumTestCase
$this->doLogin();
// Check if login error happend
- if ($this->isElementPresent("//html/body/div/div[@class='error']")){
+ if ($this->isElementPresent("//html/body/div/div[@class='error']")) {
$this->fail($this->getText("//html/body/div/div[@class='error']"));
}