@@ -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 | { |
@@ -792,8 +813,9 @@ discard block |
||
| 792 | 813 | // Holidays between now and now + days. |
| 793 | 814 | for ($i = $now; $i < $now + $days_for_index; $i += 86400) |
| 794 | 815 | { |
| 795 | - if (isset($cached_data['holidays'][strftime('%Y-%m-%d', $i)])) |
|
| 796 | - $return_data['calendar_holidays'] = array_merge($return_data['calendar_holidays'], $cached_data['holidays'][strftime('%Y-%m-%d', $i)]); |
|
| 816 | + if (isset($cached_data['holidays'][strftime('%Y-%m-%d', $i)])) { |
|
| 817 | + $return_data['calendar_holidays'] = array_merge($return_data['calendar_holidays'], $cached_data['holidays'][strftime('%Y-%m-%d', $i)]); |
|
| 818 | + } |
|
| 797 | 819 | } |
| 798 | 820 | |
| 799 | 821 | // Happy Birthday, guys and gals! |
@@ -802,8 +824,9 @@ discard block |
||
| 802 | 824 | $loop_date = strftime('%Y-%m-%d', $i); |
| 803 | 825 | if (isset($cached_data['birthdays'][$loop_date])) |
| 804 | 826 | { |
| 805 | - foreach ($cached_data['birthdays'][$loop_date] as $index => $dummy) |
|
| 806 | - $cached_data['birthdays'][strftime('%Y-%m-%d', $i)][$index]['is_today'] = $loop_date === $today['date']; |
|
| 827 | + foreach ($cached_data['birthdays'][$loop_date] as $index => $dummy) { |
|
| 828 | + $cached_data['birthdays'][strftime('%Y-%m-%d', $i)][$index]['is_today'] = $loop_date === $today['date']; |
|
| 829 | + } |
|
| 807 | 830 | $return_data['calendar_birthdays'] = array_merge($return_data['calendar_birthdays'], $cached_data['birthdays'][$loop_date]); |
| 808 | 831 | } |
| 809 | 832 | } |
@@ -815,8 +838,9 @@ discard block |
||
| 815 | 838 | $loop_date = strftime('%Y-%m-%d', $i); |
| 816 | 839 | |
| 817 | 840 | // No events today? Check the next day. |
| 818 | - if (empty($cached_data['events'][$loop_date])) |
|
| 819 | - continue; |
|
| 841 | + if (empty($cached_data['events'][$loop_date])) { |
|
| 842 | + continue; |
|
| 843 | + } |
|
| 820 | 844 | |
| 821 | 845 | // Loop through all events to add a few last-minute values. |
| 822 | 846 | foreach ($cached_data['events'][$loop_date] as $ev => $event) |
@@ -829,9 +853,9 @@ discard block |
||
| 829 | 853 | { |
| 830 | 854 | unset($cached_data['events'][$loop_date][$ev]); |
| 831 | 855 | continue; |
| 856 | + } else { |
|
| 857 | + $duplicates[$this_event['topic'] . $this_event['title']] = true; |
|
| 832 | 858 | } |
| 833 | - else |
|
| 834 | - $duplicates[$this_event['topic'] . $this_event['title']] = true; |
|
| 835 | 859 | |
| 836 | 860 | // Might be set to true afterwards, depending on the permissions. |
| 837 | 861 | $this_event['can_edit'] = false; |
@@ -839,15 +863,18 @@ discard block |
||
| 839 | 863 | $this_event['date'] = $loop_date; |
| 840 | 864 | } |
| 841 | 865 | |
| 842 | - if (!empty($cached_data['events'][$loop_date])) |
|
| 843 | - $return_data['calendar_events'] = array_merge($return_data['calendar_events'], $cached_data['events'][$loop_date]); |
|
| 866 | + if (!empty($cached_data['events'][$loop_date])) { |
|
| 867 | + $return_data['calendar_events'] = array_merge($return_data['calendar_events'], $cached_data['events'][$loop_date]); |
|
| 868 | + } |
|
| 844 | 869 | } |
| 845 | 870 | |
| 846 | 871 | // Mark the last item so that a list separator can be used in the template. |
| 847 | - for ($i = 0, $n = count($return_data['calendar_birthdays']); $i < $n; $i++) |
|
| 848 | - $return_data['calendar_birthdays'][$i]['is_last'] = !isset($return_data['calendar_birthdays'][$i + 1]); |
|
| 849 | - for ($i = 0, $n = count($return_data['calendar_events']); $i < $n; $i++) |
|
| 850 | - $return_data['calendar_events'][$i]['is_last'] = !isset($return_data['calendar_events'][$i + 1]); |
|
| 872 | + for ($i = 0, $n = count($return_data['calendar_birthdays']); $i < $n; $i++) { |
|
| 873 | + $return_data['calendar_birthdays'][$i]['is_last'] = !isset($return_data['calendar_birthdays'][$i + 1]); |
|
| 874 | + } |
|
| 875 | + for ($i = 0, $n = count($return_data['calendar_events']); $i < $n; $i++) { |
|
| 876 | + $return_data['calendar_events'][$i]['is_last'] = !isset($return_data['calendar_events'][$i + 1]); |
|
| 877 | + } |
|
| 851 | 878 | |
| 852 | 879 | return array( |
| 853 | 880 | 'data' => $return_data, |
@@ -895,37 +922,46 @@ discard block |
||
| 895 | 922 | if (isset($_POST['start_date'])) |
| 896 | 923 | { |
| 897 | 924 | $d = date_parse($_POST['start_date']); |
| 898 | - if (!empty($d['error_count']) || !empty($d['warning_count'])) |
|
| 899 | - fatal_lang_error('invalid_date', false); |
|
| 900 | - if (empty($d['year'])) |
|
| 901 | - fatal_lang_error('event_year_missing', false); |
|
| 902 | - if (empty($d['month'])) |
|
| 903 | - fatal_lang_error('event_month_missing', false); |
|
| 904 | - } |
|
| 905 | - elseif (isset($_POST['start_datetime'])) |
|
| 925 | + if (!empty($d['error_count']) || !empty($d['warning_count'])) { |
|
| 926 | + fatal_lang_error('invalid_date', false); |
|
| 927 | + } |
|
| 928 | + if (empty($d['year'])) { |
|
| 929 | + fatal_lang_error('event_year_missing', false); |
|
| 930 | + } |
|
| 931 | + if (empty($d['month'])) { |
|
| 932 | + fatal_lang_error('event_month_missing', false); |
|
| 933 | + } |
|
| 934 | + } elseif (isset($_POST['start_datetime'])) |
|
| 906 | 935 | { |
| 907 | 936 | $d = date_parse($_POST['start_datetime']); |
| 908 | - if (!empty($d['error_count']) || !empty($d['warning_count'])) |
|
| 909 | - fatal_lang_error('invalid_date', false); |
|
| 910 | - if (empty($d['year'])) |
|
| 911 | - fatal_lang_error('event_year_missing', false); |
|
| 912 | - if (empty($d['month'])) |
|
| 913 | - fatal_lang_error('event_month_missing', false); |
|
| 937 | + if (!empty($d['error_count']) || !empty($d['warning_count'])) { |
|
| 938 | + fatal_lang_error('invalid_date', false); |
|
| 939 | + } |
|
| 940 | + if (empty($d['year'])) { |
|
| 941 | + fatal_lang_error('event_year_missing', false); |
|
| 942 | + } |
|
| 943 | + if (empty($d['month'])) { |
|
| 944 | + fatal_lang_error('event_month_missing', false); |
|
| 945 | + } |
|
| 914 | 946 | } |
| 915 | 947 | // The 2.0 way |
| 916 | 948 | else |
| 917 | 949 | { |
| 918 | 950 | // No month? No year? |
| 919 | - if (!isset($_POST['month'])) |
|
| 920 | - fatal_lang_error('event_month_missing', false); |
|
| 921 | - if (!isset($_POST['year'])) |
|
| 922 | - fatal_lang_error('event_year_missing', false); |
|
| 951 | + if (!isset($_POST['month'])) { |
|
| 952 | + fatal_lang_error('event_month_missing', false); |
|
| 953 | + } |
|
| 954 | + if (!isset($_POST['year'])) { |
|
| 955 | + fatal_lang_error('event_year_missing', false); |
|
| 956 | + } |
|
| 923 | 957 | |
| 924 | 958 | // Check the month and year... |
| 925 | - if ($_POST['month'] < 1 || $_POST['month'] > 12) |
|
| 926 | - fatal_lang_error('invalid_month', false); |
|
| 927 | - if ($_POST['year'] < $modSettings['cal_minyear'] || $_POST['year'] > $modSettings['cal_maxyear']) |
|
| 928 | - fatal_lang_error('invalid_year', false); |
|
| 959 | + if ($_POST['month'] < 1 || $_POST['month'] > 12) { |
|
| 960 | + fatal_lang_error('invalid_month', false); |
|
| 961 | + } |
|
| 962 | + if ($_POST['year'] < $modSettings['cal_minyear'] || $_POST['year'] > $modSettings['cal_maxyear']) { |
|
| 963 | + fatal_lang_error('invalid_year', false); |
|
| 964 | + } |
|
| 929 | 965 | } |
| 930 | 966 | } |
| 931 | 967 | |
@@ -935,8 +971,9 @@ discard block |
||
| 935 | 971 | // If they want to us to calculate an end date, make sure it will fit in an acceptable range. |
| 936 | 972 | if (isset($_POST['span'])) |
| 937 | 973 | { |
| 938 | - if (($_POST['span'] < 1) || (!empty($modSettings['cal_maxspan']) && $_POST['span'] > $modSettings['cal_maxspan'])) |
|
| 939 | - fatal_lang_error('invalid_days_numb', false); |
|
| 974 | + if (($_POST['span'] < 1) || (!empty($modSettings['cal_maxspan']) && $_POST['span'] > $modSettings['cal_maxspan'])) { |
|
| 975 | + fatal_lang_error('invalid_days_numb', false); |
|
| 976 | + } |
|
| 940 | 977 | } |
| 941 | 978 | |
| 942 | 979 | // There is no need to validate the following values if we are just deleting the event. |
@@ -946,24 +983,29 @@ discard block |
||
| 946 | 983 | if (empty($_POST['start_date']) && empty($_POST['start_datetime'])) |
| 947 | 984 | { |
| 948 | 985 | // No day? |
| 949 | - if (!isset($_POST['day'])) |
|
| 950 | - fatal_lang_error('event_day_missing', false); |
|
| 986 | + if (!isset($_POST['day'])) { |
|
| 987 | + fatal_lang_error('event_day_missing', false); |
|
| 988 | + } |
|
| 951 | 989 | |
| 952 | 990 | // Bad day? |
| 953 | - if (!checkdate($_POST['month'], $_POST['day'], $_POST['year'])) |
|
| 954 | - fatal_lang_error('invalid_date', false); |
|
| 991 | + if (!checkdate($_POST['month'], $_POST['day'], $_POST['year'])) { |
|
| 992 | + fatal_lang_error('invalid_date', false); |
|
| 993 | + } |
|
| 955 | 994 | } |
| 956 | 995 | |
| 957 | - if (!isset($_POST['evtitle']) && !isset($_POST['subject'])) |
|
| 958 | - fatal_lang_error('event_title_missing', false); |
|
| 959 | - elseif (!isset($_POST['evtitle'])) |
|
| 960 | - $_POST['evtitle'] = $_POST['subject']; |
|
| 996 | + if (!isset($_POST['evtitle']) && !isset($_POST['subject'])) { |
|
| 997 | + fatal_lang_error('event_title_missing', false); |
|
| 998 | + } elseif (!isset($_POST['evtitle'])) { |
|
| 999 | + $_POST['evtitle'] = $_POST['subject']; |
|
| 1000 | + } |
|
| 961 | 1001 | |
| 962 | 1002 | // No title? |
| 963 | - if ($smcFunc['htmltrim']($_POST['evtitle']) === '') |
|
| 964 | - fatal_lang_error('no_event_title', false); |
|
| 965 | - if ($smcFunc['strlen']($_POST['evtitle']) > 100) |
|
| 966 | - $_POST['evtitle'] = $smcFunc['substr']($_POST['evtitle'], 0, 100); |
|
| 1003 | + if ($smcFunc['htmltrim']($_POST['evtitle']) === '') { |
|
| 1004 | + fatal_lang_error('no_event_title', false); |
|
| 1005 | + } |
|
| 1006 | + if ($smcFunc['strlen']($_POST['evtitle']) > 100) { |
|
| 1007 | + $_POST['evtitle'] = $smcFunc['substr']($_POST['evtitle'], 0, 100); |
|
| 1008 | + } |
|
| 967 | 1009 | $_POST['evtitle'] = str_replace(';', '', $_POST['evtitle']); |
| 968 | 1010 | } |
| 969 | 1011 | } |
@@ -990,8 +1032,9 @@ discard block |
||
| 990 | 1032 | ); |
| 991 | 1033 | |
| 992 | 1034 | // No results, return false. |
| 993 | - if ($smcFunc['db_num_rows'] === 0) |
|
| 994 | - return false; |
|
| 1035 | + if ($smcFunc['db_num_rows'] === 0) { |
|
| 1036 | + return false; |
|
| 1037 | + } |
|
| 995 | 1038 | |
| 996 | 1039 | // Grab the results and return. |
| 997 | 1040 | list ($poster) = $smcFunc['db_fetch_row']($request); |
@@ -1125,8 +1168,9 @@ discard block |
||
| 1125 | 1168 | call_integration_hook('integrate_modify_event', array($event_id, &$eventOptions, &$event_columns, &$event_parameters)); |
| 1126 | 1169 | |
| 1127 | 1170 | $column_clauses = array(); |
| 1128 | - foreach ($event_columns as $col => $crit) |
|
| 1129 | - $column_clauses[] = $col . ' = ' . $crit; |
|
| 1171 | + foreach ($event_columns as $col => $crit) { |
|
| 1172 | + $column_clauses[] = $col . ' = ' . $crit; |
|
| 1173 | + } |
|
| 1130 | 1174 | |
| 1131 | 1175 | $smcFunc['db_query']('', ' |
| 1132 | 1176 | UPDATE {db_prefix}calendar |
@@ -1211,8 +1255,9 @@ discard block |
||
| 1211 | 1255 | ); |
| 1212 | 1256 | |
| 1213 | 1257 | // If nothing returned, we are in poo, poo. |
| 1214 | - if ($smcFunc['db_num_rows']($request) === 0) |
|
| 1215 | - return false; |
|
| 1258 | + if ($smcFunc['db_num_rows']($request) === 0) { |
|
| 1259 | + return false; |
|
| 1260 | + } |
|
| 1216 | 1261 | |
| 1217 | 1262 | $row = $smcFunc['db_fetch_assoc']($request); |
| 1218 | 1263 | $smcFunc['db_free_result']($request); |
@@ -1220,8 +1265,9 @@ discard block |
||
| 1220 | 1265 | list($start, $end, $allday, $span, $tz, $tz_abbrev) = buildEventDatetimes($row); |
| 1221 | 1266 | |
| 1222 | 1267 | // Sanity check |
| 1223 | - if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) |
|
| 1224 | - return false; |
|
| 1268 | + if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) { |
|
| 1269 | + return false; |
|
| 1270 | + } |
|
| 1225 | 1271 | |
| 1226 | 1272 | $return_value = array( |
| 1227 | 1273 | 'boards' => array(), |
@@ -1358,24 +1404,27 @@ discard block |
||
| 1358 | 1404 | |
| 1359 | 1405 | // Set $span, in case we need it |
| 1360 | 1406 | $span = isset($eventOptions['span']) ? $eventOptions['span'] : (isset($_POST['span']) ? $_POST['span'] : 0); |
| 1361 | - if ($span > 0) |
|
| 1362 | - $span = !empty($modSettings['cal_maxspan']) ? min($modSettings['cal_maxspan'], $span - 1) : $span - 1; |
|
| 1407 | + if ($span > 0) { |
|
| 1408 | + $span = !empty($modSettings['cal_maxspan']) ? min($modSettings['cal_maxspan'], $span - 1) : $span - 1; |
|
| 1409 | + } |
|
| 1363 | 1410 | |
| 1364 | 1411 | // Define the timezone for this event, falling back to the default if not provided |
| 1365 | - if (!empty($eventOptions['tz']) && in_array($eventOptions['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) |
|
| 1366 | - $tz = $eventOptions['tz']; |
|
| 1367 | - elseif (!empty($_POST['tz']) && in_array($_POST['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) |
|
| 1368 | - $tz = $_POST['tz']; |
|
| 1369 | - else |
|
| 1370 | - $tz = getUserTimezone(); |
|
| 1412 | + if (!empty($eventOptions['tz']) && in_array($eventOptions['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) { |
|
| 1413 | + $tz = $eventOptions['tz']; |
|
| 1414 | + } elseif (!empty($_POST['tz']) && in_array($_POST['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) { |
|
| 1415 | + $tz = $_POST['tz']; |
|
| 1416 | + } else { |
|
| 1417 | + $tz = getUserTimezone(); |
|
| 1418 | + } |
|
| 1371 | 1419 | |
| 1372 | 1420 | // Is this supposed to be an all day event, or should it have specific start and end times? |
| 1373 | - if (isset($eventOptions['allday'])) |
|
| 1374 | - $allday = $eventOptions['allday']; |
|
| 1375 | - elseif (empty($_POST['allday'])) |
|
| 1376 | - $allday = false; |
|
| 1377 | - else |
|
| 1378 | - $allday = true; |
|
| 1421 | + if (isset($eventOptions['allday'])) { |
|
| 1422 | + $allday = $eventOptions['allday']; |
|
| 1423 | + } elseif (empty($_POST['allday'])) { |
|
| 1424 | + $allday = false; |
|
| 1425 | + } else { |
|
| 1426 | + $allday = true; |
|
| 1427 | + } |
|
| 1379 | 1428 | |
| 1380 | 1429 | // Input might come as individual parameters... |
| 1381 | 1430 | $start_year = isset($eventOptions['year']) ? $eventOptions['year'] : (isset($_POST['year']) ? $_POST['year'] : null); |
@@ -1402,10 +1451,12 @@ discard block |
||
| 1402 | 1451 | $end_time_string = isset($eventOptions['end_time']) ? $eventOptions['end_time'] : (isset($_POST['end_time']) ? $_POST['end_time'] : null); |
| 1403 | 1452 | |
| 1404 | 1453 | // If the date and time were given in separate strings, combine them |
| 1405 | - if (empty($start_string) && isset($start_date_string)) |
|
| 1406 | - $start_string = $start_date_string . (isset($start_time_string) ? ' ' . $start_time_string : ''); |
|
| 1407 | - if (empty($end_string) && isset($end_date_string)) |
|
| 1408 | - $end_string = $end_date_string . (isset($end_time_string) ? ' ' . $end_time_string : ''); |
|
| 1454 | + if (empty($start_string) && isset($start_date_string)) { |
|
| 1455 | + $start_string = $start_date_string . (isset($start_time_string) ? ' ' . $start_time_string : ''); |
|
| 1456 | + } |
|
| 1457 | + if (empty($end_string) && isset($end_date_string)) { |
|
| 1458 | + $end_string = $end_date_string . (isset($end_time_string) ? ' ' . $end_time_string : ''); |
|
| 1459 | + } |
|
| 1409 | 1460 | |
| 1410 | 1461 | // If some form of string input was given, override individually defined options with it |
| 1411 | 1462 | if (isset($start_string)) |
@@ -1496,10 +1547,11 @@ discard block |
||
| 1496 | 1547 | if ($start_object >= $end_object) |
| 1497 | 1548 | { |
| 1498 | 1549 | $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, $start_hour, $start_minute, $start_second) . ' ' . $tz); |
| 1499 | - if ($span > 0) |
|
| 1500 | - date_add($end_object, date_interval_create_from_date_string($span . ' days')); |
|
| 1501 | - else |
|
| 1502 | - date_add($end_object, date_interval_create_from_date_string('1 hour')); |
|
| 1550 | + if ($span > 0) { |
|
| 1551 | + date_add($end_object, date_interval_create_from_date_string($span . ' days')); |
|
| 1552 | + } else { |
|
| 1553 | + date_add($end_object, date_interval_create_from_date_string('1 hour')); |
|
| 1554 | + } |
|
| 1503 | 1555 | } |
| 1504 | 1556 | |
| 1505 | 1557 | // Is $end_object too late? |
@@ -1512,9 +1564,9 @@ discard block |
||
| 1512 | 1564 | { |
| 1513 | 1565 | $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, $start_hour, $start_minute, $start_second) . ' ' . $tz); |
| 1514 | 1566 | date_add($end_object, date_interval_create_from_date_string($modSettings['cal_maxspan'] . ' days')); |
| 1567 | + } else { |
|
| 1568 | + $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, '11', '59', '59') . ' ' . $tz); |
|
| 1515 | 1569 | } |
| 1516 | - else |
|
| 1517 | - $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, '11', '59', '59') . ' ' . $tz); |
|
| 1518 | 1570 | } |
| 1519 | 1571 | } |
| 1520 | 1572 | |
@@ -1527,8 +1579,7 @@ discard block |
||
| 1527 | 1579 | $start_time = null; |
| 1528 | 1580 | $end_time = null; |
| 1529 | 1581 | $tz = null; |
| 1530 | - } |
|
| 1531 | - else |
|
| 1582 | + } else |
|
| 1532 | 1583 | { |
| 1533 | 1584 | $start_time = date_format($start_object, 'H:i:s'); |
| 1534 | 1585 | $end_time = date_format($end_object, 'H:i:s'); |
@@ -1549,16 +1600,18 @@ discard block |
||
| 1549 | 1600 | require_once($sourcedir . '/Subs.php'); |
| 1550 | 1601 | |
| 1551 | 1602 | // First, try to create a better date format, ignoring the "time" elements. |
| 1552 | - if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
| 1553 | - $date_format = '%F'; |
|
| 1554 | - else |
|
| 1555 | - $date_format = $matches[0]; |
|
| 1603 | + if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
| 1604 | + $date_format = '%F'; |
|
| 1605 | + } else { |
|
| 1606 | + $date_format = $matches[0]; |
|
| 1607 | + } |
|
| 1556 | 1608 | |
| 1557 | 1609 | // We want a fairly compact version of the time, but as close as possible to the user's settings. |
| 1558 | - if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
| 1559 | - $time_format = '%k:%M'; |
|
| 1560 | - else |
|
| 1561 | - $time_format = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
|
| 1610 | + if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
| 1611 | + $time_format = '%k:%M'; |
|
| 1612 | + } else { |
|
| 1613 | + $time_format = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
|
| 1614 | + } |
|
| 1562 | 1615 | |
| 1563 | 1616 | // Should this be an all day event? |
| 1564 | 1617 | $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; |
@@ -1567,8 +1620,9 @@ discard block |
||
| 1567 | 1620 | $span = 1 + date_interval_format(date_diff(date_create($row['start_date']), date_create($row['end_date'])), '%d'); |
| 1568 | 1621 | |
| 1569 | 1622 | // We need to have a defined timezone in the steps below |
| 1570 | - if (empty($row['timezone'])) |
|
| 1571 | - $row['timezone'] = getUserTimezone(); |
|
| 1623 | + if (empty($row['timezone'])) { |
|
| 1624 | + $row['timezone'] = getUserTimezone(); |
|
| 1625 | + } |
|
| 1572 | 1626 | |
| 1573 | 1627 | // Get most of the standard date information for the start and end datetimes |
| 1574 | 1628 | $start = date_parse($row['start_date'] . (!$allday ? ' ' . $row['start_time'] : '')); |
@@ -1612,8 +1666,9 @@ discard block |
||
| 1612 | 1666 | $tz_location = timezone_location_get(timezone_open($row['timezone'])); |
| 1613 | 1667 | |
| 1614 | 1668 | // Kazakstan |
| 1615 | - if ($tz_location['country_code'] == 'KZ') |
|
| 1616 | - $tz_abbrev = str_replace(array('+05', '+06'), array('AQTT', 'ALMT'), $tz_abbrev); |
|
| 1669 | + if ($tz_location['country_code'] == 'KZ') { |
|
| 1670 | + $tz_abbrev = str_replace(array('+05', '+06'), array('AQTT', 'ALMT'), $tz_abbrev); |
|
| 1671 | + } |
|
| 1617 | 1672 | |
| 1618 | 1673 | // Russia likes to experiment with time zones |
| 1619 | 1674 | if ($tz_location['country_code'] == 'RU') |
@@ -1624,8 +1679,9 @@ discard block |
||
| 1624 | 1679 | } |
| 1625 | 1680 | |
| 1626 | 1681 | // Still no good? We'll just mark it as a UTC offset |
| 1627 | - if (strspn($tz_abbrev, '+-') > 0) |
|
| 1628 | - $tz_abbrev = 'UTC' . $tz_abbrev; |
|
| 1682 | + if (strspn($tz_abbrev, '+-') > 0) { |
|
| 1683 | + $tz_abbrev = 'UTC' . $tz_abbrev; |
|
| 1684 | + } |
|
| 1629 | 1685 | } |
| 1630 | 1686 | |
| 1631 | 1687 | return array($start, $end, $allday, $span, $tz, $tz_abbrev); |
@@ -1642,8 +1698,9 @@ discard block |
||
| 1642 | 1698 | global $smcFunc, $context, $sourcedir, $user_info, $modSettings; |
| 1643 | 1699 | static $member_cache = array(); |
| 1644 | 1700 | |
| 1645 | - if (is_null($id_member) && $user_info['is_guest'] == false) |
|
| 1646 | - $id_member = $context['user']['id']; |
|
| 1701 | + if (is_null($id_member) && $user_info['is_guest'] == false) { |
|
| 1702 | + $id_member = $context['user']['id']; |
|
| 1703 | + } |
|
| 1647 | 1704 | |
| 1648 | 1705 | //check if the cache got the data |
| 1649 | 1706 | if (isset($id_member) && isset($member_cache[$id_member])) |
@@ -1665,11 +1722,13 @@ discard block |
||
| 1665 | 1722 | $smcFunc['db_free_result']($request); |
| 1666 | 1723 | } |
| 1667 | 1724 | |
| 1668 | - if (empty($timezone) || !in_array($timezone, timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) |
|
| 1669 | - $timezone = isset($modSettings['default_timezone']) ? $modSettings['default_timezone'] : date_default_timezone_get(); |
|
| 1725 | + if (empty($timezone) || !in_array($timezone, timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) { |
|
| 1726 | + $timezone = isset($modSettings['default_timezone']) ? $modSettings['default_timezone'] : date_default_timezone_get(); |
|
| 1727 | + } |
|
| 1670 | 1728 | |
| 1671 | - if (isset($id_member)) |
|
| 1672 | - $member_cache[$id_member] = $timezone; |
|
| 1729 | + if (isset($id_member)) { |
|
| 1730 | + $member_cache[$id_member] = $timezone; |
|
| 1731 | + } |
|
| 1673 | 1732 | |
| 1674 | 1733 | return $timezone; |
| 1675 | 1734 | } |
@@ -1698,8 +1757,9 @@ discard block |
||
| 1698 | 1757 | ) |
| 1699 | 1758 | ); |
| 1700 | 1759 | $holidays = array(); |
| 1701 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1702 | - $holidays[] = $row; |
|
| 1760 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1761 | + $holidays[] = $row; |
|
| 1762 | + } |
|
| 1703 | 1763 | $smcFunc['db_free_result']($request); |
| 1704 | 1764 | |
| 1705 | 1765 | return $holidays; |
@@ -51,30 +51,33 @@ discard block |
||
| 51 | 51 | $ignored_members = explode(',', $row['pm_ignore_list']); |
| 52 | 52 | |
| 53 | 53 | // If the user is in group 1 anywhere, they can see everything anyway. |
| 54 | - if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) |
|
| 55 | - $author = $row['id_member']; |
|
| 54 | + if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) { |
|
| 55 | + $author = $row['id_member']; |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | 58 | $smcFunc['db_free_result']($request); |
| 58 | - } |
|
| 59 | - else |
|
| 59 | + } else |
|
| 60 | 60 | { |
| 61 | 61 | // This isn't something we know natively how to support. Call the hooks, if they're dealing with it, return false, otherwise return the user id. |
| 62 | 62 | $hook_results = call_integration_hook('integrate_find_like_author', array($this->_details['content_type'], $this->_details['content_id'])); |
| 63 | - foreach ($hook_results as $result) |
|
| 64 | - if (!empty($result)) |
|
| 63 | + foreach ($hook_results as $result) { |
|
| 64 | + if (!empty($result)) |
|
| 65 | 65 | { |
| 66 | 66 | $author = $result; |
| 67 | + } |
|
| 67 | 68 | break; |
| 68 | 69 | } |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | // If we didn't have a member... leave. |
| 72 | - if (empty($author)) |
|
| 73 | - return true; |
|
| 73 | + if (empty($author)) { |
|
| 74 | + return true; |
|
| 75 | + } |
|
| 74 | 76 | |
| 75 | 77 | // If the person who sent the notification is the person whose content it is, do nothing. |
| 76 | - if ($author == $this->_details['sender_id']) |
|
| 77 | - return true; |
|
| 78 | + if ($author == $this->_details['sender_id']) { |
|
| 79 | + return true; |
|
| 80 | + } |
|
| 78 | 81 | |
| 79 | 82 | // If the person who sent the notification is on this person's ignore list, do nothing. |
| 80 | 83 | if (!empty($ignored_members) && in_array($this->_details['sender_id'], $ignored_members)) { |
@@ -88,8 +91,9 @@ discard block |
||
| 88 | 91 | // As a result, the value should really just be non empty. |
| 89 | 92 | |
| 90 | 93 | // Check the value. If no value or it's empty, they didn't want alerts, oh well. |
| 91 | - if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) |
|
| 92 | - return true; |
|
| 94 | + if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) { |
|
| 95 | + return true; |
|
| 96 | + } |
|
| 93 | 97 | |
| 94 | 98 | // Don't spam the alerts: if there is an existing unread alert of the |
| 95 | 99 | // requested type for the target user from the sender, don't make a new one. |
@@ -109,8 +113,9 @@ discard block |
||
| 109 | 113 | ) |
| 110 | 114 | ); |
| 111 | 115 | |
| 112 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 113 | - return true; |
|
| 116 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 117 | + return true; |
|
| 118 | + } |
|
| 114 | 119 | $smcFunc['db_free_result']($request); |
| 115 | 120 | |
| 116 | 121 | // Issue, update, move on. |
@@ -25,18 +25,20 @@ discard block |
||
| 25 | 25 | </div> |
| 26 | 26 | <div class="windowbg2 noup">'; |
| 27 | 27 | |
| 28 | - if (!empty($context['move_board'])) |
|
| 29 | - echo ' |
|
| 28 | + if (!empty($context['move_board'])) { |
|
| 29 | + echo ' |
|
| 30 | 30 | <div class="noticebox"> |
| 31 | 31 | ', $context['move_title'], ' [<a href="', $scripturl, '?action=admin;area=manageboards">', $txt['mboards_cancel_moving'], '</a>]', ' |
| 32 | 32 | </div>'; |
| 33 | + } |
|
| 33 | 34 | |
| 34 | 35 | // No categories so show a label. |
| 35 | - if (empty($context['categories'])) |
|
| 36 | - echo ' |
|
| 36 | + if (empty($context['categories'])) { |
|
| 37 | + echo ' |
|
| 37 | 38 | <div class="windowbg centertext"> |
| 38 | 39 | ', $txt['mboards_no_cats'], ' |
| 39 | 40 | </div>'; |
| 41 | + } |
|
| 40 | 42 | |
| 41 | 43 | // Loop through every category, listing the boards in each as we go. |
| 42 | 44 | foreach ($context['categories'] as $category) |
@@ -54,9 +56,10 @@ discard block |
||
| 54 | 56 | <form action="', $scripturl, '?action=admin;area=manageboards;sa=newboard;cat=', $category['id'], '" method="post" accept-charset="', $context['character_set'], '"> |
| 55 | 57 | <ul id="category_', $category['id'], '" class="nolist">'; |
| 56 | 58 | |
| 57 | - if (!empty($category['move_link'])) |
|
| 58 | - echo ' |
|
| 59 | + if (!empty($category['move_link'])) { |
|
| 60 | + echo ' |
|
| 59 | 61 | <li><a href="', $category['move_link']['href'], '" title="', $category['move_link']['label'], '"><span class="generic_icons select_above"></span></a></li>'; |
| 62 | + } |
|
| 60 | 63 | |
| 61 | 64 | $recycle_board = '<a href="' . $scripturl . '?action=admin;area=manageboards;sa=settings"> <img src="' . $settings['images_url'] . '/post/recycled.png" alt="' . $txt['recycle_board'] . '" title="' . $txt['recycle_board'] . '"></a>'; |
| 62 | 65 | $redirect_board = '<img src="' . $settings['images_url'] . '/new_redirect.png" alt="' . $txt['redirect_board_desc'] . '" title="' . $txt['redirect_board_desc'] . '">'; |
@@ -81,9 +84,10 @@ discard block |
||
| 81 | 84 | echo ' |
| 82 | 85 | <li class="windowbg" style="padding-', $context['right_to_left'] ? 'right' : 'left', ': ', 5 + 30 * $board['move_links'][0]['child_level'], 'px;">'; |
| 83 | 86 | |
| 84 | - foreach ($board['move_links'] as $link) |
|
| 85 | - echo ' |
|
| 87 | + foreach ($board['move_links'] as $link) { |
|
| 88 | + echo ' |
|
| 86 | 89 | <a href="', $link['href'], '" class="move_links" title="', $link['label'], '"><span class="generic_icons select_', $link['class'], '" title="', $link['label'], '"></span></a>'; |
| 90 | + } |
|
| 87 | 91 | |
| 88 | 92 | echo ' |
| 89 | 93 | </li>'; |
@@ -132,9 +136,10 @@ discard block |
||
| 132 | 136 | <select name="cat_order">'; |
| 133 | 137 | |
| 134 | 138 | // Print every existing category into a select box. |
| 135 | - foreach ($context['category_order'] as $order) |
|
| 136 | - echo ' |
|
| 139 | + foreach ($context['category_order'] as $order) { |
|
| 140 | + echo ' |
|
| 137 | 141 | <option', $order['selected'] ? ' selected' : '', ' value="', $order['id'], '">', $order['name'], '</option>'; |
| 142 | + } |
|
| 138 | 143 | echo ' |
| 139 | 144 | </select> |
| 140 | 145 | </dd>'; |
@@ -169,14 +174,15 @@ discard block |
||
| 169 | 174 | { |
| 170 | 175 | foreach ($context['custom_category_settings'] as $catset_id => $catset) |
| 171 | 176 | { |
| 172 | - if (!empty($catset['dt']) && !empty($catset['dd'])) |
|
| 173 | - echo ' |
|
| 177 | + if (!empty($catset['dt']) && !empty($catset['dd'])) { |
|
| 178 | + echo ' |
|
| 174 | 179 | <dt class="clear', !is_numeric($catset_id) ? ' catset_' . $catset_id : '', '"> |
| 175 | 180 | ', $catset['dt'], ' |
| 176 | 181 | </dt> |
| 177 | 182 | <dd', !is_numeric($catset_id) ? ' class="catset_' . $catset_id . '"' : '', '> |
| 178 | 183 | ', $catset['dd'], ' |
| 179 | 184 | </dd>'; |
| 185 | + } |
|
| 180 | 186 | } |
| 181 | 187 | } |
| 182 | 188 | |
@@ -184,21 +190,23 @@ discard block |
||
| 184 | 190 | echo ' |
| 185 | 191 | </dl>'; |
| 186 | 192 | |
| 187 | - if (isset($context['category']['is_new'])) |
|
| 188 | - echo ' |
|
| 193 | + if (isset($context['category']['is_new'])) { |
|
| 194 | + echo ' |
|
| 189 | 195 | <input type="submit" name="add" value="', $txt['mboards_add_cat_button'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" class="button_submit">'; |
| 190 | - else |
|
| 191 | - echo ' |
|
| 196 | + } else { |
|
| 197 | + echo ' |
|
| 192 | 198 | <input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" class="button_submit"> |
| 193 | 199 | <input type="submit" name="delete" value="', $txt['mboards_delete_cat'], '" data-confirm="', $txt['catConfirm'], '" class="button_submit you_sure">'; |
| 200 | + } |
|
| 194 | 201 | echo ' |
| 195 | 202 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 196 | 203 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 197 | 204 | |
| 198 | 205 | // If this category is empty we don't bother with the next confirmation screen. |
| 199 | - if ($context['category']['is_empty']) |
|
| 200 | - echo ' |
|
| 206 | + if ($context['category']['is_empty']) { |
|
| 207 | + echo ' |
|
| 201 | 208 | <input type="hidden" name="empty" value="1">'; |
| 209 | + } |
|
| 202 | 210 | |
| 203 | 211 | echo ' |
| 204 | 212 | </div> |
@@ -225,9 +233,10 @@ discard block |
||
| 225 | 233 | <p>', $txt['mboards_delete_cat_contains'], ':</p> |
| 226 | 234 | <ul>'; |
| 227 | 235 | |
| 228 | - foreach ($context['category']['children'] as $child) |
|
| 229 | - echo ' |
|
| 236 | + foreach ($context['category']['children'] as $child) { |
|
| 237 | + echo ' |
|
| 230 | 238 | <li>', $child, '</li>'; |
| 239 | + } |
|
| 231 | 240 | |
| 232 | 241 | echo ' |
| 233 | 242 | </ul> |
@@ -241,10 +250,11 @@ discard block |
||
| 241 | 250 | <label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1" class="input_radio"', count($context['category_order']) == 1 ? ' disabled' : '', '>', $txt['mboards_delete_option2'], '</label>: |
| 242 | 251 | <select name="cat_to"', count($context['category_order']) == 1 ? ' disabled' : '', '>'; |
| 243 | 252 | |
| 244 | - foreach ($context['category_order'] as $cat) |
|
| 245 | - if ($cat['id'] != 0) |
|
| 253 | + foreach ($context['category_order'] as $cat) { |
|
| 254 | + if ($cat['id'] != 0) |
|
| 246 | 255 | echo ' |
| 247 | 256 | <option value="', $cat['id'], '">', $cat['true_name'], '</option>'; |
| 257 | + } |
|
| 248 | 258 | |
| 249 | 259 | echo ' |
| 250 | 260 | </select> |
@@ -288,9 +298,10 @@ discard block |
||
| 288 | 298 | </dt> |
| 289 | 299 | <dd> |
| 290 | 300 | <select name="new_cat" onchange="if (this.form.order) {this.form.order.disabled = this.options[this.selectedIndex].value != 0; this.form.board_order.disabled = this.options[this.selectedIndex].value != 0 || this.form.order.options[this.form.order.selectedIndex].value == \'\';}">'; |
| 291 | - foreach ($context['categories'] as $category) |
|
| 292 | - echo ' |
|
| 301 | + foreach ($context['categories'] as $category) { |
|
| 302 | + echo ' |
|
| 293 | 303 | <option', $category['selected'] ? ' selected' : '', ' value="', $category['id'], '">', $category['name'], '</option>'; |
| 304 | + } |
|
| 294 | 305 | echo ' |
| 295 | 306 | </select> |
| 296 | 307 | </dd>'; |
@@ -317,9 +328,10 @@ discard block |
||
| 317 | 328 | echo ' |
| 318 | 329 | <select id="board_order" name="board_order"', !isset($context['board']['is_new']) ? ' disabled' : '', '> |
| 319 | 330 | ', !isset($context['board']['is_new']) ? '<option value="">(' . $txt['mboards_unchanged'] . ')</option>' : ''; |
| 320 | - foreach ($context['board_order'] as $order) |
|
| 321 | - echo ' |
|
| 331 | + foreach ($context['board_order'] as $order) { |
|
| 332 | + echo ' |
|
| 322 | 333 | <option', $order['selected'] ? ' selected' : '', ' value="', $order['id'], '">', $order['name'], '</option>'; |
| 334 | + } |
|
| 323 | 335 | echo ' |
| 324 | 336 | </select> |
| 325 | 337 | </dd>'; |
@@ -348,13 +360,15 @@ discard block |
||
| 348 | 360 | <dd> |
| 349 | 361 | <select name="profile">'; |
| 350 | 362 | |
| 351 | - if (isset($context['board']['is_new'])) |
|
| 352 | - echo ' |
|
| 363 | + if (isset($context['board']['is_new'])) { |
|
| 364 | + echo ' |
|
| 353 | 365 | <option value="-1">[', $txt['permission_profile_inherit'], ']</option>'; |
| 366 | + } |
|
| 354 | 367 | |
| 355 | - foreach ($context['profiles'] as $id => $profile) |
|
| 356 | - echo ' |
|
| 368 | + foreach ($context['profiles'] as $id => $profile) { |
|
| 369 | + echo ' |
|
| 357 | 370 | <option value="', $id, '"', $id == $context['board']['profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
| 371 | + } |
|
| 358 | 372 | |
| 359 | 373 | echo ' |
| 360 | 374 | </select> |
@@ -367,8 +381,8 @@ discard block |
||
| 367 | 381 | </dt> |
| 368 | 382 | <dd>'; |
| 369 | 383 | |
| 370 | - if (!empty($modSettings['deny_boards_access'])) |
|
| 371 | - echo ' |
|
| 384 | + if (!empty($modSettings['deny_boards_access'])) { |
|
| 385 | + echo ' |
|
| 372 | 386 | <table> |
| 373 | 387 | <tr> |
| 374 | 388 | <td></td> |
@@ -376,10 +390,11 @@ discard block |
||
| 376 | 390 | <th>', $txt['permissions_option_off'], '</th> |
| 377 | 391 | <th>', $txt['permissions_option_deny'], '</th> |
| 378 | 392 | </tr>'; |
| 393 | + } |
|
| 379 | 394 | |
| 380 | 395 | // List all the membergroups so the user can choose who may access this board. |
| 381 | - foreach ($context['groups'] as $group) |
|
| 382 | - if (empty($modSettings['deny_boards_access'])) |
|
| 396 | + foreach ($context['groups'] as $group) { |
|
| 397 | + if (empty($modSettings['deny_boards_access'])) |
|
| 383 | 398 | echo ' |
| 384 | 399 | <label for="groups_', $group['id'], '"> |
| 385 | 400 | <input type="checkbox" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '"', in_array($group['id'], $context['board_managers']) ? ' checked disabled' : ($group['allow'] ? ' checked' : ''), ' class="input_check"> |
@@ -387,8 +402,9 @@ discard block |
||
| 387 | 402 | ', $group['name'], ' |
| 388 | 403 | </span> |
| 389 | 404 | </label><br>'; |
| 390 | - else |
|
| 391 | - echo ' |
|
| 405 | + } |
|
| 406 | + else { |
|
| 407 | + echo ' |
|
| 392 | 408 | <tr> |
| 393 | 409 | <td> |
| 394 | 410 | <label for="groups_', $group['id'], '_a"> |
@@ -408,16 +424,17 @@ discard block |
||
| 408 | 424 | </td> |
| 409 | 425 | <td></td> |
| 410 | 426 | </tr>'; |
| 427 | + } |
|
| 411 | 428 | |
| 412 | - if (empty($modSettings['deny_boards_access'])) |
|
| 413 | - echo ' |
|
| 429 | + if (empty($modSettings['deny_boards_access'])) { |
|
| 430 | + echo ' |
|
| 414 | 431 | <span class="select_all_box"> |
| 415 | 432 | <em>', $txt['check_all'], '</em> <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'groups[\');"> |
| 416 | 433 | </span> |
| 417 | 434 | <br><br> |
| 418 | 435 | </dd>'; |
| 419 | - else |
|
| 420 | - echo ' |
|
| 436 | + } else { |
|
| 437 | + echo ' |
|
| 421 | 438 | <tr class="select_all_box"> |
| 422 | 439 | <td> |
| 423 | 440 | </td> |
@@ -436,6 +453,7 @@ discard block |
||
| 436 | 453 | </tr> |
| 437 | 454 | </table> |
| 438 | 455 | </dd>'; |
| 456 | + } |
|
| 439 | 457 | |
| 440 | 458 | // Options to choose moderators, specify as announcement board and choose whether to count posts here. |
| 441 | 459 | echo ' |
@@ -490,8 +508,8 @@ discard block |
||
| 490 | 508 | </dl> |
| 491 | 509 | </div>'; |
| 492 | 510 | |
| 493 | - if ($context['board']['redirect']) |
|
| 494 | - echo ' |
|
| 511 | + if ($context['board']['redirect']) { |
|
| 512 | + echo ' |
|
| 495 | 513 | <div id="reset_redirect_div"> |
| 496 | 514 | <dl class="settings"> |
| 497 | 515 | <dt> |
@@ -504,6 +522,7 @@ discard block |
||
| 504 | 522 | </dd> |
| 505 | 523 | </dl> |
| 506 | 524 | </div>'; |
| 525 | + } |
|
| 507 | 526 | } |
| 508 | 527 | |
| 509 | 528 | echo ' |
@@ -531,9 +550,10 @@ discard block |
||
| 531 | 550 | <select name="boardtheme" id="boardtheme" onchange="refreshOptions();"> |
| 532 | 551 | <option value="0"', $context['board']['theme'] == 0 ? ' selected' : '', '>', $txt['mboards_theme_default'], '</option>'; |
| 533 | 552 | |
| 534 | - foreach ($context['themes'] as $theme) |
|
| 535 | - echo ' |
|
| 553 | + foreach ($context['themes'] as $theme) { |
|
| 554 | + echo ' |
|
| 536 | 555 | <option value="', $theme['id'], '"', $context['board']['theme'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>'; |
| 556 | + } |
|
| 537 | 557 | |
| 538 | 558 | echo ' |
| 539 | 559 | </select> |
@@ -562,14 +582,15 @@ discard block |
||
| 562 | 582 | |
| 563 | 583 | foreach ($context['custom_board_settings'] as $cbs_id => $cbs) |
| 564 | 584 | { |
| 565 | - if (!empty($cbs['dt']) && !empty($cbs['dd'])) |
|
| 566 | - echo ' |
|
| 585 | + if (!empty($cbs['dt']) && !empty($cbs['dd'])) { |
|
| 586 | + echo ' |
|
| 567 | 587 | <dt class="clear', !is_numeric($cbs_id) ? ' cbs_' . $cbs_id : '', '"> |
| 568 | 588 | ', $cbs['dt'], ' |
| 569 | 589 | </dt> |
| 570 | 590 | <dd', !is_numeric($cbs_id) ? ' class="cbs_' . $cbs_id . '"' : '', '> |
| 571 | 591 | ', $cbs['dd'], ' |
| 572 | 592 | </dd>'; |
| 593 | + } |
|
| 573 | 594 | } |
| 574 | 595 | |
| 575 | 596 | echo ' |
@@ -577,9 +598,10 @@ discard block |
||
| 577 | 598 | </div>'; |
| 578 | 599 | } |
| 579 | 600 | |
| 580 | - if (!empty($context['board']['is_recycle'])) |
|
| 581 | - echo ' |
|
| 601 | + if (!empty($context['board']['is_recycle'])) { |
|
| 602 | + echo ' |
|
| 582 | 603 | <div class="noticebox">', $txt['mboards_recycle_disabled_delete'], '</div>'; |
| 604 | + } |
|
| 583 | 605 | |
| 584 | 606 | echo ' |
| 585 | 607 | <input type="hidden" name="rid" value="', $context['redirect_location'], '"> |
@@ -587,21 +609,24 @@ discard block |
||
| 587 | 609 | <input type="hidden" name="', $context['admin-be-' . $context['board']['id'] . '_token_var'], '" value="', $context['admin-be-' . $context['board']['id'] . '_token'], '">'; |
| 588 | 610 | |
| 589 | 611 | // If this board has no children don't bother with the next confirmation screen. |
| 590 | - if ($context['board']['no_children']) |
|
| 591 | - echo ' |
|
| 612 | + if ($context['board']['no_children']) { |
|
| 613 | + echo ' |
|
| 592 | 614 | <input type="hidden" name="no_children" value="1">'; |
| 615 | + } |
|
| 593 | 616 | |
| 594 | - if (isset($context['board']['is_new'])) |
|
| 595 | - echo ' |
|
| 617 | + if (isset($context['board']['is_new'])) { |
|
| 618 | + echo ' |
|
| 596 | 619 | <input type="hidden" name="cur_cat" value="', $context['board']['category'], '"> |
| 597 | 620 | <input type="submit" name="add" value="', $txt['mboards_new_board'], '" onclick="return !isEmptyText(this.form.board_name);" class="button_submit">'; |
| 598 | - else |
|
| 599 | - echo ' |
|
| 621 | + } else { |
|
| 622 | + echo ' |
|
| 600 | 623 | <input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.board_name);" class="button_submit">'; |
| 624 | + } |
|
| 601 | 625 | |
| 602 | - if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle'])) |
|
| 603 | - echo ' |
|
| 626 | + if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle'])) { |
|
| 627 | + echo ' |
|
| 604 | 628 | <input type="submit" name="delete" value="', $txt['mboards_delete_board'], '" data-confirm="', $txt['boardConfirm'], '" class="button_submit you_sure">'; |
| 629 | + } |
|
| 605 | 630 | echo ' |
| 606 | 631 | </div> |
| 607 | 632 | </form> |
@@ -622,12 +647,13 @@ discard block |
||
| 622 | 647 | sItemListContainerId: \'moderator_container\', |
| 623 | 648 | aListItems: ['; |
| 624 | 649 | |
| 625 | - foreach ($context['board']['moderators'] as $id_member => $member_name) |
|
| 626 | - echo ' |
|
| 650 | + foreach ($context['board']['moderators'] as $id_member => $member_name) { |
|
| 651 | + echo ' |
|
| 627 | 652 | { |
| 628 | 653 | sItemId: ', JavaScriptEscape($id_member), ', |
| 629 | 654 | sItemName: ', JavaScriptEscape($member_name), ' |
| 630 | 655 | }', $id_member == $context['board']['last_moderator_id'] ? '' : ','; |
| 656 | + } |
|
| 631 | 657 | |
| 632 | 658 | echo ' |
| 633 | 659 | ] |
@@ -647,12 +673,13 @@ discard block |
||
| 647 | 673 | sItemListContainerId: \'moderator_group_container\', |
| 648 | 674 | aListItems: ['; |
| 649 | 675 | |
| 650 | - foreach ($context['board']['moderator_groups'] as $id_group => $group_name) |
|
| 651 | - echo ' |
|
| 676 | + foreach ($context['board']['moderator_groups'] as $id_group => $group_name) { |
|
| 677 | + echo ' |
|
| 652 | 678 | { |
| 653 | 679 | sItemId: ', JavaScriptEscape($id_group), ', |
| 654 | 680 | sItemName: ', JavaScriptEscape($group_name), ' |
| 655 | 681 | }', $id_group == $context['board']['last_moderator_group_id'] ? '' : ','; |
| 682 | + } |
|
| 656 | 683 | |
| 657 | 684 | echo ' |
| 658 | 685 | ] |
@@ -678,17 +705,19 @@ discard block |
||
| 678 | 705 | echo ' |
| 679 | 706 | document.getElementById("redirect_address_div").style.display = redirectEnabled ? "" : "none";'; |
| 680 | 707 | |
| 681 | - if ($context['board']['redirect']) |
|
| 682 | - echo ' |
|
| 708 | + if ($context['board']['redirect']) { |
|
| 709 | + echo ' |
|
| 683 | 710 | document.getElementById("reset_redirect_div").style.display = redirectEnabled ? "" : "none";'; |
| 711 | + } |
|
| 684 | 712 | } |
| 685 | 713 | |
| 686 | 714 | // Include any JavaScript added by mods using the 'integrate_edit_board' hook. |
| 687 | 715 | if (!empty($context['custom_refreshOptions']) && is_array($context['custom_refreshOptions'])) |
| 688 | 716 | { |
| 689 | - foreach ($context['custom_refreshOptions'] as $refreshOption) |
|
| 690 | - echo ' |
|
| 717 | + foreach ($context['custom_refreshOptions'] as $refreshOption) { |
|
| 718 | + echo ' |
|
| 691 | 719 | ', $refreshOption; |
| 720 | + } |
|
| 692 | 721 | } |
| 693 | 722 | |
| 694 | 723 | echo ' |
@@ -717,9 +746,10 @@ discard block |
||
| 717 | 746 | <p>', $txt['mboards_delete_board_contains'], '</p> |
| 718 | 747 | <ul>'; |
| 719 | 748 | |
| 720 | - foreach ($context['children'] as $child) |
|
| 721 | - echo ' |
|
| 749 | + foreach ($context['children'] as $child) { |
|
| 750 | + echo ' |
|
| 722 | 751 | <li>', $child['node']['name'], '</li>'; |
| 752 | + } |
|
| 723 | 753 | |
| 724 | 754 | echo ' |
| 725 | 755 | </ul> |
@@ -733,10 +763,11 @@ discard block |
||
| 733 | 763 | <label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1" class="input_radio"', empty($context['can_move_children']) ? ' disabled' : '', '>', $txt['mboards_delete_board_option2'], '</label>: |
| 734 | 764 | <select name="board_to"', empty($context['can_move_children']) ? ' disabled' : '', '>'; |
| 735 | 765 | |
| 736 | - foreach ($context['board_order'] as $board) |
|
| 737 | - if ($board['id'] != $context['board']['id'] && empty($board['is_child'])) |
|
| 766 | + foreach ($context['board_order'] as $board) { |
|
| 767 | + if ($board['id'] != $context['board']['id'] && empty($board['is_child'])) |
|
| 738 | 768 | echo ' |
| 739 | 769 | <option value="', $board['id'], '">', $board['name'], '</option>'; |
| 770 | + } |
|
| 740 | 771 | |
| 741 | 772 | echo ' |
| 742 | 773 | </select> |
@@ -670,7 +670,7 @@ |
||
| 670 | 670 | // Show "<< Last Edit: Time by Person >>" if this post was edited. But we need the div even if it wasn't modified! |
| 671 | 671 | // Because we insert into it through AJAX and we don't want to stop themers moving it around if they so wish so they can put it where they want it. |
| 672 | 672 | echo ' |
| 673 | - <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">'; |
|
| 673 | + <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '', '" id="modified_', $message['id'], '">'; |
|
| 674 | 674 | |
| 675 | 675 | if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
| 676 | 676 | echo |
@@ -51,11 +51,13 @@ discard block |
||
| 51 | 51 | <p>'; |
| 52 | 52 | |
| 53 | 53 | // Show just numbers...? |
| 54 | - if ($settings['display_who_viewing'] == 1) |
|
| 55 | - echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
| 54 | + if ($settings['display_who_viewing'] == 1) { |
|
| 55 | + echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
| 56 | + } |
|
| 56 | 57 | // Or show the actual people viewing the topic? |
| 57 | - else |
|
| 58 | - echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
| 58 | + else { |
|
| 59 | + echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
| 60 | + } |
|
| 59 | 61 | |
| 60 | 62 | // Now show how many guests are here too. |
| 61 | 63 | echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], ' |
@@ -93,10 +95,11 @@ discard block |
||
| 93 | 95 | <dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt> |
| 94 | 96 | <dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">'; |
| 95 | 97 | |
| 96 | - if ($context['allow_results_view']) |
|
| 97 | - echo ' |
|
| 98 | + if ($context['allow_results_view']) { |
|
| 99 | + echo ' |
|
| 98 | 100 | ', $option['bar_ndt'], ' |
| 99 | 101 | <span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>'; |
| 102 | + } |
|
| 100 | 103 | |
| 101 | 104 | echo ' |
| 102 | 105 | </dd>'; |
@@ -105,9 +108,10 @@ discard block |
||
| 105 | 108 | echo ' |
| 106 | 109 | </dl>'; |
| 107 | 110 | |
| 108 | - if ($context['allow_results_view']) |
|
| 109 | - echo ' |
|
| 111 | + if ($context['allow_results_view']) { |
|
| 112 | + echo ' |
|
| 110 | 113 | <p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>'; |
| 114 | + } |
|
| 111 | 115 | } |
| 112 | 116 | // They are allowed to vote! Go to it! |
| 113 | 117 | else |
@@ -116,17 +120,19 @@ discard block |
||
| 116 | 120 | <form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">'; |
| 117 | 121 | |
| 118 | 122 | // Show a warning if they are allowed more than one option. |
| 119 | - if ($context['poll']['allowed_warning']) |
|
| 120 | - echo ' |
|
| 123 | + if ($context['poll']['allowed_warning']) { |
|
| 124 | + echo ' |
|
| 121 | 125 | <p class="smallpadding">', $context['poll']['allowed_warning'], '</p>'; |
| 126 | + } |
|
| 122 | 127 | |
| 123 | 128 | echo ' |
| 124 | 129 | <ul class="options">'; |
| 125 | 130 | |
| 126 | 131 | // Show each option with its button - a radio likely. |
| 127 | - foreach ($context['poll']['options'] as $option) |
|
| 128 | - echo ' |
|
| 132 | + foreach ($context['poll']['options'] as $option) { |
|
| 133 | + echo ' |
|
| 129 | 134 | <li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>'; |
| 135 | + } |
|
| 130 | 136 | |
| 131 | 137 | echo ' |
| 132 | 138 | </ul> |
@@ -138,9 +144,10 @@ discard block |
||
| 138 | 144 | } |
| 139 | 145 | |
| 140 | 146 | // Is the clock ticking? |
| 141 | - if (!empty($context['poll']['expire_time'])) |
|
| 142 | - echo ' |
|
| 147 | + if (!empty($context['poll']['expire_time'])) { |
|
| 148 | + echo ' |
|
| 143 | 149 | <p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>'; |
| 150 | + } |
|
| 144 | 151 | |
| 145 | 152 | echo ' |
| 146 | 153 | </div> |
@@ -170,11 +177,13 @@ discard block |
||
| 170 | 177 | <li> |
| 171 | 178 | <b class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></b>'; |
| 172 | 179 | |
| 173 | - if ($event['can_edit']) |
|
| 174 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
| 180 | + if ($event['can_edit']) { |
|
| 181 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
| 182 | + } |
|
| 175 | 183 | |
| 176 | - if ($event['can_export']) |
|
| 177 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
| 184 | + if ($event['can_export']) { |
|
| 185 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
| 186 | + } |
|
| 178 | 187 | |
| 179 | 188 | echo ' |
| 180 | 189 | <br>'; |
@@ -182,14 +191,14 @@ discard block |
||
| 182 | 191 | if (!empty($event['allday'])) |
| 183 | 192 | { |
| 184 | 193 | 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>' : ''; |
| 185 | - } |
|
| 186 | - else |
|
| 194 | + } else |
|
| 187 | 195 | { |
| 188 | 196 | // Display event info relative to user's local timezone |
| 189 | 197 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
| 190 | 198 | |
| 191 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
| 192 | - echo trim($event['end_date_local']) . ', '; |
|
| 199 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
| 200 | + echo trim($event['end_date_local']) . ', '; |
|
| 201 | + } |
|
| 193 | 202 | |
| 194 | 203 | echo trim($event['end_time_local']); |
| 195 | 204 | |
@@ -198,23 +207,27 @@ discard block |
||
| 198 | 207 | { |
| 199 | 208 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
| 200 | 209 | |
| 201 | - 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']) |
|
| 202 | - echo trim($event['start_date_orig']), ', '; |
|
| 210 | + 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']) { |
|
| 211 | + echo trim($event['start_date_orig']), ', '; |
|
| 212 | + } |
|
| 203 | 213 | |
| 204 | 214 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
| 205 | 215 | |
| 206 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
| 207 | - echo trim($event['end_date_orig']) . ', '; |
|
| 216 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
| 217 | + echo trim($event['end_date_orig']) . ', '; |
|
| 218 | + } |
|
| 208 | 219 | |
| 209 | 220 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
| 210 | 221 | } |
| 211 | 222 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
| 212 | - else |
|
| 213 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
| 223 | + else { |
|
| 224 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
| 225 | + } |
|
| 214 | 226 | } |
| 215 | 227 | |
| 216 | - if (!empty($event['location'])) |
|
| 217 | - echo '<br>', $event['location']; |
|
| 228 | + if (!empty($event['location'])) { |
|
| 229 | + echo '<br>', $event['location']; |
|
| 230 | + } |
|
| 218 | 231 | |
| 219 | 232 | echo ' |
| 220 | 233 | </li>'; |
@@ -252,8 +265,9 @@ discard block |
||
| 252 | 265 | $context['removableMessageIDs'] = array(); |
| 253 | 266 | |
| 254 | 267 | // Get all the messages... |
| 255 | - while ($message = $context['get_message']()) |
|
| 256 | - template_single_post($message); |
|
| 268 | + while ($message = $context['get_message']()) { |
|
| 269 | + template_single_post($message); |
|
| 270 | + } |
|
| 257 | 271 | |
| 258 | 272 | echo ' |
| 259 | 273 | </form> |
@@ -290,8 +304,9 @@ discard block |
||
| 290 | 304 | <div id="display_jump_to"> </div>'; |
| 291 | 305 | |
| 292 | 306 | // Show quickreply |
| 293 | - if ($context['can_reply']) |
|
| 294 | - template_quickreply(); |
|
| 307 | + if ($context['can_reply']) { |
|
| 308 | + template_quickreply(); |
|
| 309 | + } |
|
| 295 | 310 | |
| 296 | 311 | // User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device. |
| 297 | 312 | echo ' |
@@ -304,8 +319,8 @@ discard block |
||
| 304 | 319 | </div>'; |
| 305 | 320 | |
| 306 | 321 | // Show the moderation button & pop only if user can moderate |
| 307 | - if ($context['can_moderate_forum'] || $context['user']['is_mod']) |
|
| 308 | - echo ' |
|
| 322 | + if ($context['can_moderate_forum'] || $context['user']['is_mod']) { |
|
| 323 | + echo ' |
|
| 309 | 324 | <div id="mobile_moderation" class="popup_container"> |
| 310 | 325 | <div class="popup_window description"> |
| 311 | 326 | <div class="popup_heading">', $txt['mobile_moderation'], ' |
@@ -315,6 +330,7 @@ discard block |
||
| 315 | 330 | </div> |
| 316 | 331 | </div> |
| 317 | 332 | </div>'; |
| 333 | + } |
|
| 318 | 334 | |
| 319 | 335 | echo ' |
| 320 | 336 | <script>'; |
@@ -438,9 +454,10 @@ discard block |
||
| 438 | 454 | }); |
| 439 | 455 | }'; |
| 440 | 456 | |
| 441 | - if (!empty($context['ignoredMsgs'])) |
|
| 442 | - echo ' |
|
| 457 | + if (!empty($context['ignoredMsgs'])) { |
|
| 458 | + echo ' |
|
| 443 | 459 | ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');'; |
| 460 | + } |
|
| 444 | 461 | |
| 445 | 462 | echo ' |
| 446 | 463 | </script>'; |
@@ -457,8 +474,9 @@ discard block |
||
| 457 | 474 | |
| 458 | 475 | $ignoring = false; |
| 459 | 476 | |
| 460 | - if ($message['can_remove']) |
|
| 461 | - $context['removableMessageIDs'][] = $message['id']; |
|
| 477 | + if ($message['can_remove']) { |
|
| 478 | + $context['removableMessageIDs'][] = $message['id']; |
|
| 479 | + } |
|
| 462 | 480 | |
| 463 | 481 | // Are we ignoring this message? |
| 464 | 482 | if (!empty($message['is_ignored'])) |
@@ -484,9 +502,10 @@ discard block |
||
| 484 | 502 | <div class="custom_fields_above_member"> |
| 485 | 503 | <ul class="nolist">'; |
| 486 | 504 | |
| 487 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
| 488 | - echo ' |
|
| 505 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
| 506 | + echo ' |
|
| 489 | 507 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 508 | + } |
|
| 490 | 509 | |
| 491 | 510 | echo ' |
| 492 | 511 | </ul> |
@@ -497,9 +516,10 @@ discard block |
||
| 497 | 516 | <h4>'; |
| 498 | 517 | |
| 499 | 518 | // Show online and offline buttons? |
| 500 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
| 501 | - echo ' |
|
| 519 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
| 520 | + echo ' |
|
| 502 | 521 | ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : ''; |
| 522 | + } |
|
| 503 | 523 | |
| 504 | 524 | |
| 505 | 525 | // Show a link to the member's profile. |
@@ -512,51 +532,59 @@ discard block |
||
| 512 | 532 | |
| 513 | 533 | |
| 514 | 534 | // Show the user's avatar. |
| 515 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
| 516 | - echo ' |
|
| 535 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
| 536 | + echo ' |
|
| 517 | 537 | <li class="avatar"> |
| 518 | 538 | <a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a> |
| 519 | 539 | </li>'; |
| 540 | + } |
|
| 520 | 541 | |
| 521 | 542 | // Are there any custom fields below the avatar? |
| 522 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
| 523 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 543 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
| 544 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 524 | 545 | echo ' |
| 525 | 546 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 547 | + } |
|
| 526 | 548 | |
| 527 | 549 | // Show the post group icons, but not for guests. |
| 528 | - if (!$message['member']['is_guest']) |
|
| 529 | - echo ' |
|
| 550 | + if (!$message['member']['is_guest']) { |
|
| 551 | + echo ' |
|
| 530 | 552 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
| 553 | + } |
|
| 531 | 554 | |
| 532 | 555 | // Show the member's primary group (like 'Administrator') if they have one. |
| 533 | - if (!empty($message['member']['group'])) |
|
| 534 | - echo ' |
|
| 556 | + if (!empty($message['member']['group'])) { |
|
| 557 | + echo ' |
|
| 535 | 558 | <li class="membergroup">', $message['member']['group'], '</li>'; |
| 559 | + } |
|
| 536 | 560 | |
| 537 | 561 | // Show the member's custom title, if they have one. |
| 538 | - if (!empty($message['member']['title'])) |
|
| 539 | - echo ' |
|
| 562 | + if (!empty($message['member']['title'])) { |
|
| 563 | + echo ' |
|
| 540 | 564 | <li class="title">', $message['member']['title'], '</li>'; |
| 565 | + } |
|
| 541 | 566 | |
| 542 | 567 | // Don't show these things for guests. |
| 543 | 568 | if (!$message['member']['is_guest']) |
| 544 | 569 | { |
| 545 | 570 | |
| 546 | 571 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
| 547 | - if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) |
|
| 548 | - echo ' |
|
| 572 | + if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) { |
|
| 573 | + echo ' |
|
| 549 | 574 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
| 575 | + } |
|
| 550 | 576 | |
| 551 | 577 | // Show how many posts they have made. |
| 552 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 553 | - echo ' |
|
| 578 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 579 | + echo ' |
|
| 554 | 580 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
| 581 | + } |
|
| 555 | 582 | |
| 556 | 583 | // Show their personal text? |
| 557 | - if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) |
|
| 558 | - echo ' |
|
| 584 | + if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) { |
|
| 585 | + echo ' |
|
| 559 | 586 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
| 587 | + } |
|
| 560 | 588 | |
| 561 | 589 | // Any custom fields to show as icons? |
| 562 | 590 | if (!empty($message['custom_fields']['icons'])) |
@@ -565,9 +593,10 @@ discard block |
||
| 565 | 593 | <li class="im_icons"> |
| 566 | 594 | <ol>'; |
| 567 | 595 | |
| 568 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
| 569 | - echo ' |
|
| 596 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
| 597 | + echo ' |
|
| 570 | 598 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 599 | + } |
|
| 571 | 600 | |
| 572 | 601 | echo ' |
| 573 | 602 | </ol> |
@@ -582,19 +611,22 @@ discard block |
||
| 582 | 611 | <ol class="profile_icons">'; |
| 583 | 612 | |
| 584 | 613 | // Don't show an icon if they haven't specified a website. |
| 585 | - if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) |
|
| 586 | - echo ' |
|
| 614 | + if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) { |
|
| 615 | + echo ' |
|
| 587 | 616 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 617 | + } |
|
| 588 | 618 | |
| 589 | 619 | // Since we know this person isn't a guest, you *can* message them. |
| 590 | - if ($context['can_send_pm']) |
|
| 591 | - echo ' |
|
| 620 | + if ($context['can_send_pm']) { |
|
| 621 | + echo ' |
|
| 592 | 622 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
| 623 | + } |
|
| 593 | 624 | |
| 594 | 625 | // Show the email if necessary |
| 595 | - if (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 596 | - echo ' |
|
| 626 | + if (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 627 | + echo ' |
|
| 597 | 628 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
| 629 | + } |
|
| 598 | 630 | |
| 599 | 631 | echo ' |
| 600 | 632 | </ol> |
@@ -602,48 +634,56 @@ discard block |
||
| 602 | 634 | } |
| 603 | 635 | |
| 604 | 636 | // Any custom fields for standard placement? |
| 605 | - if (!empty($message['custom_fields']['standard'])) |
|
| 606 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
| 637 | + if (!empty($message['custom_fields']['standard'])) { |
|
| 638 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
| 607 | 639 | echo ' |
| 608 | 640 | <li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>'; |
| 641 | + } |
|
| 609 | 642 | |
| 610 | 643 | } |
| 611 | 644 | // Otherwise, show the guest's email. |
| 612 | - elseif (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 613 | - echo ' |
|
| 645 | + elseif (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 646 | + echo ' |
|
| 614 | 647 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
| 648 | + } |
|
| 615 | 649 | |
| 616 | 650 | // Show the IP to this user for this post - because you can moderate? |
| 617 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
| 618 | - echo ' |
|
| 651 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
| 652 | + echo ' |
|
| 619 | 653 | <li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>'; |
| 654 | + } |
|
| 620 | 655 | |
| 621 | 656 | // Or, should we show it because this is you? |
| 622 | - elseif ($message['can_see_ip']) |
|
| 623 | - echo ' |
|
| 657 | + elseif ($message['can_see_ip']) { |
|
| 658 | + echo ' |
|
| 624 | 659 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>'; |
| 660 | + } |
|
| 625 | 661 | |
| 626 | 662 | // Okay, are you at least logged in? Then we can show something about why IPs are logged... |
| 627 | - elseif (!$context['user']['is_guest']) |
|
| 628 | - echo ' |
|
| 663 | + elseif (!$context['user']['is_guest']) { |
|
| 664 | + echo ' |
|
| 629 | 665 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
| 666 | + } |
|
| 630 | 667 | |
| 631 | 668 | // Otherwise, you see NOTHING! |
| 632 | - else |
|
| 633 | - echo ' |
|
| 669 | + else { |
|
| 670 | + echo ' |
|
| 634 | 671 | <li class="poster_ip">', $txt['logged'], '</li>'; |
| 672 | + } |
|
| 635 | 673 | |
| 636 | 674 | // Are we showing the warning status? |
| 637 | 675 | // Don't show these things for guests. |
| 638 | - if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) |
|
| 639 | - echo ' |
|
| 676 | + if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) { |
|
| 677 | + echo ' |
|
| 640 | 678 | <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
| 679 | + } |
|
| 641 | 680 | |
| 642 | 681 | // Are there any custom fields to show at the bottom of the poster info? |
| 643 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
| 644 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 682 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
| 683 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 645 | 684 | echo ' |
| 646 | 685 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 686 | + } |
|
| 647 | 687 | |
| 648 | 688 | // Poster info ends. |
| 649 | 689 | echo ' |
@@ -672,9 +712,10 @@ discard block |
||
| 672 | 712 | echo ' |
| 673 | 713 | <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">'; |
| 674 | 714 | |
| 675 | - if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
|
| 676 | - echo |
|
| 715 | + if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) { |
|
| 716 | + echo |
|
| 677 | 717 | $message['modified']['last_edit_text']; |
| 718 | + } |
|
| 678 | 719 | |
| 679 | 720 | echo ' |
| 680 | 721 | </span> |
@@ -683,22 +724,24 @@ discard block |
||
| 683 | 724 | </div>'; |
| 684 | 725 | |
| 685 | 726 | // Ignoring this user? Hide the post. |
| 686 | - if ($ignoring) |
|
| 687 | - echo ' |
|
| 727 | + if ($ignoring) { |
|
| 728 | + echo ' |
|
| 688 | 729 | <div id="msg_', $message['id'], '_ignored_prompt"> |
| 689 | 730 | ', $txt['ignoring_user'], ' |
| 690 | 731 | <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a> |
| 691 | 732 | </div>'; |
| 733 | + } |
|
| 692 | 734 | |
| 693 | 735 | // Show the post itself, finally! |
| 694 | 736 | echo ' |
| 695 | 737 | <div class="post">'; |
| 696 | 738 | |
| 697 | - if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) |
|
| 698 | - echo ' |
|
| 739 | + if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) { |
|
| 740 | + echo ' |
|
| 699 | 741 | <div class="approve_post"> |
| 700 | 742 | ', $txt['post_awaiting_approval'], ' |
| 701 | 743 | </div>'; |
| 744 | + } |
|
| 702 | 745 | echo ' |
| 703 | 746 | <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div> |
| 704 | 747 | </div>'; |
@@ -715,9 +758,9 @@ discard block |
||
| 715 | 758 | foreach ($message['attachment'] as $attachment) |
| 716 | 759 | { |
| 717 | 760 | // Do we want this attachment to not be showed here? |
| 718 | - if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) |
|
| 719 | - continue; |
|
| 720 | - elseif (!$div_output) |
|
| 761 | + if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) { |
|
| 762 | + continue; |
|
| 763 | + } elseif (!$div_output) |
|
| 721 | 764 | { |
| 722 | 765 | $div_output = true; |
| 723 | 766 | |
@@ -733,9 +776,10 @@ discard block |
||
| 733 | 776 | <fieldset> |
| 734 | 777 | <legend>', $txt['attach_awaiting_approve']; |
| 735 | 778 | |
| 736 | - if ($context['can_approve']) |
|
| 737 | - echo ' |
|
| 779 | + if ($context['can_approve']) { |
|
| 780 | + echo ' |
|
| 738 | 781 | [<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]'; |
| 782 | + } |
|
| 739 | 783 | |
| 740 | 784 | echo ' |
| 741 | 785 | </legend>'; |
@@ -749,12 +793,13 @@ discard block |
||
| 749 | 793 | echo ' |
| 750 | 794 | <div class="attachments_top">'; |
| 751 | 795 | |
| 752 | - if ($attachment['thumbnail']['has_thumb']) |
|
| 753 | - echo ' |
|
| 796 | + if ($attachment['thumbnail']['has_thumb']) { |
|
| 797 | + echo ' |
|
| 754 | 798 | <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>'; |
| 755 | - else |
|
| 756 | - echo ' |
|
| 799 | + } else { |
|
| 800 | + echo ' |
|
| 757 | 801 | <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">'; |
| 802 | + } |
|
| 758 | 803 | |
| 759 | 804 | echo ' |
| 760 | 805 | </div>'; |
@@ -764,9 +809,10 @@ discard block |
||
| 764 | 809 | <div class="attachments_bot"> |
| 765 | 810 | <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*"> ' . $attachment['name'] . '</a> '; |
| 766 | 811 | |
| 767 | - if (!$attachment['is_approved'] && $context['can_approve']) |
|
| 768 | - echo ' |
|
| 812 | + if (!$attachment['is_approved'] && $context['can_approve']) { |
|
| 813 | + echo ' |
|
| 769 | 814 | [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>] | [<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] '; |
| 815 | + } |
|
| 770 | 816 | echo ' |
| 771 | 817 | <br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), ' |
| 772 | 818 | </div>'; |
@@ -775,33 +821,38 @@ discard block |
||
| 775 | 821 | </div>'; |
| 776 | 822 | |
| 777 | 823 | // Next attachment line ? |
| 778 | - if (++$i % $attachments_per_line === 0) |
|
| 779 | - echo ' |
|
| 824 | + if (++$i % $attachments_per_line === 0) { |
|
| 825 | + echo ' |
|
| 780 | 826 | <br>'; |
| 827 | + } |
|
| 781 | 828 | } |
| 782 | 829 | |
| 783 | 830 | // If we had unapproved attachments clean up. |
| 784 | - if ($last_approved_state == 0) |
|
| 785 | - echo ' |
|
| 831 | + if ($last_approved_state == 0) { |
|
| 832 | + echo ' |
|
| 786 | 833 | </fieldset>'; |
| 834 | + } |
|
| 787 | 835 | |
| 788 | 836 | // Only do this if we output a div above - otherwise it'll break things |
| 789 | - if ($div_output) |
|
| 790 | - echo ' |
|
| 837 | + if ($div_output) { |
|
| 838 | + echo ' |
|
| 791 | 839 | </div>'; |
| 840 | + } |
|
| 792 | 841 | } |
| 793 | 842 | |
| 794 | 843 | // And stuff below the attachments. |
| 795 | - if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
| 796 | - echo ' |
|
| 844 | + if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
| 845 | + echo ' |
|
| 797 | 846 | <div class="under_message">'; |
| 847 | + } |
|
| 798 | 848 | |
| 799 | 849 | // Maybe they want to report this post to the moderator(s)? |
| 800 | - if ($context['can_report_moderator']) |
|
| 801 | - echo ' |
|
| 850 | + if ($context['can_report_moderator']) { |
|
| 851 | + echo ' |
|
| 802 | 852 | <ul class="floatright smalltext"> |
| 803 | 853 | <li class="report_link"><a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a></li> |
| 804 | 854 | </ul>'; |
| 855 | + } |
|
| 805 | 856 | |
| 806 | 857 | // What about likes? |
| 807 | 858 | if (!empty($modSettings['enable_likes'])) |
@@ -842,78 +893,91 @@ discard block |
||
| 842 | 893 | <ul class="quickbuttons">'; |
| 843 | 894 | |
| 844 | 895 | // Can they quote? if so they can select and quote as well! |
| 845 | - if ($context['can_quote']) |
|
| 846 | - echo ' |
|
| 896 | + if ($context['can_quote']) { |
|
| 897 | + echo ' |
|
| 847 | 898 | <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li> |
| 848 | 899 | <li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'], '</a></li>'; |
| 900 | + } |
|
| 849 | 901 | |
| 850 | 902 | // Can the user modify the contents of this post? Show the modify inline image. |
| 851 | - if ($message['can_modify']) |
|
| 852 | - echo ' |
|
| 903 | + if ($message['can_modify']) { |
|
| 904 | + echo ' |
|
| 853 | 905 | <li class="quick_edit"><a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a></li>'; |
| 906 | + } |
|
| 854 | 907 | |
| 855 | - if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
| 856 | - echo ' |
|
| 908 | + if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
| 909 | + echo ' |
|
| 857 | 910 | <li class="post_options">', $txt['post_options']; |
| 911 | + } |
|
| 858 | 912 | |
| 859 | 913 | echo ' |
| 860 | 914 | <ul>'; |
| 861 | 915 | |
| 862 | 916 | // Can the user modify the contents of this post? |
| 863 | - if ($message['can_modify']) |
|
| 864 | - echo ' |
|
| 917 | + if ($message['can_modify']) { |
|
| 918 | + echo ' |
|
| 865 | 919 | <li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>'; |
| 920 | + } |
|
| 866 | 921 | |
| 867 | 922 | // How about... even... remove it entirely?! |
| 868 | - if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) |
|
| 869 | - echo ' |
|
| 923 | + if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) { |
|
| 924 | + echo ' |
|
| 870 | 925 | <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'], '</a></li>'; |
| 871 | - elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) |
|
| 872 | - echo ' |
|
| 926 | + } elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) { |
|
| 927 | + echo ' |
|
| 873 | 928 | <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
| 929 | + } |
|
| 874 | 930 | |
| 875 | 931 | // What about splitting it off the rest of the topic? |
| 876 | - if ($context['can_split'] && !empty($context['real_num_replies'])) |
|
| 877 | - echo ' |
|
| 932 | + if ($context['can_split'] && !empty($context['real_num_replies'])) { |
|
| 933 | + echo ' |
|
| 878 | 934 | <li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>'; |
| 935 | + } |
|
| 879 | 936 | |
| 880 | 937 | // Can we issue a warning because of this post? Remember, we can't give guests warnings. |
| 881 | - if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) |
|
| 882 | - echo ' |
|
| 938 | + if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) { |
|
| 939 | + echo ' |
|
| 883 | 940 | <li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>'; |
| 941 | + } |
|
| 884 | 942 | |
| 885 | 943 | // Can we restore topics? |
| 886 | - if ($context['can_restore_msg']) |
|
| 887 | - echo ' |
|
| 944 | + if ($context['can_restore_msg']) { |
|
| 945 | + echo ' |
|
| 888 | 946 | <li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>'; |
| 947 | + } |
|
| 889 | 948 | |
| 890 | 949 | // Maybe we can approve it, maybe we should? |
| 891 | - if ($message['can_approve']) |
|
| 892 | - echo ' |
|
| 950 | + if ($message['can_approve']) { |
|
| 951 | + echo ' |
|
| 893 | 952 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>'; |
| 953 | + } |
|
| 894 | 954 | |
| 895 | 955 | // Maybe we can unapprove it? |
| 896 | - if ($message['can_unapprove']) |
|
| 897 | - echo ' |
|
| 956 | + if ($message['can_unapprove']) { |
|
| 957 | + echo ' |
|
| 898 | 958 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>'; |
| 959 | + } |
|
| 899 | 960 | |
| 900 | 961 | echo ' |
| 901 | 962 | </ul> |
| 902 | 963 | </li>'; |
| 903 | 964 | |
| 904 | 965 | // Show a checkbox for quick moderation? |
| 905 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) |
|
| 906 | - echo ' |
|
| 966 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) { |
|
| 967 | + echo ' |
|
| 907 | 968 | <li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>'; |
| 969 | + } |
|
| 908 | 970 | |
| 909 | - if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
| 910 | - echo ' |
|
| 971 | + if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
| 972 | + echo ' |
|
| 911 | 973 | </ul>'; |
| 974 | + } |
|
| 912 | 975 | } |
| 913 | 976 | |
| 914 | - if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
| 915 | - echo ' |
|
| 977 | + if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
| 978 | + echo ' |
|
| 916 | 979 | </div>'; |
| 980 | + } |
|
| 917 | 981 | |
| 918 | 982 | echo ' |
| 919 | 983 | </div> |
@@ -926,9 +990,10 @@ discard block |
||
| 926 | 990 | <div class="custom_fields_above_signature"> |
| 927 | 991 | <ul class="nolist">'; |
| 928 | 992 | |
| 929 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
| 930 | - echo ' |
|
| 993 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
| 994 | + echo ' |
|
| 931 | 995 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 996 | + } |
|
| 932 | 997 | |
| 933 | 998 | echo ' |
| 934 | 999 | </ul> |
@@ -936,9 +1001,10 @@ discard block |
||
| 936 | 1001 | } |
| 937 | 1002 | |
| 938 | 1003 | // Show the member's signature? |
| 939 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
| 940 | - echo ' |
|
| 1004 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
| 1005 | + echo ' |
|
| 941 | 1006 | <div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>'; |
| 1007 | + } |
|
| 942 | 1008 | |
| 943 | 1009 | |
| 944 | 1010 | // Are there any custom profile fields for below the signature? |
@@ -948,9 +1014,10 @@ discard block |
||
| 948 | 1014 | <div class="custom_fields_below_signature"> |
| 949 | 1015 | <ul class="nolist">'; |
| 950 | 1016 | |
| 951 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
| 952 | - echo ' |
|
| 1017 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
| 1018 | + echo ' |
|
| 953 | 1019 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 1020 | + } |
|
| 954 | 1021 | |
| 955 | 1022 | echo ' |
| 956 | 1023 | </ul> |
@@ -998,8 +1065,8 @@ discard block |
||
| 998 | 1065 | <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">'; |
| 999 | 1066 | |
| 1000 | 1067 | // Guests just need more. |
| 1001 | - if ($context['user']['is_guest']) |
|
| 1002 | - echo ' |
|
| 1068 | + if ($context['user']['is_guest']) { |
|
| 1069 | + echo ' |
|
| 1003 | 1070 | <dl id="post_header"> |
| 1004 | 1071 | <dt> |
| 1005 | 1072 | ', $txt['name'], ': |
@@ -1014,6 +1081,7 @@ discard block |
||
| 1014 | 1081 | <input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" required> |
| 1015 | 1082 | </dd> |
| 1016 | 1083 | </dl>'; |
| 1084 | + } |
|
| 1017 | 1085 | |
| 1018 | 1086 | echo ' |
| 1019 | 1087 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), ' |
@@ -1061,8 +1129,8 @@ discard block |
||
| 1061 | 1129 | <br class="clear">'; |
| 1062 | 1130 | |
| 1063 | 1131 | // draft autosave available and the user has it enabled? |
| 1064 | - if (!empty($context['drafts_autosave'])) |
|
| 1065 | - echo ' |
|
| 1132 | + if (!empty($context['drafts_autosave'])) { |
|
| 1133 | + echo ' |
|
| 1066 | 1134 | <script> |
| 1067 | 1135 | var oDraftAutoSave = new smf_DraftAutoSave({ |
| 1068 | 1136 | sSelf: \'oDraftAutoSave\', |
@@ -1074,10 +1142,12 @@ discard block |
||
| 1074 | 1142 | iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), ' |
| 1075 | 1143 | }); |
| 1076 | 1144 | </script>'; |
| 1145 | + } |
|
| 1077 | 1146 | |
| 1078 | - if ($context['show_spellchecking']) |
|
| 1079 | - echo ' |
|
| 1147 | + if ($context['show_spellchecking']) { |
|
| 1148 | + echo ' |
|
| 1080 | 1149 | <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value=""></form>'; |
| 1150 | + } |
|
| 1081 | 1151 | |
| 1082 | 1152 | echo ' |
| 1083 | 1153 | <script> |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | |
| 119 | 119 | // Right, image not cached? Simply redirect, then. |
| 120 | 120 | if (!$response) |
| 121 | - redirectexit($request); |
|
| 121 | + redirectexit($request); |
|
| 122 | 122 | |
| 123 | 123 | // Make sure we're serving an image |
| 124 | 124 | $contentParts = explode('/', !empty($cached['content_type']) ? $cached['content_type'] : ''); |
@@ -63,26 +63,31 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function checkRequest() |
| 65 | 65 | { |
| 66 | - if (!$this->enabled) |
|
| 67 | - return false; |
|
| 66 | + if (!$this->enabled) { |
|
| 67 | + return false; |
|
| 68 | + } |
|
| 68 | 69 | |
| 69 | 70 | // Try to create the image cache directory if it doesn't exist |
| 70 | - if (!file_exists($this->cache)) |
|
| 71 | - if (!mkdir($this->cache) || !copy(dirname($this->cache) . '/index.php', $this->cache . '/index.php')) |
|
| 71 | + if (!file_exists($this->cache)) { |
|
| 72 | + if (!mkdir($this->cache) || !copy(dirname($this->cache) . '/index.php', $this->cache . '/index.php')) |
|
| 72 | 73 | return false; |
| 74 | + } |
|
| 73 | 75 | |
| 74 | - if (empty($_GET['hash']) || empty($_GET['request'])) |
|
| 75 | - return false; |
|
| 76 | + if (empty($_GET['hash']) || empty($_GET['request'])) { |
|
| 77 | + return false; |
|
| 78 | + } |
|
| 76 | 79 | |
| 77 | 80 | $hash = $_GET['hash']; |
| 78 | 81 | $request = $_GET['request']; |
| 79 | 82 | |
| 80 | - if (md5($request . $this->secret) != $hash) |
|
| 81 | - return false; |
|
| 83 | + if (md5($request . $this->secret) != $hash) { |
|
| 84 | + return false; |
|
| 85 | + } |
|
| 82 | 86 | |
| 83 | 87 | // Attempt to cache the request if it doesn't exist |
| 84 | - if (!$this->isCached($request)) |
|
| 85 | - return $this->cacheImage($request); |
|
| 88 | + if (!$this->isCached($request)) { |
|
| 89 | + return $this->cacheImage($request); |
|
| 90 | + } |
|
| 86 | 91 | |
| 87 | 92 | return true; |
| 88 | 93 | } |
@@ -111,19 +116,22 @@ discard block |
||
| 111 | 116 | if (!$cached || time() - $cached['time'] > (5 * 86400)) |
| 112 | 117 | { |
| 113 | 118 | @unlink($cached_file); |
| 114 | - if ($this->checkRequest()) |
|
| 115 | - $this->serve(); |
|
| 119 | + if ($this->checkRequest()) { |
|
| 120 | + $this->serve(); |
|
| 121 | + } |
|
| 116 | 122 | redirectexit($request); |
| 117 | 123 | } |
| 118 | 124 | |
| 119 | 125 | // Right, image not cached? Simply redirect, then. |
| 120 | - if (!$response) |
|
| 121 | - redirectexit($request); |
|
| 126 | + if (!$response) { |
|
| 127 | + redirectexit($request); |
|
| 128 | + } |
|
| 122 | 129 | |
| 123 | 130 | // Make sure we're serving an image |
| 124 | 131 | $contentParts = explode('/', !empty($cached['content_type']) ? $cached['content_type'] : ''); |
| 125 | - if ($contentParts[0] != 'image') |
|
| 126 | - exit; |
|
| 132 | + if ($contentParts[0] != 'image') { |
|
| 133 | + exit; |
|
| 134 | + } |
|
| 127 | 135 | |
| 128 | 136 | header('Content-type: ' . $cached['content_type']); |
| 129 | 137 | header('Content-length: ' . $cached['size']); |
@@ -170,8 +178,9 @@ discard block |
||
| 170 | 178 | $responseCode = $request->result('code'); |
| 171 | 179 | $response = $request->result(); |
| 172 | 180 | |
| 173 | - if (empty($response)) |
|
| 174 | - return false; |
|
| 181 | + if (empty($response)) { |
|
| 182 | + return false; |
|
| 183 | + } |
|
| 175 | 184 | |
| 176 | 185 | if ($responseCode != 200) { |
| 177 | 186 | return $request->result('code'); |
@@ -181,12 +190,14 @@ discard block |
||
| 181 | 190 | |
| 182 | 191 | // Make sure the url is returning an image |
| 183 | 192 | $contentParts = explode('/', !empty($headers['content-type']) ? $headers['content-type'] : ''); |
| 184 | - if ($contentParts[0] != 'image') |
|
| 185 | - return false; |
|
| 193 | + if ($contentParts[0] != 'image') { |
|
| 194 | + return false; |
|
| 195 | + } |
|
| 186 | 196 | |
| 187 | 197 | // Validate the filesize |
| 188 | - if ($response['size'] > ($this->maxSize * 1024)) |
|
| 189 | - return false; |
|
| 198 | + if ($response['size'] > ($this->maxSize * 1024)) { |
|
| 199 | + return false; |
|
| 200 | + } |
|
| 190 | 201 | |
| 191 | 202 | return file_put_contents($dest, json_encode(array( |
| 192 | 203 | 'content_type' => $headers['content-type'], |
@@ -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 | * Shows an avatar based on $_GET['attach'] |
@@ -35,11 +36,11 @@ discard block |
||
| 35 | 36 | |
| 36 | 37 | if (!empty($modSettings['enableCompressedOutput']) && !headers_sent() && ob_get_length() == 0) |
| 37 | 38 | { |
| 38 | - if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler') |
|
| 39 | - $modSettings['enableCompressedOutput'] = 0; |
|
| 40 | - |
|
| 41 | - else |
|
| 42 | - ob_start('ob_gzhandler'); |
|
| 39 | + if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler') { |
|
| 40 | + $modSettings['enableCompressedOutput'] = 0; |
|
| 41 | + } else { |
|
| 42 | + ob_start('ob_gzhandler'); |
|
| 43 | + } |
|
| 43 | 44 | } |
| 44 | 45 | |
| 45 | 46 | if (empty($modSettings['enableCompressedOutput'])) |
@@ -71,8 +72,9 @@ discard block |
||
| 71 | 72 | } |
| 72 | 73 | |
| 73 | 74 | // Use cache when possible. |
| 74 | - if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null) |
|
| 75 | - list($file, $thumbFile) = $cache; |
|
| 75 | + if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null) { |
|
| 76 | + list($file, $thumbFile) = $cache; |
|
| 77 | + } |
|
| 76 | 78 | |
| 77 | 79 | // Get the info from the DB. |
| 78 | 80 | if (empty($file) || empty($thumbFile) && !empty($file['id_thumb'])) |
@@ -80,10 +82,9 @@ discard block |
||
| 80 | 82 | // Do we have a hook wanting to use our attachment system? We use $attachRequest to prevent accidental usage of $request. |
| 81 | 83 | $attachRequest = null; |
| 82 | 84 | call_integration_hook('integrate_download_request', array(&$attachRequest)); |
| 83 | - if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) |
|
| 84 | - $request = $attachRequest; |
|
| 85 | - |
|
| 86 | - else |
|
| 85 | + if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) { |
|
| 86 | + $request = $attachRequest; |
|
| 87 | + } else |
|
| 87 | 88 | { |
| 88 | 89 | // Make sure this attachment is on this board and load its info while we are at it. |
| 89 | 90 | $request = $smcFunc['db_query']('', ' |
@@ -176,13 +177,15 @@ discard block |
||
| 176 | 177 | } |
| 177 | 178 | |
| 178 | 179 | // Cache it. |
| 179 | - if (!empty($file) || !empty($thumbFile)) |
|
| 180 | - cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900)); |
|
| 180 | + if (!empty($file) || !empty($thumbFile)) { |
|
| 181 | + cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900)); |
|
| 182 | + } |
|
| 181 | 183 | } |
| 182 | 184 | |
| 183 | 185 | // Replace the normal file with its thumbnail if it has one! |
| 184 | - if (!empty($showThumb) && !empty($thumbFile)) |
|
| 185 | - $file = $thumbFile; |
|
| 186 | + if (!empty($showThumb) && !empty($thumbFile)) { |
|
| 187 | + $file = $thumbFile; |
|
| 188 | + } |
|
| 186 | 189 | |
| 187 | 190 | // No point in a nicer message, because this is supposed to be an attachment anyway... |
| 188 | 191 | if (!file_exists($file['filePath'])) |
@@ -232,8 +235,8 @@ discard block |
||
| 232 | 235 | } |
| 233 | 236 | |
| 234 | 237 | // Update the download counter (unless it's a thumbnail or resuming an incomplete download). |
| 235 | - if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0) |
|
| 236 | - $smcFunc['db_query']('attach_download_increase', ' |
|
| 238 | + if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0) { |
|
| 239 | + $smcFunc['db_query']('attach_download_increase', ' |
|
| 237 | 240 | UPDATE LOW_PRIORITY {db_prefix}attachments |
| 238 | 241 | SET downloads = downloads + 1 |
| 239 | 242 | WHERE id_attach = {int:id_attach}', |
@@ -241,12 +244,14 @@ discard block |
||
| 241 | 244 | 'id_attach' => $attachId, |
| 242 | 245 | ) |
| 243 | 246 | ); |
| 247 | + } |
|
| 244 | 248 | |
| 245 | 249 | // Send the attachment headers. |
| 246 | 250 | header('Pragma: '); |
| 247 | 251 | |
| 248 | - if (!isBrowser('gecko')) |
|
| 249 | - header('Content-Transfer-Encoding: binary'); |
|
| 252 | + if (!isBrowser('gecko')) { |
|
| 253 | + header('Content-Transfer-Encoding: binary'); |
|
| 254 | + } |
|
| 250 | 255 | |
| 251 | 256 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT'); |
| 252 | 257 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file['filePath'])) . ' GMT'); |
@@ -255,18 +260,19 @@ discard block |
||
| 255 | 260 | header('ETag: ' . $eTag); |
| 256 | 261 | |
| 257 | 262 | // Make sure the mime type warrants an inline display. |
| 258 | - if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0) |
|
| 259 | - unset($_REQUEST['image']); |
|
| 263 | + if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0) { |
|
| 264 | + unset($_REQUEST['image']); |
|
| 265 | + } |
|
| 260 | 266 | |
| 261 | 267 | // Does this have a mime type? |
| 262 | - elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) |
|
| 263 | - header('Content-Type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp'))); |
|
| 264 | - |
|
| 265 | - else |
|
| 268 | + elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) { |
|
| 269 | + header('Content-Type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp'))); |
|
| 270 | + } else |
|
| 266 | 271 | { |
| 267 | 272 | header('Content-Type: ' . (isBrowser('ie') || isBrowser('opera') ? 'application/octetstream' : 'application/octet-stream')); |
| 268 | - if (isset($_REQUEST['image'])) |
|
| 269 | - unset($_REQUEST['image']); |
|
| 273 | + if (isset($_REQUEST['image'])) { |
|
| 274 | + unset($_REQUEST['image']); |
|
| 275 | + } |
|
| 270 | 276 | } |
| 271 | 277 | |
| 272 | 278 | // Convert the file to UTF-8, cuz most browsers dig that. |
@@ -274,24 +280,22 @@ discard block |
||
| 274 | 280 | $disposition = !isset($_REQUEST['image']) ? 'attachment' : 'inline'; |
| 275 | 281 | |
| 276 | 282 | // Different browsers like different standards... |
| 277 | - if (isBrowser('firefox')) |
|
| 278 | - header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name))); |
|
| 279 | - |
|
| 280 | - elseif (isBrowser('opera')) |
|
| 281 | - header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"'); |
|
| 282 | - |
|
| 283 | - elseif (isBrowser('ie')) |
|
| 284 | - header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"'); |
|
| 285 | - |
|
| 286 | - else |
|
| 287 | - header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"'); |
|
| 283 | + if (isBrowser('firefox')) { |
|
| 284 | + header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name))); |
|
| 285 | + } elseif (isBrowser('opera')) { |
|
| 286 | + header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"'); |
|
| 287 | + } elseif (isBrowser('ie')) { |
|
| 288 | + header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"'); |
|
| 289 | + } else { |
|
| 290 | + header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"'); |
|
| 291 | + } |
|
| 288 | 292 | |
| 289 | 293 | // If this has an "image extension" - but isn't actually an image - then ensure it isn't cached cause of silly IE. |
| 290 | - if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) |
|
| 291 | - header('Cache-Control: no-cache'); |
|
| 292 | - |
|
| 293 | - else |
|
| 294 | - header('Cache-Control: max-age=' . (525600 * 60) . ', private'); |
|
| 294 | + if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) { |
|
| 295 | + header('Cache-Control: no-cache'); |
|
| 296 | + } else { |
|
| 297 | + header('Cache-Control: max-age=' . (525600 * 60) . ', private'); |
|
| 298 | + } |
|
| 295 | 299 | |
| 296 | 300 | // Multipart and resuming support |
| 297 | 301 | if (isset($_SERVER['HTTP_RANGE'])) |
@@ -299,9 +303,9 @@ discard block |
||
| 299 | 303 | header("HTTP/1.1 206 Partial Content"); |
| 300 | 304 | header("Content-Length: $new_length"); |
| 301 | 305 | header("Content-Range: bytes $range-$range_end/$size"); |
| 306 | + } else { |
|
| 307 | + header("Content-Length: " . $size); |
|
| 302 | 308 | } |
| 303 | - else |
|
| 304 | - header("Content-Length: " . $size); |
|
| 305 | 309 | |
| 306 | 310 | |
| 307 | 311 | // Try to buy some time... |
@@ -310,8 +314,9 @@ discard block |
||
| 310 | 314 | // For multipart/resumable downloads, send the requested chunk(s) of the file |
| 311 | 315 | if (isset($_SERVER['HTTP_RANGE'])) |
| 312 | 316 | { |
| 313 | - while (@ob_get_level() > 0) |
|
| 314 | - @ob_end_clean(); |
|
| 317 | + while (@ob_get_level() > 0) { |
|
| 318 | + @ob_end_clean(); |
|
| 319 | + } |
|
| 315 | 320 | |
| 316 | 321 | // 40 kilobytes is a good-ish amount |
| 317 | 322 | $chunksize = 40 * 1024; |
@@ -335,8 +340,9 @@ discard block |
||
| 335 | 340 | elseif ($size > 4194304) |
| 336 | 341 | { |
| 337 | 342 | // Forcibly end any output buffering going on. |
| 338 | - while (@ob_get_level() > 0) |
|
| 339 | - @ob_end_clean(); |
|
| 343 | + while (@ob_get_level() > 0) { |
|
| 344 | + @ob_end_clean(); |
|
| 345 | + } |
|
| 340 | 346 | |
| 341 | 347 | $fp = fopen($file['filePath'], 'rb'); |
| 342 | 348 | while (!feof($fp)) |
@@ -348,8 +354,9 @@ discard block |
||
| 348 | 354 | } |
| 349 | 355 | |
| 350 | 356 | // On some of the less-bright hosts, readfile() is disabled. It's just a faster, more byte safe, version of what's in the if. |
| 351 | - elseif (@readfile($file['filePath']) === null) |
|
| 352 | - echo file_get_contents($file['filePath']); |
|
| 357 | + elseif (@readfile($file['filePath']) === null) { |
|
| 358 | + echo file_get_contents($file['filePath']); |
|
| 359 | + } |
|
| 353 | 360 | |
| 354 | 361 | die(); |
| 355 | 362 | } |