diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2012-04-13 20:20:26 +0400 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2012-04-13 20:20:26 +0400 |
commit | ea800101cb1f4242ccf629c73d91f2a876dbfb19 (patch) | |
tree | 44b32c389a1b9f208c3e75dde2c6580ca07acd7c | |
parent | fa9aaea8c0f409cfd6f131de6b808de1a4851008 (diff) |
Fix Checkstyle Warnings - Type: BraceOnSameLine
42 files changed, 297 insertions, 172 deletions
diff --git a/libraries/Theme.class.php b/libraries/Theme.class.php index 11ebb0d333..d9bd8affd1 100644 --- a/libraries/Theme.class.php +++ b/libraries/Theme.class.php @@ -362,7 +362,8 @@ class PMA_Theme * * @return string CSS code. */ - function getCssIEClearFilter() { + function getCssIEClearFilter() + { return PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 6 && PMA_USR_BROWSER_VER <= 8 ? 'filter: none' : ''; diff --git a/libraries/config/ConfigFile.class.php b/libraries/config/ConfigFile.class.php index 97d9f0d917..62ad8378c0 100644 --- a/libraries/config/ConfigFile.class.php +++ b/libraries/config/ConfigFile.class.php @@ -328,7 +328,8 @@ class ConfigFile * @param string $path * @return string */ - public function getCanonicalPath($path) { + public function getCanonicalPath($path) + { return preg_replace('#^Servers/([\d]+)/#', 'Servers/1/', $path); } diff --git a/libraries/dbi/drizzle-wrappers.lib.php b/libraries/dbi/drizzle-wrappers.lib.php index 86fcf229b4..b47f69548c 100644 --- a/libraries/dbi/drizzle-wrappers.lib.php +++ b/libraries/dbi/drizzle-wrappers.lib.php @@ -12,7 +12,8 @@ */ // TODO: drizzle module segfaults while freeing resources, often. This allows at least for some development -function _drizzle_shutdown_flush() { +function _drizzle_shutdown_flush() +{ flush(); } register_shutdown_function('_drizzle_shutdown_flush'); @@ -130,7 +131,7 @@ class PMA_Drizzle extends Drizzle /** * Creates a new connection using unix domain socket - * + * * @param $uds * @param $user * @param $password @@ -211,7 +212,7 @@ class PMA_DrizzleCon /** * Pass calls of undefined methods to DrizzleCon object - * + * * @param $method * @param $args * @return mixed diff --git a/libraries/dbi/drizzle.dbi.lib.php b/libraries/dbi/drizzle.dbi.lib.php index 724e94f778..457bc291de 100644 --- a/libraries/dbi/drizzle.dbi.lib.php +++ b/libraries/dbi/drizzle.dbi.lib.php @@ -229,7 +229,8 @@ function PMA_DBI_free_result($result) * * @return bool false */ -function PMA_DBI_more_results() { +function PMA_DBI_more_results() +{ // N.B.: PHP's 'mysql' extension does not support // multi_queries so this function will always // return false. Use the 'mysqli' extension, if @@ -242,7 +243,8 @@ function PMA_DBI_more_results() { * * @return bool false */ -function PMA_DBI_next_result() { +function PMA_DBI_next_result() +{ // N.B.: PHP's 'mysql' extension does not support // multi_queries so this function will always // return false. Use the 'mysqli' extension, if diff --git a/libraries/export/csv.php b/libraries/export/csv.php index bb4a550164..deb8538438 100644 --- a/libraries/export/csv.php +++ b/libraries/export/csv.php @@ -42,7 +42,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportFooter() { + function PMA_exportFooter() + { return true; } @@ -53,7 +54,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportHeader() { + function PMA_exportHeader() + { global $what; global $csv_terminated; global $csv_separator; @@ -101,7 +103,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBHeader($db) { + function PMA_exportDBHeader($db) + { return true; } @@ -113,7 +116,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBFooter($db) { + function PMA_exportDBFooter($db) + { return true; } @@ -125,7 +129,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBCreate($db) { + function PMA_exportDBCreate($db) + { return true; } @@ -141,7 +146,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { + function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) + { global $what; global $csv_terminated; global $csv_separator; diff --git a/libraries/export/htmlword.php b/libraries/export/htmlword.php index abd492792f..91c04cfb6b 100644 --- a/libraries/export/htmlword.php +++ b/libraries/export/htmlword.php @@ -41,7 +41,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportFooter() { + function PMA_exportFooter() + { return PMA_exportOutputHandler('</body></html>'); } @@ -52,7 +53,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportHeader() { + 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" @@ -74,7 +76,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBHeader($db) { + function PMA_exportDBHeader($db) + { return PMA_exportOutputHandler('<h1>' . __('Database') . ' ' . htmlspecialchars($db) . '</h1>'); } @@ -86,7 +89,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBFooter($db) { + function PMA_exportDBFooter($db) + { return true; } @@ -98,7 +102,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBCreate($db) { + function PMA_exportDBCreate($db) + { return true; } diff --git a/libraries/export/mediawiki.php b/libraries/export/mediawiki.php index 752f196a7c..99faa998f6 100644 --- a/libraries/export/mediawiki.php +++ b/libraries/export/mediawiki.php @@ -31,7 +31,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportFooter() { + function PMA_exportFooter() + { return true; } @@ -42,7 +43,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportHeader() { + function PMA_exportHeader() + { return true; } @@ -54,7 +56,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBHeader($db) { + function PMA_exportDBHeader($db) + { return true; } @@ -66,7 +69,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBFooter($db) { + function PMA_exportDBFooter($db) + { return true; } @@ -78,7 +82,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBCreate($db) { + function PMA_exportDBCreate($db) + { return true; } @@ -94,7 +99,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { + function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) + { $columns = PMA_DBI_get_columns($db, $table); $columns = array_values($columns); $row_cnt = count($columns); diff --git a/libraries/export/ods.php b/libraries/export/ods.php index 1ee1fb7045..e9728cd8b7 100644 --- a/libraries/export/ods.php +++ b/libraries/export/ods.php @@ -40,7 +40,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportFooter() { + function PMA_exportFooter() + { $GLOBALS['ods_buffer'] .= '</office:spreadsheet>' . '</office:body>' . '</office:document-content>'; @@ -57,7 +58,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportHeader() { + function PMA_exportHeader() + { $GLOBALS['ods_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>' . '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">' . '<office:automatic-styles>' @@ -107,7 +109,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBHeader($db) { + function PMA_exportDBHeader($db) + { return true; } @@ -119,7 +122,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBFooter($db) { + function PMA_exportDBFooter($db) + { return true; } @@ -131,7 +135,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBCreate($db) { + function PMA_exportDBCreate($db) + { return true; } @@ -147,7 +152,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { + function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) + { global $what; // Gets the data from the database diff --git a/libraries/export/texytext.php b/libraries/export/texytext.php index f06ae5817a..21906d8eda 100644 --- a/libraries/export/texytext.php +++ b/libraries/export/texytext.php @@ -39,7 +39,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportFooter() { + function PMA_exportFooter() + { return true; } @@ -50,7 +51,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportHeader() { + function PMA_exportHeader() + { return true; } @@ -62,7 +64,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBHeader($db) { + function PMA_exportDBHeader($db) + { return PMA_exportOutputHandler('===' . __('Database') . ' ' . $db . "\n\n"); } @@ -74,7 +77,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBFooter($db) { + function PMA_exportDBFooter($db) + { return true; } @@ -86,7 +90,8 @@ if (isset($plugin_list)) { * * @access public */ - function PMA_exportDBCreate($db) { + function PMA_exportDBCreate($db) + { return true; } diff --git a/libraries/import/shp.php b/libraries/import/shp.php index e935ca271f..bf9d1e09d4 100644 --- a/libraries/import/shp.php +++ b/libraries/import/shp.php @@ -41,7 +41,8 @@ if (isset($plugin_list)) { // Returns specified number of bytes from the buffer. // Buffer automatically fetches next chunk of data when the buffer falls short. // Sets $eof when $GLOBALS['finished'] is set and the buffer falls short. - function readFromBuffer($length){ + function readFromBuffer($length) + { global $buffer, $eof; if (strlen($buffer) < $length) { diff --git a/libraries/sanitizing.lib.php b/libraries/sanitizing.lib.php index 802481679b..4183cae821 100644 --- a/libraries/sanitizing.lib.php +++ b/libraries/sanitizing.lib.php @@ -149,7 +149,8 @@ function PMA_sanitize($message, $escape = false, $safe = false) * @return string the sanitized filename * */ -function PMA_sanitize_filename($filename) { +function PMA_sanitize_filename($filename) +{ $filename = preg_replace('/[^A-Za-z0-9_.-]/', '_', $filename); return $filename; } diff --git a/libraries/sysinfo.lib.php b/libraries/sysinfo.lib.php index c6408ff631..3566ffea97 100644 --- a/libraries/sysinfo.lib.php +++ b/libraries/sysinfo.lib.php @@ -32,13 +32,15 @@ class WINNT public $os = 'WINNT'; - public function __construct() { + public function __construct() + { // initialize the wmi object $objLocator = new COM('WbemScripting.SWbemLocator'); $this->_wmi = $objLocator->ConnectServer(); } - function loadavg() { + function loadavg() + { $loadavg = ""; $sum = 0; $buffer = $this->_getWMI('Win32_Processor', array('LoadPercentage')); @@ -52,7 +54,8 @@ class WINNT return array('loadavg' => $sum / count($buffer)); } - private function _getWMI($strClass, $strValue = array()) { + private function _getWMI($strClass, $strValue = array()) + { $arrData = array(); $value = ""; @@ -81,7 +84,8 @@ class WINNT } - function memory() { + function memory() + { $buffer = $this->_getWMI("Win32_OperatingSystem", array('TotalVisibleMemorySize', 'FreePhysicalMemory')); $mem = Array(); $mem['MemTotal'] = $buffer[0]['TotalVisibleMemorySize']; @@ -108,13 +112,15 @@ class Linux { public $os = 'Linux'; - function loadavg() { + function loadavg() + { $buf = file_get_contents('/proc/stat'); $nums=preg_split("/\s+/", substr($buf, 0, strpos($buf, "\n"))); return Array('busy' => $nums[1]+$nums[2]+$nums[3], 'idle' => intval($nums[4])); } - function memory() { + function memory() + { preg_match_all('/^(MemTotal|MemFree|Cached|Buffers|SwapCached|SwapTotal|SwapFree):\s+(.*)\s*kB/im', file_get_contents('/proc/meminfo'), $matches); $mem = array_combine( $matches[1], $matches[2] ); diff --git a/libraries/transformations/text_plain__append.inc.php b/libraries/transformations/text_plain__append.inc.php index 5ca0d3c7e0..b8297a557c 100644 --- a/libraries/transformations/text_plain__append.inc.php +++ b/libraries/transformations/text_plain__append.inc.php @@ -5,14 +5,15 @@ * Has one option: the text to be appended (default '')
*/
-function PMA_transformation_text_plain__append_info() {
+function PMA_transformation_text_plain__append_info()
+{
return array(
'info' => __('Appends text to a string. The only option is the text to be appended (enclosed in single quotes, default empty string).'),
);
}
-function PMA_transformation_text_plain__append($buffer, $options = array(), $meta = '') {
-
+function PMA_transformation_text_plain__append($buffer, $options = array(), $meta = '')
+{
if (! isset($options[0]) || $options[0] == '') {
$options[0] = '';
}
diff --git a/tbl_tracking.php b/tbl_tracking.php index e207b710e6..ae0f0388a8 100644 --- a/tbl_tracking.php +++ b/tbl_tracking.php @@ -60,7 +60,8 @@ if (isset($_REQUEST['report_export'])) { * @return array filtered entries * */ - function PMA_filter_tracking($data, $filter_ts_from, $filter_ts_to, $filter_users) { + function PMA_filter_tracking($data, $filter_ts_from, $filter_ts_to, $filter_users) + { $tmp_entries = array(); $id = 0; foreach ( $data as $entry ) { diff --git a/test/classes/Advisor_test.php b/test/classes/Advisor_test.php index c57b367d56..3ca153dbb5 100644 --- a/test/classes/Advisor_test.php +++ b/test/classes/Advisor_test.php @@ -31,7 +31,8 @@ class Advisor_test extends PHPUnit_Framework_TestCase $this->assertEquals(Advisor::escapePercent($text), $expected); } - public function escapeStrings() { + public function escapeStrings() + { return array( array('80%', '80%%'), array('%s%', '%s%%'), diff --git a/test/classes/PMA_File_test.php b/test/classes/PMA_File_test.php index 9760618520..c483a9a0ad 100644 --- a/test/classes/PMA_File_test.php +++ b/test/classes/PMA_File_test.php @@ -57,7 +57,8 @@ class PMA_File_test extends PHPUnit_Framework_TestCase $this->assertEquals($data, $file->getContent()); } - public function compressedFiles() { + public function compressedFiles() + { return array( array('./test/test_data/test.gz', 'application/gzip'), array('./test/test_data/test.bz2', 'application/bzip2'), diff --git a/test/classes/PMA_Message_test.php b/test/classes/PMA_Message_test.php index 64e04297e3..e65ce3532f 100644 --- a/test/classes/PMA_Message_test.php +++ b/test/classes/PMA_Message_test.php @@ -396,7 +396,8 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase $this->assertTrue($this->object->isDisplayed(false)); } - public function providerAffectedRows(){ + public function providerAffectedRows() + { return array(array(1, '<div class="notice"> 1 row affected.</div>')); return array(array(2, '<div class="notice"> 2 rows affected.</div>')); return array(array(50000000000000, '<div class="notice"> 50000000000000 rows affected.</div>')); @@ -416,7 +417,8 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase $this->object->display(); } - public function providerInsertedRows(){ + public function providerInsertedRows() + { return array(array(1, '<div class="notice"> 1 row inserted.</div>')); return array(array(2, '<div class="notice"> 2 rows inserted.</div>')); return array(array(50000000000000, '<div class="notice"> 50000000000000 rows inserted.</div>')); @@ -436,7 +438,8 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase $this->object->display(); } - public function providerDeletedRows(){ + public function providerDeletedRows() + { return array(array(1, '<div class="notice"> 1 row deleted.</div>')); return array(array(2, '<div class="notice"> 2 rows deleted.</div>')); return array(array(50000000000000, '<div class="notice"> 50000000000000 rows deleted.</div>')); diff --git a/test/libraries/common/PMA_browseUploadFile_test.php b/test/libraries/common/PMA_browseUploadFile_test.php index d372ee610f..0f9f96f3c5 100644 --- a/test/libraries/common/PMA_browseUploadFile_test.php +++ b/test/libraries/common/PMA_browseUploadFile_test.php @@ -19,7 +19,8 @@ class PMA_browseUploadFile_test extends PHPUnit_Framework_TestCase /* * Data provider for test */ - public function dataProvider() { + public function dataProvider() + { return array( array(10, __('B'), "10"), array(100, __('B'), "100"), @@ -35,8 +36,8 @@ class PMA_browseUploadFile_test extends PHPUnit_Framework_TestCase * @dataProvider dataProvider * @return void */ - function testBrowseUploadFile($size, $unit, $res){ - + 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>' diff --git a/test/libraries/common/PMA_buildActionTitles_test.php b/test/libraries/common/PMA_buildActionTitles_test.php index 8068cefead..91e857ed21 100644 --- a/test/libraries/common/PMA_buildActionTitles_test.php +++ b/test/libraries/common/PMA_buildActionTitles_test.php @@ -24,7 +24,8 @@ class PMA_buildActionTitles_test extends PHPUnit_Framework_TestCase $GLOBALS['pmaThemeImage'] = 'theme/'; } - function testBuildActionTitles(){ + function testBuildActionTitles() + { $titles = array(); $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse')); diff --git a/test/libraries/common/PMA_contains_nonprintable_ascii_test.php b/test/libraries/common/PMA_contains_nonprintable_ascii_test.php index 2804c88c2b..581adb6acc 100644 --- a/test/libraries/common/PMA_contains_nonprintable_ascii_test.php +++ b/test/libraries/common/PMA_contains_nonprintable_ascii_test.php @@ -16,7 +16,8 @@ require_once 'libraries/common.lib.php'; class PMA_contains_nonprintable_ascii extends PHPUnit_Framework_TestCase { - function dataProvider(){ + function dataProvider() + { return array( array("normal string", 0), array("new\nline", 1), @@ -29,7 +30,8 @@ class PMA_contains_nonprintable_ascii extends PHPUnit_Framework_TestCase /** * @dataProvider dataProvider */ - function testContainsNonPrintableAscii($str, $res){ + function testContainsNonPrintableAscii($str, $res) + { $this->assertEquals($res, PMA_contains_nonprintable_ascii($str)); } diff --git a/test/libraries/common/PMA_convert_bit_default_value_test.php b/test/libraries/common/PMA_convert_bit_default_value_test.php index 6dd7b25235..445f3c2b8c 100644 --- a/test/libraries/common/PMA_convert_bit_default_value_test.php +++ b/test/libraries/common/PMA_convert_bit_default_value_test.php @@ -16,7 +16,8 @@ require_once 'libraries/common.lib.php'; class PMA_convert_bit_default_value_test extends PHPUnit_Framework_TestCase { - function dataProvider(){ + function dataProvider() + { return array( array("b'",""), array("b'01'","01"), @@ -27,7 +28,8 @@ class PMA_convert_bit_default_value_test extends PHPUnit_Framework_TestCase /** * @dataProvider dataProvider */ - function testConvert_bit_default_value_test($bit, $val){ + function testConvert_bit_default_value_test($bit, $val) + { $this->assertEquals($val, PMA_convert_bit_default_value($bit)); } diff --git a/test/libraries/common/PMA_displayMaximumUploadSize_test.php b/test/libraries/common/PMA_displayMaximumUploadSize_test.php index 9236c4435c..8840b52775 100644 --- a/test/libraries/common/PMA_displayMaximumUploadSize_test.php +++ b/test/libraries/common/PMA_displayMaximumUploadSize_test.php @@ -19,7 +19,8 @@ class PMA_displayMaximumUploadSize_test extends PHPUnit_Framework_TestCase /* * Data provider for test */ - public function dataProvider() { + public function dataProvider() + { return array( array(10, __('B'), "10"), array(100, __('B'), "100"), @@ -35,7 +36,8 @@ class PMA_displayMaximumUploadSize_test extends PHPUnit_Framework_TestCase * @dataProvider dataProvider * @return void */ - function testMaximumUploadSize($size, $unit, $res){ + function testMaximumUploadSize($size, $unit, $res) + { $this->assertEquals("(" . __('Max: '). $res . $unit .")", PMA_displayMaximumUploadSize($size)); } diff --git a/test/libraries/common/PMA_escapeMySqlWildcards_test.php b/test/libraries/common/PMA_escapeMySqlWildcards_test.php index de4d1a79ab..91c0f3ce07 100644 --- a/test/libraries/common/PMA_escapeMySqlWildcards_test.php +++ b/test/libraries/common/PMA_escapeMySqlWildcards_test.php @@ -16,7 +16,8 @@ require_once 'libraries/common.lib.php'; class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase { - public function escapeDataProvider() { + public function escapeDataProvider() + { return array( array('\_test', '_test'), array('\_\\', '_\\'), @@ -29,8 +30,8 @@ class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase ); } - /** - * PMA_escape_mysql_wildcards tests + /** + * PMA_escape_mysql_wildcards tests * @dataProvider escapeDataProvider */ @@ -39,8 +40,8 @@ class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase $this->assertEquals($a, PMA_escape_mysql_wildcards($b)); } - /** - * PMA_unescape_mysql_wildcards tests + /** + * PMA_unescape_mysql_wildcards tests * @dataProvider escapeDataProvider */ diff --git a/test/libraries/common/PMA_extractValueFromFormattedSize_test.php b/test/libraries/common/PMA_extractValueFromFormattedSize_test.php index 43ba342465..75f734845e 100644 --- a/test/libraries/common/PMA_extractValueFromFormattedSize_test.php +++ b/test/libraries/common/PMA_extractValueFromFormattedSize_test.php @@ -16,23 +16,23 @@ require_once 'libraries/common.lib.php'; class PMA_extractValueFromFormattedSize_test extends PHPUnit_Framework_TestCase { - function testExtractValueFromFormattedSizeNoFormat(){ - + function testExtractValueFromFormattedSizeNoFormat() + { $this->assertEquals(-1, PMA_extractValueFromFormattedSize(100)); } - function testExtractValueFromFormattedSizeGB(){ - + function testExtractValueFromFormattedSizeGB() + { $this->assertEquals(10737418240, PMA_extractValueFromFormattedSize("10GB")); } - function testExtractValueFromFormattedSizeMB(){ - + function testExtractValueFromFormattedSizeMB() + { $this->assertEquals(15728640, PMA_extractValueFromFormattedSize("15MB")); } - function testExtractValueFromFormattedSizeK(){ - + function testExtractValueFromFormattedSizeK() + { $this->assertEquals(262144, PMA_extractValueFromFormattedSize("256K")); } } diff --git a/test/libraries/common/PMA_foreignKeySupported_test.php b/test/libraries/common/PMA_foreignKeySupported_test.php index ccea2a2036..703e62ac04 100644 --- a/test/libraries/common/PMA_foreignKeySupported_test.php +++ b/test/libraries/common/PMA_foreignKeySupported_test.php @@ -20,7 +20,8 @@ class PMA_foreignKeySupported_test extends PHPUnit_Framework_TestCase * * @return array */ - public function foreignkeySupportedDataProvider() { + public function foreignkeySupportedDataProvider() + { return array( array('MyISAM', false), array('innodb', true), @@ -32,7 +33,8 @@ class PMA_foreignKeySupported_test extends PHPUnit_Framework_TestCase * foreign key supported test * @dataProvider foreignkeySupportedDataProvider */ - public function testForeignkeySupported($a, $e) { + public function testForeignkeySupported($a, $e) + { $this->assertEquals($e, PMA_foreignkey_supported($a)); } } diff --git a/test/libraries/common/PMA_formatNumberByteDown_test.php b/test/libraries/common/PMA_formatNumberByteDown_test.php index 2cdf25991e..f67df587ec 100644 --- a/test/libraries/common/PMA_formatNumberByteDown_test.php +++ b/test/libraries/common/PMA_formatNumberByteDown_test.php @@ -28,8 +28,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase /** * storing globals and session */ - public function setUp() { - + public function setUp() + { $this->tmpGlobals = $GLOBALS; $this->tmpSession = $_SESSION; @@ -38,8 +38,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase /** * recovering globals and session */ - public function tearDown() { - + public function tearDown() + { $GLOBALS = $this->tmpGlobals; $_SESSION = $this->tmpSession; @@ -50,7 +50,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase * * @return array */ - public function formatNumberDataProvider() { + public function formatNumberDataProvider() + { return array( array(10, 2, 2, '10 '), array(100, 2, 0, '100 '), @@ -67,7 +68,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase * format number test, globals are defined * @dataProvider formatNumberDataProvider */ - public function testFormatNumber($a, $b, $c, $d) { + public function testFormatNumber($a, $b, $c, $d) + { $this->assertEquals($d, (string)PMA_formatNumber($a, $b, $c, false)); } @@ -76,7 +78,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase * * @return array */ - public function formatByteDownDataProvider() { + public function formatByteDownDataProvider() + { return array( array(10, 2, 2, array('10', __('B'))), array(100, 2, 0, array('0', __('KiB'))), @@ -92,7 +95,8 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase * format byte test, globals are defined * @dataProvider formatByteDownDataProvider */ - public function testFormatByteDown($a, $b, $c, $e) { + public function testFormatByteDown($a, $b, $c, $e) + { $result = PMA_formatByteDown($a, $b, $c); $result[0] = trim($result[0]); $this->assertEquals($e, $result); diff --git a/test/libraries/common/PMA_formatSql_test.php b/test/libraries/common/PMA_formatSql_test.php index 809ebb180c..eb49541062 100644 --- a/test/libraries/common/PMA_formatSql_test.php +++ b/test/libraries/common/PMA_formatSql_test.php @@ -30,7 +30,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase /** * storing globals and session */ - public function setUp() { + public function setUp() + { global $cfg; $this->tmpCfg = $cfg; } @@ -38,19 +39,22 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase /** * recovering globals and session */ - public function tearDown() { + public function tearDown() + { global $cfg; $cfg = $this->tmpCfg; } - function testFormatSQLNotArray(){ + function testFormatSQLNotArray() + { global $cfg; $cfg['SQP']['fmtType'] = 'html'; $sql = "SELECT * FROM tTable;"; $this->assertEquals("<pre>\n$sql\n</pre>", PMA_formatSql($sql)); } - function testFormatSQLfmTypeHtml_1(){ + function testFormatSQLfmTypeHtml_1() + { global $cfg; $cfg['SQP']['fmtType'] = 'html'; $cfg['MySQLManualType'] = 'none'; @@ -84,7 +88,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, PMA_formatSql($sql, $unparsed)); } - function testFormatSQLfmTypeHtml_2(){ + function testFormatSQLfmTypeHtml_2() + { global $cfg; $cfg['SQP']['fmtType'] = 'html'; $cfg['MySQLManualType'] = 'none'; @@ -131,7 +136,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, PMA_formatSql($sql, $unparsed)); } - function testFormatSQLfmTypeHtml_3(){ + function testFormatSQLfmTypeHtml_3() + { global $cfg; $cfg['SQP']['fmtType'] = 'html'; $cfg['MySQLManualType'] = 'none'; @@ -266,7 +272,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, PMA_formatSql($sql, $unparsed)); } - function testFormatSQLfmTypeText_1(){ + function testFormatSQLfmTypeText_1() + { global $cfg; $cfg['SQP']['fmtType'] = 'text'; $cfg['MySQLManualType'] = 'none'; @@ -300,7 +307,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, PMA_formatSql($sql, $unparsed)); } - function testFormatSQLfmTypeText_2(){ + function testFormatSQLfmTypeText_2() + { global $cfg; $cfg['SQP']['fmtType'] = 'text'; $cfg['MySQLManualType'] = 'none'; @@ -347,7 +355,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, PMA_formatSql($sql, $unparsed)); } - function testFormatSQLfmTypeText_3(){ + function testFormatSQLfmTypeText_3() + { global $cfg; $cfg['SQP']['fmtType'] = 'text'; $cfg['MySQLManualType'] = 'none'; @@ -481,7 +490,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, PMA_formatSql($sql, $unparsed)); } - function testFormatSQLfmTypeNone_1(){ + function testFormatSQLfmTypeNone_1() + { global $cfg; $cfg['SQP']['fmtType'] = 'none'; $cfg['MySQLManualType'] = 'none'; @@ -518,7 +528,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, PMA_formatSql($sql)); } - function testFormatSQLfmTypeNone_2(){ + function testFormatSQLfmTypeNone_2() + { global $cfg; $cfg['SQP']['fmtType'] = 'none'; $cfg['MySQLManualType'] = 'none'; @@ -568,7 +579,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, PMA_formatSql($sql)); } - function testFormatSQLfmTypeNone_3(){ + function testFormatSQLfmTypeNone_3() + { global $cfg; $cfg['SQP']['fmtType'] = 'none'; $cfg['MySQLManualType'] = 'none'; @@ -705,7 +717,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, PMA_formatSql($sql)); } - function testFormatSQLWithoutType(){ + function testFormatSQLWithoutType() + { global $cfg; $cfg['SQP']['fmtType'] = ''; $cfg['MySQLManualType'] = 'none'; @@ -735,7 +748,8 @@ class PMA_formatSql_test extends PHPUnit_Framework_TestCase $this->assertEmpty(PMA_formatSql($sql)); } - function testFormatSQLError(){ + function testFormatSQLError() + { global $SQP_errorString; $SQP_errorString = true; $sql = array("raw" => "& \" < >"); diff --git a/test/libraries/common/PMA_generateHiddenMaxFileSize_test.php b/test/libraries/common/PMA_generateHiddenMaxFileSize_test.php index d546fd8297..88a4f3d949 100644 --- a/test/libraries/common/PMA_generateHiddenMaxFileSize_test.php +++ b/test/libraries/common/PMA_generateHiddenMaxFileSize_test.php @@ -19,7 +19,8 @@ class PMA_generateHiddenMaxFileSize_test extends PHPUnit_Framework_TestCase /* * Data provider for test */ - public function dataProvider() { + public function dataProvider() + { return array( array(10), array("100"), @@ -34,7 +35,8 @@ class PMA_generateHiddenMaxFileSize_test extends PHPUnit_Framework_TestCase * @dataProvider dataProvider * @return void */ - function test_generateHiddenMaxFileSize($size){ + function test_generateHiddenMaxFileSize($size) + { $this->assertEquals(PMA_generateHiddenMaxFileSize($size), '<input type="hidden" name="MAX_FILE_SIZE" value="' .$size . '" />'); } diff --git a/test/libraries/common/PMA_getIcon_test.php b/test/libraries/common/PMA_getIcon_test.php index 486dc3131c..2234696117 100644 --- a/test/libraries/common/PMA_getIcon_test.php +++ b/test/libraries/common/PMA_getIcon_test.php @@ -21,8 +21,8 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme'); } - function testGetIconWithoutPropertiesIconic(){ - + function testGetIconWithoutPropertiesIconic() + { $GLOBALS['cfg']['PropertiesIconic'] = false; $this->assertEquals( @@ -31,8 +31,8 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase ); } - function testGetIconWithPropertiesIconic(){ - + function testGetIconWithPropertiesIconic() + { $GLOBALS['cfg']['PropertiesIconic'] = true; $this->assertEquals( @@ -41,8 +41,8 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase ); } - function testGetIconAlternate(){ - + function testGetIconAlternate() + { $GLOBALS['cfg']['PropertiesIconic'] = true; $alternate_text = 'alt_str'; @@ -53,8 +53,8 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase ); } - function testGetIconWithForceText(){ - + function testGetIconWithForceText() + { $GLOBALS['cfg']['PropertiesIconic'] = true; $alternate_text = 'alt_str'; diff --git a/test/libraries/common/PMA_getTitleForTarget_test.php b/test/libraries/common/PMA_getTitleForTarget_test.php index 77cdb6ff45..f6b1afe13e 100644 --- a/test/libraries/common/PMA_getTitleForTarget_test.php +++ b/test/libraries/common/PMA_getTitleForTarget_test.php @@ -16,7 +16,8 @@ require_once 'libraries/common.lib.php'; class PMA_getTitleForTarget_test extends PHPUnit_Framework_TestCase { - function dataProvider(){ + function dataProvider() + { return array( array('tbl_structure.php', __('Structure')), array('tbl_sql.php', __('SQL'),), @@ -34,8 +35,8 @@ class PMA_getTitleForTarget_test extends PHPUnit_Framework_TestCase * @dataProvider dataProvider * @return void */ - function testGetTitleForTarget($target, $result){ - + function testGetTitleForTarget($target, $result) + { $this->assertEquals($result, PMA_getTitleForTarget($target)); } diff --git a/test/libraries/common/PMA_localisedDateTimespan_test.php b/test/libraries/common/PMA_localisedDateTimespan_test.php index b4ee1f7de0..8c6329f287 100644 --- a/test/libraries/common/PMA_localisedDateTimespan_test.php +++ b/test/libraries/common/PMA_localisedDateTimespan_test.php @@ -33,8 +33,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase /** * storing globals and session */ - public function setUp() { - + public function setUp() + { $this->tmpGlobals = $GLOBALS; $this->tmpSession = $_SESSION; $this->tmpTimezone = date_default_timezone_get(); @@ -44,8 +44,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase /** * recovering globals and session */ - public function tearDown() { - + public function tearDown() + { $GLOBALS = $this->tmpGlobals; $_SESSION = $this->tmpSession; date_default_timezone_set($this->tmpTimezone); @@ -57,7 +57,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase * * @return array */ - public function localisedDateDataProvider() { + public function localisedDateDataProvider() + { return array( array(1227455558, '', 'Nov 23, 2008 at 03:52 PM'), array(1227455558, '%Y-%m-%d %H:%M:%S %a', '2008-11-23 15:52:38 Sun') @@ -68,7 +69,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase * localised date test, globals are defined * @dataProvider localisedDateDataProvider */ - public function testLocalisedDate($a, $b, $e) { + public function testLocalisedDate($a, $b, $e) + { $this->assertEquals($e, PMA_localisedDate($a, $b)); } @@ -77,7 +79,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase * * @return array */ - public function timespanFormatDataProvider() { + public function timespanFormatDataProvider() + { return array( array(1258, '0 days, 0 hours, 20 minutes and 58 seconds'), array(821958, '9 days, 12 hours, 19 minutes and 18 seconds') @@ -88,7 +91,8 @@ class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase * localised timestamp test, globals are defined * @dataProvider timespanFormatDataProvider */ - public function testTimespanFormat($a, $e) { + public function testTimespanFormat($a, $e) + { $GLOBALS['timespanfmt'] = '%s days, %s hours, %s minutes and %s seconds'; $this->assertEquals($e, PMA_timespanFormat($a)); diff --git a/test/libraries/common/PMA_printableBitValue_test.php b/test/libraries/common/PMA_printableBitValue_test.php index eea420d3b3..bf1c6f2e6d 100644 --- a/test/libraries/common/PMA_printableBitValue_test.php +++ b/test/libraries/common/PMA_printableBitValue_test.php @@ -21,7 +21,8 @@ class PMA_printableBitValue_test extends PHPUnit_Framework_TestCase * * @return array */ - public function printableBitValueDataProvider() { + public function printableBitValueDataProvider() + { return array( array('testtest', 64, '0111010001100101011100110111010001110100011001010111001101110100'), array('test', 32, '01110100011001010111001101110100') @@ -33,7 +34,8 @@ class PMA_printableBitValue_test extends PHPUnit_Framework_TestCase * @dataProvider printableBitValueDataProvider */ - public function testPrintableBitValue($a, $b, $e) { + public function testPrintableBitValue($a, $b, $e) + { $this->assertEquals($e, PMA_printable_bit_value($a, $b)); } } diff --git a/test/libraries/common/PMA_quoting_slashing_test.php b/test/libraries/common/PMA_quoting_slashing_test.php index 9f946f91f6..291d1cca8d 100644 --- a/test/libraries/common/PMA_quoting_slashing_test.php +++ b/test/libraries/common/PMA_quoting_slashing_test.php @@ -20,7 +20,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase /** * sqlAddslashes test */ - public function testAddSlashes() { + public function testAddSlashes() + { $string = "\'test''\''\'\r\t\n"; $this->assertEquals("\\\\\\\\\'test\'\'\\\\\\\\\'\'\\\\\\\\\'\\r\\t\\n", PMA_sqlAddSlashes($string, true, true, true)); @@ -38,7 +39,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase * * @return array */ - public function unQuoteProvider() { + public function unQuoteProvider() + { return array( array('"test\'"', "test'"), array("'test''", "test'"), @@ -51,7 +53,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase * unQuote test * @dataProvider unQuoteProvider */ - public function testUnQuote($param, $expected) { + public function testUnQuote($param, $expected) + { $this->assertEquals($expected, PMA_unQuote($param)); } @@ -60,7 +63,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase * * @return array */ - public function unQuoteSelectedProvider() { + public function unQuoteSelectedProvider() + { return array( array('"test\'"', "test'"), array("'test''", "'test''"), @@ -73,7 +77,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase * unQuote test with chosen quote * @dataProvider unQuoteSelectedProvider */ - public function testUnQuoteSelectedChar($param, $expected) { + public function testUnQuoteSelectedChar($param, $expected) + { $this->assertEquals($expected, PMA_unQuote($param, '"')); } @@ -82,7 +87,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase * * @return array */ - public function backquoteDataProvider() { + public function backquoteDataProvider() + { return array( array('0', '`0`'), array('test', '`test`'), @@ -95,7 +101,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase * backquote test with different param $do_it (true, false) * @dataProvider backquoteDataProvider */ - public function testBackquote($a, $b) { + public function testBackquote($a, $b) + { // Test bypass quoting (used by dump functions) $this->assertEquals($a, PMA_backquote($a, false)); @@ -103,7 +110,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase $this->assertEquals($b, PMA_backquote($a)); } - public function testBackquoteForbidenWords() { + public function testBackquoteForbidenWords() + { global $PMA_SQPdata_forbidden_word; foreach ($PMA_SQPdata_forbidden_word as $forbidden) { diff --git a/test/libraries/common/PMA_stringOperations_test.php b/test/libraries/common/PMA_stringOperations_test.php index ef18dbea88..716ce6cda1 100644 --- a/test/libraries/common/PMA_stringOperations_test.php +++ b/test/libraries/common/PMA_stringOperations_test.php @@ -31,8 +31,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase /** * storing globals and session */ - public function setUp() { - + public function setUp() + { global $GLOBALS, $_SESSION; $this->tmpGlobals = $GLOBALS; $this->tmpSession = $_SESSION; @@ -44,7 +44,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase * * @return array */ - public function flipStringDataProvider() { + public function flipStringDataProvider() + { return array( array('test', "t<br />\ne<br />\ns<br />\nt"), array('te ;st', "t<br />\ne<br />\n <br />\n;<br />\ns<br />\nt") @@ -56,7 +57,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase * @dataProvider flipStringDataProvider */ - public function testFlipString($a, $e) { + public function testFlipString($a, $e) + { $this->assertEquals($e, PMA_flipstring($a)); } @@ -65,7 +67,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase * * @return array */ - public function userDirDataProvider() { + public function userDirDataProvider() + { return array( array('/var/pma_tmp/%u/', "/var/pma_tmp/root/"), array('/home/%u/pma', "/home/root/pma/") @@ -77,7 +80,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase * @dataProvider userDirDataProvider */ - public function testUserDirString($a, $e) { + public function testUserDirString($a, $e) + { $GLOBALS['cfg']['Server']['user'] = 'root'; $this->assertEquals($e, PMA_userDir($a)); @@ -88,7 +92,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase * * @return array */ - public function replaceBinaryContentsDataProvider() { + public function replaceBinaryContentsDataProvider() + { return array( array("\x000", '\00'), array("\x08\x0a\x0d\x1atest", '\b\n\r\Ztest'), @@ -101,7 +106,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase * @dataProvider replaceBinaryContentsDataProvider */ - public function testReplaceBinaryContents($a, $e) { + public function testReplaceBinaryContents($a, $e) + { $this->assertEquals($e, PMA_replace_binary_contents($a)); } @@ -110,7 +116,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase * * @return array */ - public function duplicateFirstNewlineDataProvider() { + public function duplicateFirstNewlineDataProvider() + { return array( array('test', 'test'), array("\r\ntest", "\n\r\ntest"), @@ -124,7 +131,8 @@ class PMA_stringOperations_test extends PHPUnit_Framework_TestCase * @dataProvider duplicateFirstNewlineDataProvider */ - public function testDuplicateFirstNewline($a, $e) { + public function testDuplicateFirstNewline($a, $e) + { $this->assertEquals($e, PMA_duplicateFirstNewline($a)); } diff --git a/test/libraries/core/PMA_checkPageValidity_test.php b/test/libraries/core/PMA_checkPageValidity_test.php index baaaeaf9da..0836a77c0b 100644 --- a/test/libraries/core/PMA_checkPageValidity_test.php +++ b/test/libraries/core/PMA_checkPageValidity_test.php @@ -35,30 +35,35 @@ class PMA_checkPageValidity_test extends PHPUnit_Framework_TestCase 'user_password.php', ); - function testGotoNowhere(){ + function testGotoNowhere() + { $page = null; $this->assertFalse(PMA_checkPageValidity($page, null)); } - function testGotoWhitelist(){ + function testGotoWhitelist() + { $page = 'export.php'; $this->assertTrue(PMA_checkPageValidity($page, $this->goto_whitelist)); } - function testGotoNotInWhitelist(){ + function testGotoNotInWhitelist() + { $page = 'shell.php'; $this->assertFalse(PMA_checkPageValidity($page, $this->goto_whitelist)); } - function testGotoWhitelistPage(){ + function testGotoWhitelistPage() + { $page = 'main.php?sql.php&test=true'; $this->assertTrue(PMA_checkPageValidity($page, $this->goto_whitelist)); } - function testGotoWhitelistEncodedPage(){ + function testGotoWhitelistEncodedPage() + { $page = 'main.php%3Fsql.php%26test%3Dtrue'; $this->assertTrue(PMA_checkPageValidity($page, $this->goto_whitelist)); diff --git a/test/libraries/core/PMA_getLinks_test.php b/test/libraries/core/PMA_getLinks_test.php index bc4490dfff..069e633bfc 100644 --- a/test/libraries/core/PMA_getLinks_test.php +++ b/test/libraries/core/PMA_getLinks_test.php @@ -33,7 +33,8 @@ class PMA_getLinks_test extends PHPUnit_Framework_TestCase ); } - public function providerLinkURL(){ + public function providerLinkURL() + { return array( array('http://wiki.phpmyadmin.net', './url.php?url=http%3A%2F%2Fwiki.phpmyadmin.net&server=99&lang=en&token=token'), array('https://wiki.phpmyadmin.net', './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net&server=99&lang=en&token=token'), @@ -45,7 +46,8 @@ class PMA_getLinks_test extends PHPUnit_Framework_TestCase /** * @dataProvider providerLinkURL */ - public function testPMA_linkURL($link, $url){ + public function testPMA_linkURL($link, $url) + { $this->assertEquals(PMA_linkURL($link), $url); } diff --git a/test/libraries/core/PMA_securePath_test.php b/test/libraries/core/PMA_securePath_test.php index 3dbd6380ed..d85385f42e 100644 --- a/test/libraries/core/PMA_securePath_test.php +++ b/test/libraries/core/PMA_securePath_test.php @@ -11,7 +11,8 @@ require_once 'libraries/core.lib.php'; class PMA_securePath extends PHPUnit_Framework_TestCase { - public function testReplaceDots(){ + public function testReplaceDots() + { $this->assertEquals(PMA_securePath('../../../etc/passwd'), './././etc/passwd'); $this->assertEquals(PMA_securePath('/var/www/../phpmyadmin'), '/var/www/./phpmyadmin'); $this->assertEquals(PMA_securePath('./path/with..dots/../../file..php'), './path/with.dots/././file.php'); diff --git a/test/libraries/core/PMA_warnMissingExtension_test.php b/test/libraries/core/PMA_warnMissingExtension_test.php index 1e11c73f04..1209b89cb5 100644 --- a/test/libraries/core/PMA_warnMissingExtension_test.php +++ b/test/libraries/core/PMA_warnMissingExtension_test.php @@ -15,14 +15,16 @@ require_once 'libraries/core.lib.php'; class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase { - function testMissingExtention(){ + 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.'); PMA_warnMissingExtension($ext); } - function testMissingExtentionFatal(){ + function testMissingExtentionFatal() + { $ext = 'php_ext'; $warn = 'The <a href="' . PMA_getPHPDocLink('book.' . $ext . '.php') . '" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.'; @@ -34,7 +36,8 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase $this->assertGreaterThan(0, strpos($printed, $warn)); } - function testMissingExtentionFatalWithExtra(){ + function testMissingExtentionFatalWithExtra() + { $ext = 'php_ext'; $extra = 'Appended Extra String'; @@ -48,7 +51,8 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase $this->assertGreaterThan(0, strpos($printed, $warn)); } - function testMissingExtentionWithExtra(){ + function testMissingExtentionWithExtra() + { $ext = 'php_ext'; $extra = 'Appended Extra String'; $this->setExpectedException('PHPUnit_Framework_Error', diff --git a/test/libraries/js_escape_test.php b/test/libraries/js_escape_test.php index 0bc904b519..d8ce4568ff 100644 --- a/test/libraries/js_escape_test.php +++ b/test/libraries/js_escape_test.php @@ -21,7 +21,8 @@ class PMA_JS_Escape_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, PMA_getJsValue($key, $value)); } - public function variables() { + public function variables() + { return array( array('foo', true, "foo = true;\n"), array('foo', false, "foo = false;\n"), diff --git a/test/libraries/php-gettext/Parsing_test.php b/test/libraries/php-gettext/Parsing_test.php index d651d84c3a..4f1795cc93 100644 --- a/test/libraries/php-gettext/Parsing_test.php +++ b/test/libraries/php-gettext/Parsing_test.php @@ -46,7 +46,8 @@ class ParsingTest extends PHPUnit_Framework_TestCase /** * @dataProvider data_provider_test_npgettext */ - public function test_npgettext($number, $expected) { + public function test_npgettext($number, $expected) + { $parser = new gettext_reader(NULL); $result = $parser->npgettext("context", "%d pig went to the market\n", @@ -54,7 +55,8 @@ class ParsingTest extends PHPUnit_Framework_TestCase $number); $this->assertSame($expected, $result); } - public static function data_provider_test_npgettext() { + public static function data_provider_test_npgettext() + { return array( array(1, "%d pig went to the market\n"), array(2, "%d pigs went to the market\n"), diff --git a/test/selenium/Helper.php b/test/selenium/Helper.php index 81a6f11d14..4146690f41 100644 --- a/test/selenium/Helper.php +++ b/test/selenium/Helper.php @@ -31,7 +31,8 @@ class Helper } } - public static function getBrowserString() { + public static function getBrowserString() + { $browserString = self::$config->getCurrentBrowser(); return $browserString; } diff --git a/user_password.php b/user_password.php index bcad720ac5..d7b8cc03e5 100644 --- a/user_password.php +++ b/user_password.php @@ -67,12 +67,13 @@ require './libraries/footer.inc.php'; /** * Send the message as an ajax request - * + * * @param array $change_password_message * @param string $sql_query * @return void */ -function PMA_getChangePassMessage($change_password_message, $sql_query = '') { +function PMA_getChangePassMessage($change_password_message, $sql_query = '') +{ if ($GLOBALS['is_ajax_request'] == true) { /** * If in an Ajax request, we don't need to show the rest of the page @@ -88,10 +89,11 @@ function PMA_getChangePassMessage($change_password_message, $sql_query = '') { /** * Generate the message - * - * @return array error value and message + * + * @return array error value and message */ -function PMA_setChangePasswordMsg() { +function PMA_setChangePasswordMsg() +{ $error = false; $message = PMA_Message::success(__('The profile has been updated.')); @@ -109,19 +111,20 @@ function PMA_setChangePasswordMsg() { /** * Change the password - * + * * @param string $password * @param string $message * @param array $change_password_message * @return void */ -function PMA_changePassword($password, $message, $change_password_message) { +function PMA_changePassword($password, $message, $change_password_message) +{ // Defines the url to return to in case of error in the sql statement $_url_params = array(); $hashing_function = PMA_changePassHashingFunction(); $sql_query = 'SET password = ' . (($password == '') ? '\'\'' : $hashing_function . '(\'***\')'); PMA_ChangePassUrlParamsAndSubmitQuery($password, $_url_params, $sql_query, $hashing_function); - + $new_url_params = PMA_changePassAuthType($_url_params, $password); PMA_getChangePassMessage($change_password_message, $sql_query); PMA_changePassDisplayPage($message, $sql_query, $new_url_params); @@ -129,10 +132,11 @@ function PMA_changePassword($password, $message, $change_password_message) { /** * Generate the hashing function - * + * * @return string $hashing_function */ -function PMA_changePassHashingFunction() { +function PMA_changePassHashingFunction() +{ if (PMA_isValid($_REQUEST['pw_hash'], 'identical', 'old')) { $hashing_function = 'OLD_PASSWORD'; } else { @@ -143,14 +147,15 @@ function PMA_changePassHashingFunction() { /** * Generate the error url and submit the query - * + * * @param string $password * @param array $_url_params * @param string $sql_query * @param string $hashing_function * @return void */ -function PMA_ChangePassUrlParamsAndSubmitQuery($password, $_url_params, $sql_query, $hashing_function) { +function PMA_ChangePassUrlParamsAndSubmitQuery($password, $_url_params, $sql_query, $hashing_function) +{ $err_url = 'user_password.php' . PMA_generate_common_url($_url_params); $local_query = 'SET password = ' . (($password == '') ? '\'\'' : $hashing_function . '(\'' . PMA_sqlAddSlashes($password) . '\')'); $result = @PMA_DBI_try_query($local_query) @@ -159,12 +164,13 @@ function PMA_ChangePassUrlParamsAndSubmitQuery($password, $_url_params, $sql_que /** * Change password authentication type - * + * * @param array $_url_params * @param string $password * @return array $_url_params */ -function PMA_changePassAuthType($_url_params, $password) { +function PMA_changePassAuthType($_url_params, $password) +{ /** * Changes password cookie if required * Duration = till the browser is closed for password (we don't want this to be saved) @@ -184,13 +190,14 @@ function PMA_changePassAuthType($_url_params, $password) { /** * Display the page - * + * * @param string $message * @param string $sql_query * @param array $_url_params * @return void */ -function PMA_changePassDisplayPage($message, $sql_query, $_url_params) { +function PMA_changePassDisplayPage($message, $sql_query, $_url_params) +{ include_once './libraries/header.inc.php'; echo '<h1>' . __('Change password') . '</h1>' . "\n\n"; PMA_showMessage($message, $sql_query, 'success'); |