@@ -462,6 +462,9 @@ |
||
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | + /** |
|
| 466 | + * @return string |
|
| 467 | + */ |
|
| 465 | 468 | protected function qte_move($attr_row, $action = 'move_up', $steps = 1) |
| 466 | 469 | { |
| 467 | 470 | global $db, $table_prefix; |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function __construct(\phpbb\request\request $request, \phpbb\cache\driver\driver_interface $cache, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\log\log $log, $root_path, $php_ext, $table_prefix) |
| 71 | 71 | { |
| 72 | - $this->request = $request; |
|
| 73 | - $this->cache = $cache; |
|
| 74 | - $this->config = $config; |
|
| 75 | - $this->db = $db; |
|
| 76 | - $this->template = $template; |
|
| 77 | - $this->user = $user; |
|
| 78 | - $this->log = $log; |
|
| 79 | - |
|
| 80 | - $this->root_path = $root_path; |
|
| 81 | - $this->php_ext = $php_ext; |
|
| 72 | + $this->request = $request; |
|
| 73 | + $this->cache = $cache; |
|
| 74 | + $this->config = $config; |
|
| 75 | + $this->db = $db; |
|
| 76 | + $this->template = $template; |
|
| 77 | + $this->user = $user; |
|
| 78 | + $this->log = $log; |
|
| 79 | + |
|
| 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(); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $result = $this->db->sql_query($sql); |
| 142 | 142 | |
| 143 | 143 | $this->_name = array(); |
| 144 | - while ( $row = $this->db->sql_fetchrow($result) ) |
|
| 144 | + while ($row = $this->db->sql_fetchrow($result)) |
|
| 145 | 145 | { |
| 146 | 146 | $this->_name[$row['user_id']] = array( |
| 147 | 147 | 'user_id' => (int) $row['user_id'], |
@@ -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\config\config $config Config object |
|
| 62 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 63 | - * @param \phpbb\template\template $template Template object |
|
| 64 | - * @param \phpbb\user $user User object |
|
| 65 | - * @param \phpbb\log\log $log Log 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\config\config $config Config object |
|
| 62 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 63 | + * @param \phpbb\template\template $template Template object |
|
| 64 | + * @param \phpbb\user $user User object |
|
| 65 | + * @param \phpbb\log\log $log Log 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\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\log\log $log, $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 | $sql = 'SELECT user_id, username, user_colour |
@@ -154,16 +154,16 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | - * Generate a list of attributes based on permissions |
|
| 158 | - * |
|
| 159 | - * @param int $forum_id Forum id |
|
| 160 | - * @param int $author_id Topic author id |
|
| 161 | - * @param int $attribute_id Current attribute id |
|
| 162 | - * @param array $hide_attr Groups which can't delete attribute in this forum |
|
| 163 | - * @param string $viewtopic_url Topic's url |
|
| 164 | - * |
|
| 165 | - * @return null |
|
| 166 | - */ |
|
| 157 | + * Generate a list of attributes based on permissions |
|
| 158 | + * |
|
| 159 | + * @param int $forum_id Forum id |
|
| 160 | + * @param int $author_id Topic author id |
|
| 161 | + * @param int $attribute_id Current attribute id |
|
| 162 | + * @param array $hide_attr Groups which can't delete attribute in this forum |
|
| 163 | + * @param string $viewtopic_url Topic's url |
|
| 164 | + * |
|
| 165 | + * @return null |
|
| 166 | + */ |
|
| 167 | 167 | public function attr_select($forum_id = 0, $author_id = 0, $attribute_id = 0, $hide_attr = array(), $viewtopic_url = '') |
| 168 | 168 | { |
| 169 | 169 | // get current time once ! |
@@ -231,10 +231,10 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
| 234 | - * Generate a list of all attributes for search page |
|
| 235 | - * |
|
| 236 | - * @return null |
|
| 237 | - */ |
|
| 234 | + * Generate a list of all attributes for search page |
|
| 235 | + * |
|
| 236 | + * @return null |
|
| 237 | + */ |
|
| 238 | 238 | public function attr_search() |
| 239 | 239 | { |
| 240 | 240 | $show_select = false; |
@@ -281,13 +281,13 @@ discard block |
||
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
| 284 | - * Generate a list of attributes for viewforum page |
|
| 285 | - * |
|
| 286 | - * @param int $forum_id Forum id |
|
| 287 | - * @param int $attribute_id Current attribute id |
|
| 288 | - * |
|
| 289 | - * @return null |
|
| 290 | - */ |
|
| 284 | + * Generate a list of attributes for viewforum page |
|
| 285 | + * |
|
| 286 | + * @param int $forum_id Forum id |
|
| 287 | + * @param int $attribute_id Current attribute id |
|
| 288 | + * |
|
| 289 | + * @return null |
|
| 290 | + */ |
|
| 291 | 291 | public function attr_sort($forum_id = 0, $attribute_id = 0) |
| 292 | 292 | { |
| 293 | 293 | $show_select = false; |
@@ -341,13 +341,13 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
| 344 | - * Generate a default attribute list for a forum |
|
| 345 | - * |
|
| 346 | - * @param int $forum_id Forum id |
|
| 347 | - * @param int $attribute_id Current attribute id |
|
| 348 | - * |
|
| 349 | - * @return null |
|
| 350 | - */ |
|
| 344 | + * Generate a default attribute list for a forum |
|
| 345 | + * |
|
| 346 | + * @param int $forum_id Forum id |
|
| 347 | + * @param int $attribute_id Current attribute id |
|
| 348 | + * |
|
| 349 | + * @return null |
|
| 350 | + */ |
|
| 351 | 351 | public function attr_default($forum_id = 0, $attribute_id = 0) |
| 352 | 352 | { |
| 353 | 353 | $show_select = false; |
@@ -401,14 +401,14 @@ discard block |
||
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | /** |
| 404 | - * Generate attribute for topic title |
|
| 405 | - * |
|
| 406 | - * @param int $attribute_id Current attribute id |
|
| 407 | - * @param int $user_id Current attribute user id |
|
| 408 | - * @param int $timestamp Attribute timestamp |
|
| 409 | - * |
|
| 410 | - * @return string Attribute html code |
|
| 411 | - */ |
|
| 404 | + * Generate attribute for topic title |
|
| 405 | + * |
|
| 406 | + * @param int $attribute_id Current attribute id |
|
| 407 | + * @param int $user_id Current attribute user id |
|
| 408 | + * @param int $timestamp Attribute timestamp |
|
| 409 | + * |
|
| 410 | + * @return string Attribute html code |
|
| 411 | + */ |
|
| 412 | 412 | public function attr_display($attribute_id = 0, $user_id = 0, $timestamp = 0) |
| 413 | 413 | { |
| 414 | 414 | if (empty($attribute_id) || empty($user_id) || empty($timestamp)) |
@@ -438,14 +438,14 @@ discard block |
||
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | /** |
| 441 | - * Generate attribute for page title |
|
| 442 | - * |
|
| 443 | - * @param int $attribute_id Current attribute id |
|
| 444 | - * @param int $user_id Current attribute user id |
|
| 445 | - * @param int $timestamp Attribute timestamp |
|
| 446 | - * |
|
| 447 | - * @return string attribute html code |
|
| 448 | - */ |
|
| 441 | + * Generate attribute for page title |
|
| 442 | + * |
|
| 443 | + * @param int $attribute_id Current attribute id |
|
| 444 | + * @param int $user_id Current attribute user id |
|
| 445 | + * @param int $timestamp Attribute timestamp |
|
| 446 | + * |
|
| 447 | + * @return string attribute html code |
|
| 448 | + */ |
|
| 449 | 449 | public function attr_title($attribute_id = 0, $user_id = 0, $timestamp = 0) |
| 450 | 450 | { |
| 451 | 451 | if (empty($attribute_id) || empty($user_id) || empty($timestamp)) |
@@ -474,16 +474,16 @@ discard block |
||
| 474 | 474 | |
| 475 | 475 | |
| 476 | 476 | /** |
| 477 | - * Change topic attribute |
|
| 478 | - * |
|
| 479 | - * @param int $attribute_id New attribute id |
|
| 480 | - * @param int $topic_id The id of the topic |
|
| 481 | - * @param int $forum_id The id of the forum |
|
| 482 | - * @param int $topic_attribute Current attribute id |
|
| 483 | - * @param array $hide_attr Groups which can't delete attribute in this forum |
|
| 484 | - * |
|
| 485 | - * @return null |
|
| 486 | - */ |
|
| 477 | + * Change topic attribute |
|
| 478 | + * |
|
| 479 | + * @param int $attribute_id New attribute id |
|
| 480 | + * @param int $topic_id The id of the topic |
|
| 481 | + * @param int $forum_id The id of the forum |
|
| 482 | + * @param int $topic_attribute Current attribute id |
|
| 483 | + * @param array $hide_attr Groups which can't delete attribute in this forum |
|
| 484 | + * |
|
| 485 | + * @return null |
|
| 486 | + */ |
|
| 487 | 487 | public function attr_apply($attribute_id = 0, $topic_id = 0, $forum_id = 0, $topic_attribute = 0, $hide_attr = array()) |
| 488 | 488 | { |
| 489 | 489 | if (empty($topic_id) || empty($forum_id) || empty($attribute_id)) |
@@ -561,13 +561,13 @@ discard block |
||
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | /** |
| 564 | - * Change topic attribute in mcp |
|
| 565 | - * |
|
| 566 | - * @param int $attribute_id New attribute id |
|
| 567 | - * @param array $topic_ids Topics ids |
|
| 568 | - * |
|
| 569 | - * @return null |
|
| 570 | - */ |
|
| 564 | + * Change topic attribute in mcp |
|
| 565 | + * |
|
| 566 | + * @param int $attribute_id New attribute id |
|
| 567 | + * @param array $topic_ids Topics ids |
|
| 568 | + * |
|
| 569 | + * @return null |
|
| 570 | + */ |
|
| 571 | 571 | public function mcp_attr_apply($attribute_id = 0, $topic_ids = array()) |
| 572 | 572 | { |
| 573 | 573 | if (!sizeof($topic_ids)) |
@@ -652,24 +652,24 @@ discard block |
||
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | /** |
| 655 | - * Getter... |
|
| 656 | - * |
|
| 657 | - * @return array |
|
| 658 | - */ |
|
| 655 | + * Getter... |
|
| 656 | + * |
|
| 657 | + * @return array |
|
| 658 | + */ |
|
| 659 | 659 | public function getAttr() |
| 660 | 660 | { |
| 661 | 661 | return $this->_attr; |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | /** |
| 665 | - * Generate list of groups |
|
| 666 | - * |
|
| 667 | - * @param int $group_ids The default groups id to mark as selected |
|
| 668 | - * @param array|bool $exclude_ids The group ids to exclude from the list, false (default) if you whish to exclude no id |
|
| 669 | - * @param bool $manage_founder If set to false (default) all groups are returned, if 0 only those groups returned not being managed by founders only, if 1 only those groups returned managed by founders only. |
|
| 670 | - * |
|
| 671 | - * @return string The list of options. |
|
| 672 | - */ |
|
| 665 | + * Generate list of groups |
|
| 666 | + * |
|
| 667 | + * @param int $group_ids The default groups id to mark as selected |
|
| 668 | + * @param array|bool $exclude_ids The group ids to exclude from the list, false (default) if you whish to exclude no id |
|
| 669 | + * @param bool $manage_founder If set to false (default) all groups are returned, if 0 only those groups returned not being managed by founders only, if 1 only those groups returned managed by founders only. |
|
| 670 | + * |
|
| 671 | + * @return string The list of options. |
|
| 672 | + */ |
|
| 673 | 673 | public function qte_group_select($group_ids, $exclude_ids = array(), $manage_founder = false) |
| 674 | 674 | { |
| 675 | 675 | $exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE ' . $this->db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; |
@@ -702,12 +702,12 @@ discard block |
||
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | /** |
| 705 | - * Build class and style attribute |
|
| 706 | - * |
|
| 707 | - * @param string $a_name Attribute name |
|
| 708 | - * @param string $a_colour Attribute color |
|
| 709 | - * @return string html code |
|
| 710 | - */ |
|
| 705 | + * Build class and style attribute |
|
| 706 | + * |
|
| 707 | + * @param string $a_name Attribute name |
|
| 708 | + * @param string $a_colour Attribute color |
|
| 709 | + * @return string html code |
|
| 710 | + */ |
|
| 711 | 711 | public function attr_colour($a_name, $a_colour) |
| 712 | 712 | { |
| 713 | 713 | $a_name = preg_replace('#[^a-z0-9 _-]#', '', strtolower($a_name)); |
@@ -720,14 +720,14 @@ discard block |
||
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /** |
| 723 | - * Check if user can apply an attribute |
|
| 724 | - * |
|
| 725 | - * @param array $attr_auth Forum auth |
|
| 726 | - * @param int $forum_id Forum id |
|
| 727 | - * @param array $user_groups User's groups |
|
| 728 | - * @param int $author_id Topic author id |
|
| 729 | - * @return bool |
|
| 730 | - */ |
|
| 723 | + * Check if user can apply an attribute |
|
| 724 | + * |
|
| 725 | + * @param array $attr_auth Forum auth |
|
| 726 | + * @param int $forum_id Forum id |
|
| 727 | + * @param array $user_groups User's groups |
|
| 728 | + * @param int $author_id Topic author id |
|
| 729 | + * @return bool |
|
| 730 | + */ |
|
| 731 | 731 | private function _check_auth_attribute($attr_auth, $forum_id, $user_groups, $author_id) |
| 732 | 732 | { |
| 733 | 733 | $forum_ids = $attr_auth['forums_ids']; |
@@ -745,12 +745,12 @@ discard block |
||
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | /** |
| 748 | - * Check if user can delete an attribute |
|
| 749 | - * |
|
| 750 | - * @param array $user_groups User's groups |
|
| 751 | - * @param array $hide_attr Groups which can't delete attribute in a forum |
|
| 752 | - * @return bool |
|
| 753 | - */ |
|
| 748 | + * Check if user can delete an attribute |
|
| 749 | + * |
|
| 750 | + * @param array $user_groups User's groups |
|
| 751 | + * @param array $hide_attr Groups which can't delete attribute in a forum |
|
| 752 | + * @return bool |
|
| 753 | + */ |
|
| 754 | 754 | private function _check_auth_remove_attr(&$user_groups, $hide_attr) |
| 755 | 755 | { |
| 756 | 756 | // include that file ! |
@@ -776,10 +776,10 @@ discard block |
||
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | /** |
| 779 | - * Get attributes from database |
|
| 780 | - * |
|
| 781 | - * @return null |
|
| 782 | - */ |
|
| 779 | + * Get attributes from database |
|
| 780 | + * |
|
| 781 | + * @return null |
|
| 782 | + */ |
|
| 783 | 783 | private function _get_attributes() |
| 784 | 784 | { |
| 785 | 785 | if (($this->_attr = $this->cache->get('_attr')) === false) |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | public function viewtopic_attr_apply($event) |
| 95 | 95 | { |
| 96 | 96 | $attr_id = (int) $this->request->variable('attr_id', 0); |
| 97 | - if ( $attr_id ) |
|
| 97 | + if ($attr_id) |
|
| 98 | 98 | { |
| 99 | 99 | $this->qte->get_users_by_topic_id(array($event['topic_id'])); |
| 100 | 100 | $this->qte->attr_apply($attr_id, $event['topic_id'], $event['forum_id'], $event['topic_data']['topic_attr_id'], (array) unserialize(trim($event['topic_data']['hide_attr']))); |