@@ -41,8 +41,7 @@ |
||
41 | 41 | if (is_array($message)) |
42 | 42 | { |
43 | 43 | $this->message = (string) $message[0]; |
44 | - } |
|
45 | - else |
|
44 | + } else |
|
46 | 45 | { |
47 | 46 | $this->message = $message; |
48 | 47 | } |
@@ -16,23 +16,23 @@ discard block |
||
16 | 16 | class base extends \Exception |
17 | 17 | { |
18 | 18 | /** |
19 | - * Null if the message is a string, array if the message was submitted as an array |
|
20 | - * @var string|array |
|
21 | - */ |
|
19 | + * Null if the message is a string, array if the message was submitted as an array |
|
20 | + * @var string|array |
|
21 | + */ |
|
22 | 22 | protected $message_full; |
23 | 23 | |
24 | 24 | protected $previous; |
25 | 25 | |
26 | 26 | /** |
27 | - * Constructor |
|
28 | - * |
|
29 | - * Different from normal exceptions in that we do not enforce $message to be a string. |
|
30 | - * |
|
31 | - * @param string|array $message |
|
32 | - * @param int $code |
|
33 | - * @param \Exception $previous |
|
34 | - * @access public |
|
35 | - */ |
|
27 | + * Constructor |
|
28 | + * |
|
29 | + * Different from normal exceptions in that we do not enforce $message to be a string. |
|
30 | + * |
|
31 | + * @param string|array $message |
|
32 | + * @param int $code |
|
33 | + * @param \Exception $previous |
|
34 | + * @access public |
|
35 | + */ |
|
36 | 36 | public function __construct($message = null, $code = 0, \Exception $previous = null) |
37 | 37 | { |
38 | 38 | // We're slightly changing the way exceptions work |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * Basic message translation for our exceptions |
|
57 | - * |
|
58 | - * @param \phpbb\user $user |
|
59 | - * @return string|array |
|
60 | - * @access public |
|
61 | - */ |
|
56 | + * Basic message translation for our exceptions |
|
57 | + * |
|
58 | + * @param \phpbb\user $user |
|
59 | + * @return string|array |
|
60 | + * @access public |
|
61 | + */ |
|
62 | 62 | public function get_message(\phpbb\user $user) |
63 | 63 | { |
64 | 64 | // Make sure our language file has been loaded |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | - * Translate all portions of the message sent to the exception |
|
77 | - * |
|
78 | - * Goes through each element of the array and tries to translate them |
|
79 | - * |
|
80 | - * @param \phpbb\user $user |
|
81 | - * @param string|array $message_portions The message portions to translate |
|
82 | - * @param string|null $parent_message Send a string to translate all of the |
|
83 | - * portions with the parent message (typically used to format a string |
|
84 | - * with the given message portions). Null to ignore. Default: Null |
|
85 | - * @return array|string Array if $parent_message === null else a string |
|
86 | - * @access protected |
|
87 | - */ |
|
76 | + * Translate all portions of the message sent to the exception |
|
77 | + * |
|
78 | + * Goes through each element of the array and tries to translate them |
|
79 | + * |
|
80 | + * @param \phpbb\user $user |
|
81 | + * @param string|array $message_portions The message portions to translate |
|
82 | + * @param string|null $parent_message Send a string to translate all of the |
|
83 | + * portions with the parent message (typically used to format a string |
|
84 | + * with the given message portions). Null to ignore. Default: Null |
|
85 | + * @return array|string Array if $parent_message === null else a string |
|
86 | + * @access protected |
|
87 | + */ |
|
88 | 88 | protected function translate_portions(\phpbb\user $user, $message_portions, $parent_message = null) |
89 | 89 | { |
90 | 90 | // Make sure our language file has been loaded |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
129 | - * Add our language file |
|
130 | - * |
|
131 | - * @param \phpbb\user $user |
|
132 | - * @return null |
|
133 | - * @access public |
|
134 | - */ |
|
129 | + * Add our language file |
|
130 | + * |
|
131 | + * @param \phpbb\user $user |
|
132 | + * @return null |
|
133 | + * @access public |
|
134 | + */ |
|
135 | 135 | public function add_lang(\phpbb\user $user) |
136 | 136 | { |
137 | 137 | static $is_loaded = false; |
@@ -150,15 +150,15 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
153 | - * Output a string of this error message |
|
154 | - * |
|
155 | - * This will hopefully be never called, always catch the expected exceptions |
|
156 | - * and call get_message to translate them into an error that a user can |
|
157 | - * understand |
|
158 | - * |
|
159 | - * @return string |
|
160 | - * @access public |
|
161 | - */ |
|
153 | + * Output a string of this error message |
|
154 | + * |
|
155 | + * This will hopefully be never called, always catch the expected exceptions |
|
156 | + * and call get_message to translate them into an error that a user can |
|
157 | + * understand |
|
158 | + * |
|
159 | + * @return string |
|
160 | + * @access public |
|
161 | + */ |
|
162 | 162 | public function __toString() |
163 | 163 | { |
164 | 164 | return (is_array($this->message_full)) ? var_export($this->message_full, true) : (string) $this->message_full; |
@@ -100,10 +100,10 @@ |
||
100 | 100 | foreach ($message_portions as &$message) |
101 | 101 | { |
102 | 102 | // Attempt to translate each portion |
103 | - $translated_message = $user->lang('EXCEPTION_' . $message); |
|
103 | + $translated_message = $user->lang('EXCEPTION_'.$message); |
|
104 | 104 | |
105 | 105 | // Check if translating did anything |
106 | - if ($translated_message !== 'EXCEPTION_' . $message) |
|
106 | + if ($translated_message !== 'EXCEPTION_'.$message) |
|
107 | 107 | { |
108 | 108 | // It did, so replace message with the translated version |
109 | 109 | $message = $translated_message; |
@@ -41,8 +41,7 @@ |
||
41 | 41 | if (is_array($message)) |
42 | 42 | { |
43 | 43 | $this->message = (string) $message[0]; |
44 | - } |
|
45 | - else |
|
44 | + } else |
|
46 | 45 | { |
47 | 46 | $this->message = $message; |
48 | 47 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $content = $this->request->variable('content', '', true); |
70 | 70 | $cblocks = $this->get_custom_blocks(); |
71 | 71 | |
72 | - $sql_data = $this->get_default_fields($block_id); |
|
72 | + $sql_data = $this->get_default_fields($block_id); |
|
73 | 73 | $sql_data['block_content'] = $content; |
74 | 74 | |
75 | 75 | generate_text_for_storage($sql_data['block_content'], $sql_data['bbcode_uid'], $sql_data['bbcode_bitfield'], $sql_data['bbcode_options'], true, true, true); |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | { |
131 | 131 | if (!$block_exists) |
132 | 132 | { |
133 | - $sql = 'INSERT INTO ' . $this->cblocks_table . ' ' . $this->db->sql_build_array('INSERT', $sql_data); |
|
133 | + $sql = 'INSERT INTO '.$this->cblocks_table.' '.$this->db->sql_build_array('INSERT', $sql_data); |
|
134 | 134 | } |
135 | 135 | else |
136 | 136 | { |
137 | - $sql = 'UPDATE ' . $this->cblocks_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_data) . ' WHERE block_id = ' . (int) $sql_data['block_id']; |
|
137 | + $sql = 'UPDATE '.$this->cblocks_table.' SET '.$this->db->sql_build_array('UPDATE', $sql_data).' WHERE block_id = '.(int) $sql_data['block_id']; |
|
138 | 138 | } |
139 | 139 | $this->db->sql_query($sql); |
140 | 140 | $this->cache->destroy('pt_cblocks'); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | if ($edit_mode !== false) |
152 | 152 | { |
153 | 153 | decode_message($cblock['block_content'], $cblock['bbcode_uid']); |
154 | - $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'] . '">' . $content . '</div>'; |
|
154 | + $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'].'">'.$content.'</div>'; |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | if (!empty($collection)) |
51 | 51 | { |
52 | 52 | return $collection->get_entities(); |
53 | - } |
|
54 | - else |
|
53 | + } else |
|
55 | 54 | { |
56 | 55 | return array(); |
57 | 56 | } |
@@ -88,8 +87,7 @@ discard block |
||
88 | 87 | if (!$has_blocks && !$hiding_blocks && !sizeof($ex_positions)) |
89 | 88 | { |
90 | 89 | $this->route_mapper->delete($route); |
91 | - } |
|
92 | - else |
|
90 | + } else |
|
93 | 91 | { |
94 | 92 | $route->set_has_blocks($has_blocks); |
95 | 93 | $this->route_mapper->save($route); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $this->ptemplate->assign_block_vars('topicrow', array( |
101 | 101 | 'TOPIC_TITLE' => censor_text($row['topic_title']), |
102 | - 'U_VIEWTOPIC' => append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "f=$forum_id&t=$topic_id"), |
|
102 | + 'U_VIEWTOPIC' => append_sid($this->phpbb_root_path.'viewtopic.'.$this->php_ext, "f=$forum_id&t=$topic_id"), |
|
103 | 103 | )); |
104 | 104 | unset($topic_data[$i]); |
105 | 105 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | return array( |
142 | 142 | 'WHERE' => array( |
143 | - 't.topic_last_post_time > ' . $this->user->data['user_lastvisit'], |
|
143 | + 't.topic_last_post_time > '.$this->user->data['user_lastvisit'], |
|
144 | 144 | 't.topic_moved_id = 0', |
145 | 145 | ), |
146 | 146 | ); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | POSTS_TABLE => 'p', |
157 | 157 | ), |
158 | 158 | 'WHERE' => array( |
159 | - 't.topic_id = p.topic_id AND p.post_time > ' . $this->user->data['user_lastvisit'], |
|
159 | + 't.topic_id = p.topic_id AND p.post_time > '.$this->user->data['user_lastvisit'], |
|
160 | 160 | ), |
161 | 161 | ); |
162 | 162 | } |
@@ -41,8 +41,7 @@ |
||
41 | 41 | if (is_array($message)) |
42 | 42 | { |
43 | 43 | $this->message = (string) $message[0]; |
44 | - } |
|
45 | - else |
|
44 | + } else |
|
46 | 45 | { |
47 | 46 | $this->message = $message; |
48 | 47 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | if (!empty($data['.'][0]['TOTAL_USERS_ONLINE'])) |
70 | 70 | { |
71 | - $l_online_users = $data['.'][0]['TOTAL_USERS_ONLINE']; |
|
71 | + $l_online_users = $data['.'][0]['TOTAL_USERS_ONLINE']; |
|
72 | 72 | $online_userlist = $data['.'][0]['LOGGED_IN_USER_LIST']; |
73 | 73 | $l_online_record = $data['.'][0]['RECORD_USERS']; |
74 | 74 | } |
@@ -105,6 +105,6 @@ discard block |
||
105 | 105 | */ |
106 | 106 | private function get_viewonline_url() |
107 | 107 | { |
108 | - return ($this->auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) ? append_sid("{$this->phpbb_root_path}viewonline." . $this->php_ext) : ''; |
|
108 | + return ($this->auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) ? append_sid("{$this->phpbb_root_path}viewonline.".$this->php_ext) : ''; |
|
109 | 109 | } |
110 | 110 | } |
@@ -41,8 +41,7 @@ |
||
41 | 41 | if (is_array($message)) |
42 | 42 | { |
43 | 43 | $this->message = (string) $message[0]; |
44 | - } |
|
45 | - else |
|
44 | + } else |
|
46 | 45 | { |
47 | 46 | $this->message = $message; |
48 | 47 | } |
@@ -172,6 +172,6 @@ |
||
172 | 172 | */ |
173 | 173 | protected function get_sql_where($menu_id) |
174 | 174 | { |
175 | - return '%smenu_id = ' . (int) $menu_id; |
|
175 | + return '%smenu_id = '.(int) $menu_id; |
|
176 | 176 | } |
177 | 177 | } |
@@ -41,8 +41,7 @@ |
||
41 | 41 | if (is_array($message)) |
42 | 42 | { |
43 | 43 | $this->message = (string) $message[0]; |
44 | - } |
|
45 | - else |
|
44 | + } else |
|
46 | 45 | { |
47 | 46 | $this->message = $message; |
48 | 47 | } |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function get_item_info($item_id = 0) |
57 | 57 | { |
58 | - $sql = 'SELECT * FROM ' . $this->table_name . ' ' . $this->get_sql_where('WHERE') . |
|
59 | - (($item_id) ? " AND {$this->column_item_id} = " . (int) $item_id : ''); |
|
58 | + $sql = 'SELECT * FROM '.$this->table_name.' '.$this->get_sql_where('WHERE'). |
|
59 | + (($item_id) ? " AND {$this->column_item_id} = ".(int) $item_id : ''); |
|
60 | 60 | |
61 | 61 | $result = $this->db->sql_query($sql); |
62 | 62 | $row = $this->db->sql_fetchrow($result); |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | public function update_item($item_id, array $sql_data) |
76 | 76 | { |
77 | 77 | $sql = "UPDATE {$this->table_name} |
78 | - SET " . $this->db->sql_build_array('UPDATE', $sql_data) . " |
|
79 | - WHERE $this->column_item_id = " . (int) $item_id; |
|
78 | + SET ".$this->db->sql_build_array('UPDATE', $sql_data)." |
|
79 | + WHERE $this->column_item_id = ".(int) $item_id; |
|
80 | 80 | $this->db->sql_query($sql); |
81 | 81 | |
82 | 82 | return $sql_data; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | // Rather than updating each item individually, we will just delete all items |
111 | 111 | // then add them all over again with new parent_id|left_id|right_id |
112 | - $this->db->sql_query("DELETE FROM {$this->table_name} " . $this->get_sql_where('WHERE')); |
|
112 | + $this->db->sql_query("DELETE FROM {$this->table_name} ".$this->get_sql_where('WHERE')); |
|
113 | 113 | |
114 | 114 | // Now we add it back |
115 | 115 | $sql_data = $this->add_sub_tree($tree, 0); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | if ($depth && !$parent_id) |
160 | 160 | { |
161 | - throw new \RuntimeException($this->message_prefix . 'MALFORMED_TREE'); |
|
161 | + throw new \RuntimeException($this->message_prefix.'MALFORMED_TREE'); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | $key = $i + $max_id + 1; |
@@ -230,23 +230,23 @@ discard block |
||
230 | 230 | foreach ($branch as $i => $row) |
231 | 231 | { |
232 | 232 | $left_id = $right_id + 1; |
233 | - $right_id = $right_id + 2; |
|
233 | + $right_id = $right_id + 2; |
|
234 | 234 | |
235 | 235 | $sql_data[$i] = $row; |
236 | - $sql_data[$i]['parent_id'] = $parent_id; |
|
237 | - $sql_data[$i]['left_id'] = $left_id; |
|
238 | - $sql_data[$i]['right_id'] = $right_id; |
|
239 | - $sql_data[$i]['depth'] = $depth; |
|
236 | + $sql_data[$i]['parent_id'] = $parent_id; |
|
237 | + $sql_data[$i]['left_id'] = $left_id; |
|
238 | + $sql_data[$i]['right_id'] = $right_id; |
|
239 | + $sql_data[$i]['depth'] = $depth; |
|
240 | 240 | |
241 | 241 | if ($row['parent_id']) |
242 | 242 | { |
243 | - $left_id = $sql_data[$row['parent_id']]['right_id']; |
|
244 | - $right_id = $left_id + 1; |
|
243 | + $left_id = $sql_data[$row['parent_id']]['right_id']; |
|
244 | + $right_id = $left_id + 1; |
|
245 | 245 | |
246 | - $sql_data[$i]['parent_id'] = $row['parent_id']; |
|
247 | - $sql_data[$i]['depth'] = $sql_data[$row['parent_id']]['depth'] + 1; |
|
248 | - $sql_data[$i]['left_id'] = $left_id; |
|
249 | - $sql_data[$i]['right_id'] = $right_id; |
|
246 | + $sql_data[$i]['parent_id'] = $row['parent_id']; |
|
247 | + $sql_data[$i]['depth'] = $sql_data[$row['parent_id']]['depth'] + 1; |
|
248 | + $sql_data[$i]['left_id'] = $left_id; |
|
249 | + $sql_data[$i]['right_id'] = $right_id; |
|
250 | 250 | |
251 | 251 | $this->update_right_side($sql_data, $right_id, $row['parent_id'], $branch); |
252 | 252 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $this->db->sql_transaction('rollback'); |
273 | 273 | $this->lock->release(); |
274 | 274 | |
275 | - throw new \RuntimeException($this->message_prefix . 'INVALID_PARENT'); |
|
275 | + throw new \RuntimeException($this->message_prefix.'INVALID_PARENT'); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | // adjust items in affected branch |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | protected function get_max_id($column, $use_sql_where = true) |
301 | 301 | { |
302 | 302 | $sql = "SELECT MAX($column) AS $column |
303 | - FROM {$this->table_name} " . |
|
303 | + FROM {$this->table_name} ". |
|
304 | 304 | (($use_sql_where) ? $this->get_sql_where('WHERE') : ''); |
305 | 305 | $result = $this->db->sql_query($sql); |
306 | 306 | $max_id = $this->db->sql_fetchfield($column); |
@@ -15,12 +15,12 @@ |
||
15 | 15 | class unexpected_value extends base |
16 | 16 | { |
17 | 17 | /** |
18 | - * Translate this exception |
|
19 | - * |
|
20 | - * @param \phpbb\user $user |
|
21 | - * @return array|string |
|
22 | - * @access public |
|
23 | - */ |
|
18 | + * Translate this exception |
|
19 | + * |
|
20 | + * @param \phpbb\user $user |
|
21 | + * @return array|string |
|
22 | + * @access public |
|
23 | + */ |
|
24 | 24 | public function get_message(\phpbb\user $user) |
25 | 25 | { |
26 | 26 | return $this->translate_portions($user, $this->message_full, 'EXCEPTION_UNEXPECTED_VALUE'); |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | if (!empty($collection)) |
51 | 51 | { |
52 | 52 | return $collection->get_entities(); |
53 | - } |
|
54 | - else |
|
53 | + } else |
|
55 | 54 | { |
56 | 55 | return array(); |
57 | 56 | } |
@@ -88,8 +87,7 @@ discard block |
||
88 | 87 | if (!$has_blocks && !$hiding_blocks && !sizeof($ex_positions)) |
89 | 88 | { |
90 | 89 | $this->route_mapper->delete($route); |
91 | - } |
|
92 | - else |
|
90 | + } else |
|
93 | 91 | { |
94 | 92 | $route->set_has_blocks($has_blocks); |
95 | 93 | $this->route_mapper->save($route); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | $this->set_display_fields(); |
141 | 141 | |
142 | - $view = 'S_' . strtoupper($this->settings['template']); |
|
142 | + $view = 'S_'.strtoupper($this->settings['template']); |
|
143 | 143 | $post_data = $this->get_post_data($topic_data); |
144 | 144 | $topic_data = array_values($topic_data); |
145 | 145 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | { |
165 | 165 | for ($i = 0, $size = sizeof($topic_data); $i < $size; $i++) |
166 | 166 | { |
167 | - $row =& $topic_data[$i]; |
|
167 | + $row = & $topic_data[$i]; |
|
168 | 168 | $forum_id = $row['forum_id']; |
169 | 169 | $topic_id = $row['topic_id']; |
170 | 170 | |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | 'VIEWS' => $row['topic_views'], |
180 | 180 | 'S_UNREAD_TOPIC' => $this->is_unread_topic($forum_id, $topic_id, $row['topic_last_post_time']), |
181 | 181 | |
182 | - 'U_VIEWTOPIC' => append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "f=$forum_id&t=$topic_id"), |
|
183 | - 'U_VIEWFORUM' => append_sid($this->phpbb_root_path . 'viewforum.' . $this->php_ext, "f=$forum_id"), |
|
182 | + 'U_VIEWTOPIC' => append_sid($this->phpbb_root_path.'viewtopic.'.$this->php_ext, "f=$forum_id&t=$topic_id"), |
|
183 | + 'U_VIEWFORUM' => append_sid($this->phpbb_root_path.'viewforum.'.$this->php_ext, "f=$forum_id"), |
|
184 | 184 | ); |
185 | 185 | |
186 | 186 | $this->ptemplate->assign_block_vars('topicrow', $tpl_ary); |
@@ -178,8 +178,7 @@ |
||
178 | 178 | if (!empty($block['content'])) |
179 | 179 | { |
180 | 180 | $content = $block['content']; |
181 | - } |
|
182 | - else if ($edit_mode) |
|
181 | + } else if ($edit_mode) |
|
183 | 182 | { |
184 | 183 | $content = $this->user->lang('BLOCK_NO_DATA'); |
185 | 184 | } |