@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 3 |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('SMF')) |
|
14 | +if (!defined('SMF')) { |
|
15 | 15 | die('Hacking attempt...'); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * Our Cache API class |
@@ -27,8 +28,9 @@ discard block |
||
27 | 28 | { |
28 | 29 | $supported = function_exists('apc_fetch') && function_exists('apc_store'); |
29 | 30 | |
30 | - if ($test) |
|
31 | - return $supported; |
|
31 | + if ($test) { |
|
32 | + return $supported; |
|
33 | + } |
|
32 | 34 | return parent::isSupported() && $supported; |
33 | 35 | } |
34 | 36 | |
@@ -50,10 +52,11 @@ discard block |
||
50 | 52 | $key = $this->prefix . strtr($key, ':/', '-_'); |
51 | 53 | |
52 | 54 | // An extended key is needed to counteract a bug in APC. |
53 | - if ($value === null) |
|
54 | - return apc_delete($key . 'smf'); |
|
55 | - else |
|
56 | - return apc_store($key . 'smf', $value, $ttl); |
|
55 | + if ($value === null) { |
|
56 | + return apc_delete($key . 'smf'); |
|
57 | + } else { |
|
58 | + return apc_store($key . 'smf', $value, $ttl); |
|
59 | + } |
|
57 | 60 | } |
58 | 61 | |
59 | 62 | /** |
@@ -67,9 +70,9 @@ discard block |
||
67 | 70 | // Always returns true. |
68 | 71 | apc_clear_cache('user'); |
69 | 72 | apc_clear_cache('system'); |
73 | + } elseif ($type === 'user') { |
|
74 | + apc_clear_cache('user'); |
|
70 | 75 | } |
71 | - elseif ($type === 'user') |
|
72 | - apc_clear_cache('user'); |
|
73 | 76 | |
74 | 77 | $this->invalidateCache(); |
75 | 78 | return true; |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 3 |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('SMF')) |
|
14 | +if (!defined('SMF')) { |
|
15 | 15 | die('Hacking attempt...'); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * Our Cache API class |
@@ -44,8 +45,9 @@ discard block |
||
44 | 45 | { |
45 | 46 | $supported = function_exists('xcache_get') && function_exists('xcache_set') && ini_get('xcache.var_size') > 0; |
46 | 47 | |
47 | - if ($test) |
|
48 | - return $supported; |
|
48 | + if ($test) { |
|
49 | + return $supported; |
|
50 | + } |
|
49 | 51 | return parent::isSupported() && $supported; |
50 | 52 | } |
51 | 53 | |
@@ -66,10 +68,11 @@ discard block |
||
66 | 68 | { |
67 | 69 | $key = $this->prefix . strtr($key, ':/', '-_'); |
68 | 70 | |
69 | - if ($value === null) |
|
70 | - return xcache_unset($key); |
|
71 | - else |
|
72 | - return xcache_set($key, $value, $ttl); |
|
71 | + if ($value === null) { |
|
72 | + return xcache_unset($key); |
|
73 | + } else { |
|
74 | + return xcache_set($key, $value, $ttl); |
|
75 | + } |
|
73 | 76 | } |
74 | 77 | |
75 | 78 | /** |
@@ -88,10 +91,12 @@ discard block |
||
88 | 91 | } |
89 | 92 | |
90 | 93 | // if passed a type, clear that type out |
91 | - if ($type === '' || $type === 'user') |
|
92 | - xcache_clear_cache(XC_TYPE_VAR, 0); |
|
93 | - if ($type === '' || $type === 'data') |
|
94 | - xcache_clear_cache(XC_TYPE_PHP, 0); |
|
94 | + if ($type === '' || $type === 'user') { |
|
95 | + xcache_clear_cache(XC_TYPE_VAR, 0); |
|
96 | + } |
|
97 | + if ($type === '' || $type === 'data') { |
|
98 | + xcache_clear_cache(XC_TYPE_PHP, 0); |
|
99 | + } |
|
95 | 100 | |
96 | 101 | $this->invalidateCache(); |
97 | 102 | return true; |
@@ -110,8 +115,9 @@ discard block |
||
110 | 115 | // While we could md5 this when saving, this could be tricky to be sure it doesn't get corrupted on additional saves. |
111 | 116 | $config_vars[] = array('xcache_adminpass', $txt['cache_xcache_adminpass'], 'db', 'text', 0); |
112 | 117 | |
113 | - if (!isset($context['settings_post_javascript'])) |
|
114 | - $context['settings_post_javascript'] = ''; |
|
118 | + if (!isset($context['settings_post_javascript'])) { |
|
119 | + $context['settings_post_javascript'] = ''; |
|
120 | + } |
|
115 | 121 | |
116 | 122 | $context['settings_post_javascript'] .= ' |
117 | 123 | $("#cache_accelerator").change(function (e) { |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 3 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Get all birthdays within the given time range. |
@@ -60,8 +61,7 @@ discard block |
||
60 | 61 | 'max_year' => $year_high, |
61 | 62 | ) |
62 | 63 | ); |
63 | - } |
|
64 | - else |
|
64 | + } else |
|
65 | 65 | { |
66 | 66 | $result = $smcFunc['db_query']('birthday_array', ' |
67 | 67 | SELECT id_member, real_name, YEAR(birthdate) AS birth_year, birthdate |
@@ -91,10 +91,11 @@ discard block |
||
91 | 91 | $bday = array(); |
92 | 92 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
93 | 93 | { |
94 | - if ($year_low != $year_high) |
|
95 | - $age_year = substr($row['birthdate'], 5) < substr($high_date, 5) ? $year_high : $year_low; |
|
96 | - else |
|
97 | - $age_year = $year_low; |
|
94 | + if ($year_low != $year_high) { |
|
95 | + $age_year = substr($row['birthdate'], 5) < substr($high_date, 5) ? $year_high : $year_low; |
|
96 | + } else { |
|
97 | + $age_year = $year_low; |
|
98 | + } |
|
98 | 99 | |
99 | 100 | $bday[$age_year . substr($row['birthdate'], 4)][] = array( |
100 | 101 | 'id' => $row['id_member'], |
@@ -108,8 +109,9 @@ discard block |
||
108 | 109 | ksort($bday); |
109 | 110 | |
110 | 111 | // Set is_last, so the themes know when to stop placing separators. |
111 | - foreach ($bday as $mday => $array) |
|
112 | - $bday[$mday][count($array) - 1]['is_last'] = true; |
|
112 | + foreach ($bday as $mday => $array) { |
|
113 | + $bday[$mday][count($array) - 1]['is_last'] = true; |
|
114 | + } |
|
113 | 115 | |
114 | 116 | return $bday; |
115 | 117 | } |
@@ -157,8 +159,9 @@ discard block |
||
157 | 159 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
158 | 160 | { |
159 | 161 | // If the attached topic is not approved then for the moment pretend it doesn't exist |
160 | - if (!empty($row['id_first_msg']) && $modSettings['postmod_active'] && !$row['approved']) |
|
161 | - continue; |
|
162 | + if (!empty($row['id_first_msg']) && $modSettings['postmod_active'] && !$row['approved']) { |
|
163 | + continue; |
|
164 | + } |
|
162 | 165 | |
163 | 166 | // Force a censor of the title - as often these are used by others. |
164 | 167 | censorText($row['title'], $use_permissions ? false : true); |
@@ -167,8 +170,9 @@ discard block |
||
167 | 170 | list($start, $end, $allday, $span, $tz, $tz_abbrev) = buildEventDatetimes($row); |
168 | 171 | |
169 | 172 | // Sanity check |
170 | - if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) |
|
171 | - continue; |
|
173 | + if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) { |
|
174 | + continue; |
|
175 | + } |
|
172 | 176 | |
173 | 177 | // Get set up for the loop |
174 | 178 | $start_object = date_create($row['start_date'] . (!$allday ? ' ' . $row['start_time'] : ''), timezone_open($tz)); |
@@ -232,8 +236,8 @@ discard block |
||
232 | 236 | ); |
233 | 237 | |
234 | 238 | // If we're using permissions (calendar pages?) then just ouput normal contextual style information. |
235 | - if ($use_permissions) |
|
236 | - $events[date_format($cal_date, 'Y-m-d')][] = array_merge($eventProperties, array( |
|
239 | + if ($use_permissions) { |
|
240 | + $events[date_format($cal_date, 'Y-m-d')][] = array_merge($eventProperties, array( |
|
237 | 241 | 'href' => $row['id_board'] == 0 ? '' : $scripturl . '?topic=' . $row['id_topic'] . '.0', |
238 | 242 | 'link' => $row['id_board'] == 0 ? $row['title'] : '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['title'] . '</a>', |
239 | 243 | 'can_edit' => allowedTo('calendar_edit_any') || ($row['id_member'] == $user_info['id'] && allowedTo('calendar_edit_own')), |
@@ -241,9 +245,10 @@ discard block |
||
241 | 245 | 'can_export' => !empty($modSettings['cal_export']) ? true : false, |
242 | 246 | 'export_href' => $scripturl . '?action=calendar;sa=ical;eventid=' . $row['id_event'] . ';' . $context['session_var'] . '=' . $context['session_id'], |
243 | 247 | )); |
248 | + } |
|
244 | 249 | // Otherwise, this is going to be cached and the VIEWER'S permissions should apply... just put together some info. |
245 | - else |
|
246 | - $events[date_format($cal_date, 'Y-m-d')][] = array_merge($eventProperties, array( |
|
250 | + else { |
|
251 | + $events[date_format($cal_date, 'Y-m-d')][] = array_merge($eventProperties, array( |
|
247 | 252 | 'href' => $row['id_topic'] == 0 ? '' : $scripturl . '?topic=' . $row['id_topic'] . '.0', |
248 | 253 | 'link' => $row['id_topic'] == 0 ? $row['title'] : '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['title'] . '</a>', |
249 | 254 | 'can_edit' => false, |
@@ -253,6 +258,7 @@ discard block |
||
253 | 258 | 'poster' => $row['id_member'], |
254 | 259 | 'allowed_groups' => explode(',', $row['member_groups']), |
255 | 260 | )); |
261 | + } |
|
256 | 262 | |
257 | 263 | date_add($cal_date, date_interval_create_from_date_string('1 day')); |
258 | 264 | } |
@@ -262,8 +268,9 @@ discard block |
||
262 | 268 | // If we're doing normal contextual data, go through and make things clear to the templates ;). |
263 | 269 | if ($use_permissions) |
264 | 270 | { |
265 | - foreach ($events as $mday => $array) |
|
266 | - $events[$mday][count($array) - 1]['is_last'] = true; |
|
271 | + foreach ($events as $mday => $array) { |
|
272 | + $events[$mday][count($array) - 1]['is_last'] = true; |
|
273 | + } |
|
267 | 274 | } |
268 | 275 | |
269 | 276 | ksort($events); |
@@ -283,11 +290,12 @@ discard block |
||
283 | 290 | global $smcFunc; |
284 | 291 | |
285 | 292 | // Get the lowest and highest dates for "all years". |
286 | - if (substr($low_date, 0, 4) != substr($high_date, 0, 4)) |
|
287 | - $allyear_part = 'event_date BETWEEN {date:all_year_low} AND {date:all_year_dec} |
|
293 | + if (substr($low_date, 0, 4) != substr($high_date, 0, 4)) { |
|
294 | + $allyear_part = 'event_date BETWEEN {date:all_year_low} AND {date:all_year_dec} |
|
288 | 295 | OR event_date BETWEEN {date:all_year_jan} AND {date:all_year_high}'; |
289 | - else |
|
290 | - $allyear_part = 'event_date BETWEEN {date:all_year_low} AND {date:all_year_high}'; |
|
296 | + } else { |
|
297 | + $allyear_part = 'event_date BETWEEN {date:all_year_low} AND {date:all_year_high}'; |
|
298 | + } |
|
291 | 299 | |
292 | 300 | // Find some holidays... ;). |
293 | 301 | $result = $smcFunc['db_query']('', ' |
@@ -307,10 +315,11 @@ discard block |
||
307 | 315 | $holidays = array(); |
308 | 316 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
309 | 317 | { |
310 | - if (substr($low_date, 0, 4) != substr($high_date, 0, 4)) |
|
311 | - $event_year = substr($row['event_date'], 5) < substr($high_date, 5) ? substr($high_date, 0, 4) : substr($low_date, 0, 4); |
|
312 | - else |
|
313 | - $event_year = substr($low_date, 0, 4); |
|
318 | + if (substr($low_date, 0, 4) != substr($high_date, 0, 4)) { |
|
319 | + $event_year = substr($row['event_date'], 5) < substr($high_date, 5) ? substr($high_date, 0, 4) : substr($low_date, 0, 4); |
|
320 | + } else { |
|
321 | + $event_year = substr($low_date, 0, 4); |
|
322 | + } |
|
314 | 323 | |
315 | 324 | $holidays[$event_year . substr($row['event_date'], 4)][] = $row['title']; |
316 | 325 | } |
@@ -336,10 +345,12 @@ discard block |
||
336 | 345 | isAllowedTo('calendar_post'); |
337 | 346 | |
338 | 347 | // No board? No topic?!? |
339 | - if (empty($board)) |
|
340 | - fatal_lang_error('missing_board_id', false); |
|
341 | - if (empty($topic)) |
|
342 | - fatal_lang_error('missing_topic_id', false); |
|
348 | + if (empty($board)) { |
|
349 | + fatal_lang_error('missing_board_id', false); |
|
350 | + } |
|
351 | + if (empty($topic)) { |
|
352 | + fatal_lang_error('missing_topic_id', false); |
|
353 | + } |
|
343 | 354 | |
344 | 355 | // Administrator, Moderator, or owner. Period. |
345 | 356 | if (!allowedTo('admin_forum') && !allowedTo('moderate_board')) |
@@ -357,12 +368,14 @@ discard block |
||
357 | 368 | if ($row = $smcFunc['db_fetch_assoc']($result)) |
358 | 369 | { |
359 | 370 | // Not the owner of the topic. |
360 | - if ($row['id_member_started'] != $user_info['id']) |
|
361 | - fatal_lang_error('not_your_topic', 'user'); |
|
371 | + if ($row['id_member_started'] != $user_info['id']) { |
|
372 | + fatal_lang_error('not_your_topic', 'user'); |
|
373 | + } |
|
362 | 374 | } |
363 | 375 | // Topic/Board doesn't exist..... |
364 | - else |
|
365 | - fatal_lang_error('calendar_no_topic', 'general'); |
|
376 | + else { |
|
377 | + fatal_lang_error('calendar_no_topic', 'general'); |
|
378 | + } |
|
366 | 379 | $smcFunc['db_free_result']($result); |
367 | 380 | } |
368 | 381 | } |
@@ -450,14 +463,16 @@ discard block |
||
450 | 463 | if (!empty($calendarOptions['start_day'])) |
451 | 464 | { |
452 | 465 | $nShift -= $calendarOptions['start_day']; |
453 | - if ($nShift < 0) |
|
454 | - $nShift = 7 + $nShift; |
|
466 | + if ($nShift < 0) { |
|
467 | + $nShift = 7 + $nShift; |
|
468 | + } |
|
455 | 469 | } |
456 | 470 | |
457 | 471 | // Number of rows required to fit the month. |
458 | 472 | $nRows = floor(($month_info['last_day']['day_of_month'] + $nShift) / 7); |
459 | - if (($month_info['last_day']['day_of_month'] + $nShift) % 7) |
|
460 | - $nRows++; |
|
473 | + if (($month_info['last_day']['day_of_month'] + $nShift) % 7) { |
|
474 | + $nRows++; |
|
475 | + } |
|
461 | 476 | |
462 | 477 | // Fetch the arrays for birthdays, posted events, and holidays. |
463 | 478 | $bday = $calendarOptions['show_birthdays'] ? getBirthdayRange($month_info['first_day']['date'], $month_info['last_day']['date']) : array(); |
@@ -470,8 +485,9 @@ discard block |
||
470 | 485 | { |
471 | 486 | $calendarGrid['week_days'][] = $count; |
472 | 487 | $count++; |
473 | - if ($count == 7) |
|
474 | - $count = 0; |
|
488 | + if ($count == 7) { |
|
489 | + $count = 0; |
|
490 | + } |
|
475 | 491 | } |
476 | 492 | |
477 | 493 | // Iterate through each week. |
@@ -488,8 +504,9 @@ discard block |
||
488 | 504 | { |
489 | 505 | $nDay = ($nRow * 7) + $nCol - $nShift + 1; |
490 | 506 | |
491 | - if ($nDay < 1 || $nDay > $month_info['last_day']['day_of_month']) |
|
492 | - $nDay = 0; |
|
507 | + if ($nDay < 1 || $nDay > $month_info['last_day']['day_of_month']) { |
|
508 | + $nDay = 0; |
|
509 | + } |
|
493 | 510 | |
494 | 511 | $date = sprintf('%04d-%02d-%02d', $year, $month, $nDay); |
495 | 512 | |
@@ -507,8 +524,9 @@ discard block |
||
507 | 524 | } |
508 | 525 | |
509 | 526 | // What is the last day of the month? |
510 | - if ($is_previous === true) |
|
511 | - $calendarGrid['last_of_month'] = $month_info['last_day']['day_of_month']; |
|
527 | + if ($is_previous === true) { |
|
528 | + $calendarGrid['last_of_month'] = $month_info['last_day']['day_of_month']; |
|
529 | + } |
|
512 | 530 | |
513 | 531 | // We'll use the shift in the template. |
514 | 532 | $calendarGrid['shift'] = $nShift; |
@@ -542,8 +560,9 @@ discard block |
||
542 | 560 | { |
543 | 561 | // Here we offset accordingly to get things to the real start of a week. |
544 | 562 | $date_diff = $day_of_week - $calendarOptions['start_day']; |
545 | - if ($date_diff < 0) |
|
546 | - $date_diff += 7; |
|
563 | + if ($date_diff < 0) { |
|
564 | + $date_diff += 7; |
|
565 | + } |
|
547 | 566 | $new_timestamp = mktime(0, 0, 0, $month, $day, $year) - $date_diff * 86400; |
548 | 567 | $day = (int) strftime('%d', $new_timestamp); |
549 | 568 | $month = (int) strftime('%m', $new_timestamp); |
@@ -673,18 +692,20 @@ discard block |
||
673 | 692 | { |
674 | 693 | foreach ($date_events as $event_key => $event_val) |
675 | 694 | { |
676 | - if (in_array($event_val['id'], $temp)) |
|
677 | - unset($calendarGrid['events'][$date][$event_key]); |
|
678 | - else |
|
679 | - $temp[] = $event_val['id']; |
|
695 | + if (in_array($event_val['id'], $temp)) { |
|
696 | + unset($calendarGrid['events'][$date][$event_key]); |
|
697 | + } else { |
|
698 | + $temp[] = $event_val['id']; |
|
699 | + } |
|
680 | 700 | } |
681 | 701 | } |
682 | 702 | |
683 | 703 | // Give birthdays and holidays a friendly format, without the year |
684 | - if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
685 | - $date_format = '%b %d'; |
|
686 | - else |
|
687 | - $date_format = str_replace(array('%Y', '%y', '%G', '%g', '%C', '%c', '%D'), array('', '', '', '', '', '%b %d', '%m/%d'), $matches[0]); |
|
704 | + if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
705 | + $date_format = '%b %d'; |
|
706 | + } else { |
|
707 | + $date_format = str_replace(array('%Y', '%y', '%G', '%g', '%C', '%c', '%D'), array('', '', '', '', '', '%b %d', '%m/%d'), $matches[0]); |
|
708 | + } |
|
688 | 709 | |
689 | 710 | foreach (array('birthdays', 'holidays') as $type) |
690 | 711 | { |
@@ -779,8 +800,9 @@ discard block |
||
779 | 800 | // Holidays between now and now + days. |
780 | 801 | for ($i = $now; $i < $now + $days_for_index; $i += 86400) |
781 | 802 | { |
782 | - if (isset($cached_data['holidays'][strftime('%Y-%m-%d', $i)])) |
|
783 | - $return_data['calendar_holidays'] = array_merge($return_data['calendar_holidays'], $cached_data['holidays'][strftime('%Y-%m-%d', $i)]); |
|
803 | + if (isset($cached_data['holidays'][strftime('%Y-%m-%d', $i)])) { |
|
804 | + $return_data['calendar_holidays'] = array_merge($return_data['calendar_holidays'], $cached_data['holidays'][strftime('%Y-%m-%d', $i)]); |
|
805 | + } |
|
784 | 806 | } |
785 | 807 | |
786 | 808 | // Happy Birthday, guys and gals! |
@@ -789,8 +811,9 @@ discard block |
||
789 | 811 | $loop_date = strftime('%Y-%m-%d', $i); |
790 | 812 | if (isset($cached_data['birthdays'][$loop_date])) |
791 | 813 | { |
792 | - foreach ($cached_data['birthdays'][$loop_date] as $index => $dummy) |
|
793 | - $cached_data['birthdays'][strftime('%Y-%m-%d', $i)][$index]['is_today'] = $loop_date === $today['date']; |
|
814 | + foreach ($cached_data['birthdays'][$loop_date] as $index => $dummy) { |
|
815 | + $cached_data['birthdays'][strftime('%Y-%m-%d', $i)][$index]['is_today'] = $loop_date === $today['date']; |
|
816 | + } |
|
794 | 817 | $return_data['calendar_birthdays'] = array_merge($return_data['calendar_birthdays'], $cached_data['birthdays'][$loop_date]); |
795 | 818 | } |
796 | 819 | } |
@@ -802,8 +825,9 @@ discard block |
||
802 | 825 | $loop_date = strftime('%Y-%m-%d', $i); |
803 | 826 | |
804 | 827 | // No events today? Check the next day. |
805 | - if (empty($cached_data['events'][$loop_date])) |
|
806 | - continue; |
|
828 | + if (empty($cached_data['events'][$loop_date])) { |
|
829 | + continue; |
|
830 | + } |
|
807 | 831 | |
808 | 832 | // Loop through all events to add a few last-minute values. |
809 | 833 | foreach ($cached_data['events'][$loop_date] as $ev => $event) |
@@ -816,9 +840,9 @@ discard block |
||
816 | 840 | { |
817 | 841 | unset($cached_data['events'][$loop_date][$ev]); |
818 | 842 | continue; |
843 | + } else { |
|
844 | + $duplicates[$this_event['topic'] . $this_event['title']] = true; |
|
819 | 845 | } |
820 | - else |
|
821 | - $duplicates[$this_event['topic'] . $this_event['title']] = true; |
|
822 | 846 | |
823 | 847 | // Might be set to true afterwards, depending on the permissions. |
824 | 848 | $this_event['can_edit'] = false; |
@@ -826,15 +850,18 @@ discard block |
||
826 | 850 | $this_event['date'] = $loop_date; |
827 | 851 | } |
828 | 852 | |
829 | - if (!empty($cached_data['events'][$loop_date])) |
|
830 | - $return_data['calendar_events'] = array_merge($return_data['calendar_events'], $cached_data['events'][$loop_date]); |
|
853 | + if (!empty($cached_data['events'][$loop_date])) { |
|
854 | + $return_data['calendar_events'] = array_merge($return_data['calendar_events'], $cached_data['events'][$loop_date]); |
|
855 | + } |
|
831 | 856 | } |
832 | 857 | |
833 | 858 | // Mark the last item so that a list separator can be used in the template. |
834 | - for ($i = 0, $n = count($return_data['calendar_birthdays']); $i < $n; $i++) |
|
835 | - $return_data['calendar_birthdays'][$i]['is_last'] = !isset($return_data['calendar_birthdays'][$i + 1]); |
|
836 | - for ($i = 0, $n = count($return_data['calendar_events']); $i < $n; $i++) |
|
837 | - $return_data['calendar_events'][$i]['is_last'] = !isset($return_data['calendar_events'][$i + 1]); |
|
859 | + for ($i = 0, $n = count($return_data['calendar_birthdays']); $i < $n; $i++) { |
|
860 | + $return_data['calendar_birthdays'][$i]['is_last'] = !isset($return_data['calendar_birthdays'][$i + 1]); |
|
861 | + } |
|
862 | + for ($i = 0, $n = count($return_data['calendar_events']); $i < $n; $i++) { |
|
863 | + $return_data['calendar_events'][$i]['is_last'] = !isset($return_data['calendar_events'][$i + 1]); |
|
864 | + } |
|
838 | 865 | |
839 | 866 | return array( |
840 | 867 | 'data' => $return_data, |
@@ -882,37 +909,46 @@ discard block |
||
882 | 909 | if (isset($_POST['start_date'])) |
883 | 910 | { |
884 | 911 | $d = date_parse($_POST['start_date']); |
885 | - if (!empty($d['error_count']) || !empty($d['warning_count'])) |
|
886 | - fatal_lang_error('invalid_date', false); |
|
887 | - if (empty($d['year'])) |
|
888 | - fatal_lang_error('event_year_missing', false); |
|
889 | - if (empty($d['month'])) |
|
890 | - fatal_lang_error('event_month_missing', false); |
|
891 | - } |
|
892 | - elseif (isset($_POST['start_datetime'])) |
|
912 | + if (!empty($d['error_count']) || !empty($d['warning_count'])) { |
|
913 | + fatal_lang_error('invalid_date', false); |
|
914 | + } |
|
915 | + if (empty($d['year'])) { |
|
916 | + fatal_lang_error('event_year_missing', false); |
|
917 | + } |
|
918 | + if (empty($d['month'])) { |
|
919 | + fatal_lang_error('event_month_missing', false); |
|
920 | + } |
|
921 | + } elseif (isset($_POST['start_datetime'])) |
|
893 | 922 | { |
894 | 923 | $d = date_parse($_POST['start_datetime']); |
895 | - if (!empty($d['error_count']) || !empty($d['warning_count'])) |
|
896 | - fatal_lang_error('invalid_date', false); |
|
897 | - if (empty($d['year'])) |
|
898 | - fatal_lang_error('event_year_missing', false); |
|
899 | - if (empty($d['month'])) |
|
900 | - fatal_lang_error('event_month_missing', false); |
|
924 | + if (!empty($d['error_count']) || !empty($d['warning_count'])) { |
|
925 | + fatal_lang_error('invalid_date', false); |
|
926 | + } |
|
927 | + if (empty($d['year'])) { |
|
928 | + fatal_lang_error('event_year_missing', false); |
|
929 | + } |
|
930 | + if (empty($d['month'])) { |
|
931 | + fatal_lang_error('event_month_missing', false); |
|
932 | + } |
|
901 | 933 | } |
902 | 934 | // The 2.0 way |
903 | 935 | else |
904 | 936 | { |
905 | 937 | // No month? No year? |
906 | - if (!isset($_POST['month'])) |
|
907 | - fatal_lang_error('event_month_missing', false); |
|
908 | - if (!isset($_POST['year'])) |
|
909 | - fatal_lang_error('event_year_missing', false); |
|
938 | + if (!isset($_POST['month'])) { |
|
939 | + fatal_lang_error('event_month_missing', false); |
|
940 | + } |
|
941 | + if (!isset($_POST['year'])) { |
|
942 | + fatal_lang_error('event_year_missing', false); |
|
943 | + } |
|
910 | 944 | |
911 | 945 | // Check the month and year... |
912 | - if ($_POST['month'] < 1 || $_POST['month'] > 12) |
|
913 | - fatal_lang_error('invalid_month', false); |
|
914 | - if ($_POST['year'] < $modSettings['cal_minyear'] || $_POST['year'] > $modSettings['cal_maxyear']) |
|
915 | - fatal_lang_error('invalid_year', false); |
|
946 | + if ($_POST['month'] < 1 || $_POST['month'] > 12) { |
|
947 | + fatal_lang_error('invalid_month', false); |
|
948 | + } |
|
949 | + if ($_POST['year'] < $modSettings['cal_minyear'] || $_POST['year'] > $modSettings['cal_maxyear']) { |
|
950 | + fatal_lang_error('invalid_year', false); |
|
951 | + } |
|
916 | 952 | } |
917 | 953 | } |
918 | 954 | |
@@ -922,8 +958,9 @@ discard block |
||
922 | 958 | // If they want to us to calculate an end date, make sure it will fit in an acceptable range. |
923 | 959 | if (isset($_POST['span'])) |
924 | 960 | { |
925 | - if (($_POST['span'] < 1) || (!empty($modSettings['cal_maxspan']) && $_POST['span'] > $modSettings['cal_maxspan'])) |
|
926 | - fatal_lang_error('invalid_days_numb', false); |
|
961 | + if (($_POST['span'] < 1) || (!empty($modSettings['cal_maxspan']) && $_POST['span'] > $modSettings['cal_maxspan'])) { |
|
962 | + fatal_lang_error('invalid_days_numb', false); |
|
963 | + } |
|
927 | 964 | } |
928 | 965 | |
929 | 966 | // There is no need to validate the following values if we are just deleting the event. |
@@ -933,24 +970,29 @@ discard block |
||
933 | 970 | if (empty($_POST['start_date']) && empty($_POST['start_datetime'])) |
934 | 971 | { |
935 | 972 | // No day? |
936 | - if (!isset($_POST['day'])) |
|
937 | - fatal_lang_error('event_day_missing', false); |
|
973 | + if (!isset($_POST['day'])) { |
|
974 | + fatal_lang_error('event_day_missing', false); |
|
975 | + } |
|
938 | 976 | |
939 | 977 | // Bad day? |
940 | - if (!checkdate($_POST['month'], $_POST['day'], $_POST['year'])) |
|
941 | - fatal_lang_error('invalid_date', false); |
|
978 | + if (!checkdate($_POST['month'], $_POST['day'], $_POST['year'])) { |
|
979 | + fatal_lang_error('invalid_date', false); |
|
980 | + } |
|
942 | 981 | } |
943 | 982 | |
944 | - if (!isset($_POST['evtitle']) && !isset($_POST['subject'])) |
|
945 | - fatal_lang_error('event_title_missing', false); |
|
946 | - elseif (!isset($_POST['evtitle'])) |
|
947 | - $_POST['evtitle'] = $_POST['subject']; |
|
983 | + if (!isset($_POST['evtitle']) && !isset($_POST['subject'])) { |
|
984 | + fatal_lang_error('event_title_missing', false); |
|
985 | + } elseif (!isset($_POST['evtitle'])) { |
|
986 | + $_POST['evtitle'] = $_POST['subject']; |
|
987 | + } |
|
948 | 988 | |
949 | 989 | // No title? |
950 | - if ($smcFunc['htmltrim']($_POST['evtitle']) === '') |
|
951 | - fatal_lang_error('no_event_title', false); |
|
952 | - if ($smcFunc['strlen']($_POST['evtitle']) > 100) |
|
953 | - $_POST['evtitle'] = $smcFunc['substr']($_POST['evtitle'], 0, 100); |
|
990 | + if ($smcFunc['htmltrim']($_POST['evtitle']) === '') { |
|
991 | + fatal_lang_error('no_event_title', false); |
|
992 | + } |
|
993 | + if ($smcFunc['strlen']($_POST['evtitle']) > 100) { |
|
994 | + $_POST['evtitle'] = $smcFunc['substr']($_POST['evtitle'], 0, 100); |
|
995 | + } |
|
954 | 996 | $_POST['evtitle'] = str_replace(';', '', $_POST['evtitle']); |
955 | 997 | } |
956 | 998 | } |
@@ -977,8 +1019,9 @@ discard block |
||
977 | 1019 | ); |
978 | 1020 | |
979 | 1021 | // No results, return false. |
980 | - if ($smcFunc['db_num_rows'] === 0) |
|
981 | - return false; |
|
1022 | + if ($smcFunc['db_num_rows'] === 0) { |
|
1023 | + return false; |
|
1024 | + } |
|
982 | 1025 | |
983 | 1026 | // Grab the results and return. |
984 | 1027 | list ($poster) = $smcFunc['db_fetch_row']($request); |
@@ -1112,8 +1155,9 @@ discard block |
||
1112 | 1155 | call_integration_hook('integrate_modify_event', array($event_id, &$eventOptions, &$event_columns, &$event_parameters)); |
1113 | 1156 | |
1114 | 1157 | $column_clauses = array(); |
1115 | - foreach ($event_columns as $col => $crit) |
|
1116 | - $column_clauses[] = $col . ' = ' . $crit; |
|
1158 | + foreach ($event_columns as $col => $crit) { |
|
1159 | + $column_clauses[] = $col . ' = ' . $crit; |
|
1160 | + } |
|
1117 | 1161 | |
1118 | 1162 | $smcFunc['db_query']('', ' |
1119 | 1163 | UPDATE {db_prefix}calendar |
@@ -1198,8 +1242,9 @@ discard block |
||
1198 | 1242 | ); |
1199 | 1243 | |
1200 | 1244 | // If nothing returned, we are in poo, poo. |
1201 | - if ($smcFunc['db_num_rows']($request) === 0) |
|
1202 | - return false; |
|
1245 | + if ($smcFunc['db_num_rows']($request) === 0) { |
|
1246 | + return false; |
|
1247 | + } |
|
1203 | 1248 | |
1204 | 1249 | $row = $smcFunc['db_fetch_assoc']($request); |
1205 | 1250 | $smcFunc['db_free_result']($request); |
@@ -1207,8 +1252,9 @@ discard block |
||
1207 | 1252 | list($start, $end, $allday, $span, $tz, $tz_abbrev) = buildEventDatetimes($row); |
1208 | 1253 | |
1209 | 1254 | // Sanity check |
1210 | - if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) |
|
1211 | - return false; |
|
1255 | + if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) { |
|
1256 | + return false; |
|
1257 | + } |
|
1212 | 1258 | |
1213 | 1259 | $return_value = array( |
1214 | 1260 | 'boards' => array(), |
@@ -1345,24 +1391,27 @@ discard block |
||
1345 | 1391 | |
1346 | 1392 | // Set $span, in case we need it |
1347 | 1393 | $span = isset($eventOptions['span']) ? $eventOptions['span'] : (isset($_POST['span']) ? $_POST['span'] : 0); |
1348 | - if ($span > 0) |
|
1349 | - $span = !empty($modSettings['cal_maxspan']) ? min($modSettings['cal_maxspan'], $span - 1) : $span - 1; |
|
1394 | + if ($span > 0) { |
|
1395 | + $span = !empty($modSettings['cal_maxspan']) ? min($modSettings['cal_maxspan'], $span - 1) : $span - 1; |
|
1396 | + } |
|
1350 | 1397 | |
1351 | 1398 | // Define the timezone for this event, falling back to the default if not provided |
1352 | - if (!empty($eventOptions['tz']) && in_array($eventOptions['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) |
|
1353 | - $tz = $eventOptions['tz']; |
|
1354 | - elseif (!empty($_POST['tz']) && in_array($_POST['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) |
|
1355 | - $tz = $_POST['tz']; |
|
1356 | - else |
|
1357 | - $tz = getUserTimezone(); |
|
1399 | + if (!empty($eventOptions['tz']) && in_array($eventOptions['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) { |
|
1400 | + $tz = $eventOptions['tz']; |
|
1401 | + } elseif (!empty($_POST['tz']) && in_array($_POST['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) { |
|
1402 | + $tz = $_POST['tz']; |
|
1403 | + } else { |
|
1404 | + $tz = getUserTimezone(); |
|
1405 | + } |
|
1358 | 1406 | |
1359 | 1407 | // Is this supposed to be an all day event, or should it have specific start and end times? |
1360 | - if (isset($eventOptions['allday'])) |
|
1361 | - $allday = $eventOptions['allday']; |
|
1362 | - elseif (empty($_POST['allday'])) |
|
1363 | - $allday = false; |
|
1364 | - else |
|
1365 | - $allday = true; |
|
1408 | + if (isset($eventOptions['allday'])) { |
|
1409 | + $allday = $eventOptions['allday']; |
|
1410 | + } elseif (empty($_POST['allday'])) { |
|
1411 | + $allday = false; |
|
1412 | + } else { |
|
1413 | + $allday = true; |
|
1414 | + } |
|
1366 | 1415 | |
1367 | 1416 | // Input might come as individual parameters... |
1368 | 1417 | $start_year = isset($eventOptions['year']) ? $eventOptions['year'] : (isset($_POST['year']) ? $_POST['year'] : null); |
@@ -1389,10 +1438,12 @@ discard block |
||
1389 | 1438 | $end_time_string = isset($eventOptions['end_time']) ? $eventOptions['end_time'] : (isset($_POST['end_time']) ? $_POST['end_time'] : null); |
1390 | 1439 | |
1391 | 1440 | // If the date and time were given in separate strings, combine them |
1392 | - if (empty($start_string) && isset($start_date_string)) |
|
1393 | - $start_string = $start_date_string . (isset($start_time_string) ? ' ' . $start_time_string : ''); |
|
1394 | - if (empty($end_string) && isset($end_date_string)) |
|
1395 | - $end_string = $end_date_string . (isset($end_time_string) ? ' ' . $end_time_string : ''); |
|
1441 | + if (empty($start_string) && isset($start_date_string)) { |
|
1442 | + $start_string = $start_date_string . (isset($start_time_string) ? ' ' . $start_time_string : ''); |
|
1443 | + } |
|
1444 | + if (empty($end_string) && isset($end_date_string)) { |
|
1445 | + $end_string = $end_date_string . (isset($end_time_string) ? ' ' . $end_time_string : ''); |
|
1446 | + } |
|
1396 | 1447 | |
1397 | 1448 | // If some form of string input was given, override individually defined options with it |
1398 | 1449 | if (isset($start_string)) |
@@ -1483,10 +1534,11 @@ discard block |
||
1483 | 1534 | if ($start_object >= $end_object) |
1484 | 1535 | { |
1485 | 1536 | $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, $start_hour, $start_minute, $start_second) . ' ' . $tz); |
1486 | - if ($span > 0) |
|
1487 | - date_add($end_object, date_interval_create_from_date_string($span . ' days')); |
|
1488 | - else |
|
1489 | - date_add($end_object, date_interval_create_from_date_string('1 hour')); |
|
1537 | + if ($span > 0) { |
|
1538 | + date_add($end_object, date_interval_create_from_date_string($span . ' days')); |
|
1539 | + } else { |
|
1540 | + date_add($end_object, date_interval_create_from_date_string('1 hour')); |
|
1541 | + } |
|
1490 | 1542 | } |
1491 | 1543 | |
1492 | 1544 | // Is $end_object too late? |
@@ -1499,9 +1551,9 @@ discard block |
||
1499 | 1551 | { |
1500 | 1552 | $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, $start_hour, $start_minute, $start_second) . ' ' . $tz); |
1501 | 1553 | date_add($end_object, date_interval_create_from_date_string($modSettings['cal_maxspan'] . ' days')); |
1554 | + } else { |
|
1555 | + $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, '11', '59', '59') . ' ' . $tz); |
|
1502 | 1556 | } |
1503 | - else |
|
1504 | - $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, '11', '59', '59') . ' ' . $tz); |
|
1505 | 1557 | } |
1506 | 1558 | } |
1507 | 1559 | |
@@ -1514,8 +1566,7 @@ discard block |
||
1514 | 1566 | $start_time = null; |
1515 | 1567 | $end_time = null; |
1516 | 1568 | $tz = null; |
1517 | - } |
|
1518 | - else |
|
1569 | + } else |
|
1519 | 1570 | { |
1520 | 1571 | $start_time = date_format($start_object, 'H:i:s'); |
1521 | 1572 | $end_time = date_format($end_object, 'H:i:s'); |
@@ -1536,16 +1587,18 @@ discard block |
||
1536 | 1587 | require_once($sourcedir . '/Subs.php'); |
1537 | 1588 | |
1538 | 1589 | // First, try to create a better date format, ignoring the "time" elements. |
1539 | - if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
1540 | - $date_format = '%F'; |
|
1541 | - else |
|
1542 | - $date_format = $matches[0]; |
|
1590 | + if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
1591 | + $date_format = '%F'; |
|
1592 | + } else { |
|
1593 | + $date_format = $matches[0]; |
|
1594 | + } |
|
1543 | 1595 | |
1544 | 1596 | // We want a fairly compact version of the time, but as close as possible to the user's settings. |
1545 | - if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
1546 | - $time_format = '%k:%M'; |
|
1547 | - else |
|
1548 | - $time_format = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
|
1597 | + if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
1598 | + $time_format = '%k:%M'; |
|
1599 | + } else { |
|
1600 | + $time_format = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
|
1601 | + } |
|
1549 | 1602 | |
1550 | 1603 | // Should this be an all day event? |
1551 | 1604 | $allday = (empty($row['start_time']) || empty($row['end_time']) || empty($row['timezone']) || !in_array($row['timezone'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) ? true : false; |
@@ -1554,8 +1607,9 @@ discard block |
||
1554 | 1607 | $span = 1 + date_interval_format(date_diff(date_create($row['start_date']), date_create($row['end_date'])), '%d'); |
1555 | 1608 | |
1556 | 1609 | // We need to have a defined timezone in the steps below |
1557 | - if (empty($row['timezone'])) |
|
1558 | - $row['timezone'] = getUserTimezone(); |
|
1610 | + if (empty($row['timezone'])) { |
|
1611 | + $row['timezone'] = getUserTimezone(); |
|
1612 | + } |
|
1559 | 1613 | |
1560 | 1614 | // Get most of the standard date information for the start and end datetimes |
1561 | 1615 | $start = date_parse($row['start_date'] . (!$allday ? ' ' . $row['start_time'] : '')); |
@@ -1607,8 +1661,9 @@ discard block |
||
1607 | 1661 | global $smcFunc, $context, $user_info, $modSettings; |
1608 | 1662 | static $member_cache = array(); |
1609 | 1663 | |
1610 | - if (is_null($id_member) && $user_info['is_guest'] == false) |
|
1611 | - $id_member = $context['user']['id']; |
|
1664 | + if (is_null($id_member) && $user_info['is_guest'] == false) { |
|
1665 | + $id_member = $context['user']['id']; |
|
1666 | + } |
|
1612 | 1667 | |
1613 | 1668 | //check if the cache got the data |
1614 | 1669 | if (isset($id_member) && isset($member_cache[$id_member])) |
@@ -1630,11 +1685,13 @@ discard block |
||
1630 | 1685 | $smcFunc['db_free_result']($request); |
1631 | 1686 | } |
1632 | 1687 | |
1633 | - if (empty($timezone) || !in_array($timezone, timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) |
|
1634 | - $timezone = isset($modSettings['default_timezone']) ? $modSettings['default_timezone'] : date_default_timezone_get(); |
|
1688 | + if (empty($timezone) || !in_array($timezone, timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) { |
|
1689 | + $timezone = isset($modSettings['default_timezone']) ? $modSettings['default_timezone'] : date_default_timezone_get(); |
|
1690 | + } |
|
1635 | 1691 | |
1636 | - if (isset($id_member)) |
|
1637 | - $member_cache[$id_member] = $timezone; |
|
1692 | + if (isset($id_member)) { |
|
1693 | + $member_cache[$id_member] = $timezone; |
|
1694 | + } |
|
1638 | 1695 | |
1639 | 1696 | return $timezone; |
1640 | 1697 | } |
@@ -1663,8 +1720,9 @@ discard block |
||
1663 | 1720 | ) |
1664 | 1721 | ); |
1665 | 1722 | $holidays = array(); |
1666 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1667 | - $holidays[] = $row; |
|
1723 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1724 | + $holidays[] = $row; |
|
1725 | + } |
|
1668 | 1726 | $smcFunc['db_free_result']($request); |
1669 | 1727 | |
1670 | 1728 | return $holidays; |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 3 |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('SMF')) |
|
14 | +if (!defined('SMF')) { |
|
15 | 15 | die('Hacking attempt...'); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * Our Cache API class |
@@ -27,8 +28,9 @@ discard block |
||
27 | 28 | { |
28 | 29 | $supported = function_exists('apcu_fetch') && function_exists('apcu_store'); |
29 | 30 | |
30 | - if ($test) |
|
31 | - return $supported; |
|
31 | + if ($test) { |
|
32 | + return $supported; |
|
33 | + } |
|
32 | 34 | return parent::isSupported() && $supported; |
33 | 35 | } |
34 | 36 | |
@@ -50,10 +52,11 @@ discard block |
||
50 | 52 | $key = $this->prefix . strtr($key, ':/', '-_'); |
51 | 53 | |
52 | 54 | // An extended key is needed to counteract a bug in APC. |
53 | - if ($value === null) |
|
54 | - return apcu_delete($key . 'smf'); |
|
55 | - else |
|
56 | - return apcu_store($key . 'smf', $value, $ttl); |
|
55 | + if ($value === null) { |
|
56 | + return apcu_delete($key . 'smf'); |
|
57 | + } else { |
|
58 | + return apcu_store($key . 'smf', $value, $ttl); |
|
59 | + } |
|
57 | 60 | } |
58 | 61 | |
59 | 62 | /** |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 3 |
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 | * This function allows to move a topic, making sure to ask the moderator |
@@ -32,8 +33,9 @@ discard block |
||
32 | 33 | { |
33 | 34 | global $txt, $board, $topic, $user_info, $context, $language, $scripturl, $smcFunc, $modSettings, $sourcedir; |
34 | 35 | |
35 | - if (empty($topic)) |
|
36 | - fatal_lang_error('no_access', false); |
|
36 | + if (empty($topic)) { |
|
37 | + fatal_lang_error('no_access', false); |
|
38 | + } |
|
37 | 39 | |
38 | 40 | $request = $smcFunc['db_query']('', ' |
39 | 41 | SELECT t.id_member_started, ms.subject, t.approved |
@@ -49,8 +51,9 @@ discard block |
||
49 | 51 | $smcFunc['db_free_result']($request); |
50 | 52 | |
51 | 53 | // Can they see it - if not approved? |
52 | - if ($modSettings['postmod_active'] && !$context['is_approved']) |
|
53 | - isAllowedTo('approve_posts'); |
|
54 | + if ($modSettings['postmod_active'] && !$context['is_approved']) { |
|
55 | + isAllowedTo('approve_posts'); |
|
56 | + } |
|
54 | 57 | |
55 | 58 | // Permission check! |
56 | 59 | // @todo |
@@ -59,9 +62,9 @@ discard block |
||
59 | 62 | if ($id_member_started == $user_info['id']) |
60 | 63 | { |
61 | 64 | isAllowedTo('move_own'); |
65 | + } else { |
|
66 | + isAllowedTo('move_any'); |
|
62 | 67 | } |
63 | - else |
|
64 | - isAllowedTo('move_any'); |
|
65 | 68 | } |
66 | 69 | |
67 | 70 | $context['move_any'] = $user_info['is_admin'] || $modSettings['topic_move_any']; |
@@ -83,11 +86,13 @@ discard block |
||
83 | 86 | 'not_redirection' => true, |
84 | 87 | ); |
85 | 88 | |
86 | - if (!empty($_SESSION['move_to_topic']) && $_SESSION['move_to_topic'] != $board) |
|
87 | - $options['selected_board'] = $_SESSION['move_to_topic']; |
|
89 | + if (!empty($_SESSION['move_to_topic']) && $_SESSION['move_to_topic'] != $board) { |
|
90 | + $options['selected_board'] = $_SESSION['move_to_topic']; |
|
91 | + } |
|
88 | 92 | |
89 | - if (!$context['move_any']) |
|
90 | - $options['included_boards'] = $boards; |
|
93 | + if (!$context['move_any']) { |
|
94 | + $options['included_boards'] = $boards; |
|
95 | + } |
|
91 | 96 | |
92 | 97 | require_once($sourcedir . '/Subs-MessageIndex.php'); |
93 | 98 | $context['categories'] = getBoardList($options); |
@@ -138,12 +143,14 @@ discard block |
||
138 | 143 | global $txt, $topic, $scripturl, $sourcedir, $context; |
139 | 144 | global $board, $language, $user_info, $smcFunc; |
140 | 145 | |
141 | - if (empty($topic)) |
|
142 | - fatal_lang_error('no_access', false); |
|
146 | + if (empty($topic)) { |
|
147 | + fatal_lang_error('no_access', false); |
|
148 | + } |
|
143 | 149 | |
144 | 150 | // You can't choose to have a redirection topic and use an empty reason. |
145 | - if (isset($_POST['postRedirect']) && (!isset($_POST['reason']) || trim($_POST['reason']) == '')) |
|
146 | - fatal_lang_error('movetopic_no_reason', false); |
|
151 | + if (isset($_POST['postRedirect']) && (!isset($_POST['reason']) || trim($_POST['reason']) == '')) { |
|
152 | + fatal_lang_error('movetopic_no_reason', false); |
|
153 | + } |
|
147 | 154 | |
148 | 155 | moveTopicConcurrence(); |
149 | 156 | |
@@ -163,16 +170,18 @@ discard block |
||
163 | 170 | $smcFunc['db_free_result']($request); |
164 | 171 | |
165 | 172 | // Can they see it? |
166 | - if (!$context['is_approved']) |
|
167 | - isAllowedTo('approve_posts'); |
|
173 | + if (!$context['is_approved']) { |
|
174 | + isAllowedTo('approve_posts'); |
|
175 | + } |
|
168 | 176 | |
169 | 177 | // Can they move topics on this board? |
170 | 178 | if (!allowedTo('move_any')) |
171 | 179 | { |
172 | - if ($id_member_started == $user_info['id']) |
|
173 | - isAllowedTo('move_own'); |
|
174 | - else |
|
175 | - isAllowedTo('move_any'); |
|
180 | + if ($id_member_started == $user_info['id']) { |
|
181 | + isAllowedTo('move_own'); |
|
182 | + } else { |
|
183 | + isAllowedTo('move_any'); |
|
184 | + } |
|
176 | 185 | } |
177 | 186 | |
178 | 187 | checkSession(); |
@@ -197,8 +206,9 @@ discard block |
||
197 | 206 | 'blank_redirect' => '', |
198 | 207 | ) |
199 | 208 | ); |
200 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
201 | - fatal_lang_error('no_board'); |
|
209 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
210 | + fatal_lang_error('no_board'); |
|
211 | + } |
|
202 | 212 | list ($pcounter, $board_name, $subject) = $smcFunc['db_fetch_row']($request); |
203 | 213 | $smcFunc['db_free_result']($request); |
204 | 214 | |
@@ -210,8 +220,9 @@ discard block |
||
210 | 220 | { |
211 | 221 | $_POST['custom_subject'] = strtr($smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['custom_subject'])), array("\r" => '', "\n" => '', "\t" => '')); |
212 | 222 | // Keep checking the length. |
213 | - if ($smcFunc['strlen']($_POST['custom_subject']) > 100) |
|
214 | - $_POST['custom_subject'] = $smcFunc['substr']($_POST['custom_subject'], 0, 100); |
|
223 | + if ($smcFunc['strlen']($_POST['custom_subject']) > 100) { |
|
224 | + $_POST['custom_subject'] = $smcFunc['substr']($_POST['custom_subject'], 0, 100); |
|
225 | + } |
|
215 | 226 | |
216 | 227 | // If it's still valid move onwards and upwards. |
217 | 228 | if ($_POST['custom_subject'] != '') |
@@ -221,9 +232,9 @@ discard block |
||
221 | 232 | // Get a response prefix, but in the forum's default language. |
222 | 233 | if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix'))) |
223 | 234 | { |
224 | - if ($language === $user_info['language']) |
|
225 | - $context['response_prefix'] = $txt['response_prefix']; |
|
226 | - else |
|
235 | + if ($language === $user_info['language']) { |
|
236 | + $context['response_prefix'] = $txt['response_prefix']; |
|
237 | + } else |
|
227 | 238 | { |
228 | 239 | loadLanguage('index', $language, false); |
229 | 240 | $context['response_prefix'] = $txt['response_prefix']; |
@@ -263,8 +274,9 @@ discard block |
||
263 | 274 | if (isset($_POST['postRedirect'])) |
264 | 275 | { |
265 | 276 | // Should be in the boardwide language. |
266 | - if ($user_info['language'] != $language) |
|
267 | - loadLanguage('index', $language); |
|
277 | + if ($user_info['language'] != $language) { |
|
278 | + loadLanguage('index', $language); |
|
279 | + } |
|
268 | 280 | |
269 | 281 | $_POST['reason'] = $smcFunc['htmlspecialchars']($_POST['reason'], ENT_QUOTES); |
270 | 282 | preparsecode($_POST['reason']); |
@@ -328,8 +340,9 @@ discard block |
||
328 | 340 | $posters = array(); |
329 | 341 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
330 | 342 | { |
331 | - if (!isset($posters[$row['id_member']])) |
|
332 | - $posters[$row['id_member']] = 0; |
|
343 | + if (!isset($posters[$row['id_member']])) { |
|
344 | + $posters[$row['id_member']] = 0; |
|
345 | + } |
|
333 | 346 | |
334 | 347 | $posters[$row['id_member']]++; |
335 | 348 | } |
@@ -338,11 +351,13 @@ discard block |
||
338 | 351 | foreach ($posters as $id_member => $posts) |
339 | 352 | { |
340 | 353 | // The board we're moving from counted posts, but not to. |
341 | - if (empty($pcounter_from)) |
|
342 | - updateMemberData($id_member, array('posts' => 'posts - ' . $posts)); |
|
354 | + if (empty($pcounter_from)) { |
|
355 | + updateMemberData($id_member, array('posts' => 'posts - ' . $posts)); |
|
356 | + } |
|
343 | 357 | // The reverse: from didn't, to did. |
344 | - else |
|
345 | - updateMemberData($id_member, array('posts' => 'posts + ' . $posts)); |
|
358 | + else { |
|
359 | + updateMemberData($id_member, array('posts' => 'posts + ' . $posts)); |
|
360 | + } |
|
346 | 361 | } |
347 | 362 | } |
348 | 363 | |
@@ -350,17 +365,19 @@ discard block |
||
350 | 365 | moveTopics($topic, $_POST['toboard']); |
351 | 366 | |
352 | 367 | // Log that they moved this topic. |
353 | - if (!allowedTo('move_own') || $id_member_started != $user_info['id']) |
|
354 | - logAction('move', array('topic' => $topic, 'board_from' => $board, 'board_to' => $_POST['toboard'])); |
|
368 | + if (!allowedTo('move_own') || $id_member_started != $user_info['id']) { |
|
369 | + logAction('move', array('topic' => $topic, 'board_from' => $board, 'board_to' => $_POST['toboard'])); |
|
370 | + } |
|
355 | 371 | // Notify people that this topic has been moved? |
356 | 372 | sendNotifications($topic, 'move'); |
357 | 373 | |
358 | 374 | // Why not go back to the original board in case they want to keep moving? |
359 | - if (!isset($_REQUEST['goback'])) |
|
360 | - redirectexit('board=' . $board . '.0'); |
|
361 | - else |
|
362 | - redirectexit('topic=' . $topic . '.0'); |
|
363 | -} |
|
375 | + if (!isset($_REQUEST['goback'])) { |
|
376 | + redirectexit('board=' . $board . '.0'); |
|
377 | + } else { |
|
378 | + redirectexit('topic=' . $topic . '.0'); |
|
379 | + } |
|
380 | + } |
|
364 | 381 | |
365 | 382 | /** |
366 | 383 | * Moves one or more topics to a specific board. (doesn't check permissions.) |
@@ -376,18 +393,21 @@ discard block |
||
376 | 393 | global $sourcedir, $user_info, $modSettings, $smcFunc; |
377 | 394 | |
378 | 395 | // Empty array? |
379 | - if (empty($topics)) |
|
380 | - return; |
|
396 | + if (empty($topics)) { |
|
397 | + return; |
|
398 | + } |
|
381 | 399 | |
382 | 400 | // Only a single topic. |
383 | - if (is_numeric($topics)) |
|
384 | - $topics = array($topics); |
|
401 | + if (is_numeric($topics)) { |
|
402 | + $topics = array($topics); |
|
403 | + } |
|
385 | 404 | |
386 | 405 | $fromBoards = array(); |
387 | 406 | |
388 | 407 | // Destination board empty or equal to 0? |
389 | - if (empty($toBoard)) |
|
390 | - return; |
|
408 | + if (empty($toBoard)) { |
|
409 | + return; |
|
410 | + } |
|
391 | 411 | |
392 | 412 | // Are we moving to the recycle board? |
393 | 413 | $isRecycleDest = !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] == $toBoard; |
@@ -395,8 +415,9 @@ discard block |
||
395 | 415 | // Callback for search APIs to do their thing |
396 | 416 | require_once($sourcedir . '/Search.php'); |
397 | 417 | $searchAPI = findSearchAPI(); |
398 | - if ($searchAPI->supportsMethod('topicsMoved')) |
|
399 | - $searchAPI->topicsMoved($topics, $toBoard); |
|
418 | + if ($searchAPI->supportsMethod('topicsMoved')) { |
|
419 | + $searchAPI->topicsMoved($topics, $toBoard); |
|
420 | + } |
|
400 | 421 | |
401 | 422 | // Determine the source boards... |
402 | 423 | $request = $smcFunc['db_query']('', ' |
@@ -410,8 +431,9 @@ discard block |
||
410 | 431 | ) |
411 | 432 | ); |
412 | 433 | // Num of rows = 0 -> no topics found. Num of rows > 1 -> topics are on multiple boards. |
413 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
414 | - return; |
|
434 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
435 | + return; |
|
436 | + } |
|
415 | 437 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
416 | 438 | { |
417 | 439 | if (!isset($fromBoards[$row['id_board']]['num_posts'])) |
@@ -429,10 +451,11 @@ discard block |
||
429 | 451 | $fromBoards[$row['id_board']]['unapproved_posts'] += $row['unapproved_posts']; |
430 | 452 | |
431 | 453 | // Add the topics to the right type. |
432 | - if ($row['approved']) |
|
433 | - $fromBoards[$row['id_board']]['num_topics'] += $row['num_topics']; |
|
434 | - else |
|
435 | - $fromBoards[$row['id_board']]['unapproved_topics'] += $row['num_topics']; |
|
454 | + if ($row['approved']) { |
|
455 | + $fromBoards[$row['id_board']]['num_topics'] += $row['num_topics']; |
|
456 | + } else { |
|
457 | + $fromBoards[$row['id_board']]['unapproved_topics'] += $row['num_topics']; |
|
458 | + } |
|
436 | 459 | } |
437 | 460 | $smcFunc['db_free_result']($request); |
438 | 461 | |
@@ -558,13 +581,14 @@ discard block |
||
558 | 581 | ) |
559 | 582 | ); |
560 | 583 | $approval_msgs = array(); |
561 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
562 | - $approval_msgs[] = $row['id_msg']; |
|
584 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
585 | + $approval_msgs[] = $row['id_msg']; |
|
586 | + } |
|
563 | 587 | $smcFunc['db_free_result']($request); |
564 | 588 | |
565 | 589 | // Empty the approval queue for these, as we're going to approve them next. |
566 | - if (!empty($approval_msgs)) |
|
567 | - $smcFunc['db_query']('', ' |
|
590 | + if (!empty($approval_msgs)) { |
|
591 | + $smcFunc['db_query']('', ' |
|
568 | 592 | DELETE FROM {db_prefix}approval_queue |
569 | 593 | WHERE id_msg IN ({array_int:message_list}) |
570 | 594 | AND id_attach = {int:id_attach}', |
@@ -573,6 +597,7 @@ discard block |
||
573 | 597 | 'id_attach' => 0, |
574 | 598 | ) |
575 | 599 | ); |
600 | + } |
|
576 | 601 | |
577 | 602 | // Get all the current max and mins. |
578 | 603 | $request = $smcFunc['db_query']('', ' |
@@ -606,8 +631,8 @@ discard block |
||
606 | 631 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
607 | 632 | { |
608 | 633 | // If not, update. |
609 | - if ($row['first_msg'] != $topicMaxMin[$row['id_topic']]['min'] || $row['last_msg'] != $topicMaxMin[$row['id_topic']]['max']) |
|
610 | - $smcFunc['db_query']('', ' |
|
634 | + if ($row['first_msg'] != $topicMaxMin[$row['id_topic']]['min'] || $row['last_msg'] != $topicMaxMin[$row['id_topic']]['max']) { |
|
635 | + $smcFunc['db_query']('', ' |
|
611 | 636 | UPDATE {db_prefix}topics |
612 | 637 | SET id_first_msg = {int:first_msg}, id_last_msg = {int:last_msg} |
613 | 638 | WHERE id_topic = {int:selected_topic}', |
@@ -617,6 +642,7 @@ discard block |
||
617 | 642 | 'selected_topic' => $row['id_topic'], |
618 | 643 | ) |
619 | 644 | ); |
645 | + } |
|
620 | 646 | } |
621 | 647 | $smcFunc['db_free_result']($request); |
622 | 648 | } |
@@ -675,9 +701,10 @@ discard block |
||
675 | 701 | } |
676 | 702 | |
677 | 703 | // Update the cache? |
678 | - if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 3) |
|
679 | - foreach ($topics as $topic_id) |
|
704 | + if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 3) { |
|
705 | + foreach ($topics as $topic_id) |
|
680 | 706 | cache_put_data('topic_board-' . $topic_id, null, 120); |
707 | + } |
|
681 | 708 | |
682 | 709 | require_once($sourcedir . '/Subs-Post.php'); |
683 | 710 | |
@@ -701,15 +728,17 @@ discard block |
||
701 | 728 | { |
702 | 729 | global $board, $topic, $smcFunc, $scripturl; |
703 | 730 | |
704 | - if (isset($_GET['current_board'])) |
|
705 | - $move_from = (int) $_GET['current_board']; |
|
731 | + if (isset($_GET['current_board'])) { |
|
732 | + $move_from = (int) $_GET['current_board']; |
|
733 | + } |
|
706 | 734 | |
707 | - if (empty($move_from) || empty($board) || empty($topic)) |
|
708 | - return true; |
|
735 | + if (empty($move_from) || empty($board) || empty($topic)) { |
|
736 | + return true; |
|
737 | + } |
|
709 | 738 | |
710 | - if ($move_from == $board) |
|
711 | - return true; |
|
712 | - else |
|
739 | + if ($move_from == $board) { |
|
740 | + return true; |
|
741 | + } else |
|
713 | 742 | { |
714 | 743 | $request = $smcFunc['db_query']('', ' |
715 | 744 | SELECT m.subject, b.name |
@@ -64,9 +64,10 @@ discard block |
||
64 | 64 | <strong>', $txt['administrators'], ':</strong> |
65 | 65 | ', implode(', ', $context['administrators']); |
66 | 66 | // If we have lots of admins... don't show them all. |
67 | - if (!empty($context['more_admins_link'])) |
|
68 | - echo ' |
|
67 | + if (!empty($context['more_admins_link'])) { |
|
68 | + echo ' |
|
69 | 69 | (', $context['more_admins_link'], ')'; |
70 | + } |
|
70 | 71 | |
71 | 72 | echo ' |
72 | 73 | </div> |
@@ -83,16 +84,18 @@ discard block |
||
83 | 84 | foreach ($area['areas'] as $item_id => $item) |
84 | 85 | { |
85 | 86 | // No point showing the 'home' page here, we're already on it! |
86 | - if ($area_id == 'forum' && $item_id == 'index') |
|
87 | - continue; |
|
87 | + if ($area_id == 'forum' && $item_id == 'index') { |
|
88 | + continue; |
|
89 | + } |
|
88 | 90 | |
89 | 91 | $url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : ''); |
90 | - if (!empty($item['icon_file'])) |
|
91 | - echo ' |
|
92 | + if (!empty($item['icon_file'])) { |
|
93 | + echo ' |
|
92 | 94 | <a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>'; |
93 | - else |
|
94 | - echo ' |
|
95 | + } else { |
|
96 | + echo ' |
|
95 | 97 | <a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>'; |
98 | + } |
|
96 | 99 | } |
97 | 100 | |
98 | 101 | echo ' |
@@ -103,10 +106,11 @@ discard block |
||
103 | 106 | </div>'; |
104 | 107 | |
105 | 108 | // The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization. |
106 | - if (empty($modSettings['disable_smf_js'])) |
|
107 | - echo ' |
|
109 | + if (empty($modSettings['disable_smf_js'])) { |
|
110 | + echo ' |
|
108 | 111 | <script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script> |
109 | 112 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
113 | + } |
|
110 | 114 | |
111 | 115 | // This sets the announcements and current versions themselves ;). |
112 | 116 | echo ' |
@@ -185,9 +189,10 @@ discard block |
||
185 | 189 | <em>', $version['version'], '</em>'; |
186 | 190 | |
187 | 191 | // more details for this item, show them a link |
188 | - if ($context['can_admin'] && isset($version['more'])) |
|
189 | - echo |
|
192 | + if ($context['can_admin'] && isset($version['more'])) { |
|
193 | + echo |
|
190 | 194 | ' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>'; |
195 | + } |
|
191 | 196 | echo ' |
192 | 197 | <br>'; |
193 | 198 | } |
@@ -218,20 +223,22 @@ discard block |
||
218 | 223 | |
219 | 224 | foreach ($context['credits'] as $section) |
220 | 225 | { |
221 | - if (isset($section['pretext'])) |
|
222 | - echo ' |
|
226 | + if (isset($section['pretext'])) { |
|
227 | + echo ' |
|
223 | 228 | <p>', $section['pretext'], '</p><hr>'; |
229 | + } |
|
224 | 230 | |
225 | 231 | echo ' |
226 | 232 | <dl>'; |
227 | 233 | |
228 | 234 | foreach ($section['groups'] as $group) |
229 | 235 | { |
230 | - if (isset($group['title'])) |
|
231 | - echo ' |
|
236 | + if (isset($group['title'])) { |
|
237 | + echo ' |
|
232 | 238 | <dt> |
233 | 239 | <strong>', $group['title'], ':</strong> |
234 | 240 | </dt>'; |
241 | + } |
|
235 | 242 | |
236 | 243 | echo ' |
237 | 244 | <dd>', implode(', ', $group['members']), '</dd>'; |
@@ -240,10 +247,11 @@ discard block |
||
240 | 247 | echo ' |
241 | 248 | </dl>'; |
242 | 249 | |
243 | - if (isset($section['posttext'])) |
|
244 | - echo ' |
|
250 | + if (isset($section['posttext'])) { |
|
251 | + echo ' |
|
245 | 252 | <hr> |
246 | 253 | <p>', $section['posttext'], '</p>'; |
254 | + } |
|
247 | 255 | } |
248 | 256 | |
249 | 257 | echo ' |
@@ -259,9 +267,10 @@ discard block |
||
259 | 267 | smfSupportVersions.forum = "', $context['forum_version'], '";'; |
260 | 268 | |
261 | 269 | // Don't worry, none of this is logged, it's just used to give information that might be of use. |
262 | - foreach ($context['current_versions'] as $variable => $version) |
|
263 | - echo ' |
|
270 | + foreach ($context['current_versions'] as $variable => $version) { |
|
271 | + echo ' |
|
264 | 272 | smfSupportVersions.', $variable, ' = "', $version['version'], '";'; |
273 | + } |
|
265 | 274 | |
266 | 275 | // Now we just have to include the script and wait ;). |
267 | 276 | echo ' |
@@ -358,8 +367,8 @@ discard block |
||
358 | 367 | <tbody>'; |
359 | 368 | |
360 | 369 | // Loop through every source file displaying its version - using javascript. |
361 | - foreach ($context['file_versions'] as $filename => $version) |
|
362 | - echo ' |
|
370 | + foreach ($context['file_versions'] as $filename => $version) { |
|
371 | + echo ' |
|
363 | 372 | <tr class="windowbg"> |
364 | 373 | <td class="half_table"> |
365 | 374 | ', $filename, ' |
@@ -371,6 +380,7 @@ discard block |
||
371 | 380 | <em id="currentSources', $filename, '">??</em> |
372 | 381 | </td> |
373 | 382 | </tr>'; |
383 | + } |
|
374 | 384 | |
375 | 385 | // Default template files. |
376 | 386 | echo ' |
@@ -396,8 +406,8 @@ discard block |
||
396 | 406 | <table id="Default" class="table_grid"> |
397 | 407 | <tbody>'; |
398 | 408 | |
399 | - foreach ($context['default_template_versions'] as $filename => $version) |
|
400 | - echo ' |
|
409 | + foreach ($context['default_template_versions'] as $filename => $version) { |
|
410 | + echo ' |
|
401 | 411 | <tr class="windowbg"> |
402 | 412 | <td class="half_table"> |
403 | 413 | ', $filename, ' |
@@ -409,6 +419,7 @@ discard block |
||
409 | 419 | <em id="currentDefault', $filename, '">??</em> |
410 | 420 | </td> |
411 | 421 | </tr>'; |
422 | + } |
|
412 | 423 | |
413 | 424 | // Now the language files... |
414 | 425 | echo ' |
@@ -436,8 +447,8 @@ discard block |
||
436 | 447 | |
437 | 448 | foreach ($context['default_language_versions'] as $language => $files) |
438 | 449 | { |
439 | - foreach ($files as $filename => $version) |
|
440 | - echo ' |
|
450 | + foreach ($files as $filename => $version) { |
|
451 | + echo ' |
|
441 | 452 | <tr class="windowbg"> |
442 | 453 | <td class="half_table"> |
443 | 454 | ', $filename, '.<em>', $language, '</em>.php |
@@ -449,6 +460,7 @@ discard block |
||
449 | 460 | <em id="current', $filename, '.', $language, '">??</em> |
450 | 461 | </td> |
451 | 462 | </tr>'; |
463 | + } |
|
452 | 464 | } |
453 | 465 | |
454 | 466 | echo ' |
@@ -478,8 +490,8 @@ discard block |
||
478 | 490 | <table id="Templates" class="table_grid"> |
479 | 491 | <tbody>'; |
480 | 492 | |
481 | - foreach ($context['template_versions'] as $filename => $version) |
|
482 | - echo ' |
|
493 | + foreach ($context['template_versions'] as $filename => $version) { |
|
494 | + echo ' |
|
483 | 495 | <tr class="windowbg"> |
484 | 496 | <td class="half_table"> |
485 | 497 | ', $filename, ' |
@@ -491,6 +503,7 @@ discard block |
||
491 | 503 | <em id="currentTemplates', $filename, '">??</em> |
492 | 504 | </td> |
493 | 505 | </tr>'; |
506 | + } |
|
494 | 507 | |
495 | 508 | echo ' |
496 | 509 | </tbody> |
@@ -520,8 +533,8 @@ discard block |
||
520 | 533 | <table id="Tasks" class="table_grid"> |
521 | 534 | <tbody>'; |
522 | 535 | |
523 | - foreach ($context['tasks_versions'] as $filename => $version) |
|
524 | - echo ' |
|
536 | + foreach ($context['tasks_versions'] as $filename => $version) { |
|
537 | + echo ' |
|
525 | 538 | <tr class="windowbg"> |
526 | 539 | <td class="half_table"> |
527 | 540 | ', $filename, ' |
@@ -533,6 +546,7 @@ discard block |
||
533 | 546 | <em id="currentTasks', $filename, '">??</em> |
534 | 547 | </td> |
535 | 548 | </tr>'; |
549 | + } |
|
536 | 550 | |
537 | 551 | echo ' |
538 | 552 | </tbody> |
@@ -574,9 +588,10 @@ discard block |
||
574 | 588 | { |
575 | 589 | global $context, $scripturl, $txt, $modSettings; |
576 | 590 | |
577 | - if (!empty($context['saved_successful'])) |
|
578 | - echo ' |
|
591 | + if (!empty($context['saved_successful'])) { |
|
592 | + echo ' |
|
579 | 593 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
594 | + } |
|
580 | 595 | |
581 | 596 | // First section is for adding/removing words from the censored list. |
582 | 597 | echo ' |
@@ -591,11 +606,12 @@ discard block |
||
591 | 606 | <p>', $txt['admin_censored_where'], '</p>'; |
592 | 607 | |
593 | 608 | // Show text boxes for censoring [bad ] => [good ]. |
594 | - foreach ($context['censored_words'] as $vulgar => $proper) |
|
595 | - echo ' |
|
609 | + foreach ($context['censored_words'] as $vulgar => $proper) { |
|
610 | + echo ' |
|
596 | 611 | <div class="block"> |
597 | 612 | <input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> => <input type="text" name="censor_proper[]" value="', $proper, '" size="30"> |
598 | 613 | </div>'; |
614 | + } |
|
599 | 615 | |
600 | 616 | // Now provide a way to censor more words. |
601 | 617 | echo ' |
@@ -669,19 +685,21 @@ discard block |
||
669 | 685 | <div class="windowbg2 noup"> |
670 | 686 | ', $txt['not_done_reason']; |
671 | 687 | |
672 | - if (!empty($context['continue_percent'])) |
|
673 | - echo ' |
|
688 | + if (!empty($context['continue_percent'])) { |
|
689 | + echo ' |
|
674 | 690 | <div class="progress_bar"> |
675 | 691 | <div class="full_bar">', $context['continue_percent'], '%</div> |
676 | 692 | <div class="green_percent" style="width: ', $context['continue_percent'], '%;"> </div> |
677 | 693 | </div>'; |
694 | + } |
|
678 | 695 | |
679 | - if (!empty($context['substep_enabled'])) |
|
680 | - echo ' |
|
696 | + if (!empty($context['substep_enabled'])) { |
|
697 | + echo ' |
|
681 | 698 | <div class="progress_bar"> |
682 | 699 | <div class="full_bar">', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</div> |
683 | 700 | <div class="blue_percent" style="width: ', $context['substep_continue_percent'], '%;"> </div> |
684 | 701 | </div>'; |
702 | + } |
|
685 | 703 | |
686 | 704 | echo ' |
687 | 705 | <form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit"> |
@@ -716,35 +734,40 @@ discard block |
||
716 | 734 | { |
717 | 735 | global $context, $txt, $scripturl; |
718 | 736 | |
719 | - if (!empty($context['saved_successful'])) |
|
720 | - echo ' |
|
737 | + if (!empty($context['saved_successful'])) { |
|
738 | + echo ' |
|
721 | 739 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
722 | - elseif (!empty($context['saved_failed'])) |
|
723 | - echo ' |
|
740 | + } elseif (!empty($context['saved_failed'])) { |
|
741 | + echo ' |
|
724 | 742 | <div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>'; |
743 | + } |
|
725 | 744 | |
726 | - if (!empty($context['settings_pre_javascript'])) |
|
727 | - echo ' |
|
745 | + if (!empty($context['settings_pre_javascript'])) { |
|
746 | + echo ' |
|
728 | 747 | <script>', $context['settings_pre_javascript'], '</script>'; |
748 | + } |
|
729 | 749 | |
730 | - if (!empty($context['settings_insert_above'])) |
|
731 | - echo $context['settings_insert_above']; |
|
750 | + if (!empty($context['settings_insert_above'])) { |
|
751 | + echo $context['settings_insert_above']; |
|
752 | + } |
|
732 | 753 | |
733 | 754 | echo ' |
734 | 755 | <div id="admincenter"> |
735 | 756 | <form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>'; |
736 | 757 | |
737 | 758 | // Is there a custom title? |
738 | - if (isset($context['settings_title'])) |
|
739 | - echo ' |
|
759 | + if (isset($context['settings_title'])) { |
|
760 | + echo ' |
|
740 | 761 | <div class="cat_bar"> |
741 | 762 | <h3 class="catbg">', $context['settings_title'], '</h3> |
742 | 763 | </div>'; |
764 | + } |
|
743 | 765 | |
744 | 766 | // Have we got a message to display? |
745 | - if (!empty($context['settings_message'])) |
|
746 | - echo ' |
|
767 | + if (!empty($context['settings_message'])) { |
|
768 | + echo ' |
|
747 | 769 | <div class="information">', $context['settings_message'], '</div>'; |
770 | + } |
|
748 | 771 | |
749 | 772 | // Now actually loop through all the variables. |
750 | 773 | $is_open = false; |
@@ -797,8 +820,9 @@ discard block |
||
797 | 820 | // Hang about? Are you pulling my leg - a callback?! |
798 | 821 | if (is_array($config_var) && $config_var['type'] == 'callback') |
799 | 822 | { |
800 | - if (function_exists('template_callback_' . $config_var['name'])) |
|
801 | - call_user_func('template_callback_' . $config_var['name']); |
|
823 | + if (function_exists('template_callback_' . $config_var['name'])) { |
|
824 | + call_user_func('template_callback_' . $config_var['name']); |
|
825 | + } |
|
802 | 826 | |
803 | 827 | continue; |
804 | 828 | } |
@@ -828,9 +852,10 @@ discard block |
||
828 | 852 | $text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time'); |
829 | 853 | |
830 | 854 | // Show the [?] button. |
831 | - if ($config_var['help']) |
|
832 | - echo ' |
|
855 | + if ($config_var['help']) { |
|
856 | + echo ' |
|
833 | 857 | <a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> '; |
858 | + } |
|
834 | 859 | |
835 | 860 | echo ' |
836 | 861 | <a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span> |
@@ -839,22 +864,25 @@ discard block |
||
839 | 864 | $config_var['preinput']; |
840 | 865 | |
841 | 866 | // Show a check box. |
842 | - if ($config_var['type'] == 'check') |
|
843 | - echo ' |
|
867 | + if ($config_var['type'] == 'check') { |
|
868 | + echo ' |
|
844 | 869 | <input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1" class="input_check">'; |
870 | + } |
|
845 | 871 | // Escape (via htmlspecialchars.) the text box. |
846 | - elseif ($config_var['type'] == 'password') |
|
847 | - echo ' |
|
872 | + elseif ($config_var['type'] == 'password') { |
|
873 | + echo ' |
|
848 | 874 | <input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;" class="input_password"><br> |
849 | 875 | <input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' class="input_password">'; |
876 | + } |
|
850 | 877 | // Show a selection box. |
851 | 878 | elseif ($config_var['type'] == 'select') |
852 | 879 | { |
853 | 880 | echo ' |
854 | 881 | <select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
855 | - foreach ($config_var['data'] as $option) |
|
856 | - echo ' |
|
882 | + foreach ($config_var['data'] as $option) { |
|
883 | + echo ' |
|
857 | 884 | <option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>'; |
885 | + } |
|
858 | 886 | echo ' |
859 | 887 | </select>'; |
860 | 888 | } |
@@ -868,15 +896,17 @@ discard block |
||
868 | 896 | <legend class="board_selector"><a href="#">', $txt['select_boards_from_list'], '</a></legend>'; |
869 | 897 | foreach ($context['board_list'] as $id_cat => $cat) |
870 | 898 | { |
871 | - if (!$first) |
|
872 | - echo ' |
|
899 | + if (!$first) { |
|
900 | + echo ' |
|
873 | 901 | <hr>'; |
902 | + } |
|
874 | 903 | echo ' |
875 | 904 | <strong>', $cat['name'], '</strong> |
876 | 905 | <ul>'; |
877 | - foreach ($cat['boards'] as $id_board => $brd) |
|
878 | - echo ' |
|
906 | + foreach ($cat['boards'] as $id_board => $brd) { |
|
907 | + echo ' |
|
879 | 908 | <li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1" class="input_check"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat(' ', $brd['child_level']) : '', $brd['name'], '</label></li>'; |
909 | + } |
|
880 | 910 | |
881 | 911 | echo ' |
882 | 912 | </ul>'; |
@@ -886,12 +916,14 @@ discard block |
||
886 | 916 | </fieldset>'; |
887 | 917 | } |
888 | 918 | // Text area? |
889 | - elseif ($config_var['type'] == 'large_text') |
|
890 | - echo ' |
|
919 | + elseif ($config_var['type'] == 'large_text') { |
|
920 | + echo ' |
|
891 | 921 | <textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>'; |
922 | + } |
|
892 | 923 | // Permission group? |
893 | - elseif ($config_var['type'] == 'permissions') |
|
894 | - theme_inline_permissions($config_var['name']); |
|
924 | + elseif ($config_var['type'] == 'permissions') { |
|
925 | + theme_inline_permissions($config_var['name']); |
|
926 | + } |
|
895 | 927 | // BBC selection? |
896 | 928 | elseif ($config_var['type'] == 'bbc') |
897 | 929 | { |
@@ -902,20 +934,22 @@ discard block |
||
902 | 934 | |
903 | 935 | foreach ($context['bbc_columns'] as $bbcColumn) |
904 | 936 | { |
905 | - foreach ($bbcColumn as $bbcTag) |
|
906 | - echo ' |
|
937 | + foreach ($bbcColumn as $bbcTag) { |
|
938 | + echo ' |
|
907 | 939 | <li class="list_bbc floatleft"> |
908 | 940 | <input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', ' class="input_check"> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', ' |
909 | 941 | </li>'; |
942 | + } |
|
910 | 943 | } |
911 | 944 | echo ' </ul> |
912 | 945 | <input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', ' class="input_check"> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label> |
913 | 946 | </fieldset>'; |
914 | 947 | } |
915 | 948 | // A simple message? |
916 | - elseif ($config_var['type'] == 'var_message') |
|
917 | - echo ' |
|
949 | + elseif ($config_var['type'] == 'var_message') { |
|
950 | + echo ' |
|
918 | 951 | <div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>', $config_var['var_message'], '</div>'; |
952 | + } |
|
919 | 953 | // Assume it must be a text box |
920 | 954 | else |
921 | 955 | { |
@@ -940,63 +974,70 @@ discard block |
||
940 | 974 | ' . $config_var['postinput'] : '', |
941 | 975 | '</dd>'; |
942 | 976 | } |
943 | - } |
|
944 | - |
|
945 | - else |
|
977 | + } else |
|
946 | 978 | { |
947 | 979 | // Just show a separator. |
948 | - if ($config_var == '') |
|
949 | - echo ' |
|
980 | + if ($config_var == '') { |
|
981 | + echo ' |
|
950 | 982 | </dl> |
951 | 983 | <hr> |
952 | 984 | <dl class="settings">'; |
953 | - else |
|
954 | - echo ' |
|
985 | + } else { |
|
986 | + echo ' |
|
955 | 987 | <dd> |
956 | 988 | <strong>' . $config_var . '</strong> |
957 | 989 | </dd>'; |
990 | + } |
|
958 | 991 | } |
959 | 992 | } |
960 | 993 | |
961 | - if ($is_open) |
|
962 | - echo ' |
|
994 | + if ($is_open) { |
|
995 | + echo ' |
|
963 | 996 | </dl>'; |
997 | + } |
|
964 | 998 | |
965 | - if (empty($context['settings_save_dont_show'])) |
|
966 | - echo ' |
|
999 | + if (empty($context['settings_save_dont_show'])) { |
|
1000 | + echo ' |
|
967 | 1001 | <input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button_submit">'; |
1002 | + } |
|
968 | 1003 | |
969 | - if ($is_open) |
|
970 | - echo ' |
|
1004 | + if ($is_open) { |
|
1005 | + echo ' |
|
971 | 1006 | </div>'; |
1007 | + } |
|
972 | 1008 | |
973 | 1009 | |
974 | 1010 | // At least one token has to be used! |
975 | - if (isset($context['admin-ssc_token'])) |
|
976 | - echo ' |
|
1011 | + if (isset($context['admin-ssc_token'])) { |
|
1012 | + echo ' |
|
977 | 1013 | <input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">'; |
1014 | + } |
|
978 | 1015 | |
979 | - if (isset($context['admin-dbsc_token'])) |
|
980 | - echo ' |
|
1016 | + if (isset($context['admin-dbsc_token'])) { |
|
1017 | + echo ' |
|
981 | 1018 | <input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">'; |
1019 | + } |
|
982 | 1020 | |
983 | - if (isset($context['admin-mp_token'])) |
|
984 | - echo ' |
|
1021 | + if (isset($context['admin-mp_token'])) { |
|
1022 | + echo ' |
|
985 | 1023 | <input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">'; |
1024 | + } |
|
986 | 1025 | |
987 | 1026 | echo ' |
988 | 1027 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
989 | 1028 | </form> |
990 | 1029 | </div>'; |
991 | 1030 | |
992 | - if (!empty($context['settings_post_javascript'])) |
|
993 | - echo ' |
|
1031 | + if (!empty($context['settings_post_javascript'])) { |
|
1032 | + echo ' |
|
994 | 1033 | <script> |
995 | 1034 | ', $context['settings_post_javascript'], ' |
996 | 1035 | </script>'; |
1036 | + } |
|
997 | 1037 | |
998 | - if (!empty($context['settings_insert_below'])) |
|
999 | - echo $context['settings_insert_below']; |
|
1038 | + if (!empty($context['settings_insert_below'])) { |
|
1039 | + echo $context['settings_insert_below']; |
|
1040 | + } |
|
1000 | 1041 | |
1001 | 1042 | // We may have added a board listing. If we did, we need to make it work. |
1002 | 1043 | addInlineJavascript(' |
@@ -1019,9 +1060,10 @@ discard block |
||
1019 | 1060 | { |
1020 | 1061 | global $context, $txt; |
1021 | 1062 | |
1022 | - if (!empty($context['saved_successful'])) |
|
1023 | - echo ' |
|
1063 | + if (!empty($context['saved_successful'])) { |
|
1064 | + echo ' |
|
1024 | 1065 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
1066 | + } |
|
1025 | 1067 | |
1026 | 1068 | // Standard fields. |
1027 | 1069 | template_show_list('standard_profile_fields'); |
@@ -1053,11 +1095,12 @@ discard block |
||
1053 | 1095 | if (isset($_GET['msg'])) |
1054 | 1096 | { |
1055 | 1097 | loadLanguage('Errors'); |
1056 | - if (isset($txt['custom_option_' . $_GET['msg']])) |
|
1057 | - echo ' |
|
1098 | + if (isset($txt['custom_option_' . $_GET['msg']])) { |
|
1099 | + echo ' |
|
1058 | 1100 | <div class="errorbox">', |
1059 | 1101 | $txt['custom_option_' . $_GET['msg']], ' |
1060 | 1102 | </div>'; |
1103 | + } |
|
1061 | 1104 | } |
1062 | 1105 | |
1063 | 1106 | echo ' |
@@ -1123,9 +1166,10 @@ discard block |
||
1123 | 1166 | <dd> |
1124 | 1167 | <select name="placement" id="placement">'; |
1125 | 1168 | |
1126 | - foreach ($context['cust_profile_fields_placement'] as $order => $name) |
|
1127 | - echo ' |
|
1169 | + foreach ($context['cust_profile_fields_placement'] as $order => $name) { |
|
1170 | + echo ' |
|
1128 | 1171 | <option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>'; |
1172 | + } |
|
1129 | 1173 | |
1130 | 1174 | echo ' |
1131 | 1175 | </select> |
@@ -1148,9 +1192,10 @@ discard block |
||
1148 | 1192 | </dt> |
1149 | 1193 | <dd> |
1150 | 1194 | <select name="field_type" id="field_type" onchange="updateInputBoxes();">'; |
1151 | - foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) |
|
1152 | - echo ' |
|
1195 | + foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) { |
|
1196 | + echo ' |
|
1153 | 1197 | <option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>'; |
1198 | + } |
|
1154 | 1199 | |
1155 | 1200 | echo ' |
1156 | 1201 | </select> |
@@ -1251,9 +1296,10 @@ discard block |
||
1251 | 1296 | </fieldset> |
1252 | 1297 | <input type="submit" name="save" value="', $txt['save'], '" class="button_submit">'; |
1253 | 1298 | |
1254 | - if ($context['fid']) |
|
1255 | - echo ' |
|
1299 | + if ($context['fid']) { |
|
1300 | + echo ' |
|
1256 | 1301 | <input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button_submit you_sure">'; |
1302 | + } |
|
1257 | 1303 | |
1258 | 1304 | echo ' |
1259 | 1305 | </div> |
@@ -1296,8 +1342,7 @@ discard block |
||
1296 | 1342 | { |
1297 | 1343 | echo ' |
1298 | 1344 | <p class="centertext"><strong>', $txt['admin_search_results_none'], '</strong></p>'; |
1299 | - } |
|
1300 | - else |
|
1345 | + } else |
|
1301 | 1346 | { |
1302 | 1347 | echo ' |
1303 | 1348 | <ol class="search_results">'; |
@@ -1323,9 +1368,10 @@ discard block |
||
1323 | 1368 | <li> |
1324 | 1369 | <a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']'; |
1325 | 1370 | |
1326 | - if ($result['help']) |
|
1327 | - echo ' |
|
1371 | + if ($result['help']) { |
|
1372 | + echo ' |
|
1328 | 1373 | <p class="double_height">', $result['help'], '</p>'; |
1374 | + } |
|
1329 | 1375 | |
1330 | 1376 | echo ' |
1331 | 1377 | </li>'; |
@@ -1365,18 +1411,20 @@ discard block |
||
1365 | 1411 | <strong>', $txt['setup_verification_answer'], '</strong> |
1366 | 1412 | </dd>'; |
1367 | 1413 | |
1368 | - if (!empty($context['qa_by_lang'][$lang_id])) |
|
1369 | - foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1414 | + if (!empty($context['qa_by_lang'][$lang_id])) { |
|
1415 | + foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1370 | 1416 | { |
1371 | 1417 | $question = $context['question_answers'][$q_id]; |
1418 | + } |
|
1372 | 1419 | echo ' |
1373 | 1420 | <dt> |
1374 | 1421 | <input type="text" name="question[', $lang_id, '][', $q_id, ']" value="', $question['question'], '" size="50" class="input_text verification_question"> |
1375 | 1422 | </dt> |
1376 | 1423 | <dd>'; |
1377 | - foreach ($question['answers'] as $answer) |
|
1378 | - echo ' |
|
1424 | + foreach ($question['answers'] as $answer) { |
|
1425 | + echo ' |
|
1379 | 1426 | <input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="input_text verification_answer">'; |
1427 | + } |
|
1380 | 1428 | |
1381 | 1429 | echo ' |
1382 | 1430 | <div class="qa_add_answer"><a href="javascript:void(0);" onclick="return addAnswer(this);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div> |
@@ -1415,11 +1463,12 @@ discard block |
||
1415 | 1463 | ', $txt['errors_found'], ': |
1416 | 1464 | <ul>'; |
1417 | 1465 | |
1418 | - foreach ($context['repair_errors'] as $error) |
|
1419 | - echo ' |
|
1466 | + foreach ($context['repair_errors'] as $error) { |
|
1467 | + echo ' |
|
1420 | 1468 | <li> |
1421 | 1469 | ', $error, ' |
1422 | 1470 | </li>'; |
1471 | + } |
|
1423 | 1472 | |
1424 | 1473 | echo ' |
1425 | 1474 | </ul> |
@@ -1429,16 +1478,15 @@ discard block |
||
1429 | 1478 | <p class="padding"> |
1430 | 1479 | <strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong> |
1431 | 1480 | </p>'; |
1432 | - } |
|
1433 | - else |
|
1434 | - echo ' |
|
1481 | + } else { |
|
1482 | + echo ' |
|
1435 | 1483 | <p>', $txt['maintain_no_errors'], '</p> |
1436 | 1484 | <p class="padding"> |
1437 | 1485 | <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a> |
1438 | 1486 | </p>'; |
1487 | + } |
|
1439 | 1488 | |
1440 | - } |
|
1441 | - else |
|
1489 | + } else |
|
1442 | 1490 | { |
1443 | 1491 | if (!empty($context['redirect_to_recount'])) |
1444 | 1492 | { |
@@ -1450,8 +1498,7 @@ discard block |
||
1450 | 1498 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1451 | 1499 | <input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '"> |
1452 | 1500 | </form>'; |
1453 | - } |
|
1454 | - else |
|
1501 | + } else |
|
1455 | 1502 | { |
1456 | 1503 | echo ' |
1457 | 1504 | <p>', $txt['errors_fixed'], '</p> |
@@ -1603,8 +1650,8 @@ discard block |
||
1603 | 1650 | function template_admin_quick_search() |
1604 | 1651 | { |
1605 | 1652 | global $context, $txt; |
1606 | - if ($context['user']['is_admin']) |
|
1607 | - echo ' |
|
1653 | + if ($context['user']['is_admin']) { |
|
1654 | + echo ' |
|
1608 | 1655 | <span class="floatright admin_search"> |
1609 | 1656 | <span class="generic_icons filter centericon"></span> |
1610 | 1657 | <input type="search" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';" class="input_text"> |
@@ -1615,6 +1662,7 @@ discard block |
||
1615 | 1662 | </select> |
1616 | 1663 | <input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button_submit"> |
1617 | 1664 | </span>'; |
1618 | -} |
|
1665 | + } |
|
1666 | + } |
|
1619 | 1667 | |
1620 | 1668 | ?> |
1621 | 1669 | \ No newline at end of file |