@@ -403,6 +403,9 @@ discard block |
||
| 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; |
@@ -529,8 +532,8 @@ discard block |
||
| 529 | 532 | * |
| 530 | 533 | * Copy a permission (auth) option |
| 531 | 534 | * |
| 532 | - * @param string $auth_optio The name of the permission (auth) option |
|
| 533 | - * @param int|false $copy_from If set, contains the id of the permission from which to copy the new one. |
|
| 535 | + * @param string $auth_option The name of the permission (auth) option |
|
| 536 | + * @param string $copy_from If set, contains the id of the permission from which to copy the new one. |
|
| 534 | 537 | * @param bool $clear_dest_perms True if destination permissions should be deleted |
| 535 | 538 | * @return null |
| 536 | 539 | */ |
@@ -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_optio The name of the permission (auth) option |
|
| 533 | - * @param int|false $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_optio The name of the permission (auth) option |
|
| 533 | + * @param int|false $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 = false, $clear_dest_perms = true) |
| 538 | 538 | { |
| 539 | 539 | global $db, $phpbb_root_path, $phpEx; |
@@ -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); |
|
| 159 | + $this->migrator_tool_permission->add('f_qte_attr_' . $attr_id); |
|
| 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; |
@@ -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 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | while ($row = $this->db->sql_fetchrow($result)) |
| 83 | 83 | { |
| 84 | 84 | $permissions += array( |
| 85 | - 'f_qte_attr_'.$row['attr_id'] => array('lang' => $this->user->lang('QTE_CAN_USE_ATTR', $row['attr_name']), 'cat' => 'qte'), |
|
| 85 | + 'f_qte_attr_' . $row['attr_id'] => array('lang' => $this->user->lang('QTE_CAN_USE_ATTR', $row['attr_name']), 'cat' => 'qte'), |
|
| 86 | 86 | ); |
| 87 | 87 | } |
| 88 | 88 | $event['permissions'] = $permissions; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $dest_forum_ids = array(); |
| 230 | 230 | while ($row = $this->db->sql_fetchrow($result)) |
| 231 | 231 | { |
| 232 | - $dest_forum_ids[] = (int) $row['forum_id']; |
|
| 232 | + $dest_forum_ids[] = (int) $row['forum_id']; |
|
| 233 | 233 | } |
| 234 | 234 | $this->db->sql_freeresult($result); |
| 235 | 235 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $acl_options_ids = array(); |
| 248 | 248 | while ($row = $this->db->sql_fetchrow($result)) |
| 249 | 249 | { |
| 250 | - $acl_options_ids[] = (int) $row['auth_option_id']; |
|
| 250 | + $acl_options_ids[] = (int) $row['auth_option_id']; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // 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 | { |
@@ -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 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | if ($topic_attribute != \ernadoo\qte\qte::KEEP) |
| 121 | 121 | { |
| 122 | - $post_data['topic_attr_id'] = (int) $topic_attribute; |
|
| 122 | + $post_data['topic_attr_id'] = (int) $topic_attribute; |
|
| 123 | 123 | $post_data['topic_attr_user'] = (int) $this->user->data['user_id']; |
| 124 | 124 | $post_data['topic_attr_time'] = time(); |
| 125 | 125 | |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | if ($event['post_data']['force_attr']) |
| 144 | 144 | { |
| 145 | - 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'])) ) |
|
| 145 | + 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']))) |
|
| 146 | 146 | { |
| 147 | 147 | $error = $event['error']; |
| 148 | 148 | $error[] = $this->user->lang['QTE_ATTRIBUTE_UNSELECTED']; |
| 149 | - $event['error'] = $error ; |
|
| 149 | + $event['error'] = $error; |
|
| 150 | 150 | |
| 151 | 151 | // init the value |
| 152 | 152 | $post_data['attr_id'] = 0; |
@@ -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() |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function mcp_select_assign_attributes($event) |
| 58 | 58 | { |
| 59 | - $attr_id = (int) $this->request->variable('attr_id', 0); |
|
| 60 | - $forum_id = (int) $event['forum_info']['forum_id']; |
|
| 59 | + $attr_id = (int) $this->request->variable('attr_id', 0); |
|
| 60 | + $forum_id = (int) $event['forum_info']['forum_id']; |
|
| 61 | 61 | |
| 62 | 62 | if ($attr_id) |
| 63 | 63 | { |
@@ -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,15 +156,15 @@ 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 | - * |
|
| 166 | - * @return null |
|
| 167 | - */ |
|
| 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 | + * |
|
| 166 | + * @return null |
|
| 167 | + */ |
|
| 168 | 168 | public function attr_select($forum_id, $author_id = 0, $attribute_id = 0, $viewtopic_url = '') |
| 169 | 169 | { |
| 170 | 170 | $show_select = false; |
@@ -217,10 +217,10 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
| 220 | - * Generate a list of all attributes for search page |
|
| 221 | - * |
|
| 222 | - * @return null |
|
| 223 | - */ |
|
| 220 | + * Generate a list of all attributes for search page |
|
| 221 | + * |
|
| 222 | + * @return null |
|
| 223 | + */ |
|
| 224 | 224 | public function attr_search() |
| 225 | 225 | { |
| 226 | 226 | foreach ($this->_attr as $attr) |
@@ -240,13 +240,13 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | - * Generate a list of attributes for viewforum page |
|
| 244 | - * |
|
| 245 | - * @param int $forum_id Forum id |
|
| 246 | - * @param int $attribute_id Current attribute id |
|
| 247 | - * |
|
| 248 | - * @return null |
|
| 249 | - */ |
|
| 243 | + * Generate a list of attributes for viewforum page |
|
| 244 | + * |
|
| 245 | + * @param int $forum_id Forum id |
|
| 246 | + * @param int $attribute_id Current attribute id |
|
| 247 | + * |
|
| 248 | + * @return null |
|
| 249 | + */ |
|
| 250 | 250 | public function attr_sort($forum_id = 0, $attribute_id = 0) |
| 251 | 251 | { |
| 252 | 252 | foreach ($this->_attr as $attr) |
@@ -268,13 +268,13 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | - * Generate a default attribute list for a forum |
|
| 272 | - * |
|
| 273 | - * @param int $forum_id Forum id |
|
| 274 | - * @param int $attribute_id Current attribute id |
|
| 275 | - * |
|
| 276 | - * @return null |
|
| 277 | - */ |
|
| 271 | + * Generate a default attribute list for a forum |
|
| 272 | + * |
|
| 273 | + * @param int $forum_id Forum id |
|
| 274 | + * @param int $attribute_id Current attribute id |
|
| 275 | + * |
|
| 276 | + * @return null |
|
| 277 | + */ |
|
| 278 | 278 | public function attr_default($forum_id = 0, $attribute_id = 0) |
| 279 | 279 | { |
| 280 | 280 | foreach ($this->_attr as $attr) |
@@ -301,14 +301,14 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
| 304 | - * Generate attribute for topic title |
|
| 305 | - * |
|
| 306 | - * @param int $attribute_id Current attribute id |
|
| 307 | - * @param int $user_id Current attribute user id |
|
| 308 | - * @param int $timestamp Attribute timestamp |
|
| 309 | - * |
|
| 310 | - * @return string Attribute html code |
|
| 311 | - */ |
|
| 304 | + * Generate attribute for topic title |
|
| 305 | + * |
|
| 306 | + * @param int $attribute_id Current attribute id |
|
| 307 | + * @param int $user_id Current attribute user id |
|
| 308 | + * @param int $timestamp Attribute timestamp |
|
| 309 | + * |
|
| 310 | + * @return string Attribute html code |
|
| 311 | + */ |
|
| 312 | 312 | public function attr_display($attribute_id = 0, $user_id = 0, $timestamp = 0) |
| 313 | 313 | { |
| 314 | 314 | if (empty($attribute_id) || empty($user_id) || empty($timestamp)) |
@@ -338,14 +338,14 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
| 341 | - * Generate attribute for page title |
|
| 342 | - * |
|
| 343 | - * @param int $attribute_id Current attribute id |
|
| 344 | - * @param int $user_id Current attribute user id |
|
| 345 | - * @param int $timestamp Attribute timestamp |
|
| 346 | - * |
|
| 347 | - * @return string attribute html code |
|
| 348 | - */ |
|
| 341 | + * Generate attribute for page title |
|
| 342 | + * |
|
| 343 | + * @param int $attribute_id Current attribute id |
|
| 344 | + * @param int $user_id Current attribute user id |
|
| 345 | + * @param int $timestamp Attribute timestamp |
|
| 346 | + * |
|
| 347 | + * @return string attribute html code |
|
| 348 | + */ |
|
| 349 | 349 | public function attr_title($attribute_id = 0, $user_id = 0, $timestamp = 0) |
| 350 | 350 | { |
| 351 | 351 | if (empty($attribute_id) || empty($user_id) || empty($timestamp)) |
@@ -372,17 +372,17 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | |
| 374 | 374 | /** |
| 375 | - * Change topic attribute |
|
| 376 | - * |
|
| 377 | - * @param int $attribute_id New attribute id |
|
| 378 | - * @param int $topic_id The id of the topic |
|
| 379 | - * @param int $forum_id The id of the forum |
|
| 380 | - * @param int $topic_attribute Current attribute id |
|
| 381 | - * @param int $author_id Topic author id |
|
| 382 | - * @param string $viewtopic_url URL to the topic page |
|
| 383 | - * |
|
| 384 | - * @return null |
|
| 385 | - */ |
|
| 375 | + * Change topic attribute |
|
| 376 | + * |
|
| 377 | + * @param int $attribute_id New attribute id |
|
| 378 | + * @param int $topic_id The id of the topic |
|
| 379 | + * @param int $forum_id The id of the forum |
|
| 380 | + * @param int $topic_attribute Current attribute id |
|
| 381 | + * @param int $author_id Topic author id |
|
| 382 | + * @param string $viewtopic_url URL to the topic page |
|
| 383 | + * |
|
| 384 | + * @return null |
|
| 385 | + */ |
|
| 386 | 386 | public function attr_apply($attribute_id = 0, $topic_id = 0, $forum_id = 0, $topic_attribute = 0, $author_id = 0, $viewtopic_url = '') |
| 387 | 387 | { |
| 388 | 388 | if (empty($topic_id) || empty($forum_id) || empty($attribute_id)) |
@@ -456,14 +456,14 @@ discard block |
||
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | /** |
| 459 | - * Change topic attribute in mcp |
|
| 460 | - * |
|
| 461 | - * @param int $attribute_id New attribute id |
|
| 462 | - * @param int $forum_id The id of the forum |
|
| 463 | - * @param array $topic_ids Topics ids |
|
| 464 | - * |
|
| 465 | - * @return null |
|
| 466 | - */ |
|
| 459 | + * Change topic attribute in mcp |
|
| 460 | + * |
|
| 461 | + * @param int $attribute_id New attribute id |
|
| 462 | + * @param int $forum_id The id of the forum |
|
| 463 | + * @param array $topic_ids Topics ids |
|
| 464 | + * |
|
| 465 | + * @return null |
|
| 466 | + */ |
|
| 467 | 467 | public function mcp_attr_apply($attribute_id = 0, $forum_id = 0, $topic_ids = array()) |
| 468 | 468 | { |
| 469 | 469 | $can_edit = $this->auth->acl_get('m_qte_attr_edit', $forum_id); |
@@ -549,10 +549,10 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | /** |
| 552 | - * Getter... |
|
| 553 | - * |
|
| 554 | - * @return array |
|
| 555 | - */ |
|
| 552 | + * Getter... |
|
| 553 | + * |
|
| 554 | + * @return array |
|
| 555 | + */ |
|
| 556 | 556 | public function getAttr() |
| 557 | 557 | { |
| 558 | 558 | return $this->_attr; |
@@ -565,12 +565,12 @@ discard block |
||
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | /** |
| 568 | - * Build class and style attribute |
|
| 569 | - * |
|
| 570 | - * @param string $a_name Attribute name |
|
| 571 | - * @param string $a_colour Attribute color |
|
| 572 | - * @return string html code |
|
| 573 | - */ |
|
| 568 | + * Build class and style attribute |
|
| 569 | + * |
|
| 570 | + * @param string $a_name Attribute name |
|
| 571 | + * @param string $a_colour Attribute color |
|
| 572 | + * @return string html code |
|
| 573 | + */ |
|
| 574 | 574 | public function attr_colour($a_name, $a_colour) |
| 575 | 575 | { |
| 576 | 576 | if ($a_name != $this->user->lang($a_name)) |
@@ -582,10 +582,10 @@ discard block |
||
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /** |
| 585 | - * Get attributes from database |
|
| 586 | - * |
|
| 587 | - * @return null |
|
| 588 | - */ |
|
| 585 | + * Get attributes from database |
|
| 586 | + * |
|
| 587 | + * @return null |
|
| 588 | + */ |
|
| 589 | 589 | private function _get_attributes() |
| 590 | 590 | { |
| 591 | 591 | 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(); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | AND t.topic_attr_user <> ' . ANONYMOUS; |
| 104 | 104 | $result = $this->db->sql_query($sql); |
| 105 | 105 | |
| 106 | - while($row = $this->db->sql_fetchrow($result)) |
|
| 106 | + while ($row = $this->db->sql_fetchrow($result)) |
|
| 107 | 107 | { |
| 108 | 108 | $this->_name[$row['user_id']] = array( |
| 109 | 109 | 'user_id' => (int) $row['user_id'], |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | WHERE user_id = ' . (int) $user_id; |
| 144 | 144 | $result = $this->db->sql_query($sql); |
| 145 | 145 | |
| 146 | - while($row = $this->db->sql_fetchrow($result) ) |
|
| 146 | + while ($row = $this->db->sql_fetchrow($result)) |
|
| 147 | 147 | { |
| 148 | 148 | $this->_name[$row['user_id']] = array( |
| 149 | 149 | 'user_id' => (int) $row['user_id'], |
@@ -168,10 +168,10 @@ discard block |
||
| 168 | 168 | public function attr_select($forum_id, $author_id = 0, $attribute_id = 0, $viewtopic_url = '') |
| 169 | 169 | { |
| 170 | 170 | $show_select = false; |
| 171 | - $current_time = time(); |
|
| 172 | - $can_edit = $this->auth->acl_get('m_qte_attr_edit', $forum_id); |
|
| 171 | + $current_time = time(); |
|
| 172 | + $can_edit = $this->auth->acl_get('m_qte_attr_edit', $forum_id); |
|
| 173 | 173 | $can_remove = $this->auth->acl_get('m_qte_attr_del', $forum_id); |
| 174 | - $is_author = $this->user->data['is_registered'] && $this->user->data['user_id'] == $author_id; |
|
| 174 | + $is_author = $this->user->data['is_registered'] && $this->user->data['user_id'] == $author_id; |
|
| 175 | 175 | |
| 176 | 176 | // Basic auth |
| 177 | 177 | if (!$can_remove && !$can_edit && !$is_author) |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | foreach ($this->_attr as $attr) |
| 183 | 183 | { |
| 184 | - if (!$this->auth->acl_get('f_qte_attr_'.$attr['attr_id'], $forum_id)) |
|
| 184 | + if (!$this->auth->acl_get('f_qte_attr_' . $attr['attr_id'], $forum_id)) |
|
| 185 | 185 | { |
| 186 | 186 | continue; |
| 187 | 187 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | { |
| 280 | 280 | foreach ($this->_attr as $attr) |
| 281 | 281 | { |
| 282 | - $forum_allowed = $this->auth->acl_getf('f_qte_attr_'.$attr['attr_id'], true); |
|
| 282 | + $forum_allowed = $this->auth->acl_getf('f_qte_attr_' . $attr['attr_id'], true); |
|
| 283 | 283 | |
| 284 | 284 | if (isset($forum_allowed[$forum_id])) |
| 285 | 285 | { |
@@ -390,8 +390,8 @@ discard block |
||
| 390 | 390 | return; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - $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; |
|
| 394 | - $can_remove = $this->auth->acl_get('m_qte_attr_del', $forum_id); |
|
| 393 | + $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; |
|
| 394 | + $can_remove = $this->auth->acl_get('m_qte_attr_del', $forum_id); |
|
| 395 | 395 | |
| 396 | 396 | if (!$can_edit && $attribute_id != self::REMOVE || !$can_remove && $attribute_id == self::REMOVE) |
| 397 | 397 | { |
@@ -466,8 +466,8 @@ discard block |
||
| 466 | 466 | */ |
| 467 | 467 | public function mcp_attr_apply($attribute_id = 0, $forum_id = 0, $topic_ids = array()) |
| 468 | 468 | { |
| 469 | - $can_edit = $this->auth->acl_get('m_qte_attr_edit', $forum_id); |
|
| 470 | - $can_remove = $this->auth->acl_get('m_qte_attr_del', $forum_id); |
|
| 469 | + $can_edit = $this->auth->acl_get('m_qte_attr_edit', $forum_id); |
|
| 470 | + $can_remove = $this->auth->acl_get('m_qte_attr_del', $forum_id); |
|
| 471 | 471 | |
| 472 | 472 | if (!$can_edit && $attribute_id != self::REMOVE || !$can_remove && $attribute_id == self::REMOVE) |
| 473 | 473 | { |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | $a_class_name = preg_replace('#[^a-z0-9 _-]#', '', strtolower($a_name)); |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - return ' class="qte-attr ' . (isset($a_class_name) ? $a_class_name : '') . '"' . (!empty($a_colour) ? ' style="color:#' . $a_colour . '; font-weight:bold;"' : ''); |
|
| 581 | + return ' class="qte-attr ' . (isset($a_class_name) ? $a_class_name : '') . '"' . (!empty($a_colour) ? ' style="color:#' . $a_colour . '; font-weight:bold;"' : ''); |
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /** |