@@ -94,7 +94,7 @@ discard block |
||
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']))); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $attr_name, |
205 | 205 | ); |
206 | 206 | |
207 | - $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'MCP_ATTRIBUTE_' . ($event['data']['attr_id'] == \ernadoo\qte\qte::REMOVE ? 'REMOVED' : 'UPDATED'), time(), $log_data); |
|
207 | + $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'MCP_ATTRIBUTE_'.($event['data']['attr_id'] == \ernadoo\qte\qte::REMOVE ? 'REMOVED' : 'UPDATED'), time(), $log_data); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | } |
@@ -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(); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | if (!empty($topic_list)) |
97 | 97 | { |
98 | 98 | $sql = 'SELECT u.user_id, u.username, u.user_colour |
99 | - FROM ' . USERS_TABLE . ' u |
|
100 | - LEFT JOIN ' . TOPICS_TABLE . ' t ON (u.user_id = t.topic_attr_user) |
|
101 | - WHERE ' . $this->db->sql_in_set('t.topic_id', array_map('intval', $topic_list)) . ' |
|
99 | + FROM ' . USERS_TABLE.' u |
|
100 | + LEFT JOIN ' . TOPICS_TABLE.' t ON (u.user_id = t.topic_attr_user) |
|
101 | + WHERE ' . $this->db->sql_in_set('t.topic_id', array_map('intval', $topic_list)).' |
|
102 | 102 | AND t.topic_attr_user <> ' . ANONYMOUS; |
103 | 103 | $result = $this->db->sql_query($sql); |
104 | 104 | |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | public function get_users_by_user_id($user_id) |
137 | 137 | { |
138 | 138 | $sql = 'SELECT user_id, username, user_colour |
139 | - FROM ' . USERS_TABLE . ' |
|
139 | + FROM ' . USERS_TABLE.' |
|
140 | 140 | WHERE user_id = ' . (int) $user_id; |
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'], |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | 'S_QTE_EMPTY' => (empty($attribute_id) || ($attribute_id == -1) || ($attribute_id == -2)), |
227 | 227 | 'S_QTE_SELECTED' => ($show_remove && ($attribute_id == -1)), |
228 | 228 | |
229 | - 'L_QTE_SELECT' => $this->user->lang['QTE_ATTRIBUTE_' . (!empty($attribute_id) ? ($show_remove ? 'REMOVE' : 'RESTRICT') : 'ADD')], |
|
229 | + 'L_QTE_SELECT' => $this->user->lang['QTE_ATTRIBUTE_'.(!empty($attribute_id) ? ($show_remove ? 'REMOVE' : 'RESTRICT') : 'ADD')], |
|
230 | 230 | 'U_QTE_URL' => !empty($viewtopic_url) ? append_sid($viewtopic_url, array('attr_id' => -1)) : false, |
231 | 231 | )); |
232 | 232 | } |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | |
445 | 445 | $attribute_name = str_replace(array('%mod%', '%date%'), array($attribute_username, $attribute_date), $this->attr_lng_key($this->_attr[$attribute_id]['attr_name'])); |
446 | 446 | |
447 | - return !$this->_attr[$attribute_id]['attr_type'] ? '<span' . $attribute_colour . '>' . $attribute_name . '</span>' : $this->attr_img_key($this->_attr[$attribute_id]['attr_img'], $attribute_name); |
|
447 | + return !$this->_attr[$attribute_id]['attr_type'] ? '<span'.$attribute_colour.'>'.$attribute_name.'</span>' : $this->attr_img_key($this->_attr[$attribute_id]['attr_img'], $attribute_name); |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
@@ -527,13 +527,13 @@ discard block |
||
527 | 527 | ); |
528 | 528 | } |
529 | 529 | |
530 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
531 | - SET ' . $this->db->sql_build_array('UPDATE', $fields) . ' |
|
530 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
531 | + SET ' . $this->db->sql_build_array('UPDATE', $fields).' |
|
532 | 532 | WHERE topic_id = ' . (int) $topic_id; |
533 | 533 | $this->db->sql_query($sql); |
534 | 534 | |
535 | 535 | $sql = 'SELECT topic_id |
536 | - FROM ' . TOPICS_TABLE . ' |
|
536 | + FROM ' . TOPICS_TABLE.' |
|
537 | 537 | WHERE topic_moved_id = ' . (int) $topic_id; |
538 | 538 | $result = $this->db->sql_query($sql); |
539 | 539 | $shadow_topic_id = (int) $this->db->sql_fetchfield('topic_id'); |
@@ -541,8 +541,8 @@ discard block |
||
541 | 541 | |
542 | 542 | if (!empty($shadow_topic_id)) |
543 | 543 | { |
544 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
545 | - SET ' . $this->db->sql_build_array('UPDATE', $fields) . ' |
|
544 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
545 | + SET ' . $this->db->sql_build_array('UPDATE', $fields).' |
|
546 | 546 | WHERE topic_id = ' . $shadow_topic_id; |
547 | 547 | $this->db->sql_query($sql); |
548 | 548 | } |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | $this->user->add_lang('posting'); |
555 | 555 | $this->user->add_lang_ext('ernadoo/qte', 'attributes'); |
556 | 556 | |
557 | - $message = $this->user->lang['QTE_ATTRIBUTE_' . ($attribute_id == -1 ? 'REMOVED' : (empty($topic_attribute) ? 'ADDED' : 'UPDATED'))] . '<br /><br />' . sprintf($this->user->lang['VIEW_MESSAGE'], '<a href="' . $meta_url . '">', '</a>'); |
|
558 | - $message .= '<br /><br />' . sprintf($this->user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$this->root_path}viewforum.$this->php_ext", 'f=' . $forum_id) . '">', '</a>'); |
|
557 | + $message = $this->user->lang['QTE_ATTRIBUTE_'.($attribute_id == -1 ? 'REMOVED' : (empty($topic_attribute) ? 'ADDED' : 'UPDATED'))].'<br /><br />'.sprintf($this->user->lang['VIEW_MESSAGE'], '<a href="'.$meta_url.'">', '</a>'); |
|
558 | + $message .= '<br /><br />'.sprintf($this->user->lang['RETURN_FORUM'], '<a href="'.append_sid("{$this->root_path}viewforum.$this->php_ext", 'f='.$forum_id).'">', '</a>'); |
|
559 | 559 | |
560 | 560 | if ($this->request->is_ajax()) |
561 | 561 | { |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | $current_time = time(); |
600 | 600 | |
601 | 601 | $sql = 'SELECT topic_id, forum_id, topic_title, topic_attr_id |
602 | - FROM ' . TOPICS_TABLE . ' |
|
602 | + FROM ' . TOPICS_TABLE.' |
|
603 | 603 | WHERE ' . $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids)); |
604 | 604 | $result = $this->db->sql_query($sql); |
605 | 605 | |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | 'topic_id' => $row['topic_id'], |
613 | 613 | $row['topic_title'], |
614 | 614 | ); |
615 | - $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'MCP_ATTRIBUTE_' . $message, $current_time, $additional_data); |
|
615 | + $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'MCP_ATTRIBUTE_'.$message, $current_time, $additional_data); |
|
616 | 616 | } |
617 | 617 | $this->db->sql_freeresult($result); |
618 | 618 | |
@@ -633,13 +633,13 @@ discard block |
||
633 | 633 | ); |
634 | 634 | } |
635 | 635 | |
636 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
637 | - SET ' . $this->db->sql_build_array('UPDATE', $fields) . ' |
|
636 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
637 | + SET ' . $this->db->sql_build_array('UPDATE', $fields).' |
|
638 | 638 | WHERE ' . $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids)); |
639 | 639 | $this->db->sql_query($sql); |
640 | 640 | |
641 | 641 | $sql = 'SELECT topic_id |
642 | - FROM ' . TOPICS_TABLE . ' |
|
642 | + FROM ' . TOPICS_TABLE.' |
|
643 | 643 | WHERE ' . $this->db->sql_in_set('topic_moved_id', array_map('intval', $topic_ids)); |
644 | 644 | $result = $this->db->sql_query($sql); |
645 | 645 | |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | |
653 | 653 | if (sizeof($shadow_topic_ids)) |
654 | 654 | { |
655 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
656 | - SET ' . $this->db->sql_build_array('UPDATE', $fields) . ' |
|
655 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
656 | + SET ' . $this->db->sql_build_array('UPDATE', $fields).' |
|
657 | 657 | WHERE ' . $this->db->sql_in_set('topic_id', array_map('intval', $shadow_topic_ids)); |
658 | 658 | $this->db->sql_query($sql); |
659 | 659 | } |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | $redirect = $this->request->variable('redirect', $this->user->data['session_page']); |
662 | 662 | |
663 | 663 | meta_refresh(3, $redirect); |
664 | - trigger_error($this->user->lang['QTE_TOPIC' . (sizeof($topic_ids) == 1 ? '' : 'S') . '_ATTRIBUTE_' . $message] . '<br /><br />' . sprintf($this->user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); |
|
664 | + trigger_error($this->user->lang['QTE_TOPIC'.(sizeof($topic_ids) == 1 ? '' : 'S').'_ATTRIBUTE_'.$message].'<br /><br />'.sprintf($this->user->lang['RETURN_PAGE'], '<a href="'.$redirect.'">', '</a>')); |
|
665 | 665 | |
666 | 666 | return; |
667 | 667 | } |
@@ -687,12 +687,12 @@ discard block |
||
687 | 687 | */ |
688 | 688 | public function qte_group_select($group_ids, $exclude_ids = array(), $manage_founder = false) |
689 | 689 | { |
690 | - $exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE ' . $this->db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; |
|
691 | - $sql_and = !$this->config['coppa_enable'] ? ($exclude_sql ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : ''; |
|
692 | - $sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ') . 'group_founder_manage = ' . (int) $manage_founder : ''; |
|
690 | + $exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE '.$this->db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; |
|
691 | + $sql_and = !$this->config['coppa_enable'] ? ($exclude_sql ? ' AND ' : ' WHERE ')."group_name <> 'REGISTERED_COPPA'" : ''; |
|
692 | + $sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ').'group_founder_manage = '.(int) $manage_founder : ''; |
|
693 | 693 | |
694 | 694 | $sql = 'SELECT group_id, group_name, group_type |
695 | - FROM ' . GROUPS_TABLE . " |
|
695 | + FROM ' . GROUPS_TABLE." |
|
696 | 696 | $exclude_sql |
697 | 697 | $sql_and |
698 | 698 | $sql_founder |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | while ($row = $this->db->sql_fetchrow($result)) |
704 | 704 | { |
705 | 705 | $selected = in_array($row['group_id'], $group_ids) ? ' selected="selected"' : ''; |
706 | - $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; |
|
706 | + $s_group_options .= '<option'.(($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '').' value="'.$row['group_id'].'"'.$selected.'>'.(($row['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_'.$row['group_name']] : $row['group_name']).'</option>'; |
|
707 | 707 | } |
708 | 708 | $this->db->sql_freeresult($result); |
709 | 709 | |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | // borrowed from "Categories Hierarchy" : used to check if a image key exists |
726 | 726 | public function attr_img_key($key, $alt) |
727 | 727 | { |
728 | - return empty($key) ? '' : (preg_match('#^[a-z0-9_-]+$#i', $key) ? $this->user->img($key, $alt) : '<img src="' . (preg_match('#^(ht|f)tp[s]?\://#i', $key) ? $key : $this->root_path . $key) . '" alt="' . $alt . '" title="' . $alt . '" />'); |
|
728 | + return empty($key) ? '' : (preg_match('#^[a-z0-9_-]+$#i', $key) ? $this->user->img($key, $alt) : '<img src="'.(preg_match('#^(ht|f)tp[s]?\://#i', $key) ? $key : $this->root_path.$key).'" alt="'.$alt.'" title="'.$alt.'" />'); |
|
729 | 729 | } |
730 | 730 | |
731 | 731 | /** |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | $a_name .= '-qte'; |
744 | 744 | } |
745 | 745 | |
746 | - return ' class="qte-attr ' . $a_name . '"' . (!empty($a_colour) ? ' style="color:#' . $a_colour . '; font-weight:bold;"' : ''); |
|
746 | + return ' class="qte-attr '.$a_name.'"'.(!empty($a_colour) ? ' style="color:#'.$a_colour.'; font-weight:bold;"' : ''); |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | /** |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | // include that file ! |
782 | 782 | if (!function_exists('group_memberships')) |
783 | 783 | { |
784 | - include $this->root_path . 'includes/functions_user.' . $this->php_ext; |
|
784 | + include $this->root_path.'includes/functions_user.'.$this->php_ext; |
|
785 | 785 | } |
786 | 786 | |
787 | 787 | // get groups membership ! |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | if (($this->_attr = $this->cache->get('_attr')) === false) |
814 | 814 | { |
815 | 815 | $sql = 'SELECT * |
816 | - FROM ' . $this->table_prefix . 'topics_attr |
|
816 | + FROM ' . $this->table_prefix.'topics_attr |
|
817 | 817 | ORDER BY left_id ASC'; |
818 | 818 | $result = $this->db->sql_query($sql); |
819 | 819 |