@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | */ |
26 | 26 | protected function find_sql(array $sql_where) |
27 | 27 | { |
28 | - return 'SELECT * FROM ' . $this->entity_table . |
|
29 | - ((sizeof($sql_where)) ? ' WHERE ' . join(' AND ', $sql_where) : '') . ' |
|
28 | + return 'SELECT * FROM '.$this->entity_table. |
|
29 | + ((sizeof($sql_where)) ? ' WHERE '.join(' AND ', $sql_where) : '').' |
|
30 | 30 | ORDER BY position, weight ASC'; |
31 | 31 | } |
32 | 32 | |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | // move blocks up for position |
41 | 41 | if ($condition instanceof $this->entity_class) |
42 | 42 | { |
43 | - $this->db->sql_query('UPDATE ' . $this->entity_table . ' |
|
43 | + $this->db->sql_query('UPDATE '.$this->entity_table.' |
|
44 | 44 | SET weight = weight - 1 |
45 | - WHERE weight > ' . (int) $condition->get_weight() . ' |
|
46 | - AND style = ' . (int) $condition->get_style() . ' |
|
47 | - AND route_id = ' . (int) $condition->get_route_id() . " |
|
48 | - AND position = '" . $this->db->sql_escape($condition->get_position()) . "'"); |
|
45 | + WHERE weight > ' . (int) $condition->get_weight().' |
|
46 | + AND style = ' . (int) $condition->get_style().' |
|
47 | + AND route_id = ' . (int) $condition->get_route_id()." |
|
48 | + AND position = '" . $this->db->sql_escape($condition->get_position())."'"); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | protected function move_blocks_down(\blitze\sitemaker\model\entity_interface $entity) |
66 | 66 | { |
67 | 67 | /** @type \blitze\sitemaker\model\entity\block $entity */ |
68 | - $sql = 'UPDATE ' . $this->entity_table . ' |
|
68 | + $sql = 'UPDATE '.$this->entity_table.' |
|
69 | 69 | SET weight = weight + 1 |
70 | - WHERE weight >= ' . (int) $entity->get_weight() . ' |
|
71 | - AND route_id = ' . (int) $entity->get_route_id() . ' |
|
70 | + WHERE weight >= ' . (int) $entity->get_weight().' |
|
71 | + AND route_id = ' . (int) $entity->get_route_id().' |
|
72 | 72 | AND style = ' . (int) $entity->get_style(); |
73 | 73 | $this->db->sql_query($sql); |
74 | 74 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function save(\blitze\sitemaker\model\entity_interface $entity) |
87 | 87 | { |
88 | - $accessor = 'get_' . $this->entity_pkey; |
|
88 | + $accessor = 'get_'.$this->entity_pkey; |
|
89 | 89 | if (is_null($entity->$accessor())) |
90 | 90 | { |
91 | 91 | $entity = $this->insert($entity); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | if ($condition instanceof $this->entity_class) |
109 | 109 | { |
110 | - $accessor = 'get_' . $this->entity_pkey; |
|
110 | + $accessor = 'get_'.$this->entity_pkey; |
|
111 | 111 | $condition = array($this->entity_pkey, '=', $condition->$accessor()); |
112 | 112 | } |
113 | 113 | else |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | $sql_where = $this->get_sql_condition($condition); |
120 | - $this->db->sql_query('DELETE FROM ' . $this->entity_table . (sizeof($sql_where) ? ' WHERE ' . join(' AND ', $sql_where) : '')); |
|
120 | + $this->db->sql_query('DELETE FROM '.$this->entity_table.(sizeof($sql_where) ? ' WHERE '.join(' AND ', $sql_where) : '')); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | */ |
137 | 137 | protected function insert(\blitze\sitemaker\model\entity_interface $entity) |
138 | 138 | { |
139 | - $this->db->sql_query('INSERT INTO ' . $this->entity_table . ' ' . $this->db->sql_build_array('INSERT', $entity->to_db())); |
|
139 | + $this->db->sql_query('INSERT INTO '.$this->entity_table.' '.$this->db->sql_build_array('INSERT', $entity->to_db())); |
|
140 | 140 | |
141 | - $mutator = 'set_' . $this->entity_pkey; |
|
141 | + $mutator = 'set_'.$this->entity_pkey; |
|
142 | 142 | $entity->$mutator((int) $this->db->sql_nextid()); |
143 | 143 | |
144 | 144 | return $entity; |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function update(\blitze\sitemaker\model\entity_interface $entity) |
154 | 154 | { |
155 | - $accessor = 'get_' . $this->entity_pkey; |
|
155 | + $accessor = 'get_'.$this->entity_pkey; |
|
156 | 156 | |
157 | - return $this->db->sql_query('UPDATE ' . $this->entity_table . ' |
|
158 | - SET ' . $this->db->sql_build_array('UPDATE', $entity->to_db()) . ' |
|
159 | - WHERE ' . $this->entity_pkey . ' = ' . (int) $entity->$accessor()); |
|
157 | + return $this->db->sql_query('UPDATE '.$this->entity_table.' |
|
158 | + SET ' . $this->db->sql_build_array('UPDATE', $entity->to_db()).' |
|
159 | + WHERE ' . $this->entity_pkey.' = '.(int) $entity->$accessor()); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | */ |
166 | 166 | protected function find_sql(array $sql_where) |
167 | 167 | { |
168 | - return 'SELECT * FROM ' . $this->entity_table . |
|
169 | - (sizeof($sql_where) ? ' WHERE ' . join(' AND ', $sql_where) : ''); |
|
168 | + return 'SELECT * FROM '.$this->entity_table. |
|
169 | + (sizeof($sql_where) ? ' WHERE '.join(' AND ', $sql_where) : ''); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | { |
183 | 183 | list($field, $operator, $value) = $info; |
184 | 184 | |
185 | - $callable = 'get_sql_where_' . gettype($value); |
|
185 | + $callable = 'get_sql_where_'.gettype($value); |
|
186 | 186 | $sql_where[] = $this->$callable($field, $value, $operator); |
187 | 187 | } |
188 | 188 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | protected function get_sql_where_string($field, $value, $operator) |
225 | 225 | { |
226 | - return $field . " $operator '" . $this->db->sql_escape($value) . "'"; |
|
226 | + return $field." $operator '".$this->db->sql_escape($value)."'"; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | protected function get_sql_where_integer($field, $value, $operator) |
236 | 236 | { |
237 | - return $field . " $operator " . (int) $value; |
|
237 | + return $field." $operator ".(int) $value; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -89,8 +89,7 @@ discard block |
||
89 | 89 | if (is_null($entity->$accessor())) |
90 | 90 | { |
91 | 91 | $entity = $this->insert($entity); |
92 | - } |
|
93 | - else |
|
92 | + } else |
|
94 | 93 | { |
95 | 94 | $this->update($entity); |
96 | 95 | } |
@@ -109,8 +108,7 @@ discard block |
||
109 | 108 | { |
110 | 109 | $accessor = 'get_' . $this->entity_pkey; |
111 | 110 | $condition = array($this->entity_pkey, '=', $condition->$accessor()); |
112 | - } |
|
113 | - else |
|
111 | + } else |
|
114 | 112 | { |
115 | 113 | throw new \blitze\sitemaker\exception\invalid_argument(array('entity', 'INVALID_ENTITY')); |
116 | 114 | } |
@@ -88,8 +88,7 @@ |
||
88 | 88 | $return_data = $command->execute($style_id); |
89 | 89 | |
90 | 90 | $this->action_handler->clear_cache(); |
91 | - } |
|
92 | - catch (\blitze\sitemaker\exception\base $e) |
|
91 | + } catch (\blitze\sitemaker\exception\base $e) |
|
93 | 92 | { |
94 | 93 | $json_data['message'] = $e->get_message($this->translator); |
95 | 94 | } |
@@ -63,12 +63,10 @@ |
||
63 | 63 | $return_data = $command->execute(); |
64 | 64 | |
65 | 65 | $this->action_handler->clear_cache(); |
66 | - } |
|
67 | - catch (\blitze\sitemaker\exception\base $e) |
|
66 | + } catch (\blitze\sitemaker\exception\base $e) |
|
68 | 67 | { |
69 | 68 | $return_data['message'] = $e->get_message($this->translator); |
70 | - } |
|
71 | - catch (\Exception $e) |
|
69 | + } catch (\Exception $e) |
|
72 | 70 | { |
73 | 71 | $return_data['message'] = $this->translator->lang($e->getMessage()); |
74 | 72 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | $this->set_display_fields(); |
110 | 110 | |
111 | - $view = 'S_' . strtoupper($this->settings['template']); |
|
111 | + $view = 'S_'.strtoupper($this->settings['template']); |
|
112 | 112 | $post_data = $this->get_post_data($topic_data); |
113 | 113 | $topic_data = array_values($topic_data); |
114 | 114 | |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | 'VIEWS' => (int) $row['topic_views'], |
157 | 157 | 'S_UNREAD_TOPIC' => $this->is_unread_topic($forum_id, $topic_id, $row['topic_last_post_time']), |
158 | 158 | |
159 | - 'U_VIEWTOPIC' => append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "f=$forum_id&t=$topic_id"), |
|
160 | - 'U_VIEWFORUM' => append_sid($this->phpbb_root_path . 'viewforum.' . $this->php_ext, "f=$forum_id"), |
|
161 | - 'U_NEW_POST' => append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "f=$forum_id&t=$topic_id&view=unread") . '#unread', |
|
162 | - 'U_LAST_POST' => append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "f=$forum_id&t=$topic_id&p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], |
|
159 | + 'U_VIEWTOPIC' => append_sid($this->phpbb_root_path.'viewtopic.'.$this->php_ext, "f=$forum_id&t=$topic_id"), |
|
160 | + 'U_VIEWFORUM' => append_sid($this->phpbb_root_path.'viewforum.'.$this->php_ext, "f=$forum_id"), |
|
161 | + 'U_NEW_POST' => append_sid($this->phpbb_root_path.'viewtopic.'.$this->php_ext, "f=$forum_id&t=$topic_id&view=unread").'#unread', |
|
162 | + 'U_LAST_POST' => append_sid($this->phpbb_root_path.'viewtopic.'.$this->php_ext, "f=$forum_id&t=$topic_id&p=".$row['topic_last_post_id']).'#p'.$row['topic_last_post_id'], |
|
163 | 163 | )); |
164 | 164 | unset($topic_data[$i], $post_data[$topic_id]); |
165 | 165 | } |
@@ -257,8 +257,7 @@ discard block |
||
257 | 257 | if ($this->settings['context'] && $this->settings['preview_chars']) |
258 | 258 | { |
259 | 259 | $post_data = $this->forum_data->get_post_data($this->settings['context']); |
260 | - } |
|
261 | - else |
|
260 | + } else |
|
262 | 261 | { |
263 | 262 | $post_data = array_fill_keys(array_keys($topic_data), array(array('post_text' => '', 'bbcode_uid' => '', 'bbcode_bitfield' => ''))); |
264 | 263 | } |
@@ -277,8 +276,7 @@ discard block |
||
277 | 276 | $this->fields['user_id'] = 'topic_last_poster_id'; |
278 | 277 | |
279 | 278 | $this->ptemplate->assign_var('L_POST_BY_AUTHOR', $this->translator->lang('LAST_POST_BY_AUTHOR')); |
280 | - } |
|
281 | - else |
|
279 | + } else |
|
282 | 280 | { |
283 | 281 | $this->fields['time'] = 'topic_time'; |
284 | 282 | $this->fields['user_id'] = 'topic_poster'; |
@@ -72,8 +72,7 @@ discard block |
||
72 | 72 | 'title' => '', |
73 | 73 | 'content' => '', |
74 | 74 | ); |
75 | - } |
|
76 | - else |
|
75 | + } else |
|
77 | 76 | { |
78 | 77 | $this->fetch_new($bdata['settings']); |
79 | 78 | |
@@ -117,8 +116,7 @@ discard block |
||
117 | 116 | { |
118 | 117 | $sorting = 't.topic_last_post_time'; |
119 | 118 | $sql_array = $this->get_topics_sql(); |
120 | - } |
|
121 | - else |
|
119 | + } else |
|
122 | 120 | { |
123 | 121 | $sorting = 'p.post_time'; |
124 | 122 | $sql_array = $this->get_posts_sql(); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $this->ptemplate->assign_block_vars('topicrow', array( |
96 | 96 | 'TOPIC_TITLE' => censor_text($row['topic_title']), |
97 | - 'U_VIEWTOPIC' => append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "f=$forum_id&t=$topic_id"), |
|
97 | + 'U_VIEWTOPIC' => append_sid($this->phpbb_root_path.'viewtopic.'.$this->php_ext, "f=$forum_id&t=$topic_id"), |
|
98 | 98 | )); |
99 | 99 | unset($topic_data[$i]); |
100 | 100 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | return array( |
137 | 137 | 'WHERE' => array( |
138 | - 't.topic_last_post_time > ' . (int) $this->user->data['user_lastvisit'], |
|
138 | + 't.topic_last_post_time > '.(int) $this->user->data['user_lastvisit'], |
|
139 | 139 | 't.topic_moved_id = 0', |
140 | 140 | ), |
141 | 141 | ); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | POSTS_TABLE => 'p', |
152 | 152 | ), |
153 | 153 | 'WHERE' => array( |
154 | - 't.topic_id = p.topic_id AND p.post_time > ' . $this->user->data['user_lastvisit'], |
|
154 | + 't.topic_id = p.topic_id AND p.post_time > '.$this->user->data['user_lastvisit'], |
|
155 | 155 | ), |
156 | 156 | ); |
157 | 157 | } |
@@ -45,9 +45,9 @@ |
||
45 | 45 | public function display(array $settings, $edit_mode = false) |
46 | 46 | { |
47 | 47 | $content = ''; |
48 | - $content .= $this->translator->lang('TOTAL_POSTS_COUNT', (int) $this->config['num_posts']) . '<br />'; |
|
49 | - $content .= $this->translator->lang('TOTAL_TOPICS', (int) $this->config['num_topics']) . '<br />'; |
|
50 | - $content .= $this->translator->lang('TOTAL_USERS', (int) $this->config['num_users']) . '<br />'; |
|
48 | + $content .= $this->translator->lang('TOTAL_POSTS_COUNT', (int) $this->config['num_posts']).'<br />'; |
|
49 | + $content .= $this->translator->lang('TOTAL_TOPICS', (int) $this->config['num_topics']).'<br />'; |
|
50 | + $content .= $this->translator->lang('TOTAL_USERS', (int) $this->config['num_users']).'<br />'; |
|
51 | 51 | $content .= $this->translator->lang('NEWEST_USER', get_username_string('full', $this->config['newest_user_id'], $this->config['newest_username'], $this->config['newest_user_colour'])); |
52 | 52 | |
53 | 53 | $this->template->assign_var('NEWEST_USER', false); |
@@ -150,8 +150,7 @@ |
||
150 | 150 | if (!$block_exists) |
151 | 151 | { |
152 | 152 | $sql = 'INSERT INTO ' . $this->cblocks_table . ' ' . $this->db->sql_build_array('INSERT', $sql_data); |
153 | - } |
|
154 | - else |
|
153 | + } else |
|
155 | 154 | { |
156 | 155 | $sql = 'UPDATE ' . $this->cblocks_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_data) . ' WHERE block_id = ' . (int) $sql_data['block_id']; |
157 | 156 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $content = $this->request->variable('content', '', true); |
86 | 86 | $cblocks = $this->get_custom_blocks(); |
87 | 87 | |
88 | - $sql_data = $this->get_default_fields($block_id); |
|
88 | + $sql_data = $this->get_default_fields($block_id); |
|
89 | 89 | $sql_data['block_content'] = $content; |
90 | 90 | |
91 | 91 | generate_text_for_storage($sql_data['block_content'], $sql_data['bbcode_uid'], $sql_data['bbcode_bitfield'], $sql_data['bbcode_options'], true, false, true); |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | { |
150 | 150 | if (!$block_exists) |
151 | 151 | { |
152 | - $sql = 'INSERT INTO ' . $this->cblocks_table . ' ' . $this->db->sql_build_array('INSERT', $sql_data); |
|
152 | + $sql = 'INSERT INTO '.$this->cblocks_table.' '.$this->db->sql_build_array('INSERT', $sql_data); |
|
153 | 153 | } |
154 | 154 | else |
155 | 155 | { |
156 | - $sql = 'UPDATE ' . $this->cblocks_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_data) . ' WHERE block_id = ' . (int) $sql_data['block_id']; |
|
156 | + $sql = 'UPDATE '.$this->cblocks_table.' SET '.$this->db->sql_build_array('UPDATE', $sql_data).' WHERE block_id = '.(int) $sql_data['block_id']; |
|
157 | 157 | } |
158 | 158 | $this->db->sql_query($sql); |
159 | 159 | $this->cache->destroy('sm_cblocks'); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | $block_is_active = $status; |
175 | 175 | $status = ($content && $status) ? true : false; |
176 | - $content = '<div id="block-editor-' . $cblock['block_id'] . '" class="editable editable-block" data-service="blitze.sitemaker.block.custom" data-method="edit" data-raw="' . $cblock['block_content'] . '" data-active="' . $block_is_active . '">' . $content . '</div>'; |
|
176 | + $content = '<div id="block-editor-'.$cblock['block_id'].'" class="editable editable-block" data-service="blitze.sitemaker.block.custom" data-method="edit" data-raw="'.$cblock['block_content'].'" data-active="'.$block_is_active.'">'.$content.'</div>'; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 |
@@ -303,8 +303,7 @@ |
||
303 | 303 | $cur_voted_id[] = $row['poll_option_id']; |
304 | 304 | } |
305 | 305 | $this->db->sql_freeresult($result); |
306 | - } |
|
307 | - else |
|
306 | + } else |
|
308 | 307 | { |
309 | 308 | // Cookie based guest tracking ... I don't like this but hum ho |
310 | 309 | // it's oft requested. This relies on "nice" users who don't feel |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param array $topic_data |
69 | 69 | * @param \phpbb\template\twig\twig $template |
70 | 70 | */ |
71 | - public function build(array $topic_data, \phpbb\template\twig\twig &$template) |
|
71 | + public function build(array $topic_data, \phpbb\template\twig\twig & $template) |
|
72 | 72 | { |
73 | 73 | $this->translator->add_lang('viewtopic'); |
74 | 74 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | 'S_POLL_ACTION' => $viewtopic_url, |
101 | 101 | 'S_FORM_TOKEN' => $this->sitemaker->get_form_key('posting'), |
102 | 102 | |
103 | - 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll', |
|
103 | + 'U_VIEW_RESULTS' => $viewtopic_url.'&view=viewpoll', |
|
104 | 104 | )); |
105 | 105 | } |
106 | 106 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $post_id = (int) $topic_data['topic_first_post_id']; |
172 | 172 | |
173 | 173 | $sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid |
174 | - FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p |
|
174 | + FROM ' . POLL_OPTIONS_TABLE.' o, '.POSTS_TABLE." p |
|
175 | 175 | WHERE o.topic_id = $topic_id |
176 | 176 | AND p.post_id = $post_id |
177 | 177 | AND p.topic_id = o.topic_id |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param int $poll_most |
217 | 217 | * @param \phpbb\template\twig\twig $template |
218 | 218 | */ |
219 | - private function build_poll_options(array $cur_voted_id, array $poll_info, $poll_total, $poll_most, \phpbb\template\twig\twig &$template) |
|
219 | + private function build_poll_options(array $cur_voted_id, array $poll_info, $poll_total, $poll_most, \phpbb\template\twig\twig & $template) |
|
220 | 220 | { |
221 | 221 | foreach ($poll_info as $poll_option) |
222 | 222 | { |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | if ($this->user->data['is_registered']) |
248 | 248 | { |
249 | 249 | $sql = 'SELECT poll_option_id |
250 | - FROM ' . POLL_VOTES_TABLE . ' |
|
251 | - WHERE topic_id = ' . (int) $topic_id . ' |
|
250 | + FROM ' . POLL_VOTES_TABLE.' |
|
251 | + WHERE topic_id = ' . (int) $topic_id.' |
|
252 | 252 | AND vote_user_id = ' . (int) $this->user->data['user_id']; |
253 | 253 | $result = $this->db->sql_query($sql); |
254 | 254 | |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | // Cookie based guest tracking ... I don't like this but hum ho |
264 | 264 | // it's oft requested. This relies on "nice" users who don't feel |
265 | 265 | // the need to delete cookies to mess with results. |
266 | - if ($this->request->is_set($this->config['cookie_name'] . '_poll_' . $topic_id, \phpbb\request\request_interface::COOKIE)) |
|
266 | + if ($this->request->is_set($this->config['cookie_name'].'_poll_'.$topic_id, \phpbb\request\request_interface::COOKIE)) |
|
267 | 267 | { |
268 | - $cur_voted_id = explode(',', $this->request->variable($this->config['cookie_name'] . '_poll_' . $topic_id, '', true, \phpbb\request\request_interface::COOKIE)); |
|
268 | + $cur_voted_id = explode(',', $this->request->variable($this->config['cookie_name'].'_poll_'.$topic_id, '', true, \phpbb\request\request_interface::COOKIE)); |
|
269 | 269 | $cur_voted_id = array_map('intval', $cur_voted_id); |
270 | 270 | } |
271 | 271 | } |