@@ -20,7 +20,7 @@ |
||
20 | 20 | class GroupReq_Notify_Background extends SMF_BackgroundTask |
21 | 21 | { |
22 | 22 | /** |
23 | - * This executes the task - loads up the information, puts the email in the queue and inserts any alerts as needed. |
|
23 | + * This executes the task - loads up the information, puts the email in the queue and inserts any alerts as needed. |
|
24 | 24 | * @return bool Always returns true. |
25 | 25 | */ |
26 | 26 | public function execute() |
@@ -37,8 +37,9 @@ discard block |
||
37 | 37 | ) |
38 | 38 | ); |
39 | 39 | $moderators = array(); |
40 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
41 | - $moderators[] = $row['id_member']; |
|
40 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
41 | + $moderators[] = $row['id_member']; |
|
42 | + } |
|
42 | 43 | $smcFunc['db_free_result']($request); |
43 | 44 | |
44 | 45 | require_once($sourcedir . '/Subs-Members.php'); |
@@ -59,11 +60,13 @@ discard block |
||
59 | 60 | { |
60 | 61 | if (!empty($prefs[$mod]['request_group'])) |
61 | 62 | { |
62 | - if ($prefs[$mod]['request_group'] & 0x01) |
|
63 | - $data['alert'][] = $mod; |
|
63 | + if ($prefs[$mod]['request_group'] & 0x01) { |
|
64 | + $data['alert'][] = $mod; |
|
65 | + } |
|
64 | 66 | |
65 | - if ($prefs[$mod]['request_group'] & 0x02) |
|
66 | - $data['email'][] = $mod; |
|
67 | + if ($prefs[$mod]['request_group'] & 0x02) { |
|
68 | + $data['email'][] = $mod; |
|
69 | + } |
|
67 | 70 | } |
68 | 71 | } |
69 | 72 |
@@ -240,8 +240,8 @@ |
||
240 | 240 | $time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
241 | 241 | |
242 | 242 | $js_time_string = str_replace( |
243 | - array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r', '%R', '%S', '%T', '%X'), |
|
244 | - array('H', 'G', 'h', 'g', 'i', 'A', 'a', 'h:i:s A', 'H:i', 's', 'H:i:s', 'H:i:s'), |
|
243 | + array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r', '%R', '%S', '%T', '%X'), |
|
244 | + array('H', 'G', 'h', 'g', 'i', 'A', 'a', 'h:i:s A', 'H:i', 's', 'H:i:s', 'H:i:s'), |
|
245 | 245 | $time_string |
246 | 246 | ); |
247 | 247 |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 4 |
15 | 15 | */ |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * Show the calendar. |
@@ -47,12 +48,14 @@ discard block |
||
47 | 48 | 'post' => 'CalendarPost', |
48 | 49 | ); |
49 | 50 | |
50 | - if (isset($_GET['sa']) && isset($subActions[$_GET['sa']])) |
|
51 | - return call_helper($subActions[$_GET['sa']]); |
|
51 | + if (isset($_GET['sa']) && isset($subActions[$_GET['sa']])) { |
|
52 | + return call_helper($subActions[$_GET['sa']]); |
|
53 | + } |
|
52 | 54 | |
53 | 55 | // You can't do anything if the calendar is off. |
54 | - if (empty($modSettings['cal_enabled'])) |
|
55 | - fatal_lang_error('calendar_off', false); |
|
56 | + if (empty($modSettings['cal_enabled'])) { |
|
57 | + fatal_lang_error('calendar_off', false); |
|
58 | + } |
|
56 | 59 | |
57 | 60 | // This is gonna be needed... |
58 | 61 | loadTemplate('Calendar'); |
@@ -88,22 +91,25 @@ discard block |
||
88 | 91 | $context['page_title'] = $txt['calendar']; |
89 | 92 | |
90 | 93 | // Ensure a default view is defined |
91 | - if (empty($modSettings['calendar_default_view'])) |
|
92 | - $modSettings['calendar_default_view'] = 'viewlist'; |
|
94 | + if (empty($modSettings['calendar_default_view'])) { |
|
95 | + $modSettings['calendar_default_view'] = 'viewlist'; |
|
96 | + } |
|
93 | 97 | |
94 | 98 | // What view do we want? |
95 | - if (isset($_GET['viewweek'])) |
|
96 | - $context['calendar_view'] = 'viewweek'; |
|
97 | - elseif (isset($_GET['viewmonth'])) |
|
98 | - $context['calendar_view'] = 'viewmonth'; |
|
99 | - elseif (isset($_GET['viewlist'])) |
|
100 | - $context['calendar_view'] = 'viewlist'; |
|
101 | - else |
|
102 | - $context['calendar_view'] = $modSettings['calendar_default_view']; |
|
99 | + if (isset($_GET['viewweek'])) { |
|
100 | + $context['calendar_view'] = 'viewweek'; |
|
101 | + } elseif (isset($_GET['viewmonth'])) { |
|
102 | + $context['calendar_view'] = 'viewmonth'; |
|
103 | + } elseif (isset($_GET['viewlist'])) { |
|
104 | + $context['calendar_view'] = 'viewlist'; |
|
105 | + } else { |
|
106 | + $context['calendar_view'] = $modSettings['calendar_default_view']; |
|
107 | + } |
|
103 | 108 | |
104 | 109 | // Don't let search engines index the non-default calendar pages |
105 | - if ($context['calendar_view'] !== $modSettings['calendar_default_view']) |
|
106 | - $context['robot_no_index'] = true; |
|
110 | + if ($context['calendar_view'] !== $modSettings['calendar_default_view']) { |
|
111 | + $context['robot_no_index'] = true; |
|
112 | + } |
|
107 | 113 | |
108 | 114 | // Get the current day of month... |
109 | 115 | require_once($sourcedir . '/Subs-Calendar.php'); |
@@ -164,16 +170,19 @@ discard block |
||
164 | 170 | ); |
165 | 171 | |
166 | 172 | // Make sure the year and month are in valid ranges. |
167 | - if ($curPage['month'] < 1 || $curPage['month'] > 12) |
|
168 | - fatal_lang_error('invalid_month', false); |
|
169 | - if ($curPage['year'] < $modSettings['cal_minyear'] || $curPage['year'] > $modSettings['cal_maxyear']) |
|
170 | - fatal_lang_error('invalid_year', false); |
|
173 | + if ($curPage['month'] < 1 || $curPage['month'] > 12) { |
|
174 | + fatal_lang_error('invalid_month', false); |
|
175 | + } |
|
176 | + if ($curPage['year'] < $modSettings['cal_minyear'] || $curPage['year'] > $modSettings['cal_maxyear']) { |
|
177 | + fatal_lang_error('invalid_year', false); |
|
178 | + } |
|
171 | 179 | // If we have a day clean that too. |
172 | 180 | if ($context['calendar_view'] != 'viewmonth') |
173 | 181 | { |
174 | 182 | $isValid = checkdate($curPage['month'], $curPage['day'], $curPage['year']); |
175 | - if (!$isValid) |
|
176 | - fatal_lang_error('invalid_day', false); |
|
183 | + if (!$isValid) { |
|
184 | + fatal_lang_error('invalid_day', false); |
|
185 | + } |
|
177 | 186 | } |
178 | 187 | |
179 | 188 | // Load all the context information needed to show the calendar grid. |
@@ -195,23 +204,26 @@ discard block |
||
195 | 204 | ); |
196 | 205 | |
197 | 206 | // Load up the main view. |
198 | - if ($context['calendar_view'] == 'viewlist') |
|
199 | - $context['calendar_grid_main'] = getCalendarList($curPage['start_date'], $curPage['end_date'], $calendarOptions); |
|
200 | - elseif ($context['calendar_view'] == 'viewweek') |
|
201 | - $context['calendar_grid_main'] = getCalendarWeek($curPage['month'], $curPage['year'], $curPage['day'], $calendarOptions); |
|
202 | - else |
|
203 | - $context['calendar_grid_main'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions); |
|
207 | + if ($context['calendar_view'] == 'viewlist') { |
|
208 | + $context['calendar_grid_main'] = getCalendarList($curPage['start_date'], $curPage['end_date'], $calendarOptions); |
|
209 | + } elseif ($context['calendar_view'] == 'viewweek') { |
|
210 | + $context['calendar_grid_main'] = getCalendarWeek($curPage['month'], $curPage['year'], $curPage['day'], $calendarOptions); |
|
211 | + } else { |
|
212 | + $context['calendar_grid_main'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions); |
|
213 | + } |
|
204 | 214 | |
205 | 215 | // Load up the previous and next months. |
206 | 216 | $context['calendar_grid_current'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions); |
207 | 217 | |
208 | 218 | // Only show previous month if it isn't pre-January of the min-year |
209 | - if ($context['calendar_grid_current']['previous_calendar']['year'] > $modSettings['cal_minyear'] || $curPage['month'] != 1) |
|
210 | - $context['calendar_grid_prev'] = getCalendarGrid($context['calendar_grid_current']['previous_calendar']['month'], $context['calendar_grid_current']['previous_calendar']['year'], $calendarOptions, true); |
|
219 | + if ($context['calendar_grid_current']['previous_calendar']['year'] > $modSettings['cal_minyear'] || $curPage['month'] != 1) { |
|
220 | + $context['calendar_grid_prev'] = getCalendarGrid($context['calendar_grid_current']['previous_calendar']['month'], $context['calendar_grid_current']['previous_calendar']['year'], $calendarOptions, true); |
|
221 | + } |
|
211 | 222 | |
212 | 223 | // Only show next month if it isn't post-December of the max-year |
213 | - if ($context['calendar_grid_current']['next_calendar']['year'] < $modSettings['cal_maxyear'] || $curPage['month'] != 12) |
|
214 | - $context['calendar_grid_next'] = getCalendarGrid($context['calendar_grid_current']['next_calendar']['month'], $context['calendar_grid_current']['next_calendar']['year'], $calendarOptions); |
|
224 | + if ($context['calendar_grid_current']['next_calendar']['year'] < $modSettings['cal_maxyear'] || $curPage['month'] != 12) { |
|
225 | + $context['calendar_grid_next'] = getCalendarGrid($context['calendar_grid_current']['next_calendar']['month'], $context['calendar_grid_current']['next_calendar']['year'], $calendarOptions); |
|
226 | + } |
|
215 | 227 | |
216 | 228 | // Basic template stuff. |
217 | 229 | $context['allow_calendar_event'] = allowedTo('calendar_post'); |
@@ -231,8 +243,9 @@ discard block |
||
231 | 243 | $context['blocks_disabled'] = !empty($modSettings['cal_disable_prev_next']) ? 1 : 0; |
232 | 244 | |
233 | 245 | // Set the page title to mention the month or week, too |
234 | - if ($context['calendar_view'] != 'viewlist') |
|
235 | - $context['page_title'] .= ' - ' . ($context['calendar_view'] == 'viewweek' ? $context['calendar_grid_main']['week_title'] : $txt['months'][$context['current_month']] . ' ' . $context['current_year']); |
|
246 | + if ($context['calendar_view'] != 'viewlist') { |
|
247 | + $context['page_title'] .= ' - ' . ($context['calendar_view'] == 'viewweek' ? $context['calendar_grid_main']['week_title'] : $txt['months'][$context['current_month']] . ' ' . $context['current_year']); |
|
248 | + } |
|
236 | 249 | |
237 | 250 | // Load up the linktree! |
238 | 251 | $context['linktree'][] = array( |
@@ -245,17 +258,19 @@ discard block |
||
245 | 258 | 'name' => $txt['months'][$context['current_month']] . ' ' . $context['current_year'] |
246 | 259 | ); |
247 | 260 | // If applicable, add the current week to the linktree. |
248 | - if ($context['calendar_view'] == 'viewweek') |
|
249 | - $context['linktree'][] = array( |
|
261 | + if ($context['calendar_view'] == 'viewweek') { |
|
262 | + $context['linktree'][] = array( |
|
250 | 263 | 'url' => $scripturl . '?action=calendar;viewweek;year=' . $context['current_year'] . ';month=' . $context['current_month'] . ';day=' . $context['current_day'], |
251 | 264 | 'name' => $context['calendar_grid_main']['week_title'], |
252 | 265 | ); |
266 | + } |
|
253 | 267 | |
254 | 268 | // Build the calendar button array. |
255 | 269 | $context['calendar_buttons'] = array(); |
256 | 270 | |
257 | - if ($context['can_post']) |
|
258 | - $context['calendar_buttons']['post_event'] = array('text' => 'calendar_post_event', 'image' => 'calendarpe.png', 'url' => $scripturl . '?action=calendar;sa=post;month=' . $context['current_month'] . ';year=' . $context['current_year'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
271 | + if ($context['can_post']) { |
|
272 | + $context['calendar_buttons']['post_event'] = array('text' => 'calendar_post_event', 'image' => 'calendarpe.png', 'url' => $scripturl . '?action=calendar;sa=post;month=' . $context['current_month'] . ';year=' . $context['current_year'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
273 | + } |
|
259 | 274 | |
260 | 275 | // Allow mods to add additional buttons here |
261 | 276 | call_integration_hook('integrate_calendar_buttons'); |
@@ -284,14 +299,16 @@ discard block |
||
284 | 299 | require_once($sourcedir . '/Subs.php'); |
285 | 300 | |
286 | 301 | // Cast this for safety... |
287 | - if (isset($_REQUEST['eventid'])) |
|
288 | - $_REQUEST['eventid'] = (int) $_REQUEST['eventid']; |
|
302 | + if (isset($_REQUEST['eventid'])) { |
|
303 | + $_REQUEST['eventid'] = (int) $_REQUEST['eventid']; |
|
304 | + } |
|
289 | 305 | |
290 | 306 | // We want a fairly compact version of the time, but as close as possible to the user's settings. |
291 | - if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
292 | - $time_string = '%k:%M'; |
|
293 | - else |
|
294 | - $time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
|
307 | + if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
308 | + $time_string = '%k:%M'; |
|
309 | + } else { |
|
310 | + $time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
|
311 | + } |
|
295 | 312 | |
296 | 313 | $js_time_string = str_replace( |
297 | 314 | array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r', '%R', '%S', '%T', '%X'), |
@@ -305,12 +322,14 @@ discard block |
||
305 | 322 | checkSession(); |
306 | 323 | |
307 | 324 | // Validate the post... |
308 | - if (!isset($_POST['link_to_board'])) |
|
309 | - validateEventPost(); |
|
325 | + if (!isset($_POST['link_to_board'])) { |
|
326 | + validateEventPost(); |
|
327 | + } |
|
310 | 328 | |
311 | 329 | // If you're not allowed to edit any events, you have to be the poster. |
312 | - if ($_REQUEST['eventid'] > 0 && !allowedTo('calendar_edit_any')) |
|
313 | - isAllowedTo('calendar_edit_' . (!empty($user_info['id']) && getEventPoster($_REQUEST['eventid']) == $user_info['id'] ? 'own' : 'any')); |
|
330 | + if ($_REQUEST['eventid'] > 0 && !allowedTo('calendar_edit_any')) { |
|
331 | + isAllowedTo('calendar_edit_' . (!empty($user_info['id']) && getEventPoster($_REQUEST['eventid']) == $user_info['id'] ? 'own' : 'any')); |
|
332 | + } |
|
314 | 333 | |
315 | 334 | // New - and directing? |
316 | 335 | if (isset($_POST['link_to_board']) || empty($modSettings['cal_allow_unlinked'])) |
@@ -333,8 +352,9 @@ discard block |
||
333 | 352 | } |
334 | 353 | |
335 | 354 | // Deleting... |
336 | - elseif (isset($_REQUEST['deleteevent'])) |
|
337 | - removeEvent($_REQUEST['eventid']); |
|
355 | + elseif (isset($_REQUEST['deleteevent'])) { |
|
356 | + removeEvent($_REQUEST['eventid']); |
|
357 | + } |
|
338 | 358 | |
339 | 359 | // ... or just update it? |
340 | 360 | else |
@@ -357,15 +377,13 @@ discard block |
||
357 | 377 | $year = $d['year']; |
358 | 378 | $month = $d['month']; |
359 | 379 | $day = $d['day']; |
360 | - } |
|
361 | - elseif (isset($_POST['start_datetime'])) |
|
380 | + } elseif (isset($_POST['start_datetime'])) |
|
362 | 381 | { |
363 | 382 | $d = date_parse($_POST['start_datetime']); |
364 | 383 | $year = $d['year']; |
365 | 384 | $month = $d['month']; |
366 | 385 | $day = $d['day']; |
367 | - } |
|
368 | - else |
|
386 | + } else |
|
369 | 387 | { |
370 | 388 | $today = getdate(); |
371 | 389 | $year = isset($_POST['year']) ? $_POST['year'] : $today['year']; |
@@ -399,13 +417,13 @@ discard block |
||
399 | 417 | $context['event'] = array_merge($context['event'], $eventDatetimes); |
400 | 418 | |
401 | 419 | $context['event']['last_day'] = (int) strftime('%d', mktime(0, 0, 0, $context['event']['month'] == 12 ? 1 : $context['event']['month'] + 1, 0, $context['event']['month'] == 12 ? $context['event']['year'] + 1 : $context['event']['year'])); |
402 | - } |
|
403 | - else |
|
420 | + } else |
|
404 | 421 | { |
405 | 422 | $context['event'] = getEventProperties($_REQUEST['eventid']); |
406 | 423 | |
407 | - if ($context['event'] === false) |
|
408 | - fatal_lang_error('no_access', false); |
|
424 | + if ($context['event'] === false) { |
|
425 | + fatal_lang_error('no_access', false); |
|
426 | + } |
|
409 | 427 | |
410 | 428 | // If it has a board, then they should be editing it within the topic. |
411 | 429 | if (!empty($context['event']['topic']['id']) && !empty($context['event']['topic']['first_msg'])) |
@@ -416,10 +434,11 @@ discard block |
||
416 | 434 | } |
417 | 435 | |
418 | 436 | // Make sure the user is allowed to edit this event. |
419 | - if ($context['event']['member'] != $user_info['id']) |
|
420 | - isAllowedTo('calendar_edit_any'); |
|
421 | - elseif (!allowedTo('calendar_edit_any')) |
|
422 | - isAllowedTo('calendar_edit_own'); |
|
437 | + if ($context['event']['member'] != $user_info['id']) { |
|
438 | + isAllowedTo('calendar_edit_any'); |
|
439 | + } elseif (!allowedTo('calendar_edit_any')) { |
|
440 | + isAllowedTo('calendar_edit_own'); |
|
441 | + } |
|
423 | 442 | } |
424 | 443 | |
425 | 444 | // An all day event? Set up some nice defaults in case the user wants to change that |
@@ -453,8 +472,7 @@ discard block |
||
453 | 472 | { |
454 | 473 | // You can post new events but can't link them to anything... |
455 | 474 | $context['event']['categories'] = array(); |
456 | - } |
|
457 | - else |
|
475 | + } else |
|
458 | 476 | { |
459 | 477 | // Load the list of boards and categories in the context. |
460 | 478 | require_once($sourcedir . '/Subs-MessageIndex.php'); |
@@ -541,12 +559,14 @@ discard block |
||
541 | 559 | global $smcFunc, $sourcedir, $forum_version, $modSettings, $webmaster_email, $mbname; |
542 | 560 | |
543 | 561 | // You can't export if the calendar export feature is off. |
544 | - if (empty($modSettings['cal_export'])) |
|
545 | - fatal_lang_error('calendar_export_off', false); |
|
562 | + if (empty($modSettings['cal_export'])) { |
|
563 | + fatal_lang_error('calendar_export_off', false); |
|
564 | + } |
|
546 | 565 | |
547 | 566 | // Goes without saying that this is required. |
548 | - if (!isset($_REQUEST['eventid'])) |
|
549 | - fatal_lang_error('no_access', false); |
|
567 | + if (!isset($_REQUEST['eventid'])) { |
|
568 | + fatal_lang_error('no_access', false); |
|
569 | + } |
|
550 | 570 | |
551 | 571 | // This is kinda wanted. |
552 | 572 | require_once($sourcedir . '/Subs-Calendar.php'); |
@@ -554,15 +574,17 @@ discard block |
||
554 | 574 | // Load up the event in question and check it exists. |
555 | 575 | $event = getEventProperties($_REQUEST['eventid']); |
556 | 576 | |
557 | - if ($event === false) |
|
558 | - fatal_lang_error('no_access', false); |
|
577 | + if ($event === false) { |
|
578 | + fatal_lang_error('no_access', false); |
|
579 | + } |
|
559 | 580 | |
560 | 581 | // Check the title isn't too long - iCal requires some formatting if so. |
561 | 582 | $title = str_split($event['title'], 30); |
562 | 583 | foreach ($title as $id => $line) |
563 | 584 | { |
564 | - if ($id != 0) |
|
565 | - $title[$id] = ' ' . $title[$id]; |
|
585 | + if ($id != 0) { |
|
586 | + $title[$id] = ' ' . $title[$id]; |
|
587 | + } |
|
566 | 588 | $title[$id] .= "\n"; |
567 | 589 | } |
568 | 590 | |
@@ -575,8 +597,7 @@ discard block |
||
575 | 597 | { |
576 | 598 | $datestart = date_format($start_date, 'Ymd\THis'); |
577 | 599 | $dateend = date_format($end_date, 'Ymd\THis'); |
578 | - } |
|
579 | - else |
|
600 | + } else |
|
580 | 601 | { |
581 | 602 | $datestart = date_format($start_date, 'Ymd'); |
582 | 603 | |
@@ -597,15 +618,18 @@ discard block |
||
597 | 618 | $filecontents .= 'DTSTART' . (!empty($event['start_time']) ? ';TZID=' . $event['tz'] : ';VALUE=DATE') . ':' . $datestart . "\n"; |
598 | 619 | |
599 | 620 | // event has a duration |
600 | - if ($event['start_iso_gmdate'] != $event['end_iso_gmdate']) |
|
601 | - $filecontents .= 'DTEND' . (!empty($event['end_time']) ? ';TZID=' . $event['tz'] : ';VALUE=DATE') . ':' . $dateend . "\n"; |
|
621 | + if ($event['start_iso_gmdate'] != $event['end_iso_gmdate']) { |
|
622 | + $filecontents .= 'DTEND' . (!empty($event['end_time']) ? ';TZID=' . $event['tz'] : ';VALUE=DATE') . ':' . $dateend . "\n"; |
|
623 | + } |
|
602 | 624 | |
603 | 625 | // event has changed? advance the sequence for this UID |
604 | - if ($event['sequence'] > 0) |
|
605 | - $filecontents .= 'SEQUENCE:' . $event['sequence'] . "\n"; |
|
626 | + if ($event['sequence'] > 0) { |
|
627 | + $filecontents .= 'SEQUENCE:' . $event['sequence'] . "\n"; |
|
628 | + } |
|
606 | 629 | |
607 | - if (!empty($event['location'])) |
|
608 | - $filecontents .= 'LOCATION:' . str_replace(',', '\,', $event['location']) . "\n"; |
|
630 | + if (!empty($event['location'])) { |
|
631 | + $filecontents .= 'LOCATION:' . str_replace(',', '\,', $event['location']) . "\n"; |
|
632 | + } |
|
609 | 633 | |
610 | 634 | $filecontents .= 'SUMMARY:' . implode('', $title); |
611 | 635 | $filecontents .= 'UID:' . $event['eventid'] . '@' . str_replace(' ', '-', $mbname) . "\n"; |
@@ -614,23 +638,26 @@ discard block |
||
614 | 638 | |
615 | 639 | // Send some standard headers. |
616 | 640 | ob_end_clean(); |
617 | - if (!empty($modSettings['enableCompressedOutput'])) |
|
618 | - @ob_start('ob_gzhandler'); |
|
619 | - else |
|
620 | - ob_start(); |
|
641 | + if (!empty($modSettings['enableCompressedOutput'])) { |
|
642 | + @ob_start('ob_gzhandler'); |
|
643 | + } else { |
|
644 | + ob_start(); |
|
645 | + } |
|
621 | 646 | |
622 | 647 | // Send the file headers |
623 | 648 | header('Pragma: '); |
624 | 649 | header('Cache-Control: no-cache'); |
625 | - if (!isBrowser('gecko')) |
|
626 | - header('Content-Transfer-Encoding: binary'); |
|
650 | + if (!isBrowser('gecko')) { |
|
651 | + header('Content-Transfer-Encoding: binary'); |
|
652 | + } |
|
627 | 653 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT'); |
628 | 654 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . 'GMT'); |
629 | 655 | header('Accept-Ranges: bytes'); |
630 | 656 | header('Connection: close'); |
631 | 657 | header('Content-Disposition: attachment; filename="' . $event['title'] . '.ics"'); |
632 | - if (empty($modSettings['enableCompressedOutput'])) |
|
633 | - header('Content-Length: ' . $smcFunc['strlen']($filecontents)); |
|
658 | + if (empty($modSettings['enableCompressedOutput'])) { |
|
659 | + header('Content-Length: ' . $smcFunc['strlen']($filecontents)); |
|
660 | + } |
|
634 | 661 | |
635 | 662 | // This is a calendar item! |
636 | 663 | header('Content-Type: text/calendar'); |
@@ -669,20 +696,17 @@ discard block |
||
669 | 696 | $context['sub_template'] = 'bcd'; |
670 | 697 | $context['linktree'][] = array('url' => $scripturl . '?action=clock;bcd', 'name' => 'BCD'); |
671 | 698 | $context['clockicons'] = $smcFunc['json_decode'](base64_decode('eyJoMSI6WzIsMV0sImgyIjpbOCw0LDIsMV0sIm0xIjpbNCwyLDFdLCJtMiI6WzgsNCwyLDFdLCJzMSI6WzQsMiwxXSwiczIiOls4LDQsMiwxXX0='), true); |
672 | - } |
|
673 | - elseif (!$omfg && !isset($_REQUEST['time'])) |
|
699 | + } elseif (!$omfg && !isset($_REQUEST['time'])) |
|
674 | 700 | { |
675 | 701 | $context['sub_template'] = 'hms'; |
676 | 702 | $context['linktree'][] = array('url' => $scripturl . '?action=clock', 'name' => 'Binary'); |
677 | 703 | $context['clockicons'] = $smcFunc['json_decode'](base64_decode('eyJoIjpbMTYsOCw0LDIsMV0sIm0iOlszMiwxNiw4LDQsMiwxXSwicyI6WzMyLDE2LDgsNCwyLDFdfQ'), true); |
678 | - } |
|
679 | - elseif ($omfg) |
|
704 | + } elseif ($omfg) |
|
680 | 705 | { |
681 | 706 | $context['sub_template'] = 'omfg'; |
682 | 707 | $context['linktree'][] = array('url' => $scripturl . '?action=clock;omfg', 'name' => 'OMFG'); |
683 | 708 | $context['clockicons'] = $smcFunc['json_decode'](base64_decode('eyJ5ZWFyIjpbNjQsMzIsMTYsOCw0LDIsMV0sIm1vbnRoIjpbOCw0LDIsMV0sImRheSI6WzE2LDgsNCwyLDFdLCJob3VyIjpbMTYsOCw0LDIsMV0sIm1pbiI6WzMyLDE2LDgsNCwyLDFdLCJzZWMiOlszMiwxNiw4LDQsMiwxXX0='), true); |
684 | - } |
|
685 | - elseif (isset($_REQUEST['time'])) |
|
709 | + } elseif (isset($_REQUEST['time'])) |
|
686 | 710 | { |
687 | 711 | $context['sub_template'] = 'thetime'; |
688 | 712 | $time = getdate($_REQUEST['time'] == 'now' ? time() : (int) $_REQUEST['time']); |
@@ -736,12 +760,13 @@ discard block |
||
736 | 760 | ), |
737 | 761 | ); |
738 | 762 | |
739 | - foreach ($context['clockicons'] as $t => $vs) |
|
740 | - foreach ($vs as $v => $dumb) |
|
763 | + foreach ($context['clockicons'] as $t => $vs) { |
|
764 | + foreach ($vs as $v => $dumb) |
|
741 | 765 | { |
742 | 766 | if ($$t >= $v) |
743 | 767 | { |
744 | 768 | $$t -= $v; |
769 | + } |
|
745 | 770 | $context['clockicons'][$t][$v] = true; |
746 | 771 | } |
747 | 772 | } |
@@ -1622,8 +1622,7 @@ |
||
1622 | 1622 | updateStats('topic'); |
1623 | 1623 | |
1624 | 1624 | // This function is needed to do the updateStats('subject') call. |
1625 | - $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
|
1626 | - function($string){ |
|
1625 | + $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
|
1627 | 1626 | global $sourcedir; |
1628 | 1627 | if (function_exists('mb_strtolower')) |
1629 | 1628 | return mb_strtolower($string, 'UTF-8'); |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | // ><html dir="ltr"><head><title>Error!</title></head><body>Sorry, this installer requires PHP!<div style="display: none;"> |
21 | 21 | |
22 | 22 | // Let's pull in useful classes |
23 | -if (!defined('SMF')) |
|
23 | +if (!defined('SMF')) { |
|
24 | 24 | define('SMF', 1); |
25 | +} |
|
25 | 26 | |
26 | 27 | require_once('Sources/Class-Package.php'); |
27 | 28 | |
@@ -63,10 +64,11 @@ discard block |
||
63 | 64 | |
64 | 65 | list ($charcode) = pg_fetch_row($request); |
65 | 66 | |
66 | - if ($charcode == 'UTF8') |
|
67 | - return true; |
|
68 | - else |
|
69 | - return false; |
|
67 | + if ($charcode == 'UTF8') { |
|
68 | + return true; |
|
69 | + } else { |
|
70 | + return false; |
|
71 | + } |
|
70 | 72 | }, |
71 | 73 | 'utf8_version' => '8.0', |
72 | 74 | 'utf8_version_check' => '$request = pg_query(\'SELECT version()\'); list ($version) = pg_fetch_row($request); list($pgl, $version) = explode(" ", $version); return $version;', |
@@ -76,12 +78,14 @@ discard block |
||
76 | 78 | $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); |
77 | 79 | |
78 | 80 | // Is it reserved? |
79 | - if ($value == 'pg_') |
|
80 | - return $txt['error_db_prefix_reserved']; |
|
81 | + if ($value == 'pg_') { |
|
82 | + return $txt['error_db_prefix_reserved']; |
|
83 | + } |
|
81 | 84 | |
82 | 85 | // Is the prefix numeric? |
83 | - if (preg_match('~^\d~', $value)) |
|
84 | - return $txt['error_db_prefix_numeric']; |
|
86 | + if (preg_match('~^\d~', $value)) { |
|
87 | + return $txt['error_db_prefix_numeric']; |
|
88 | + } |
|
85 | 89 | |
86 | 90 | return true; |
87 | 91 | }, |
@@ -128,10 +132,11 @@ discard block |
||
128 | 132 | $incontext['skip'] = false; |
129 | 133 | |
130 | 134 | // Call the step and if it returns false that means pause! |
131 | - if (function_exists($step[2]) && $step[2]() === false) |
|
132 | - break; |
|
133 | - elseif (function_exists($step[2])) |
|
134 | - $incontext['current_step']++; |
|
135 | + if (function_exists($step[2]) && $step[2]() === false) { |
|
136 | + break; |
|
137 | + } elseif (function_exists($step[2])) { |
|
138 | + $incontext['current_step']++; |
|
139 | + } |
|
135 | 140 | |
136 | 141 | // No warnings pass on. |
137 | 142 | $incontext['warning'] = ''; |
@@ -147,8 +152,9 @@ discard block |
||
147 | 152 | global $databases; |
148 | 153 | |
149 | 154 | // Just so people using older versions of PHP aren't left in the cold. |
150 | - if (!isset($_SERVER['PHP_SELF'])) |
|
151 | - $_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php'; |
|
155 | + if (!isset($_SERVER['PHP_SELF'])) { |
|
156 | + $_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php'; |
|
157 | + } |
|
152 | 158 | |
153 | 159 | // Enable error reporting for fatal errors. |
154 | 160 | error_reporting(E_ERROR | E_PARSE); |
@@ -164,21 +170,23 @@ discard block |
||
164 | 170 | { |
165 | 171 | ob_start(); |
166 | 172 | |
167 | - if (ini_get('session.save_handler') == 'user') |
|
168 | - @ini_set('session.save_handler', 'files'); |
|
169 | - if (function_exists('session_start')) |
|
170 | - @session_start(); |
|
171 | - } |
|
172 | - else |
|
173 | + if (ini_get('session.save_handler') == 'user') { |
|
174 | + @ini_set('session.save_handler', 'files'); |
|
175 | + } |
|
176 | + if (function_exists('session_start')) { |
|
177 | + @session_start(); |
|
178 | + } |
|
179 | + } else |
|
173 | 180 | { |
174 | 181 | ob_start('ob_gzhandler'); |
175 | 182 | |
176 | - if (ini_get('session.save_handler') == 'user') |
|
177 | - @ini_set('session.save_handler', 'files'); |
|
183 | + if (ini_get('session.save_handler') == 'user') { |
|
184 | + @ini_set('session.save_handler', 'files'); |
|
185 | + } |
|
178 | 186 | session_start(); |
179 | 187 | |
180 | - if (!headers_sent()) |
|
181 | - echo '<!DOCTYPE html> |
|
188 | + if (!headers_sent()) { |
|
189 | + echo '<!DOCTYPE html> |
|
182 | 190 | <html> |
183 | 191 | <head> |
184 | 192 | <title>', htmlspecialchars($_GET['pass_string']), '</title> |
@@ -187,14 +195,16 @@ discard block |
||
187 | 195 | <strong>', htmlspecialchars($_GET['pass_string']), '</strong> |
188 | 196 | </body> |
189 | 197 | </html>'; |
198 | + } |
|
190 | 199 | exit; |
191 | 200 | } |
192 | 201 | |
193 | 202 | // Add slashes, as long as they aren't already being added. |
194 | - if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) |
|
195 | - foreach ($_POST as $k => $v) |
|
203 | + if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) { |
|
204 | + foreach ($_POST as $k => $v) |
|
196 | 205 | if (strpos($k, 'password') === false && strpos($k, 'db_passwd') === false) |
197 | 206 | $_POST[$k] = addslashes($v); |
207 | + } |
|
198 | 208 | |
199 | 209 | // This is really quite simple; if ?delete is on the URL, delete the installer... |
200 | 210 | if (isset($_GET['delete'])) |
@@ -215,8 +225,7 @@ discard block |
||
215 | 225 | $ftp->close(); |
216 | 226 | |
217 | 227 | unset($_SESSION['installer_temp_ftp']); |
218 | - } |
|
219 | - else |
|
228 | + } else |
|
220 | 229 | { |
221 | 230 | @unlink(__FILE__); |
222 | 231 | |
@@ -237,10 +246,11 @@ discard block |
||
237 | 246 | { |
238 | 247 | // Get PHP's default timezone, if set |
239 | 248 | $ini_tz = ini_get('date.timezone'); |
240 | - if (!empty($ini_tz)) |
|
241 | - $timezone_id = $ini_tz; |
|
242 | - else |
|
243 | - $timezone_id = ''; |
|
249 | + if (!empty($ini_tz)) { |
|
250 | + $timezone_id = $ini_tz; |
|
251 | + } else { |
|
252 | + $timezone_id = ''; |
|
253 | + } |
|
244 | 254 | |
245 | 255 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
246 | 256 | if (!in_array($timezone_id, timezone_identifiers_list())) |
@@ -270,8 +280,9 @@ discard block |
||
270 | 280 | $dir = dir(dirname(__FILE__) . '/Themes/default/languages'); |
271 | 281 | while ($entry = $dir->read()) |
272 | 282 | { |
273 | - if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') |
|
274 | - $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
283 | + if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') { |
|
284 | + $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
285 | + } |
|
275 | 286 | } |
276 | 287 | $dir->close(); |
277 | 288 | } |
@@ -306,10 +317,11 @@ discard block |
||
306 | 317 | } |
307 | 318 | |
308 | 319 | // Override the language file? |
309 | - if (isset($_GET['lang_file'])) |
|
310 | - $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
311 | - elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) |
|
312 | - $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
320 | + if (isset($_GET['lang_file'])) { |
|
321 | + $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
322 | + } elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) { |
|
323 | + $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
324 | + } |
|
313 | 325 | |
314 | 326 | // Make sure it exists, if it doesn't reset it. |
315 | 327 | if (!isset($_SESSION['installer_temp_lang']) || preg_match('~[^\\w_\\-.]~', $_SESSION['installer_temp_lang']) === 1 || !file_exists(dirname(__FILE__) . '/Themes/default/languages/' . $_SESSION['installer_temp_lang'])) |
@@ -318,8 +330,9 @@ discard block |
||
318 | 330 | list ($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
319 | 331 | |
320 | 332 | // If we have english and some other language, use the other language. We Americans hate english :P. |
321 | - if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) |
|
322 | - list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
333 | + if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) { |
|
334 | + list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
335 | + } |
|
323 | 336 | } |
324 | 337 | |
325 | 338 | // And now include the actual language file itself. |
@@ -332,15 +345,18 @@ discard block |
||
332 | 345 | global $db_prefix, $db_connection, $sourcedir, $smcFunc, $modSettings; |
333 | 346 | global $db_server, $db_passwd, $db_type, $db_name, $db_user, $db_persist; |
334 | 347 | |
335 | - if (empty($sourcedir)) |
|
336 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
348 | + if (empty($sourcedir)) { |
|
349 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
350 | + } |
|
337 | 351 | |
338 | 352 | // Need this to check whether we need the database password. |
339 | 353 | require(dirname(__FILE__) . '/Settings.php'); |
340 | - if (!defined('SMF')) |
|
341 | - define('SMF', 1); |
|
342 | - if (empty($smcFunc)) |
|
343 | - $smcFunc = array(); |
|
354 | + if (!defined('SMF')) { |
|
355 | + define('SMF', 1); |
|
356 | + } |
|
357 | + if (empty($smcFunc)) { |
|
358 | + $smcFunc = array(); |
|
359 | + } |
|
344 | 360 | |
345 | 361 | $modSettings['disableQueryCheck'] = true; |
346 | 362 | |
@@ -348,8 +364,9 @@ discard block |
||
348 | 364 | if (!$db_connection) |
349 | 365 | { |
350 | 366 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
351 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
352 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
367 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
368 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
369 | + } |
|
353 | 370 | |
354 | 371 | $db_options = array('persist' => $db_persist); |
355 | 372 | $port = ''; |
@@ -360,19 +377,20 @@ discard block |
||
360 | 377 | if ($db_type == 'mysql') |
361 | 378 | { |
362 | 379 | $port = ((int) $_POST['db_port'] == ini_get($db_type . 'default_port')) ? '' : (int) $_POST['db_port']; |
363 | - } |
|
364 | - elseif ($db_type == 'postgresql') |
|
380 | + } elseif ($db_type == 'postgresql') |
|
365 | 381 | { |
366 | 382 | // PostgreSQL doesn't have a default port setting in php.ini, so just check against the default |
367 | 383 | $port = ((int) $_POST['db_port'] == 5432) ? '' : (int) $_POST['db_port']; |
368 | 384 | } |
369 | 385 | } |
370 | 386 | |
371 | - if (!empty($port)) |
|
372 | - $db_options['port'] = $port; |
|
387 | + if (!empty($port)) { |
|
388 | + $db_options['port'] = $port; |
|
389 | + } |
|
373 | 390 | |
374 | - if (!$db_connection) |
|
375 | - $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options); |
|
391 | + if (!$db_connection) { |
|
392 | + $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options); |
|
393 | + } |
|
376 | 394 | } |
377 | 395 | } |
378 | 396 | |
@@ -400,8 +418,9 @@ discard block |
||
400 | 418 | // @todo REMOVE THIS!! |
401 | 419 | else |
402 | 420 | { |
403 | - if (function_exists('doStep' . $_GET['step'])) |
|
404 | - call_user_func('doStep' . $_GET['step']); |
|
421 | + if (function_exists('doStep' . $_GET['step'])) { |
|
422 | + call_user_func('doStep' . $_GET['step']); |
|
423 | + } |
|
405 | 424 | } |
406 | 425 | // Show the footer. |
407 | 426 | template_install_below(); |
@@ -419,8 +438,9 @@ discard block |
||
419 | 438 | $incontext['sub_template'] = 'welcome_message'; |
420 | 439 | |
421 | 440 | // Done the submission? |
422 | - if (isset($_POST['contbutt'])) |
|
423 | - return true; |
|
441 | + if (isset($_POST['contbutt'])) { |
|
442 | + return true; |
|
443 | + } |
|
424 | 444 | |
425 | 445 | // See if we think they have already installed it? |
426 | 446 | if (is_readable(dirname(__FILE__) . '/Settings.php')) |
@@ -428,14 +448,17 @@ discard block |
||
428 | 448 | $probably_installed = 0; |
429 | 449 | foreach (file(dirname(__FILE__) . '/Settings.php') as $line) |
430 | 450 | { |
431 | - if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) |
|
432 | - $probably_installed++; |
|
433 | - if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) |
|
434 | - $probably_installed++; |
|
451 | + if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) { |
|
452 | + $probably_installed++; |
|
453 | + } |
|
454 | + if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) { |
|
455 | + $probably_installed++; |
|
456 | + } |
|
435 | 457 | } |
436 | 458 | |
437 | - if ($probably_installed == 2) |
|
438 | - $incontext['warning'] = $txt['error_already_installed']; |
|
459 | + if ($probably_installed == 2) { |
|
460 | + $incontext['warning'] = $txt['error_already_installed']; |
|
461 | + } |
|
439 | 462 | } |
440 | 463 | |
441 | 464 | // Is some database support even compiled in? |
@@ -450,45 +473,54 @@ discard block |
||
450 | 473 | $databases[$key]['supported'] = false; |
451 | 474 | $notFoundSQLFile = true; |
452 | 475 | $txt['error_db_script_missing'] = sprintf($txt['error_db_script_missing'], 'install_' . $GLOBALS['db_script_version'] . '_' . $type . '.sql'); |
476 | + } else { |
|
477 | + $incontext['supported_databases'][] = $db; |
|
453 | 478 | } |
454 | - else |
|
455 | - $incontext['supported_databases'][] = $db; |
|
456 | 479 | } |
457 | 480 | } |
458 | 481 | |
459 | 482 | // Check the PHP version. |
460 | - if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>='))) |
|
461 | - $error = 'error_php_too_low'; |
|
483 | + if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>='))) { |
|
484 | + $error = 'error_php_too_low'; |
|
485 | + } |
|
462 | 486 | // Make sure we have a supported database |
463 | - elseif (empty($incontext['supported_databases'])) |
|
464 | - $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
487 | + elseif (empty($incontext['supported_databases'])) { |
|
488 | + $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
489 | + } |
|
465 | 490 | // How about session support? Some crazy sysadmin remove it? |
466 | - elseif (!function_exists('session_start')) |
|
467 | - $error = 'error_session_missing'; |
|
491 | + elseif (!function_exists('session_start')) { |
|
492 | + $error = 'error_session_missing'; |
|
493 | + } |
|
468 | 494 | // Make sure they uploaded all the files. |
469 | - elseif (!file_exists(dirname(__FILE__) . '/index.php')) |
|
470 | - $error = 'error_missing_files'; |
|
495 | + elseif (!file_exists(dirname(__FILE__) . '/index.php')) { |
|
496 | + $error = 'error_missing_files'; |
|
497 | + } |
|
471 | 498 | // Very simple check on the session.save_path for Windows. |
472 | 499 | // @todo Move this down later if they don't use database-driven sessions? |
473 | - elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') |
|
474 | - $error = 'error_session_save_path'; |
|
500 | + elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') { |
|
501 | + $error = 'error_session_save_path'; |
|
502 | + } |
|
475 | 503 | |
476 | 504 | // Since each of the three messages would look the same, anyway... |
477 | - if (isset($error)) |
|
478 | - $incontext['error'] = $txt[$error]; |
|
505 | + if (isset($error)) { |
|
506 | + $incontext['error'] = $txt[$error]; |
|
507 | + } |
|
479 | 508 | |
480 | 509 | // Mod_security blocks everything that smells funny. Let SMF handle security. |
481 | - if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) |
|
482 | - $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
510 | + if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) { |
|
511 | + $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
512 | + } |
|
483 | 513 | |
484 | 514 | // Confirm mbstring is loaded... |
485 | - if (!extension_loaded('mbstring')) |
|
486 | - $incontext['error'] = $txt['install_no_mbstring']; |
|
515 | + if (!extension_loaded('mbstring')) { |
|
516 | + $incontext['error'] = $txt['install_no_mbstring']; |
|
517 | + } |
|
487 | 518 | |
488 | 519 | // Check for https stream support. |
489 | 520 | $supported_streams = stream_get_wrappers(); |
490 | - if (!in_array('https', $supported_streams)) |
|
491 | - $incontext['warning'] = $txt['install_no_https']; |
|
521 | + if (!in_array('https', $supported_streams)) { |
|
522 | + $incontext['warning'] = $txt['install_no_https']; |
|
523 | + } |
|
492 | 524 | |
493 | 525 | return false; |
494 | 526 | } |
@@ -514,12 +546,14 @@ discard block |
||
514 | 546 | 'db_last_error.php', |
515 | 547 | ); |
516 | 548 | |
517 | - foreach ($incontext['detected_languages'] as $lang => $temp) |
|
518 | - $extra_files[] = 'Themes/default/languages/' . $lang; |
|
549 | + foreach ($incontext['detected_languages'] as $lang => $temp) { |
|
550 | + $extra_files[] = 'Themes/default/languages/' . $lang; |
|
551 | + } |
|
519 | 552 | |
520 | 553 | // With mod_security installed, we could attempt to fix it with .htaccess. |
521 | - if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) |
|
522 | - $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
554 | + if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) { |
|
555 | + $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
556 | + } |
|
523 | 557 | |
524 | 558 | $failed_files = array(); |
525 | 559 | |
@@ -531,20 +565,23 @@ discard block |
||
531 | 565 | foreach ($writable_files as $file) |
532 | 566 | { |
533 | 567 | // Some files won't exist, try to address up front |
534 | - if (!file_exists(dirname(__FILE__) . '/' . $file)) |
|
535 | - @touch(dirname(__FILE__) . '/' . $file); |
|
568 | + if (!file_exists(dirname(__FILE__) . '/' . $file)) { |
|
569 | + @touch(dirname(__FILE__) . '/' . $file); |
|
570 | + } |
|
536 | 571 | // NOW do the writable check... |
537 | 572 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
538 | 573 | { |
539 | 574 | @chmod(dirname(__FILE__) . '/' . $file, 0755); |
540 | 575 | |
541 | 576 | // Well, 755 hopefully worked... if not, try 777. |
542 | - if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) |
|
543 | - $failed_files[] = $file; |
|
577 | + if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) { |
|
578 | + $failed_files[] = $file; |
|
579 | + } |
|
544 | 580 | } |
545 | 581 | } |
546 | - foreach ($extra_files as $file) |
|
547 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
582 | + foreach ($extra_files as $file) { |
|
583 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
584 | + } |
|
548 | 585 | } |
549 | 586 | // Windows is trickier. Let's try opening for r+... |
550 | 587 | else |
@@ -554,30 +591,35 @@ discard block |
||
554 | 591 | foreach ($writable_files as $file) |
555 | 592 | { |
556 | 593 | // Folders can't be opened for write... but the index.php in them can ;) |
557 | - if (is_dir(dirname(__FILE__) . '/' . $file)) |
|
558 | - $file .= '/index.php'; |
|
594 | + if (is_dir(dirname(__FILE__) . '/' . $file)) { |
|
595 | + $file .= '/index.php'; |
|
596 | + } |
|
559 | 597 | |
560 | 598 | // Funny enough, chmod actually does do something on windows - it removes the read only attribute. |
561 | 599 | @chmod(dirname(__FILE__) . '/' . $file, 0777); |
562 | 600 | $fp = @fopen(dirname(__FILE__) . '/' . $file, 'r+'); |
563 | 601 | |
564 | 602 | // Hmm, okay, try just for write in that case... |
565 | - if (!is_resource($fp)) |
|
566 | - $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
603 | + if (!is_resource($fp)) { |
|
604 | + $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
605 | + } |
|
567 | 606 | |
568 | - if (!is_resource($fp)) |
|
569 | - $failed_files[] = $file; |
|
607 | + if (!is_resource($fp)) { |
|
608 | + $failed_files[] = $file; |
|
609 | + } |
|
570 | 610 | |
571 | 611 | @fclose($fp); |
572 | 612 | } |
573 | - foreach ($extra_files as $file) |
|
574 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
613 | + foreach ($extra_files as $file) { |
|
614 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
615 | + } |
|
575 | 616 | } |
576 | 617 | |
577 | 618 | $failure = count($failed_files) >= 1; |
578 | 619 | |
579 | - if (!isset($_SERVER)) |
|
580 | - return !$failure; |
|
620 | + if (!isset($_SERVER)) { |
|
621 | + return !$failure; |
|
622 | + } |
|
581 | 623 | |
582 | 624 | // Put the list into context. |
583 | 625 | $incontext['failed_files'] = $failed_files; |
@@ -625,19 +667,23 @@ discard block |
||
625 | 667 | |
626 | 668 | if (!isset($ftp) || $ftp->error !== false) |
627 | 669 | { |
628 | - if (!isset($ftp)) |
|
629 | - $ftp = new ftp_connection(null); |
|
670 | + if (!isset($ftp)) { |
|
671 | + $ftp = new ftp_connection(null); |
|
672 | + } |
|
630 | 673 | // Save the error so we can mess with listing... |
631 | - elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) |
|
632 | - $incontext['ftp_errors'][] = $ftp->last_message; |
|
674 | + elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) { |
|
675 | + $incontext['ftp_errors'][] = $ftp->last_message; |
|
676 | + } |
|
633 | 677 | |
634 | 678 | list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__)); |
635 | 679 | |
636 | - if (empty($_POST['ftp_path']) && $found_path) |
|
637 | - $_POST['ftp_path'] = $detect_path; |
|
680 | + if (empty($_POST['ftp_path']) && $found_path) { |
|
681 | + $_POST['ftp_path'] = $detect_path; |
|
682 | + } |
|
638 | 683 | |
639 | - if (!isset($_POST['ftp_username'])) |
|
640 | - $_POST['ftp_username'] = $username; |
|
684 | + if (!isset($_POST['ftp_username'])) { |
|
685 | + $_POST['ftp_username'] = $username; |
|
686 | + } |
|
641 | 687 | |
642 | 688 | // Set the username etc, into context. |
643 | 689 | $incontext['ftp'] = array( |
@@ -649,8 +695,7 @@ discard block |
||
649 | 695 | ); |
650 | 696 | |
651 | 697 | return false; |
652 | - } |
|
653 | - else |
|
698 | + } else |
|
654 | 699 | { |
655 | 700 | $_SESSION['installer_temp_ftp'] = array( |
656 | 701 | 'server' => $_POST['ftp_server'], |
@@ -664,10 +709,12 @@ discard block |
||
664 | 709 | |
665 | 710 | foreach ($failed_files as $file) |
666 | 711 | { |
667 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
668 | - $ftp->chmod($file, 0755); |
|
669 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
670 | - $ftp->chmod($file, 0777); |
|
712 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
713 | + $ftp->chmod($file, 0755); |
|
714 | + } |
|
715 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
716 | + $ftp->chmod($file, 0777); |
|
717 | + } |
|
671 | 718 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
672 | 719 | { |
673 | 720 | $failed_files_updated[] = $file; |
@@ -723,15 +770,17 @@ discard block |
||
723 | 770 | |
724 | 771 | if (!$foundOne) |
725 | 772 | { |
726 | - if (isset($db['default_host'])) |
|
727 | - $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
773 | + if (isset($db['default_host'])) { |
|
774 | + $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
775 | + } |
|
728 | 776 | if (isset($db['default_user'])) |
729 | 777 | { |
730 | 778 | $incontext['db']['user'] = ini_get($db['default_user']); |
731 | 779 | $incontext['db']['name'] = ini_get($db['default_user']); |
732 | 780 | } |
733 | - if (isset($db['default_password'])) |
|
734 | - $incontext['db']['pass'] = ini_get($db['default_password']); |
|
781 | + if (isset($db['default_password'])) { |
|
782 | + $incontext['db']['pass'] = ini_get($db['default_password']); |
|
783 | + } |
|
735 | 784 | |
736 | 785 | // For simplicity and less confusion, leave the port blank by default |
737 | 786 | $incontext['db']['port'] = ''; |
@@ -750,10 +799,10 @@ discard block |
||
750 | 799 | $incontext['db']['server'] = $_POST['db_server']; |
751 | 800 | $incontext['db']['prefix'] = $_POST['db_prefix']; |
752 | 801 | |
753 | - if (!empty($_POST['db_port'])) |
|
754 | - $incontext['db']['port'] = $_POST['db_port']; |
|
755 | - } |
|
756 | - else |
|
802 | + if (!empty($_POST['db_port'])) { |
|
803 | + $incontext['db']['port'] = $_POST['db_port']; |
|
804 | + } |
|
805 | + } else |
|
757 | 806 | { |
758 | 807 | $incontext['db']['prefix'] = 'smf_'; |
759 | 808 | } |
@@ -789,10 +838,11 @@ discard block |
||
789 | 838 | if (!empty($_POST['db_port'])) |
790 | 839 | { |
791 | 840 | // For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though. |
792 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) |
|
793 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
794 | - elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) |
|
795 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
841 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) { |
|
842 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
843 | + } elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) { |
|
844 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
845 | + } |
|
796 | 846 | } |
797 | 847 | |
798 | 848 | // God I hope it saved! |
@@ -805,8 +855,9 @@ discard block |
||
805 | 855 | // Make sure it works. |
806 | 856 | require(dirname(__FILE__) . '/Settings.php'); |
807 | 857 | |
808 | - if (empty($sourcedir)) |
|
809 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
858 | + if (empty($sourcedir)) { |
|
859 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
860 | + } |
|
810 | 861 | |
811 | 862 | // Better find the database file! |
812 | 863 | if (!file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php')) |
@@ -816,18 +867,21 @@ discard block |
||
816 | 867 | } |
817 | 868 | |
818 | 869 | // Now include it for database functions! |
819 | - if (!defined('SMF')) |
|
820 | - define('SMF', 1); |
|
870 | + if (!defined('SMF')) { |
|
871 | + define('SMF', 1); |
|
872 | + } |
|
821 | 873 | |
822 | 874 | $modSettings['disableQueryCheck'] = true; |
823 | - if (empty($smcFunc)) |
|
824 | - $smcFunc = array(); |
|
875 | + if (empty($smcFunc)) { |
|
876 | + $smcFunc = array(); |
|
877 | + } |
|
825 | 878 | |
826 | 879 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
827 | 880 | |
828 | 881 | // What - running PHP4? The shame! |
829 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
830 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
882 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
883 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
884 | + } |
|
831 | 885 | |
832 | 886 | // Attempt a connection. |
833 | 887 | $needsDB = !empty($databases[$db_type]['always_has_db']); |
@@ -915,12 +969,14 @@ discard block |
||
915 | 969 | $incontext['page_title'] = $txt['install_settings']; |
916 | 970 | |
917 | 971 | // Let's see if we got the database type correct. |
918 | - if (isset($_POST['db_type'], $databases[$_POST['db_type']])) |
|
919 | - $db_type = $_POST['db_type']; |
|
972 | + if (isset($_POST['db_type'], $databases[$_POST['db_type']])) { |
|
973 | + $db_type = $_POST['db_type']; |
|
974 | + } |
|
920 | 975 | |
921 | 976 | // Else we'd better be able to get the connection. |
922 | - else |
|
923 | - load_database(); |
|
977 | + else { |
|
978 | + load_database(); |
|
979 | + } |
|
924 | 980 | |
925 | 981 | $db_type = isset($_POST['db_type']) ? $_POST['db_type'] : $db_type; |
926 | 982 | |
@@ -957,18 +1013,21 @@ discard block |
||
957 | 1013 | // Submitting? |
958 | 1014 | if (isset($_POST['boardurl'])) |
959 | 1015 | { |
960 | - if (substr($_POST['boardurl'], -10) == '/index.php') |
|
961 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
962 | - elseif (substr($_POST['boardurl'], -1) == '/') |
|
963 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
964 | - if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') |
|
965 | - $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
1016 | + if (substr($_POST['boardurl'], -10) == '/index.php') { |
|
1017 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
1018 | + } elseif (substr($_POST['boardurl'], -1) == '/') { |
|
1019 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
1020 | + } |
|
1021 | + if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') { |
|
1022 | + $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
1023 | + } |
|
966 | 1024 | |
967 | 1025 | //Make sure boardurl is aligned with ssl setting |
968 | - if (empty($_POST['force_ssl'])) |
|
969 | - $_POST['boardurl'] = strtr($_POST['boardurl'], array('https://' => 'http://')); |
|
970 | - else |
|
971 | - $_POST['boardurl'] = strtr($_POST['boardurl'], array('http://' => 'https://')); |
|
1026 | + if (empty($_POST['force_ssl'])) { |
|
1027 | + $_POST['boardurl'] = strtr($_POST['boardurl'], array('https://' => 'http://')); |
|
1028 | + } else { |
|
1029 | + $_POST['boardurl'] = strtr($_POST['boardurl'], array('http://' => 'https://')); |
|
1030 | + } |
|
972 | 1031 | |
973 | 1032 | // Save these variables. |
974 | 1033 | $vars = array( |
@@ -1007,10 +1066,10 @@ discard block |
||
1007 | 1066 | { |
1008 | 1067 | $incontext['error'] = sprintf($txt['error_utf8_version'], $databases[$db_type]['utf8_version']); |
1009 | 1068 | return false; |
1010 | - } |
|
1011 | - else |
|
1012 | - // Set the character set here. |
|
1069 | + } else { |
|
1070 | + // Set the character set here. |
|
1013 | 1071 | updateSettingsFile(array('db_character_set' => 'utf8')); |
1072 | + } |
|
1014 | 1073 | } |
1015 | 1074 | |
1016 | 1075 | // Good, skip on. |
@@ -1030,8 +1089,9 @@ discard block |
||
1030 | 1089 | $incontext['continue'] = 1; |
1031 | 1090 | |
1032 | 1091 | // Already done? |
1033 | - if (isset($_POST['pop_done'])) |
|
1034 | - return true; |
|
1092 | + if (isset($_POST['pop_done'])) { |
|
1093 | + return true; |
|
1094 | + } |
|
1035 | 1095 | |
1036 | 1096 | // Reload settings. |
1037 | 1097 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1049,8 +1109,9 @@ discard block |
||
1049 | 1109 | $modSettings = array(); |
1050 | 1110 | if ($result !== false) |
1051 | 1111 | { |
1052 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
1053 | - $modSettings[$row['variable']] = $row['value']; |
|
1112 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
1113 | + $modSettings[$row['variable']] = $row['value']; |
|
1114 | + } |
|
1054 | 1115 | $smcFunc['db_free_result']($result); |
1055 | 1116 | |
1056 | 1117 | // Do they match? If so, this is just a refresh so charge on! |
@@ -1063,20 +1124,22 @@ discard block |
||
1063 | 1124 | $modSettings['disableQueryCheck'] = true; |
1064 | 1125 | |
1065 | 1126 | // If doing UTF8, select it. PostgreSQL requires passing it as a string... |
1066 | - if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) |
|
1067 | - $smcFunc['db_query']('', ' |
|
1127 | + if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) { |
|
1128 | + $smcFunc['db_query']('', ' |
|
1068 | 1129 | SET NAMES {string:utf8}', |
1069 | 1130 | array( |
1070 | 1131 | 'db_error_skip' => true, |
1071 | 1132 | 'utf8' => 'utf8', |
1072 | 1133 | ) |
1073 | 1134 | ); |
1135 | + } |
|
1074 | 1136 | |
1075 | 1137 | // Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments... |
1076 | - if (substr(__DIR__, -1) == '\\') |
|
1077 | - $attachdir = __DIR__ . 'attachments'; |
|
1078 | - else |
|
1079 | - $attachdir = __DIR__ . '/attachments'; |
|
1138 | + if (substr(__DIR__, -1) == '\\') { |
|
1139 | + $attachdir = __DIR__ . 'attachments'; |
|
1140 | + } else { |
|
1141 | + $attachdir = __DIR__ . '/attachments'; |
|
1142 | + } |
|
1080 | 1143 | |
1081 | 1144 | $replaces = array( |
1082 | 1145 | '{$db_prefix}' => $db_prefix, |
@@ -1093,8 +1156,9 @@ discard block |
||
1093 | 1156 | |
1094 | 1157 | foreach ($txt as $key => $value) |
1095 | 1158 | { |
1096 | - if (substr($key, 0, 8) == 'default_') |
|
1097 | - $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
1159 | + if (substr($key, 0, 8) == 'default_') { |
|
1160 | + $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
1161 | + } |
|
1098 | 1162 | } |
1099 | 1163 | $replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], array('\\\\n' => '\\n')); |
1100 | 1164 | |
@@ -1109,8 +1173,9 @@ discard block |
||
1109 | 1173 | |
1110 | 1174 | while ($row = $smcFunc['db_fetch_assoc']($get_engines)) |
1111 | 1175 | { |
1112 | - if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') |
|
1113 | - $engines[] = $row['Engine']; |
|
1176 | + if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') { |
|
1177 | + $engines[] = $row['Engine']; |
|
1178 | + } |
|
1114 | 1179 | } |
1115 | 1180 | |
1116 | 1181 | // Done with this now |
@@ -1134,8 +1199,7 @@ discard block |
||
1134 | 1199 | $replaces['START TRANSACTION;'] = ''; |
1135 | 1200 | $replaces['COMMIT;'] = ''; |
1136 | 1201 | } |
1137 | - } |
|
1138 | - else |
|
1202 | + } else |
|
1139 | 1203 | { |
1140 | 1204 | $has_innodb = false; |
1141 | 1205 | } |
@@ -1157,21 +1221,24 @@ discard block |
||
1157 | 1221 | foreach ($sql_lines as $count => $line) |
1158 | 1222 | { |
1159 | 1223 | // No comments allowed! |
1160 | - if (substr(trim($line), 0, 1) != '#') |
|
1161 | - $current_statement .= "\n" . rtrim($line); |
|
1224 | + if (substr(trim($line), 0, 1) != '#') { |
|
1225 | + $current_statement .= "\n" . rtrim($line); |
|
1226 | + } |
|
1162 | 1227 | |
1163 | 1228 | // Is this the end of the query string? |
1164 | - if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) |
|
1165 | - continue; |
|
1229 | + if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) { |
|
1230 | + continue; |
|
1231 | + } |
|
1166 | 1232 | |
1167 | 1233 | // Does this table already exist? If so, don't insert more data into it! |
1168 | 1234 | if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists)) |
1169 | 1235 | { |
1170 | 1236 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
1171 | - if (!empty($matches[0])) |
|
1172 | - $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
1173 | - else |
|
1174 | - $incontext['sql_results']['insert_dups']++; |
|
1237 | + if (!empty($matches[0])) { |
|
1238 | + $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
1239 | + } else { |
|
1240 | + $incontext['sql_results']['insert_dups']++; |
|
1241 | + } |
|
1175 | 1242 | |
1176 | 1243 | $current_statement = ''; |
1177 | 1244 | continue; |
@@ -1180,8 +1247,9 @@ discard block |
||
1180 | 1247 | if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false) |
1181 | 1248 | { |
1182 | 1249 | // Use the appropriate function based on the DB type |
1183 | - if ($db_type == 'mysql' || $db_type == 'mysqli') |
|
1184 | - $db_errorno = $db_type . '_errno'; |
|
1250 | + if ($db_type == 'mysql' || $db_type == 'mysqli') { |
|
1251 | + $db_errorno = $db_type . '_errno'; |
|
1252 | + } |
|
1185 | 1253 | |
1186 | 1254 | // Error 1050: Table already exists! |
1187 | 1255 | // @todo Needs to be made better! |
@@ -1196,18 +1264,18 @@ discard block |
||
1196 | 1264 | // MySQLi requires a connection object. It's optional with MySQL and Postgres |
1197 | 1265 | $incontext['failures'][$count] = $smcFunc['db_error']($db_connection); |
1198 | 1266 | } |
1199 | - } |
|
1200 | - else |
|
1267 | + } else |
|
1201 | 1268 | { |
1202 | - if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
1203 | - $incontext['sql_results']['tables']++; |
|
1204 | - elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
1269 | + if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) { |
|
1270 | + $incontext['sql_results']['tables']++; |
|
1271 | + } elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
1205 | 1272 | { |
1206 | 1273 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
1207 | - if (!empty($matches[0])) |
|
1208 | - $incontext['sql_results']['inserts'] += count($matches[0]); |
|
1209 | - else |
|
1210 | - $incontext['sql_results']['inserts']++; |
|
1274 | + if (!empty($matches[0])) { |
|
1275 | + $incontext['sql_results']['inserts'] += count($matches[0]); |
|
1276 | + } else { |
|
1277 | + $incontext['sql_results']['inserts']++; |
|
1278 | + } |
|
1211 | 1279 | } |
1212 | 1280 | } |
1213 | 1281 | |
@@ -1220,15 +1288,17 @@ discard block |
||
1220 | 1288 | // Sort out the context for the SQL. |
1221 | 1289 | foreach ($incontext['sql_results'] as $key => $number) |
1222 | 1290 | { |
1223 | - if ($number == 0) |
|
1224 | - unset($incontext['sql_results'][$key]); |
|
1225 | - else |
|
1226 | - $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
1291 | + if ($number == 0) { |
|
1292 | + unset($incontext['sql_results'][$key]); |
|
1293 | + } else { |
|
1294 | + $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
1295 | + } |
|
1227 | 1296 | } |
1228 | 1297 | |
1229 | 1298 | // Make sure UTF will be used globally. |
1230 | - if ((!empty($databases[$db_type]['utf8_support']) && !empty($databases[$db_type]['utf8_required'])) || (empty($databases[$db_type]['utf8_required']) && !empty($databases[$db_type]['utf8_support']) && isset($_POST['utf8']))) |
|
1231 | - $newSettings[] = array('global_character_set', 'UTF-8'); |
|
1299 | + if ((!empty($databases[$db_type]['utf8_support']) && !empty($databases[$db_type]['utf8_required'])) || (empty($databases[$db_type]['utf8_required']) && !empty($databases[$db_type]['utf8_support']) && isset($_POST['utf8']))) { |
|
1300 | + $newSettings[] = array('global_character_set', 'UTF-8'); |
|
1301 | + } |
|
1232 | 1302 | |
1233 | 1303 | // Maybe we can auto-detect better cookie settings? |
1234 | 1304 | preg_match('~^http[s]?://([^\.]+?)([^/]*?)(/.*)?$~', $boardurl, $matches); |
@@ -1239,16 +1309,20 @@ discard block |
||
1239 | 1309 | $globalCookies = false; |
1240 | 1310 | |
1241 | 1311 | // Okay... let's see. Using a subdomain other than www.? (not a perfect check.) |
1242 | - if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www')))) |
|
1243 | - $globalCookies = true; |
|
1312 | + if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www')))) { |
|
1313 | + $globalCookies = true; |
|
1314 | + } |
|
1244 | 1315 | // If there's a / in the middle of the path, or it starts with ~... we want local. |
1245 | - if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false)) |
|
1246 | - $localCookies = true; |
|
1316 | + if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false)) { |
|
1317 | + $localCookies = true; |
|
1318 | + } |
|
1247 | 1319 | |
1248 | - if ($globalCookies) |
|
1249 | - $newSettings[] = array('globalCookies', '1'); |
|
1250 | - if ($localCookies) |
|
1251 | - $newSettings[] = array('localCookies', '1'); |
|
1320 | + if ($globalCookies) { |
|
1321 | + $newSettings[] = array('globalCookies', '1'); |
|
1322 | + } |
|
1323 | + if ($localCookies) { |
|
1324 | + $newSettings[] = array('localCookies', '1'); |
|
1325 | + } |
|
1252 | 1326 | } |
1253 | 1327 | |
1254 | 1328 | // Are we allowing stat collection? |
@@ -1266,16 +1340,17 @@ discard block |
||
1266 | 1340 | fwrite($fp, $out); |
1267 | 1341 | |
1268 | 1342 | $return_data = ''; |
1269 | - while (!feof($fp)) |
|
1270 | - $return_data .= fgets($fp, 128); |
|
1343 | + while (!feof($fp)) { |
|
1344 | + $return_data .= fgets($fp, 128); |
|
1345 | + } |
|
1271 | 1346 | |
1272 | 1347 | fclose($fp); |
1273 | 1348 | |
1274 | 1349 | // Get the unique site ID. |
1275 | 1350 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
1276 | 1351 | |
1277 | - if (!empty($ID[1])) |
|
1278 | - $smcFunc['db_insert']('replace', |
|
1352 | + if (!empty($ID[1])) { |
|
1353 | + $smcFunc['db_insert']('replace', |
|
1279 | 1354 | $db_prefix . 'settings', |
1280 | 1355 | array('variable' => 'string', 'value' => 'string'), |
1281 | 1356 | array( |
@@ -1284,11 +1359,12 @@ discard block |
||
1284 | 1359 | ), |
1285 | 1360 | array('variable') |
1286 | 1361 | ); |
1362 | + } |
|
1287 | 1363 | } |
1288 | 1364 | } |
1289 | 1365 | // Don't remove stat collection unless we unchecked the box for real, not from the loop. |
1290 | - elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) |
|
1291 | - $smcFunc['db_query']('', ' |
|
1366 | + elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) { |
|
1367 | + $smcFunc['db_query']('', ' |
|
1292 | 1368 | DELETE FROM {db_prefix}settings |
1293 | 1369 | WHERE variable = {string:enable_sm_stats}', |
1294 | 1370 | array( |
@@ -1296,20 +1372,23 @@ discard block |
||
1296 | 1372 | 'db_error_skip' => true, |
1297 | 1373 | ) |
1298 | 1374 | ); |
1375 | + } |
|
1299 | 1376 | |
1300 | 1377 | // Are we enabling SSL? |
1301 | - if (!empty($_POST['force_ssl'])) |
|
1302 | - $newSettings[] = array('force_ssl', 2); |
|
1378 | + if (!empty($_POST['force_ssl'])) { |
|
1379 | + $newSettings[] = array('force_ssl', 2); |
|
1380 | + } |
|
1303 | 1381 | |
1304 | 1382 | // Setting a timezone is required. |
1305 | 1383 | if (!isset($modSettings['default_timezone']) && function_exists('date_default_timezone_set')) |
1306 | 1384 | { |
1307 | 1385 | // Get PHP's default timezone, if set |
1308 | 1386 | $ini_tz = ini_get('date.timezone'); |
1309 | - if (!empty($ini_tz)) |
|
1310 | - $timezone_id = $ini_tz; |
|
1311 | - else |
|
1312 | - $timezone_id = ''; |
|
1387 | + if (!empty($ini_tz)) { |
|
1388 | + $timezone_id = $ini_tz; |
|
1389 | + } else { |
|
1390 | + $timezone_id = ''; |
|
1391 | + } |
|
1313 | 1392 | |
1314 | 1393 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
1315 | 1394 | if (!in_array($timezone_id, timezone_identifiers_list())) |
@@ -1318,8 +1397,9 @@ discard block |
||
1318 | 1397 | $timezone_id = timezone_name_from_abbr('', $server_offset, 0); |
1319 | 1398 | } |
1320 | 1399 | |
1321 | - if (date_default_timezone_set($timezone_id)) |
|
1322 | - $newSettings[] = array('default_timezone', $timezone_id); |
|
1400 | + if (date_default_timezone_set($timezone_id)) { |
|
1401 | + $newSettings[] = array('default_timezone', $timezone_id); |
|
1402 | + } |
|
1323 | 1403 | } |
1324 | 1404 | |
1325 | 1405 | if (!empty($newSettings)) |
@@ -1350,16 +1430,18 @@ discard block |
||
1350 | 1430 | } |
1351 | 1431 | |
1352 | 1432 | // MySQL specific stuff |
1353 | - if (substr($db_type, 0, 5) != 'mysql') |
|
1354 | - return false; |
|
1433 | + if (substr($db_type, 0, 5) != 'mysql') { |
|
1434 | + return false; |
|
1435 | + } |
|
1355 | 1436 | |
1356 | 1437 | // Find database user privileges. |
1357 | 1438 | $privs = array(); |
1358 | 1439 | $get_privs = $smcFunc['db_query']('', 'SHOW PRIVILEGES', array()); |
1359 | 1440 | while ($row = $smcFunc['db_fetch_assoc']($get_privs)) |
1360 | 1441 | { |
1361 | - if ($row['Privilege'] == 'Alter') |
|
1362 | - $privs[] = $row['Privilege']; |
|
1442 | + if ($row['Privilege'] == 'Alter') { |
|
1443 | + $privs[] = $row['Privilege']; |
|
1444 | + } |
|
1363 | 1445 | } |
1364 | 1446 | $smcFunc['db_free_result']($get_privs); |
1365 | 1447 | |
@@ -1389,8 +1471,9 @@ discard block |
||
1389 | 1471 | $incontext['continue'] = 1; |
1390 | 1472 | |
1391 | 1473 | // Skipping? |
1392 | - if (!empty($_POST['skip'])) |
|
1393 | - return true; |
|
1474 | + if (!empty($_POST['skip'])) { |
|
1475 | + return true; |
|
1476 | + } |
|
1394 | 1477 | |
1395 | 1478 | // Need this to check whether we need the database password. |
1396 | 1479 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1407,18 +1490,22 @@ discard block |
||
1407 | 1490 | // We need this to properly hash the password for Admin |
1408 | 1491 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
1409 | 1492 | global $sourcedir; |
1410 | - if (function_exists('mb_strtolower')) |
|
1411 | - return mb_strtolower($string, 'UTF-8'); |
|
1493 | + if (function_exists('mb_strtolower')) { |
|
1494 | + return mb_strtolower($string, 'UTF-8'); |
|
1495 | + } |
|
1412 | 1496 | require_once($sourcedir . '/Subs-Charset.php'); |
1413 | 1497 | return utf8_strtolower($string); |
1414 | 1498 | }; |
1415 | 1499 | |
1416 | - if (!isset($_POST['username'])) |
|
1417 | - $_POST['username'] = ''; |
|
1418 | - if (!isset($_POST['email'])) |
|
1419 | - $_POST['email'] = ''; |
|
1420 | - if (!isset($_POST['server_email'])) |
|
1421 | - $_POST['server_email'] = ''; |
|
1500 | + if (!isset($_POST['username'])) { |
|
1501 | + $_POST['username'] = ''; |
|
1502 | + } |
|
1503 | + if (!isset($_POST['email'])) { |
|
1504 | + $_POST['email'] = ''; |
|
1505 | + } |
|
1506 | + if (!isset($_POST['server_email'])) { |
|
1507 | + $_POST['server_email'] = ''; |
|
1508 | + } |
|
1422 | 1509 | |
1423 | 1510 | $incontext['username'] = htmlspecialchars(stripslashes($_POST['username'])); |
1424 | 1511 | $incontext['email'] = htmlspecialchars(stripslashes($_POST['email'])); |
@@ -1437,8 +1524,9 @@ discard block |
||
1437 | 1524 | 'admin_group' => 1, |
1438 | 1525 | ) |
1439 | 1526 | ); |
1440 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
1441 | - $incontext['skip'] = 1; |
|
1527 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
1528 | + $incontext['skip'] = 1; |
|
1529 | + } |
|
1442 | 1530 | $smcFunc['db_free_result']($request); |
1443 | 1531 | |
1444 | 1532 | // Trying to create an account? |
@@ -1469,8 +1557,9 @@ discard block |
||
1469 | 1557 | } |
1470 | 1558 | |
1471 | 1559 | // Update the webmaster's email? |
1472 | - if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) |
|
1473 | - updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
1560 | + if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) { |
|
1561 | + updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
1562 | + } |
|
1474 | 1563 | |
1475 | 1564 | // Work out whether we're going to have dodgy characters and remove them. |
1476 | 1565 | $invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0; |
@@ -1493,32 +1582,27 @@ discard block |
||
1493 | 1582 | $smcFunc['db_free_result']($result); |
1494 | 1583 | |
1495 | 1584 | $incontext['account_existed'] = $txt['error_user_settings_taken']; |
1496 | - } |
|
1497 | - elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
1585 | + } elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
1498 | 1586 | { |
1499 | 1587 | // Try the previous step again. |
1500 | 1588 | $incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long']; |
1501 | 1589 | return false; |
1502 | - } |
|
1503 | - elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
1590 | + } elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
1504 | 1591 | { |
1505 | 1592 | // Try the previous step again. |
1506 | 1593 | $incontext['error'] = $txt['error_invalid_characters_username']; |
1507 | 1594 | return false; |
1508 | - } |
|
1509 | - elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
1595 | + } elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
1510 | 1596 | { |
1511 | 1597 | // One step back, this time fill out a proper admin email address. |
1512 | 1598 | $incontext['error'] = sprintf($txt['error_valid_admin_email_needed'], $_POST['username']); |
1513 | 1599 | return false; |
1514 | - } |
|
1515 | - elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
1600 | + } elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
1516 | 1601 | { |
1517 | 1602 | // One step back, this time fill out a proper admin email address. |
1518 | 1603 | $incontext['error'] = $txt['error_valid_server_email_needed']; |
1519 | 1604 | return false; |
1520 | - } |
|
1521 | - elseif ($_POST['username'] != '') |
|
1605 | + } elseif ($_POST['username'] != '') |
|
1522 | 1606 | { |
1523 | 1607 | $incontext['member_salt'] = substr(md5(mt_rand()), 0, 4); |
1524 | 1608 | |
@@ -1586,17 +1670,19 @@ discard block |
||
1586 | 1670 | reloadSettings(); |
1587 | 1671 | |
1588 | 1672 | // Bring a warning over. |
1589 | - if (!empty($incontext['account_existed'])) |
|
1590 | - $incontext['warning'] = $incontext['account_existed']; |
|
1673 | + if (!empty($incontext['account_existed'])) { |
|
1674 | + $incontext['warning'] = $incontext['account_existed']; |
|
1675 | + } |
|
1591 | 1676 | |
1592 | - if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) |
|
1593 | - $smcFunc['db_query']('', ' |
|
1677 | + if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) { |
|
1678 | + $smcFunc['db_query']('', ' |
|
1594 | 1679 | SET NAMES {string:db_character_set}', |
1595 | 1680 | array( |
1596 | 1681 | 'db_character_set' => $db_character_set, |
1597 | 1682 | 'db_error_skip' => true, |
1598 | 1683 | ) |
1599 | 1684 | ); |
1685 | + } |
|
1600 | 1686 | |
1601 | 1687 | // As track stats is by default enabled let's add some activity. |
1602 | 1688 | $smcFunc['db_insert']('ignore', |
@@ -1617,14 +1703,16 @@ discard block |
||
1617 | 1703 | // Only proceed if we can load the data. |
1618 | 1704 | if ($request) |
1619 | 1705 | { |
1620 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
1621 | - $modSettings[$row[0]] = $row[1]; |
|
1706 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
1707 | + $modSettings[$row[0]] = $row[1]; |
|
1708 | + } |
|
1622 | 1709 | $smcFunc['db_free_result']($request); |
1623 | 1710 | } |
1624 | 1711 | |
1625 | 1712 | // Automatically log them in ;) |
1626 | - if (isset($incontext['member_id']) && isset($incontext['member_salt'])) |
|
1627 | - setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
1713 | + if (isset($incontext['member_id']) && isset($incontext['member_salt'])) { |
|
1714 | + setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
1715 | + } |
|
1628 | 1716 | |
1629 | 1717 | $result = $smcFunc['db_query']('', ' |
1630 | 1718 | SELECT value |
@@ -1635,13 +1723,14 @@ discard block |
||
1635 | 1723 | 'db_error_skip' => true, |
1636 | 1724 | ) |
1637 | 1725 | ); |
1638 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
1639 | - list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
1726 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
1727 | + list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
1728 | + } |
|
1640 | 1729 | $smcFunc['db_free_result']($result); |
1641 | 1730 | |
1642 | - if (empty($db_sessions)) |
|
1643 | - $_SESSION['admin_time'] = time(); |
|
1644 | - else |
|
1731 | + if (empty($db_sessions)) { |
|
1732 | + $_SESSION['admin_time'] = time(); |
|
1733 | + } else |
|
1645 | 1734 | { |
1646 | 1735 | $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211); |
1647 | 1736 | |
@@ -1665,8 +1754,9 @@ discard block |
||
1665 | 1754 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
1666 | 1755 | function($string){ |
1667 | 1756 | global $sourcedir; |
1668 | - if (function_exists('mb_strtolower')) |
|
1669 | - return mb_strtolower($string, 'UTF-8'); |
|
1757 | + if (function_exists('mb_strtolower')) { |
|
1758 | + return mb_strtolower($string, 'UTF-8'); |
|
1759 | + } |
|
1670 | 1760 | require_once($sourcedir . '/Subs-Charset.php'); |
1671 | 1761 | return utf8_strtolower($string); |
1672 | 1762 | }; |
@@ -1682,8 +1772,9 @@ discard block |
||
1682 | 1772 | ) |
1683 | 1773 | ); |
1684 | 1774 | $context['utf8'] = $db_character_set === 'utf8' || $txt['lang_character_set'] === 'UTF-8'; |
1685 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
1686 | - updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
1775 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
1776 | + updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
1777 | + } |
|
1687 | 1778 | $smcFunc['db_free_result']($request); |
1688 | 1779 | |
1689 | 1780 | // Now is the perfect time to fetch the SM files. |
@@ -1702,8 +1793,9 @@ discard block |
||
1702 | 1793 | |
1703 | 1794 | // Check if we need some stupid MySQL fix. |
1704 | 1795 | $server_version = $smcFunc['db_server_info'](); |
1705 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) |
|
1706 | - updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
1796 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) { |
|
1797 | + updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
1798 | + } |
|
1707 | 1799 | |
1708 | 1800 | // Some final context for the template. |
1709 | 1801 | $incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\'; |
@@ -1723,8 +1815,9 @@ discard block |
||
1723 | 1815 | $settingsArray = file(dirname(__FILE__) . '/Settings.php'); |
1724 | 1816 | |
1725 | 1817 | // @todo Do we just want to read the file in clean, and split it this way always? |
1726 | - if (count($settingsArray) == 1) |
|
1727 | - $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
1818 | + if (count($settingsArray) == 1) { |
|
1819 | + $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
1820 | + } |
|
1728 | 1821 | |
1729 | 1822 | for ($i = 0, $n = count($settingsArray); $i < $n; $i++) |
1730 | 1823 | { |
@@ -1739,19 +1832,22 @@ discard block |
||
1739 | 1832 | continue; |
1740 | 1833 | } |
1741 | 1834 | |
1742 | - if (trim($settingsArray[$i]) == '?' . '>') |
|
1743 | - $settingsArray[$i] = ''; |
|
1835 | + if (trim($settingsArray[$i]) == '?' . '>') { |
|
1836 | + $settingsArray[$i] = ''; |
|
1837 | + } |
|
1744 | 1838 | |
1745 | 1839 | // Don't trim or bother with it if it's not a variable. |
1746 | - if (substr($settingsArray[$i], 0, 1) != '$') |
|
1747 | - continue; |
|
1840 | + if (substr($settingsArray[$i], 0, 1) != '$') { |
|
1841 | + continue; |
|
1842 | + } |
|
1748 | 1843 | |
1749 | 1844 | $settingsArray[$i] = rtrim($settingsArray[$i]) . "\n"; |
1750 | 1845 | |
1751 | - foreach ($vars as $var => $val) |
|
1752 | - if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
1846 | + foreach ($vars as $var => $val) { |
|
1847 | + if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
1753 | 1848 | { |
1754 | 1849 | $comment = strstr($settingsArray[$i], '#'); |
1850 | + } |
|
1755 | 1851 | $settingsArray[$i] = '$' . $var . ' = \'' . $val . '\';' . ($comment != '' ? "\t\t" . $comment : "\n"); |
1756 | 1852 | unset($vars[$var]); |
1757 | 1853 | } |
@@ -1761,36 +1857,41 @@ discard block |
||
1761 | 1857 | if (!empty($vars)) |
1762 | 1858 | { |
1763 | 1859 | $settingsArray[$i++] = ''; |
1764 | - foreach ($vars as $var => $val) |
|
1765 | - $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
1860 | + foreach ($vars as $var => $val) { |
|
1861 | + $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
1862 | + } |
|
1766 | 1863 | } |
1767 | 1864 | |
1768 | 1865 | // Blank out the file - done to fix a oddity with some servers. |
1769 | 1866 | $fp = @fopen(dirname(__FILE__) . '/Settings.php', 'w'); |
1770 | - if (!$fp) |
|
1771 | - return false; |
|
1867 | + if (!$fp) { |
|
1868 | + return false; |
|
1869 | + } |
|
1772 | 1870 | fclose($fp); |
1773 | 1871 | |
1774 | 1872 | $fp = fopen(dirname(__FILE__) . '/Settings.php', 'r+'); |
1775 | 1873 | |
1776 | 1874 | // Gotta have one of these ;) |
1777 | - if (trim($settingsArray[0]) != '<?php') |
|
1778 | - fwrite($fp, "<?php\n"); |
|
1875 | + if (trim($settingsArray[0]) != '<?php') { |
|
1876 | + fwrite($fp, "<?php\n"); |
|
1877 | + } |
|
1779 | 1878 | |
1780 | 1879 | $lines = count($settingsArray); |
1781 | 1880 | for ($i = 0; $i < $lines - 1; $i++) |
1782 | 1881 | { |
1783 | 1882 | // Don't just write a bunch of blank lines. |
1784 | - if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') |
|
1785 | - fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
1883 | + if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') { |
|
1884 | + fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
1885 | + } |
|
1786 | 1886 | } |
1787 | 1887 | fwrite($fp, $settingsArray[$i] . '?' . '>'); |
1788 | 1888 | fclose($fp); |
1789 | 1889 | |
1790 | 1890 | // Even though on normal installations the filemtime should prevent this being used by the installer incorrectly |
1791 | 1891 | // it seems that there are times it might not. So let's MAKE it dump the cache. |
1792 | - if (function_exists('opcache_invalidate')) |
|
1793 | - opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
1892 | + if (function_exists('opcache_invalidate')) { |
|
1893 | + opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
1894 | + } |
|
1794 | 1895 | |
1795 | 1896 | return true; |
1796 | 1897 | } |
@@ -1815,9 +1916,9 @@ discard block |
||
1815 | 1916 | SecFilterScanPOST Off |
1816 | 1917 | </IfModule>'; |
1817 | 1918 | |
1818 | - if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) |
|
1819 | - return true; |
|
1820 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
1919 | + if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) { |
|
1920 | + return true; |
|
1921 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
1821 | 1922 | { |
1822 | 1923 | $current_htaccess = implode('', file(dirname(__FILE__) . '/.htaccess')); |
1823 | 1924 | |
@@ -1829,29 +1930,28 @@ discard block |
||
1829 | 1930 | fwrite($ht_handle, $htaccess_addition); |
1830 | 1931 | fclose($ht_handle); |
1831 | 1932 | return true; |
1933 | + } else { |
|
1934 | + return false; |
|
1832 | 1935 | } |
1833 | - else |
|
1834 | - return false; |
|
1936 | + } else { |
|
1937 | + return true; |
|
1835 | 1938 | } |
1836 | - else |
|
1837 | - return true; |
|
1838 | - } |
|
1839 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess')) |
|
1840 | - return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
1841 | - elseif (is_writable(dirname(__FILE__))) |
|
1939 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess')) { |
|
1940 | + return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
1941 | + } elseif (is_writable(dirname(__FILE__))) |
|
1842 | 1942 | { |
1843 | 1943 | if ($ht_handle = fopen(dirname(__FILE__) . '/.htaccess', 'w')) |
1844 | 1944 | { |
1845 | 1945 | fwrite($ht_handle, $htaccess_addition); |
1846 | 1946 | fclose($ht_handle); |
1847 | 1947 | return true; |
1948 | + } else { |
|
1949 | + return false; |
|
1848 | 1950 | } |
1849 | - else |
|
1951 | + } else { |
|
1850 | 1952 | return false; |
1851 | 1953 | } |
1852 | - else |
|
1853 | - return false; |
|
1854 | -} |
|
1954 | + } |
|
1855 | 1955 | |
1856 | 1956 | function template_install_above() |
1857 | 1957 | { |
@@ -1889,9 +1989,10 @@ discard block |
||
1889 | 1989 | <label for="installer_language">', $txt['installer_language'], ':</label> |
1890 | 1990 | <select id="installer_language" name="lang_file" onchange="location.href = \'', $installurl, '?lang_file=\' + this.options[this.selectedIndex].value;">'; |
1891 | 1991 | |
1892 | - foreach ($incontext['detected_languages'] as $lang => $name) |
|
1893 | - echo ' |
|
1992 | + foreach ($incontext['detected_languages'] as $lang => $name) { |
|
1993 | + echo ' |
|
1894 | 1994 | <option', isset($_SESSION['installer_temp_lang']) && $_SESSION['installer_temp_lang'] == $lang ? ' selected' : '', ' value="', $lang, '">', $name, '</option>'; |
1995 | + } |
|
1895 | 1996 | |
1896 | 1997 | echo ' |
1897 | 1998 | </select> |
@@ -1911,9 +2012,10 @@ discard block |
||
1911 | 2012 | <h2>', $txt['upgrade_progress'], '</h2> |
1912 | 2013 | <ul>'; |
1913 | 2014 | |
1914 | - foreach ($incontext['steps'] as $num => $step) |
|
1915 | - echo ' |
|
2015 | + foreach ($incontext['steps'] as $num => $step) { |
|
2016 | + echo ' |
|
1916 | 2017 | <li class="', $num < $incontext['current_step'] ? 'stepdone' : ($num == $incontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>'; |
2018 | + } |
|
1917 | 2019 | |
1918 | 2020 | echo ' |
1919 | 2021 | </ul> |
@@ -1938,20 +2040,23 @@ discard block |
||
1938 | 2040 | echo ' |
1939 | 2041 | <div class="floatright">'; |
1940 | 2042 | |
1941 | - if (!empty($incontext['continue'])) |
|
1942 | - echo ' |
|
2043 | + if (!empty($incontext['continue'])) { |
|
2044 | + echo ' |
|
1943 | 2045 | <input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '" onclick="return submitThisOnce(this);" class="button" />'; |
1944 | - if (!empty($incontext['skip'])) |
|
1945 | - echo ' |
|
2046 | + } |
|
2047 | + if (!empty($incontext['skip'])) { |
|
2048 | + echo ' |
|
1946 | 2049 | <input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="return submitThisOnce(this);" class="button" />'; |
2050 | + } |
|
1947 | 2051 | echo ' |
1948 | 2052 | </div>'; |
1949 | 2053 | } |
1950 | 2054 | |
1951 | 2055 | // Show the closing form tag and other data only if not in the last step |
1952 | - if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) |
|
1953 | - echo ' |
|
2056 | + if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) { |
|
2057 | + echo ' |
|
1954 | 2058 | </form>'; |
2059 | + } |
|
1955 | 2060 | |
1956 | 2061 | echo ' |
1957 | 2062 | </div> |
@@ -1986,13 +2091,15 @@ discard block |
||
1986 | 2091 | </div>'; |
1987 | 2092 | |
1988 | 2093 | // Show the warnings, or not. |
1989 | - if (template_warning_divs()) |
|
1990 | - echo ' |
|
2094 | + if (template_warning_divs()) { |
|
2095 | + echo ' |
|
1991 | 2096 | <h3>', $txt['install_all_lovely'], '</h3>'; |
2097 | + } |
|
1992 | 2098 | |
1993 | 2099 | // Say we want the continue button! |
1994 | - if (empty($incontext['error'])) |
|
1995 | - $incontext['continue'] = 1; |
|
2100 | + if (empty($incontext['error'])) { |
|
2101 | + $incontext['continue'] = 1; |
|
2102 | + } |
|
1996 | 2103 | |
1997 | 2104 | // For the latest version stuff. |
1998 | 2105 | echo ' |
@@ -2026,8 +2133,8 @@ discard block |
||
2026 | 2133 | global $txt, $incontext; |
2027 | 2134 | |
2028 | 2135 | // Errors are very serious.. |
2029 | - if (!empty($incontext['error'])) |
|
2030 | - echo ' |
|
2136 | + if (!empty($incontext['error'])) { |
|
2137 | + echo ' |
|
2031 | 2138 | <div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;"> |
2032 | 2139 | <div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div> |
2033 | 2140 | <strong style="text-decoration: underline;">', $txt['upgrade_critical_error'], '</strong><br> |
@@ -2035,9 +2142,10 @@ discard block |
||
2035 | 2142 | ', $incontext['error'], ' |
2036 | 2143 | </div> |
2037 | 2144 | </div>'; |
2145 | + } |
|
2038 | 2146 | // A warning message? |
2039 | - elseif (!empty($incontext['warning'])) |
|
2040 | - echo ' |
|
2147 | + elseif (!empty($incontext['warning'])) { |
|
2148 | + echo ' |
|
2041 | 2149 | <div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;"> |
2042 | 2150 | <div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div> |
2043 | 2151 | <strong style="text-decoration: underline;">', $txt['upgrade_warning'], '</strong><br> |
@@ -2045,6 +2153,7 @@ discard block |
||
2045 | 2153 | ', $incontext['warning'], ' |
2046 | 2154 | </div> |
2047 | 2155 | </div>'; |
2156 | + } |
|
2048 | 2157 | |
2049 | 2158 | return empty($incontext['error']) && empty($incontext['warning']); |
2050 | 2159 | } |
@@ -2060,27 +2169,30 @@ discard block |
||
2060 | 2169 | <li>', $incontext['failed_files']), '</li> |
2061 | 2170 | </ul>'; |
2062 | 2171 | |
2063 | - if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') |
|
2064 | - echo ' |
|
2172 | + if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') { |
|
2173 | + echo ' |
|
2065 | 2174 | <hr> |
2066 | 2175 | <p>', $txt['chmod_linux_info'], '</p> |
2067 | 2176 | <tt># chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), '</tt>'; |
2177 | + } |
|
2068 | 2178 | |
2069 | 2179 | // This is serious! |
2070 | - if (!template_warning_divs()) |
|
2071 | - return; |
|
2180 | + if (!template_warning_divs()) { |
|
2181 | + return; |
|
2182 | + } |
|
2072 | 2183 | |
2073 | 2184 | echo ' |
2074 | 2185 | <hr> |
2075 | 2186 | <p>', $txt['ftp_setup_info'], '</p>'; |
2076 | 2187 | |
2077 | - if (!empty($incontext['ftp_errors'])) |
|
2078 | - echo ' |
|
2188 | + if (!empty($incontext['ftp_errors'])) { |
|
2189 | + echo ' |
|
2079 | 2190 | <div class="error_message"> |
2080 | 2191 | ', $txt['error_ftp_no_connect'], '<br><br> |
2081 | 2192 | <code>', implode('<br>', $incontext['ftp_errors']), '</code> |
2082 | 2193 | </div> |
2083 | 2194 | <br>'; |
2195 | + } |
|
2084 | 2196 | |
2085 | 2197 | echo ' |
2086 | 2198 | <form action="', $incontext['form_url'], '" method="post"> |
@@ -2140,17 +2252,17 @@ discard block |
||
2140 | 2252 | <td> |
2141 | 2253 | <select name="db_type" id="db_type_input" onchange="toggleDBInput();">'; |
2142 | 2254 | |
2143 | - foreach ($incontext['supported_databases'] as $key => $db) |
|
2144 | - echo ' |
|
2255 | + foreach ($incontext['supported_databases'] as $key => $db) { |
|
2256 | + echo ' |
|
2145 | 2257 | <option value="', $key, '"', isset($_POST['db_type']) && $_POST['db_type'] == $key ? ' selected' : '', '>', $db['name'], '</option>'; |
2258 | + } |
|
2146 | 2259 | |
2147 | 2260 | echo ' |
2148 | 2261 | </select> |
2149 | 2262 | <div class="smalltext block">', $txt['db_settings_type_info'], '</div> |
2150 | 2263 | </td> |
2151 | 2264 | </tr>'; |
2152 | - } |
|
2153 | - else |
|
2265 | + } else |
|
2154 | 2266 | { |
2155 | 2267 | echo ' |
2156 | 2268 | <tr style="display: none;"> |
@@ -2343,9 +2455,10 @@ discard block |
||
2343 | 2455 | <div style="color: red;">', $txt['error_db_queries'], '</div> |
2344 | 2456 | <ul>'; |
2345 | 2457 | |
2346 | - foreach ($incontext['failures'] as $line => $fail) |
|
2347 | - echo ' |
|
2458 | + foreach ($incontext['failures'] as $line => $fail) { |
|
2459 | + echo ' |
|
2348 | 2460 | <li><strong>', $txt['error_db_queries_line'], $line + 1, ':</strong> ', nl2br(htmlspecialchars($fail)), '</li>'; |
2461 | + } |
|
2349 | 2462 | |
2350 | 2463 | echo ' |
2351 | 2464 | </ul>'; |
@@ -2406,15 +2519,16 @@ discard block |
||
2406 | 2519 | </tr> |
2407 | 2520 | </table>'; |
2408 | 2521 | |
2409 | - if ($incontext['require_db_confirm']) |
|
2410 | - echo ' |
|
2522 | + if ($incontext['require_db_confirm']) { |
|
2523 | + echo ' |
|
2411 | 2524 | <h2>', $txt['user_settings_database'], '</h2> |
2412 | 2525 | <p>', $txt['user_settings_database_info'], '</p> |
2413 | 2526 | |
2414 | 2527 | <div style="margin-bottom: 2ex; padding-', $txt['lang_rtl'] == false ? 'left' : 'right', ': 50px;"> |
2415 | 2528 | <input type="password" name="password3" size="30" /> |
2416 | 2529 | </div>'; |
2417 | -} |
|
2530 | + } |
|
2531 | + } |
|
2418 | 2532 | |
2419 | 2533 | // Tell them it's done, and to delete. |
2420 | 2534 | function template_delete_install() |
@@ -2427,14 +2541,15 @@ discard block |
||
2427 | 2541 | template_warning_divs(); |
2428 | 2542 | |
2429 | 2543 | // Install directory still writable? |
2430 | - if ($incontext['dir_still_writable']) |
|
2431 | - echo ' |
|
2544 | + if ($incontext['dir_still_writable']) { |
|
2545 | + echo ' |
|
2432 | 2546 | <em>', $txt['still_writable'], '</em><br> |
2433 | 2547 | <br>'; |
2548 | + } |
|
2434 | 2549 | |
2435 | 2550 | // Don't show the box if it's like 99% sure it won't work :P. |
2436 | - if ($incontext['probably_delete_install']) |
|
2437 | - echo ' |
|
2551 | + if ($incontext['probably_delete_install']) { |
|
2552 | + echo ' |
|
2438 | 2553 | <div style="margin: 1ex; font-weight: bold;"> |
2439 | 2554 | <label for="delete_self"><input type="checkbox" id="delete_self" onclick="doTheDelete();" /> ', $txt['delete_installer'], !isset($_SESSION['installer_temp_ftp']) ? ' ' . $txt['delete_installer_maybe'] : '', '</label> |
2440 | 2555 | </div> |
@@ -2450,6 +2565,7 @@ discard block |
||
2450 | 2565 | } |
2451 | 2566 | </script> |
2452 | 2567 | <br>'; |
2568 | + } |
|
2453 | 2569 | |
2454 | 2570 | echo ' |
2455 | 2571 | ', sprintf($txt['go_to_your_forum'], $boardurl . '/index.php'), '<br> |
@@ -3031,8 +3031,7 @@ |
||
3031 | 3031 | <div class="roundframe"> |
3032 | 3032 | <div> |
3033 | 3033 | ', !empty($context['tfa_backup']) ? ' |
3034 | - <div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : |
|
3035 | - ($modSettings['tfa_mode'] == 2 ? ' |
|
3034 | + <div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : ($modSettings['tfa_mode'] == 2 ? ' |
|
3036 | 3035 | <div class="smalltext"><strong>' . $txt['tfa_forced_desc'] . '</strong></div>' : ''), ' |
3037 | 3036 | <div class="smalltext">', $txt['tfa_desc'], '</div> |
3038 | 3037 | <div id="basicinfo" style="width: 60%"> |
@@ -18,23 +18,25 @@ discard block |
||
18 | 18 | global $context; |
19 | 19 | |
20 | 20 | // Prevent Chrome from auto completing fields when viewing/editing other members profiles |
21 | - if (isBrowser('is_chrome') && !$context['user']['is_owner']) |
|
22 | - echo ' |
|
21 | + if (isBrowser('is_chrome') && !$context['user']['is_owner']) { |
|
22 | + echo ' |
|
23 | 23 | <script> |
24 | 24 | disableAutoComplete(); |
25 | 25 | </script>'; |
26 | + } |
|
26 | 27 | |
27 | 28 | // If an error occurred while trying to save previously, give the user a clue! |
28 | 29 | echo ' |
29 | 30 | ', template_error_message(); |
30 | 31 | |
31 | 32 | // If the profile was update successfully, let the user know this. |
32 | - if (!empty($context['profile_updated'])) |
|
33 | - echo ' |
|
33 | + if (!empty($context['profile_updated'])) { |
|
34 | + echo ' |
|
34 | 35 | <div class="infobox"> |
35 | 36 | ', $context['profile_updated'], ' |
36 | 37 | </div>'; |
37 | -} |
|
38 | + } |
|
39 | + } |
|
38 | 40 | |
39 | 41 | /** |
40 | 42 | * Template for any HTML needed below the profile (closing off divs/tables, etc.) |
@@ -102,8 +104,7 @@ discard block |
||
102 | 104 | if (empty($context['unread_alerts'])) |
103 | 105 | { |
104 | 106 | template_alerts_all_read(); |
105 | - } |
|
106 | - else |
|
107 | + } else |
|
107 | 108 | { |
108 | 109 | foreach ($context['unread_alerts'] as $id_alert => $details) |
109 | 110 | { |
@@ -164,10 +165,11 @@ discard block |
||
164 | 165 | <div class="custom_fields_above_name"> |
165 | 166 | <ul >'; |
166 | 167 | |
167 | - foreach ($context['print_custom_fields']['above_member'] as $field) |
|
168 | - if (!empty($field['output_html'])) |
|
168 | + foreach ($context['print_custom_fields']['above_member'] as $field) { |
|
169 | + if (!empty($field['output_html'])) |
|
169 | 170 | echo ' |
170 | 171 | <li>', $field['output_html'], '</li>'; |
172 | + } |
|
171 | 173 | |
172 | 174 | echo ' |
173 | 175 | </ul> |
@@ -188,10 +190,11 @@ discard block |
||
188 | 190 | <div class="custom_fields_below_avatar"> |
189 | 191 | <ul >'; |
190 | 192 | |
191 | - foreach ($context['print_custom_fields']['below_avatar'] as $field) |
|
192 | - if (!empty($field['output_html'])) |
|
193 | + foreach ($context['print_custom_fields']['below_avatar'] as $field) { |
|
194 | + if (!empty($field['output_html'])) |
|
193 | 195 | echo ' |
194 | 196 | <li>', $field['output_html'], '</li>'; |
197 | + } |
|
195 | 198 | |
196 | 199 | echo ' |
197 | 200 | </ul> |
@@ -202,22 +205,25 @@ discard block |
||
202 | 205 | echo ' |
203 | 206 | <ul class="clear">'; |
204 | 207 | // Email is only visible if it's your profile or you have the moderate_forum permission |
205 | - if ($context['member']['show_email']) |
|
206 | - echo ' |
|
208 | + if ($context['member']['show_email']) { |
|
209 | + echo ' |
|
207 | 210 | <li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>'; |
211 | + } |
|
208 | 212 | |
209 | 213 | // Don't show an icon if they haven't specified a website. |
210 | - if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
|
211 | - echo ' |
|
214 | + if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) { |
|
215 | + echo ' |
|
212 | 216 | <li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
217 | + } |
|
213 | 218 | |
214 | 219 | // Are there any custom profile fields as icons? |
215 | 220 | if (!empty($context['print_custom_fields']['icons'])) |
216 | 221 | { |
217 | - foreach ($context['print_custom_fields']['icons'] as $field) |
|
218 | - if (!empty($field['output_html'])) |
|
222 | + foreach ($context['print_custom_fields']['icons'] as $field) { |
|
223 | + if (!empty($field['output_html'])) |
|
219 | 224 | echo ' |
220 | 225 | <li class="custom_field">', $field['output_html'], '</li>'; |
226 | + } |
|
221 | 227 | } |
222 | 228 | |
223 | 229 | echo ' |
@@ -225,23 +231,26 @@ discard block |
||
225 | 231 | <span id="userstatus">', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : ''; |
226 | 232 | |
227 | 233 | // Can they add this member as a buddy? |
228 | - if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
|
229 | - echo ' |
|
234 | + if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) { |
|
235 | + echo ' |
|
230 | 236 | <br><a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>'; |
237 | + } |
|
231 | 238 | |
232 | 239 | echo ' |
233 | 240 | </span>'; |
234 | 241 | |
235 | - if (!$context['user']['is_owner'] && $context['can_send_pm']) |
|
236 | - echo ' |
|
242 | + if (!$context['user']['is_owner'] && $context['can_send_pm']) { |
|
243 | + echo ' |
|
237 | 244 | <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>'; |
245 | + } |
|
238 | 246 | |
239 | 247 | echo ' |
240 | 248 | <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>'; |
241 | 249 | |
242 | - if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) |
|
243 | - echo ' |
|
250 | + if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) { |
|
251 | + echo ' |
|
244 | 252 | <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>'; |
253 | + } |
|
245 | 254 | |
246 | 255 | echo ' |
247 | 256 | <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>'; |
@@ -253,10 +262,11 @@ discard block |
||
253 | 262 | <div class="custom_fields_bottom"> |
254 | 263 | <ul class="nolist">'; |
255 | 264 | |
256 | - foreach ($context['print_custom_fields']['bottom_poster'] as $field) |
|
257 | - if (!empty($field['output_html'])) |
|
265 | + foreach ($context['print_custom_fields']['bottom_poster'] as $field) { |
|
266 | + if (!empty($field['output_html'])) |
|
258 | 267 | echo ' |
259 | 268 | <li>', $field['output_html'], '</li>'; |
269 | + } |
|
260 | 270 | |
261 | 271 | echo ' |
262 | 272 | </ul> |
@@ -270,15 +280,17 @@ discard block |
||
270 | 280 | <div id="detailedinfo"> |
271 | 281 | <dl class="settings">'; |
272 | 282 | |
273 | - if ($context['user']['is_owner'] || $context['user']['is_admin']) |
|
274 | - echo ' |
|
283 | + if ($context['user']['is_owner'] || $context['user']['is_admin']) { |
|
284 | + echo ' |
|
275 | 285 | <dt>', $txt['username'], ': </dt> |
276 | 286 | <dd>', $context['member']['username'], '</dd>'; |
287 | + } |
|
277 | 288 | |
278 | - if (!isset($context['disabled_fields']['posts'])) |
|
279 | - echo ' |
|
289 | + if (!isset($context['disabled_fields']['posts'])) { |
|
290 | + echo ' |
|
280 | 291 | <dt>', $txt['profile_posts'], ': </dt> |
281 | 292 | <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
293 | + } |
|
282 | 294 | |
283 | 295 | if ($context['member']['show_email']) |
284 | 296 | { |
@@ -287,15 +299,17 @@ discard block |
||
287 | 299 | <dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>'; |
288 | 300 | } |
289 | 301 | |
290 | - if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
|
291 | - echo ' |
|
302 | + if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) { |
|
303 | + echo ' |
|
292 | 304 | <dt>', $txt['custom_title'], ': </dt> |
293 | 305 | <dd>', $context['member']['title'], '</dd>'; |
306 | + } |
|
294 | 307 | |
295 | - if (!empty($context['member']['blurb'])) |
|
296 | - echo ' |
|
308 | + if (!empty($context['member']['blurb'])) { |
|
309 | + echo ' |
|
297 | 310 | <dt>', $txt['personal_text'], ': </dt> |
298 | 311 | <dd>', $context['member']['blurb'], '</dd>'; |
312 | + } |
|
299 | 313 | |
300 | 314 | echo ' |
301 | 315 | <dt>', $txt['age'], ':</dt> |
@@ -309,19 +323,21 @@ discard block |
||
309 | 323 | { |
310 | 324 | $fields = array(); |
311 | 325 | |
312 | - foreach ($context['print_custom_fields']['standard'] as $field) |
|
313 | - if (!empty($field['output_html'])) |
|
326 | + foreach ($context['print_custom_fields']['standard'] as $field) { |
|
327 | + if (!empty($field['output_html'])) |
|
314 | 328 | $fields[] = $field; |
329 | + } |
|
315 | 330 | |
316 | 331 | if (count($fields) > 0) |
317 | 332 | { |
318 | 333 | echo ' |
319 | 334 | <dl class="settings">'; |
320 | 335 | |
321 | - foreach ($fields as $field) |
|
322 | - echo ' |
|
336 | + foreach ($fields as $field) { |
|
337 | + echo ' |
|
323 | 338 | <dt>', $field['name'], ':</dt> |
324 | 339 | <dd>', $field['output_html'], '</dd>'; |
340 | + } |
|
325 | 341 | |
326 | 342 | echo ' |
327 | 343 | </dl>'; |
@@ -341,9 +357,10 @@ discard block |
||
341 | 357 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>'; |
342 | 358 | |
343 | 359 | // Can we provide information on what this means? |
344 | - if (!empty($context['warning_status'])) |
|
345 | - echo ' |
|
360 | + if (!empty($context['warning_status'])) { |
|
361 | + echo ' |
|
346 | 362 | <span class="smalltext">(', $context['warning_status'], ')</span>'; |
363 | + } |
|
347 | 364 | |
348 | 365 | echo ' |
349 | 366 | </dd>'; |
@@ -354,9 +371,10 @@ discard block |
||
354 | 371 | { |
355 | 372 | |
356 | 373 | // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
357 | - if (!empty($context['activate_message'])) |
|
358 | - echo ' |
|
374 | + if (!empty($context['activate_message'])) { |
|
375 | + echo ' |
|
359 | 376 | <dt class="clear"><span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>)</dt>'; |
377 | + } |
|
360 | 378 | |
361 | 379 | // If the current member is banned, show a message and possibly a link to the ban. |
362 | 380 | if (!empty($context['member']['bans'])) |
@@ -366,9 +384,10 @@ discard block |
||
366 | 384 | <dt class="clear" id="ban_info" style="display: none;"> |
367 | 385 | <strong>', $txt['user_banned_by_following'], ':</strong>'; |
368 | 386 | |
369 | - foreach ($context['member']['bans'] as $ban) |
|
370 | - echo ' |
|
387 | + foreach ($context['member']['bans'] as $ban) { |
|
388 | + echo ' |
|
371 | 389 | <br><span class="smalltext">', $ban['explanation'], '</span>'; |
390 | + } |
|
372 | 391 | |
373 | 392 | echo ' |
374 | 393 | </dt>'; |
@@ -382,30 +401,34 @@ discard block |
||
382 | 401 | // If the person looking is allowed, they can check the members IP address and hostname. |
383 | 402 | if ($context['can_see_ip']) |
384 | 403 | { |
385 | - if (!empty($context['member']['ip'])) |
|
386 | - echo ' |
|
404 | + if (!empty($context['member']['ip'])) { |
|
405 | + echo ' |
|
387 | 406 | <dt>', $txt['ip'], ': </dt> |
388 | 407 | <dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
408 | + } |
|
389 | 409 | |
390 | - if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
|
391 | - echo ' |
|
410 | + if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) { |
|
411 | + echo ' |
|
392 | 412 | <dt>', $txt['hostname'], ': </dt> |
393 | 413 | <dd>', $context['member']['hostname'], '</dd>'; |
414 | + } |
|
394 | 415 | } |
395 | 416 | |
396 | 417 | echo ' |
397 | 418 | <dt>', $txt['local_time'], ':</dt> |
398 | 419 | <dd>', $context['member']['local_time'], '</dd>'; |
399 | 420 | |
400 | - if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
|
401 | - echo ' |
|
421 | + if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) { |
|
422 | + echo ' |
|
402 | 423 | <dt>', $txt['language'], ':</dt> |
403 | 424 | <dd>', $context['member']['language'], '</dd>'; |
425 | + } |
|
404 | 426 | |
405 | - if ($context['member']['show_last_login']) |
|
406 | - echo ' |
|
427 | + if ($context['member']['show_last_login']) { |
|
428 | + echo ' |
|
407 | 429 | <dt>', $txt['lastLoggedIn'], ': </dt> |
408 | 430 | <dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>'; |
431 | + } |
|
409 | 432 | |
410 | 433 | echo ' |
411 | 434 | </dl>'; |
@@ -417,10 +440,11 @@ discard block |
||
417 | 440 | <div class="custom_fields_above_signature"> |
418 | 441 | <ul class="nolist">'; |
419 | 442 | |
420 | - foreach ($context['print_custom_fields']['above_signature'] as $field) |
|
421 | - if (!empty($field['output_html'])) |
|
443 | + foreach ($context['print_custom_fields']['above_signature'] as $field) { |
|
444 | + if (!empty($field['output_html'])) |
|
422 | 445 | echo ' |
423 | 446 | <li>', $field['output_html'], '</li>'; |
447 | + } |
|
424 | 448 | |
425 | 449 | echo ' |
426 | 450 | </ul> |
@@ -428,12 +452,13 @@ discard block |
||
428 | 452 | } |
429 | 453 | |
430 | 454 | // Show the users signature. |
431 | - if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
|
432 | - echo ' |
|
455 | + if ($context['signature_enabled'] && !empty($context['member']['signature'])) { |
|
456 | + echo ' |
|
433 | 457 | <div class="signature"> |
434 | 458 | <h5>', $txt['signature'], ':</h5> |
435 | 459 | ', $context['member']['signature'], ' |
436 | 460 | </div>'; |
461 | + } |
|
437 | 462 | |
438 | 463 | // Are there any custom profile fields for below the signature? |
439 | 464 | if (!empty($context['print_custom_fields']['below_signature'])) |
@@ -442,10 +467,11 @@ discard block |
||
442 | 467 | <div class="custom_fields_below_signature"> |
443 | 468 | <ul class="nolist">'; |
444 | 469 | |
445 | - foreach ($context['print_custom_fields']['below_signature'] as $field) |
|
446 | - if (!empty($field['output_html'])) |
|
470 | + foreach ($context['print_custom_fields']['below_signature'] as $field) { |
|
471 | + if (!empty($field['output_html'])) |
|
447 | 472 | echo ' |
448 | 473 | <li>', $field['output_html'], '</li>'; |
474 | + } |
|
449 | 475 | |
450 | 476 | echo ' |
451 | 477 | </ul> |
@@ -490,62 +516,70 @@ discard block |
||
490 | 516 | </div> |
491 | 517 | <div class="list_posts">'; |
492 | 518 | |
493 | - if (!$post['approved']) |
|
494 | - echo ' |
|
519 | + if (!$post['approved']) { |
|
520 | + echo ' |
|
495 | 521 | <div class="approve_post"> |
496 | 522 | <em>', $txt['post_awaiting_approval'], '</em> |
497 | 523 | </div>'; |
524 | + } |
|
498 | 525 | |
499 | 526 | echo ' |
500 | 527 | ', $post['body'], ' |
501 | 528 | </div>'; |
502 | 529 | |
503 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
504 | - echo ' |
|
530 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
531 | + echo ' |
|
505 | 532 | <div class="floatright"> |
506 | 533 | <ul class="quickbuttons">'; |
534 | + } |
|
507 | 535 | |
508 | 536 | // If they *can* reply? |
509 | - if ($post['can_reply']) |
|
510 | - echo ' |
|
537 | + if ($post['can_reply']) { |
|
538 | + echo ' |
|
511 | 539 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
540 | + } |
|
512 | 541 | |
513 | 542 | // If they *can* quote? |
514 | - if ($post['can_quote']) |
|
515 | - echo ' |
|
543 | + if ($post['can_quote']) { |
|
544 | + echo ' |
|
516 | 545 | <li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
546 | + } |
|
517 | 547 | |
518 | 548 | // How about... even... remove it entirely?! |
519 | - if ($post['can_delete']) |
|
520 | - echo ' |
|
549 | + if ($post['can_delete']) { |
|
550 | + echo ' |
|
521 | 551 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
552 | + } |
|
522 | 553 | |
523 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
524 | - echo ' |
|
554 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
555 | + echo ' |
|
525 | 556 | </ul> |
526 | 557 | </div>'; |
558 | + } |
|
527 | 559 | |
528 | 560 | echo ' |
529 | 561 | </div>'; |
530 | 562 | } |
563 | + } else { |
|
564 | + template_show_list('attachments'); |
|
531 | 565 | } |
532 | - else |
|
533 | - template_show_list('attachments'); |
|
534 | 566 | |
535 | 567 | // No posts? Just end with a informative message. |
536 | - if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) |
|
537 | - echo ' |
|
568 | + if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) { |
|
569 | + echo ' |
|
538 | 570 | <div class="windowbg2"> |
539 | 571 | ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), ' |
540 | 572 | </div>'; |
573 | + } |
|
541 | 574 | |
542 | 575 | // Show more page numbers. |
543 | - if (!empty($context['page_index'])) |
|
544 | - echo ' |
|
576 | + if (!empty($context['page_index'])) { |
|
577 | + echo ' |
|
545 | 578 | <div class="pagesection"> |
546 | 579 | <div class="pagelinks">', $context['page_index'], '</div> |
547 | 580 | </div>'; |
548 | -} |
|
581 | + } |
|
582 | + } |
|
549 | 583 | |
550 | 584 | /** |
551 | 585 | * Template for showing alerts within the alerts popup |
@@ -555,11 +589,12 @@ discard block |
||
555 | 589 | global $context, $txt, $scripturl; |
556 | 590 | |
557 | 591 | // Do we have an update message? |
558 | - if (!empty($context['update_message'])) |
|
559 | - echo ' |
|
592 | + if (!empty($context['update_message'])) { |
|
593 | + echo ' |
|
560 | 594 | <div class="infobox"> |
561 | 595 | ', $context['update_message'], '. |
562 | 596 | </div>'; |
597 | + } |
|
563 | 598 | |
564 | 599 | echo ' |
565 | 600 | <div class="cat_bar"> |
@@ -568,13 +603,12 @@ discard block |
||
568 | 603 | </h3> |
569 | 604 | </div>'; |
570 | 605 | |
571 | - if (empty($context['alerts'])) |
|
572 | - echo ' |
|
606 | + if (empty($context['alerts'])) { |
|
607 | + echo ' |
|
573 | 608 | <div class="information"> |
574 | 609 | ', $txt['alerts_none'], ' |
575 | 610 | </div>'; |
576 | - |
|
577 | - else |
|
611 | + } else |
|
578 | 612 | { |
579 | 613 | // Start the form. |
580 | 614 | echo ' |
@@ -636,12 +670,12 @@ discard block |
||
636 | 670 | </div>' : ''; |
637 | 671 | |
638 | 672 | // No drafts? Just show an informative message. |
639 | - if (empty($context['drafts'])) |
|
640 | - echo ' |
|
673 | + if (empty($context['drafts'])) { |
|
674 | + echo ' |
|
641 | 675 | <div class="windowbg2 centertext"> |
642 | 676 | ', $txt['draft_none'], ' |
643 | 677 | </div>'; |
644 | - else |
|
678 | + } else |
|
645 | 679 | { |
646 | 680 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
647 | 681 | foreach ($context['drafts'] as $draft) |
@@ -652,11 +686,13 @@ discard block |
||
652 | 686 | <div class="topic_details"> |
653 | 687 | <h5><strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> '; |
654 | 688 | |
655 | - if (!empty($draft['sticky'])) |
|
656 | - echo '<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
|
689 | + if (!empty($draft['sticky'])) { |
|
690 | + echo '<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
|
691 | + } |
|
657 | 692 | |
658 | - if (!empty($draft['locked'])) |
|
659 | - echo '<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
|
693 | + if (!empty($draft['locked'])) { |
|
694 | + echo '<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
|
695 | + } |
|
660 | 696 | |
661 | 697 | echo ' |
662 | 698 | </h5> |
@@ -689,12 +725,13 @@ discard block |
||
689 | 725 | { |
690 | 726 | global $context, $scripturl, $txt; |
691 | 727 | |
692 | - if (!empty($context['saved_successful'])) |
|
693 | - echo ' |
|
728 | + if (!empty($context['saved_successful'])) { |
|
729 | + echo ' |
|
694 | 730 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
695 | - elseif (!empty($context['saved_failed'])) |
|
696 | - echo ' |
|
731 | + } elseif (!empty($context['saved_failed'])) { |
|
732 | + echo ' |
|
697 | 733 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
734 | + } |
|
698 | 735 | |
699 | 736 | echo ' |
700 | 737 | <div id="edit_buddies"> |
@@ -708,24 +745,27 @@ discard block |
||
708 | 745 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
709 | 746 | <th scope="col">', $txt['status'], '</th>'; |
710 | 747 | |
711 | - if (allowedTo('moderate_forum')) |
|
712 | - echo ' |
|
748 | + if (allowedTo('moderate_forum')) { |
|
749 | + echo ' |
|
713 | 750 | <th scope="col">', $txt['email'], '</th>'; |
751 | + } |
|
714 | 752 | |
715 | - if (!empty($context['custom_pf'])) |
|
716 | - foreach ($context['custom_pf'] as $column) |
|
753 | + if (!empty($context['custom_pf'])) { |
|
754 | + foreach ($context['custom_pf'] as $column) |
|
717 | 755 | echo '<th scope="col">', $column['label'], '</th>'; |
756 | + } |
|
718 | 757 | |
719 | 758 | echo ' |
720 | 759 | <th scope="col">', $txt['remove'], '</th> |
721 | 760 | </tr>'; |
722 | 761 | |
723 | 762 | // If they don't have any buddies don't list them! |
724 | - if (empty($context['buddies'])) |
|
725 | - echo ' |
|
763 | + if (empty($context['buddies'])) { |
|
764 | + echo ' |
|
726 | 765 | <tr class="windowbg"> |
727 | 766 | <td colspan="', allowedTo('moderate_forum') ? '10' : '9', '"><strong>', $txt['no_buddies'], '</strong></td> |
728 | 767 | </tr>'; |
768 | + } |
|
729 | 769 | |
730 | 770 | // Now loop through each buddy showing info on each. |
731 | 771 | else |
@@ -737,15 +777,17 @@ discard block |
||
737 | 777 | <td>', $buddy['link'], '</td> |
738 | 778 | <td><a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a></td>'; |
739 | 779 | |
740 | - if ($buddy['show_email']) |
|
741 | - echo ' |
|
780 | + if ($buddy['show_email']) { |
|
781 | + echo ' |
|
742 | 782 | <td><a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a></td>'; |
783 | + } |
|
743 | 784 | |
744 | 785 | // Show the custom profile fields for this user. |
745 | - if (!empty($context['custom_pf'])) |
|
746 | - foreach ($context['custom_pf'] as $key => $column) |
|
786 | + if (!empty($context['custom_pf'])) { |
|
787 | + foreach ($context['custom_pf'] as $key => $column) |
|
747 | 788 | echo ' |
748 | 789 | <td class="lefttext">', $buddy['options'][$key], '</td>'; |
790 | + } |
|
749 | 791 | |
750 | 792 | echo ' |
751 | 793 | <td><a href="', $scripturl, '?action=profile;area=lists;sa=buddies;u=', $context['id_member'], ';remove=', $buddy['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['buddy_remove'], '"></span></a></td> |
@@ -775,9 +817,10 @@ discard block |
||
775 | 817 | </dl> |
776 | 818 | </div>'; |
777 | 819 | |
778 | - if (!empty($context['token_check'])) |
|
779 | - echo ' |
|
820 | + if (!empty($context['token_check'])) { |
|
821 | + echo ' |
|
780 | 822 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
823 | + } |
|
781 | 824 | |
782 | 825 | echo ' |
783 | 826 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -803,12 +846,13 @@ discard block |
||
803 | 846 | { |
804 | 847 | global $context, $scripturl, $txt; |
805 | 848 | |
806 | - if (!empty($context['saved_successful'])) |
|
807 | - echo ' |
|
849 | + if (!empty($context['saved_successful'])) { |
|
850 | + echo ' |
|
808 | 851 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
809 | - elseif (!empty($context['saved_failed'])) |
|
810 | - echo ' |
|
852 | + } elseif (!empty($context['saved_failed'])) { |
|
853 | + echo ' |
|
811 | 854 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
855 | + } |
|
812 | 856 | |
813 | 857 | echo ' |
814 | 858 | <div id="edit_buddies"> |
@@ -822,20 +866,22 @@ discard block |
||
822 | 866 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
823 | 867 | <th scope="col">', $txt['status'], '</th>'; |
824 | 868 | |
825 | - if (allowedTo('moderate_forum')) |
|
826 | - echo ' |
|
869 | + if (allowedTo('moderate_forum')) { |
|
870 | + echo ' |
|
827 | 871 | <th scope="col">', $txt['email'], '</th>'; |
872 | + } |
|
828 | 873 | |
829 | 874 | echo ' |
830 | 875 | <th scope="col">', $txt['ignore_remove'], '</th> |
831 | 876 | </tr>'; |
832 | 877 | |
833 | 878 | // If they don't have anyone on their ignore list, don't list it! |
834 | - if (empty($context['ignore_list'])) |
|
835 | - echo ' |
|
879 | + if (empty($context['ignore_list'])) { |
|
880 | + echo ' |
|
836 | 881 | <tr class="windowbg"> |
837 | 882 | <td colspan="', allowedTo('moderate_forum') ? '4' : '3', '"><strong>', $txt['no_ignore'], '</strong></td> |
838 | 883 | </tr>'; |
884 | + } |
|
839 | 885 | |
840 | 886 | // Now loop through each buddy showing info on each. |
841 | 887 | foreach ($context['ignore_list'] as $member) |
@@ -845,9 +891,10 @@ discard block |
||
845 | 891 | <td>', $member['link'], '</td> |
846 | 892 | <td><a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a></td>'; |
847 | 893 | |
848 | - if ($member['show_email']) |
|
849 | - echo ' |
|
894 | + if ($member['show_email']) { |
|
895 | + echo ' |
|
850 | 896 | <td><a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a></td>'; |
897 | + } |
|
851 | 898 | echo ' |
852 | 899 | <td><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a></td> |
853 | 900 | </tr>'; |
@@ -874,9 +921,10 @@ discard block |
||
874 | 921 | </dl> |
875 | 922 | </div>'; |
876 | 923 | |
877 | - if (!empty($context['token_check'])) |
|
878 | - echo ' |
|
924 | + if (!empty($context['token_check'])) { |
|
925 | + echo ' |
|
879 | 926 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
927 | + } |
|
880 | 928 | |
881 | 929 | echo ' |
882 | 930 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -921,9 +969,10 @@ discard block |
||
921 | 969 | <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>'; |
922 | 970 | |
923 | 971 | // Second address detected? |
924 | - if (!empty($context['last_ip2'])) |
|
925 | - echo ' |
|
972 | + if (!empty($context['last_ip2'])) { |
|
973 | + echo ' |
|
926 | 974 | , <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>'; |
975 | + } |
|
927 | 976 | |
928 | 977 | echo ' |
929 | 978 | </dd>'; |
@@ -988,9 +1037,10 @@ discard block |
||
988 | 1037 | <h3 class="catbg">', $txt['whois_title'], ' ', $context['ip'], '</h3> |
989 | 1038 | </div> |
990 | 1039 | <div class="windowbg2 noup">'; |
991 | - foreach ($context['whois_servers'] as $server) |
|
992 | - echo ' |
|
1040 | + foreach ($context['whois_servers'] as $server) { |
|
1041 | + echo ' |
|
993 | 1042 | <a href="', $server['url'], '" target="_blank"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>'; |
1043 | + } |
|
994 | 1044 | echo ' |
995 | 1045 | </div> |
996 | 1046 | <br>'; |
@@ -1001,10 +1051,10 @@ discard block |
||
1001 | 1051 | <div class="cat_bar"> |
1002 | 1052 | <h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3> |
1003 | 1053 | </div>'; |
1004 | - if (empty($context['ips'])) |
|
1005 | - echo ' |
|
1054 | + if (empty($context['ips'])) { |
|
1055 | + echo ' |
|
1006 | 1056 | <p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>'; |
1007 | - else |
|
1057 | + } else |
|
1008 | 1058 | { |
1009 | 1059 | echo ' |
1010 | 1060 | <table class="table_grid"> |
@@ -1017,12 +1067,13 @@ discard block |
||
1017 | 1067 | <tbody>'; |
1018 | 1068 | |
1019 | 1069 | // Loop through each of the members and display them. |
1020 | - foreach ($context['ips'] as $ip => $memberlist) |
|
1021 | - echo ' |
|
1070 | + foreach ($context['ips'] as $ip => $memberlist) { |
|
1071 | + echo ' |
|
1022 | 1072 | <tr class="windowbg"> |
1023 | 1073 | <td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td> |
1024 | 1074 | <td>', implode(', ', $memberlist), '</td> |
1025 | 1075 | </tr>'; |
1076 | + } |
|
1026 | 1077 | |
1027 | 1078 | echo ' |
1028 | 1079 | </tbody> |
@@ -1068,8 +1119,7 @@ discard block |
||
1068 | 1119 | { |
1069 | 1120 | echo ' |
1070 | 1121 | <div class="information">', $txt['showPermissions_all'], '</div>'; |
1071 | - } |
|
1072 | - else |
|
1122 | + } else |
|
1073 | 1123 | { |
1074 | 1124 | echo ' |
1075 | 1125 | <div class="information">',$txt['showPermissions_help'], '</div> |
@@ -1083,9 +1133,10 @@ discard block |
||
1083 | 1133 | </div> |
1084 | 1134 | <div class="windowbg smalltext"> |
1085 | 1135 | ', $txt['showPermissions_restricted_boards_desc'], ':<br>'; |
1086 | - foreach ($context['no_access_boards'] as $no_access_board) |
|
1087 | - echo ' |
|
1136 | + foreach ($context['no_access_boards'] as $no_access_board) { |
|
1137 | + echo ' |
|
1088 | 1138 | <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', '; |
1139 | + } |
|
1089 | 1140 | echo ' |
1090 | 1141 | </div>'; |
1091 | 1142 | } |
@@ -1117,12 +1168,13 @@ discard block |
||
1117 | 1168 | </td> |
1118 | 1169 | <td class="smalltext">'; |
1119 | 1170 | |
1120 | - if ($permission['is_denied']) |
|
1121 | - echo ' |
|
1171 | + if ($permission['is_denied']) { |
|
1172 | + echo ' |
|
1122 | 1173 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1123 | - else |
|
1124 | - echo ' |
|
1174 | + } else { |
|
1175 | + echo ' |
|
1125 | 1176 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
1177 | + } |
|
1126 | 1178 | |
1127 | 1179 | echo ' |
1128 | 1180 | </td> |
@@ -1132,10 +1184,10 @@ discard block |
||
1132 | 1184 | </tbody> |
1133 | 1185 | </table> |
1134 | 1186 | </div><br>'; |
1135 | - } |
|
1136 | - else |
|
1137 | - echo ' |
|
1187 | + } else { |
|
1188 | + echo ' |
|
1138 | 1189 | <p class="windowbg2">', $txt['showPermissions_none_general'], '</p>'; |
1190 | + } |
|
1139 | 1191 | |
1140 | 1192 | // Board permission section. |
1141 | 1193 | echo ' |
@@ -1145,14 +1197,16 @@ discard block |
||
1145 | 1197 | <a id="board_permissions"></a>', $txt['showPermissions_select'], ': |
1146 | 1198 | <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
1147 | 1199 | <option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], ' </option>'; |
1148 | - if (!empty($context['boards'])) |
|
1149 | - echo ' |
|
1200 | + if (!empty($context['boards'])) { |
|
1201 | + echo ' |
|
1150 | 1202 | <option value="" disabled>---------------------------</option>'; |
1203 | + } |
|
1151 | 1204 | |
1152 | 1205 | // Fill the box with any local permission boards. |
1153 | - foreach ($context['boards'] as $board) |
|
1154 | - echo ' |
|
1206 | + foreach ($context['boards'] as $board) { |
|
1207 | + echo ' |
|
1155 | 1208 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
1209 | + } |
|
1156 | 1210 | |
1157 | 1211 | echo ' |
1158 | 1212 | </select> |
@@ -1183,8 +1237,7 @@ discard block |
||
1183 | 1237 | { |
1184 | 1238 | echo ' |
1185 | 1239 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1186 | - } |
|
1187 | - else |
|
1240 | + } else |
|
1188 | 1241 | { |
1189 | 1242 | echo ' |
1190 | 1243 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
@@ -1196,10 +1249,10 @@ discard block |
||
1196 | 1249 | echo ' |
1197 | 1250 | </tbody> |
1198 | 1251 | </table>'; |
1199 | - } |
|
1200 | - else |
|
1201 | - echo ' |
|
1252 | + } else { |
|
1253 | + echo ' |
|
1202 | 1254 | <p class="windowbg2">', $txt['showPermissions_none_board'], '</p>'; |
1255 | + } |
|
1203 | 1256 | echo ' |
1204 | 1257 | </div> |
1205 | 1258 | </div>'; |
@@ -1241,9 +1294,10 @@ discard block |
||
1241 | 1294 | </div>'; |
1242 | 1295 | |
1243 | 1296 | // If they haven't post at all, don't draw the graph. |
1244 | - if (empty($context['posts_by_time'])) |
|
1245 | - echo ' |
|
1297 | + if (empty($context['posts_by_time'])) { |
|
1298 | + echo ' |
|
1246 | 1299 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1300 | + } |
|
1247 | 1301 | // Otherwise do! |
1248 | 1302 | else |
1249 | 1303 | { |
@@ -1282,11 +1336,10 @@ discard block |
||
1282 | 1336 | </h3> |
1283 | 1337 | </div>'; |
1284 | 1338 | |
1285 | - if (empty($context['popular_boards'])) |
|
1286 | - echo ' |
|
1339 | + if (empty($context['popular_boards'])) { |
|
1340 | + echo ' |
|
1287 | 1341 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1288 | - |
|
1289 | - else |
|
1342 | + } else |
|
1290 | 1343 | { |
1291 | 1344 | echo ' |
1292 | 1345 | <dl class="stats">'; |
@@ -1317,10 +1370,10 @@ discard block |
||
1317 | 1370 | </h3> |
1318 | 1371 | </div>'; |
1319 | 1372 | |
1320 | - if (empty($context['board_activity'])) |
|
1321 | - echo ' |
|
1373 | + if (empty($context['board_activity'])) { |
|
1374 | + echo ' |
|
1322 | 1375 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1323 | - else |
|
1376 | + } else |
|
1324 | 1377 | { |
1325 | 1378 | echo ' |
1326 | 1379 | <dl class="stats">'; |
@@ -1368,41 +1421,46 @@ discard block |
||
1368 | 1421 | <h3 class="catbg profile_hd">'; |
1369 | 1422 | |
1370 | 1423 | // Don't say "Profile" if this isn't the profile... |
1371 | - if (!empty($context['profile_header_text'])) |
|
1372 | - echo ' |
|
1424 | + if (!empty($context['profile_header_text'])) { |
|
1425 | + echo ' |
|
1373 | 1426 | ', $context['profile_header_text']; |
1374 | - else |
|
1375 | - echo ' |
|
1427 | + } else { |
|
1428 | + echo ' |
|
1376 | 1429 | ', $txt['profile']; |
1430 | + } |
|
1377 | 1431 | |
1378 | 1432 | echo ' |
1379 | 1433 | </h3> |
1380 | 1434 | </div>'; |
1381 | 1435 | |
1382 | 1436 | // Have we some description? |
1383 | - if ($context['page_desc']) |
|
1384 | - echo ' |
|
1437 | + if ($context['page_desc']) { |
|
1438 | + echo ' |
|
1385 | 1439 | <p class="information">', $context['page_desc'], '</p>'; |
1440 | + } |
|
1386 | 1441 | |
1387 | 1442 | echo ' |
1388 | 1443 | <div class="roundframe">'; |
1389 | 1444 | |
1390 | 1445 | // Any bits at the start? |
1391 | - if (!empty($context['profile_prehtml'])) |
|
1392 | - echo ' |
|
1446 | + if (!empty($context['profile_prehtml'])) { |
|
1447 | + echo ' |
|
1393 | 1448 | <div>', $context['profile_prehtml'], '</div>'; |
1449 | + } |
|
1394 | 1450 | |
1395 | - if (!empty($context['profile_fields'])) |
|
1396 | - echo ' |
|
1451 | + if (!empty($context['profile_fields'])) { |
|
1452 | + echo ' |
|
1397 | 1453 | <dl class="settings">'; |
1454 | + } |
|
1398 | 1455 | |
1399 | 1456 | // Start the big old loop 'of love. |
1400 | 1457 | $lastItem = 'hr'; |
1401 | 1458 | foreach ($context['profile_fields'] as $key => $field) |
1402 | 1459 | { |
1403 | 1460 | // We add a little hack to be sure we never get more than one hr in a row! |
1404 | - if ($lastItem == 'hr' && $field['type'] == 'hr') |
|
1405 | - continue; |
|
1461 | + if ($lastItem == 'hr' && $field['type'] == 'hr') { |
|
1462 | + continue; |
|
1463 | + } |
|
1406 | 1464 | |
1407 | 1465 | $lastItem = $field['type']; |
1408 | 1466 | if ($field['type'] == 'hr') |
@@ -1411,48 +1469,50 @@ discard block |
||
1411 | 1469 | </dl> |
1412 | 1470 | <hr> |
1413 | 1471 | <dl class="settings">'; |
1414 | - } |
|
1415 | - elseif ($field['type'] == 'callback') |
|
1472 | + } elseif ($field['type'] == 'callback') |
|
1416 | 1473 | { |
1417 | 1474 | if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) |
1418 | 1475 | { |
1419 | 1476 | $callback_func = 'template_profile_' . $field['callback_func']; |
1420 | 1477 | $callback_func(); |
1421 | 1478 | } |
1422 | - } |
|
1423 | - else |
|
1479 | + } else |
|
1424 | 1480 | { |
1425 | 1481 | echo ' |
1426 | 1482 | <dt> |
1427 | 1483 | <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>'; |
1428 | 1484 | |
1429 | 1485 | // Does it have any subtext to show? |
1430 | - if (!empty($field['subtext'])) |
|
1431 | - echo ' |
|
1486 | + if (!empty($field['subtext'])) { |
|
1487 | + echo ' |
|
1432 | 1488 | <br> |
1433 | 1489 | <span class="smalltext">', $field['subtext'], '</span>'; |
1490 | + } |
|
1434 | 1491 | |
1435 | 1492 | echo ' |
1436 | 1493 | </dt> |
1437 | 1494 | <dd>'; |
1438 | 1495 | |
1439 | 1496 | // Want to put something infront of the box? |
1440 | - if (!empty($field['preinput'])) |
|
1441 | - echo ' |
|
1497 | + if (!empty($field['preinput'])) { |
|
1498 | + echo ' |
|
1442 | 1499 | ', $field['preinput']; |
1500 | + } |
|
1443 | 1501 | |
1444 | 1502 | // What type of data are we showing? |
1445 | - if ($field['type'] == 'label') |
|
1446 | - echo ' |
|
1503 | + if ($field['type'] == 'label') { |
|
1504 | + echo ' |
|
1447 | 1505 | ', $field['value']; |
1506 | + } |
|
1448 | 1507 | |
1449 | 1508 | // Maybe it's a text box - very likely! |
1450 | 1509 | elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) |
1451 | 1510 | { |
1452 | - if ($field['type'] == 'int' || $field['type'] == 'float') |
|
1453 | - $type = 'number'; |
|
1454 | - else |
|
1455 | - $type = $field['type']; |
|
1511 | + if ($field['type'] == 'int' || $field['type'] == 'float') { |
|
1512 | + $type = 'number'; |
|
1513 | + } else { |
|
1514 | + $type = $field['type']; |
|
1515 | + } |
|
1456 | 1516 | $step = $field['type'] == 'float' ? ' step="0.1"' : ''; |
1457 | 1517 | |
1458 | 1518 | |
@@ -1460,9 +1520,10 @@ discard block |
||
1460 | 1520 | <input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>'; |
1461 | 1521 | } |
1462 | 1522 | // You "checking" me out? ;) |
1463 | - elseif ($field['type'] == 'check') |
|
1464 | - echo ' |
|
1523 | + elseif ($field['type'] == 'check') { |
|
1524 | + echo ' |
|
1465 | 1525 | <input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>'; |
1526 | + } |
|
1466 | 1527 | |
1467 | 1528 | // Always fun - select boxes! |
1468 | 1529 | elseif ($field['type'] == 'select') |
@@ -1473,13 +1534,15 @@ discard block |
||
1473 | 1534 | if (isset($field['options'])) |
1474 | 1535 | { |
1475 | 1536 | // Is this some code to generate the options? |
1476 | - if (!is_array($field['options'])) |
|
1477 | - $field['options'] = $field['options'](); |
|
1537 | + if (!is_array($field['options'])) { |
|
1538 | + $field['options'] = $field['options'](); |
|
1539 | + } |
|
1478 | 1540 | // Assuming we now have some! |
1479 | - if (is_array($field['options'])) |
|
1480 | - foreach ($field['options'] as $value => $name) |
|
1541 | + if (is_array($field['options'])) { |
|
1542 | + foreach ($field['options'] as $value => $name) |
|
1481 | 1543 | echo ' |
1482 | 1544 | <option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
1545 | + } |
|
1483 | 1546 | } |
1484 | 1547 | |
1485 | 1548 | echo ' |
@@ -1487,25 +1550,28 @@ discard block |
||
1487 | 1550 | } |
1488 | 1551 | |
1489 | 1552 | // Something to end with? |
1490 | - if (!empty($field['postinput'])) |
|
1491 | - echo ' |
|
1553 | + if (!empty($field['postinput'])) { |
|
1554 | + echo ' |
|
1492 | 1555 | ', $field['postinput']; |
1556 | + } |
|
1493 | 1557 | |
1494 | 1558 | echo ' |
1495 | 1559 | </dd>'; |
1496 | 1560 | } |
1497 | 1561 | } |
1498 | 1562 | |
1499 | - if (!empty($context['profile_fields'])) |
|
1500 | - echo ' |
|
1563 | + if (!empty($context['profile_fields'])) { |
|
1564 | + echo ' |
|
1501 | 1565 | </dl>'; |
1566 | + } |
|
1502 | 1567 | |
1503 | 1568 | // Are there any custom profile fields - if so print them! |
1504 | 1569 | if (!empty($context['custom_fields'])) |
1505 | 1570 | { |
1506 | - if ($lastItem != 'hr') |
|
1507 | - echo ' |
|
1571 | + if ($lastItem != 'hr') { |
|
1572 | + echo ' |
|
1508 | 1573 | <hr>'; |
1574 | + } |
|
1509 | 1575 | |
1510 | 1576 | echo ' |
1511 | 1577 | <dl class="settings">'; |
@@ -1528,13 +1594,14 @@ discard block |
||
1528 | 1594 | } |
1529 | 1595 | |
1530 | 1596 | // Any closing HTML? |
1531 | - if (!empty($context['profile_posthtml'])) |
|
1532 | - echo ' |
|
1597 | + if (!empty($context['profile_posthtml'])) { |
|
1598 | + echo ' |
|
1533 | 1599 | <div>', $context['profile_posthtml'], '</div>'; |
1600 | + } |
|
1534 | 1601 | |
1535 | 1602 | // Only show the password box if it's actually needed. |
1536 | - if ($context['require_password']) |
|
1537 | - echo ' |
|
1603 | + if ($context['require_password']) { |
|
1604 | + echo ' |
|
1538 | 1605 | <dl class="settings"> |
1539 | 1606 | <dt> |
1540 | 1607 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br> |
@@ -1544,18 +1611,21 @@ discard block |
||
1544 | 1611 | <input type="password" name="oldpasswrd" id="oldpasswrd" size="20" style="margin-right: 4ex;"> |
1545 | 1612 | </dd> |
1546 | 1613 | </dl>'; |
1614 | + } |
|
1547 | 1615 | |
1548 | 1616 | // The button shouldn't say "Change profile" unless we're changing the profile... |
1549 | - if (!empty($context['submit_button_text'])) |
|
1550 | - echo ' |
|
1617 | + if (!empty($context['submit_button_text'])) { |
|
1618 | + echo ' |
|
1551 | 1619 | <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button">'; |
1552 | - else |
|
1553 | - echo ' |
|
1620 | + } else { |
|
1621 | + echo ' |
|
1554 | 1622 | <input type="submit" name="save" value="', $txt['change_profile'], '" class="button">'; |
1623 | + } |
|
1555 | 1624 | |
1556 | - if (!empty($context['token_check'])) |
|
1557 | - echo ' |
|
1625 | + if (!empty($context['token_check'])) { |
|
1626 | + echo ' |
|
1558 | 1627 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
1628 | + } |
|
1559 | 1629 | |
1560 | 1630 | echo ' |
1561 | 1631 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1565,10 +1635,11 @@ discard block |
||
1565 | 1635 | </form>'; |
1566 | 1636 | |
1567 | 1637 | // Any final spellchecking stuff? |
1568 | - if (!empty($context['show_spellchecking'])) |
|
1569 | - echo ' |
|
1638 | + if (!empty($context['show_spellchecking'])) { |
|
1639 | + echo ' |
|
1570 | 1640 | <form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>'; |
1571 | -} |
|
1641 | + } |
|
1642 | + } |
|
1572 | 1643 | |
1573 | 1644 | /** |
1574 | 1645 | * Personal Message settings. |
@@ -1605,10 +1676,11 @@ discard block |
||
1605 | 1676 | <select name="pm_receive_from" id="pm_receive_from"> |
1606 | 1677 | <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>'; |
1607 | 1678 | |
1608 | - if (!empty($modSettings['enable_buddylist'])) |
|
1609 | - echo ' |
|
1679 | + if (!empty($modSettings['enable_buddylist'])) { |
|
1680 | + echo ' |
|
1610 | 1681 | <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option> |
1611 | 1682 | <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>'; |
1683 | + } |
|
1612 | 1684 | |
1613 | 1685 | echo ' |
1614 | 1686 | <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option> |
@@ -1651,11 +1723,12 @@ discard block |
||
1651 | 1723 | if (empty($setting) || !is_array($setting)) |
1652 | 1724 | { |
1653 | 1725 | // Insert a separator (unless this is the first item in the list) |
1654 | - if ($i !== $first_option_key) |
|
1655 | - echo ' |
|
1726 | + if ($i !== $first_option_key) { |
|
1727 | + echo ' |
|
1656 | 1728 | </dl> |
1657 | 1729 | <hr> |
1658 | 1730 | <dl class="settings">'; |
1731 | + } |
|
1659 | 1732 | |
1660 | 1733 | // Should we give a name to this section? |
1661 | 1734 | if (is_string($setting) && !empty($setting)) |
@@ -1663,48 +1736,52 @@ discard block |
||
1663 | 1736 | $titled_section = true; |
1664 | 1737 | echo ' |
1665 | 1738 | <dt><strong>' . $setting . '</strong></dt><dd></dd>'; |
1739 | + } else { |
|
1740 | + $titled_section = false; |
|
1666 | 1741 | } |
1667 | - else |
|
1668 | - $titled_section = false; |
|
1669 | 1742 | |
1670 | 1743 | continue; |
1671 | 1744 | } |
1672 | 1745 | |
1673 | 1746 | // Is this disabled? |
1674 | - if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) |
|
1675 | - continue; |
|
1676 | - elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) |
|
1677 | - continue; |
|
1678 | - elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) |
|
1679 | - continue; |
|
1680 | - elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) |
|
1681 | - continue; |
|
1682 | - elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) |
|
1683 | - continue; |
|
1684 | - elseif ($setting['id'] == 'topics_per_page' && !empty($modSettings['disableCustomPerPage'])) |
|
1685 | - continue; |
|
1686 | - elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
1687 | - continue; |
|
1688 | - elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
1689 | - continue; |
|
1747 | + if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) { |
|
1748 | + continue; |
|
1749 | + } elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) { |
|
1750 | + continue; |
|
1751 | + } elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) { |
|
1752 | + continue; |
|
1753 | + } elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) { |
|
1754 | + continue; |
|
1755 | + } elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) { |
|
1756 | + continue; |
|
1757 | + } elseif ($setting['id'] == 'topics_per_page' && !empty($modSettings['disableCustomPerPage'])) { |
|
1758 | + continue; |
|
1759 | + } elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
1760 | + continue; |
|
1761 | + } elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
1762 | + continue; |
|
1763 | + } |
|
1690 | 1764 | |
1691 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
1692 | - $setting['type'] = 'checkbox'; |
|
1693 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
1694 | - $setting['type'] = 'number'; |
|
1695 | - elseif ($setting['type'] == 'string') |
|
1696 | - $setting['type'] = 'text'; |
|
1765 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
1766 | + $setting['type'] = 'checkbox'; |
|
1767 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
1768 | + $setting['type'] = 'number'; |
|
1769 | + } elseif ($setting['type'] == 'string') { |
|
1770 | + $setting['type'] = 'text'; |
|
1771 | + } |
|
1697 | 1772 | |
1698 | - if (isset($setting['options'])) |
|
1699 | - $setting['type'] = 'list'; |
|
1773 | + if (isset($setting['options'])) { |
|
1774 | + $setting['type'] = 'list'; |
|
1775 | + } |
|
1700 | 1776 | |
1701 | 1777 | echo ' |
1702 | 1778 | <dt> |
1703 | 1779 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
1704 | 1780 | |
1705 | - if (isset($setting['description'])) |
|
1706 | - echo ' |
|
1781 | + if (isset($setting['description'])) { |
|
1782 | + echo ' |
|
1707 | 1783 | <br><span class="smalltext">', $setting['description'], '</span>'; |
1784 | + } |
|
1708 | 1785 | echo ' |
1709 | 1786 | </dt> |
1710 | 1787 | <dd>'; |
@@ -1742,13 +1819,11 @@ discard block |
||
1742 | 1819 | |
1743 | 1820 | echo ' |
1744 | 1821 | <input type="number"', $min . $max . $step; |
1745 | - } |
|
1746 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
1822 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
1747 | 1823 | { |
1748 | 1824 | echo' |
1749 | 1825 | <input type="url"'; |
1750 | - } |
|
1751 | - else |
|
1826 | + } else |
|
1752 | 1827 | { |
1753 | 1828 | echo ' |
1754 | 1829 | <input type="text"'; |
@@ -1787,8 +1862,8 @@ discard block |
||
1787 | 1862 | <dl class="settings">'; |
1788 | 1863 | |
1789 | 1864 | // Allow notification on announcements to be disabled? |
1790 | - if (!empty($modSettings['allow_disableAnnounce'])) |
|
1791 | - echo ' |
|
1865 | + if (!empty($modSettings['allow_disableAnnounce'])) { |
|
1866 | + echo ' |
|
1792 | 1867 | <dt> |
1793 | 1868 | <label for="notify_announcements">', $txt['notify_important_email'], '</label> |
1794 | 1869 | </dt> |
@@ -1796,9 +1871,10 @@ discard block |
||
1796 | 1871 | <input type="hidden" name="notify_announcements" value="0"> |
1797 | 1872 | <input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '> |
1798 | 1873 | </dd>'; |
1874 | + } |
|
1799 | 1875 | |
1800 | - if (!empty($modSettings['enable_ajax_alerts'])) |
|
1801 | - echo ' |
|
1876 | + if (!empty($modSettings['enable_ajax_alerts'])) { |
|
1877 | + echo ' |
|
1802 | 1878 | <dt> |
1803 | 1879 | <label for="notify_send_body">', $txt['notify_alert_timeout'], '</label> |
1804 | 1880 | </dt> |
@@ -1806,6 +1882,7 @@ discard block |
||
1806 | 1882 | <input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '"> |
1807 | 1883 | </dd> |
1808 | 1884 | '; |
1885 | + } |
|
1809 | 1886 | |
1810 | 1887 | echo ' |
1811 | 1888 | </dl> |
@@ -1835,9 +1912,10 @@ discard block |
||
1835 | 1912 | <td colspan="3">'; |
1836 | 1913 | $label = $txt['alert_opt_' . $opts[1]]; |
1837 | 1914 | $label_pos = isset($opts['label']) ? $opts['label'] : ''; |
1838 | - if ($label_pos == 'before') |
|
1839 | - echo ' |
|
1915 | + if ($label_pos == 'before') { |
|
1916 | + echo ' |
|
1840 | 1917 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
1918 | + } |
|
1841 | 1919 | |
1842 | 1920 | $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; |
1843 | 1921 | switch ($opts[0]) |
@@ -1849,17 +1927,19 @@ discard block |
||
1849 | 1927 | case 'select': |
1850 | 1928 | echo ' |
1851 | 1929 | <select name="opt_', $opts[1], '" id="opt_', $opts[1], '">'; |
1852 | - foreach ($opts['opts'] as $k => $v) |
|
1853 | - echo ' |
|
1930 | + foreach ($opts['opts'] as $k => $v) { |
|
1931 | + echo ' |
|
1854 | 1932 | <option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>'; |
1933 | + } |
|
1855 | 1934 | echo ' |
1856 | 1935 | </select>'; |
1857 | 1936 | break; |
1858 | 1937 | } |
1859 | 1938 | |
1860 | - if ($label_pos == 'after') |
|
1861 | - echo ' |
|
1939 | + if ($label_pos == 'after') { |
|
1940 | + echo ' |
|
1862 | 1941 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
1942 | + } |
|
1863 | 1943 | |
1864 | 1944 | echo ' |
1865 | 1945 | </td> |
@@ -1973,11 +2053,12 @@ discard block |
||
1973 | 2053 | <p class="information">', $txt['groupMembership_info'], '</p>'; |
1974 | 2054 | |
1975 | 2055 | // Do we have an update message? |
1976 | - if (!empty($context['update_message'])) |
|
1977 | - echo ' |
|
2056 | + if (!empty($context['update_message'])) { |
|
2057 | + echo ' |
|
1978 | 2058 | <div class="infobox"> |
1979 | 2059 | ', $context['update_message'], '. |
1980 | 2060 | </div>'; |
2061 | + } |
|
1981 | 2062 | |
1982 | 2063 | echo ' |
1983 | 2064 | <div id="groups">'; |
@@ -1999,8 +2080,7 @@ discard block |
||
1999 | 2080 | </div> |
2000 | 2081 | </div> |
2001 | 2082 | </div>'; |
2002 | - } |
|
2003 | - else |
|
2083 | + } else |
|
2004 | 2084 | { |
2005 | 2085 | echo ' |
2006 | 2086 | <div class="title_bar"> |
@@ -2012,27 +2092,30 @@ discard block |
||
2012 | 2092 | echo ' |
2013 | 2093 | <div class="windowbg" id="primdiv_', $group['id'], '">'; |
2014 | 2094 | |
2015 | - if ($context['can_edit_primary']) |
|
2016 | - echo ' |
|
2095 | + if ($context['can_edit_primary']) { |
|
2096 | + echo ' |
|
2017 | 2097 | <input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>'; |
2098 | + } |
|
2018 | 2099 | |
2019 | 2100 | echo ' |
2020 | 2101 | <label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>'; |
2021 | 2102 | |
2022 | 2103 | // Can they leave their group? |
2023 | - if ($group['can_leave']) |
|
2024 | - echo ' |
|
2104 | + if ($group['can_leave']) { |
|
2105 | + echo ' |
|
2025 | 2106 | <a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>'; |
2107 | + } |
|
2026 | 2108 | |
2027 | 2109 | echo ' |
2028 | 2110 | </div>'; |
2029 | 2111 | } |
2030 | 2112 | |
2031 | - if ($context['can_edit_primary']) |
|
2032 | - echo ' |
|
2113 | + if ($context['can_edit_primary']) { |
|
2114 | + echo ' |
|
2033 | 2115 | <div class="padding righttext"> |
2034 | 2116 | <input type="submit" value="', $txt['make_primary'], '" class="button"> |
2035 | 2117 | </div>'; |
2118 | + } |
|
2036 | 2119 | |
2037 | 2120 | // Any groups they can join? |
2038 | 2121 | if (!empty($context['groups']['available'])) |
@@ -2048,15 +2131,16 @@ discard block |
||
2048 | 2131 | <div class="windowbg"> |
2049 | 2132 | <strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), ''; |
2050 | 2133 | |
2051 | - if ($group['type'] == 3) |
|
2052 | - echo ' |
|
2134 | + if ($group['type'] == 3) { |
|
2135 | + echo ' |
|
2053 | 2136 | <a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>'; |
2054 | - elseif ($group['type'] == 2 && $group['pending']) |
|
2055 | - echo ' |
|
2137 | + } elseif ($group['type'] == 2 && $group['pending']) { |
|
2138 | + echo ' |
|
2056 | 2139 | <span class="floatright">', $txt['approval_pending'], '</span>'; |
2057 | - elseif ($group['type'] == 2) |
|
2058 | - echo ' |
|
2140 | + } elseif ($group['type'] == 2) { |
|
2141 | + echo ' |
|
2059 | 2142 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>'; |
2143 | + } |
|
2060 | 2144 | |
2061 | 2145 | echo ' |
2062 | 2146 | </div>'; |
@@ -2079,9 +2163,10 @@ discard block |
||
2079 | 2163 | |
2080 | 2164 | prevDiv.className = "windowbg"; |
2081 | 2165 | }'; |
2082 | - if (isset($context['groups']['member'][$context['primary_group']])) |
|
2083 | - echo ' |
|
2166 | + if (isset($context['groups']['member'][$context['primary_group']])) { |
|
2167 | + echo ' |
|
2084 | 2168 | highlightSelected("primdiv_' . $context['primary_group'] . '");'; |
2169 | + } |
|
2085 | 2170 | echo ' |
2086 | 2171 | </script>'; |
2087 | 2172 | } |
@@ -2089,9 +2174,10 @@ discard block |
||
2089 | 2174 | echo ' |
2090 | 2175 | </div>'; |
2091 | 2176 | |
2092 | - if (!empty($context['token_check'])) |
|
2093 | - echo ' |
|
2177 | + if (!empty($context['token_check'])) { |
|
2178 | + echo ' |
|
2094 | 2179 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2180 | + } |
|
2095 | 2181 | |
2096 | 2182 | echo ' |
2097 | 2183 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2138,14 +2224,15 @@ discard block |
||
2138 | 2224 | |
2139 | 2225 | foreach ($category['boards'] as $board) |
2140 | 2226 | { |
2141 | - if ($i == $limit) |
|
2142 | - echo ' |
|
2227 | + if ($i == $limit) { |
|
2228 | + echo ' |
|
2143 | 2229 | </ul> |
2144 | 2230 | </li> |
2145 | 2231 | </ul> |
2146 | 2232 | <ul class="ignoreboards floatright"> |
2147 | 2233 | <li class="category"> |
2148 | 2234 | <ul>'; |
2235 | + } |
|
2149 | 2236 | |
2150 | 2237 | echo ' |
2151 | 2238 | <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"> |
@@ -2191,10 +2278,11 @@ discard block |
||
2191 | 2278 | |
2192 | 2279 | // Work out the starting color. |
2193 | 2280 | $context['current_color'] = $context['colors'][0]; |
2194 | - foreach ($context['colors'] as $limit => $color) |
|
2195 | - if ($context['member']['warning'] >= $limit) |
|
2281 | + foreach ($context['colors'] as $limit => $color) { |
|
2282 | + if ($context['member']['warning'] >= $limit) |
|
2196 | 2283 | $context['current_color'] = $color; |
2197 | -} |
|
2284 | + } |
|
2285 | + } |
|
2198 | 2286 | |
2199 | 2287 | // Show all warnings of a user? |
2200 | 2288 | function template_viewWarning() |
@@ -2233,14 +2321,15 @@ discard block |
||
2233 | 2321 | </dd>'; |
2234 | 2322 | |
2235 | 2323 | // There's some impact of this? |
2236 | - if (!empty($context['level_effects'][$context['current_level']])) |
|
2237 | - echo ' |
|
2324 | + if (!empty($context['level_effects'][$context['current_level']])) { |
|
2325 | + echo ' |
|
2238 | 2326 | <dt> |
2239 | 2327 | <strong>', $txt['profile_viewwarning_impact'], ':</strong> |
2240 | 2328 | </dt> |
2241 | 2329 | <dd> |
2242 | 2330 | ', $context['level_effects'][$context['current_level']], ' |
2243 | 2331 | </dd>'; |
2332 | + } |
|
2244 | 2333 | |
2245 | 2334 | echo ' |
2246 | 2335 | </dl> |
@@ -2278,10 +2367,11 @@ discard block |
||
2278 | 2367 | |
2279 | 2368 | // Otherwise see what we can do...'; |
2280 | 2369 | |
2281 | - foreach ($context['notification_templates'] as $k => $type) |
|
2282 | - echo ' |
|
2370 | + foreach ($context['notification_templates'] as $k => $type) { |
|
2371 | + echo ' |
|
2283 | 2372 | if (index == ', $k, ') |
2284 | 2373 | document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; |
2374 | + } |
|
2285 | 2375 | |
2286 | 2376 | echo ' |
2287 | 2377 | } |
@@ -2291,10 +2381,11 @@ discard block |
||
2291 | 2381 | // Also set the right effect. |
2292 | 2382 | effectText = "";'; |
2293 | 2383 | |
2294 | - foreach ($context['level_effects'] as $limit => $text) |
|
2295 | - echo ' |
|
2384 | + foreach ($context['level_effects'] as $limit => $text) { |
|
2385 | + echo ' |
|
2296 | 2386 | if (slideAmount >= ', $limit, ') |
2297 | 2387 | effectText = "', $text, '";'; |
2388 | + } |
|
2298 | 2389 | |
2299 | 2390 | echo ' |
2300 | 2391 | setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\'); |
@@ -2309,31 +2400,34 @@ discard block |
||
2309 | 2400 | </h3> |
2310 | 2401 | </div>'; |
2311 | 2402 | |
2312 | - if (!$context['user']['is_owner']) |
|
2313 | - echo ' |
|
2403 | + if (!$context['user']['is_owner']) { |
|
2404 | + echo ' |
|
2314 | 2405 | <p class="information">', $txt['profile_warning_desc'], '</p>'; |
2406 | + } |
|
2315 | 2407 | |
2316 | 2408 | echo ' |
2317 | 2409 | <div class="windowbg"> |
2318 | 2410 | <dl class="settings">'; |
2319 | 2411 | |
2320 | - if (!$context['user']['is_owner']) |
|
2321 | - echo ' |
|
2412 | + if (!$context['user']['is_owner']) { |
|
2413 | + echo ' |
|
2322 | 2414 | <dt> |
2323 | 2415 | <strong>', $txt['profile_warning_name'], ':</strong> |
2324 | 2416 | </dt> |
2325 | 2417 | <dd> |
2326 | 2418 | <strong>', $context['member']['name'], '</strong> |
2327 | 2419 | </dd>'; |
2420 | + } |
|
2328 | 2421 | |
2329 | 2422 | echo ' |
2330 | 2423 | <dt> |
2331 | 2424 | <strong>', $txt['profile_warning_level'], ':</strong>'; |
2332 | 2425 | |
2333 | 2426 | // Is there only so much they can apply? |
2334 | - if ($context['warning_limit']) |
|
2335 | - echo ' |
|
2427 | + if ($context['warning_limit']) { |
|
2428 | + echo ' |
|
2336 | 2429 | <br><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; |
2430 | + } |
|
2337 | 2431 | |
2338 | 2432 | echo ' |
2339 | 2433 | </dt> |
@@ -2386,9 +2480,10 @@ discard block |
||
2386 | 2480 | <option value="-1">', $txt['profile_warning_notify_template'], '</option> |
2387 | 2481 | <option value="-1" disabled>------------------------------</option>'; |
2388 | 2482 | |
2389 | - foreach ($context['notification_templates'] as $id_template => $template) |
|
2390 | - echo ' |
|
2483 | + foreach ($context['notification_templates'] as $id_template => $template) { |
|
2484 | + echo ' |
|
2391 | 2485 | <option value="', $id_template, '">', $template['title'], '</option>'; |
2486 | + } |
|
2392 | 2487 | |
2393 | 2488 | echo ' |
2394 | 2489 | </select> |
@@ -2400,9 +2495,10 @@ discard block |
||
2400 | 2495 | </dl> |
2401 | 2496 | <div class="righttext">'; |
2402 | 2497 | |
2403 | - if (!empty($context['token_check'])) |
|
2404 | - echo ' |
|
2498 | + if (!empty($context['token_check'])) { |
|
2499 | + echo ' |
|
2405 | 2500 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2501 | + } |
|
2406 | 2502 | |
2407 | 2503 | echo ' |
2408 | 2504 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2418,8 +2514,8 @@ discard block |
||
2418 | 2514 | echo ' |
2419 | 2515 | <script>'; |
2420 | 2516 | |
2421 | - if (!$context['user']['is_owner']) |
|
2422 | - echo ' |
|
2517 | + if (!$context['user']['is_owner']) { |
|
2518 | + echo ' |
|
2423 | 2519 | modifyWarnNotify(); |
2424 | 2520 | $(document).ready(function() { |
2425 | 2521 | $("#preview_button").click(function() { |
@@ -2458,6 +2554,7 @@ discard block |
||
2458 | 2554 | }); |
2459 | 2555 | return false; |
2460 | 2556 | }'; |
2557 | + } |
|
2461 | 2558 | |
2462 | 2559 | echo ' |
2463 | 2560 | </script>'; |
@@ -2480,16 +2577,18 @@ discard block |
||
2480 | 2577 | </div>'; |
2481 | 2578 | |
2482 | 2579 | // If deleting another account give them a lovely info box. |
2483 | - if (!$context['user']['is_owner']) |
|
2484 | - echo ' |
|
2580 | + if (!$context['user']['is_owner']) { |
|
2581 | + echo ' |
|
2485 | 2582 | <p class="information">', $txt['deleteAccount_desc'], '</p>'; |
2583 | + } |
|
2486 | 2584 | echo ' |
2487 | 2585 | <div class="windowbg2">'; |
2488 | 2586 | |
2489 | 2587 | // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) |
2490 | - if ($context['needs_approval']) |
|
2491 | - echo ' |
|
2588 | + if ($context['needs_approval']) { |
|
2589 | + echo ' |
|
2492 | 2590 | <div class="errorbox">', $txt['deleteAccount_approval'], '</div>'; |
2591 | + } |
|
2493 | 2592 | |
2494 | 2593 | // If the user is deleting their own account warn them first - and require a password! |
2495 | 2594 | if ($context['user']['is_owner']) |
@@ -2501,9 +2600,10 @@ discard block |
||
2501 | 2600 | <input type="password" name="oldpasswrd" size="20"> |
2502 | 2601 | <input type="submit" value="', $txt['yes'], '" class="button">'; |
2503 | 2602 | |
2504 | - if (!empty($context['token_check'])) |
|
2505 | - echo ' |
|
2603 | + if (!empty($context['token_check'])) { |
|
2604 | + echo ' |
|
2506 | 2605 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2606 | + } |
|
2507 | 2607 | |
2508 | 2608 | echo ' |
2509 | 2609 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2529,9 +2629,10 @@ discard block |
||
2529 | 2629 | <option value="topics">', $txt['deleteAccount_topics'], '</option> |
2530 | 2630 | </select>'; |
2531 | 2631 | |
2532 | - if ($context['show_perma_delete']) |
|
2533 | - echo ' |
|
2632 | + if ($context['show_perma_delete']) { |
|
2633 | + echo ' |
|
2534 | 2634 | <br><label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>'; |
2635 | + } |
|
2535 | 2636 | |
2536 | 2637 | echo ' |
2537 | 2638 | </div>'; |
@@ -2544,9 +2645,10 @@ discard block |
||
2544 | 2645 | <div> |
2545 | 2646 | <input type="submit" value="', $txt['delete'], '" class="button">'; |
2546 | 2647 | |
2547 | - if (!empty($context['token_check'])) |
|
2548 | - echo ' |
|
2648 | + if (!empty($context['token_check'])) { |
|
2649 | + echo ' |
|
2549 | 2650 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2651 | + } |
|
2550 | 2652 | |
2551 | 2653 | echo ' |
2552 | 2654 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2572,8 +2674,8 @@ discard block |
||
2572 | 2674 | <hr>'; |
2573 | 2675 | |
2574 | 2676 | // Only show the password box if it's actually needed. |
2575 | - if ($context['require_password']) |
|
2576 | - echo ' |
|
2677 | + if ($context['require_password']) { |
|
2678 | + echo ' |
|
2577 | 2679 | <dl class="settings"> |
2578 | 2680 | <dt> |
2579 | 2681 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br> |
@@ -2583,13 +2685,15 @@ discard block |
||
2583 | 2685 | <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;"> |
2584 | 2686 | </dd> |
2585 | 2687 | </dl>'; |
2688 | + } |
|
2586 | 2689 | |
2587 | 2690 | echo ' |
2588 | 2691 | <div class="righttext">'; |
2589 | 2692 | |
2590 | - if (!empty($context['token_check'])) |
|
2591 | - echo ' |
|
2693 | + if (!empty($context['token_check'])) { |
|
2694 | + echo ' |
|
2592 | 2695 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2696 | + } |
|
2593 | 2697 | |
2594 | 2698 | echo ' |
2595 | 2699 | <input type="submit" value="', $txt['change_profile'], '" class="button"> |
@@ -2616,9 +2720,10 @@ discard block |
||
2616 | 2720 | <ul id="list_errors">'; |
2617 | 2721 | |
2618 | 2722 | // Cycle through each error and display an error message. |
2619 | - foreach ($context['post_errors'] as $error) |
|
2620 | - echo ' |
|
2723 | + foreach ($context['post_errors'] as $error) { |
|
2724 | + echo ' |
|
2621 | 2725 | <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>'; |
2726 | + } |
|
2622 | 2727 | |
2623 | 2728 | echo ' |
2624 | 2729 | </ul>'; |
@@ -2644,12 +2749,13 @@ discard block |
||
2644 | 2749 | <select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 && !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>'; |
2645 | 2750 | |
2646 | 2751 | // Fill the select box with all primary member groups that can be assigned to a member. |
2647 | - foreach ($context['member_groups'] as $member_group) |
|
2648 | - if (!empty($member_group['can_be_primary'])) |
|
2752 | + foreach ($context['member_groups'] as $member_group) { |
|
2753 | + if (!empty($member_group['can_be_primary'])) |
|
2649 | 2754 | echo ' |
2650 | 2755 | <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '> |
2651 | 2756 | ', $member_group['name'], ' |
2652 | 2757 | </option>'; |
2758 | + } |
|
2653 | 2759 | echo ' |
2654 | 2760 | </select> |
2655 | 2761 | </dd> |
@@ -2661,10 +2767,11 @@ discard block |
||
2661 | 2767 | <input type="hidden" name="additional_groups[]" value="0">'; |
2662 | 2768 | |
2663 | 2769 | // For each membergroup show a checkbox so members can be assigned to more than one group. |
2664 | - foreach ($context['member_groups'] as $member_group) |
|
2665 | - if ($member_group['can_be_additional']) |
|
2770 | + foreach ($context['member_groups'] as $member_group) { |
|
2771 | + if ($member_group['can_be_additional']) |
|
2666 | 2772 | echo ' |
2667 | 2773 | <label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>'; |
2774 | + } |
|
2668 | 2775 | echo ' |
2669 | 2776 | </span> |
2670 | 2777 | <a href="javascript:void(0);" onclick="document.getElementById(\'additional_groupsList\').style.display = \'block\'; document.getElementById(\'additional_groupsLink\').style.display = \'none\'; return false;" id="additional_groupsLink" style="display: none;" class="toggle_down">', $txt['additional_membergroups_show'], '</a> |
@@ -2724,9 +2831,10 @@ discard block |
||
2724 | 2831 | <span class="smalltext">', $txt['sig_info'], '</span><br> |
2725 | 2832 | <br>'; |
2726 | 2833 | |
2727 | - if ($context['show_spellchecking']) |
|
2728 | - echo ' |
|
2834 | + if ($context['show_spellchecking']) { |
|
2835 | + echo ' |
|
2729 | 2836 | <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">'; |
2837 | + } |
|
2730 | 2838 | |
2731 | 2839 | echo ' |
2732 | 2840 | </dt> |
@@ -2734,17 +2842,20 @@ discard block |
||
2734 | 2842 | <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50" style="min-width: 50%; max-width: 99%;">', $context['member']['signature'], '</textarea><br>'; |
2735 | 2843 | |
2736 | 2844 | // If there is a limit at all! |
2737 | - if (!empty($context['signature_limits']['max_length'])) |
|
2738 | - echo ' |
|
2845 | + if (!empty($context['signature_limits']['max_length'])) { |
|
2846 | + echo ' |
|
2739 | 2847 | <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>'; |
2848 | + } |
|
2740 | 2849 | |
2741 | - if (!empty($context['show_preview_button'])) |
|
2742 | - echo ' |
|
2850 | + if (!empty($context['show_preview_button'])) { |
|
2851 | + echo ' |
|
2743 | 2852 | <input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button">'; |
2853 | + } |
|
2744 | 2854 | |
2745 | - if ($context['signature_warning']) |
|
2746 | - echo ' |
|
2855 | + if ($context['signature_warning']) { |
|
2856 | + echo ' |
|
2747 | 2857 | <span class="smalltext">', $context['signature_warning'], '</span>'; |
2858 | + } |
|
2748 | 2859 | |
2749 | 2860 | // Some javascript used to count how many characters have been used so far in the signature. |
2750 | 2861 | echo ' |
@@ -2788,9 +2899,10 @@ discard block |
||
2788 | 2899 | <div> |
2789 | 2900 | <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">'; |
2790 | 2901 | // This lists all the file categories. |
2791 | - foreach ($context['avatars'] as $avatar) |
|
2792 | - echo ' |
|
2902 | + foreach ($context['avatars'] as $avatar) { |
|
2903 | + echo ' |
|
2793 | 2904 | <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>'; |
2905 | + } |
|
2794 | 2906 | echo ' |
2795 | 2907 | </select> |
2796 | 2908 | </div> |
@@ -2845,16 +2957,17 @@ discard block |
||
2845 | 2957 | <div id="avatar_gravatar"> |
2846 | 2958 | <img src="' . $context['member']['avatar']['href'] . '" alt="" />'; |
2847 | 2959 | |
2848 | - if (empty($modSettings['gravatarAllowExtraEmail'])) |
|
2849 | - echo ' |
|
2960 | + if (empty($modSettings['gravatarAllowExtraEmail'])) { |
|
2961 | + echo ' |
|
2850 | 2962 | <div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>'; |
2851 | - else |
|
2963 | + } else |
|
2852 | 2964 | { |
2853 | 2965 | // Depending on other stuff, the stored value here might have some odd things in it from other areas. |
2854 | - if ($context['member']['avatar']['external'] == $context['member']['email']) |
|
2855 | - $textbox_value = ''; |
|
2856 | - else |
|
2857 | - $textbox_value = $context['member']['avatar']['external']; |
|
2966 | + if ($context['member']['avatar']['external'] == $context['member']['email']) { |
|
2967 | + $textbox_value = ''; |
|
2968 | + } else { |
|
2969 | + $textbox_value = $context['member']['avatar']['external']; |
|
2970 | + } |
|
2858 | 2971 | |
2859 | 2972 | echo ' |
2860 | 2973 | <div class="smalltext">', $txt['gravatar_alternateEmail'], '</div> |
@@ -2926,8 +3039,9 @@ discard block |
||
2926 | 3039 | $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; |
2927 | 3040 | |
2928 | 3041 | $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); |
2929 | - if (empty($suffix)) |
|
2930 | - return; |
|
3042 | + if (empty($suffix)) { |
|
3043 | + return; |
|
3044 | + } |
|
2931 | 3045 | |
2932 | 3046 | echo ' |
2933 | 3047 | <div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>'; |
@@ -2949,9 +3063,10 @@ discard block |
||
2949 | 3063 | <dd> |
2950 | 3064 | <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;" style="margin-bottom: 4px;">'; |
2951 | 3065 | // Help the user by showing a list of common time formats. |
2952 | - foreach ($context['easy_timeformats'] as $time_format) |
|
2953 | - echo ' |
|
3066 | + foreach ($context['easy_timeformats'] as $time_format) { |
|
3067 | + echo ' |
|
2954 | 3068 | <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>'; |
3069 | + } |
|
2955 | 3070 | echo ' |
2956 | 3071 | </select><br> |
2957 | 3072 | <input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30"> |
@@ -2987,9 +3102,10 @@ discard block |
||
2987 | 3102 | </dt> |
2988 | 3103 | <dd> |
2989 | 3104 | <select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.gif\';">'; |
2990 | - foreach ($context['smiley_sets'] as $set) |
|
2991 | - echo ' |
|
3105 | + foreach ($context['smiley_sets'] as $set) { |
|
3106 | + echo ' |
|
2992 | 3107 | <option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>'; |
3108 | + } |
|
2993 | 3109 | echo ' |
2994 | 3110 | </select> <img id="smileypr" class="centericon" src="', $context['member']['smiley_set']['id'] != 'none' ? $modSettings['smileys_url'] . '/' . ($context['member']['smiley_set']['id'] != '' ? $context['member']['smiley_set']['id'] : (!empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'])) . '/smiley.gif' : $settings['images_url'] . '/blank.png', '" alt=":)" style="padding-left: 20px;"> |
2995 | 3111 | </dd>'; |
@@ -3040,10 +3156,11 @@ discard block |
||
3040 | 3156 | </div> |
3041 | 3157 | <div class="clear"></div>'; |
3042 | 3158 | |
3043 | - if (!empty($context['from_ajax'])) |
|
3044 | - echo ' |
|
3159 | + if (!empty($context['from_ajax'])) { |
|
3160 | + echo ' |
|
3045 | 3161 | <br> |
3046 | 3162 | <a href="javascript:self.close();"></a>'; |
3163 | + } |
|
3047 | 3164 | |
3048 | 3165 | echo ' |
3049 | 3166 | </div> |
@@ -3082,15 +3199,16 @@ discard block |
||
3082 | 3199 | <br><div class="smalltext">', $txt['tfa_profile_desc'], '</div> |
3083 | 3200 | </dt> |
3084 | 3201 | <dd>'; |
3085 | - if (!$context['tfa_enabled'] && $context['user']['is_owner']) |
|
3086 | - echo ' |
|
3202 | + if (!$context['tfa_enabled'] && $context['user']['is_owner']) { |
|
3203 | + echo ' |
|
3087 | 3204 | <a href="', !empty($modSettings['force_ssl']) && $modSettings['force_ssl'] < 2 ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>'; |
3088 | - elseif (!$context['tfa_enabled']) |
|
3089 | - echo ' |
|
3205 | + } elseif (!$context['tfa_enabled']) { |
|
3206 | + echo ' |
|
3090 | 3207 | ', $txt['tfa_profile_disabled']; |
3091 | - else |
|
3092 | - echo ' |
|
3208 | + } else { |
|
3209 | + echo ' |
|
3093 | 3210 | ', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable'); |
3211 | + } |
|
3094 | 3212 | echo ' |
3095 | 3213 | </dd>'; |
3096 | 3214 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | <div id="recent" class="main_section"> |
22 | 22 | <div class="cat_bar"> |
23 | 23 | <h3 class="catbg"> |
24 | - <span class="xx"></span>',$txt['recent_posts'],' |
|
24 | + <span class="xx"></span>',$txt['recent_posts'], ' |
|
25 | 25 | </h3> |
26 | 26 | </div> |
27 | 27 | <div class="pagesection">', $context['page_index'], '</div>'; |
@@ -43,28 +43,33 @@ discard block |
||
43 | 43 | </div> |
44 | 44 | <div class="list_posts">', $post['message'], '</div>'; |
45 | 45 | |
46 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
47 | - echo ' |
|
46 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
47 | + echo ' |
|
48 | 48 | <ul class="quickbuttons">'; |
49 | + } |
|
49 | 50 | |
50 | 51 | // If they *can* reply? |
51 | - if ($post['can_reply']) |
|
52 | - echo ' |
|
52 | + if ($post['can_reply']) { |
|
53 | + echo ' |
|
53 | 54 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
55 | + } |
|
54 | 56 | |
55 | 57 | // If they *can* quote? |
56 | - if ($post['can_quote']) |
|
57 | - echo ' |
|
58 | + if ($post['can_quote']) { |
|
59 | + echo ' |
|
58 | 60 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
61 | + } |
|
59 | 62 | |
60 | 63 | // How about... even... remove it entirely?! |
61 | - if ($post['can_delete']) |
|
62 | - echo ' |
|
64 | + if ($post['can_delete']) { |
|
65 | + echo ' |
|
63 | 66 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';recent;', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
67 | + } |
|
64 | 68 | |
65 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
66 | - echo ' |
|
69 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
70 | + echo ' |
|
67 | 71 | </ul>'; |
72 | + } |
|
68 | 73 | |
69 | 74 | echo ' |
70 | 75 | </div>'; |
@@ -86,12 +91,13 @@ discard block |
||
86 | 91 | echo ' |
87 | 92 | <div id="recent" class="main_content">'; |
88 | 93 | |
89 | - if ($context['showCheckboxes']) |
|
90 | - echo ' |
|
94 | + if ($context['showCheckboxes']) { |
|
95 | + echo ' |
|
91 | 96 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;"> |
92 | 97 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
93 | 98 | <input type="hidden" name="qaction" value="markread"> |
94 | 99 | <input type="hidden" name="redirect_url" value="action=unread', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">'; |
100 | + } |
|
95 | 101 | |
96 | 102 | if (!empty($context['topics'])) |
97 | 103 | { |
@@ -120,11 +126,12 @@ discard block |
||
120 | 126 | </div>'; |
121 | 127 | |
122 | 128 | // Show a "select all" box for quick moderation? |
123 | - if ($context['showCheckboxes']) |
|
124 | - echo ' |
|
129 | + if ($context['showCheckboxes']) { |
|
130 | + echo ' |
|
125 | 131 | <div class="moderation"> |
126 | 132 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');"> |
127 | 133 | </div>'; |
134 | + } |
|
128 | 135 | |
129 | 136 | echo ' |
130 | 137 | </div> |
@@ -143,15 +150,18 @@ discard block |
||
143 | 150 | // Now we handle the icons |
144 | 151 | echo ' |
145 | 152 | <div class="icons floatright">'; |
146 | - if ($topic['is_locked']) |
|
147 | - echo ' |
|
153 | + if ($topic['is_locked']) { |
|
154 | + echo ' |
|
148 | 155 | <span class="generic_icons lock"></span>'; |
149 | - if ($topic['is_sticky']) |
|
150 | - echo ' |
|
156 | + } |
|
157 | + if ($topic['is_sticky']) { |
|
158 | + echo ' |
|
151 | 159 | <span class="generic_icons sticky"></span>'; |
152 | - if ($topic['is_poll']) |
|
153 | - echo ' |
|
160 | + } |
|
161 | + if ($topic['is_poll']) { |
|
162 | + echo ' |
|
154 | 163 | <span class="generic_icons poll"></span>'; |
164 | + } |
|
155 | 165 | echo ' |
156 | 166 | </div>'; |
157 | 167 | |
@@ -176,19 +186,21 @@ discard block |
||
176 | 186 | ', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), ' |
177 | 187 | </div>'; |
178 | 188 | |
179 | - if ($context['showCheckboxes']) |
|
180 | - echo ' |
|
189 | + if ($context['showCheckboxes']) { |
|
190 | + echo ' |
|
181 | 191 | <div class="moderation"> |
182 | 192 | <input type="checkbox" name="topics[]" value="', $topic['id'], '"> |
183 | 193 | </div>'; |
194 | + } |
|
184 | 195 | |
185 | 196 | echo ' |
186 | 197 | </div>'; |
187 | 198 | } |
188 | 199 | |
189 | - if (empty($context['topics'])) |
|
190 | - echo ' |
|
200 | + if (empty($context['topics'])) { |
|
201 | + echo ' |
|
191 | 202 | <div style="display: none;"></div>'; |
203 | + } |
|
192 | 204 | |
193 | 205 | echo ' |
194 | 206 | </div> |
@@ -203,25 +215,27 @@ discard block |
||
203 | 215 | ', $context['page_index'], ' |
204 | 216 | </div> |
205 | 217 | </div>'; |
206 | - } |
|
207 | - else |
|
208 | - echo ' |
|
218 | + } else { |
|
219 | + echo ' |
|
209 | 220 | <div class="cat_bar"> |
210 | 221 | <h3 class="catbg centertext"> |
211 | 222 | ', $context['showing_all_topics'] ? $txt['topic_alert_none'] : $txt['unread_topics_visit_none'], ' |
212 | 223 | </h3> |
213 | 224 | </div>'; |
225 | + } |
|
214 | 226 | |
215 | - if ($context['showCheckboxes']) |
|
216 | - echo ' |
|
227 | + if ($context['showCheckboxes']) { |
|
228 | + echo ' |
|
217 | 229 | </form>'; |
230 | + } |
|
218 | 231 | |
219 | 232 | echo ' |
220 | 233 | </div>'; |
221 | 234 | |
222 | - if (empty($context['no_topic_listing'])) |
|
223 | - template_topic_legend(); |
|
224 | -} |
|
235 | + if (empty($context['no_topic_listing'])) { |
|
236 | + template_topic_legend(); |
|
237 | + } |
|
238 | + } |
|
225 | 239 | |
226 | 240 | /** |
227 | 241 | * Template for showing unread replies (eg new replies to topics you've posted in) |
@@ -233,12 +247,13 @@ discard block |
||
233 | 247 | echo ' |
234 | 248 | <div id="recent">'; |
235 | 249 | |
236 | - if ($context['showCheckboxes']) |
|
237 | - echo ' |
|
250 | + if ($context['showCheckboxes']) { |
|
251 | + echo ' |
|
238 | 252 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;"> |
239 | 253 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
240 | 254 | <input type="hidden" name="qaction" value="markread"> |
241 | 255 | <input type="hidden" name="redirect_url" value="action=unreadreplies', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">'; |
256 | + } |
|
242 | 257 | |
243 | 258 | if (!empty($context['topics'])) |
244 | 259 | { |
@@ -267,11 +282,12 @@ discard block |
||
267 | 282 | </div>'; |
268 | 283 | |
269 | 284 | // Show a "select all" box for quick moderation? |
270 | - if ($context['showCheckboxes']) |
|
271 | - echo ' |
|
285 | + if ($context['showCheckboxes']) { |
|
286 | + echo ' |
|
272 | 287 | <div class="moderation"> |
273 | 288 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');"> |
274 | 289 | </div>'; |
290 | + } |
|
275 | 291 | |
276 | 292 | echo ' |
277 | 293 | </div> |
@@ -290,15 +306,18 @@ discard block |
||
290 | 306 | // Now we handle the icons |
291 | 307 | echo ' |
292 | 308 | <div class="icons floatright">'; |
293 | - if ($topic['is_locked']) |
|
294 | - echo ' |
|
309 | + if ($topic['is_locked']) { |
|
310 | + echo ' |
|
295 | 311 | <span class="generic_icons lock"></span>'; |
296 | - if ($topic['is_sticky']) |
|
297 | - echo ' |
|
312 | + } |
|
313 | + if ($topic['is_sticky']) { |
|
314 | + echo ' |
|
298 | 315 | <span class="generic_icons sticky"></span>'; |
299 | - if ($topic['is_poll']) |
|
300 | - echo ' |
|
316 | + } |
|
317 | + if ($topic['is_poll']) { |
|
318 | + echo ' |
|
301 | 319 | <span class="generic_icons poll"></span>'; |
320 | + } |
|
302 | 321 | echo ' |
303 | 322 | </div>'; |
304 | 323 | |
@@ -323,11 +342,12 @@ discard block |
||
323 | 342 | ', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), ' |
324 | 343 | </div>'; |
325 | 344 | |
326 | - if ($context['showCheckboxes']) |
|
327 | - echo ' |
|
345 | + if ($context['showCheckboxes']) { |
|
346 | + echo ' |
|
328 | 347 | <div class="moderation"> |
329 | 348 | <input type="checkbox" name="topics[]" value="', $topic['id'], '"> |
330 | 349 | </div>'; |
350 | + } |
|
331 | 351 | echo ' |
332 | 352 | </div>'; |
333 | 353 | } |
@@ -343,24 +363,26 @@ discard block |
||
343 | 363 | ', $context['page_index'], ' |
344 | 364 | </div> |
345 | 365 | </div>'; |
346 | - } |
|
347 | - else |
|
348 | - echo ' |
|
366 | + } else { |
|
367 | + echo ' |
|
349 | 368 | <div class="cat_bar"> |
350 | 369 | <h3 class="catbg centertext"> |
351 | 370 | ', $context['showing_all_topics'] ? $txt['topic_alert_none'] : $txt['unread_topics_visit_none'], ' |
352 | 371 | </h3> |
353 | 372 | </div>'; |
373 | + } |
|
354 | 374 | |
355 | - if ($context['showCheckboxes']) |
|
356 | - echo ' |
|
375 | + if ($context['showCheckboxes']) { |
|
376 | + echo ' |
|
357 | 377 | </form>'; |
378 | + } |
|
358 | 379 | |
359 | 380 | echo ' |
360 | 381 | </div>'; |
361 | 382 | |
362 | - if (empty($context['no_topic_listing'])) |
|
363 | - template_topic_legend(); |
|
364 | -} |
|
383 | + if (empty($context['no_topic_listing'])) { |
|
384 | + template_topic_legend(); |
|
385 | + } |
|
386 | + } |
|
365 | 387 | |
366 | 388 | ?> |
367 | 389 | \ No newline at end of file |
@@ -89,8 +89,9 @@ discard block |
||
89 | 89 | foreach ($section['areas'] as $i => $area) |
90 | 90 | { |
91 | 91 | // Not supposed to be printed? |
92 | - if (empty($area['label'])) |
|
93 | - continue; |
|
92 | + if (empty($area['label'])) { |
|
93 | + continue; |
|
94 | + } |
|
94 | 95 | |
95 | 96 | echo ' |
96 | 97 | <li', !empty($area['subsections']) ? ' class="subsections"' : '', '>'; |
@@ -99,8 +100,9 @@ discard block |
||
99 | 100 | <a class="', $area['icon_class'], !empty($area['selected']) ? ' chosen ' : '', '" href="', (isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $i), $menu_context['extra_parameters'], '">', $area['icon'], $area['label'], '</a>'; |
100 | 101 | |
101 | 102 | // Is this the current area, or just some area? |
102 | - if (!empty($area['selected']) && empty($context['tabs'])) |
|
103 | - $context['tabs'] = isset($area['subsections']) ? $area['subsections'] : array(); |
|
103 | + if (!empty($area['selected']) && empty($context['tabs'])) { |
|
104 | + $context['tabs'] = isset($area['subsections']) ? $area['subsections'] : array(); |
|
105 | + } |
|
104 | 106 | |
105 | 107 | // Are there any subsections? |
106 | 108 | if (!empty($area['subsections'])) |
@@ -110,8 +112,9 @@ discard block |
||
110 | 112 | |
111 | 113 | foreach ($area['subsections'] as $sa => $sub) |
112 | 114 | { |
113 | - if (!empty($sub['disabled'])) |
|
114 | - continue; |
|
115 | + if (!empty($sub['disabled'])) { |
|
116 | + continue; |
|
117 | + } |
|
115 | 118 | |
116 | 119 | $url = isset($sub['url']) ? $sub['url'] : (isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $i) . ';sa=' . $sa; |
117 | 120 | |
@@ -158,8 +161,9 @@ discard block |
||
158 | 161 | <h3 class="catbg">'; |
159 | 162 | |
160 | 163 | // The function is in Admin.template.php, but since this template is used elsewhere too better check if the function is available |
161 | - if (function_exists('template_admin_quick_search')) |
|
162 | - template_admin_quick_search(); |
|
164 | + if (function_exists('template_admin_quick_search')) { |
|
165 | + template_admin_quick_search(); |
|
166 | + } |
|
163 | 167 | |
164 | 168 | // Exactly how many tabs do we have? |
165 | 169 | if (!empty($context['tabs'])) |
@@ -174,30 +178,36 @@ discard block |
||
174 | 178 | } |
175 | 179 | |
176 | 180 | // Did this not even exist - or do we not have a label? |
177 | - if (!isset($tab_context['tabs'][$id])) |
|
178 | - $tab_context['tabs'][$id] = array('label' => $tab['label']); |
|
179 | - elseif (!isset($tab_context['tabs'][$id]['label'])) |
|
180 | - $tab_context['tabs'][$id]['label'] = $tab['label']; |
|
181 | + if (!isset($tab_context['tabs'][$id])) { |
|
182 | + $tab_context['tabs'][$id] = array('label' => $tab['label']); |
|
183 | + } elseif (!isset($tab_context['tabs'][$id]['label'])) { |
|
184 | + $tab_context['tabs'][$id]['label'] = $tab['label']; |
|
185 | + } |
|
181 | 186 | |
182 | 187 | // Has a custom URL defined in the main admin structure? |
183 | - if (isset($tab['url']) && !isset($tab_context['tabs'][$id]['url'])) |
|
184 | - $tab_context['tabs'][$id]['url'] = $tab['url']; |
|
188 | + if (isset($tab['url']) && !isset($tab_context['tabs'][$id]['url'])) { |
|
189 | + $tab_context['tabs'][$id]['url'] = $tab['url']; |
|
190 | + } |
|
185 | 191 | |
186 | 192 | // Any additional paramaters for the url? |
187 | - if (isset($tab['add_params']) && !isset($tab_context['tabs'][$id]['add_params'])) |
|
188 | - $tab_context['tabs'][$id]['add_params'] = $tab['add_params']; |
|
193 | + if (isset($tab['add_params']) && !isset($tab_context['tabs'][$id]['add_params'])) { |
|
194 | + $tab_context['tabs'][$id]['add_params'] = $tab['add_params']; |
|
195 | + } |
|
189 | 196 | |
190 | 197 | // Has it been deemed selected? |
191 | - if (!empty($tab['is_selected'])) |
|
192 | - $tab_context['tabs'][$id]['is_selected'] = true; |
|
198 | + if (!empty($tab['is_selected'])) { |
|
199 | + $tab_context['tabs'][$id]['is_selected'] = true; |
|
200 | + } |
|
193 | 201 | |
194 | 202 | // Does it have its own help? |
195 | - if (!empty($tab['help'])) |
|
196 | - $tab_context['tabs'][$id]['help'] = $tab['help']; |
|
203 | + if (!empty($tab['help'])) { |
|
204 | + $tab_context['tabs'][$id]['help'] = $tab['help']; |
|
205 | + } |
|
197 | 206 | |
198 | 207 | // Is this the last one? |
199 | - if (!empty($tab['is_last']) && !isset($tab_context['override_last'])) |
|
200 | - $tab_context['tabs'][$id]['is_last'] = true; |
|
208 | + if (!empty($tab['is_last']) && !isset($tab_context['override_last'])) { |
|
209 | + $tab_context['tabs'][$id]['is_last'] = true; |
|
210 | + } |
|
201 | 211 | } |
202 | 212 | |
203 | 213 | // Find the selected tab |
@@ -214,17 +224,18 @@ discard block |
||
214 | 224 | // Show an icon and/or a help item? |
215 | 225 | if (!empty($selected_tab['icon_class']) || !empty($tab_context['icon_class']) || !empty($selected_tab['icon']) || !empty($tab_context['icon']) || !empty($selected_tab['help']) || !empty($tab_context['help'])) |
216 | 226 | { |
217 | - if (!empty($selected_tab['icon_class']) || !empty($tab_context['icon_class'])) |
|
218 | - echo '<span class="', !empty($selected_tab['icon_class']) ? $selected_tab['icon_class'] : $tab_context['icon_class'], ' icon"></span>'; |
|
219 | - elseif (!empty($selected_tab['icon']) || !empty($tab_context['icon'])) |
|
220 | - echo '<img src="', $settings['images_url'], '/icons/', !empty($selected_tab['icon']) ? $selected_tab['icon'] : $tab_context['icon'], '" alt="" class="icon">'; |
|
227 | + if (!empty($selected_tab['icon_class']) || !empty($tab_context['icon_class'])) { |
|
228 | + echo '<span class="', !empty($selected_tab['icon_class']) ? $selected_tab['icon_class'] : $tab_context['icon_class'], ' icon"></span>'; |
|
229 | + } elseif (!empty($selected_tab['icon']) || !empty($tab_context['icon'])) { |
|
230 | + echo '<img src="', $settings['images_url'], '/icons/', !empty($selected_tab['icon']) ? $selected_tab['icon'] : $tab_context['icon'], '" alt="" class="icon">'; |
|
231 | + } |
|
221 | 232 | |
222 | - if (!empty($selected_tab['help']) || !empty($tab_context['help'])) |
|
223 | - echo '<a href="', $scripturl, '?action=helpadmin;help=', !empty($selected_tab['help']) ? $selected_tab['help'] : $tab_context['help'], '" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a>'; |
|
233 | + if (!empty($selected_tab['help']) || !empty($tab_context['help'])) { |
|
234 | + echo '<a href="', $scripturl, '?action=helpadmin;help=', !empty($selected_tab['help']) ? $selected_tab['help'] : $tab_context['help'], '" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a>'; |
|
235 | + } |
|
224 | 236 | |
225 | 237 | echo $tab_context['title']; |
226 | - } |
|
227 | - else |
|
238 | + } else |
|
228 | 239 | { |
229 | 240 | echo ' |
230 | 241 | ', $tab_context['title']; |
@@ -237,11 +248,12 @@ discard block |
||
237 | 248 | } |
238 | 249 | |
239 | 250 | // Shall we use the tabs? Yes, it's the only known way! |
240 | - if (!empty($selected_tab['description']) || !empty($tab_context['description'])) |
|
241 | - echo ' |
|
251 | + if (!empty($selected_tab['description']) || !empty($tab_context['description'])) { |
|
252 | + echo ' |
|
242 | 253 | <p class="information"> |
243 | 254 | ', !empty($selected_tab['description']) ? $selected_tab['description'] : $tab_context['description'], ' |
244 | 255 | </p>'; |
256 | + } |
|
245 | 257 | |
246 | 258 | // Print out all the items in this tab (if any). |
247 | 259 | if (!empty($context['tabs'])) |
@@ -253,8 +265,9 @@ discard block |
||
253 | 265 | |
254 | 266 | foreach ($tab_context['tabs'] as $sa => $tab) |
255 | 267 | { |
256 | - if (!empty($tab['disabled'])) |
|
257 | - continue; |
|
268 | + if (!empty($tab['disabled'])) { |
|
269 | + continue; |
|
270 | + } |
|
258 | 271 | |
259 | 272 | if (!empty($tab['is_selected'])) |
260 | 273 | { |
@@ -262,12 +275,12 @@ discard block |
||
262 | 275 | <li> |
263 | 276 | <a class="active" href="', isset($tab['url']) ? $tab['url'] : $menu_context['base_url'] . ';area=' . $menu_context['current_area'] . ';sa=' . $sa, $menu_context['extra_parameters'], isset($tab['add_params']) ? $tab['add_params'] : '', '">', $tab['label'], '</a> |
264 | 277 | </li>'; |
265 | - } |
|
266 | - else |
|
267 | - echo ' |
|
278 | + } else { |
|
279 | + echo ' |
|
268 | 280 | <li> |
269 | 281 | <a href="', isset($tab['url']) ? $tab['url'] : $menu_context['base_url'] . ';area=' . $menu_context['current_area'] . ';sa=' . $sa, $menu_context['extra_parameters'], isset($tab['add_params']) ? $tab['add_params'] : '', '">', $tab['label'], '</a> |
270 | 282 | </li>'; |
283 | + } |
|
271 | 284 | } |
272 | 285 | |
273 | 286 | // the end of tabs |
@@ -673,7 +673,7 @@ |
||
673 | 673 | 'Nikola "Dzonny" Novaković', |
674 | 674 | // Localizers |
675 | 675 | 'Dr. Deejay', |
676 | - 'd3vcho', |
|
676 | + 'd3vcho', |
|
677 | 677 | // Former Localizers |
678 | 678 | 'Relyana', |
679 | 679 | ), |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | 'Shitiz "Dragooon" Garg', |
591 | 591 | 'Karl "RegularExpression" Benson', |
592 | 592 | 'Matthew "Labradoodle-360" Kerle', |
593 | - $user_info['is_admin'] ? 'Matt "Grudge" Wolf': 'Grudge', |
|
593 | + $user_info['is_admin'] ? 'Matt "Grudge" Wolf' : 'Grudge', |
|
594 | 594 | 'Michael "Thantos" Miller', |
595 | 595 | 'Norv', |
596 | 596 | 'Peter "Arantor" Spicer', |
@@ -814,13 +814,13 @@ discard block |
||
814 | 814 | $credit_info = $smcFunc['json_decode']($row['credits'], true); |
815 | 815 | |
816 | 816 | $copyright = empty($credit_info['copyright']) ? '' : $txt['credits_copyright'] . ' © ' . $smcFunc['htmlspecialchars']($credit_info['copyright']); |
817 | - $license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="'. $smcFunc['htmlspecialchars']($credit_info['licenseurl']) .'">'. $smcFunc['htmlspecialchars']($credit_info['license']) .'</a>' : $smcFunc['htmlspecialchars']($credit_info['license'])); |
|
817 | + $license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="' . $smcFunc['htmlspecialchars']($credit_info['licenseurl']) . '">' . $smcFunc['htmlspecialchars']($credit_info['license']) . '</a>' : $smcFunc['htmlspecialchars']($credit_info['license'])); |
|
818 | 818 | $version = $txt['credits_version'] . ' ' . $row['version']; |
819 | 819 | $title = (empty($credit_info['title']) ? $row['name'] : $smcFunc['htmlspecialchars']($credit_info['title'])) . ': ' . $version; |
820 | 820 | |
821 | 821 | // build this one out and stash it away |
822 | 822 | $mod_name = empty($credit_info['url']) ? $title : '<a href="' . $credit_info['url'] . '">' . $title . '</a>'; |
823 | - $mods[] = $mod_name . (!empty($license) ? ' | ' . $license : '') . (!empty($copyright) ? ' | ' . $copyright : ''); |
|
823 | + $mods[] = $mod_name . (!empty($license) ? ' | ' . $license : '') . (!empty($copyright) ? ' | ' . $copyright : ''); |
|
824 | 824 | } |
825 | 825 | cache_put_data('mods_credits', $mods, 86400); |
826 | 826 | } |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 4 |
15 | 15 | */ |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * Who's online, and what are they doing? |
@@ -35,8 +36,9 @@ discard block |
||
35 | 36 | isAllowedTo('who_view'); |
36 | 37 | |
37 | 38 | // You can't do anything if this is off. |
38 | - if (empty($modSettings['who_enabled'])) |
|
39 | - fatal_lang_error('who_off', false); |
|
39 | + if (empty($modSettings['who_enabled'])) { |
|
40 | + fatal_lang_error('who_off', false); |
|
41 | + } |
|
40 | 42 | |
41 | 43 | // Load the 'Who' template. |
42 | 44 | loadTemplate('Who'); |
@@ -71,9 +73,9 @@ discard block |
||
71 | 73 | $show_methods['spiders'] = '(lo.id_member = 0 AND lo.id_spider > 0)'; |
72 | 74 | $show_methods['guests'] = '(lo.id_member = 0 AND lo.id_spider = 0)'; |
73 | 75 | $context['show_methods']['spiders'] = $txt['who_show_spiders_only']; |
76 | + } elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders') { |
|
77 | + unset($_SESSION['who_online_filter']); |
|
74 | 78 | } |
75 | - elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders') |
|
76 | - unset($_SESSION['who_online_filter']); |
|
77 | 79 | |
78 | 80 | // Does the user prefer a different sort direction? |
79 | 81 | if (isset($_REQUEST['sort']) && isset($sort_methods[$_REQUEST['sort']])) |
@@ -97,20 +99,24 @@ discard block |
||
97 | 99 | $context['sort_direction'] = isset($_REQUEST['asc']) || (isset($_REQUEST['sort_dir']) && $_REQUEST['sort_dir'] == 'asc') ? 'up' : 'down'; |
98 | 100 | |
99 | 101 | $conditions = array(); |
100 | - if (!allowedTo('moderate_forum')) |
|
101 | - $conditions[] = '(COALESCE(mem.show_online, 1) = 1)'; |
|
102 | + if (!allowedTo('moderate_forum')) { |
|
103 | + $conditions[] = '(COALESCE(mem.show_online, 1) = 1)'; |
|
104 | + } |
|
102 | 105 | |
103 | 106 | // Fallback to top filter? |
104 | - if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top'])) |
|
105 | - $_REQUEST['show'] = $_REQUEST['show_top']; |
|
107 | + if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top'])) { |
|
108 | + $_REQUEST['show'] = $_REQUEST['show_top']; |
|
109 | + } |
|
106 | 110 | // Does the user wish to apply a filter? |
107 | - if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']])) |
|
108 | - $context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show']; |
|
111 | + if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']])) { |
|
112 | + $context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show']; |
|
113 | + } |
|
109 | 114 | // Perhaps we saved a filter earlier in the session? |
110 | - elseif (isset($_SESSION['who_online_filter'])) |
|
111 | - $context['show_by'] = $_SESSION['who_online_filter']; |
|
112 | - else |
|
113 | - $context['show_by'] = 'members'; |
|
115 | + elseif (isset($_SESSION['who_online_filter'])) { |
|
116 | + $context['show_by'] = $_SESSION['who_online_filter']; |
|
117 | + } else { |
|
118 | + $context['show_by'] = 'members'; |
|
119 | + } |
|
114 | 120 | |
115 | 121 | $conditions[] = $show_methods[$context['show_by']]; |
116 | 122 | |
@@ -156,8 +162,9 @@ discard block |
||
156 | 162 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
157 | 163 | { |
158 | 164 | $actions = $smcFunc['json_decode']($row['url'], true); |
159 | - if ($actions === false) |
|
160 | - continue; |
|
165 | + if ($actions === false) { |
|
166 | + continue; |
|
167 | + } |
|
161 | 168 | |
162 | 169 | // Send the information to the template. |
163 | 170 | $context['members'][$row['session']] = array( |
@@ -195,8 +202,8 @@ discard block |
||
195 | 202 | $spiderContext = array(); |
196 | 203 | if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] == 2 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) |
197 | 204 | { |
198 | - foreach ($smcFunc['json_decode']($modSettings['spider_name_cache'], true) as $id => $name) |
|
199 | - $spiderContext[$id] = array( |
|
205 | + foreach ($smcFunc['json_decode']($modSettings['spider_name_cache'], true) as $id => $name) { |
|
206 | + $spiderContext[$id] = array( |
|
200 | 207 | 'id' => 0, |
201 | 208 | 'name' => $name, |
202 | 209 | 'group' => $txt['spiders'], |
@@ -205,6 +212,7 @@ discard block |
||
205 | 212 | 'email' => $name, |
206 | 213 | 'is_guest' => true |
207 | 214 | ); |
215 | + } |
|
208 | 216 | } |
209 | 217 | |
210 | 218 | $url_data = determineActions($url_data); |
@@ -219,16 +227,18 @@ discard block |
||
219 | 227 | // Put it in the context variables. |
220 | 228 | foreach ($context['members'] as $i => $member) |
221 | 229 | { |
222 | - if ($member['id'] != 0) |
|
223 | - $member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0; |
|
230 | + if ($member['id'] != 0) { |
|
231 | + $member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0; |
|
232 | + } |
|
224 | 233 | |
225 | 234 | // Keep the IP that came from the database. |
226 | 235 | $memberContext[$member['id']]['ip'] = $member['ip']; |
227 | 236 | $context['members'][$i]['action'] = isset($url_data[$i]) ? $url_data[$i] : $txt['who_hidden']; |
228 | - if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']])) |
|
229 | - $context['members'][$i] += $spiderContext[$member['id_spider']]; |
|
230 | - else |
|
231 | - $context['members'][$i] += $memberContext[$member['id']]; |
|
237 | + if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']])) { |
|
238 | + $context['members'][$i] += $spiderContext[$member['id_spider']]; |
|
239 | + } else { |
|
240 | + $context['members'][$i] += $memberContext[$member['id']]; |
|
241 | + } |
|
232 | 242 | } |
233 | 243 | |
234 | 244 | // Some people can't send personal messages... |
@@ -263,8 +273,9 @@ discard block |
||
263 | 273 | { |
264 | 274 | global $txt, $user_info, $modSettings, $smcFunc; |
265 | 275 | |
266 | - if (!allowedTo('who_view')) |
|
267 | - return array(); |
|
276 | + if (!allowedTo('who_view')) { |
|
277 | + return array(); |
|
278 | + } |
|
268 | 279 | loadLanguage('Who'); |
269 | 280 | |
270 | 281 | // Actions that require a specific permission level. |
@@ -292,10 +303,11 @@ discard block |
||
292 | 303 | ); |
293 | 304 | call_integration_hook('who_allowed', array(&$allowedActions)); |
294 | 305 | |
295 | - if (!is_array($urls)) |
|
296 | - $url_list = array(array($urls, $user_info['id'])); |
|
297 | - else |
|
298 | - $url_list = $urls; |
|
306 | + if (!is_array($urls)) { |
|
307 | + $url_list = array(array($urls, $user_info['id'])); |
|
308 | + } else { |
|
309 | + $url_list = $urls; |
|
310 | + } |
|
299 | 311 | |
300 | 312 | // These are done to later query these in large chunks. (instead of one by one.) |
301 | 313 | $topic_ids = array(); |
@@ -307,12 +319,14 @@ discard block |
||
307 | 319 | { |
308 | 320 | // Get the request parameters.. |
309 | 321 | $actions = $smcFunc['json_decode']($url[0], true); |
310 | - if ($actions === false) |
|
311 | - continue; |
|
322 | + if ($actions === false) { |
|
323 | + continue; |
|
324 | + } |
|
312 | 325 | |
313 | 326 | // If it's the admin or moderation center, and there is an area set, use that instead. |
314 | - if (isset($actions['action']) && ($actions['action'] == 'admin' || $actions['action'] == 'moderate') && isset($actions['area'])) |
|
315 | - $actions['action'] = $actions['area']; |
|
327 | + if (isset($actions['action']) && ($actions['action'] == 'admin' || $actions['action'] == 'moderate') && isset($actions['area'])) { |
|
328 | + $actions['action'] = $actions['area']; |
|
329 | + } |
|
316 | 330 | |
317 | 331 | // Check if there was no action or the action is display. |
318 | 332 | if (!isset($actions['action']) || $actions['action'] == 'display') |
@@ -332,12 +346,14 @@ discard block |
||
332 | 346 | $board_ids[$actions['board']][$k] = $txt['who_board']; |
333 | 347 | } |
334 | 348 | // It's the board index!! It must be! |
335 | - else |
|
336 | - $data[$k] = $txt['who_index']; |
|
349 | + else { |
|
350 | + $data[$k] = $txt['who_index']; |
|
351 | + } |
|
337 | 352 | } |
338 | 353 | // Probably an error or some goon? |
339 | - elseif ($actions['action'] == '') |
|
340 | - $data[$k] = $txt['who_index']; |
|
354 | + elseif ($actions['action'] == '') { |
|
355 | + $data[$k] = $txt['who_index']; |
|
356 | + } |
|
341 | 357 | // Some other normal action...? |
342 | 358 | else |
343 | 359 | { |
@@ -345,23 +361,25 @@ discard block |
||
345 | 361 | if ($actions['action'] == 'profile') |
346 | 362 | { |
347 | 363 | // Whose? Their own? |
348 | - if (empty($actions['u'])) |
|
349 | - $actions['u'] = $url[1]; |
|
364 | + if (empty($actions['u'])) { |
|
365 | + $actions['u'] = $url[1]; |
|
366 | + } |
|
350 | 367 | |
351 | 368 | $data[$k] = $txt['who_hidden']; |
352 | 369 | $profile_ids[(int) $actions['u']][$k] = $actions['u'] == $url[1] ? $txt['who_viewownprofile'] : $txt['who_viewprofile']; |
353 | - } |
|
354 | - elseif (($actions['action'] == 'post' || $actions['action'] == 'post2') && empty($actions['topic']) && isset($actions['board'])) |
|
370 | + } elseif (($actions['action'] == 'post' || $actions['action'] == 'post2') && empty($actions['topic']) && isset($actions['board'])) |
|
355 | 371 | { |
356 | 372 | $data[$k] = $txt['who_hidden']; |
357 | 373 | $board_ids[(int) $actions['board']][$k] = isset($actions['poll']) ? $txt['who_poll'] : $txt['who_post']; |
358 | 374 | } |
359 | 375 | // A subaction anyone can view... if the language string is there, show it. |
360 | - elseif (isset($actions['sa']) && isset($txt['whoall_' . $actions['action'] . '_' . $actions['sa']])) |
|
361 | - $data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']]; |
|
376 | + elseif (isset($actions['sa']) && isset($txt['whoall_' . $actions['action'] . '_' . $actions['sa']])) { |
|
377 | + $data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']]; |
|
378 | + } |
|
362 | 379 | // An action any old fellow can look at. (if ['whoall_' . $action] exists, we know everyone can see it.) |
363 | - elseif (isset($txt['whoall_' . $actions['action']])) |
|
364 | - $data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : $txt['whoall_' . $actions['action']]; |
|
380 | + elseif (isset($txt['whoall_' . $actions['action']])) { |
|
381 | + $data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : $txt['whoall_' . $actions['action']]; |
|
382 | + } |
|
365 | 383 | // Viewable if and only if they can see the board... |
366 | 384 | elseif (isset($txt['whotopic_' . $actions['action']])) |
367 | 385 | { |
@@ -370,8 +388,7 @@ discard block |
||
370 | 388 | |
371 | 389 | $data[$k] = $txt['who_hidden']; |
372 | 390 | $topic_ids[$topic][$k] = $txt['whotopic_' . $actions['action']]; |
373 | - } |
|
374 | - elseif (isset($txt['whopost_' . $actions['action']])) |
|
391 | + } elseif (isset($txt['whopost_' . $actions['action']])) |
|
375 | 392 | { |
376 | 393 | // Find out what message they are accessing. |
377 | 394 | $msgid = (int) (isset($actions['msg']) ? $actions['msg'] : (isset($actions['quote']) ? $actions['quote'] : 0)); |
@@ -394,41 +411,46 @@ discard block |
||
394 | 411 | $data[$k] = sprintf($txt['whopost_' . $actions['action']], $id_topic, $subject); |
395 | 412 | $smcFunc['db_free_result']($result); |
396 | 413 | |
397 | - if (empty($id_topic)) |
|
398 | - $data[$k] = $txt['who_hidden']; |
|
414 | + if (empty($id_topic)) { |
|
415 | + $data[$k] = $txt['who_hidden']; |
|
416 | + } |
|
399 | 417 | } |
400 | 418 | // Viewable only by administrators.. (if it starts with whoadmin, it's admin only!) |
401 | - elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' . $actions['action']])) |
|
402 | - $data[$k] = $txt['whoadmin_' . $actions['action']]; |
|
419 | + elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' . $actions['action']])) { |
|
420 | + $data[$k] = $txt['whoadmin_' . $actions['action']]; |
|
421 | + } |
|
403 | 422 | // Viewable by permission level. |
404 | 423 | elseif (isset($allowedActions[$actions['action']])) |
405 | 424 | { |
406 | - if (allowedTo($allowedActions[$actions['action']])) |
|
407 | - $data[$k] = $txt['whoallow_' . $actions['action']]; |
|
408 | - elseif (in_array('moderate_forum', $allowedActions[$actions['action']])) |
|
409 | - $data[$k] = $txt['who_moderate']; |
|
410 | - elseif (in_array('admin_forum', $allowedActions[$actions['action']])) |
|
411 | - $data[$k] = $txt['who_admin']; |
|
412 | - else |
|
413 | - $data[$k] = $txt['who_hidden']; |
|
425 | + if (allowedTo($allowedActions[$actions['action']])) { |
|
426 | + $data[$k] = $txt['whoallow_' . $actions['action']]; |
|
427 | + } elseif (in_array('moderate_forum', $allowedActions[$actions['action']])) { |
|
428 | + $data[$k] = $txt['who_moderate']; |
|
429 | + } elseif (in_array('admin_forum', $allowedActions[$actions['action']])) { |
|
430 | + $data[$k] = $txt['who_admin']; |
|
431 | + } else { |
|
432 | + $data[$k] = $txt['who_hidden']; |
|
433 | + } |
|
434 | + } elseif (!empty($actions['action'])) { |
|
435 | + $data[$k] = $txt['who_generic'] . ' ' . $actions['action']; |
|
436 | + } else { |
|
437 | + $data[$k] = $txt['who_unknown']; |
|
414 | 438 | } |
415 | - elseif (!empty($actions['action'])) |
|
416 | - $data[$k] = $txt['who_generic'] . ' ' . $actions['action']; |
|
417 | - else |
|
418 | - $data[$k] = $txt['who_unknown']; |
|
419 | 439 | } |
420 | 440 | |
421 | 441 | if (isset($actions['error'])) |
422 | 442 | { |
423 | - if (isset($txt[$actions['error']])) |
|
424 | - $error_message = str_replace('"', '"', empty($actions['who_error_params']) ? $txt[$actions['error']] : vsprintf($txt[$actions['error']], $actions['who_error_params'])); |
|
425 | - elseif ($actions['error'] == 'guest_login') |
|
426 | - $error_message = str_replace('"', '"', $txt['who_guest_login']); |
|
427 | - else |
|
428 | - $error_message = str_replace('"', '"', $actions['error']); |
|
429 | - |
|
430 | - if (!empty($error_message)) |
|
431 | - $data[$k] .= ' <span class="generic_icons error" title="' . $error_message . '"></span>'; |
|
443 | + if (isset($txt[$actions['error']])) { |
|
444 | + $error_message = str_replace('"', '"', empty($actions['who_error_params']) ? $txt[$actions['error']] : vsprintf($txt[$actions['error']], $actions['who_error_params'])); |
|
445 | + } elseif ($actions['error'] == 'guest_login') { |
|
446 | + $error_message = str_replace('"', '"', $txt['who_guest_login']); |
|
447 | + } else { |
|
448 | + $error_message = str_replace('"', '"', $actions['error']); |
|
449 | + } |
|
450 | + |
|
451 | + if (!empty($error_message)) { |
|
452 | + $data[$k] .= ' <span class="generic_icons error" title="' . $error_message . '"></span>'; |
|
453 | + } |
|
432 | 454 | } |
433 | 455 | |
434 | 456 | // Maybe the action is integrated into another system? |
@@ -439,12 +461,15 @@ discard block |
||
439 | 461 | if (!empty($integrate_action)) |
440 | 462 | { |
441 | 463 | $data[$k] = $integrate_action; |
442 | - if (isset($actions['topic']) && isset($topic_ids[(int) $actions['topic']][$k])) |
|
443 | - $topic_ids[(int) $actions['topic']][$k] = $integrate_action; |
|
444 | - if (isset($actions['board']) && isset($board_ids[(int) $actions['board']][$k])) |
|
445 | - $board_ids[(int) $actions['board']][$k] = $integrate_action; |
|
446 | - if (isset($actions['u']) && isset($profile_ids[(int) $actions['u']][$k])) |
|
447 | - $profile_ids[(int) $actions['u']][$k] = $integrate_action; |
|
464 | + if (isset($actions['topic']) && isset($topic_ids[(int) $actions['topic']][$k])) { |
|
465 | + $topic_ids[(int) $actions['topic']][$k] = $integrate_action; |
|
466 | + } |
|
467 | + if (isset($actions['board']) && isset($board_ids[(int) $actions['board']][$k])) { |
|
468 | + $board_ids[(int) $actions['board']][$k] = $integrate_action; |
|
469 | + } |
|
470 | + if (isset($actions['u']) && isset($profile_ids[(int) $actions['u']][$k])) { |
|
471 | + $profile_ids[(int) $actions['u']][$k] = $integrate_action; |
|
472 | + } |
|
448 | 473 | break; |
449 | 474 | } |
450 | 475 | } |
@@ -472,8 +497,9 @@ discard block |
||
472 | 497 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
473 | 498 | { |
474 | 499 | // Show the topic's subject for each of the actions. |
475 | - foreach ($topic_ids[$row['id_topic']] as $k => $session_text) |
|
476 | - $data[$k] = sprintf($session_text, $row['id_topic'], censorText($row['subject'])); |
|
500 | + foreach ($topic_ids[$row['id_topic']] as $k => $session_text) { |
|
501 | + $data[$k] = sprintf($session_text, $row['id_topic'], censorText($row['subject'])); |
|
502 | + } |
|
477 | 503 | } |
478 | 504 | $smcFunc['db_free_result']($result); |
479 | 505 | } |
@@ -495,8 +521,9 @@ discard block |
||
495 | 521 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
496 | 522 | { |
497 | 523 | // Put the board name into the string for each member... |
498 | - foreach ($board_ids[$row['id_board']] as $k => $session_text) |
|
499 | - $data[$k] = sprintf($session_text, $row['id_board'], $row['name']); |
|
524 | + foreach ($board_ids[$row['id_board']] as $k => $session_text) { |
|
525 | + $data[$k] = sprintf($session_text, $row['id_board'], $row['name']); |
|
526 | + } |
|
500 | 527 | } |
501 | 528 | $smcFunc['db_free_result']($result); |
502 | 529 | } |
@@ -518,23 +545,26 @@ discard block |
||
518 | 545 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
519 | 546 | { |
520 | 547 | // If they aren't allowed to view this person's profile, skip it. |
521 | - if (!$allow_view_any && ($user_info['id'] != $row['id_member'])) |
|
522 | - continue; |
|
548 | + if (!$allow_view_any && ($user_info['id'] != $row['id_member'])) { |
|
549 | + continue; |
|
550 | + } |
|
523 | 551 | |
524 | 552 | // Set their action on each - session/text to sprintf. |
525 | - foreach ($profile_ids[$row['id_member']] as $k => $session_text) |
|
526 | - $data[$k] = sprintf($session_text, $row['id_member'], $row['real_name']); |
|
553 | + foreach ($profile_ids[$row['id_member']] as $k => $session_text) { |
|
554 | + $data[$k] = sprintf($session_text, $row['id_member'], $row['real_name']); |
|
555 | + } |
|
527 | 556 | } |
528 | 557 | $smcFunc['db_free_result']($result); |
529 | 558 | } |
530 | 559 | |
531 | 560 | call_integration_hook('whos_online_after', array(&$urls, &$data)); |
532 | 561 | |
533 | - if (!is_array($urls)) |
|
534 | - return isset($data[0]) ? $data[0] : false; |
|
535 | - else |
|
536 | - return $data; |
|
537 | -} |
|
562 | + if (!is_array($urls)) { |
|
563 | + return isset($data[0]) ? $data[0] : false; |
|
564 | + } else { |
|
565 | + return $data; |
|
566 | + } |
|
567 | + } |
|
538 | 568 | |
539 | 569 | /** |
540 | 570 | * It prepares credit and copyright information for the credits page or the admin page |
@@ -710,8 +740,8 @@ discard block |
||
710 | 740 | ); |
711 | 741 | |
712 | 742 | // Give the translators some credit for their hard work. |
713 | - if (!empty($txt['translation_credits'])) |
|
714 | - $context['credits'][] = array( |
|
743 | + if (!empty($txt['translation_credits'])) { |
|
744 | + $context['credits'][] = array( |
|
715 | 745 | 'title' => $txt['credits_groups_translation'], |
716 | 746 | 'groups' => array( |
717 | 747 | array( |
@@ -720,6 +750,7 @@ discard block |
||
720 | 750 | ), |
721 | 751 | ), |
722 | 752 | ); |
753 | + } |
|
723 | 754 | |
724 | 755 | $context['credits'][] = array( |
725 | 756 | 'title' => $txt['credits_special'], |
@@ -104,7 +104,7 @@ |
||
104 | 104 | * |
105 | 105 | * @param string $class The fully-qualified class name. |
106 | 106 | */ |
107 | -spl_autoload_register(function ($class) use ($sourcedir) |
|
107 | +spl_autoload_register(function($class) use ($sourcedir) |
|
108 | 108 | { |
109 | 109 | $classMap = array( |
110 | 110 | 'ReCaptcha\\' => 'ReCaptcha/', |
@@ -32,16 +32,18 @@ discard block |
||
32 | 32 | ob_start(); |
33 | 33 | |
34 | 34 | // Do some cleaning, just in case. |
35 | -foreach (array('db_character_set', 'cachedir') as $variable) |
|
35 | +foreach (array('db_character_set', 'cachedir') as $variable) { |
|
36 | 36 | if (isset($GLOBALS[$variable])) |
37 | 37 | unset($GLOBALS[$variable], $GLOBALS[$variable]); |
38 | +} |
|
38 | 39 | |
39 | 40 | // Load the settings... |
40 | 41 | require_once(dirname(__FILE__) . '/Settings.php'); |
41 | 42 | |
42 | 43 | // Make absolutely sure the cache directory is defined. |
43 | -if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) |
|
44 | +if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) { |
|
44 | 45 | $cachedir = $boarddir . '/cache'; |
46 | +} |
|
45 | 47 | |
46 | 48 | // Without those we can't go anywhere |
47 | 49 | require_once($sourcedir . '/QueryString.php'); |
@@ -51,8 +53,9 @@ discard block |
||
51 | 53 | require_once($sourcedir . '/Load.php'); |
52 | 54 | |
53 | 55 | // If $maintenance is set specifically to 2, then we're upgrading or something. |
54 | -if (!empty($maintenance) && $maintenance == 2) |
|
56 | +if (!empty($maintenance) && $maintenance == 2) { |
|
55 | 57 | display_maintenance_message(); |
58 | +} |
|
56 | 59 | |
57 | 60 | // Create a variable to store some SMF specific functions in. |
58 | 61 | $smcFunc = array(); |
@@ -67,8 +70,9 @@ discard block |
||
67 | 70 | cleanRequest(); |
68 | 71 | |
69 | 72 | // Seed the random generator. |
70 | -if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) |
|
73 | +if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) { |
|
71 | 74 | smf_seed_generator(); |
75 | +} |
|
72 | 76 | |
73 | 77 | // Before we get carried away, are we doing a scheduled task? If so save CPU cycles by jumping out! |
74 | 78 | if (isset($_GET['scheduled'])) |
@@ -88,9 +92,9 @@ discard block |
||
88 | 92 | if (!empty($modSettings['enableCompressedOutput']) && !headers_sent()) |
89 | 93 | { |
90 | 94 | // If zlib is being used, turn off output compression. |
91 | - if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') |
|
92 | - $modSettings['enableCompressedOutput'] = '0'; |
|
93 | - else |
|
95 | + if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') { |
|
96 | + $modSettings['enableCompressedOutput'] = '0'; |
|
97 | + } else |
|
94 | 98 | { |
95 | 99 | ob_end_clean(); |
96 | 100 | ob_start('ob_gzhandler'); |
@@ -182,18 +186,21 @@ discard block |
||
182 | 186 | loadPermissions(); |
183 | 187 | |
184 | 188 | // Attachments don't require the entire theme to be loaded. |
185 | - if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') |
|
186 | - detectBrowser(); |
|
189 | + if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') { |
|
190 | + detectBrowser(); |
|
191 | + } |
|
187 | 192 | // Load the current theme. (note that ?theme=1 will also work, may be used for guest theming.) |
188 | - else |
|
189 | - loadTheme(); |
|
193 | + else { |
|
194 | + loadTheme(); |
|
195 | + } |
|
190 | 196 | |
191 | 197 | // Check if the user should be disallowed access. |
192 | 198 | is_not_banned(); |
193 | 199 | |
194 | 200 | // If we are in a topic and don't have permission to approve it then duck out now. |
195 | - if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) |
|
196 | - fatal_lang_error('not_a_topic', false); |
|
201 | + if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) { |
|
202 | + fatal_lang_error('not_a_topic', false); |
|
203 | + } |
|
197 | 204 | |
198 | 205 | $no_stat_actions = array('clock', 'dlattach', 'findmember', 'jsoption', 'likes', 'loadeditorlocale', 'modifycat', 'requestmembers', 'smstats', 'suggest', 'about:unknown', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile'); |
199 | 206 | call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions)); |
@@ -204,8 +211,9 @@ discard block |
||
204 | 211 | writeLog(); |
205 | 212 | |
206 | 213 | // Track forum statistics and hits...? |
207 | - if (!empty($modSettings['hitStats'])) |
|
208 | - trackStats(array('hits' => '+')); |
|
214 | + if (!empty($modSettings['hitStats'])) { |
|
215 | + trackStats(array('hits' => '+')); |
|
216 | + } |
|
209 | 217 | } |
210 | 218 | unset($no_stat_actions); |
211 | 219 | |
@@ -219,13 +227,14 @@ discard block |
||
219 | 227 | return ($_REQUEST['action'] == 'login2' ? 'Login2' : ($_REQUEST['action'] == 'logintfa' ? 'LoginTFA' : 'Logout')); |
220 | 228 | } |
221 | 229 | // Don't even try it, sonny. |
222 | - else |
|
223 | - return 'InMaintenance'; |
|
230 | + else { |
|
231 | + return 'InMaintenance'; |
|
232 | + } |
|
224 | 233 | } |
225 | 234 | // If guest access is off, a guest can only do one of the very few following actions. |
226 | - elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) |
|
227 | - return 'KickGuest'; |
|
228 | - elseif (empty($_REQUEST['action'])) |
|
235 | + elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) { |
|
236 | + return 'KickGuest'; |
|
237 | + } elseif (empty($_REQUEST['action'])) |
|
229 | 238 | { |
230 | 239 | // Action and board are both empty... BoardIndex! Unless someone else wants to do something different. |
231 | 240 | if (empty($board) && empty($topic)) |
@@ -239,8 +248,9 @@ discard block |
||
239 | 248 | |
240 | 249 | $call = call_helper($defaultAction, true); |
241 | 250 | |
242 | - if (!empty($call)) |
|
243 | - return $call; |
|
251 | + if (!empty($call)) { |
|
252 | + return $call; |
|
253 | + } |
|
244 | 254 | } |
245 | 255 | |
246 | 256 | // No default action huh? then go to our good old BoardIndex. |
@@ -370,8 +380,9 @@ discard block |
||
370 | 380 | |
371 | 381 | $call = call_helper($fallbackAction, true); |
372 | 382 | |
373 | - if (!empty($call)) |
|
374 | - return $call; |
|
383 | + if (!empty($call)) { |
|
384 | + return $call; |
|
385 | + } |
|
375 | 386 | } |
376 | 387 | |
377 | 388 | // No fallback action, huh? |
@@ -382,8 +393,9 @@ discard block |
||
382 | 393 | } |
383 | 394 | |
384 | 395 | // Otherwise, it was set - so let's go to that action. |
385 | - if (!empty($actionArray[$_REQUEST['action']][0])) |
|
386 | - require_once($sourcedir . '/' . $actionArray[$_REQUEST['action']][0]); |
|
396 | + if (!empty($actionArray[$_REQUEST['action']][0])) { |
|
397 | + require_once($sourcedir . '/' . $actionArray[$_REQUEST['action']][0]); |
|
398 | + } |
|
387 | 399 | |
388 | 400 | // Do the right thing. |
389 | 401 | return call_helper($actionArray[$_REQUEST['action']][1], true); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * Display a list of upcoming events, birthdays, and holidays. |
69 | 69 | * |
70 | 70 | * @param string $grid_name The grid name |
71 | - * @return void|bool Returns false if the grid doesn't exist. |
|
71 | + * @return false|null Returns false if the grid doesn't exist. |
|
72 | 72 | */ |
73 | 73 | function template_show_upcoming_list($grid_name) |
74 | 74 | { |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param string $grid_name The grid name |
240 | 240 | * @param bool $is_mini Is this a mini grid? |
241 | - * @return void|bool Returns false if the grid doesn't exist. |
|
241 | + * @return false|null Returns false if the grid doesn't exist. |
|
242 | 242 | */ |
243 | 243 | function template_show_month_grid($grid_name, $is_mini = false) |
244 | 244 | { |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | * Shows a weekly grid |
524 | 524 | * |
525 | 525 | * @param string $grid_name The name of the grid |
526 | - * @return void|bool Returns false if the grid doesn't exist |
|
526 | + * @return false|null Returns false if the grid doesn't exist |
|
527 | 527 | */ |
528 | 528 | function template_show_week_grid($grid_name) |
529 | 529 | { |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | { |
438 | 438 | // Sort events by start time (all day events will be listed first) |
439 | 439 | uasort($day['events'], function($a, $b) { |
440 | - if ($a['start_timestamp'] == $b['start_timestamp']) |
|
441 | - return 0; |
|
442 | - return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
|
440 | + if ($a['start_timestamp'] == $b['start_timestamp']) |
|
441 | + return 0; |
|
442 | + return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
|
443 | 443 | }); |
444 | 444 | |
445 | 445 | echo ' |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | { |
620 | 620 | // Sort events by start time (all day events will be listed first) |
621 | 621 | uasort($day['events'], function($a, $b) { |
622 | - if ($a['start_timestamp'] == $b['start_timestamp']) |
|
623 | - return 0; |
|
624 | - return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
|
622 | + if ($a['start_timestamp'] == $b['start_timestamp']) |
|
623 | + return 0; |
|
624 | + return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
|
625 | 625 | }); |
626 | 626 | |
627 | 627 | foreach ($day['events'] as $event) |
@@ -40,16 +40,14 @@ discard block |
||
40 | 40 | ', template_show_upcoming_list('main'), ' |
41 | 41 | </div> |
42 | 42 | '; |
43 | - } |
|
44 | - elseif ($context['calendar_view'] == 'viewweek') |
|
43 | + } elseif ($context['calendar_view'] == 'viewweek') |
|
45 | 44 | { |
46 | 45 | echo ' |
47 | 46 | <div id="main_grid"> |
48 | 47 | ', template_show_week_grid('main'), ' |
49 | 48 | </div> |
50 | 49 | '; |
51 | - } |
|
52 | - else |
|
50 | + } else |
|
53 | 51 | { |
54 | 52 | echo ' |
55 | 53 | <div id="main_grid"> |
@@ -75,8 +73,9 @@ discard block |
||
75 | 73 | global $context, $scripturl, $txt; |
76 | 74 | |
77 | 75 | // Bail out if we have nothing to work with |
78 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
79 | - return false; |
|
76 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
77 | + return false; |
|
78 | + } |
|
80 | 79 | |
81 | 80 | // Protect programmer sanity |
82 | 81 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
@@ -113,11 +112,13 @@ discard block |
||
113 | 112 | <li class="windowbg"> |
114 | 113 | <b class="event_title">', $event['link'], '</b>'; |
115 | 114 | |
116 | - if ($event['can_edit']) |
|
117 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
115 | + if ($event['can_edit']) { |
|
116 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
117 | + } |
|
118 | 118 | |
119 | - if ($event['can_export']) |
|
120 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
119 | + if ($event['can_export']) { |
|
120 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
121 | + } |
|
121 | 122 | |
122 | 123 | echo ' |
123 | 124 | <br>'; |
@@ -125,14 +126,14 @@ discard block |
||
125 | 126 | if (!empty($event['allday'])) |
126 | 127 | { |
127 | 128 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' – <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : ''; |
128 | - } |
|
129 | - else |
|
129 | + } else |
|
130 | 130 | { |
131 | 131 | // Display event info relative to user's local timezone |
132 | 132 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
133 | 133 | |
134 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
135 | - echo trim($event['end_date_local']) . ', '; |
|
134 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
135 | + echo trim($event['end_date_local']) . ', '; |
|
136 | + } |
|
136 | 137 | |
137 | 138 | echo trim($event['end_time_local']); |
138 | 139 | |
@@ -141,23 +142,27 @@ discard block |
||
141 | 142 | { |
142 | 143 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
143 | 144 | |
144 | - if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) |
|
145 | - echo trim($event['start_date_orig']), ', '; |
|
145 | + if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) { |
|
146 | + echo trim($event['start_date_orig']), ', '; |
|
147 | + } |
|
146 | 148 | |
147 | 149 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
148 | 150 | |
149 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
150 | - echo trim($event['end_date_orig']) . ', '; |
|
151 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
152 | + echo trim($event['end_date_orig']) . ', '; |
|
153 | + } |
|
151 | 154 | |
152 | 155 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
153 | 156 | } |
154 | 157 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
155 | - else |
|
156 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
158 | + else { |
|
159 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
160 | + } |
|
157 | 161 | } |
158 | 162 | |
159 | - if (!empty($event['location'])) |
|
160 | - echo '<br>', $event['location']; |
|
163 | + if (!empty($event['location'])) { |
|
164 | + echo '<br>', $event['location']; |
|
165 | + } |
|
161 | 166 | |
162 | 167 | echo ' |
163 | 168 | </li>'; |
@@ -189,8 +194,9 @@ discard block |
||
189 | 194 | |
190 | 195 | $birthdays = array(); |
191 | 196 | |
192 | - foreach ($date as $member) |
|
193 | - $birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>'; |
|
197 | + foreach ($date as $member) { |
|
198 | + $birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>'; |
|
199 | + } |
|
194 | 200 | |
195 | 201 | echo implode(', ', $birthdays); |
196 | 202 | |
@@ -221,8 +227,9 @@ discard block |
||
221 | 227 | $date_local = $date['date_local']; |
222 | 228 | unset($date['date_local']); |
223 | 229 | |
224 | - foreach ($date as $holiday) |
|
225 | - $holidays[] = $holiday . ' (' . $date_local . ')'; |
|
230 | + foreach ($date as $holiday) { |
|
231 | + $holidays[] = $holiday . ' (' . $date_local . ')'; |
|
232 | + } |
|
226 | 233 | } |
227 | 234 | |
228 | 235 | echo implode(', ', $holidays); |
@@ -245,17 +252,19 @@ discard block |
||
245 | 252 | global $context, $txt, $scripturl, $modSettings; |
246 | 253 | |
247 | 254 | // If the grid doesn't exist, no point in proceeding. |
248 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
249 | - return false; |
|
255 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
256 | + return false; |
|
257 | + } |
|
250 | 258 | |
251 | 259 | // A handy little pointer variable. |
252 | 260 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
253 | 261 | |
254 | 262 | // Some conditions for whether or not we should show the week links *here*. |
255 | - if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) |
|
256 | - $show_week_links = true; |
|
257 | - else |
|
258 | - $show_week_links = false; |
|
263 | + if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) { |
|
264 | + $show_week_links = true; |
|
265 | + } else { |
|
266 | + $show_week_links = false; |
|
267 | + } |
|
259 | 268 | |
260 | 269 | // Assuming that we've not disabled it, show the title block! |
261 | 270 | if (empty($calendar_data['disable_title'])) |
@@ -294,8 +303,9 @@ discard block |
||
294 | 303 | } |
295 | 304 | |
296 | 305 | // Show the controls on main grids |
297 | - if ($is_mini === false) |
|
298 | - template_calendar_top($calendar_data); |
|
306 | + if ($is_mini === false) { |
|
307 | + template_calendar_top($calendar_data); |
|
308 | + } |
|
299 | 309 | |
300 | 310 | // Finally, the main calendar table. |
301 | 311 | echo '<table class="calendar_table">'; |
@@ -306,8 +316,9 @@ discard block |
||
306 | 316 | echo '<tr>'; |
307 | 317 | |
308 | 318 | // If we're showing week links, there's an extra column ahead of the week links, so let's think ahead and be prepared! |
309 | - if ($show_week_links === true) |
|
310 | - echo '<th> </th>'; |
|
319 | + if ($show_week_links === true) { |
|
320 | + echo '<th> </th>'; |
|
321 | + } |
|
311 | 322 | |
312 | 323 | // Now, loop through each actual day of the week. |
313 | 324 | foreach ($calendar_data['week_days'] as $day) |
@@ -354,27 +365,29 @@ discard block |
||
354 | 365 | // Additional classes are given for events, holidays, and birthdays. |
355 | 366 | if (!empty($day['events']) && !empty($calendar_data['highlight']['events'])) |
356 | 367 | { |
357 | - if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) |
|
358 | - $classes[] = 'events'; |
|
359 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) |
|
360 | - $classes[] = 'events'; |
|
368 | + if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) { |
|
369 | + $classes[] = 'events'; |
|
370 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) { |
|
371 | + $classes[] = 'events'; |
|
372 | + } |
|
361 | 373 | } |
362 | 374 | if (!empty($day['holidays']) && !empty($calendar_data['highlight']['holidays'])) |
363 | 375 | { |
364 | - if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) |
|
365 | - $classes[] = 'holidays'; |
|
366 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) |
|
367 | - $classes[] = 'holidays'; |
|
376 | + if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) { |
|
377 | + $classes[] = 'holidays'; |
|
378 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) { |
|
379 | + $classes[] = 'holidays'; |
|
380 | + } |
|
368 | 381 | } |
369 | 382 | if (!empty($day['birthdays']) && !empty($calendar_data['highlight']['birthdays'])) |
370 | 383 | { |
371 | - if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) |
|
372 | - $classes[] = 'birthdays'; |
|
373 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) |
|
374 | - $classes[] = 'birthdays'; |
|
384 | + if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) { |
|
385 | + $classes[] = 'birthdays'; |
|
386 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) { |
|
387 | + $classes[] = 'birthdays'; |
|
388 | + } |
|
375 | 389 | } |
376 | - } |
|
377 | - else |
|
390 | + } else |
|
378 | 391 | { |
379 | 392 | // Default Classes (either compact or comfortable and disabled). |
380 | 393 | $classes[] = !empty($calendar_data['size']) && $calendar_data['size'] == 'small' ? 'compact' : 'comfortable'; |
@@ -392,19 +405,21 @@ discard block |
||
392 | 405 | $title_prefix = !empty($day['is_first_of_month']) && $context['current_month'] == $calendar_data['current_month'] && $is_mini === false ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$calendar_data['current_month']] . ' ' : $txt['months_titles'][$calendar_data['current_month']] . ' ') : ''; |
393 | 406 | |
394 | 407 | // The actual day number - be it a link, or just plain old text! |
395 | - if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) |
|
396 | - echo '<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
|
397 | - elseif ($is_mini) |
|
398 | - echo '<a href="', $scripturl, '?action=calendar;', $context['calendar_view'], ';year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
|
399 | - else |
|
400 | - echo '<span class="day_text">', $title_prefix, $day['day'], '</span>'; |
|
408 | + if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) { |
|
409 | + echo '<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
|
410 | + } elseif ($is_mini) { |
|
411 | + echo '<a href="', $scripturl, '?action=calendar;', $context['calendar_view'], ';year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
|
412 | + } else { |
|
413 | + echo '<span class="day_text">', $title_prefix, $day['day'], '</span>'; |
|
414 | + } |
|
401 | 415 | |
402 | 416 | // A lot of stuff, we're not showing on mini-calendars to conserve space. |
403 | 417 | if ($is_mini === false) |
404 | 418 | { |
405 | 419 | // Holidays are always fun, let's show them! |
406 | - if (!empty($day['holidays'])) |
|
407 | - echo '<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>'; |
|
420 | + if (!empty($day['holidays'])) { |
|
421 | + echo '<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>'; |
|
422 | + } |
|
408 | 423 | |
409 | 424 | // Happy Birthday Dear, Member! |
410 | 425 | if (!empty($day['birthdays'])) |
@@ -422,14 +437,16 @@ discard block |
||
422 | 437 | echo '<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] || ($count == 10 && $use_js_hide) ? '' : ', '; |
423 | 438 | |
424 | 439 | // 9...10! Let's stop there. |
425 | - if ($birthday_count == 10 && $use_js_hide) |
|
426 | - // !!TODO - Inline CSS and JavaScript should be moved. |
|
440 | + if ($birthday_count == 10 && $use_js_hide) { |
|
441 | + // !!TODO - Inline CSS and JavaScript should be moved. |
|
427 | 442 | echo '<span class="hidelink" id="bdhidelink_', $day['day'], '">...<br><a href="', $scripturl, '?action=calendar;month=', $calendar_data['current_month'], ';year=', $calendar_data['current_year'], ';showbd" onclick="document.getElementById(\'bdhide_', $day['day'], '\').style.display = \'\'; document.getElementById(\'bdhidelink_', $day['day'], '\').style.display = \'none\'; return false;">(', sprintf($txt['calendar_click_all'], count($day['birthdays'])), ')</a></span><span id="bdhide_', $day['day'], '" style="display: none;">, '; |
443 | + } |
|
428 | 444 | |
429 | 445 | ++$birthday_count; |
430 | 446 | } |
431 | - if ($use_js_hide) |
|
432 | - echo '</span>'; |
|
447 | + if ($use_js_hide) { |
|
448 | + echo '</span>'; |
|
449 | + } |
|
433 | 450 | |
434 | 451 | echo '</div>'; |
435 | 452 | } |
@@ -439,8 +456,9 @@ discard block |
||
439 | 456 | { |
440 | 457 | // Sort events by start time (all day events will be listed first) |
441 | 458 | uasort($day['events'], function($a, $b) { |
442 | - if ($a['start_timestamp'] == $b['start_timestamp']) |
|
443 | - return 0; |
|
459 | + if ($a['start_timestamp'] == $b['start_timestamp']) { |
|
460 | + return 0; |
|
461 | + } |
|
444 | 462 | return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
445 | 463 | }); |
446 | 464 | |
@@ -456,17 +474,19 @@ discard block |
||
456 | 474 | |
457 | 475 | echo '<div class="event_wrapper', $event['starts_today'] == true ? ' event_starts_today' : '', $event['ends_today'] == true ? ' event_ends_today' : '', $event['allday'] == true ? ' allday' : '', $event['is_selected'] ? ' sel_event' : '', '">', $event['link'], '<br><span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">'; |
458 | 476 | |
459 | - if (!empty($event['start_time_local']) && $event['starts_today'] == true) |
|
460 | - echo trim(str_replace(':00 ', ' ', $event['start_time_local'])); |
|
461 | - elseif (!empty($event['end_time_local']) && $event['ends_today'] == true) |
|
462 | - echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local'])); |
|
463 | - elseif (!empty($event['allday'])) |
|
464 | - echo $txt['calendar_allday']; |
|
477 | + if (!empty($event['start_time_local']) && $event['starts_today'] == true) { |
|
478 | + echo trim(str_replace(':00 ', ' ', $event['start_time_local'])); |
|
479 | + } elseif (!empty($event['end_time_local']) && $event['ends_today'] == true) { |
|
480 | + echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local'])); |
|
481 | + } elseif (!empty($event['allday'])) { |
|
482 | + echo $txt['calendar_allday']; |
|
483 | + } |
|
465 | 484 | |
466 | 485 | echo '</span>'; |
467 | 486 | |
468 | - if (!empty($event['location'])) |
|
469 | - echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
|
487 | + if (!empty($event['location'])) { |
|
488 | + echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
|
489 | + } |
|
470 | 490 | |
471 | 491 | if ($event['can_edit'] || $event['can_export']) |
472 | 492 | { |
@@ -503,10 +523,11 @@ discard block |
||
503 | 523 | // Otherwise, assuming it's not a mini-calendar, we can show previous / next month days! |
504 | 524 | elseif ($is_mini === false) |
505 | 525 | { |
506 | - if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) |
|
507 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>'; |
|
508 | - elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) |
|
509 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
|
526 | + if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) { |
|
527 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>'; |
|
528 | + } elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) { |
|
529 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
|
530 | + } |
|
510 | 531 | } |
511 | 532 | |
512 | 533 | // Close this day and increase var count. |
@@ -532,8 +553,9 @@ discard block |
||
532 | 553 | global $context, $txt, $scripturl, $modSettings; |
533 | 554 | |
534 | 555 | // We might have no reason to proceed, if the variable isn't there. |
535 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
536 | - return false; |
|
556 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
557 | + return false; |
|
558 | + } |
|
537 | 559 | |
538 | 560 | // Handy pointer. |
539 | 561 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
@@ -568,8 +590,9 @@ discard block |
||
568 | 590 | } |
569 | 591 | |
570 | 592 | // The Month Title + Week Number... |
571 | - if (!empty($calendar_data['week_title'])) |
|
572 | - echo $calendar_data['week_title']; |
|
593 | + if (!empty($calendar_data['week_title'])) { |
|
594 | + echo $calendar_data['week_title']; |
|
595 | + } |
|
573 | 596 | |
574 | 597 | echo ' |
575 | 598 | </h3> |
@@ -608,10 +631,11 @@ discard block |
||
608 | 631 | <tr class="days_wrapper"> |
609 | 632 | <td class="', implode(' ', $classes), ' act_day">'; |
610 | 633 | // Should the day number be a link? |
611 | - if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) |
|
612 | - echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>'; |
|
613 | - else |
|
614 | - echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; |
|
634 | + if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) { |
|
635 | + echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>'; |
|
636 | + } else { |
|
637 | + echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; |
|
638 | + } |
|
615 | 639 | |
616 | 640 | echo '</td> |
617 | 641 | <td class="', implode(' ', $classes), '', empty($day['events']) ? (' disabled' . ($context['can_post'] ? ' week_post' : '')) : ' events', ' event_col" data-css-prefix="' . $txt['events'] . ' ', (empty($day['events']) && empty($context['can_post'])) ? $txt['none'] : '', '">'; |
@@ -620,8 +644,9 @@ discard block |
||
620 | 644 | { |
621 | 645 | // Sort events by start time (all day events will be listed first) |
622 | 646 | uasort($day['events'], function($a, $b) { |
623 | - if ($a['start_timestamp'] == $b['start_timestamp']) |
|
624 | - return 0; |
|
647 | + if ($a['start_timestamp'] == $b['start_timestamp']) { |
|
648 | + return 0; |
|
649 | + } |
|
625 | 650 | return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
626 | 651 | }); |
627 | 652 | |
@@ -633,15 +658,17 @@ discard block |
||
633 | 658 | |
634 | 659 | echo $event['link'], '<br><span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">'; |
635 | 660 | |
636 | - if (!empty($event['start_time_local'])) |
|
637 | - echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' – ' . trim($event['end_time_local']) : ''; |
|
638 | - else |
|
639 | - echo $txt['calendar_allday']; |
|
661 | + if (!empty($event['start_time_local'])) { |
|
662 | + echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' – ' . trim($event['end_time_local']) : ''; |
|
663 | + } else { |
|
664 | + echo $txt['calendar_allday']; |
|
665 | + } |
|
640 | 666 | |
641 | 667 | echo '</span>'; |
642 | 668 | |
643 | - if (!empty($event['location'])) |
|
644 | - echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
|
669 | + if (!empty($event['location'])) { |
|
670 | + echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
|
671 | + } |
|
645 | 672 | |
646 | 673 | if (!empty($event_icons_needed)) |
647 | 674 | { |
@@ -678,8 +705,7 @@ discard block |
||
678 | 705 | </div> |
679 | 706 | <br class="clear">'; |
680 | 707 | } |
681 | - } |
|
682 | - else |
|
708 | + } else |
|
683 | 709 | { |
684 | 710 | if (!empty($context['can_post'])) |
685 | 711 | { |
@@ -692,8 +718,9 @@ discard block |
||
692 | 718 | echo '</td> |
693 | 719 | <td class="', implode(' ', $classes), !empty($day['holidays']) ? ' holidays' : ' disabled', ' holiday_col" data-css-prefix="' . $txt['calendar_prompt'] . ' ">'; |
694 | 720 | // Show any holidays! |
695 | - if (!empty($day['holidays'])) |
|
696 | - echo implode('<br>', $day['holidays']); |
|
721 | + if (!empty($day['holidays'])) { |
|
722 | + echo implode('<br>', $day['holidays']); |
|
723 | + } |
|
697 | 724 | |
698 | 725 | echo '</td> |
699 | 726 | <td class="', implode(' ', $classes), '', !empty($day['birthdays']) ? ' birthdays' : ' disabled', ' birthday_col" data-css-prefix="' . $txt['birthdays'] . ' ">'; |
@@ -751,8 +778,7 @@ discard block |
||
751 | 778 | <input type="text" name="end_date" id="end_date" maxlength="10" value="', $calendar_data['end_date'], '" tabindex="', $context['tabindex']++, '" class="date_input end" data-type="date"> |
752 | 779 | <input type="submit" class="button" style="float:none" id="view_button" value="', $txt['view'], '"> |
753 | 780 | </form>'; |
754 | - } |
|
755 | - else |
|
781 | + } else |
|
756 | 782 | { |
757 | 783 | echo' |
758 | 784 | <form action="', $scripturl, '?action=calendar" id="calendar_navigation" method="post" accept-charset="', $context['character_set'], '"> |
@@ -794,8 +820,9 @@ discard block |
||
794 | 820 | echo ' |
795 | 821 | <form action="', $scripturl, '?action=calendar;sa=post" method="post" name="postevent" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);smc_saveEntities(\'postevent\', [\'evtitle\']);" style="margin: 0;">'; |
796 | 822 | |
797 | - if (!empty($context['event']['new'])) |
|
798 | - echo '<input type="hidden" name="eventid" value="', $context['event']['eventid'], '">'; |
|
823 | + if (!empty($context['event']['new'])) { |
|
824 | + echo '<input type="hidden" name="eventid" value="', $context['event']['eventid'], '">'; |
|
825 | + } |
|
799 | 826 | |
800 | 827 | // Start the main table. |
801 | 828 | echo ' |
@@ -845,9 +872,10 @@ discard block |
||
845 | 872 | { |
846 | 873 | echo ' |
847 | 874 | <optgroup label="', $category['name'], '">'; |
848 | - foreach ($category['boards'] as $board) |
|
849 | - echo ' |
|
875 | + foreach ($category['boards'] as $board) { |
|
876 | + echo ' |
|
850 | 877 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], ' </option>'; |
878 | + } |
|
851 | 879 | echo ' |
852 | 880 | </optgroup>'; |
853 | 881 | } |
@@ -883,9 +911,10 @@ discard block |
||
883 | 911 | <span class="label">', $txt['calendar_timezone'], '</span> |
884 | 912 | <select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>'; |
885 | 913 | |
886 | - foreach ($context['all_timezones'] as $tz => $tzname) |
|
887 | - echo ' |
|
914 | + foreach ($context['all_timezones'] as $tz => $tzname) { |
|
915 | + echo ' |
|
888 | 916 | <option value="', $tz, '"', $tz == $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>'; |
917 | + } |
|
889 | 918 | |
890 | 919 | echo ' |
891 | 920 | </select> |
@@ -900,9 +929,10 @@ discard block |
||
900 | 929 | echo ' |
901 | 930 | <input type="submit" value="', empty($context['event']['new']) ? $txt['save'] : $txt['post'], '" class="button">'; |
902 | 931 | // Delete button? |
903 | - if (empty($context['event']['new'])) |
|
904 | - echo ' |
|
932 | + if (empty($context['event']['new'])) { |
|
933 | + echo ' |
|
905 | 934 | <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['calendar_confirm_delete'], '" class="button you_sure">'; |
935 | + } |
|
906 | 936 | |
907 | 937 | echo ' |
908 | 938 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -946,9 +976,10 @@ discard block |
||
946 | 976 | |
947 | 977 | foreach ($context['clockicons'] as $t => $v) |
948 | 978 | { |
949 | - foreach ($v as $i) |
|
950 | - echo ' |
|
979 | + foreach ($v as $i) { |
|
980 | + echo ' |
|
951 | 981 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
982 | + } |
|
952 | 983 | } |
953 | 984 | |
954 | 985 | echo ' |
@@ -973,13 +1004,14 @@ discard block |
||
973 | 1004 | |
974 | 1005 | foreach ($context['clockicons'] as $t => $v) |
975 | 1006 | { |
976 | - foreach ($v as $i) |
|
977 | - echo ' |
|
1007 | + foreach ($v as $i) { |
|
1008 | + echo ' |
|
978 | 1009 | if (', $t, ' >= ', $i, ') |
979 | 1010 | { |
980 | 1011 | turnon.push("', $t, '_', $i, '"); |
981 | 1012 | ', $t, ' -= ', $i, '; |
982 | 1013 | }'; |
1014 | + } |
|
983 | 1015 | } |
984 | 1016 | |
985 | 1017 | echo ' |
@@ -1043,9 +1075,10 @@ discard block |
||
1043 | 1075 | |
1044 | 1076 | foreach ($context['clockicons'] as $t => $v) |
1045 | 1077 | { |
1046 | - foreach ($v as $i) |
|
1047 | - echo ' |
|
1078 | + foreach ($v as $i) { |
|
1079 | + echo ' |
|
1048 | 1080 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
1081 | + } |
|
1049 | 1082 | } |
1050 | 1083 | |
1051 | 1084 | echo ' |
@@ -1062,13 +1095,14 @@ discard block |
||
1062 | 1095 | |
1063 | 1096 | foreach ($context['clockicons'] as $t => $v) |
1064 | 1097 | { |
1065 | - foreach ($v as $i) |
|
1066 | - echo ' |
|
1098 | + foreach ($v as $i) { |
|
1099 | + echo ' |
|
1067 | 1100 | if (', $t, ' >= ', $i, ') |
1068 | 1101 | { |
1069 | 1102 | turnon.push("', $t, '_', $i, '"); |
1070 | 1103 | ', $t, ' -= ', $i, '; |
1071 | 1104 | }'; |
1105 | + } |
|
1072 | 1106 | } |
1073 | 1107 | |
1074 | 1108 | echo ' |
@@ -1127,9 +1161,10 @@ discard block |
||
1127 | 1161 | |
1128 | 1162 | foreach ($context['clockicons'] as $t => $v) |
1129 | 1163 | { |
1130 | - foreach ($v as $i) |
|
1131 | - echo ' |
|
1164 | + foreach ($v as $i) { |
|
1165 | + echo ' |
|
1132 | 1166 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
1167 | + } |
|
1133 | 1168 | } |
1134 | 1169 | |
1135 | 1170 | echo ' |
@@ -1150,13 +1185,14 @@ discard block |
||
1150 | 1185 | |
1151 | 1186 | foreach ($context['clockicons'] as $t => $v) |
1152 | 1187 | { |
1153 | - foreach ($v as $i) |
|
1154 | - echo ' |
|
1188 | + foreach ($v as $i) { |
|
1189 | + echo ' |
|
1155 | 1190 | if (', $t, ' >= ', $i, ') |
1156 | 1191 | { |
1157 | 1192 | turnon.push("', $t, '_', $i, '"); |
1158 | 1193 | ', $t, ' -= ', $i, '; |
1159 | 1194 | }'; |
1195 | + } |
|
1160 | 1196 | } |
1161 | 1197 | |
1162 | 1198 | echo ' |