From 2991918bac1656bbc97dd7b1b2b335af24c11d18 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Fri, 25 Apr 2014 23:31:31 +0200 Subject: [PATCH 1/4] [ticket/12444] The logs message aren't filled correctly https://tracker.phpbb.com/browse/PHPBB3-12444 PHPBB3-12444 --- phpBB/phpbb/log/log.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index e38950f4c1..24b622dbac 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -520,7 +520,7 @@ class log implements \phpbb\log\log_interface $num_args = 0; if (!is_array($this->user->lang[$row['log_operation']])) { - $num_args = substr_count($log[$i]['action'], '%'); + $num_args = substr_count($this->user->lang[$row['log_operation']], '%'); } else { From 3d1569d38594cb06a9d8a9baa3f64a37ac8c9b43 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Sat, 26 Apr 2014 00:42:24 +0200 Subject: [PATCH 2/4] [ticket/12444] Adding regression test PHPBB3-12444 --- tests/log/fixtures/full_log.xml | 36 ++++++++++++++++++---------- tests/log/function_view_log_test.php | 27 +++++++++++++++++++++ 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/tests/log/fixtures/full_log.xml b/tests/log/fixtures/full_log.xml index 4e5538d5a9..4e59dc93f6 100644 --- a/tests/log/fixtures/full_log.xml +++ b/tests/log/fixtures/full_log.xml @@ -83,18 +83,18 @@ LOG_MOD - - 7 - 1 - 1 - 12 - 45 - 0 - 127.0.0.1 - 1 - LOG_MOD2 - - + + 7 + 1 + 1 + 12 + 45 + 0 + 127.0.0.1 + 1 + LOG_MOD2 + + 8 3 @@ -131,6 +131,18 @@ LOG_SINGULAR_PLURAL a:1:{i:0;i:2;} + + 11 + 1 + 1 + 15 + 3 + 0 + 127.0.0.1 + 1 + LOG_MOD3 + a:1:{i:0;s:5:"guest";} + user_id diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php index 2f64459062..542d0adf9d 100644 --- a/tests/log/function_view_log_test.php +++ b/tests/log/function_view_log_test.php @@ -225,6 +225,27 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'viewforum' => '', 'action' => 'LOG_SINGULAR_PLURAL 2', ), + 11 => array( + 'id' => 11, + + 'reportee_id' => 0, + 'reportee_username' => '', + 'reportee_username_full'=> '', + + 'user_id' => 1, + 'username' => 'Anonymous', + 'username_full' => 'Anonymous', + + 'ip' => '127.0.0.1', + 'time' => 1, + 'forum_id' => 15, + 'topic_id' => 3, + + 'viewforum' => '', + 'action' => 'LOG_MOD3 guest ', + 'viewtopic' => '', + 'viewlogs' => '', + ), ); $test_cases = array( @@ -310,6 +331,11 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'expected_returned' => 0, 'user', false, 5, 0, 0, 0, 0, 0, 'l.log_id ASC', 'plural', ), + array( + 'expected' => array(11), + 'expected_returned' => 0, + 'mod', 0, 5, 0, 15, 3, + ), ); foreach ($test_cases as $case => $case_data) @@ -362,6 +388,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'LOG_INSTALL_INSTALLED' => 'installed: %s', 'LOG_USER' => 'User
%s', 'LOG_MOD2' => 'Mod2', + 'LOG_MOD3' => 'Mod3: %1$s, %2$s', 'LOG_SINGULAR_PLURAL' => array( 1 => 'singular', 2 => 'plural (%d)', From 41b004ae50601d54e589f41441e86f76010ed57b Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Sat, 26 Apr 2014 00:52:56 +0200 Subject: [PATCH 3/4] [ticket/12444] Replace spaces with tabs PHPBB3-12444 --- tests/log/fixtures/full_log.xml | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/log/fixtures/full_log.xml b/tests/log/fixtures/full_log.xml index 4e59dc93f6..60713dbe89 100644 --- a/tests/log/fixtures/full_log.xml +++ b/tests/log/fixtures/full_log.xml @@ -83,18 +83,18 @@ LOG_MOD - - 7 - 1 - 1 - 12 - 45 - 0 - 127.0.0.1 - 1 - LOG_MOD2 - - + + 7 + 1 + 1 + 12 + 45 + 0 + 127.0.0.1 + 1 + LOG_MOD2 + + 8 3 @@ -132,16 +132,16 @@ a:1:{i:0;i:2;} - 11 - 1 - 1 - 15 - 3 - 0 - 127.0.0.1 - 1 - LOG_MOD3 - a:1:{i:0;s:5:"guest";} + 11 + 1 + 1 + 15 + 3 + 0 + 127.0.0.1 + 1 + LOG_MOD3 + a:1:{i:0;s:5:"guest";}
From 7b8a8a2a5da212657e1baf02466665c9e4a9ec8a Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Sat, 26 Apr 2014 18:52:26 +0200 Subject: [PATCH 4/4] [ticket/12444] Replacing spaces with tabs PHPBB3-12444 --- tests/log/fixtures/full_log.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/log/fixtures/full_log.xml b/tests/log/fixtures/full_log.xml index 60713dbe89..ef35884444 100644 --- a/tests/log/fixtures/full_log.xml +++ b/tests/log/fixtures/full_log.xml @@ -131,7 +131,7 @@ LOG_SINGULAR_PLURAL a:1:{i:0;i:2;} - + 11 1 1 @@ -142,7 +142,7 @@ 1 LOG_MOD3 a:1:{i:0;s:5:"guest";} - +
user_id