@@ -93,7 +93,6 @@ |
||
93 | 93 | * @param string $type |
94 | 94 | * @param string $slug |
95 | 95 | * @param int $topic_id |
96 | - * @param int $page |
|
97 | 96 | * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
98 | 97 | */ |
99 | 98 | public function show($type, $slug, $topic_id) |
@@ -46,7 +46,7 @@ |
||
46 | 46 | * @param \blitze\content\services\comments $comments Comments object |
47 | 47 | * @param \blitze\content\services\types $content_types Content types object |
48 | 48 | * @param \blitze\content\services\views\views_factory $views_factory Views handlers |
49 | - */ |
|
49 | + */ |
|
50 | 50 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\request\request_interface $request, \phpbb\template\template $template, \phpbb\user $user, \blitze\content\services\comments $comments, \blitze\content\services\types $content_types, \blitze\content\services\views\views_factory $views_factory) |
51 | 51 | { |
52 | 52 | $this->db = $db; |
@@ -156,15 +156,15 @@ |
||
156 | 156 | { |
157 | 157 | if (!$this->user->data['is_bot'] && !$this->request->is_set('page')) |
158 | 158 | { |
159 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
160 | - SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . " |
|
159 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
160 | + SET topic_views = topic_views + 1, topic_last_view_time = ' . time()." |
|
161 | 161 | WHERE topic_id = $topic_id"; |
162 | 162 | $this->db->sql_query($sql); |
163 | 163 | |
164 | 164 | // Update the attachment download counts |
165 | 165 | if (sizeof($update_count)) |
166 | 166 | { |
167 | - $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' |
|
167 | + $sql = 'UPDATE '.ATTACHMENTS_TABLE.' |
|
168 | 168 | SET download_count = download_count + 1 |
169 | 169 | WHERE ' . $this->db->sql_in_set('attach_id', array_unique($update_count)); |
170 | 170 | $this->db->sql_query($sql); |
@@ -155,7 +155,7 @@ |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
158 | - * @param $action |
|
158 | + * @param string $action |
|
159 | 159 | * @param array $topic_ids |
160 | 160 | */ |
161 | 161 | protected function change_topic_type($action, array $topic_ids) |
@@ -70,8 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | $forum_ids = $this->get_selected_forum_ids($topic_ids); |
72 | 72 | $this->{$action}($topic_ids, $forum_ids); |
73 | - } |
|
74 | - else |
|
73 | + } else |
|
75 | 74 | { |
76 | 75 | $message = $this->language->lang('INVALID_REQUEST', $action); |
77 | 76 | trigger_error($message . '<br /><br />' . $this->language->lang('RETURN_PAGE', '<a href="' . $u_action . '">', '</a>')); |
@@ -113,8 +112,7 @@ discard block |
||
113 | 112 | { |
114 | 113 | $this->approve($topic_ids, $forum_ids, false); |
115 | 114 | \mcp_queue::disapprove_posts($post_id_list, '-blitze-content-mcp-content_module', 'content'); |
116 | - } |
|
117 | - else |
|
115 | + } else |
|
118 | 116 | { |
119 | 117 | trigger_error('NO_POST_SELECTED'); |
120 | 118 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | } |
74 | 74 | else |
75 | 75 | { |
76 | - $message = $this->language->lang('INVALID_REQUEST', $action); |
|
77 | - trigger_error($message . '<br /><br />' . $this->language->lang('RETURN_PAGE', '<a href="' . $u_action . '">', '</a>')); |
|
76 | + $message = $this->language->lang('INVALID_REQUEST', $action); |
|
77 | + trigger_error($message.'<br /><br />'.$this->language->lang('RETURN_PAGE', '<a href="'.$u_action.'">', '</a>')); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | */ |
87 | 87 | protected function approve(array $topic_ids, array $forum_ids, $execute = true) |
88 | 88 | { |
89 | - include($this->phpbb_root_path . 'includes/mcp/mcp_queue.' . $this->php_ext); |
|
90 | - include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext); |
|
89 | + include($this->phpbb_root_path.'includes/mcp/mcp_queue.'.$this->php_ext); |
|
90 | + include($this->phpbb_root_path.'includes/functions_messenger.'.$this->php_ext); |
|
91 | 91 | |
92 | 92 | if (!(sizeof(array_intersect_key($forum_ids, $this->auth->acl_getf('m_approve', true))))) |
93 | 93 | { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | protected function resync(array $topic_ids) |
151 | 151 | { |
152 | - include($this->phpbb_root_path . 'includes/mcp/mcp_forum.' . $this->php_ext); |
|
152 | + include($this->phpbb_root_path.'includes/mcp/mcp_forum.'.$this->php_ext); |
|
153 | 153 | |
154 | 154 | mcp_resync_topics($topic_ids); |
155 | 155 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | $sql = 'SELECT forum_id |
232 | - FROM ' . TOPICS_TABLE . ' |
|
232 | + FROM ' . TOPICS_TABLE.' |
|
233 | 233 | WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids); |
234 | 234 | $result = $this->db->sql_query($sql); |
235 | 235 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | $sql = 'SELECT post_id |
260 | - FROM ' . POSTS_TABLE . ' |
|
260 | + FROM ' . POSTS_TABLE.' |
|
261 | 261 | WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids); |
262 | 262 | $result = $this->db->sql_query($sql); |
263 | 263 |
@@ -88,7 +88,7 @@ |
||
88 | 88 | * @param int $forum_id |
89 | 89 | * @param string $mode |
90 | 90 | * @param bool $save_draft |
91 | - * @return string|false |
|
91 | + * @return string|boolean |
|
92 | 92 | */ |
93 | 93 | public function init($forum_id, $mode, $save_draft) |
94 | 94 | { |
@@ -223,8 +223,7 @@ discard block |
||
223 | 223 | if (!$field_data['field_mod_only'] || $this->mode === 'mcp') |
224 | 224 | { |
225 | 225 | $this->form->add($field, $field_data['field_type'], $field_data, $topic_id); |
226 | - } |
|
227 | - else if (!empty($field_data['field_value'])) |
|
226 | + } else if (!empty($field_data['field_value'])) |
|
228 | 227 | { |
229 | 228 | $this->form->add($field, 'hidden', $field_data, $topic_id); |
230 | 229 | } |
@@ -271,8 +270,7 @@ discard block |
||
271 | 270 | { |
272 | 271 | $data['force_approved_state'] = $force_status; |
273 | 272 | } |
274 | - } |
|
275 | - else |
|
273 | + } else |
|
276 | 274 | { |
277 | 275 | if ($this->force_state()) |
278 | 276 | { |
@@ -122,7 +122,7 @@ |
||
122 | 122 | foreach ($fields_data as $field => $value) |
123 | 123 | { |
124 | 124 | $value = is_array($value) ? join("\n", $value) : $value; |
125 | - $message .= '[tag=' . $field . ']' . $value . '[/tag]'; |
|
125 | + $message .= '[tag='.$field.']'.$value.'[/tag]'; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | return $message; |
@@ -64,7 +64,6 @@ discard block |
||
64 | 64 | * @param \phpbb\user $user User object |
65 | 65 | * @param \blitze\content\services\form\form $form Form object |
66 | 66 | * @param \blitze\sitemaker\services\forum\data $forum Forum Data object |
67 | - * @param \blitze\content\services\topic $topic Content topic object |
|
68 | 67 | * @param string $root_path Path to the phpbb includes directory. |
69 | 68 | * @param string $php_ext php file extension |
70 | 69 | */ |
@@ -217,6 +216,11 @@ discard block |
||
217 | 216 | $this->template->assign_var('POST_FORM', $this->form->get_form()); |
218 | 217 | } |
219 | 218 | |
219 | + /** |
|
220 | + * @param integer $topic_id |
|
221 | + * @param integer $total_comments |
|
222 | + * @param string $base_url |
|
223 | + */ |
|
220 | 224 | protected function build_pagination(&$start, $forum_id, $topic_id, $post_id, $total_comments, $action, $base_url) |
221 | 225 | { |
222 | 226 | if ($post_id && !$action) |
@@ -67,7 +67,7 @@ |
||
67 | 67 | * @param \blitze\content\services\topic $topic Content topic object |
68 | 68 | * @param string $root_path Path to the phpbb includes directory. |
69 | 69 | * @param string $php_ext php file extension |
70 | - */ |
|
70 | + */ |
|
71 | 71 | public function __construct(\phpbb\auth\auth $auth, \phpbb\config\db $config, \phpbb\content_visibility $content_visibility, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\pagination $pagination, \phpbb\request\request_interface $request, \phpbb\template\template $template, \phpbb\user $user, \blitze\content\services\form\form $form, \blitze\sitemaker\services\forum\data $forum, $root_path, $php_ext) |
72 | 72 | { |
73 | 73 | $this->auth = $auth; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $this->build_pagination($start, $topic_data['forum_id'], $topic_id, $post_id, $total_comments, $action, $base_url); |
108 | 108 | |
109 | 109 | $posts_data = $this->forum->get_post_data(false, array(), $this->config['posts_per_page'], $start, array( |
110 | - 'WHERE' => 'p.post_id <> ' . (int) $topic_data['topic_first_post_id'], |
|
110 | + 'WHERE' => 'p.post_id <> '.(int) $topic_data['topic_first_post_id'], |
|
111 | 111 | )); |
112 | 112 | |
113 | 113 | $topic_tracking_info = $this->forum->get_topic_tracking_info(); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | if ($action == 'edit') |
152 | 152 | { |
153 | - $result = $this->db->sql_query('SELECT * FROM ' . POSTS_TABLE . ' WHERE post_id = ' . (int) $post_id); |
|
153 | + $result = $this->db->sql_query('SELECT * FROM '.POSTS_TABLE.' WHERE post_id = '.(int) $post_id); |
|
154 | 154 | $post_data = $this->db->sql_fetchrow($result); |
155 | 155 | $this->db->sql_freeresult($result); |
156 | 156 | |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | { |
178 | 178 | if (!function_exists('submit_post')) |
179 | 179 | { |
180 | - include($this->root_path . 'includes/functions_posting.' . $this->php_ext); |
|
180 | + include($this->root_path.'includes/functions_posting.'.$this->php_ext); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | $poll = array(); |
184 | 184 | $uid = $bitfield = $options = ''; |
185 | - $allow_bbcode = ($this->config['allow_bbcode']) ? true : false; |
|
186 | - $allow_smilies = ($this->config['allow_smilies']) ? true : false; |
|
187 | - $allow_urls = ($this->config['allow_post_links']) ? true : false; |
|
185 | + $allow_bbcode = ($this->config['allow_bbcode']) ? true : false; |
|
186 | + $allow_smilies = ($this->config['allow_smilies']) ? true : false; |
|
187 | + $allow_urls = ($this->config['allow_post_links']) ? true : false; |
|
188 | 188 | |
189 | 189 | generate_text_for_storage($message, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies); |
190 | 190 | |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | submit_post($action, $topic_data['topic_title'], $this->user->data['username'], POST_NORMAL, $poll, $post_data); |
207 | 207 | |
208 | 208 | $post_id = $post_data['post_id']; |
209 | - $redirect_url = $current_page . ((strpos($current_page, '?') === false) ? '?' : '&') . "p=$post_id#p$post_id"; |
|
210 | - $message = $this->user->lang['COMMENT_POSTED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_PAGE'], '<a href="' . $redirect_url . '">', '</a>'); |
|
209 | + $redirect_url = $current_page.((strpos($current_page, '?') === false) ? '?' : '&')."p=$post_id#p$post_id"; |
|
210 | + $message = $this->user->lang['COMMENT_POSTED'].'<br /><br />'.sprintf($this->user->lang['RETURN_PAGE'], '<a href="'.$redirect_url.'">', '</a>'); |
|
211 | 211 | |
212 | 212 | meta_refresh(3, $redirect_url); |
213 | 213 | trigger_error($message); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | if ($post_id && !$action) |
223 | 223 | { |
224 | 224 | $sql = 'SELECT post_id, post_time, post_visibility |
225 | - FROM ' . POSTS_TABLE . " p |
|
225 | + FROM ' . POSTS_TABLE." p |
|
226 | 226 | WHERE p.topic_id = $topic_id |
227 | 227 | AND p.post_id = $post_id"; |
228 | 228 | $result = $this->db->sql_query($sql); |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | $this->db->sql_freeresult($result); |
231 | 231 | |
232 | 232 | $sql = 'SELECT COUNT(p.post_id) AS prev_posts |
233 | - FROM ' . POSTS_TABLE . " p |
|
233 | + FROM ' . POSTS_TABLE." p |
|
234 | 234 | WHERE p.topic_id = $topic_id |
235 | 235 | AND (p.post_time < {$row['post_time']} OR (p.post_time = {$row['post_time']} AND p.post_id <= {$row['post_id']})) |
236 | - AND " . $this->content_visibility->get_visibility_sql('post', $forum_id, 'p.'); |
|
236 | + AND ".$this->content_visibility->get_visibility_sql('post', $forum_id, 'p.'); |
|
237 | 237 | |
238 | 238 | $result = $this->db->sql_query($sql); |
239 | 239 | $row = $this->db->sql_fetchrow($result); |
@@ -75,10 +75,8 @@ discard block |
||
75 | 75 | /** |
76 | 76 | * Display content field |
77 | 77 | * |
78 | - * @param string $field_value |
|
79 | 78 | * @param string $view_mode |
80 | 79 | * @param array $topic_data |
81 | - * @param array $field_data |
|
82 | 80 | * @return mixed |
83 | 81 | */ |
84 | 82 | public function display_field($value, $view_mode = 'detail', array $topic_data = array(), array $field = array()) |
@@ -182,7 +180,7 @@ discard block |
||
182 | 180 | * @param string $value |
183 | 181 | * @param string $topic_url |
184 | 182 | * @param string $view_mode |
185 | - * @return void |
|
183 | + * @return string |
|
186 | 184 | */ |
187 | 185 | protected function generate_field_pages($field_name, $value, $topic_url, $view_mode) |
188 | 186 | { |
@@ -212,8 +210,8 @@ discard block |
||
212 | 210 | /** |
213 | 211 | * Generate pagination for topic subpages |
214 | 212 | * |
215 | - * @param array $pages |
|
216 | - * @param array $page_titles |
|
213 | + * @param string[] $pages |
|
214 | + * @param string[] $page_titles |
|
217 | 215 | * @param int $start |
218 | 216 | * @param string $topic_url |
219 | 217 | * @param string $view_mode |
@@ -235,6 +233,7 @@ discard block |
||
235 | 233 | * |
236 | 234 | * @param int $start |
237 | 235 | * @param $page_titles |
236 | + * @param string $topic_url |
|
238 | 237 | * @return void |
239 | 238 | */ |
240 | 239 | protected function generate_toc($start, $page_titles, $topic_url) |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $asset_path = $this->util->get_web_path(); |
105 | 105 | $this->util->add_assets(array( |
106 | 106 | 'js' => array( |
107 | - $asset_path . 'assets/javascript/editor.js', |
|
107 | + $asset_path.'assets/javascript/editor.js', |
|
108 | 108 | '@blitze_content/assets/content_posting.min.js' |
109 | 109 | ) |
110 | 110 | )); |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | // Assigning custom bbcodes |
156 | 156 | if (!function_exists('display_custom_bbcodes')) |
157 | 157 | { |
158 | - include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); |
|
158 | + include($this->phpbb_root_path.'includes/functions_display.'.$this->php_ext); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | display_custom_bbcodes(); |
162 | 162 | |
163 | - $bbcode_status = ($this->config['allow_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id)) ? true : false; |
|
163 | + $bbcode_status = ($this->config['allow_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id)) ? true : false; |
|
164 | 164 | |
165 | 165 | $dataref = $this->template_context->get_data_ref(); |
166 | 166 | $this->ptemplate->assign_block_vars_array('custom_tags', (isset($dataref['custom_tags'])) ? $dataref['custom_tags'] : array()); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $this->template->assign_block_vars('toc', array( |
246 | 246 | 'TITLE' => $title, |
247 | 247 | 'S_PAGE' => ($page === $start), |
248 | - 'U_VIEW' => append_sid($topic_url, 'page=' . $page), |
|
248 | + 'U_VIEW' => append_sid($topic_url, 'page='.$page), |
|
249 | 249 | )); |
250 | 250 | } |
251 | 251 | } |
@@ -84,8 +84,7 @@ |
||
84 | 84 | if ($trigger_error) |
85 | 85 | { |
86 | 86 | throw new \blitze\sitemaker\exception\out_of_bounds($type); |
87 | - } |
|
88 | - else |
|
87 | + } else |
|
89 | 88 | { |
90 | 89 | return false; |
91 | 90 | } |
@@ -206,14 +206,12 @@ |
||
206 | 206 | if (!empty($field_value)) |
207 | 207 | { |
208 | 208 | $this->errors[] = $obj->validate_field($row); |
209 | - } |
|
210 | - else if ($row['field_required']) |
|
209 | + } else if ($row['field_required']) |
|
211 | 210 | { |
212 | 211 | if (!$row['field_mod_only'] || $cp_class === 'mcp') |
213 | 212 | { |
214 | 213 | $this->errors[] = $this->language->lang_array('FIELD_REQUIRED', array($row['field_label'])); |
215 | - } |
|
216 | - else |
|
214 | + } else |
|
217 | 215 | { |
218 | 216 | $req_mod_input = true; |
219 | 217 | } |
@@ -92,7 +92,7 @@ |
||
92 | 92 | */ |
93 | 93 | public function add($name, $type, array $field_data, $forum_id = 0, $topic_id = 0) |
94 | 94 | { |
95 | - $field_data += array('field_id' => 'field-' . $name); |
|
95 | + $field_data += array('field_id' => 'field-'.$name); |
|
96 | 96 | $field_data += $this->get_default_field_data(); |
97 | 97 | |
98 | 98 | if ($this->fields_factory->exists($type)) |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public function get_field_value($name, $default) |
18 | 18 | { |
19 | 19 | $default = is_array($default) ? $default : explode("\n", $default); |
20 | - $value = $this->request->variable($name, $default, true); |
|
20 | + $value = $this->request->variable($name, $default, true); |
|
21 | 21 | |
22 | 22 | if (empty($value) && $this->request->server('REQUEST_METHOD') !== 'POST') |
23 | 23 | { |
@@ -134,12 +134,10 @@ |
||
134 | 134 | if ($this->is_too_short($data, $length)) |
135 | 135 | { |
136 | 136 | return $this->language->lang('FIELD_TOO_SHORT', $data['field_label'], $data['field_minlength']); |
137 | - } |
|
138 | - else if ($this->is_too_long($data, $length)) |
|
137 | + } else if ($this->is_too_long($data, $length)) |
|
139 | 138 | { |
140 | 139 | return $this->language->lang('FIELD_TOO_LONG', $data['field_label'], $data['field_maxlength']); |
141 | - } |
|
142 | - else |
|
140 | + } else |
|
143 | 141 | { |
144 | 142 | return $this->language->lang('FIELD_INVALID', $data['field_label']); |
145 | 143 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $this->ptemplate->assign_vars(array_change_key_case($data, CASE_UPPER)); |
71 | 71 | |
72 | - return $this->ptemplate->render_view('blitze/content', "fields/$field.html", $field . '_field'); |
|
72 | + return $this->ptemplate->render_view('blitze/content', "fields/$field.html", $field.'_field'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function get_langname() |
87 | 87 | { |
88 | - return strtoupper('FORM_FIELD_' . $this->get_name()); |
|
88 | + return strtoupper('FORM_FIELD_'.$this->get_name()); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |