diff --git a/libraries/CommonFunctions.class.php b/libraries/CommonFunctions.class.php index 3f48a40825..35b26a1a21 100644 --- a/libraries/CommonFunctions.class.php +++ b/libraries/CommonFunctions.class.php @@ -983,22 +983,23 @@ class PMA_CommonFunctions * * * - * @param mixed $a_name the database, table or field name to "backquote" - * or array of it + * @param mixed $a_name the database, table or field name to + * "backquote" or array of it * @param string $compatibility string compatibility mode (used by dump - * functions) - * @param boolean $do_it a flag to bypass this function (used by dump - * functions) - * @return mixed the "backquoted" database, table or field name + * functions) + * @param boolean $do_it a flag to bypass this function (used by dump + * functions) + * + * @return mixed the "backquoted" database, table or field name * * @access public */ - public function backquote_compat($a_name, $compatibility = 'MSSQL', $do_it = true) + public function backquoteCompat($a_name, $compatibility = 'MSSQL', $do_it = true) { if (is_array($a_name)) { foreach ($a_name as &$data) { - $data = $this->backquote_compat($data, $compatibility, $do_it); + $data = $this->backquoteCompat($data, $compatibility, $do_it); } return $a_name; } @@ -1013,8 +1014,12 @@ class PMA_CommonFunctions // @todo add more compatibility cases (ORACLE for example) switch ($compatibility) { - case 'MSSQL': $quote = '"'; break; - default: (isset($GLOBALS['sql_backquotes'])) ? $quote = "`" : $quote = ''; break; + case 'MSSQL': + $quote = '"'; + break; + default: + (isset($GLOBALS['sql_backquotes'])) ? $quote = "`" : $quote = ''; + break; } // '0' is also empty for php :-( @@ -1024,7 +1029,7 @@ class PMA_CommonFunctions return $a_name; } - } // end of the 'backquote_compat()' function + } // end of the 'backquoteCompat()' function /** * Defines the value depending on the user OS. diff --git a/libraries/Message.class.php b/libraries/Message.class.php index 6e6abf8559..93fe1df2c9 100644 --- a/libraries/Message.class.php +++ b/libraries/Message.class.php @@ -85,7 +85,7 @@ class PMA_Message * @access protected * @var integer */ - protected $_number = PMA_Message::NOTICE; + protected $number = PMA_Message::NOTICE; /** * The locale string identifier @@ -93,7 +93,7 @@ class PMA_Message * @access protected * @var string */ - protected $_string = ''; + protected $string = ''; /** * The formatted message @@ -101,7 +101,7 @@ class PMA_Message * @access protected * @var string */ - protected $_message = ''; + protected $message = ''; /** * Whether the message was already displayed @@ -109,7 +109,7 @@ class PMA_Message * @access protected * @var boolean */ - protected $_is_displayed = false; + protected $isDisplayed = false; /** * Unique id @@ -125,7 +125,7 @@ class PMA_Message * @access protected * @var array */ - protected $_params = array(); + protected $params = array(); /** * holds additional messages @@ -133,7 +133,7 @@ class PMA_Message * @access protected * @var array */ - protected $_added_messages = array(); + protected $addedMessages = array(); /** * Constructor @@ -248,7 +248,7 @@ class PMA_Message * @return PMA_Message * @static */ - static public function affected_rows($rows) + static public function getMessageForAffectedRows($rows) { $message = PMA_Message::success( _ngettext('%1$d row affected.', '%1$d rows affected.', $rows) @@ -267,7 +267,7 @@ class PMA_Message * @return PMA_Message * @static */ - static public function deleted_rows($rows) + static public function getMessageForDeletedRows($rows) { $message = PMA_Message::success( _ngettext('%1$d row deleted.', '%1$d rows deleted.', $rows) @@ -286,7 +286,7 @@ class PMA_Message * @return PMA_Message * @static */ - static public function inserted_rows($rows) + static public function getMessageForInsertedRows($rows) { $message = PMA_Message::success( _ngettext('%1$d row inserted.', '%1$d rows inserted.', $rows) @@ -404,24 +404,24 @@ class PMA_Message if ($sanitize) { $message = PMA_Message::sanitize($message); } - $this->_message = $message; + $this->message = $message; } /** * set string (does not take effect if raw message is set) * - * @param string $_string + * @param string $string * * @param boolean $sanitize whether to sanitize $string or not * * @return void */ - public function setString($_string, $sanitize = true) + public function setString($string, $sanitize = true) { if ($sanitize) { - $_string = PMA_Message::sanitize($_string); + $string = PMA_Message::sanitize($string); } - $this->_string = $_string; + $this->string = $string; } /** @@ -433,7 +433,7 @@ class PMA_Message */ public function setNumber($number) { - $this->_number = $number; + $this->number = $number; } /** @@ -454,11 +454,11 @@ class PMA_Message public function addParam($param, $raw = true) { if ($param instanceof PMA_Message) { - $this->_params[] = $param; + $this->params[] = $param; } elseif ($raw) { - $this->_params[] = htmlspecialchars($param); + $this->params[] = htmlspecialchars($param); } else { - $this->_params[] = PMA_Message::notice($param); + $this->params[] = PMA_Message::notice($param); } } @@ -472,8 +472,8 @@ class PMA_Message */ public function addString($string, $separator = ' ') { - $this->_added_messages[] = $separator; - $this->_added_messages[] = PMA_Message::notice($string); + $this->addedMessages[] = $separator; + $this->addedMessages[] = PMA_Message::notice($string); } /** @@ -502,13 +502,13 @@ class PMA_Message public function addMessage($message, $separator = ' ') { if (strlen($separator)) { - $this->_added_messages[] = $separator; + $this->addedMessages[] = $separator; } if ($message instanceof PMA_Message) { - $this->_added_messages[] = $message; + $this->addedMessages[] = $message; } else { - $this->_added_messages[] = PMA_Message::rawNotice($message); + $this->addedMessages[] = PMA_Message::rawNotice($message); } } @@ -525,7 +525,7 @@ class PMA_Message if ($sanitize) { $params = PMA_Message::sanitize($params); } - $this->_params = $params; + $this->params = $params; } /** @@ -535,7 +535,7 @@ class PMA_Message */ public function getParams() { - return $this->_params; + return $this->params; } /** @@ -545,7 +545,7 @@ class PMA_Message */ public function getAddedMessages() { - return $this->_added_messages; + return $this->addedMessages; } /** @@ -611,8 +611,8 @@ class PMA_Message if (null === $this->hash) { $this->hash = md5( $this->getNumber() . - $this->_string . - $this->_message + $this->string . + $this->message ); } @@ -626,7 +626,7 @@ class PMA_Message */ public function getMessage() { - $message = $this->_message; + $message = $this->message; if (0 === strlen($message)) { $string = $this->getString(); @@ -653,23 +653,23 @@ class PMA_Message } /** - * returns PMA_Message::$_string + * returns PMA_Message::$string * - * @return string PMA_Message::$_string + * @return string PMA_Message::$string */ public function getString() { - return $this->_string; + return $this->string; } /** - * returns PMA_Message::$_number + * returns PMA_Message::$number * - * @return integer PMA_Message::$_number + * @return integer PMA_Message::$number */ public function getNumber() { - return $this->_number; + return $this->number; } /** @@ -710,15 +710,15 @@ class PMA_Message * * @param boolean $is_displayed * - * @return boolean PMA_Message::$_is_displayed + * @return boolean PMA_Message::$isDisplayed */ - public function isDisplayed($is_displayed = false) + public function isDisplayed($isDisplayed = false) { - if ($is_displayed) { - $this->_is_displayed = true; + if ($isDisplayed) { + $this->isDisplayed = true; } - return $this->_is_displayed; + return $this->isDisplayed; } } ?> diff --git a/libraries/dbi/drizzle.dbi.lib.php b/libraries/dbi/drizzle.dbi.lib.php index d0493d1cb5..d86adce098 100644 --- a/libraries/dbi/drizzle.dbi.lib.php +++ b/libraries/dbi/drizzle.dbi.lib.php @@ -599,8 +599,9 @@ function PMA_DBI_field_flags($result, $i) // so we have to check also the type. // Unfortunately there is no equivalent in the mysql extension. if (($type == DRIZZLE_COLUMN_TYPE_DRIZZLE_BLOB - || $type == DRIZZLE_COLUMN_TYPE_DRIZZLE_VARCHAR) - && 63 == $charsetnr) { + || $type == DRIZZLE_COLUMN_TYPE_DRIZZLE_VARCHAR) + && 63 == $charsetnr + ) { $flags .= 'binary '; } if ($f & DRIZZLE_COLUMN_FLAGS_ZEROFILL) { diff --git a/libraries/import.lib.php b/libraries/import.lib.php index ff8acee258..1bdcc1bd7d 100644 --- a/libraries/import.lib.php +++ b/libraries/import.lib.php @@ -179,7 +179,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false, &$sql_d $msg .= __('Rows'). ': ' . $a_num_rows; $last_query_with_results = $import_run_buffer['sql']; } elseif ($a_aff_rows > 0) { - $message = PMA_Message::affected_rows($a_aff_rows); + $message = PMA_Message::getMessageForAffectedRows($a_aff_rows); $msg .= $message->getMessage(); } else { $msg .= __('MySQL returned an empty result set (i.e. zero rows).'); diff --git a/libraries/plugins/export/ExportSql.class.php b/libraries/plugins/export/ExportSql.class.php index aca53b39ba..db25a61f91 100644 --- a/libraries/plugins/export/ExportSql.class.php +++ b/libraries/plugins/export/ExportSql.class.php @@ -702,7 +702,7 @@ class ExportSql extends ExportPlugin if (! PMA_exportOutputHandler( 'DROP DATABASE ' . (isset($GLOBALS['sql_backquotes']) - ? $common_functions->backquote_compat($db, $compat) : $db) + ? $common_functions->backquoteCompat($db, $compat) : $db) . ';' . $crlf )) { return false; @@ -710,7 +710,7 @@ class ExportSql extends ExportPlugin } $create_query = 'CREATE DATABASE ' . (isset($GLOBALS['sql_backquotes']) - ? $common_functions->backquote_compat($db, $compat) : $db); + ? $common_functions->backquoteCompat($db, $compat) : $db); $collation = PMA_getDbCollation($db); if (PMA_DRIZZLE) { $create_query .= ' COLLATE ' . $collation; @@ -733,7 +733,7 @@ class ExportSql extends ExportPlugin || PMA_DRIZZLE) ) { $result = PMA_exportOutputHandler( - 'USE ' . $common_functions->backquote_compat($db, $compat) + 'USE ' . $common_functions->backquoteCompat($db, $compat) . ';' . $crlf ); } else { @@ -761,7 +761,7 @@ class ExportSql extends ExportPlugin . $this->_exportComment( __('Database') . ': ' . (isset($GLOBALS['sql_backquotes']) - ? PMA_CommonFunctions::getInstance()->backquote_compat($db, $compat) + ? PMA_CommonFunctions::getInstance()->backquoteCompat($db, $compat) : '\'' . $db . '\'') ) . $this->_exportComment(); @@ -1213,21 +1213,21 @@ class ExportSql extends ExportPlugin . $this->_exportComment( __('Constraints for table') . ' ' - . $common_functions->backquote_compat($table, $compat) + . $common_functions->backquoteCompat($table, $compat) ) . $this->_exportComment(); } // let's do the work $sql_constraints_query .= 'ALTER TABLE ' - . $common_functions->backquote_compat($table, $compat) + . $common_functions->backquoteCompat($table, $compat) . $crlf; $sql_constraints .= 'ALTER TABLE ' - . $common_functions->backquote_compat($table, $compat) + . $common_functions->backquoteCompat($table, $compat) . $crlf; $sql_drop_foreign_keys .= 'ALTER TABLE ' - . $common_functions->backquote_compat($db, $compat) . '.' - . $common_functions->backquote_compat($table, $compat) + . $common_functions->backquoteCompat($db, $compat) . '.' + . $common_functions->backquoteCompat($table, $compat) . $crlf; $first = true; @@ -1451,7 +1451,7 @@ class ExportSql extends ExportPlugin } $formatted_table_name = (isset($GLOBALS['sql_backquotes'])) - ? $common_functions->backquote_compat($table, $compat) + ? $common_functions->backquoteCompat($table, $compat) : '\'' . $table . '\''; $dump = $this->_possibleCRLF() . $this->_exportComment(str_repeat('-', 56)) @@ -1543,7 +1543,7 @@ class ExportSql extends ExportPlugin $common_functions = PMA_CommonFunctions::getInstance(); $formatted_table_name = (isset($GLOBALS['sql_backquotes'])) - ? $common_functions->backquote_compat($table, $compat) + ? $common_functions->backquoteCompat($table, $compat) : '\'' . $table . '\''; // Do not export data for a VIEW @@ -1590,13 +1590,13 @@ class ExportSql extends ExportPlugin for ($j = 0; $j < $fields_cnt; $j++) { if (isset($analyzed_sql[0]['select_expr'][$j]['column'])) { - $field_set[$j] = $common_functions->backquote_compat( + $field_set[$j] = $common_functions->backquoteCompat( $analyzed_sql[0]['select_expr'][$j]['column'], $compat, $sql_backquotes ); } else { - $field_set[$j] = $common_functions->backquote_compat( + $field_set[$j] = $common_functions->backquoteCompat( $fields_meta[$j]->name, $compat, $sql_backquotes @@ -1613,7 +1613,7 @@ class ExportSql extends ExportPlugin $schema_insert .= 'IGNORE '; } // avoid EOL blank - $schema_insert .= $common_functions->backquote_compat( + $schema_insert .= $common_functions->backquoteCompat( $table, $compat, $sql_backquotes @@ -1648,7 +1648,7 @@ class ExportSql extends ExportPlugin && $sql_command == 'INSERT' ) { $truncate = 'TRUNCATE TABLE ' - . $common_functions->backquote_compat( + . $common_functions->backquoteCompat( $table, $compat, $sql_backquotes @@ -1673,7 +1673,7 @@ class ExportSql extends ExportPlugin ) { $fields = implode(', ', $field_set); $schema_insert = $sql_command . $insert_delayed .' INTO ' - . $common_functions->backquote_compat( + . $common_functions->backquoteCompat( $table, $compat, $sql_backquotes @@ -1682,7 +1682,7 @@ class ExportSql extends ExportPlugin . ' (' . $fields . ') VALUES'; } else { $schema_insert = $sql_command . $insert_delayed .' INTO ' - . $common_functions->backquote_compat( + . $common_functions->backquoteCompat( $table, $compat, $sql_backquotes @@ -1728,7 +1728,7 @@ class ExportSql extends ExportPlugin ) { if (! PMA_exportOutputHandler( 'SET IDENTITY_INSERT ' - . $common_functions->backquote_compat( + . $common_functions->backquoteCompat( $table, $compat ) @@ -1865,21 +1865,19 @@ class ExportSql extends ExportPlugin } // We need to SET IDENTITY_INSERT OFF for MSSQL - if (isset($GLOBALS['sql_compatibility']) - && $GLOBALS['sql_compatibility'] == 'MSSQL' - && $current_row > 0 - ) - if (! PMA_exportOutputHandler( - $crlf . 'SET IDENTITY_INSERT ' - . $common_functions->backquote_compat( - $table, - $compat - ) - . ' OFF;' . $crlf - )) { - return false; + if (isset($GLOBALS['sql_compatibility']) + && $GLOBALS['sql_compatibility'] == 'MSSQL' + && $current_row > 0 + ) { + $outputSucceeded = PMA_exportOutputHandler( + $crlf . 'SET IDENTITY_INSERT ' + . $common_functions->backquoteCompat($table, $compat) + . ' OFF;' . $crlf + ); + if (! $outputSucceeded) { + return false; + } } - } // end if ($result != false) PMA_DBI_free_result($result); diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index d72115d86a..7e00185ab1 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -852,9 +852,9 @@ function PMA_SQP_typeCheck($toCheck, $whatWeWant) */ function PMA_SQP_analyze($arr) { - + $common_functions = PMA_CommonFunctions::getInstance(); - + if ($arr == array() || ! isset($arr['len'])) { return array(); } @@ -1911,14 +1911,13 @@ function PMA_SQP_analyze($arr) } if (isset($clause) && ($arr[$i+2]['type'] == 'alpha_reservedWord' - - // ugly workaround because currently, NO is not - // in the list of reserved words in sqlparser.data - // (we got a bug report about not being able to use - // 'no' as an identifier) - || ($arr[$i+2]['type'] == 'alpha_identifier' - && strtoupper($arr[$i+2]['data'])=='NO')) - ) { + // ugly workaround because currently, NO is not + // in the list of reserved words in sqlparser.data + // (we got a bug report about not being able to use + // 'no' as an identifier) + || ($arr[$i+2]['type'] == 'alpha_identifier' + && strtoupper($arr[$i+2]['data'])=='NO')) + ) { $third_upper_data = strtoupper($arr[$i+2]['data']); if ($third_upper_data == 'CASCADE' || $third_upper_data == 'RESTRICT' @@ -2149,9 +2148,9 @@ function PMA_SQP_formatHtml( $number_of_tokens=-1 ) { global $PMA_SQPdata_operators_docs, $PMA_SQPdata_functions_docs; - + $common_functions = PMA_CommonFunctions::getInstance(); - + //DEBUG echo 'in Format
'; print_r($arr); echo '
'; // then check for an array if (! is_array($arr)) { @@ -2291,7 +2290,7 @@ function PMA_SQP_formatHtml( && isset($keywords_with_brackets_2before[strtoupper($arr[$i - 2]['data'])])) || (($typearr[1] == 'alpha_reservedWord') && isset($keywords_with_brackets_1before[strtoupper($arr[$i - 1]['data'])])) - ) { + ) { $functionlevel++; $infunction = true; $after .= ' '; diff --git a/server_status.php b/server_status.php index 9317e04a51..c998d968db 100644 --- a/server_status.php +++ b/server_status.php @@ -897,7 +897,7 @@ foreach ($sections as $section_id => $section_name) {