@@ -90,7 +90,9 @@ |
||
90 | 90 | |
91 | 91 | // Derived from, set the link back |
92 | 92 | if (!empty($context['topic_derived_from'])) |
93 | - $context['links']['derived_from'] = $scripturl . '?msg=' . $context['topic_derived_from']['derived_from']; |
|
93 | + { |
|
94 | + $context['links']['derived_from'] = $scripturl . '?msg=' . $context['topic_derived_from']['derived_from']; |
|
95 | + } |
|
94 | 96 | } |
95 | 97 | } |
96 | 98 |
@@ -34,11 +34,14 @@ discard block |
||
34 | 34 | add_integration_function('integrate_mod_buttons', 'Calendar_Display_Module::integrate_mod_buttons', '', false); |
35 | 35 | |
36 | 36 | if (!empty($modSettings['cal_showInTopic'])) |
37 | - return array( |
|
37 | + { |
|
38 | + return array( |
|
38 | 39 | array('topicinfo', array('Calendar_Display_Module', 'topicinfo'), array('topicinfo', 'topic')), |
39 | 40 | ); |
40 | - else |
|
41 | - return array(); |
|
41 | + } |
|
42 | + else { |
|
43 | + return array(); |
|
44 | + } |
|
42 | 45 | } |
43 | 46 | |
44 | 47 | /** |
@@ -71,9 +74,12 @@ discard block |
||
71 | 74 | |
72 | 75 | // First, try create a better time format, ignoring the "time" elements. |
73 | 76 | if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
74 | - $date_string = $user_info['time_format']; |
|
75 | - else |
|
76 | - $date_string = $matches[0]; |
|
77 | + { |
|
78 | + $date_string = $user_info['time_format']; |
|
79 | + } |
|
80 | + else { |
|
81 | + $date_string = $matches[0]; |
|
82 | + } |
|
77 | 83 | |
78 | 84 | // Get event information for this topic. |
79 | 85 | $events = eventInfoForTopic($topic); |
@@ -71,7 +71,9 @@ |
||
71 | 71 | global $context; |
72 | 72 | |
73 | 73 | if (empty($context['calendar_holidays']) && empty($context['calendar_birthdays']) && empty($context['calendar_events'])) |
74 | - return; |
|
74 | + { |
|
75 | + return; |
|
76 | + } |
|
75 | 77 | |
76 | 78 | $callbacks = elk_array_insert($callbacks, 'recent_posts', array('show_events'), 'after', false); |
77 | 79 | } |
@@ -48,14 +48,17 @@ discard block |
||
48 | 48 | $context['cal_maxyear'] = (int) date('Y') + (int) $modSettings['cal_limityear']; |
49 | 49 | |
50 | 50 | if (self::$_make_event) |
51 | - return array( |
|
51 | + { |
|
52 | + return array( |
|
52 | 53 | array('prepare_post', array('Calendar_Post_Module', 'prepare_post'), array()), |
53 | 54 | array('prepare_context', array('Calendar_Post_Module', 'prepare_context'), array()), |
54 | 55 | array('before_save_post', array('Calendar_Post_Module', 'before_save_post'), array()), |
55 | 56 | array('after_save_post', array('Calendar_Post_Module', 'after_save_post'), array()), |
56 | 57 | ); |
57 | - else |
|
58 | - return array(); |
|
58 | + } |
|
59 | + else { |
|
60 | + return array(); |
|
61 | + } |
|
59 | 62 | } |
60 | 63 | |
61 | 64 | /** |
@@ -74,7 +77,9 @@ discard block |
||
74 | 77 | public function before_save_post($post_errors) |
75 | 78 | { |
76 | 79 | if (!isset($_REQUEST['deleteevent']) && Util::htmltrim($_POST['evtitle']) === '') |
77 | - $post_errors->addError('no_event'); |
|
80 | + { |
|
81 | + $post_errors->addError('no_event'); |
|
82 | + } |
|
78 | 83 | } |
79 | 84 | |
80 | 85 | /** |
@@ -124,7 +129,9 @@ discard block |
||
124 | 129 | |
125 | 130 | // Delete it? |
126 | 131 | if (isset($_REQUEST['deleteevent'])) |
127 | - $event->remove(); |
|
132 | + { |
|
133 | + $event->remove(); |
|
134 | + } |
|
128 | 135 | // ... or just update it? |
129 | 136 | else |
130 | 137 | { |
@@ -175,7 +182,9 @@ discard block |
||
175 | 182 | |
176 | 183 | // They might want to pick a board. |
177 | 184 | if (!isset($context['current_board'])) |
178 | - $context['current_board'] = 0; |
|
185 | + { |
|
186 | + $context['current_board'] = 0; |
|
187 | + } |
|
179 | 188 | |
180 | 189 | // Start loading up the event info. |
181 | 190 | $context['event'] = array(); |
@@ -195,9 +204,13 @@ discard block |
||
195 | 204 | |
196 | 205 | // Make sure the user is allowed to edit this event. |
197 | 206 | if ($event_info['member'] != $user_info['id']) |
198 | - isAllowedTo('calendar_edit_any'); |
|
207 | + { |
|
208 | + isAllowedTo('calendar_edit_any'); |
|
209 | + } |
|
199 | 210 | elseif (!allowedTo('calendar_edit_any')) |
200 | - isAllowedTo('calendar_edit_own'); |
|
211 | + { |
|
212 | + isAllowedTo('calendar_edit_own'); |
|
213 | + } |
|
201 | 214 | |
202 | 215 | $context['event']['month'] = $event_info['month']; |
203 | 216 | $context['event']['day'] = $event_info['day']; |
@@ -212,35 +225,50 @@ discard block |
||
212 | 225 | |
213 | 226 | // You must have a month and year specified! |
214 | 227 | if (isset($_REQUEST['month'])) |
215 | - $context['event']['month'] = (int) $_REQUEST['month']; |
|
216 | - else |
|
217 | - $context['event']['month'] = $today['mon']; |
|
228 | + { |
|
229 | + $context['event']['month'] = (int) $_REQUEST['month']; |
|
230 | + } |
|
231 | + else { |
|
232 | + $context['event']['month'] = $today['mon']; |
|
233 | + } |
|
218 | 234 | |
219 | 235 | if (isset($_REQUEST['year'])) |
220 | - $context['event']['year'] = (int) $_REQUEST['year']; |
|
221 | - else |
|
222 | - $context['event']['year'] = $today['year']; |
|
236 | + { |
|
237 | + $context['event']['year'] = (int) $_REQUEST['year']; |
|
238 | + } |
|
239 | + else { |
|
240 | + $context['event']['year'] = $today['year']; |
|
241 | + } |
|
223 | 242 | |
224 | 243 | if (isset($_REQUEST['day'])) |
225 | - $context['event']['day'] = (int) $_REQUEST['day']; |
|
226 | - else |
|
227 | - $context['event']['day'] = $context['event']['month'] == $today['mon'] ? $today['mday'] : 0; |
|
244 | + { |
|
245 | + $context['event']['day'] = (int) $_REQUEST['day']; |
|
246 | + } |
|
247 | + else { |
|
248 | + $context['event']['day'] = $context['event']['month'] == $today['mon'] ? $today['mday'] : 0; |
|
249 | + } |
|
228 | 250 | |
229 | 251 | $context['event']['span'] = isset($_REQUEST['span']) ? $_REQUEST['span'] : 1; |
230 | 252 | |
231 | 253 | // Make sure the year and month are in the valid range. |
232 | 254 | if ($context['event']['month'] < 1 || $context['event']['month'] > 12) |
233 | - throw new Elk_Exception('invalid_month', false); |
|
255 | + { |
|
256 | + throw new Elk_Exception('invalid_month', false); |
|
257 | + } |
|
234 | 258 | |
235 | 259 | if ($context['event']['year'] < $modSettings['cal_minyear'] || $context['event']['year'] > (int) date('Y') + (int) $modSettings['cal_limityear']) |
236 | - throw new Elk_Exception('invalid_year', false); |
|
260 | + { |
|
261 | + throw new Elk_Exception('invalid_year', false); |
|
262 | + } |
|
237 | 263 | |
238 | 264 | // Get a list of boards they can post in. |
239 | 265 | require_once(SUBSDIR . '/Boards.subs.php'); |
240 | 266 | |
241 | 267 | $boards = boardsAllowedTo('post_new'); |
242 | 268 | if (empty($boards)) |
243 | - throw new Elk_Exception('cannot_post_new', 'user'); |
|
269 | + { |
|
270 | + throw new Elk_Exception('cannot_post_new', 'user'); |
|
271 | + } |
|
244 | 272 | |
245 | 273 | // Load a list of boards for this event in the context. |
246 | 274 | $boardListOptions = array( |
@@ -55,8 +55,9 @@ discard block |
||
55 | 55 | array('pre_save_post', array('Poll_Post_Module', 'pre_save_post'), array('topicOptions')), |
56 | 56 | )); |
57 | 57 | } |
58 | - else |
|
59 | - return $return; |
|
58 | + else { |
|
59 | + return $return; |
|
60 | + } |
|
60 | 61 | } |
61 | 62 | |
62 | 63 | /** |
@@ -104,9 +105,12 @@ discard block |
||
104 | 105 | |
105 | 106 | // It's a new reply |
106 | 107 | if (empty($_REQUEST['msg'])) |
107 | - $context['can_add_poll'] = false; |
|
108 | - else |
|
109 | - $context['can_add_poll'] = (allowedTo('poll_add_any') || (!empty($_REQUEST['msg']) && $topic_attributes['id_first_msg'] == $_REQUEST['msg'] && allowedTo('poll_add_own'))) && $topic_attributes['id_poll'] <= 0; |
|
108 | + { |
|
109 | + $context['can_add_poll'] = false; |
|
110 | + } |
|
111 | + else { |
|
112 | + $context['can_add_poll'] = (allowedTo('poll_add_any') || (!empty($_REQUEST['msg']) && $topic_attributes['id_first_msg'] == $_REQUEST['msg'] && allowedTo('poll_add_own'))) && $topic_attributes['id_poll'] <= 0; |
|
113 | + } |
|
110 | 114 | } |
111 | 115 | else |
112 | 116 | { |
@@ -125,13 +129,18 @@ discard block |
||
125 | 129 | { |
126 | 130 | // New topic, new poll. |
127 | 131 | if (empty($topic)) |
128 | - isAllowedTo('poll_post'); |
|
132 | + { |
|
133 | + isAllowedTo('poll_post'); |
|
134 | + } |
|
129 | 135 | // This is an old topic - but it is yours! Can you add to it? |
130 | 136 | elseif ($user_info['id'] == $topic_attributes['id_member'] && !allowedTo('poll_add_any')) |
131 | - isAllowedTo('poll_add_own'); |
|
137 | + { |
|
138 | + isAllowedTo('poll_add_own'); |
|
139 | + } |
|
132 | 140 | // If you're not the owner, can you add to any poll? |
133 | - else |
|
134 | - isAllowedTo('poll_add_any'); |
|
141 | + else { |
|
142 | + isAllowedTo('poll_add_any'); |
|
143 | + } |
|
135 | 144 | $context['can_moderate_poll'] = true; |
136 | 145 | |
137 | 146 | require_once(SUBSDIR . '/Members.subs.php'); |
@@ -197,7 +206,9 @@ discard block |
||
197 | 206 | { |
198 | 207 | // Sorry, multiple polls aren't allowed... yet. You should stop giving me ideas :P. |
199 | 208 | if (isset($_REQUEST['poll']) && $topic_info['id_poll'] > 0) |
200 | - $this->_unset_poll(); |
|
209 | + { |
|
210 | + $this->_unset_poll(); |
|
211 | + } |
|
201 | 212 | } |
202 | 213 | |
203 | 214 | /** |
@@ -214,20 +225,29 @@ discard block |
||
214 | 225 | |
215 | 226 | // Validate the poll... |
216 | 227 | if (!empty($topic_info) && !isset($_REQUEST['msg'])) |
217 | - throw new Elk_Exception('no_access', false); |
|
228 | + { |
|
229 | + throw new Elk_Exception('no_access', false); |
|
230 | + } |
|
218 | 231 | |
219 | 232 | // This is a new topic... so it's a new poll. |
220 | 233 | if (empty($topic_info)) |
221 | - isAllowedTo('poll_post'); |
|
234 | + { |
|
235 | + isAllowedTo('poll_post'); |
|
236 | + } |
|
222 | 237 | // Can you add to your own topics? |
223 | 238 | elseif ($user_info['id'] == $topic_info['id_member_started'] && !allowedTo('poll_add_any')) |
224 | - isAllowedTo('poll_add_own'); |
|
239 | + { |
|
240 | + isAllowedTo('poll_add_own'); |
|
241 | + } |
|
225 | 242 | // Can you add polls to any topic, then? |
226 | - else |
|
227 | - isAllowedTo('poll_add_any'); |
|
243 | + else { |
|
244 | + isAllowedTo('poll_add_any'); |
|
245 | + } |
|
228 | 246 | |
229 | 247 | if (!isset($_POST['question']) || trim($_POST['question']) == '') |
230 | - $post_errors->addError('no_question'); |
|
248 | + { |
|
249 | + $post_errors->addError('no_question'); |
|
250 | + } |
|
231 | 251 | |
232 | 252 | $_POST['options'] = empty($_POST['options']) ? array() : htmltrim__recursive($_POST['options']); |
233 | 253 | |
@@ -235,14 +255,20 @@ discard block |
||
235 | 255 | foreach ($_POST['options'] as $k => $option) |
236 | 256 | { |
237 | 257 | if ($option == '') |
238 | - unset($_POST['options'][$k], $_POST['options'][$k]); |
|
258 | + { |
|
259 | + unset($_POST['options'][$k], $_POST['options'][$k]); |
|
260 | + } |
|
239 | 261 | } |
240 | 262 | |
241 | 263 | // What are you going to vote between with one choice?!? |
242 | 264 | if (count($_POST['options']) < 2) |
243 | - $post_errors->addError('poll_few'); |
|
265 | + { |
|
266 | + $post_errors->addError('poll_few'); |
|
267 | + } |
|
244 | 268 | elseif (count($_POST['options']) > 256) |
245 | - $post_errors->addError('poll_many'); |
|
269 | + { |
|
270 | + $post_errors->addError('poll_many'); |
|
271 | + } |
|
246 | 272 | } |
247 | 273 | |
248 | 274 | /** |
@@ -255,9 +281,12 @@ discard block |
||
255 | 281 | { |
256 | 282 | // Make the poll... |
257 | 283 | if (self::$_make_poll) |
258 | - $id_poll = $this->_createPoll($_POST, $_POST['guestname']); |
|
259 | - else |
|
260 | - $id_poll = 0; |
|
284 | + { |
|
285 | + $id_poll = $this->_createPoll($_POST, $_POST['guestname']); |
|
286 | + } |
|
287 | + else { |
|
288 | + $id_poll = 0; |
|
289 | + } |
|
261 | 290 | |
262 | 291 | $topicOptions['poll'] = self::$_make_poll ? $id_poll : null; |
263 | 292 | } |
@@ -280,7 +309,9 @@ discard block |
||
280 | 309 | foreach ($_POST['options'] as $option) |
281 | 310 | { |
282 | 311 | if (trim($option) == '') |
283 | - continue; |
|
312 | + { |
|
313 | + continue; |
|
314 | + } |
|
284 | 315 | |
285 | 316 | $context['poll']['choices'][] = array( |
286 | 317 | 'id' => $choice_id++, |
@@ -340,20 +371,28 @@ discard block |
||
340 | 371 | |
341 | 372 | // Make sure that the user has not entered a ridiculous number of options.. |
342 | 373 | if (empty($options['poll_max_votes']) || $options['poll_max_votes'] <= 0) |
343 | - $poll_max_votes = 1; |
|
374 | + { |
|
375 | + $poll_max_votes = 1; |
|
376 | + } |
|
344 | 377 | elseif ($options['poll_max_votes'] > count($options['options'])) |
345 | - $poll_max_votes = count($options['options']); |
|
346 | - else |
|
347 | - $poll_max_votes = (int) $options['poll_max_votes']; |
|
378 | + { |
|
379 | + $poll_max_votes = count($options['options']); |
|
380 | + } |
|
381 | + else { |
|
382 | + $poll_max_votes = (int) $options['poll_max_votes']; |
|
383 | + } |
|
348 | 384 | |
349 | 385 | $poll_expire = (int) $options['poll_expire']; |
350 | 386 | $poll_expire = $poll_expire > 9999 ? 9999 : ($poll_expire < 0 ? 0 : $poll_expire); |
351 | 387 | |
352 | 388 | // Just set it to zero if it's not there.. |
353 | 389 | if (isset($options['poll_hide'])) |
354 | - $poll_hide = (int) $options['poll_hide']; |
|
355 | - else |
|
356 | - $poll_hide = 0; |
|
390 | + { |
|
391 | + $poll_hide = (int) $options['poll_hide']; |
|
392 | + } |
|
393 | + else { |
|
394 | + $poll_hide = 0; |
|
395 | + } |
|
357 | 396 | |
358 | 397 | $poll_change_vote = isset($options['poll_change_vote']) ? 1 : 0; |
359 | 398 | $poll_guest_vote = isset($options['poll_guest_vote']) ? 1 : 0; |
@@ -365,16 +404,22 @@ discard block |
||
365 | 404 | $allowedVoteGroups = groupsAllowedTo('poll_vote', $board); |
366 | 405 | |
367 | 406 | if (!in_array(-1, $allowedVoteGroups['allowed'])) |
368 | - $poll_guest_vote = 0; |
|
407 | + { |
|
408 | + $poll_guest_vote = 0; |
|
409 | + } |
|
369 | 410 | } |
370 | 411 | |
371 | 412 | // If the user tries to set the poll too far in advance, don't let them. |
372 | 413 | if (!empty($poll_expire) && $poll_expire < 1) |
373 | - // @todo this fatal error should not be here |
|
414 | + { |
|
415 | + // @todo this fatal error should not be here |
|
374 | 416 | throw new Elk_Exception('poll_range_error', false); |
417 | + } |
|
375 | 418 | // Don't allow them to select option 2 for hidden results if it's not time limited. |
376 | 419 | elseif (empty($poll_expire) && $poll_hide == 2) |
377 | - $poll_hide = 1; |
|
420 | + { |
|
421 | + $poll_hide = 1; |
|
422 | + } |
|
378 | 423 | |
379 | 424 | // Clean up the question and answers. |
380 | 425 | $question = htmlspecialchars($options['question'], ENT_COMPAT, 'UTF-8'); |
@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | array('prepare_save_post', array('Verification_Post_Module', 'prepare_save_post'), array('_post_errors')), |
40 | 40 | ); |
41 | 41 | } |
42 | - else |
|
43 | - return array(); |
|
42 | + else { |
|
43 | + return array(); |
|
44 | + } |
|
44 | 45 | } |
45 | 46 | |
46 | 47 | /** |
@@ -62,7 +63,9 @@ discard block |
||
62 | 63 | |
63 | 64 | // If they came from quick reply, and have to enter verification details, give them some notice. |
64 | 65 | if (!empty($_REQUEST['from_qr']) && $context['require_verification'] !== false) |
65 | - $_post_errors->addError('need_qr_verification'); |
|
66 | + { |
|
67 | + $_post_errors->addError('need_qr_verification'); |
|
68 | + } |
|
66 | 69 | } |
67 | 70 | |
68 | 71 | /** |
@@ -84,7 +87,9 @@ discard block |
||
84 | 87 | if (is_array($context['require_verification'])) |
85 | 88 | { |
86 | 89 | foreach ($context['require_verification'] as $verification_error) |
87 | - $_post_errors->addError($verification_error); |
|
90 | + { |
|
91 | + $_post_errors->addError($verification_error); |
|
92 | + } |
|
88 | 93 | } |
89 | 94 | } |
90 | 95 | } |
@@ -35,8 +35,9 @@ |
||
35 | 35 | array('topicinfo', array('Verification_Display_Module', 'topicinfo'), array()), |
36 | 36 | ); |
37 | 37 | } |
38 | - else |
|
39 | - return array(); |
|
38 | + else { |
|
39 | + return array(); |
|
40 | + } |
|
40 | 41 | } |
41 | 42 | |
42 | 43 | /** |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | array('before_sending', array('Verification_PersonalMessage_Module', 'before_sending'), array('post_errors')), |
41 | 41 | ); |
42 | 42 | } |
43 | - else |
|
44 | - return array(); |
|
43 | + else { |
|
44 | + return array(); |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | |
47 | 48 | /** |
@@ -72,7 +73,9 @@ discard block |
||
72 | 73 | global $context; |
73 | 74 | |
74 | 75 | if (isset($_REQUEST['xml'])) |
75 | - return; |
|
76 | + { |
|
77 | + return; |
|
78 | + } |
|
76 | 79 | |
77 | 80 | // Wrong verification code? |
78 | 81 | $verificationOptions = array( |
@@ -83,7 +86,9 @@ discard block |
||
83 | 86 | if (is_array($context['require_verification'])) |
84 | 87 | { |
85 | 88 | foreach ($context['require_verification'] as $error) |
86 | - $post_errors->addError($error); |
|
89 | + { |
|
90 | + $post_errors->addError($error); |
|
91 | + } |
|
87 | 92 | } |
88 | 93 | } |
89 | 94 | } |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | array('setup_contact', array('Verification_Register_Module', 'setup_contact'), array()), |
41 | 41 | ); |
42 | 42 | } |
43 | - else |
|
44 | - return array(); |
|
43 | + else { |
|
44 | + return array(); |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | |
47 | 48 | /** |
@@ -64,8 +65,9 @@ discard block |
||
64 | 65 | $context['visual_verification_id'] = $verificationOptions['id']; |
65 | 66 | } |
66 | 67 | // Otherwise we have nothing to show. |
67 | - else |
|
68 | - $context['visual_verification'] = false; |
|
68 | + else { |
|
69 | + $context['visual_verification'] = false; |
|
70 | + } |
|
69 | 71 | } |
70 | 72 | |
71 | 73 | /** |
@@ -87,7 +89,9 @@ discard block |
||
87 | 89 | if (is_array($context['visual_verification'])) |
88 | 90 | { |
89 | 91 | foreach ($context['visual_verification'] as $error) |
90 | - $reg_errors->addError($error); |
|
92 | + { |
|
93 | + $reg_errors->addError($error); |
|
94 | + } |
|
91 | 95 | } |
92 | 96 | } |
93 | 97 | |
@@ -107,7 +111,9 @@ discard block |
||
107 | 111 | if (is_array($context['require_verification'])) |
108 | 112 | { |
109 | 113 | foreach ($context['require_verification'] as $error) |
110 | - $context['errors'][] = $txt['error_' . $error]; |
|
114 | + { |
|
115 | + $context['errors'][] = $txt['error_' . $error]; |
|
116 | + } |
|
111 | 117 | } |
112 | 118 | } |
113 | 119 |