@@ -33,18 +33,6 @@ |
||
33 | 33 | /** |
34 | 34 | * Performs a search on keywords depending on display specific params. You have to run split_keywords() first |
35 | 35 | * |
36 | - * @param array $keywords_ary contains each words to search |
|
37 | - * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) |
|
38 | - * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query |
|
39 | - * @param string $sort_key is the key of $sort_by_sql for the selected sorting |
|
40 | - * @param string $sort_dir is either a or d representing ASC and DESC |
|
41 | - * @param string $sort_days specifies the maximum amount of days a post may be old |
|
42 | - * @param array $ex_cid_ary specifies an array of category ids which should not be searched |
|
43 | - * @param int $cat_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched |
|
44 | - * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered |
|
45 | - * @param int $start indicates the first index of the page |
|
46 | - * @param int $per_page number of ids each page is supposed to contain |
|
47 | - * @return int total number of results |
|
48 | 36 | */ |
49 | 37 | public function attribute_search($attribute_id, $type, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) |
50 | 38 | { |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | protected $db; |
20 | 20 | |
21 | 21 | /** |
22 | - * Constructor |
|
23 | - * |
|
24 | - * @param \phpbb\config\config $config Config object |
|
25 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
26 | - */ |
|
22 | + * Constructor |
|
23 | + * |
|
24 | + * @param \phpbb\config\config $config Config object |
|
25 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
26 | + */ |
|
27 | 27 | public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db) |
28 | 28 | { |
29 | 29 | $this->config = $config; |
@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | - * Performs a search on keywords depending on display specific params. You have to run split_keywords() first |
|
35 | - * |
|
36 | - * @param array $keywords_ary contains each words to search |
|
37 | - * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) |
|
38 | - * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query |
|
39 | - * @param string $sort_key is the key of $sort_by_sql for the selected sorting |
|
40 | - * @param string $sort_dir is either a or d representing ASC and DESC |
|
41 | - * @param string $sort_days specifies the maximum amount of days a post may be old |
|
42 | - * @param array $ex_cid_ary specifies an array of category ids which should not be searched |
|
43 | - * @param int $cat_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched |
|
44 | - * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered |
|
45 | - * @param int $start indicates the first index of the page |
|
46 | - * @param int $per_page number of ids each page is supposed to contain |
|
47 | - * @return int total number of results |
|
48 | - */ |
|
34 | + * Performs a search on keywords depending on display specific params. You have to run split_keywords() first |
|
35 | + * |
|
36 | + * @param array $keywords_ary contains each words to search |
|
37 | + * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) |
|
38 | + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query |
|
39 | + * @param string $sort_key is the key of $sort_by_sql for the selected sorting |
|
40 | + * @param string $sort_dir is either a or d representing ASC and DESC |
|
41 | + * @param string $sort_days specifies the maximum amount of days a post may be old |
|
42 | + * @param array $ex_cid_ary specifies an array of category ids which should not be searched |
|
43 | + * @param int $cat_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched |
|
44 | + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered |
|
45 | + * @param int $start indicates the first index of the page |
|
46 | + * @param int $per_page number of ids each page is supposed to contain |
|
47 | + * @return int total number of results |
|
48 | + */ |
|
49 | 49 | public function attribute_search($attribute_id, $type, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) |
50 | 50 | { |
51 | 51 | // generate a search_key from all the options to identify the results |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db) |
28 | 28 | { |
29 | - $this->config = $config; |
|
30 | - $this->db = $db; |
|
29 | + $this->config = $config; |
|
30 | + $this->db = $db; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | $id_ary = array(); |
82 | 82 | |
83 | 83 | // Create some display specific sql strings |
84 | - $sql_attribute = 't.topic_attr_id = ' . (int) $attribute_id; |
|
84 | + $sql_attribute = 't.topic_attr_id = ' . (int) $attribute_id; |
|
85 | 85 | $sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; |
86 | - $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; |
|
86 | + $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; |
|
87 | 87 | $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; |
88 | - $sql_firstpost = ' AND p.post_id = t.topic_first_post_id'; |
|
88 | + $sql_firstpost = ' AND p.post_id = t.topic_first_post_id'; |
|
89 | 89 | |
90 | 90 | // Build sql strings for sorting |
91 | 91 | $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | switch ($sql_sort[0]) |
94 | 94 | { |
95 | 95 | case 'u': |
96 | - $sql_sort_table = USERS_TABLE . ' u, '; |
|
97 | - $sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster '; |
|
96 | + $sql_sort_table = USERS_TABLE . ' u, '; |
|
97 | + $sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster '; |
|
98 | 98 | break; |
99 | 99 | |
100 | 100 | case 'f': |
101 | - $sql_sort_table = FORUMS_TABLE . ' f, '; |
|
102 | - $sql_sort_join = ' AND f.forum_id = p.forum_id '; |
|
101 | + $sql_sort_table = FORUMS_TABLE . ' f, '; |
|
102 | + $sql_sort_join = ' AND f.forum_id = p.forum_id '; |
|
103 | 103 | break; |
104 | 104 | } |
105 | 105 |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // Build the query for really selecting the post_ids |
112 | 112 | if ($type == 'posts') |
113 | 113 | { |
114 | - $sql = "SELECT {$calc_results}p.post_id |
|
114 | + $sql = "select {$calc_results}p.post_id |
|
115 | 115 | FROM " . $sql_sort_table . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t ' . " |
116 | 116 | WHERE $sql_attribute |
117 | 117 | $sql_topic_id |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | else |
127 | 127 | { |
128 | - $sql = "SELECT {$calc_results}t.topic_id |
|
128 | + $sql = "select {$calc_results}t.topic_id |
|
129 | 129 | FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p |
130 | 130 | WHERE $sql_attribute |
131 | 131 | $sql_topic_id |
@@ -180,14 +180,14 @@ |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | - * Copies attributes permissions from one forum to others |
|
184 | - * |
|
185 | - * @param int $src_forum_id The source forum we want to copy permissions from |
|
186 | - * @param array $dest_forum_ids The destination forum(s) we want to copy to |
|
187 | - * @param bool $clear_dest_perms True if destination permissions should be deleted |
|
188 | - * |
|
189 | - * @return bool False on error |
|
190 | - */ |
|
183 | + * Copies attributes permissions from one forum to others |
|
184 | + * |
|
185 | + * @param int $src_forum_id The source forum we want to copy permissions from |
|
186 | + * @param array $dest_forum_ids The destination forum(s) we want to copy to |
|
187 | + * @param bool $clear_dest_perms True if destination permissions should be deleted |
|
188 | + * |
|
189 | + * @return bool False on error |
|
190 | + */ |
|
191 | 191 | private function _copy_attribute_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perms) |
192 | 192 | { |
193 | 193 | // Only one forum id specified |
@@ -36,11 +36,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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: |
@@ -30,9 +30,9 @@ discard block |
||
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 |
||
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 | { |
@@ -23,11 +23,11 @@ |
||
23 | 23 | protected $qte; |
24 | 24 | |
25 | 25 | /** |
26 | - * Constructor |
|
27 | - * |
|
28 | - * @param \phpbb\request\request $request Request object |
|
29 | - * @param \ernadoo\qte\qte $qte QTE object |
|
30 | - */ |
|
26 | + * Constructor |
|
27 | + * |
|
28 | + * @param \phpbb\request\request $request Request object |
|
29 | + * @param \ernadoo\qte\qte $qte QTE object |
|
30 | + */ |
|
31 | 31 | public function __construct(\phpbb\request\request $request, \ernadoo\qte\qte $qte) |
32 | 32 | { |
33 | 33 | $this->request = $request; |
@@ -30,8 +30,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | { |
@@ -27,18 +27,18 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -525,15 +525,15 @@ |
||
525 | 525 | } |
526 | 526 | |
527 | 527 | /** |
528 | - * Permission Copy |
|
529 | - * |
|
530 | - * Copy a permission (auth) option |
|
531 | - * |
|
532 | - * @param string $auth_option The name of the permission (auth) option |
|
533 | - * @param int $copy_from If set, contains the id of the permission from which to copy the new one. |
|
534 | - * @param bool $clear_dest_perms True if destination permissions should be deleted |
|
535 | - * @return null |
|
536 | - */ |
|
528 | + * Permission Copy |
|
529 | + * |
|
530 | + * Copy a permission (auth) option |
|
531 | + * |
|
532 | + * @param string $auth_option The name of the permission (auth) option |
|
533 | + * @param int $copy_from If set, contains the id of the permission from which to copy the new one. |
|
534 | + * @param bool $clear_dest_perms True if destination permissions should be deleted |
|
535 | + * @return null |
|
536 | + */ |
|
537 | 537 | private function _copy_permission($auth_option, $copy_from, $clear_dest_perms = true) |
538 | 538 | { |
539 | 539 | global $db, $phpbb_root_path, $phpEx; |
@@ -403,6 +403,9 @@ |
||
403 | 403 | return $attr; |
404 | 404 | } |
405 | 405 | |
406 | + /** |
|
407 | + * @return string |
|
408 | + */ |
|
406 | 409 | protected function qte_move($attr_row, $action = 'move_up', $steps = 1) |
407 | 410 | { |
408 | 411 | global $db, $table_prefix; |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | private $_name = array(); |
55 | 55 | |
56 | 56 | /** |
57 | - * Constructor |
|
58 | - * |
|
59 | - * @param \phpbb\request\request $request Request object |
|
60 | - * @param \phpbb\cache\driver\driver_interface $cache Cache object |
|
61 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
62 | - * @param \phpbb\template\template $template Template object |
|
63 | - * @param \phpbb\user $user User object |
|
64 | - * @param \phpbb\log\log $log Log object |
|
65 | - * @param \phpbb\auth\auth $auth Auth object |
|
66 | - * @param string $root_path phpBB root path |
|
67 | - * @param string $php_ext phpEx |
|
68 | - * @param string $table_prefix Prefix tables |
|
69 | - */ |
|
57 | + * Constructor |
|
58 | + * |
|
59 | + * @param \phpbb\request\request $request Request object |
|
60 | + * @param \phpbb\cache\driver\driver_interface $cache Cache object |
|
61 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
62 | + * @param \phpbb\template\template $template Template object |
|
63 | + * @param \phpbb\user $user User object |
|
64 | + * @param \phpbb\log\log $log Log object |
|
65 | + * @param \phpbb\auth\auth $auth Auth object |
|
66 | + * @param string $root_path phpBB root path |
|
67 | + * @param string $php_ext phpEx |
|
68 | + * @param string $table_prefix Prefix tables |
|
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 | 72 | $this->request = $request; |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | - * Get topic attributes username |
|
90 | - * |
|
91 | - * @param array $topic_list Topic ids |
|
92 | - * |
|
93 | - * @return null |
|
94 | - */ |
|
89 | + * Get topic attributes username |
|
90 | + * |
|
91 | + * @param array $topic_list Topic ids |
|
92 | + * |
|
93 | + * @return null |
|
94 | + */ |
|
95 | 95 | public function get_users_by_topic_id($topic_list) |
96 | 96 | { |
97 | 97 | if (!empty($topic_list)) |
@@ -116,24 +116,24 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
119 | - * Get attribute name |
|
120 | - * |
|
121 | - * @param int $attr_id The attribute id |
|
122 | - * |
|
123 | - * @return string |
|
124 | - */ |
|
119 | + * Get attribute name |
|
120 | + * |
|
121 | + * @param int $attr_id The attribute id |
|
122 | + * |
|
123 | + * @return string |
|
124 | + */ |
|
125 | 125 | public function get_attr_name_by_id($attr_id) |
126 | 126 | { |
127 | 127 | return $this->_attr[$attr_id]['attr_name']; |
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * Get attribute author |
|
132 | - * |
|
133 | - * @param int $user_id User id |
|
134 | - * |
|
135 | - * @return string |
|
136 | - */ |
|
131 | + * Get attribute author |
|
132 | + * |
|
133 | + * @param int $user_id User id |
|
134 | + * |
|
135 | + * @return string |
|
136 | + */ |
|
137 | 137 | public function get_users_by_user_id($user_id) |
138 | 138 | { |
139 | 139 | if (!isset($this->_name[$user_id])) |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | - * Generate a list of attributes based on permissions |
|
160 | - * |
|
161 | - * @param int $forum_id Forum id |
|
162 | - * @param int $author_id Topic author id |
|
163 | - * @param int $attribute_id Current attribute id |
|
164 | - * @param string $viewtopic_url Topic's url |
|
165 | - * @param string $mode Post mode |
|
166 | - * |
|
167 | - * @return null |
|
168 | - */ |
|
159 | + * Generate a list of attributes based on permissions |
|
160 | + * |
|
161 | + * @param int $forum_id Forum id |
|
162 | + * @param int $author_id Topic author id |
|
163 | + * @param int $attribute_id Current attribute id |
|
164 | + * @param string $viewtopic_url Topic's url |
|
165 | + * @param string $mode Post mode |
|
166 | + * |
|
167 | + * @return null |
|
168 | + */ |
|
169 | 169 | public function attr_select($forum_id, $author_id = 0, $attribute_id = 0, $viewtopic_url = '', $mode = '') |
170 | 170 | { |
171 | 171 | $show_select = false; |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
218 | - * Generate a list of all attributes for search page |
|
219 | - * |
|
220 | - * @return null |
|
221 | - */ |
|
218 | + * Generate a list of all attributes for search page |
|
219 | + * |
|
220 | + * @return null |
|
221 | + */ |
|
222 | 222 | public function attr_search() |
223 | 223 | { |
224 | 224 | foreach ($this->_attr as $attr) |
@@ -238,13 +238,13 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
241 | - * Generate a list of attributes for viewforum page |
|
242 | - * |
|
243 | - * @param int $forum_id Forum id |
|
244 | - * @param int $attribute_id Current attribute id |
|
245 | - * |
|
246 | - * @return null |
|
247 | - */ |
|
241 | + * Generate a list of attributes for viewforum page |
|
242 | + * |
|
243 | + * @param int $forum_id Forum id |
|
244 | + * @param int $attribute_id Current attribute id |
|
245 | + * |
|
246 | + * @return null |
|
247 | + */ |
|
248 | 248 | public function attr_sort($forum_id = 0, $attribute_id = 0) |
249 | 249 | { |
250 | 250 | foreach ($this->_attr as $attr) |
@@ -271,13 +271,13 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
274 | - * Generate a default attribute list for a forum |
|
275 | - * |
|
276 | - * @param int $forum_id Forum id |
|
277 | - * @param int $attribute_id Current attribute id |
|
278 | - * |
|
279 | - * @return null |
|
280 | - */ |
|
274 | + * Generate a default attribute list for a forum |
|
275 | + * |
|
276 | + * @param int $forum_id Forum id |
|
277 | + * @param int $attribute_id Current attribute id |
|
278 | + * |
|
279 | + * @return null |
|
280 | + */ |
|
281 | 281 | public function attr_default($forum_id = 0, $attribute_id = 0) |
282 | 282 | { |
283 | 283 | foreach ($this->_attr as $attr) |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
307 | - * Generate attribute for topic title |
|
308 | - * |
|
309 | - * @param int $attribute_id Current attribute id |
|
310 | - * @param int $user_id Current attribute user id |
|
311 | - * @param int $timestamp Attribute timestamp |
|
312 | - * |
|
313 | - * @return string Attribute html code |
|
314 | - */ |
|
307 | + * Generate attribute for topic title |
|
308 | + * |
|
309 | + * @param int $attribute_id Current attribute id |
|
310 | + * @param int $user_id Current attribute user id |
|
311 | + * @param int $timestamp Attribute timestamp |
|
312 | + * |
|
313 | + * @return string Attribute html code |
|
314 | + */ |
|
315 | 315 | public function attr_display($attribute_id = 0, $user_id = 0, $timestamp = 0) |
316 | 316 | { |
317 | 317 | if (empty($attribute_id) || empty($user_id) || empty($timestamp)) |
@@ -341,14 +341,14 @@ discard block |
||
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
344 | - * Generate attribute for page title |
|
345 | - * |
|
346 | - * @param int $attribute_id Current attribute id |
|
347 | - * @param int $user_id Current attribute user id |
|
348 | - * @param int $timestamp Attribute timestamp |
|
349 | - * |
|
350 | - * @return string attribute html code |
|
351 | - */ |
|
344 | + * Generate attribute for page title |
|
345 | + * |
|
346 | + * @param int $attribute_id Current attribute id |
|
347 | + * @param int $user_id Current attribute user id |
|
348 | + * @param int $timestamp Attribute timestamp |
|
349 | + * |
|
350 | + * @return string attribute html code |
|
351 | + */ |
|
352 | 352 | public function attr_title($attribute_id = 0, $user_id = 0, $timestamp = 0) |
353 | 353 | { |
354 | 354 | if (empty($attribute_id) || empty($user_id) || empty($timestamp)) |
@@ -375,17 +375,17 @@ discard block |
||
375 | 375 | |
376 | 376 | |
377 | 377 | /** |
378 | - * Change topic attribute |
|
379 | - * |
|
380 | - * @param int $attribute_id New attribute id |
|
381 | - * @param int $topic_id The id of the topic |
|
382 | - * @param int $forum_id The id of the forum |
|
383 | - * @param int $topic_attribute Current attribute id |
|
384 | - * @param int $author_id Topic author id |
|
385 | - * @param string $viewtopic_url URL to the topic page |
|
386 | - * |
|
387 | - * @return null |
|
388 | - */ |
|
378 | + * Change topic attribute |
|
379 | + * |
|
380 | + * @param int $attribute_id New attribute id |
|
381 | + * @param int $topic_id The id of the topic |
|
382 | + * @param int $forum_id The id of the forum |
|
383 | + * @param int $topic_attribute Current attribute id |
|
384 | + * @param int $author_id Topic author id |
|
385 | + * @param string $viewtopic_url URL to the topic page |
|
386 | + * |
|
387 | + * @return null |
|
388 | + */ |
|
389 | 389 | public function attr_apply($attribute_id = 0, $topic_id = 0, $forum_id = 0, $topic_attribute = 0, $author_id = 0, $viewtopic_url = '') |
390 | 390 | { |
391 | 391 | if (empty($topic_id) || empty($forum_id) || empty($attribute_id)) |
@@ -458,14 +458,14 @@ discard block |
||
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
461 | - * Change topic attribute in mcp |
|
462 | - * |
|
463 | - * @param int $attribute_id New attribute id |
|
464 | - * @param int $forum_id The id of the forum |
|
465 | - * @param array $topic_ids Topics ids |
|
466 | - * |
|
467 | - * @return null |
|
468 | - */ |
|
461 | + * Change topic attribute in mcp |
|
462 | + * |
|
463 | + * @param int $attribute_id New attribute id |
|
464 | + * @param int $forum_id The id of the forum |
|
465 | + * @param array $topic_ids Topics ids |
|
466 | + * |
|
467 | + * @return null |
|
468 | + */ |
|
469 | 469 | public function mcp_attr_apply($attribute_id = 0, $forum_id = 0, $topic_ids = array()) |
470 | 470 | { |
471 | 471 | $can_edit = $this->auth->acl_get('m_qte_attr_edit', $forum_id); |
@@ -551,10 +551,10 @@ discard block |
||
551 | 551 | } |
552 | 552 | |
553 | 553 | /** |
554 | - * Getter... |
|
555 | - * |
|
556 | - * @return array |
|
557 | - */ |
|
554 | + * Getter... |
|
555 | + * |
|
556 | + * @return array |
|
557 | + */ |
|
558 | 558 | public function getAttr() |
559 | 559 | { |
560 | 560 | return $this->_attr; |
@@ -567,12 +567,12 @@ discard block |
||
567 | 567 | } |
568 | 568 | |
569 | 569 | /** |
570 | - * Build class and style attribute |
|
571 | - * |
|
572 | - * @param string $a_name Attribute name |
|
573 | - * @param string $a_colour Attribute color |
|
574 | - * @return string html code |
|
575 | - */ |
|
570 | + * Build class and style attribute |
|
571 | + * |
|
572 | + * @param string $a_name Attribute name |
|
573 | + * @param string $a_colour Attribute color |
|
574 | + * @return string html code |
|
575 | + */ |
|
576 | 576 | public function attr_colour($a_name, $a_colour) |
577 | 577 | { |
578 | 578 | if ($a_name != $this->user->lang($a_name)) |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | } |
585 | 585 | |
586 | 586 | /** |
587 | - * Get attributes from database |
|
588 | - * |
|
589 | - * @return null |
|
590 | - */ |
|
587 | + * Get attributes from database |
|
588 | + * |
|
589 | + * @return null |
|
590 | + */ |
|
591 | 591 | private function _get_attributes() |
592 | 592 | { |
593 | 593 | if (($this->_attr = $this->cache->get('_attr')) === false) |
@@ -69,16 +69,16 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | /** |
@@ -52,7 +52,7 @@ |
||
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 | } |
@@ -33,9 +33,9 @@ discard block |
||
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 |
||
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 |
||
139 | 139 | |
140 | 140 | if ($event['post_data']['force_attr']) |
141 | 141 | { |
142 | - if ((!$post_data['attr_id'] || $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'] || $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; |
@@ -11,14 +11,14 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // ignore |
14 | -if (!defined('IN_PHPBB')) |
|
15 | -{ |
|
14 | +if (!defined('IN_PHPBB')) |
|
15 | +{ |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | 19 | // init lang ary, if it doesn't ! |
20 | -if (empty($lang) || !is_array($lang)) |
|
21 | -{ |
|
20 | +if (empty($lang) || !is_array($lang)) |
|
21 | +{ |
|
22 | 22 | $lang = array(); |
23 | 23 | } |
24 | 24 |