Completed
Pull Request — master (#13)
by Erwan
01:28
created
event/search_listener.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 
31 31
 	public function __construct(\phpbb\request\request $request, \ernadoo\qte\qte $qte, \ernadoo\qte\search\fulltext_attribute $qte_search)
32 32
 	{
33
-		$this->request		= $request;
34
-		$this->qte			= $qte;
35
-		$this->qte_search	= $qte_search;
33
+		$this->request = $request;
34
+		$this->qte = $qte;
35
+		$this->qte_search = $qte_search;
36 36
 	}
37 37
 
38 38
 	static public function getSubscribedEvents()
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	{
120 120
 		if ($this->searc_attr)
121 121
 		{
122
-			$keywords	= utf8_normalize_nfc($this->request->variable('keywords', '', true));
123
-			$author		= $this->request->variable('author', '', true);
122
+			$keywords = utf8_normalize_nfc($this->request->variable('keywords', '', true));
123
+			$author = $this->request->variable('author', '', true);
124 124
 
125 125
 			if (!$keywords && !$author)
126 126
 			{
Please login to merge, or discard this patch.
event/acp_listener.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public function __construct(\phpbb\request\request $request, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, \ernadoo\qte\qte $qte, $table_prefix)
38 38
 	{
39
-		$this->request	= $request;
39
+		$this->request = $request;
40 40
 		$this->cache	= $cache;
41
-		$this->db		= $db;
41
+		$this->db = $db;
42 42
 		$this->user		= $user;
43
-		$this->qte		= $qte;
43
+		$this->qte = $qte;
44 44
 
45 45
 		$this->table_prefix = $table_prefix;
46 46
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	{
66 66
 		$categories				= $event['categories'];
67 67
 		$categories				= array_merge($categories, array('qte' => 'ACL_CAT_QTE'));
68
-		$event['categories']	= $categories;
68
+		$event['categories'] = $categories;
69 69
 
70 70
 		$permissions = $event['permissions'];
71 71
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		foreach ($this->qte->getAttr() as $attr)
79 79
 		{
80 80
 			$permissions += array(
81
-				'f_qte_attr_'.$attr['attr_id'] => array('lang' => $this->user->lang('QTE_CAN_USE_ATTR', $attr['attr_name']), 'cat' => 'qte'),
81
+				'f_qte_attr_' . $attr['attr_id'] => array('lang' => $this->user->lang('QTE_CAN_USE_ATTR', $attr['attr_name']), 'cat' => 'qte'),
82 82
 			);
83 83
 		}
84 84
 		$event['permissions'] = $permissions;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		$dest_forum_ids = array();
226 226
 		while ($row = $this->db->sql_fetchrow($result))
227 227
 		{
228
-			$dest_forum_ids[]	= (int) $row['forum_id'];
228
+			$dest_forum_ids[] = (int) $row['forum_id'];
229 229
 		}
230 230
 		$this->db->sql_freeresult($result);
231 231
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		$acl_options_ids = array();
244 244
 		while ($row = $this->db->sql_fetchrow($result))
245 245
 		{
246
-			$acl_options_ids[]	= (int) $row['auth_option_id'];
246
+			$acl_options_ids[] = (int) $row['auth_option_id'];
247 247
 		}
248 248
 
249 249
 		// From the mysql documentation:
Please login to merge, or discard this patch.
acp/main_module.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,18 +27,18 @@  discard block
 block discarded – undo
27 27
 	{
28 28
 		global $phpbb_container, $db, $user, $phpbb_log, $template, $cache, $request, $table_prefix;
29 29
 
30
-		$this->qte						= $phpbb_container->get('ernadoo.qte');
31
-		$this->migrator_tool_permission	= $phpbb_container->get('migrator.tool.permission');
30
+		$this->qte = $phpbb_container->get('ernadoo.qte');
31
+		$this->migrator_tool_permission = $phpbb_container->get('migrator.tool.permission');
32 32
 
33 33
 		$action			= $request->variable('action', '');
34 34
 		$submit			= $request->is_set_post('submit');
35 35
 		$attr_id		= $request->variable('id', 0);
36
-		$attr_auth_id	= $request->variable('attr_auth_id', 0);
36
+		$attr_auth_id = $request->variable('attr_auth_id', 0);
37 37
 
38 38
 		$error = array();
39 39
 		$clear_dest_perms = false;
40 40
 
41
-		$this->tpl_name		= 'acp_attributes';
41
+		$this->tpl_name = 'acp_attributes';
42 42
 		$this->page_title	= 'QTE_MANAGE_TITLE';
43 43
 
44 44
 		$user->add_lang_ext('ernadoo/qte', array('attributes', 'attributes_acp'));
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
 							$db->sql_query($sql);
157 157
 							$attr_id = $db->sql_nextid();
158 158
 
159
-							$this->migrator_tool_permission->add('f_qte_attr_'.$attr_id, false);
159
+							$this->migrator_tool_permission->add('f_qte_attr_' . $attr_id, false);
160 160
 
161 161
 							$message = 'ADDED';
162 162
 						}
163 163
 
164 164
 						if ($attr_auth_id)
165 165
 						{
166
-							$this->_copy_permission('f_qte_attr_'.$attr_id, 'f_qte_attr_'.$attr_auth_id, $clear_dest_perms);
166
+							$this->_copy_permission('f_qte_attr_' . $attr_id, 'f_qte_attr_' . $attr_auth_id, $clear_dest_perms);
167 167
 						}
168 168
 
169 169
 						$cache->destroy('_attr');
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 
272 272
 					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTRIBUTE_REMOVED', time(), array($attr_name));
273 273
 
274
-					$this->migrator_tool_permission->remove('f_qte_attr_'.$attr_id, false);
274
+					$this->migrator_tool_permission->remove('f_qte_attr_' . $attr_id, false);
275 275
 
276 276
 					$sql = 'DELETE FROM ' . $table_prefix . 'topics_attr
277 277
 						WHERE attr_id = ' . (int) $attr_id;
Please login to merge, or discard this patch.
qte.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
 	*/
70 70
 	public function __construct(\phpbb\request\request $request, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\log\log $log, \phpbb\auth\auth $auth, $root_path, $php_ext, $table_prefix)
71 71
 	{
72
-		$this->request		= $request;
72
+		$this->request = $request;
73 73
 		$this->cache		= $cache;
74
-		$this->db			= $db;
75
-		$this->template		= $template;
74
+		$this->db = $db;
75
+		$this->template = $template;
76 76
 		$this->user			= $user;
77
-		$this->log			= $log;
77
+		$this->log = $log;
78 78
 		$this->auth			= $auth;
79 79
 
80
-		$this->root_path	= $root_path;
81
-		$this->php_ext		= $php_ext;
80
+		$this->root_path = $root_path;
81
+		$this->php_ext = $php_ext;
82 82
 		$this->table_prefix = $table_prefix;
83 83
 
84 84
 		$this->_get_attributes();
@@ -169,16 +169,16 @@  discard block
 block discarded – undo
169 169
 	public function attr_select($forum_id, $author_id = 0, $attribute_id = 0, $viewtopic_url = '', $mode = '')
170 170
 	{
171 171
 		$show_select	= false;
172
-		$current_time	= time();
173
-		$can_edit		= (bool) $this->auth->acl_get('m_qte_attr_edit', $forum_id);
172
+		$current_time = time();
173
+		$can_edit = (bool) $this->auth->acl_get('m_qte_attr_edit', $forum_id);
174 174
 		$can_remove		= (bool) $this->auth->acl_get('m_qte_attr_del', $forum_id);
175
-		$is_author		= (bool) ($this->user->data['is_registered'] && $this->user->data['user_id'] == $author_id);
175
+		$is_author = (bool) ($this->user->data['is_registered'] && $this->user->data['user_id'] == $author_id);
176 176
 
177 177
 		if ($can_edit || $is_author || $mode == 'post')
178 178
 		{
179 179
 			foreach ($this->_attr as $attr)
180 180
 			{
181
-				if (!$this->auth->acl_get('f_qte_attr_'.$attr['attr_id'], $forum_id))
181
+				if (!$this->auth->acl_get('f_qte_attr_' . $attr['attr_id'], $forum_id))
182 182
 				{
183 183
 					continue;
184 184
 				}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	{
250 250
 		foreach ($this->_attr as $attr)
251 251
 		{
252
-			$forum_allowed = $this->auth->acl_getf('f_qte_attr_'.$attr['attr_id'], true);
252
+			$forum_allowed = $this->auth->acl_getf('f_qte_attr_' . $attr['attr_id'], true);
253 253
 
254 254
 			if (isset($forum_allowed[$forum_id]))
255 255
 			{
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	{
283 283
 		foreach ($this->_attr as $attr)
284 284
 		{
285
-			$forum_allowed = $this->auth->acl_getf('f_qte_attr_'.$attr['attr_id'], true);
285
+			$forum_allowed = $this->auth->acl_getf('f_qte_attr_' . $attr['attr_id'], true);
286 286
 
287 287
 			if (isset($forum_allowed[$forum_id]))
288 288
 			{
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 			return;
394 394
 		}
395 395
 
396
-		$can_edit		= $this->auth->acl_get('m_qte_attr_edit', $forum_id) || $this->auth->acl_get('f_qte_attr_'.$attribute_id, $forum_id) && $this->user->data['is_registered'] && $this->user->data['user_id'] == $author_id;
397
-		$can_remove		= $this->auth->acl_get('m_qte_attr_del', $forum_id);
396
+		$can_edit = $this->auth->acl_get('m_qte_attr_edit', $forum_id) || $this->auth->acl_get('f_qte_attr_' . $attribute_id, $forum_id) && $this->user->data['is_registered'] && $this->user->data['user_id'] == $author_id;
397
+		$can_remove = $this->auth->acl_get('m_qte_attr_del', $forum_id);
398 398
 
399 399
 		if (!$can_edit && $attribute_id != self::REMOVE || !$can_remove && $attribute_id == self::REMOVE)
400 400
 		{
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
 	*/
469 469
 	public function mcp_attr_apply($attribute_id = 0, $forum_id = 0, $topic_ids = array())
470 470
 	{
471
-		$can_edit		= $this->auth->acl_get('m_qte_attr_edit', $forum_id);
472
-		$can_remove		= $this->auth->acl_get('m_qte_attr_del', $forum_id);
471
+		$can_edit = $this->auth->acl_get('m_qte_attr_edit', $forum_id);
472
+		$can_remove = $this->auth->acl_get('m_qte_attr_del', $forum_id);
473 473
 
474 474
 		if (!$can_edit && $attribute_id != self::REMOVE || !$can_remove && $attribute_id == self::REMOVE)
475 475
 		{
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 			$a_class_name = preg_replace('#[^a-z0-9 _-]#', '', strtolower($a_name));
581 581
 		}
582 582
 
583
-		return ' class="qte-attr ' . (isset($a_class_name) ?  $a_class_name : '') . '"' . (!empty($a_colour) ? ' style="color:#' . $a_colour . '; font-weight:bold;"' : '');
583
+		return ' class="qte-attr ' . (isset($a_class_name) ? $a_class_name : '') . '"' . (!empty($a_colour) ? ' style="color:#' . $a_colour . '; font-weight:bold;"' : '');
584 584
 	}
585 585
 
586 586
 	/**
Please login to merge, or discard this patch.
event/main_listener.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, \phpbb\log\log $log, \ernadoo\qte\qte $qte)
35 35
 	{
36
-		$this->request	= $request;
37
-		$this->template	= $template;
38
-		$this->user		= $user;
36
+		$this->request = $request;
37
+		$this->template = $template;
38
+		$this->user = $user;
39 39
 		$this->log		= $log;
40 40
 		$this->qte		= $qte;
41 41
 	}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 			if ($topic_attribute != \ernadoo\qte\qte::KEEP)
119 119
 			{
120
-				$post_data['topic_attr_id']		= (int) $topic_attribute;
120
+				$post_data['topic_attr_id'] = (int) $topic_attribute;
121 121
 				$post_data['topic_attr_user']	= (int) $this->user->data['user_id'];
122 122
 				$post_data['topic_attr_time']	= time();
123 123
 
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 
140 140
 		if ($event['post_data']['force_attr'])
141 141
 		{
142
-			if ($post_data['attr_id'] == \ernadoo\qte\qte::REMOVE && ($event['mode'] == 'post' || ($event['mode'] == 'edit' && $event['post_data']['topic_first_post_id'] == $event['post_id'])) )
142
+			if ($post_data['attr_id'] == \ernadoo\qte\qte::REMOVE && ($event['mode'] == 'post' || ($event['mode'] == 'edit' && $event['post_data']['topic_first_post_id'] == $event['post_id'])))
143 143
 			{
144 144
 				$error = $event['error'];
145 145
 				$error[] = $this->user->lang['QTE_ATTRIBUTE_UNSELECTED'];
146
-				$event['error'] = $error ;
146
+				$event['error'] = $error;
147 147
 
148 148
 				// init the value
149 149
 				$post_data['attr_id'] = 0;
Please login to merge, or discard this patch.
migrations/v200/convert_old_permissions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 
53 53
 		while ($row = $this->db->sql_fetchrow($result))
54 54
 		{
55
-			$auth_option = 'f_qte_attr_'.$row['attr_id'];
55
+			$auth_option = 'f_qte_attr_' . $row['attr_id'];
56 56
 			$migrator_tool_permission->add($auth_option, false);
57 57
 			$attr_permissions_array[$auth_option] = json_decode($row['attr_auths'], true);
58 58
 		}
Please login to merge, or discard this patch.
event/mcp_listener.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	*/
31 31
 	public function __construct(\phpbb\request\request $request, \ernadoo\qte\qte $qte)
32 32
 	{
33
-		$this->request	= $request;
34
-		$this->qte		= $qte;
33
+		$this->request = $request;
34
+		$this->qte = $qte;
35 35
 	}
36 36
 
37 37
 	static public function getSubscribedEvents()
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 		$sql_ary = $event['sql_ary'];
62 62
 
63
-		$sql_ary['topic_attr_id']	= $event['topic_row']['topic_attr_id'];
63
+		$sql_ary['topic_attr_id'] = $event['topic_row']['topic_attr_id'];
64 64
 		$sql_ary['topic_attr_user'] = $event['topic_row']['topic_attr_user'];
65 65
 		$sql_ary['topic_attr_time'] = $event['topic_row']['topic_attr_time'];
66 66
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	{
72 72
 		$shadow = $event['shadow'];
73 73
 
74
-		$shadow['topic_attr_id']	= $event['row']['topic_attr_id'];
74
+		$shadow['topic_attr_id'] = $event['row']['topic_attr_id'];
75 75
 		$shadow['topic_attr_user']	= $event['row']['topic_attr_user'];
76 76
 		$shadow['topic_attr_time']	= $event['row']['topic_attr_time'];
77 77
 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 
81 81
 	public function mcp_select_assign_attributes($event)
82 82
 	{
83
-		$attr_id	= (int) $this->request->variable('attr_id', 0);
84
-		$forum_id	= (int) $event['forum_info']['forum_id'];
83
+		$attr_id = (int) $this->request->variable('attr_id', 0);
84
+		$forum_id = (int) $event['forum_info']['forum_id'];
85 85
 
86 86
 		if ($attr_id)
87 87
 		{
Please login to merge, or discard this patch.