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:
authorMadhura Jayaratne <madhura.cj@gmail.com>2012-06-02 21:11:39 +0400
committerMadhura Jayaratne <madhura.cj@gmail.com>2012-06-02 21:11:39 +0400
commit9398f99503902ea7d8775c0eceb389cc273edd46 (patch)
tree3c17d3a3a6f7588d59a59e5e46024df169fef6f2 /libraries
parente1a4f227fdd6149b6b08504730c8cf20094b476c (diff)
Various coding style improvements
Diffstat (limited to 'libraries')
-rw-r--r--libraries/header.inc.php4
-rw-r--r--libraries/iconv_wrapper.lib.php20
-rw-r--r--libraries/import.lib.php56
3 files changed, 53 insertions, 27 deletions
diff --git a/libraries/header.inc.php b/libraries/header.inc.php
index 4f66d1256f..be455590a3 100644
--- a/libraries/header.inc.php
+++ b/libraries/header.inc.php
@@ -15,8 +15,10 @@ require_once 'libraries/Menu.class.php';
/**
* Add recently used table and reload the navigation.
*
- * @param string $db Database name where the table is located.
+ * @param string $db Database name where the table is located.
* @param string $table The table name
+ *
+ * @return void
*/
function PMA_addRecentTable($db, $table)
{
diff --git a/libraries/iconv_wrapper.lib.php b/libraries/iconv_wrapper.lib.php
index ef2bd0d2ef..9bacffa82e 100644
--- a/libraries/iconv_wrapper.lib.php
+++ b/libraries/iconv_wrapper.lib.php
@@ -69,20 +69,20 @@ function PMA_aix_iconv_wrapper($in_charset, $out_charset, $str)
: $out_charset);
// Transform name of input character set (if found)
- if (array_key_exists(
- strtolower($in_charset),
- $gnu_iconv_to_aix_iconv_codepage_map
- )
- ) {
+ $in_charset_exisits = array_key_exists(
+ strtolower($in_charset),
+ $gnu_iconv_to_aix_iconv_codepage_map
+ );
+ if ($in_charset_exisits) {
$in_charset = $gnu_iconv_to_aix_iconv_codepage_map[strtolower($in_charset)];
}
// Transform name of "plain" output character set (if found)
- if (array_key_exists(
- strtolower($out_charset_plain),
- $gnu_iconv_to_aix_iconv_codepage_map
- )
- ) {
+ $out_charset_plain_exists = array_key_exists(
+ strtolower($out_charset_plain),
+ $gnu_iconv_to_aix_iconv_codepage_map
+ );
+ if ($out_charset_plain_exists) {
$out_charset_plain = $gnu_iconv_to_aix_iconv_codepage_map[
strtolower($out_charset_plain)];
}
diff --git a/libraries/import.lib.php b/libraries/import.lib.php
index 1213881671..bdc396f0ed 100644
--- a/libraries/import.lib.php
+++ b/libraries/import.lib.php
@@ -20,7 +20,7 @@ require_once './libraries/check_user_privileges.lib.php';
define('PMA_CHK_DROP', 1);
/**
- * Check whether timeout is getting close
+ * Checks whether timeout is getting close
*
* @return boolean true if timeout is close
* @access public
@@ -42,7 +42,7 @@ function PMA_checkTimeout()
}
/**
- * Detects what compression filse uses
+ * Detects what compression filse uses
*
* @param string $filepath filename to check
*
@@ -78,6 +78,7 @@ function PMA_detectCompression($filepath)
* @param string $full query to display, this might be commented
* @param bool $controluser whether to use control user for queries
*
+ * @return void
* @access public
*/
function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
@@ -268,7 +269,8 @@ function PMA_importGetNextChunk($size = 32768)
}
if ($GLOBALS['import_file'] == 'none') {
- // Well this is not yet supported and tested, but should return content of textarea
+ // Well this is not yet supported and tested,
+ // but should return content of textarea
if (strlen($GLOBALS['import_text']) < $size) {
$GLOBALS['finished'] = true;
return $GLOBALS['import_text'];
@@ -316,7 +318,9 @@ function PMA_importGetNextChunk($size = 32768)
if (strncmp($result, "\xEF\xBB\xBF", 3) == 0) {
$result = substr($result, 3);
// UTF-16 BE, LE
- } elseif (strncmp($result, "\xFE\xFF", 2) == 0 || strncmp($result, "\xFF\xFE", 2) == 0) {
+ } elseif (strncmp($result, "\xFE\xFF", 2) == 0
+ || strncmp($result, "\xFF\xFE", 2) == 0
+ ) {
$result = substr($result, 2);
}
}
@@ -792,7 +796,12 @@ function PMA_analyzeTable(&$table)
/* Determine type of the current cell */
$curr_type = PMA_detectType($types[$i], $table[ROWS][$j][$i]);
/* Determine size of the current cell */
- $sizes[$i] = PMA_detectSize($sizes[$i], $types[$i], $curr_type, $table[ROWS][$j][$i]);
+ $sizes[$i] = PMA_detectSize(
+ $sizes[$i],
+ $types[$i],
+ $curr_type,
+ $table[ROWS][$j][$i]
+ );
/**
* If a type for this column has already been declared,
@@ -810,7 +819,10 @@ function PMA_analyzeTable(&$table)
$types[$i] = BIGINT;
}
} else if ($curr_type == INT) {
- if ($types[$i] != VARCHAR && $types[$i] != DECIMAL && $types[$i] != BIGINT) {
+ if ($types[$i] != VARCHAR
+ && $types[$i] != DECIMAL
+ && $types[$i] != BIGINT
+ ) {
$types[$i] = INT;
}
}
@@ -855,8 +867,9 @@ $import_notice = null;
*
* @link http://wiki.phpmyadmin.net/pma/Import
*/
-function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql = null, $options = null)
-{
+function PMA_buildSQL($db_name, &$tables, &$analyses = null,
+ &$additional_sql = null, $options = null
+) {
/* Take care of the options */
if (isset($options['db_collation'])&& ! is_null($options['db_collation'])) {
$collation = $options['db_collation'];
@@ -881,9 +894,11 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql =
if ($create_db) {
if (PMA_DRIZZLE) {
- $sql[] = "CREATE DATABASE IF NOT EXISTS " . PMA_backquote($db_name) . " COLLATE " . $collation;
+ $sql[] = "CREATE DATABASE IF NOT EXISTS " . PMA_backquote($db_name)
+ . " COLLATE " . $collation;
} else {
- $sql[] = "CREATE DATABASE IF NOT EXISTS " . PMA_backquote($db_name) . " DEFAULT CHARACTER SET " . $charset . " COLLATE " . $collation;
+ $sql[] = "CREATE DATABASE IF NOT EXISTS " . PMA_backquote($db_name)
+ . " DEFAULT CHARACTER SET " . $charset . " COLLATE " . $collation;
}
}
@@ -922,9 +937,15 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql =
$pattern = '/CREATE [^`]*(TABLE)/';
$replacement = 'CREATE \\1 IF NOT EXISTS';
- /* Change CREATE statements to CREATE IF NOT EXISTS to support inserting into existing structures */
+ /* Change CREATE statements to CREATE IF NOT EXISTS to support
+ * inserting into existing structures
+ */
for ($i = 0; $i < $additional_sql_len; ++$i) {
- $additional_sql[$i] = preg_replace($pattern, $replacement, $additional_sql[$i]);
+ $additional_sql[$i] = preg_replace(
+ $pattern,
+ $replacement,
+ $additional_sql[$i]
+ );
/* Execute the resulting statements */
PMA_importRunQuery($additional_sql[$i], $additional_sql[$i]);
}
@@ -993,7 +1014,8 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql =
$num_cols = count($tables[$i][COL_NAMES]);
$num_rows = count($tables[$i][ROWS]);
- $tempSQLStr = "INSERT INTO " . PMA_backquote($db_name) . '.' . PMA_backquote($tables[$i][TBL_NAME]) . " (";
+ $tempSQLStr = "INSERT INTO " . PMA_backquote($db_name) . '.'
+ . PMA_backquote($tables[$i][TBL_NAME]) . " (";
for ($m = 0; $m < $num_cols; ++$m) {
$tempSQLStr .= PMA_backquote($tables[$i][COL_NAMES][$m]);
@@ -1009,7 +1031,8 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql =
$tempSQLStr .= "(";
for ($k = 0; $k < $num_cols; ++$k) {
- // If fully formatted SQL, no need to enclose with aphostrophes, add shalshes etc.
+ // If fully formatted SQL, no need to enclose
+ // with aphostrophes, add shalshes etc.
if ($analyses != null
&& isset($analyses[$i][FORMATTEDSQL][$col_count])
&& $analyses[$i][FORMATTEDSQL][$col_count] == true
@@ -1074,8 +1097,9 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql =
* A work in progress
*/
- /* Add the viewable structures from $additional_sql to $tables so they are also displayed */
-
+ /* Add the viewable structures from $additional_sql
+ * to $tables so they are also displayed
+ */
$view_pattern = '@VIEW `[^`]+`\.`([^`]+)@';
$table_pattern = '@CREATE TABLE IF NOT EXISTS `([^`]+)`@';
/* Check a third pattern to make sure its not a "USE `db_name`;" statement */