@@ -80,7 +80,7 @@ |
||
| 80 | 80 | /** |
| 81 | 81 | * Handles retrieving previews of news items, newsletters, signatures and warnings. |
| 82 | 82 | * Calls the appropriate function based on $_POST['item'] |
| 83 | - * @return void|bool Returns false if $_POST['item'] isn't set or isn't valid |
|
| 83 | + * @return false|null Returns false if $_POST['item'] isn't set or isn't valid |
|
| 84 | 84 | */ |
| 85 | 85 | function RetrievePreview() |
| 86 | 86 | { |
@@ -272,13 +272,13 @@ |
||
| 272 | 272 | $context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body']; |
| 273 | 273 | // Add in few replacements. |
| 274 | 274 | /** |
| 275 | - * These are the defaults: |
|
| 276 | - * - {MEMBER} - Member Name. => current user for review |
|
| 277 | - * - {MESSAGE} - Link to Offending Post. (If Applicable) => not applicable here, so not replaced |
|
| 278 | - * - {FORUMNAME} - Forum Name. |
|
| 279 | - * - {SCRIPTURL} - Web address of forum. |
|
| 280 | - * - {REGARDS} - Standard email sign-off. |
|
| 281 | - */ |
|
| 275 | + * These are the defaults: |
|
| 276 | + * - {MEMBER} - Member Name. => current user for review |
|
| 277 | + * - {MESSAGE} - Link to Offending Post. (If Applicable) => not applicable here, so not replaced |
|
| 278 | + * - {FORUMNAME} - Forum Name. |
|
| 279 | + * - {SCRIPTURL} - Web address of forum. |
|
| 280 | + * - {REGARDS} - Standard email sign-off. |
|
| 281 | + */ |
|
| 282 | 282 | $find = array( |
| 283 | 283 | '{MEMBER}', |
| 284 | 284 | '{FORUMNAME}', |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | require_once($sourcedir . '/Subs-Post.php'); |
| 112 | 112 | |
| 113 | 113 | $errors = array(); |
| 114 | - $news = !isset($_POST['news'])? '' : $smcFunc['htmlspecialchars']($_POST['news'], ENT_QUOTES); |
|
| 114 | + $news = !isset($_POST['news']) ? '' : $smcFunc['htmlspecialchars']($_POST['news'], ENT_QUOTES); |
|
| 115 | 115 | if (empty($news)) |
| 116 | 116 | $errors[] = array('value' => 'no_news'); |
| 117 | 117 | else |
@@ -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 | * The main handler and designator for AJAX stuff - jumpto, message icons and previews |
@@ -32,8 +33,9 @@ discard block |
||
| 32 | 33 | // Easy adding of sub actions. |
| 33 | 34 | call_integration_hook('integrate_XMLhttpMain_subActions', array(&$subActions)); |
| 34 | 35 | |
| 35 | - if (!isset($_REQUEST['sa'], $subActions[$_REQUEST['sa']])) |
|
| 36 | - fatal_lang_error('no_access', false); |
|
| 36 | + if (!isset($_REQUEST['sa'], $subActions[$_REQUEST['sa']])) { |
|
| 37 | + fatal_lang_error('no_access', false); |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | call_helper($subActions[$_REQUEST['sa']]); |
| 39 | 41 | } |
@@ -57,8 +59,9 @@ discard block |
||
| 57 | 59 | foreach ($context['jump_to'] as $id_cat => $cat) |
| 58 | 60 | { |
| 59 | 61 | $context['jump_to'][$id_cat]['name'] = un_htmlspecialchars(strip_tags($cat['name'])); |
| 60 | - foreach ($cat['boards'] as $id_board => $board) |
|
| 61 | - $context['jump_to'][$id_cat]['boards'][$id_board]['name'] = un_htmlspecialchars(strip_tags($board['name'])); |
|
| 62 | + foreach ($cat['boards'] as $id_board => $board) { |
|
| 63 | + $context['jump_to'][$id_cat]['boards'][$id_board]['name'] = un_htmlspecialchars(strip_tags($board['name'])); |
|
| 64 | + } |
|
| 62 | 65 | } |
| 63 | 66 | |
| 64 | 67 | $context['sub_template'] = 'jump_to'; |
@@ -95,8 +98,9 @@ discard block |
||
| 95 | 98 | |
| 96 | 99 | $context['sub_template'] = 'generic_xml'; |
| 97 | 100 | |
| 98 | - if (!isset($_POST['item']) || !in_array($_POST['item'], $items)) |
|
| 99 | - return false; |
|
| 101 | + if (!isset($_POST['item']) || !in_array($_POST['item'], $items)) { |
|
| 102 | + return false; |
|
| 103 | + } |
|
| 100 | 104 | |
| 101 | 105 | $_POST['item'](); |
| 102 | 106 | } |
@@ -112,10 +116,11 @@ discard block |
||
| 112 | 116 | |
| 113 | 117 | $errors = array(); |
| 114 | 118 | $news = !isset($_POST['news'])? '' : $smcFunc['htmlspecialchars']($_POST['news'], ENT_QUOTES); |
| 115 | - if (empty($news)) |
|
| 116 | - $errors[] = array('value' => 'no_news'); |
|
| 117 | - else |
|
| 118 | - preparsecode($news); |
|
| 119 | + if (empty($news)) { |
|
| 120 | + $errors[] = array('value' => 'no_news'); |
|
| 121 | + } else { |
|
| 122 | + preparsecode($news); |
|
| 123 | + } |
|
| 119 | 124 | |
| 120 | 125 | $context['xml_data'] = array( |
| 121 | 126 | 'news' => array( |
@@ -148,10 +153,12 @@ discard block |
||
| 148 | 153 | $context['send_pm'] = !empty($_POST['send_pm']) ? 1 : 0; |
| 149 | 154 | $context['send_html'] = !empty($_POST['send_html']) ? 1 : 0; |
| 150 | 155 | |
| 151 | - if (empty($_POST['subject'])) |
|
| 152 | - $context['post_error']['messages'][] = $txt['error_no_subject']; |
|
| 153 | - if (empty($_POST['message'])) |
|
| 154 | - $context['post_error']['messages'][] = $txt['error_no_message']; |
|
| 156 | + if (empty($_POST['subject'])) { |
|
| 157 | + $context['post_error']['messages'][] = $txt['error_no_subject']; |
|
| 158 | + } |
|
| 159 | + if (empty($_POST['message'])) { |
|
| 160 | + $context['post_error']['messages'][] = $txt['error_no_message']; |
|
| 161 | + } |
|
| 155 | 162 | |
| 156 | 163 | prepareMailingForPreview(); |
| 157 | 164 | |
@@ -196,38 +203,41 @@ discard block |
||
| 196 | 203 | $preview_signature = !empty($_POST['signature']) ? $_POST['signature'] : $txt['no_signature_preview']; |
| 197 | 204 | $validation = profileValidateSignature($preview_signature); |
| 198 | 205 | |
| 199 | - if ($validation !== true && $validation !== false) |
|
| 200 | - $errors[] = array('value' => $txt['profile_error_' . $validation], 'attributes' => array('type' => 'error')); |
|
| 206 | + if ($validation !== true && $validation !== false) { |
|
| 207 | + $errors[] = array('value' => $txt['profile_error_' . $validation], 'attributes' => array('type' => 'error')); |
|
| 208 | + } |
|
| 201 | 209 | |
| 202 | 210 | censorText($preview_signature); |
| 203 | 211 | $preview_signature = parse_bbc($preview_signature, true, 'sig' . $user); |
| 204 | - } |
|
| 205 | - elseif (!$can_change) |
|
| 212 | + } elseif (!$can_change) |
|
| 206 | 213 | { |
| 207 | - if ($is_owner) |
|
| 208 | - $errors[] = array('value' => $txt['cannot_profile_extra_own'], 'attributes' => array('type' => 'error')); |
|
| 209 | - else |
|
| 210 | - $errors[] = array('value' => $txt['cannot_profile_extra_any'], 'attributes' => array('type' => 'error')); |
|
| 214 | + if ($is_owner) { |
|
| 215 | + $errors[] = array('value' => $txt['cannot_profile_extra_own'], 'attributes' => array('type' => 'error')); |
|
| 216 | + } else { |
|
| 217 | + $errors[] = array('value' => $txt['cannot_profile_extra_any'], 'attributes' => array('type' => 'error')); |
|
| 218 | + } |
|
| 219 | + } else { |
|
| 220 | + $errors[] = array('value' => $txt['no_user_selected'], 'attributes' => array('type' => 'error')); |
|
| 211 | 221 | } |
| 212 | - else |
|
| 213 | - $errors[] = array('value' => $txt['no_user_selected'], 'attributes' => array('type' => 'error')); |
|
| 214 | 222 | |
| 215 | 223 | $context['xml_data']['signatures'] = array( |
| 216 | 224 | 'identifier' => 'signature', |
| 217 | 225 | 'children' => array() |
| 218 | 226 | ); |
| 219 | - if (isset($current_signature)) |
|
| 220 | - $context['xml_data']['signatures']['children'][] = array( |
|
| 227 | + if (isset($current_signature)) { |
|
| 228 | + $context['xml_data']['signatures']['children'][] = array( |
|
| 221 | 229 | 'value' => $current_signature, |
| 222 | 230 | 'attributes' => array('type' => 'current'), |
| 223 | 231 | ); |
| 224 | - if (isset($preview_signature)) |
|
| 225 | - $context['xml_data']['signatures']['children'][] = array( |
|
| 232 | + } |
|
| 233 | + if (isset($preview_signature)) { |
|
| 234 | + $context['xml_data']['signatures']['children'][] = array( |
|
| 226 | 235 | 'value' => $preview_signature, |
| 227 | 236 | 'attributes' => array('type' => 'preview'), |
| 228 | 237 | ); |
| 229 | - if (!empty($errors)) |
|
| 230 | - $context['xml_data']['errors'] = array( |
|
| 238 | + } |
|
| 239 | + if (!empty($errors)) { |
|
| 240 | + $context['xml_data']['errors'] = array( |
|
| 231 | 241 | 'identifier' => 'error', |
| 232 | 242 | 'children' => array_merge( |
| 233 | 243 | array( |
@@ -239,7 +249,8 @@ discard block |
||
| 239 | 249 | $errors |
| 240 | 250 | ), |
| 241 | 251 | ); |
| 242 | -} |
|
| 252 | + } |
|
| 253 | + } |
|
| 243 | 254 | |
| 244 | 255 | /** |
| 245 | 256 | * Handles previewing user warnings |
@@ -261,15 +272,17 @@ discard block |
||
| 261 | 272 | $context['preview_subject'] = !empty($_POST['title']) ? trim($smcFunc['htmlspecialchars']($_POST['title'])) : ''; |
| 262 | 273 | if (isset($_POST['issuing'])) |
| 263 | 274 | { |
| 264 | - if (empty($_POST['title']) || empty($_POST['body'])) |
|
| 265 | - $context['post_error']['messages'][] = $txt['warning_notify_blank']; |
|
| 266 | - } |
|
| 267 | - else |
|
| 275 | + if (empty($_POST['title']) || empty($_POST['body'])) { |
|
| 276 | + $context['post_error']['messages'][] = $txt['warning_notify_blank']; |
|
| 277 | + } |
|
| 278 | + } else |
|
| 268 | 279 | { |
| 269 | - if (empty($_POST['title'])) |
|
| 270 | - $context['post_error']['messages'][] = $txt['mc_warning_template_error_no_title']; |
|
| 271 | - if (empty($_POST['body'])) |
|
| 272 | - $context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body']; |
|
| 280 | + if (empty($_POST['title'])) { |
|
| 281 | + $context['post_error']['messages'][] = $txt['mc_warning_template_error_no_title']; |
|
| 282 | + } |
|
| 283 | + if (empty($_POST['body'])) { |
|
| 284 | + $context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body']; |
|
| 285 | + } |
|
| 273 | 286 | // Add in few replacements. |
| 274 | 287 | /** |
| 275 | 288 | * These are the defaults: |
@@ -300,9 +313,9 @@ discard block |
||
| 300 | 313 | $warning_body = parse_bbc($warning_body, true); |
| 301 | 314 | } |
| 302 | 315 | $context['preview_message'] = $warning_body; |
| 316 | + } else { |
|
| 317 | + $context['post_error']['messages'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error')); |
|
| 303 | 318 | } |
| 304 | - else |
|
| 305 | - $context['post_error']['messages'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error')); |
|
| 306 | 319 | |
| 307 | 320 | $context['sub_template'] = 'warning'; |
| 308 | 321 | } |
@@ -1717,7 +1717,7 @@ discard block |
||
| 1717 | 1717 | /** |
| 1718 | 1718 | * Show today's birthdays. |
| 1719 | 1719 | * @param string $output_method The output method. If 'echo', displays a list of users, otherwise returns an array of info about them. |
| 1720 | - * @return void|array Displays a list of users or returns an array of info about them depending on output_method. |
|
| 1720 | + * @return null|string Displays a list of users or returns an array of info about them depending on output_method. |
|
| 1721 | 1721 | */ |
| 1722 | 1722 | function ssi_todaysBirthdays($output_method = 'echo') |
| 1723 | 1723 | { |
@@ -1746,7 +1746,7 @@ discard block |
||
| 1746 | 1746 | /** |
| 1747 | 1747 | * Shows today's holidays. |
| 1748 | 1748 | * @param string $output_method The output method. If 'echo', displays a list of holidays, otherwise returns an array of info about them. |
| 1749 | - * @return void|array Displays a list of holidays or returns an array of info about them depending on output_method |
|
| 1749 | + * @return null|string Displays a list of holidays or returns an array of info about them depending on output_method |
|
| 1750 | 1750 | */ |
| 1751 | 1751 | function ssi_todaysHolidays($output_method = 'echo') |
| 1752 | 1752 | { |
@@ -1773,7 +1773,7 @@ discard block |
||
| 1773 | 1773 | |
| 1774 | 1774 | /** |
| 1775 | 1775 | * @param string $output_method The output method. If 'echo', displays a list of events, otherwise returns an array of info about them. |
| 1776 | - * @return void|array Displays a list of events or returns an array of info about them depending on output_method |
|
| 1776 | + * @return null|string Displays a list of events or returns an array of info about them depending on output_method |
|
| 1777 | 1777 | */ |
| 1778 | 1778 | function ssi_todaysEvents($output_method = 'echo') |
| 1779 | 1779 | { |
@@ -1807,7 +1807,7 @@ discard block |
||
| 1807 | 1807 | /** |
| 1808 | 1808 | * Shows today's calendar items (events, birthdays and holidays) |
| 1809 | 1809 | * @param string $output_method The output method. If 'echo', displays a list of calendar items, otherwise returns an array of info about them. |
| 1810 | - * @return void|array Displays a list of calendar items or returns an array of info about them depending on output_method |
|
| 1810 | + * @return null|string Displays a list of calendar items or returns an array of info about them depending on output_method |
|
| 1811 | 1811 | */ |
| 1812 | 1812 | function ssi_todaysCalendar($output_method = 'echo') |
| 1813 | 1813 | { |
@@ -2198,7 +2198,7 @@ discard block |
||
| 2198 | 2198 | * @param int|string $id The ID or username of a user |
| 2199 | 2199 | * @param string $password The password to check |
| 2200 | 2200 | * @param bool $is_username If true, treats $id as a username rather than a user ID |
| 2201 | - * @return bool Whether or not the password is correct. |
|
| 2201 | + * @return null|boolean Whether or not the password is correct. |
|
| 2202 | 2202 | */ |
| 2203 | 2203 | function ssi_checkPassword($id = null, $password = null, $is_username = false) |
| 2204 | 2204 | { |
@@ -1557,7 +1557,7 @@ discard block |
||
| 1557 | 1557 | |
| 1558 | 1558 | echo ' |
| 1559 | 1559 | </dl>', ($return['allow_view_results'] ? ' |
| 1560 | - <strong>'. $txt['poll_total_voters'] .': '. $return['total_votes'] .'</strong>' : ''), ' |
|
| 1560 | + <strong>'. $txt['poll_total_voters'] . ': ' . $return['total_votes'] . '</strong>' : ''), ' |
|
| 1561 | 1561 | </div>'; |
| 1562 | 1562 | } |
| 1563 | 1563 | } |
@@ -2083,7 +2083,7 @@ discard block |
||
| 2083 | 2083 | $base .= (isset($txt[$base . $count])) ? $count : 'n'; |
| 2084 | 2084 | |
| 2085 | 2085 | echo ' |
| 2086 | - <li class="like_count smalltext">', sprintf($txt[$base], $scripturl . '?action=likes;sa=view;ltype=msg;like=' . $news['message_id'] .';'. $context['session_var'] .'='. $context['session_id'], comma_format($count)), '</li>'; |
|
| 2086 | + <li class="like_count smalltext">', sprintf($txt[$base], $scripturl . '?action=likes;sa=view;ltype=msg;like=' . $news['message_id'] . ';' . $context['session_var'] . '=' . $context['session_id'], comma_format($count)), '</li>'; |
|
| 2087 | 2087 | } |
| 2088 | 2088 | |
| 2089 | 2089 | echo ' |
@@ -2287,7 +2287,7 @@ discard block |
||
| 2287 | 2287 | ), |
| 2288 | 2288 | 'file' => array( |
| 2289 | 2289 | 'filename' => $filename, |
| 2290 | - 'filesize' => round($row['filesize'] /1024, 2) . $txt['kilobyte'], |
|
| 2290 | + 'filesize' => round($row['filesize'] / 1024, 2) . $txt['kilobyte'], |
|
| 2291 | 2291 | 'downloads' => $row['downloads'], |
| 2292 | 2292 | 'href' => $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'], |
| 2293 | 2293 | 'link' => '<img src="' . $settings['images_url'] . '/icons/clip.png" alt=""> <a href="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . '">' . $filename . '</a>', |
@@ -12,8 +12,9 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Don't do anything if SMF is already loaded. |
| 15 | -if (defined('SMF')) |
|
| 15 | +if (defined('SMF')) { |
|
| 16 | 16 | return true; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | define('SMF', 'SSI'); |
| 19 | 20 | |
@@ -26,21 +27,24 @@ discard block |
||
| 26 | 27 | |
| 27 | 28 | // Remember the current configuration so it can be set back. |
| 28 | 29 | $ssi_magic_quotes_runtime = function_exists('get_magic_quotes_gpc') && get_magic_quotes_runtime(); |
| 29 | -if (function_exists('set_magic_quotes_runtime')) |
|
| 30 | +if (function_exists('set_magic_quotes_runtime')) { |
|
| 30 | 31 | @set_magic_quotes_runtime(0); |
| 32 | +} |
|
| 31 | 33 | $time_start = microtime(); |
| 32 | 34 | |
| 33 | 35 | // Just being safe... |
| 34 | -foreach (array('db_character_set', 'cachedir') as $variable) |
|
| 36 | +foreach (array('db_character_set', 'cachedir') as $variable) { |
|
| 35 | 37 | if (isset($GLOBALS[$variable])) |
| 36 | 38 | unset($GLOBALS[$variable]); |
| 39 | +} |
|
| 37 | 40 | |
| 38 | 41 | // Get the forum's settings for database and file paths. |
| 39 | 42 | require_once(dirname(__FILE__) . '/Settings.php'); |
| 40 | 43 | |
| 41 | 44 | // Make absolutely sure the cache directory is defined. |
| 42 | -if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) |
|
| 45 | +if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) { |
|
| 43 | 46 | $cachedir = $boarddir . '/cache'; |
| 47 | +} |
|
| 44 | 48 | |
| 45 | 49 | $ssi_error_reporting = error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL); |
| 46 | 50 | /* Set this to one of three values depending on what you want to happen in the case of a fatal error. |
@@ -51,12 +55,14 @@ discard block |
||
| 51 | 55 | $ssi_on_error_method = false; |
| 52 | 56 | |
| 53 | 57 | // Don't do john didley if the forum's been shut down completely. |
| 54 | -if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true)) |
|
| 58 | +if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true)) { |
|
| 55 | 59 | die($mmessage); |
| 60 | +} |
|
| 56 | 61 | |
| 57 | 62 | // Fix for using the current directory as a path. |
| 58 | -if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') |
|
| 63 | +if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') { |
|
| 59 | 64 | $sourcedir = dirname(__FILE__) . substr($sourcedir, 1); |
| 65 | +} |
|
| 60 | 66 | |
| 61 | 67 | // Load the important includes. |
| 62 | 68 | require_once($sourcedir . '/QueryString.php'); |
@@ -81,34 +87,38 @@ discard block |
||
| 81 | 87 | cleanRequest(); |
| 82 | 88 | |
| 83 | 89 | // Seed the random generator? |
| 84 | -if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) |
|
| 90 | +if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) { |
|
| 85 | 91 | smf_seed_generator(); |
| 92 | +} |
|
| 86 | 93 | |
| 87 | 94 | // Check on any hacking attempts. |
| 88 | -if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) |
|
| 95 | +if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) { |
|
| 89 | 96 | die('No direct access...'); |
| 90 | -elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme) |
|
| 97 | +} elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme) { |
|
| 91 | 98 | die('No direct access...'); |
| 92 | -elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme) |
|
| 99 | +} elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme) { |
|
| 93 | 100 | die('No direct access...'); |
| 94 | -elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers) |
|
| 101 | +} elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers) { |
|
| 95 | 102 | die('No direct access...'); |
| 96 | -if (isset($_REQUEST['context'])) |
|
| 103 | +} |
|
| 104 | +if (isset($_REQUEST['context'])) { |
|
| 97 | 105 | die('No direct access...'); |
| 106 | +} |
|
| 98 | 107 | |
| 99 | 108 | // Gzip output? (because it must be boolean and true, this can't be hacked.) |
| 100 | -if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>=')) |
|
| 109 | +if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>=')) { |
|
| 101 | 110 | ob_start('ob_gzhandler'); |
| 102 | -else |
|
| 111 | +} else { |
|
| 103 | 112 | $modSettings['enableCompressedOutput'] = '0'; |
| 113 | +} |
|
| 104 | 114 | |
| 105 | 115 | // Primarily, this is to fix the URLs... |
| 106 | 116 | ob_start('ob_sessrewrite'); |
| 107 | 117 | |
| 108 | 118 | // Start the session... known to scramble SSI includes in cases... |
| 109 | -if (!headers_sent()) |
|
| 119 | +if (!headers_sent()) { |
|
| 110 | 120 | loadSession(); |
| 111 | -else |
|
| 121 | +} else |
|
| 112 | 122 | { |
| 113 | 123 | if (isset($_COOKIE[session_name()]) || isset($_REQUEST[session_name()])) |
| 114 | 124 | { |
@@ -142,12 +152,14 @@ discard block |
||
| 142 | 152 | loadTheme(isset($ssi_theme) ? (int) $ssi_theme : 0); |
| 143 | 153 | |
| 144 | 154 | // @todo: probably not the best place, but somewhere it should be set... |
| 145 | -if (!headers_sent()) |
|
| 155 | +if (!headers_sent()) { |
|
| 146 | 156 | header('Content-Type: text/html; charset=' . (empty($modSettings['global_character_set']) ? (empty($txt['lang_character_set']) ? 'ISO-8859-1' : $txt['lang_character_set']) : $modSettings['global_character_set'])); |
| 157 | +} |
|
| 147 | 158 | |
| 148 | 159 | // Take care of any banning that needs to be done. |
| 149 | -if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true)) |
|
| 160 | +if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true)) { |
|
| 150 | 161 | is_not_banned(); |
| 162 | +} |
|
| 151 | 163 | |
| 152 | 164 | // Do we allow guests in here? |
| 153 | 165 | if (empty($ssi_guest_access) && empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && basename($_SERVER['PHP_SELF']) != 'SSI.php') |
@@ -162,17 +174,19 @@ discard block |
||
| 162 | 174 | { |
| 163 | 175 | $context['template_layers'] = $ssi_layers; |
| 164 | 176 | template_header(); |
| 165 | -} |
|
| 166 | -else |
|
| 177 | +} else { |
|
| 167 | 178 | setupThemeContext(); |
| 179 | +} |
|
| 168 | 180 | |
| 169 | 181 | // Make sure they didn't muss around with the settings... but only if it's not cli. |
| 170 | -if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '') |
|
| 182 | +if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '') { |
|
| 171 | 183 | trigger_error($txt['ssi_session_broken'], E_USER_NOTICE); |
| 184 | +} |
|
| 172 | 185 | |
| 173 | 186 | // Without visiting the forum this session variable might not be set on submit. |
| 174 | -if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) |
|
| 187 | +if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) { |
|
| 175 | 188 | $_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT']; |
| 189 | +} |
|
| 176 | 190 | |
| 177 | 191 | // Have the ability to easily add functions to SSI. |
| 178 | 192 | call_integration_hook('integrate_SSI'); |
@@ -183,15 +197,18 @@ discard block |
||
| 183 | 197 | call_user_func('ssi_' . $_GET['ssi_function']); |
| 184 | 198 | exit; |
| 185 | 199 | } |
| 186 | -if (isset($_GET['ssi_function'])) |
|
| 200 | +if (isset($_GET['ssi_function'])) { |
|
| 187 | 201 | exit; |
| 202 | +} |
|
| 188 | 203 | // You shouldn't just access SSI.php directly by URL!! |
| 189 | -elseif (basename($_SERVER['PHP_SELF']) == 'SSI.php') |
|
| 204 | +elseif (basename($_SERVER['PHP_SELF']) == 'SSI.php') { |
|
| 190 | 205 | die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\'')); |
| 206 | +} |
|
| 191 | 207 | |
| 192 | 208 | error_reporting($ssi_error_reporting); |
| 193 | -if (function_exists('set_magic_quotes_runtime')) |
|
| 209 | +if (function_exists('set_magic_quotes_runtime')) { |
|
| 194 | 210 | @set_magic_quotes_runtime($ssi_magic_quotes_runtime); |
| 211 | +} |
|
| 195 | 212 | |
| 196 | 213 | return true; |
| 197 | 214 | |
@@ -201,9 +218,10 @@ discard block |
||
| 201 | 218 | */ |
| 202 | 219 | function ssi_shutdown() |
| 203 | 220 | { |
| 204 | - if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') |
|
| 205 | - template_footer(); |
|
| 206 | -} |
|
| 221 | + if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') { |
|
| 222 | + template_footer(); |
|
| 223 | + } |
|
| 224 | + } |
|
| 207 | 225 | |
| 208 | 226 | /** |
| 209 | 227 | * Display a welcome message, like: Hey, User, you have 0 messages, 0 are new. |
@@ -216,15 +234,17 @@ discard block |
||
| 216 | 234 | |
| 217 | 235 | if ($output_method == 'echo') |
| 218 | 236 | { |
| 219 | - if ($context['user']['is_guest']) |
|
| 220 | - echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'); |
|
| 221 | - else |
|
| 222 | - echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : ''; |
|
| 237 | + if ($context['user']['is_guest']) { |
|
| 238 | + echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'); |
|
| 239 | + } else { |
|
| 240 | + echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : ''; |
|
| 241 | + } |
|
| 223 | 242 | } |
| 224 | 243 | // Don't echo... then do what?! |
| 225 | - else |
|
| 226 | - return $context['user']; |
|
| 227 | -} |
|
| 244 | + else { |
|
| 245 | + return $context['user']; |
|
| 246 | + } |
|
| 247 | + } |
|
| 228 | 248 | |
| 229 | 249 | /** |
| 230 | 250 | * Display a menu bar, like is displayed at the top of the forum. |
@@ -235,12 +255,14 @@ discard block |
||
| 235 | 255 | { |
| 236 | 256 | global $context; |
| 237 | 257 | |
| 238 | - if ($output_method == 'echo') |
|
| 239 | - template_menu(); |
|
| 258 | + if ($output_method == 'echo') { |
|
| 259 | + template_menu(); |
|
| 260 | + } |
|
| 240 | 261 | // What else could this do? |
| 241 | - else |
|
| 242 | - return $context['menu_buttons']; |
|
| 243 | -} |
|
| 262 | + else { |
|
| 263 | + return $context['menu_buttons']; |
|
| 264 | + } |
|
| 265 | + } |
|
| 244 | 266 | |
| 245 | 267 | /** |
| 246 | 268 | * Show a logout link. |
@@ -252,20 +274,23 @@ discard block |
||
| 252 | 274 | { |
| 253 | 275 | global $context, $txt, $scripturl; |
| 254 | 276 | |
| 255 | - if ($redirect_to != '') |
|
| 256 | - $_SESSION['logout_url'] = $redirect_to; |
|
| 277 | + if ($redirect_to != '') { |
|
| 278 | + $_SESSION['logout_url'] = $redirect_to; |
|
| 279 | + } |
|
| 257 | 280 | |
| 258 | 281 | // Guests can't log out. |
| 259 | - if ($context['user']['is_guest']) |
|
| 260 | - return false; |
|
| 282 | + if ($context['user']['is_guest']) { |
|
| 283 | + return false; |
|
| 284 | + } |
|
| 261 | 285 | |
| 262 | 286 | $link = '<a href="' . $scripturl . '?action=logout;' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['logout'] . '</a>'; |
| 263 | 287 | |
| 264 | - if ($output_method == 'echo') |
|
| 265 | - echo $link; |
|
| 266 | - else |
|
| 267 | - return $link; |
|
| 268 | -} |
|
| 288 | + if ($output_method == 'echo') { |
|
| 289 | + echo $link; |
|
| 290 | + } else { |
|
| 291 | + return $link; |
|
| 292 | + } |
|
| 293 | + } |
|
| 269 | 294 | |
| 270 | 295 | /** |
| 271 | 296 | * Recent post list: [board] Subject by Poster Date |
@@ -281,17 +306,17 @@ discard block |
||
| 281 | 306 | global $modSettings, $context; |
| 282 | 307 | |
| 283 | 308 | // Excluding certain boards... |
| 284 | - if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) |
|
| 285 | - $exclude_boards = array($modSettings['recycle_board']); |
|
| 286 | - else |
|
| 287 | - $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
| 309 | + if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) { |
|
| 310 | + $exclude_boards = array($modSettings['recycle_board']); |
|
| 311 | + } else { |
|
| 312 | + $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
| 313 | + } |
|
| 288 | 314 | |
| 289 | 315 | // What about including certain boards - note we do some protection here as pre-2.0 didn't have this parameter. |
| 290 | 316 | if (is_array($include_boards) || (int) $include_boards === $include_boards) |
| 291 | 317 | { |
| 292 | 318 | $include_boards = is_array($include_boards) ? $include_boards : array($include_boards); |
| 293 | - } |
|
| 294 | - elseif ($include_boards != null) |
|
| 319 | + } elseif ($include_boards != null) |
|
| 295 | 320 | { |
| 296 | 321 | $include_boards = array(); |
| 297 | 322 | } |
@@ -328,8 +353,9 @@ discard block |
||
| 328 | 353 | { |
| 329 | 354 | global $modSettings; |
| 330 | 355 | |
| 331 | - if (empty($post_ids)) |
|
| 332 | - return; |
|
| 356 | + if (empty($post_ids)) { |
|
| 357 | + return; |
|
| 358 | + } |
|
| 333 | 359 | |
| 334 | 360 | // Allow the user to request more than one - why not? |
| 335 | 361 | $post_ids = is_array($post_ids) ? $post_ids : array($post_ids); |
@@ -364,8 +390,9 @@ discard block |
||
| 364 | 390 | global $scripturl, $txt, $user_info; |
| 365 | 391 | global $modSettings, $smcFunc, $context; |
| 366 | 392 | |
| 367 | - if (!empty($modSettings['enable_likes'])) |
|
| 368 | - $context['can_like'] = allowedTo('likes_like'); |
|
| 393 | + if (!empty($modSettings['enable_likes'])) { |
|
| 394 | + $context['can_like'] = allowedTo('likes_like'); |
|
| 395 | + } |
|
| 369 | 396 | |
| 370 | 397 | // Find all the posts. Newer ones will have higher IDs. |
| 371 | 398 | $request = $smcFunc['db_query']('substring', ' |
@@ -431,12 +458,13 @@ discard block |
||
| 431 | 458 | ); |
| 432 | 459 | |
| 433 | 460 | // Get the likes for each message. |
| 434 | - if (!empty($modSettings['enable_likes'])) |
|
| 435 | - $posts[$row['id_msg']]['likes'] = array( |
|
| 461 | + if (!empty($modSettings['enable_likes'])) { |
|
| 462 | + $posts[$row['id_msg']]['likes'] = array( |
|
| 436 | 463 | 'count' => $row['likes'], |
| 437 | 464 | 'you' => in_array($row['id_msg'], prepareLikesContext($row['id_topic'])), |
| 438 | 465 | 'can_like' => !$context['user']['is_guest'] && $row['id_member'] != $context['user']['id'] && !empty($context['can_like']), |
| 439 | 466 | ); |
| 467 | + } |
|
| 440 | 468 | } |
| 441 | 469 | $smcFunc['db_free_result']($request); |
| 442 | 470 | |
@@ -444,13 +472,14 @@ discard block |
||
| 444 | 472 | call_integration_hook('integrate_ssi_queryPosts', array(&$posts)); |
| 445 | 473 | |
| 446 | 474 | // Just return it. |
| 447 | - if ($output_method != 'echo' || empty($posts)) |
|
| 448 | - return $posts; |
|
| 475 | + if ($output_method != 'echo' || empty($posts)) { |
|
| 476 | + return $posts; |
|
| 477 | + } |
|
| 449 | 478 | |
| 450 | 479 | echo ' |
| 451 | 480 | <table style="border: none" class="ssi_table">'; |
| 452 | - foreach ($posts as $post) |
|
| 453 | - echo ' |
|
| 481 | + foreach ($posts as $post) { |
|
| 482 | + echo ' |
|
| 454 | 483 | <tr> |
| 455 | 484 | <td style="text-align: right; vertical-align: top; white-space: nowrap"> |
| 456 | 485 | [', $post['board']['link'], '] |
@@ -464,6 +493,7 @@ discard block |
||
| 464 | 493 | ', $post['time'], ' |
| 465 | 494 | </td> |
| 466 | 495 | </tr>'; |
| 496 | + } |
|
| 467 | 497 | echo ' |
| 468 | 498 | </table>'; |
| 469 | 499 | } |
@@ -481,25 +511,26 @@ discard block |
||
| 481 | 511 | global $settings, $scripturl, $txt, $user_info; |
| 482 | 512 | global $modSettings, $smcFunc, $context; |
| 483 | 513 | |
| 484 | - if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) |
|
| 485 | - $exclude_boards = array($modSettings['recycle_board']); |
|
| 486 | - else |
|
| 487 | - $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
| 514 | + if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) { |
|
| 515 | + $exclude_boards = array($modSettings['recycle_board']); |
|
| 516 | + } else { |
|
| 517 | + $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
| 518 | + } |
|
| 488 | 519 | |
| 489 | 520 | // Only some boards?. |
| 490 | 521 | if (is_array($include_boards) || (int) $include_boards === $include_boards) |
| 491 | 522 | { |
| 492 | 523 | $include_boards = is_array($include_boards) ? $include_boards : array($include_boards); |
| 493 | - } |
|
| 494 | - elseif ($include_boards != null) |
|
| 524 | + } elseif ($include_boards != null) |
|
| 495 | 525 | { |
| 496 | 526 | $output_method = $include_boards; |
| 497 | 527 | $include_boards = array(); |
| 498 | 528 | } |
| 499 | 529 | |
| 500 | 530 | $icon_sources = array(); |
| 501 | - foreach ($context['stable_icons'] as $icon) |
|
| 502 | - $icon_sources[$icon] = 'images_url'; |
|
| 531 | + foreach ($context['stable_icons'] as $icon) { |
|
| 532 | + $icon_sources[$icon] = 'images_url'; |
|
| 533 | + } |
|
| 503 | 534 | |
| 504 | 535 | // Find all the posts in distinct topics. Newer ones will have higher IDs. |
| 505 | 536 | $request = $smcFunc['db_query']('substring', ' |
@@ -524,13 +555,15 @@ discard block |
||
| 524 | 555 | ) |
| 525 | 556 | ); |
| 526 | 557 | $topics = array(); |
| 527 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 528 | - $topics[$row['id_topic']] = $row; |
|
| 558 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 559 | + $topics[$row['id_topic']] = $row; |
|
| 560 | + } |
|
| 529 | 561 | $smcFunc['db_free_result']($request); |
| 530 | 562 | |
| 531 | 563 | // Did we find anything? If not, bail. |
| 532 | - if (empty($topics)) |
|
| 533 | - return array(); |
|
| 564 | + if (empty($topics)) { |
|
| 565 | + return array(); |
|
| 566 | + } |
|
| 534 | 567 | |
| 535 | 568 | $recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0; |
| 536 | 569 | |
@@ -558,19 +591,22 @@ discard block |
||
| 558 | 591 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 559 | 592 | { |
| 560 | 593 | $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br>' => ' '))); |
| 561 | - if ($smcFunc['strlen']($row['body']) > 128) |
|
| 562 | - $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...'; |
|
| 594 | + if ($smcFunc['strlen']($row['body']) > 128) { |
|
| 595 | + $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...'; |
|
| 596 | + } |
|
| 563 | 597 | |
| 564 | 598 | // Censor the subject. |
| 565 | 599 | censorText($row['subject']); |
| 566 | 600 | censorText($row['body']); |
| 567 | 601 | |
| 568 | 602 | // Recycled icon |
| 569 | - if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board']) |
|
| 570 | - $row['icon'] = 'recycled'; |
|
| 603 | + if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board']) { |
|
| 604 | + $row['icon'] = 'recycled'; |
|
| 605 | + } |
|
| 571 | 606 | |
| 572 | - if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) |
|
| 573 | - $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
| 607 | + if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) { |
|
| 608 | + $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
| 609 | + } |
|
| 574 | 610 | |
| 575 | 611 | // Build the array. |
| 576 | 612 | $posts[] = array( |
@@ -609,13 +645,14 @@ discard block |
||
| 609 | 645 | call_integration_hook('integrate_ssi_recentTopics', array(&$posts)); |
| 610 | 646 | |
| 611 | 647 | // Just return it. |
| 612 | - if ($output_method != 'echo' || empty($posts)) |
|
| 613 | - return $posts; |
|
| 648 | + if ($output_method != 'echo' || empty($posts)) { |
|
| 649 | + return $posts; |
|
| 650 | + } |
|
| 614 | 651 | |
| 615 | 652 | echo ' |
| 616 | 653 | <table style="border: none" class="ssi_table">'; |
| 617 | - foreach ($posts as $post) |
|
| 618 | - echo ' |
|
| 654 | + foreach ($posts as $post) { |
|
| 655 | + echo ' |
|
| 619 | 656 | <tr> |
| 620 | 657 | <td style="text-align: right; vertical-align: top; white-space: nowrap"> |
| 621 | 658 | [', $post['board']['link'], '] |
@@ -629,6 +666,7 @@ discard block |
||
| 629 | 666 | ', $post['time'], ' |
| 630 | 667 | </td> |
| 631 | 668 | </tr>'; |
| 669 | + } |
|
| 632 | 670 | echo ' |
| 633 | 671 | </table>'; |
| 634 | 672 | } |
@@ -653,27 +691,30 @@ discard block |
||
| 653 | 691 | ) |
| 654 | 692 | ); |
| 655 | 693 | $return = array(); |
| 656 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 657 | - $return[] = array( |
|
| 694 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 695 | + $return[] = array( |
|
| 658 | 696 | 'id' => $row['id_member'], |
| 659 | 697 | 'name' => $row['real_name'], |
| 660 | 698 | 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], |
| 661 | 699 | 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>', |
| 662 | 700 | 'posts' => $row['posts'] |
| 663 | 701 | ); |
| 702 | + } |
|
| 664 | 703 | $smcFunc['db_free_result']($request); |
| 665 | 704 | |
| 666 | 705 | // If mods want to do somthing with this list of members, let them do that now. |
| 667 | 706 | call_integration_hook('integrate_ssi_topPoster', array(&$return)); |
| 668 | 707 | |
| 669 | 708 | // Just return all the top posters. |
| 670 | - if ($output_method != 'echo') |
|
| 671 | - return $return; |
|
| 709 | + if ($output_method != 'echo') { |
|
| 710 | + return $return; |
|
| 711 | + } |
|
| 672 | 712 | |
| 673 | 713 | // Make a quick array to list the links in. |
| 674 | 714 | $temp_array = array(); |
| 675 | - foreach ($return as $member) |
|
| 676 | - $temp_array[] = $member['link']; |
|
| 715 | + foreach ($return as $member) { |
|
| 716 | + $temp_array[] = $member['link']; |
|
| 717 | + } |
|
| 677 | 718 | |
| 678 | 719 | echo implode(', ', $temp_array); |
| 679 | 720 | } |
@@ -705,8 +746,8 @@ discard block |
||
| 705 | 746 | ) |
| 706 | 747 | ); |
| 707 | 748 | $boards = array(); |
| 708 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 709 | - $boards[] = array( |
|
| 749 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 750 | + $boards[] = array( |
|
| 710 | 751 | 'id' => $row['id_board'], |
| 711 | 752 | 'num_posts' => $row['num_posts'], |
| 712 | 753 | 'num_topics' => $row['num_topics'], |
@@ -715,14 +756,16 @@ discard block |
||
| 715 | 756 | 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', |
| 716 | 757 | 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>' |
| 717 | 758 | ); |
| 759 | + } |
|
| 718 | 760 | $smcFunc['db_free_result']($request); |
| 719 | 761 | |
| 720 | 762 | // If mods want to do somthing with this list of boards, let them do that now. |
| 721 | 763 | call_integration_hook('integrate_ssi_topBoards', array(&$boards)); |
| 722 | 764 | |
| 723 | 765 | // If we shouldn't output or have nothing to output, just jump out. |
| 724 | - if ($output_method != 'echo' || empty($boards)) |
|
| 725 | - return $boards; |
|
| 766 | + if ($output_method != 'echo' || empty($boards)) { |
|
| 767 | + return $boards; |
|
| 768 | + } |
|
| 726 | 769 | |
| 727 | 770 | echo ' |
| 728 | 771 | <table class="ssi_table"> |
@@ -731,13 +774,14 @@ discard block |
||
| 731 | 774 | <th style="text-align: left">', $txt['board_topics'], '</th> |
| 732 | 775 | <th style="text-align: left">', $txt['posts'], '</th> |
| 733 | 776 | </tr>'; |
| 734 | - foreach ($boards as $sBoard) |
|
| 735 | - echo ' |
|
| 777 | + foreach ($boards as $sBoard) { |
|
| 778 | + echo ' |
|
| 736 | 779 | <tr> |
| 737 | 780 | <td>', $sBoard['link'], $sBoard['new'] ? ' <a href="' . $sBoard['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>' : '', '</td> |
| 738 | 781 | <td style="text-align: right">', comma_format($sBoard['num_topics']), '</td> |
| 739 | 782 | <td style="text-align: right">', comma_format($sBoard['num_posts']), '</td> |
| 740 | 783 | </tr>'; |
| 784 | + } |
|
| 741 | 785 | echo ' |
| 742 | 786 | </table>'; |
| 743 | 787 | } |
@@ -770,12 +814,13 @@ discard block |
||
| 770 | 814 | ) |
| 771 | 815 | ); |
| 772 | 816 | $topic_ids = array(); |
| 773 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 774 | - $topic_ids[] = $row['id_topic']; |
|
| 817 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 818 | + $topic_ids[] = $row['id_topic']; |
|
| 819 | + } |
|
| 775 | 820 | $smcFunc['db_free_result']($request); |
| 821 | + } else { |
|
| 822 | + $topic_ids = array(); |
|
| 776 | 823 | } |
| 777 | - else |
|
| 778 | - $topic_ids = array(); |
|
| 779 | 824 | |
| 780 | 825 | $request = $smcFunc['db_query']('', ' |
| 781 | 826 | SELECT m.subject, m.id_topic, t.num_views, t.num_replies |
@@ -814,8 +859,9 @@ discard block |
||
| 814 | 859 | // If mods want to do somthing with this list of topics, let them do that now. |
| 815 | 860 | call_integration_hook('integrate_ssi_topTopics', array(&$topics, $type)); |
| 816 | 861 | |
| 817 | - if ($output_method != 'echo' || empty($topics)) |
|
| 818 | - return $topics; |
|
| 862 | + if ($output_method != 'echo' || empty($topics)) { |
|
| 863 | + return $topics; |
|
| 864 | + } |
|
| 819 | 865 | |
| 820 | 866 | echo ' |
| 821 | 867 | <table class="ssi_table"> |
@@ -824,8 +870,8 @@ discard block |
||
| 824 | 870 | <th style="text-align: left">', $txt['views'], '</th> |
| 825 | 871 | <th style="text-align: left">', $txt['replies'], '</th> |
| 826 | 872 | </tr>'; |
| 827 | - foreach ($topics as $sTopic) |
|
| 828 | - echo ' |
|
| 873 | + foreach ($topics as $sTopic) { |
|
| 874 | + echo ' |
|
| 829 | 875 | <tr> |
| 830 | 876 | <td style="text-align: left"> |
| 831 | 877 | ', $sTopic['link'], ' |
@@ -833,6 +879,7 @@ discard block |
||
| 833 | 879 | <td style="text-align: right">', comma_format($sTopic['num_views']), '</td> |
| 834 | 880 | <td style="text-align: right">', comma_format($sTopic['num_replies']), '</td> |
| 835 | 881 | </tr>'; |
| 882 | + } |
|
| 836 | 883 | echo ' |
| 837 | 884 | </table>'; |
| 838 | 885 | } |
@@ -868,12 +915,13 @@ discard block |
||
| 868 | 915 | { |
| 869 | 916 | global $txt, $context; |
| 870 | 917 | |
| 871 | - if ($output_method == 'echo') |
|
| 872 | - echo ' |
|
| 918 | + if ($output_method == 'echo') { |
|
| 919 | + echo ' |
|
| 873 | 920 | ', sprintf($txt['welcome_newest_member'], $context['common_stats']['latest_member']['link']), '<br>'; |
| 874 | - else |
|
| 875 | - return $context['common_stats']['latest_member']; |
|
| 876 | -} |
|
| 921 | + } else { |
|
| 922 | + return $context['common_stats']['latest_member']; |
|
| 923 | + } |
|
| 924 | + } |
|
| 877 | 925 | |
| 878 | 926 | /** |
| 879 | 927 | * Fetches a random member. |
@@ -922,8 +970,9 @@ discard block |
||
| 922 | 970 | } |
| 923 | 971 | |
| 924 | 972 | // Just to be sure put the random generator back to something... random. |
| 925 | - if ($random_type != '') |
|
| 926 | - mt_srand(time()); |
|
| 973 | + if ($random_type != '') { |
|
| 974 | + mt_srand(time()); |
|
| 975 | + } |
|
| 927 | 976 | |
| 928 | 977 | return $result; |
| 929 | 978 | } |
@@ -936,8 +985,9 @@ discard block |
||
| 936 | 985 | */ |
| 937 | 986 | function ssi_fetchMember($member_ids = array(), $output_method = 'echo') |
| 938 | 987 | { |
| 939 | - if (empty($member_ids)) |
|
| 940 | - return; |
|
| 988 | + if (empty($member_ids)) { |
|
| 989 | + return; |
|
| 990 | + } |
|
| 941 | 991 | |
| 942 | 992 | // Can have more than one member if you really want... |
| 943 | 993 | $member_ids = is_array($member_ids) ? $member_ids : array($member_ids); |
@@ -962,8 +1012,9 @@ discard block |
||
| 962 | 1012 | */ |
| 963 | 1013 | function ssi_fetchGroupMembers($group_id = null, $output_method = 'echo') |
| 964 | 1014 | { |
| 965 | - if ($group_id === null) |
|
| 966 | - return; |
|
| 1015 | + if ($group_id === null) { |
|
| 1016 | + return; |
|
| 1017 | + } |
|
| 967 | 1018 | |
| 968 | 1019 | $query_where = ' |
| 969 | 1020 | id_group = {int:id_group} |
@@ -990,8 +1041,9 @@ discard block |
||
| 990 | 1041 | { |
| 991 | 1042 | global $smcFunc, $memberContext; |
| 992 | 1043 | |
| 993 | - if ($query_where === null) |
|
| 994 | - return; |
|
| 1044 | + if ($query_where === null) { |
|
| 1045 | + return; |
|
| 1046 | + } |
|
| 995 | 1047 | |
| 996 | 1048 | // Fetch the members in question. |
| 997 | 1049 | $request = $smcFunc['db_query']('', ' |
@@ -1004,12 +1056,14 @@ discard block |
||
| 1004 | 1056 | )) |
| 1005 | 1057 | ); |
| 1006 | 1058 | $members = array(); |
| 1007 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1008 | - $members[] = $row['id_member']; |
|
| 1059 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1060 | + $members[] = $row['id_member']; |
|
| 1061 | + } |
|
| 1009 | 1062 | $smcFunc['db_free_result']($request); |
| 1010 | 1063 | |
| 1011 | - if (empty($members)) |
|
| 1012 | - return array(); |
|
| 1064 | + if (empty($members)) { |
|
| 1065 | + return array(); |
|
| 1066 | + } |
|
| 1013 | 1067 | |
| 1014 | 1068 | // If mods want to do somthing with this list of members, let them do that now. |
| 1015 | 1069 | call_integration_hook('integrate_ssi_queryMembers', array(&$members)); |
@@ -1018,23 +1072,25 @@ discard block |
||
| 1018 | 1072 | loadMemberData($members); |
| 1019 | 1073 | |
| 1020 | 1074 | // Draw the table! |
| 1021 | - if ($output_method == 'echo') |
|
| 1022 | - echo ' |
|
| 1075 | + if ($output_method == 'echo') { |
|
| 1076 | + echo ' |
|
| 1023 | 1077 | <table style="border: none" class="ssi_table">'; |
| 1078 | + } |
|
| 1024 | 1079 | |
| 1025 | 1080 | $query_members = array(); |
| 1026 | 1081 | foreach ($members as $member) |
| 1027 | 1082 | { |
| 1028 | 1083 | // Load their context data. |
| 1029 | - if (!loadMemberContext($member)) |
|
| 1030 | - continue; |
|
| 1084 | + if (!loadMemberContext($member)) { |
|
| 1085 | + continue; |
|
| 1086 | + } |
|
| 1031 | 1087 | |
| 1032 | 1088 | // Store this member's information. |
| 1033 | 1089 | $query_members[$member] = $memberContext[$member]; |
| 1034 | 1090 | |
| 1035 | 1091 | // Only do something if we're echo'ing. |
| 1036 | - if ($output_method == 'echo') |
|
| 1037 | - echo ' |
|
| 1092 | + if ($output_method == 'echo') { |
|
| 1093 | + echo ' |
|
| 1038 | 1094 | <tr> |
| 1039 | 1095 | <td style="text-align: right; vertical-align: top; white-space: nowrap"> |
| 1040 | 1096 | ', $query_members[$member]['link'], ' |
@@ -1042,12 +1098,14 @@ discard block |
||
| 1042 | 1098 | <br>', $query_members[$member]['avatar']['image'], ' |
| 1043 | 1099 | </td> |
| 1044 | 1100 | </tr>'; |
| 1101 | + } |
|
| 1045 | 1102 | } |
| 1046 | 1103 | |
| 1047 | 1104 | // End the table if appropriate. |
| 1048 | - if ($output_method == 'echo') |
|
| 1049 | - echo ' |
|
| 1105 | + if ($output_method == 'echo') { |
|
| 1106 | + echo ' |
|
| 1050 | 1107 | </table>'; |
| 1108 | + } |
|
| 1051 | 1109 | |
| 1052 | 1110 | // Send back the data. |
| 1053 | 1111 | return $query_members; |
@@ -1062,8 +1120,9 @@ discard block |
||
| 1062 | 1120 | { |
| 1063 | 1121 | global $txt, $scripturl, $modSettings, $smcFunc; |
| 1064 | 1122 | |
| 1065 | - if (!allowedTo('view_stats')) |
|
| 1066 | - return; |
|
| 1123 | + if (!allowedTo('view_stats')) { |
|
| 1124 | + return; |
|
| 1125 | + } |
|
| 1067 | 1126 | |
| 1068 | 1127 | $totals = array( |
| 1069 | 1128 | 'members' => $modSettings['totalMembers'], |
@@ -1092,8 +1151,9 @@ discard block |
||
| 1092 | 1151 | // If mods want to do somthing with the board stats, let them do that now. |
| 1093 | 1152 | call_integration_hook('integrate_ssi_boardStats', array(&$totals)); |
| 1094 | 1153 | |
| 1095 | - if ($output_method != 'echo') |
|
| 1096 | - return $totals; |
|
| 1154 | + if ($output_method != 'echo') { |
|
| 1155 | + return $totals; |
|
| 1156 | + } |
|
| 1097 | 1157 | |
| 1098 | 1158 | echo ' |
| 1099 | 1159 | ', $txt['total_members'], ': <a href="', $scripturl . '?action=mlist">', comma_format($totals['members']), '</a><br> |
@@ -1122,8 +1182,8 @@ discard block |
||
| 1122 | 1182 | call_integration_hook('integrate_ssi_whosOnline', array(&$return)); |
| 1123 | 1183 | |
| 1124 | 1184 | // Add some redundancy for backwards compatibility reasons. |
| 1125 | - if ($output_method != 'echo') |
|
| 1126 | - return $return + array( |
|
| 1185 | + if ($output_method != 'echo') { |
|
| 1186 | + return $return + array( |
|
| 1127 | 1187 | 'users' => $return['users_online'], |
| 1128 | 1188 | 'guests' => $return['num_guests'], |
| 1129 | 1189 | 'hidden' => $return['num_users_hidden'], |
@@ -1131,29 +1191,35 @@ discard block |
||
| 1131 | 1191 | 'num_users' => $return['num_users_online'], |
| 1132 | 1192 | 'total_users' => $return['num_users_online'] + $return['num_guests'], |
| 1133 | 1193 | ); |
| 1194 | + } |
|
| 1134 | 1195 | |
| 1135 | 1196 | echo ' |
| 1136 | 1197 | ', comma_format($return['num_guests']), ' ', $return['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($return['num_users_online']), ' ', $return['num_users_online'] == 1 ? $txt['user'] : $txt['users']; |
| 1137 | 1198 | |
| 1138 | 1199 | $bracketList = array(); |
| 1139 | - if (!empty($user_info['buddies'])) |
|
| 1140 | - $bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
| 1141 | - if (!empty($return['num_spiders'])) |
|
| 1142 | - $bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
| 1143 | - if (!empty($return['num_users_hidden'])) |
|
| 1144 | - $bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden']; |
|
| 1200 | + if (!empty($user_info['buddies'])) { |
|
| 1201 | + $bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
| 1202 | + } |
|
| 1203 | + if (!empty($return['num_spiders'])) { |
|
| 1204 | + $bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
| 1205 | + } |
|
| 1206 | + if (!empty($return['num_users_hidden'])) { |
|
| 1207 | + $bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden']; |
|
| 1208 | + } |
|
| 1145 | 1209 | |
| 1146 | - if (!empty($bracketList)) |
|
| 1147 | - echo ' (' . implode(', ', $bracketList) . ')'; |
|
| 1210 | + if (!empty($bracketList)) { |
|
| 1211 | + echo ' (' . implode(', ', $bracketList) . ')'; |
|
| 1212 | + } |
|
| 1148 | 1213 | |
| 1149 | 1214 | echo '<br> |
| 1150 | 1215 | ', implode(', ', $return['list_users_online']); |
| 1151 | 1216 | |
| 1152 | 1217 | // Showing membergroups? |
| 1153 | - if (!empty($settings['show_group_key']) && !empty($return['membergroups'])) |
|
| 1154 | - echo '<br> |
|
| 1218 | + if (!empty($settings['show_group_key']) && !empty($return['membergroups'])) { |
|
| 1219 | + echo '<br> |
|
| 1155 | 1220 | [' . implode('] [', $return['membergroups']) . ']'; |
| 1156 | -} |
|
| 1221 | + } |
|
| 1222 | + } |
|
| 1157 | 1223 | |
| 1158 | 1224 | /** |
| 1159 | 1225 | * Just like whosOnline except it also logs the online presence. |
@@ -1164,11 +1230,12 @@ discard block |
||
| 1164 | 1230 | { |
| 1165 | 1231 | writeLog(); |
| 1166 | 1232 | |
| 1167 | - if ($output_method != 'echo') |
|
| 1168 | - return ssi_whosOnline($output_method); |
|
| 1169 | - else |
|
| 1170 | - ssi_whosOnline($output_method); |
|
| 1171 | -} |
|
| 1233 | + if ($output_method != 'echo') { |
|
| 1234 | + return ssi_whosOnline($output_method); |
|
| 1235 | + } else { |
|
| 1236 | + ssi_whosOnline($output_method); |
|
| 1237 | + } |
|
| 1238 | + } |
|
| 1172 | 1239 | |
| 1173 | 1240 | // Shows a login box. |
| 1174 | 1241 | /** |
@@ -1181,11 +1248,13 @@ discard block |
||
| 1181 | 1248 | { |
| 1182 | 1249 | global $scripturl, $txt, $user_info, $context; |
| 1183 | 1250 | |
| 1184 | - if ($redirect_to != '') |
|
| 1185 | - $_SESSION['login_url'] = $redirect_to; |
|
| 1251 | + if ($redirect_to != '') { |
|
| 1252 | + $_SESSION['login_url'] = $redirect_to; |
|
| 1253 | + } |
|
| 1186 | 1254 | |
| 1187 | - if ($output_method != 'echo' || !$user_info['is_guest']) |
|
| 1188 | - return $user_info['is_guest']; |
|
| 1255 | + if ($output_method != 'echo' || !$user_info['is_guest']) { |
|
| 1256 | + return $user_info['is_guest']; |
|
| 1257 | + } |
|
| 1189 | 1258 | |
| 1190 | 1259 | // Create a login token |
| 1191 | 1260 | createToken('login'); |
@@ -1237,8 +1306,9 @@ discard block |
||
| 1237 | 1306 | |
| 1238 | 1307 | $boardsAllowed = array_intersect(boardsAllowedTo('poll_view'), boardsAllowedTo('poll_vote')); |
| 1239 | 1308 | |
| 1240 | - if (empty($boardsAllowed)) |
|
| 1241 | - return array(); |
|
| 1309 | + if (empty($boardsAllowed)) { |
|
| 1310 | + return array(); |
|
| 1311 | + } |
|
| 1242 | 1312 | |
| 1243 | 1313 | $request = $smcFunc['db_query']('', ' |
| 1244 | 1314 | SELECT p.id_poll, p.question, t.id_topic, p.max_votes, p.guest_vote, p.hide_results, p.expire_time |
@@ -1271,12 +1341,14 @@ discard block |
||
| 1271 | 1341 | $smcFunc['db_free_result']($request); |
| 1272 | 1342 | |
| 1273 | 1343 | // This user has voted on all the polls. |
| 1274 | - if (empty($row) || !is_array($row)) |
|
| 1275 | - return array(); |
|
| 1344 | + if (empty($row) || !is_array($row)) { |
|
| 1345 | + return array(); |
|
| 1346 | + } |
|
| 1276 | 1347 | |
| 1277 | 1348 | // If this is a guest who's voted we'll through ourselves to show poll to show the results. |
| 1278 | - if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))) |
|
| 1279 | - return ssi_showPoll($row['id_topic'], $output_method); |
|
| 1349 | + if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))) { |
|
| 1350 | + return ssi_showPoll($row['id_topic'], $output_method); |
|
| 1351 | + } |
|
| 1280 | 1352 | |
| 1281 | 1353 | $request = $smcFunc['db_query']('', ' |
| 1282 | 1354 | SELECT COUNT(DISTINCT id_member) |
@@ -1340,8 +1412,9 @@ discard block |
||
| 1340 | 1412 | // If mods want to do somthing with this list of polls, let them do that now. |
| 1341 | 1413 | call_integration_hook('integrate_ssi_recentPoll', array(&$return, $topPollInstead)); |
| 1342 | 1414 | |
| 1343 | - if ($output_method != 'echo') |
|
| 1344 | - return $return; |
|
| 1415 | + if ($output_method != 'echo') { |
|
| 1416 | + return $return; |
|
| 1417 | + } |
|
| 1345 | 1418 | |
| 1346 | 1419 | if ($allow_view_results) |
| 1347 | 1420 | { |
@@ -1350,19 +1423,20 @@ discard block |
||
| 1350 | 1423 | <strong>', $return['question'], '</strong><br> |
| 1351 | 1424 | ', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : ''; |
| 1352 | 1425 | |
| 1353 | - foreach ($return['options'] as $option) |
|
| 1354 | - echo ' |
|
| 1426 | + foreach ($return['options'] as $option) { |
|
| 1427 | + echo ' |
|
| 1355 | 1428 | <label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>'; |
| 1429 | + } |
|
| 1356 | 1430 | |
| 1357 | 1431 | echo ' |
| 1358 | 1432 | <input type="submit" value="', $txt['poll_vote'], '" class="button_submit"> |
| 1359 | 1433 | <input type="hidden" name="poll" value="', $return['id'], '"> |
| 1360 | 1434 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 1361 | 1435 | </form>'; |
| 1436 | + } else { |
|
| 1437 | + echo $txt['poll_cannot_see']; |
|
| 1438 | + } |
|
| 1362 | 1439 | } |
| 1363 | - else |
|
| 1364 | - echo $txt['poll_cannot_see']; |
|
| 1365 | -} |
|
| 1366 | 1440 | |
| 1367 | 1441 | /** |
| 1368 | 1442 | * Shows the poll from the specified topic |
@@ -1376,13 +1450,15 @@ discard block |
||
| 1376 | 1450 | |
| 1377 | 1451 | $boardsAllowed = boardsAllowedTo('poll_view'); |
| 1378 | 1452 | |
| 1379 | - if (empty($boardsAllowed)) |
|
| 1380 | - return array(); |
|
| 1453 | + if (empty($boardsAllowed)) { |
|
| 1454 | + return array(); |
|
| 1455 | + } |
|
| 1381 | 1456 | |
| 1382 | - if ($topic === null && isset($_REQUEST['ssi_topic'])) |
|
| 1383 | - $topic = (int) $_REQUEST['ssi_topic']; |
|
| 1384 | - else |
|
| 1385 | - $topic = (int) $topic; |
|
| 1457 | + if ($topic === null && isset($_REQUEST['ssi_topic'])) { |
|
| 1458 | + $topic = (int) $_REQUEST['ssi_topic']; |
|
| 1459 | + } else { |
|
| 1460 | + $topic = (int) $topic; |
|
| 1461 | + } |
|
| 1386 | 1462 | |
| 1387 | 1463 | $request = $smcFunc['db_query']('', ' |
| 1388 | 1464 | SELECT |
@@ -1403,17 +1479,18 @@ discard block |
||
| 1403 | 1479 | ); |
| 1404 | 1480 | |
| 1405 | 1481 | // Either this topic has no poll, or the user cannot view it. |
| 1406 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 1407 | - return array(); |
|
| 1482 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 1483 | + return array(); |
|
| 1484 | + } |
|
| 1408 | 1485 | |
| 1409 | 1486 | $row = $smcFunc['db_fetch_assoc']($request); |
| 1410 | 1487 | $smcFunc['db_free_result']($request); |
| 1411 | 1488 | |
| 1412 | 1489 | // Check if they can vote. |
| 1413 | 1490 | $already_voted = false; |
| 1414 | - if (!empty($row['expire_time']) && $row['expire_time'] < time()) |
|
| 1415 | - $allow_vote = false; |
|
| 1416 | - elseif ($user_info['is_guest']) |
|
| 1491 | + if (!empty($row['expire_time']) && $row['expire_time'] < time()) { |
|
| 1492 | + $allow_vote = false; |
|
| 1493 | + } elseif ($user_info['is_guest']) |
|
| 1417 | 1494 | { |
| 1418 | 1495 | // There's a difference between "allowed to vote" and "already voted"... |
| 1419 | 1496 | $allow_vote = $row['guest_vote']; |
@@ -1423,10 +1500,9 @@ discard block |
||
| 1423 | 1500 | { |
| 1424 | 1501 | $already_voted = true; |
| 1425 | 1502 | } |
| 1426 | - } |
|
| 1427 | - elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board'])) |
|
| 1428 | - $allow_vote = false; |
|
| 1429 | - else |
|
| 1503 | + } elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board'])) { |
|
| 1504 | + $allow_vote = false; |
|
| 1505 | + } else |
|
| 1430 | 1506 | { |
| 1431 | 1507 | $request = $smcFunc['db_query']('', ' |
| 1432 | 1508 | SELECT id_member |
@@ -1508,8 +1584,9 @@ discard block |
||
| 1508 | 1584 | // If mods want to do somthing with this poll, let them do that now. |
| 1509 | 1585 | call_integration_hook('integrate_ssi_showPoll', array(&$return)); |
| 1510 | 1586 | |
| 1511 | - if ($output_method != 'echo') |
|
| 1512 | - return $return; |
|
| 1587 | + if ($output_method != 'echo') { |
|
| 1588 | + return $return; |
|
| 1589 | + } |
|
| 1513 | 1590 | |
| 1514 | 1591 | if ($return['allow_vote']) |
| 1515 | 1592 | { |
@@ -1518,17 +1595,17 @@ discard block |
||
| 1518 | 1595 | <strong>', $return['question'], '</strong><br> |
| 1519 | 1596 | ', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : ''; |
| 1520 | 1597 | |
| 1521 | - foreach ($return['options'] as $option) |
|
| 1522 | - echo ' |
|
| 1598 | + foreach ($return['options'] as $option) { |
|
| 1599 | + echo ' |
|
| 1523 | 1600 | <label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>'; |
| 1601 | + } |
|
| 1524 | 1602 | |
| 1525 | 1603 | echo ' |
| 1526 | 1604 | <input type="submit" value="', $txt['poll_vote'], '" class="button_submit"> |
| 1527 | 1605 | <input type="hidden" name="poll" value="', $return['id'], '"> |
| 1528 | 1606 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 1529 | 1607 | </form>'; |
| 1530 | - } |
|
| 1531 | - else |
|
| 1608 | + } else |
|
| 1532 | 1609 | { |
| 1533 | 1610 | echo ' |
| 1534 | 1611 | <div class="ssi_poll"> |
@@ -1608,27 +1685,32 @@ discard block |
||
| 1608 | 1685 | 'is_approved' => 1, |
| 1609 | 1686 | ) |
| 1610 | 1687 | ); |
| 1611 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 1612 | - die; |
|
| 1688 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 1689 | + die; |
|
| 1690 | + } |
|
| 1613 | 1691 | $row = $smcFunc['db_fetch_assoc']($request); |
| 1614 | 1692 | $smcFunc['db_free_result']($request); |
| 1615 | 1693 | |
| 1616 | - if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time'])) |
|
| 1617 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1694 | + if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time'])) { |
|
| 1695 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1696 | + } |
|
| 1618 | 1697 | |
| 1619 | 1698 | // Too many options checked? |
| 1620 | - if (count($_REQUEST['options']) > $row['max_votes']) |
|
| 1621 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1699 | + if (count($_REQUEST['options']) > $row['max_votes']) { |
|
| 1700 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1701 | + } |
|
| 1622 | 1702 | |
| 1623 | 1703 | // It's a guest who has already voted? |
| 1624 | 1704 | if ($user_info['is_guest']) |
| 1625 | 1705 | { |
| 1626 | 1706 | // Guest voting disabled? |
| 1627 | - if (!$row['guest_vote']) |
|
| 1628 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1707 | + if (!$row['guest_vote']) { |
|
| 1708 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1709 | + } |
|
| 1629 | 1710 | // Already voted? |
| 1630 | - elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) |
|
| 1631 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1711 | + elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) { |
|
| 1712 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1713 | + } |
|
| 1632 | 1714 | } |
| 1633 | 1715 | |
| 1634 | 1716 | $sOptions = array(); |
@@ -1682,11 +1764,13 @@ discard block |
||
| 1682 | 1764 | { |
| 1683 | 1765 | global $scripturl, $txt, $context; |
| 1684 | 1766 | |
| 1685 | - if (!allowedTo('search_posts')) |
|
| 1686 | - return; |
|
| 1767 | + if (!allowedTo('search_posts')) { |
|
| 1768 | + return; |
|
| 1769 | + } |
|
| 1687 | 1770 | |
| 1688 | - if ($output_method != 'echo') |
|
| 1689 | - return $scripturl . '?action=search'; |
|
| 1771 | + if ($output_method != 'echo') { |
|
| 1772 | + return $scripturl . '?action=search'; |
|
| 1773 | + } |
|
| 1690 | 1774 | |
| 1691 | 1775 | echo ' |
| 1692 | 1776 | <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '"> |
@@ -1708,8 +1792,9 @@ discard block |
||
| 1708 | 1792 | // If mods want to do somthing with the news, let them do that now. Don't need to pass the news line itself, since it is already in $context. |
| 1709 | 1793 | call_integration_hook('integrate_ssi_news'); |
| 1710 | 1794 | |
| 1711 | - if ($output_method != 'echo') |
|
| 1712 | - return $context['random_news_line']; |
|
| 1795 | + if ($output_method != 'echo') { |
|
| 1796 | + return $context['random_news_line']; |
|
| 1797 | + } |
|
| 1713 | 1798 | |
| 1714 | 1799 | echo $context['random_news_line']; |
| 1715 | 1800 | } |
@@ -1723,8 +1808,9 @@ discard block |
||
| 1723 | 1808 | { |
| 1724 | 1809 | global $scripturl, $modSettings, $user_info; |
| 1725 | 1810 | |
| 1726 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view')) |
|
| 1727 | - return; |
|
| 1811 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view')) { |
|
| 1812 | + return; |
|
| 1813 | + } |
|
| 1728 | 1814 | |
| 1729 | 1815 | $eventOptions = array( |
| 1730 | 1816 | 'include_birthdays' => true, |
@@ -1735,13 +1821,15 @@ discard block |
||
| 1735 | 1821 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
| 1736 | 1822 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
| 1737 | 1823 | |
| 1738 | - if ($output_method != 'echo') |
|
| 1739 | - return $return['calendar_birthdays']; |
|
| 1824 | + if ($output_method != 'echo') { |
|
| 1825 | + return $return['calendar_birthdays']; |
|
| 1826 | + } |
|
| 1740 | 1827 | |
| 1741 | - foreach ($return['calendar_birthdays'] as $member) |
|
| 1742 | - echo ' |
|
| 1828 | + foreach ($return['calendar_birthdays'] as $member) { |
|
| 1829 | + echo ' |
|
| 1743 | 1830 | <a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">' . $member['name'] . '</span>' . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? ', ' : ''); |
| 1744 | -} |
|
| 1831 | + } |
|
| 1832 | + } |
|
| 1745 | 1833 | |
| 1746 | 1834 | /** |
| 1747 | 1835 | * Shows today's holidays. |
@@ -1752,8 +1840,9 @@ discard block |
||
| 1752 | 1840 | { |
| 1753 | 1841 | global $modSettings, $user_info; |
| 1754 | 1842 | |
| 1755 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
| 1756 | - return; |
|
| 1843 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
| 1844 | + return; |
|
| 1845 | + } |
|
| 1757 | 1846 | |
| 1758 | 1847 | $eventOptions = array( |
| 1759 | 1848 | 'include_holidays' => true, |
@@ -1764,8 +1853,9 @@ discard block |
||
| 1764 | 1853 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
| 1765 | 1854 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
| 1766 | 1855 | |
| 1767 | - if ($output_method != 'echo') |
|
| 1768 | - return $return['calendar_holidays']; |
|
| 1856 | + if ($output_method != 'echo') { |
|
| 1857 | + return $return['calendar_holidays']; |
|
| 1858 | + } |
|
| 1769 | 1859 | |
| 1770 | 1860 | echo ' |
| 1771 | 1861 | ', implode(', ', $return['calendar_holidays']); |
@@ -1779,8 +1869,9 @@ discard block |
||
| 1779 | 1869 | { |
| 1780 | 1870 | global $modSettings, $user_info; |
| 1781 | 1871 | |
| 1782 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
| 1783 | - return; |
|
| 1872 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
| 1873 | + return; |
|
| 1874 | + } |
|
| 1784 | 1875 | |
| 1785 | 1876 | $eventOptions = array( |
| 1786 | 1877 | 'include_events' => true, |
@@ -1791,14 +1882,16 @@ discard block |
||
| 1791 | 1882 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
| 1792 | 1883 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
| 1793 | 1884 | |
| 1794 | - if ($output_method != 'echo') |
|
| 1795 | - return $return['calendar_events']; |
|
| 1885 | + if ($output_method != 'echo') { |
|
| 1886 | + return $return['calendar_events']; |
|
| 1887 | + } |
|
| 1796 | 1888 | |
| 1797 | 1889 | foreach ($return['calendar_events'] as $event) |
| 1798 | 1890 | { |
| 1799 | - if ($event['can_edit']) |
|
| 1800 | - echo ' |
|
| 1891 | + if ($event['can_edit']) { |
|
| 1892 | + echo ' |
|
| 1801 | 1893 | <a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> '; |
| 1894 | + } |
|
| 1802 | 1895 | echo ' |
| 1803 | 1896 | ' . $event['link'] . (!$event['is_last'] ? ', ' : ''); |
| 1804 | 1897 | } |
@@ -1813,8 +1906,9 @@ discard block |
||
| 1813 | 1906 | { |
| 1814 | 1907 | global $modSettings, $txt, $scripturl, $user_info; |
| 1815 | 1908 | |
| 1816 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
| 1817 | - return; |
|
| 1909 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
| 1910 | + return; |
|
| 1911 | + } |
|
| 1818 | 1912 | |
| 1819 | 1913 | $eventOptions = array( |
| 1820 | 1914 | 'include_birthdays' => allowedTo('profile_view'), |
@@ -1827,19 +1921,22 @@ discard block |
||
| 1827 | 1921 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
| 1828 | 1922 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
| 1829 | 1923 | |
| 1830 | - if ($output_method != 'echo') |
|
| 1831 | - return $return; |
|
| 1924 | + if ($output_method != 'echo') { |
|
| 1925 | + return $return; |
|
| 1926 | + } |
|
| 1832 | 1927 | |
| 1833 | - if (!empty($return['calendar_holidays'])) |
|
| 1834 | - echo ' |
|
| 1928 | + if (!empty($return['calendar_holidays'])) { |
|
| 1929 | + echo ' |
|
| 1835 | 1930 | <span class="holiday">' . $txt['calendar_prompt'] . ' ' . implode(', ', $return['calendar_holidays']) . '<br></span>'; |
| 1931 | + } |
|
| 1836 | 1932 | if (!empty($return['calendar_birthdays'])) |
| 1837 | 1933 | { |
| 1838 | 1934 | echo ' |
| 1839 | 1935 | <span class="birthday">' . $txt['birthdays_upcoming'] . '</span> '; |
| 1840 | - foreach ($return['calendar_birthdays'] as $member) |
|
| 1841 | - echo ' |
|
| 1936 | + foreach ($return['calendar_birthdays'] as $member) { |
|
| 1937 | + echo ' |
|
| 1842 | 1938 | <a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', !$member['is_last'] ? ', ' : ''; |
| 1939 | + } |
|
| 1843 | 1940 | echo ' |
| 1844 | 1941 | <br>'; |
| 1845 | 1942 | } |
@@ -1849,9 +1946,10 @@ discard block |
||
| 1849 | 1946 | <span class="event">' . $txt['events_upcoming'] . '</span> '; |
| 1850 | 1947 | foreach ($return['calendar_events'] as $event) |
| 1851 | 1948 | { |
| 1852 | - if ($event['can_edit']) |
|
| 1853 | - echo ' |
|
| 1949 | + if ($event['can_edit']) { |
|
| 1950 | + echo ' |
|
| 1854 | 1951 | <a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> '; |
| 1952 | + } |
|
| 1855 | 1953 | echo ' |
| 1856 | 1954 | ' . $event['link'] . (!$event['is_last'] ? ', ' : ''); |
| 1857 | 1955 | } |
@@ -1875,25 +1973,29 @@ discard block |
||
| 1875 | 1973 | loadLanguage('Stats'); |
| 1876 | 1974 | |
| 1877 | 1975 | // Must be integers.... |
| 1878 | - if ($limit === null) |
|
| 1879 | - $limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5; |
|
| 1880 | - else |
|
| 1881 | - $limit = (int) $limit; |
|
| 1882 | - |
|
| 1883 | - if ($start === null) |
|
| 1884 | - $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
| 1885 | - else |
|
| 1886 | - $start = (int) $start; |
|
| 1887 | - |
|
| 1888 | - if ($board !== null) |
|
| 1889 | - $board = (int) $board; |
|
| 1890 | - elseif (isset($_GET['board'])) |
|
| 1891 | - $board = (int) $_GET['board']; |
|
| 1892 | - |
|
| 1893 | - if ($length === null) |
|
| 1894 | - $length = isset($_GET['length']) ? (int) $_GET['length'] : 0; |
|
| 1895 | - else |
|
| 1896 | - $length = (int) $length; |
|
| 1976 | + if ($limit === null) { |
|
| 1977 | + $limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5; |
|
| 1978 | + } else { |
|
| 1979 | + $limit = (int) $limit; |
|
| 1980 | + } |
|
| 1981 | + |
|
| 1982 | + if ($start === null) { |
|
| 1983 | + $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
| 1984 | + } else { |
|
| 1985 | + $start = (int) $start; |
|
| 1986 | + } |
|
| 1987 | + |
|
| 1988 | + if ($board !== null) { |
|
| 1989 | + $board = (int) $board; |
|
| 1990 | + } elseif (isset($_GET['board'])) { |
|
| 1991 | + $board = (int) $_GET['board']; |
|
| 1992 | + } |
|
| 1993 | + |
|
| 1994 | + if ($length === null) { |
|
| 1995 | + $length = isset($_GET['length']) ? (int) $_GET['length'] : 0; |
|
| 1996 | + } else { |
|
| 1997 | + $length = (int) $length; |
|
| 1998 | + } |
|
| 1897 | 1999 | |
| 1898 | 2000 | $limit = max(0, $limit); |
| 1899 | 2001 | $start = max(0, $start); |
@@ -1911,17 +2013,19 @@ discard block |
||
| 1911 | 2013 | ); |
| 1912 | 2014 | if ($smcFunc['db_num_rows']($request) == 0) |
| 1913 | 2015 | { |
| 1914 | - if ($output_method == 'echo') |
|
| 1915 | - die($txt['ssi_no_guests']); |
|
| 1916 | - else |
|
| 1917 | - return array(); |
|
| 2016 | + if ($output_method == 'echo') { |
|
| 2017 | + die($txt['ssi_no_guests']); |
|
| 2018 | + } else { |
|
| 2019 | + return array(); |
|
| 2020 | + } |
|
| 1918 | 2021 | } |
| 1919 | 2022 | list ($board) = $smcFunc['db_fetch_row']($request); |
| 1920 | 2023 | $smcFunc['db_free_result']($request); |
| 1921 | 2024 | |
| 1922 | 2025 | $icon_sources = array(); |
| 1923 | - foreach ($context['stable_icons'] as $icon) |
|
| 1924 | - $icon_sources[$icon] = 'images_url'; |
|
| 2026 | + foreach ($context['stable_icons'] as $icon) { |
|
| 2027 | + $icon_sources[$icon] = 'images_url'; |
|
| 2028 | + } |
|
| 1925 | 2029 | |
| 1926 | 2030 | if (!empty($modSettings['enable_likes'])) |
| 1927 | 2031 | { |
@@ -1945,12 +2049,14 @@ discard block |
||
| 1945 | 2049 | ) |
| 1946 | 2050 | ); |
| 1947 | 2051 | $posts = array(); |
| 1948 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1949 | - $posts[] = $row['id_first_msg']; |
|
| 2052 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 2053 | + $posts[] = $row['id_first_msg']; |
|
| 2054 | + } |
|
| 1950 | 2055 | $smcFunc['db_free_result']($request); |
| 1951 | 2056 | |
| 1952 | - if (empty($posts)) |
|
| 1953 | - return array(); |
|
| 2057 | + if (empty($posts)) { |
|
| 2058 | + return array(); |
|
| 2059 | + } |
|
| 1954 | 2060 | |
| 1955 | 2061 | // Find the posts. |
| 1956 | 2062 | $request = $smcFunc['db_query']('', ' |
@@ -1980,24 +2086,28 @@ discard block |
||
| 1980 | 2086 | $last_space = strrpos($row['body'], ' '); |
| 1981 | 2087 | $last_open = strrpos($row['body'], '<'); |
| 1982 | 2088 | $last_close = strrpos($row['body'], '>'); |
| 1983 | - if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6) |
|
| 1984 | - $cutoff = $last_open; |
|
| 1985 | - elseif (empty($last_close) || $last_close < $last_open) |
|
| 1986 | - $cutoff = $last_space; |
|
| 2089 | + if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6) { |
|
| 2090 | + $cutoff = $last_open; |
|
| 2091 | + } elseif (empty($last_close) || $last_close < $last_open) { |
|
| 2092 | + $cutoff = $last_space; |
|
| 2093 | + } |
|
| 1987 | 2094 | |
| 1988 | - if ($cutoff !== false) |
|
| 1989 | - $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); |
|
| 2095 | + if ($cutoff !== false) { |
|
| 2096 | + $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); |
|
| 2097 | + } |
|
| 1990 | 2098 | $row['body'] .= '...'; |
| 1991 | 2099 | } |
| 1992 | 2100 | |
| 1993 | 2101 | $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']); |
| 1994 | 2102 | |
| 1995 | - if (!empty($recycle_board) && $row['id_board'] == $recycle_board) |
|
| 1996 | - $row['icon'] = 'recycled'; |
|
| 2103 | + if (!empty($recycle_board) && $row['id_board'] == $recycle_board) { |
|
| 2104 | + $row['icon'] = 'recycled'; |
|
| 2105 | + } |
|
| 1997 | 2106 | |
| 1998 | 2107 | // Check that this message icon is there... |
| 1999 | - if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) |
|
| 2000 | - $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
| 2108 | + if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) { |
|
| 2109 | + $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
| 2110 | + } |
|
| 2001 | 2111 | |
| 2002 | 2112 | censorText($row['subject']); |
| 2003 | 2113 | censorText($row['body']); |
@@ -2034,16 +2144,18 @@ discard block |
||
| 2034 | 2144 | } |
| 2035 | 2145 | $smcFunc['db_free_result']($request); |
| 2036 | 2146 | |
| 2037 | - if (empty($return)) |
|
| 2038 | - return $return; |
|
| 2147 | + if (empty($return)) { |
|
| 2148 | + return $return; |
|
| 2149 | + } |
|
| 2039 | 2150 | |
| 2040 | 2151 | $return[count($return) - 1]['is_last'] = true; |
| 2041 | 2152 | |
| 2042 | 2153 | // If mods want to do somthing with this list of posts, let them do that now. |
| 2043 | 2154 | call_integration_hook('integrate_ssi_boardNews', array(&$return)); |
| 2044 | 2155 | |
| 2045 | - if ($output_method != 'echo') |
|
| 2046 | - return $return; |
|
| 2156 | + if ($output_method != 'echo') { |
|
| 2157 | + return $return; |
|
| 2158 | + } |
|
| 2047 | 2159 | |
| 2048 | 2160 | foreach ($return as $news) |
| 2049 | 2161 | { |
@@ -2095,9 +2207,10 @@ discard block |
||
| 2095 | 2207 | echo ' |
| 2096 | 2208 | </div>'; |
| 2097 | 2209 | |
| 2098 | - if (!$news['is_last']) |
|
| 2099 | - echo ' |
|
| 2210 | + if (!$news['is_last']) { |
|
| 2211 | + echo ' |
|
| 2100 | 2212 | <hr>'; |
| 2213 | + } |
|
| 2101 | 2214 | } |
| 2102 | 2215 | } |
| 2103 | 2216 | |
@@ -2111,8 +2224,9 @@ discard block |
||
| 2111 | 2224 | { |
| 2112 | 2225 | global $user_info, $scripturl, $modSettings, $txt, $context, $smcFunc; |
| 2113 | 2226 | |
| 2114 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
| 2115 | - return; |
|
| 2227 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
| 2228 | + return; |
|
| 2229 | + } |
|
| 2116 | 2230 | |
| 2117 | 2231 | // Find all events which are happening in the near future that the member can see. |
| 2118 | 2232 | $request = $smcFunc['db_query']('', ' |
@@ -2137,20 +2251,23 @@ discard block |
||
| 2137 | 2251 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2138 | 2252 | { |
| 2139 | 2253 | // Check if we've already come by an event linked to this same topic with the same title... and don't display it if we have. |
| 2140 | - if (!empty($duplicates[$row['title'] . $row['id_topic']])) |
|
| 2141 | - continue; |
|
| 2254 | + if (!empty($duplicates[$row['title'] . $row['id_topic']])) { |
|
| 2255 | + continue; |
|
| 2256 | + } |
|
| 2142 | 2257 | |
| 2143 | 2258 | // Censor the title. |
| 2144 | 2259 | censorText($row['title']); |
| 2145 | 2260 | |
| 2146 | - if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) |
|
| 2147 | - $date = strftime('%Y-%m-%d', forum_time(false)); |
|
| 2148 | - else |
|
| 2149 | - $date = $row['start_date']; |
|
| 2261 | + if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) { |
|
| 2262 | + $date = strftime('%Y-%m-%d', forum_time(false)); |
|
| 2263 | + } else { |
|
| 2264 | + $date = $row['start_date']; |
|
| 2265 | + } |
|
| 2150 | 2266 | |
| 2151 | 2267 | // If the topic it is attached to is not approved then don't link it. |
| 2152 | - if (!empty($row['id_first_msg']) && !$row['approved']) |
|
| 2153 | - $row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0; |
|
| 2268 | + if (!empty($row['id_first_msg']) && !$row['approved']) { |
|
| 2269 | + $row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0; |
|
| 2270 | + } |
|
| 2154 | 2271 | |
| 2155 | 2272 | $return[$date][] = array( |
| 2156 | 2273 | 'id' => $row['id_event'], |
@@ -2169,24 +2286,27 @@ discard block |
||
| 2169 | 2286 | } |
| 2170 | 2287 | $smcFunc['db_free_result']($request); |
| 2171 | 2288 | |
| 2172 | - foreach ($return as $mday => $array) |
|
| 2173 | - $return[$mday][count($array) - 1]['is_last'] = true; |
|
| 2289 | + foreach ($return as $mday => $array) { |
|
| 2290 | + $return[$mday][count($array) - 1]['is_last'] = true; |
|
| 2291 | + } |
|
| 2174 | 2292 | |
| 2175 | 2293 | // If mods want to do somthing with this list of events, let them do that now. |
| 2176 | 2294 | call_integration_hook('integrate_ssi_recentEvents', array(&$return)); |
| 2177 | 2295 | |
| 2178 | - if ($output_method != 'echo' || empty($return)) |
|
| 2179 | - return $return; |
|
| 2296 | + if ($output_method != 'echo' || empty($return)) { |
|
| 2297 | + return $return; |
|
| 2298 | + } |
|
| 2180 | 2299 | |
| 2181 | 2300 | // Well the output method is echo. |
| 2182 | 2301 | echo ' |
| 2183 | 2302 | <span class="event">' . $txt['events'] . '</span> '; |
| 2184 | - foreach ($return as $mday => $array) |
|
| 2185 | - foreach ($array as $event) |
|
| 2303 | + foreach ($return as $mday => $array) { |
|
| 2304 | + foreach ($array as $event) |
|
| 2186 | 2305 | { |
| 2187 | 2306 | if ($event['can_edit']) |
| 2188 | 2307 | echo ' |
| 2189 | 2308 | <a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> '; |
| 2309 | + } |
|
| 2190 | 2310 | |
| 2191 | 2311 | echo ' |
| 2192 | 2312 | ' . $event['link'] . (!$event['is_last'] ? ', ' : ''); |
@@ -2205,8 +2325,9 @@ discard block |
||
| 2205 | 2325 | global $smcFunc; |
| 2206 | 2326 | |
| 2207 | 2327 | // If $id is null, this was most likely called from a query string and should do nothing. |
| 2208 | - if ($id === null) |
|
| 2209 | - return; |
|
| 2328 | + if ($id === null) { |
|
| 2329 | + return; |
|
| 2330 | + } |
|
| 2210 | 2331 | |
| 2211 | 2332 | $request = $smcFunc['db_query']('', ' |
| 2212 | 2333 | SELECT passwd, member_name, is_activated |
@@ -2238,8 +2359,9 @@ discard block |
||
| 2238 | 2359 | $attachments_boards = boardsAllowedTo('view_attachments'); |
| 2239 | 2360 | |
| 2240 | 2361 | // No boards? Adios amigo. |
| 2241 | - if (empty($attachments_boards)) |
|
| 2242 | - return array(); |
|
| 2362 | + if (empty($attachments_boards)) { |
|
| 2363 | + return array(); |
|
| 2364 | + } |
|
| 2243 | 2365 | |
| 2244 | 2366 | // Is it an array? |
| 2245 | 2367 | $attachment_ext = (array) $attachment_ext; |
@@ -2323,8 +2445,9 @@ discard block |
||
| 2323 | 2445 | call_integration_hook('integrate_ssi_recentAttachments', array(&$attachments)); |
| 2324 | 2446 | |
| 2325 | 2447 | // So you just want an array? Here you can have it. |
| 2326 | - if ($output_method == 'array' || empty($attachments)) |
|
| 2327 | - return $attachments; |
|
| 2448 | + if ($output_method == 'array' || empty($attachments)) { |
|
| 2449 | + return $attachments; |
|
| 2450 | + } |
|
| 2328 | 2451 | |
| 2329 | 2452 | // Give them the default. |
| 2330 | 2453 | echo ' |
@@ -2335,14 +2458,15 @@ discard block |
||
| 2335 | 2458 | <th style="text-align: left; padding: 2">', $txt['downloads'], '</th> |
| 2336 | 2459 | <th style="text-align: left; padding: 2">', $txt['filesize'], '</th> |
| 2337 | 2460 | </tr>'; |
| 2338 | - foreach ($attachments as $attach) |
|
| 2339 | - echo ' |
|
| 2461 | + foreach ($attachments as $attach) { |
|
| 2462 | + echo ' |
|
| 2340 | 2463 | <tr> |
| 2341 | 2464 | <td>', $attach['file']['link'], '</td> |
| 2342 | 2465 | <td>', $attach['member']['link'], '</td> |
| 2343 | 2466 | <td style="text-align: center">', $attach['file']['downloads'], '</td> |
| 2344 | 2467 | <td>', $attach['file']['filesize'], '</td> |
| 2345 | 2468 | </tr>'; |
| 2469 | + } |
|
| 2346 | 2470 | echo ' |
| 2347 | 2471 | </table>'; |
| 2348 | 2472 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @param string $grid_name The grid name |
| 62 | 62 | * @param bool $is_mini Is this a mini grid? |
| 63 | - * @return void|bool Returns false if the grid doesn't exist. |
|
| 63 | + * @return false|null Returns false if the grid doesn't exist. |
|
| 64 | 64 | */ |
| 65 | 65 | function template_show_month_grid($grid_name, $is_mini = false) |
| 66 | 66 | { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * Shows a weekly grid |
| 313 | 313 | * |
| 314 | 314 | * @param string $grid_name The name of the grid |
| 315 | - * @return void|bool Returns false if the grid doesn't exist |
|
| 315 | + * @return false|null Returns false if the grid doesn't exist |
|
| 316 | 316 | */ |
| 317 | 317 | function template_show_week_grid($grid_name) |
| 318 | 318 | { |
@@ -172,23 +172,23 @@ discard block |
||
| 172 | 172 | // Additional classes are given for events, holidays, and birthdays. |
| 173 | 173 | if (!empty($day['events']) && !empty($calendar_data['highlight']['events'])) |
| 174 | 174 | { |
| 175 | - if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1,3))) |
|
| 175 | + if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) |
|
| 176 | 176 | $classes[] = 'events'; |
| 177 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2,3))) |
|
| 177 | + elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) |
|
| 178 | 178 | $classes[] = 'events'; |
| 179 | 179 | } |
| 180 | 180 | if (!empty($day['holidays']) && !empty($calendar_data['highlight']['holidays'])) |
| 181 | 181 | { |
| 182 | - if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1,3))) |
|
| 182 | + if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) |
|
| 183 | 183 | $classes[] = 'holidays'; |
| 184 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2,3))) |
|
| 184 | + elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) |
|
| 185 | 185 | $classes[] = 'holidays'; |
| 186 | 186 | } |
| 187 | 187 | if (!empty($day['birthdays']) && !empty($calendar_data['highlight']['birthdays'])) |
| 188 | 188 | { |
| 189 | - if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1,3))) |
|
| 189 | + if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) |
|
| 190 | 190 | $classes[] = 'birthdays'; |
| 191 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2,3))) |
|
| 191 | + elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) |
|
| 192 | 192 | $classes[] = 'birthdays'; |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | elseif ($is_mini === false) |
| 288 | 288 | { |
| 289 | 289 | if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) |
| 290 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- + 1, '</a>'; |
|
| 290 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>'; |
|
| 291 | 291 | elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) |
| 292 | 292 | echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
| 293 | 293 | } |
@@ -40,8 +40,7 @@ discard block |
||
| 40 | 40 | ', template_show_week_grid('main'), ' |
| 41 | 41 | </div> |
| 42 | 42 | '; |
| 43 | - } |
|
| 44 | - else |
|
| 43 | + } else |
|
| 45 | 44 | { |
| 46 | 45 | echo ' |
| 47 | 46 | <div id="main_grid"> |
@@ -67,17 +66,19 @@ discard block |
||
| 67 | 66 | global $context, $settings, $txt, $scripturl, $modSettings; |
| 68 | 67 | |
| 69 | 68 | // If the grid doesn't exist, no point in proceeding. |
| 70 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
| 71 | - return false; |
|
| 69 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
| 70 | + return false; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | 73 | // A handy little pointer variable. |
| 74 | 74 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
| 75 | 75 | |
| 76 | 76 | // Some conditions for whether or not we should show the week links *here*. |
| 77 | - if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) |
|
| 78 | - $show_week_links = true; |
|
| 79 | - else |
|
| 80 | - $show_week_links = false; |
|
| 77 | + if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) { |
|
| 78 | + $show_week_links = true; |
|
| 79 | + } else { |
|
| 80 | + $show_week_links = false; |
|
| 81 | + } |
|
| 81 | 82 | |
| 82 | 83 | // Assuming that we've not disabled it, show the title block! |
| 83 | 84 | if (empty($calendar_data['disable_title'])) |
@@ -124,8 +125,9 @@ discard block |
||
| 124 | 125 | echo '<tr>'; |
| 125 | 126 | |
| 126 | 127 | // If we're showing week links, there's an extra column ahead of the week links, so let's think ahead and be prepared! |
| 127 | - if ($show_week_links === true) |
|
| 128 | - echo '<th> </th>'; |
|
| 128 | + if ($show_week_links === true) { |
|
| 129 | + echo '<th> </th>'; |
|
| 130 | + } |
|
| 129 | 131 | |
| 130 | 132 | // Now, loop through each actual day of the week. |
| 131 | 133 | foreach ($calendar_data['week_days'] as $day) |
@@ -172,29 +174,32 @@ discard block |
||
| 172 | 174 | // Additional classes are given for events, holidays, and birthdays. |
| 173 | 175 | if (!empty($day['events']) && !empty($calendar_data['highlight']['events'])) |
| 174 | 176 | { |
| 175 | - if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1,3))) |
|
| 176 | - $classes[] = 'events'; |
|
| 177 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2,3))) |
|
| 178 | - $classes[] = 'events'; |
|
| 177 | + if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1,3))) { |
|
| 178 | + $classes[] = 'events'; |
|
| 179 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2,3))) { |
|
| 180 | + $classes[] = 'events'; |
|
| 181 | + } |
|
| 179 | 182 | } |
| 180 | 183 | if (!empty($day['holidays']) && !empty($calendar_data['highlight']['holidays'])) |
| 181 | 184 | { |
| 182 | - if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1,3))) |
|
| 183 | - $classes[] = 'holidays'; |
|
| 184 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2,3))) |
|
| 185 | - $classes[] = 'holidays'; |
|
| 185 | + if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1,3))) { |
|
| 186 | + $classes[] = 'holidays'; |
|
| 187 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2,3))) { |
|
| 188 | + $classes[] = 'holidays'; |
|
| 189 | + } |
|
| 186 | 190 | } |
| 187 | 191 | if (!empty($day['birthdays']) && !empty($calendar_data['highlight']['birthdays'])) |
| 188 | 192 | { |
| 189 | - if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1,3))) |
|
| 190 | - $classes[] = 'birthdays'; |
|
| 191 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2,3))) |
|
| 192 | - $classes[] = 'birthdays'; |
|
| 193 | + if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1,3))) { |
|
| 194 | + $classes[] = 'birthdays'; |
|
| 195 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2,3))) { |
|
| 196 | + $classes[] = 'birthdays'; |
|
| 197 | + } |
|
| 193 | 198 | } |
| 194 | - } |
|
| 195 | - else |
|
| 196 | - // Default Classes (either compact or comfortable and disabled). |
|
| 199 | + } else { |
|
| 200 | + // Default Classes (either compact or comfortable and disabled). |
|
| 197 | 201 | $classes[] = !empty($calendar_data['size']) && $calendar_data['size'] == 'small' ? 'compact' : 'comfortable'; |
| 202 | + } |
|
| 198 | 203 | $classes[] = 'disabled'; |
| 199 | 204 | |
| 200 | 205 | // Now, implode the classes for each day. |
@@ -208,17 +213,19 @@ discard block |
||
| 208 | 213 | $title_prefix = !empty($day['is_first_of_month']) && $context['current_month'] == $calendar_data['current_month'] && $is_mini === false ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$calendar_data['current_month']] . ' ' : $txt['months_titles'][$calendar_data['current_month']] . ' ') : ''; |
| 209 | 214 | |
| 210 | 215 | // The actual day number - be it a link, or just plain old text! |
| 211 | - if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) |
|
| 212 | - echo '<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
|
| 213 | - else |
|
| 214 | - echo '<span class="day_text">', $title_prefix, $day['day'], '</span>'; |
|
| 216 | + if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) { |
|
| 217 | + echo '<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
|
| 218 | + } else { |
|
| 219 | + echo '<span class="day_text">', $title_prefix, $day['day'], '</span>'; |
|
| 220 | + } |
|
| 215 | 221 | |
| 216 | 222 | // A lot of stuff, we're not showing on mini-calendars to conserve space. |
| 217 | 223 | if ($is_mini === false) |
| 218 | 224 | { |
| 219 | 225 | // Holidays are always fun, let's show them! |
| 220 | - if (!empty($day['holidays'])) |
|
| 221 | - echo '<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>'; |
|
| 226 | + if (!empty($day['holidays'])) { |
|
| 227 | + echo '<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>'; |
|
| 228 | + } |
|
| 222 | 229 | |
| 223 | 230 | // Happy Birthday Dear, Member! |
| 224 | 231 | if (!empty($day['birthdays'])) |
@@ -236,14 +243,16 @@ discard block |
||
| 236 | 243 | echo '<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] || ($count == 10 && $use_js_hide) ? '' : ', '; |
| 237 | 244 | |
| 238 | 245 | // 9...10! Let's stop there. |
| 239 | - if ($birthday_count == 10 && $use_js_hide) |
|
| 240 | - // !!TODO - Inline CSS and JavaScript should be moved. |
|
| 246 | + if ($birthday_count == 10 && $use_js_hide) { |
|
| 247 | + // !!TODO - Inline CSS and JavaScript should be moved. |
|
| 241 | 248 | echo '<span class="hidelink" id="bdhidelink_', $day['day'], '">...<br><a href="', $scripturl, '?action=calendar;month=', $calendar_data['current_month'], ';year=', $calendar_data['current_year'], ';showbd" onclick="document.getElementById(\'bdhide_', $day['day'], '\').style.display = \'\'; document.getElementById(\'bdhidelink_', $day['day'], '\').style.display = \'none\'; return false;">(', sprintf($txt['calendar_click_all'], count($day['birthdays'])), ')</a></span><span id="bdhide_', $day['day'], '" style="display: none;">, '; |
| 249 | + } |
|
| 242 | 250 | |
| 243 | 251 | ++$birthday_count; |
| 244 | 252 | } |
| 245 | - if ($use_js_hide) |
|
| 246 | - echo '</span>'; |
|
| 253 | + if ($use_js_hide) { |
|
| 254 | + echo '</span>'; |
|
| 255 | + } |
|
| 247 | 256 | |
| 248 | 257 | echo '</div>'; |
| 249 | 258 | } |
@@ -286,10 +295,11 @@ discard block |
||
| 286 | 295 | // Otherwise, assuming it's not a mini-calendar, we can show previous / next month days! |
| 287 | 296 | elseif ($is_mini === false) |
| 288 | 297 | { |
| 289 | - if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) |
|
| 290 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- + 1, '</a>'; |
|
| 291 | - elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) |
|
| 292 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
|
| 298 | + if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) { |
|
| 299 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- + 1, '</a>'; |
|
| 300 | + } elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) { |
|
| 301 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
|
| 302 | + } |
|
| 293 | 303 | } |
| 294 | 304 | |
| 295 | 305 | // Close this day and increase var count. |
@@ -301,8 +311,9 @@ discard block |
||
| 301 | 311 | } |
| 302 | 312 | |
| 303 | 313 | // Quick Month Navigation + Post Event Link on Main Grids! |
| 304 | - if ($is_mini === false) |
|
| 305 | - template_calendar_base($show_week_links === true ? 8 : 7); |
|
| 314 | + if ($is_mini === false) { |
|
| 315 | + template_calendar_base($show_week_links === true ? 8 : 7); |
|
| 316 | + } |
|
| 306 | 317 | |
| 307 | 318 | // The end of our main table. |
| 308 | 319 | echo '</table>'; |
@@ -319,8 +330,9 @@ discard block |
||
| 319 | 330 | global $context, $settings, $txt, $scripturl, $modSettings; |
| 320 | 331 | |
| 321 | 332 | // We might have no reason to proceed, if the variable isn't there. |
| 322 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
| 323 | - return false; |
|
| 333 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
| 334 | + return false; |
|
| 335 | + } |
|
| 324 | 336 | |
| 325 | 337 | // Handy pointer. |
| 326 | 338 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
@@ -356,8 +368,9 @@ discard block |
||
| 356 | 368 | } |
| 357 | 369 | |
| 358 | 370 | // The Month Title + Week Number... |
| 359 | - if (!empty($calendar_data['week_title'])) |
|
| 360 | - echo $calendar_data['week_title']; |
|
| 371 | + if (!empty($calendar_data['week_title'])) { |
|
| 372 | + echo $calendar_data['week_title']; |
|
| 373 | + } |
|
| 361 | 374 | |
| 362 | 375 | echo ' |
| 363 | 376 | </h3> |
@@ -393,10 +406,11 @@ discard block |
||
| 393 | 406 | <tr class="days_wrapper"> |
| 394 | 407 | <td class="', implode(' ', $classes), ' act_day">'; |
| 395 | 408 | // Should the day number be a link? |
| 396 | - if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) |
|
| 397 | - echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>'; |
|
| 398 | - else |
|
| 399 | - echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; |
|
| 409 | + if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) { |
|
| 410 | + echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>'; |
|
| 411 | + } else { |
|
| 412 | + echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; |
|
| 413 | + } |
|
| 400 | 414 | |
| 401 | 415 | echo '</td> |
| 402 | 416 | <td class="', implode(' ', $classes), '', empty($day['events']) ? (' disabled' . ($context['can_post'] ? ' week_post' : '')) : ' events', ' event_col">'; |
@@ -432,8 +446,7 @@ discard block |
||
| 432 | 446 | </a> |
| 433 | 447 | </div> |
| 434 | 448 | <br class="clear">'; |
| 435 | - } |
|
| 436 | - else |
|
| 449 | + } else |
|
| 437 | 450 | { |
| 438 | 451 | if (!empty($context['can_post'])) |
| 439 | 452 | { |
@@ -446,8 +459,9 @@ discard block |
||
| 446 | 459 | echo '</td> |
| 447 | 460 | <td class="', implode(' ', $classes), !empty($day['holidays']) ? ' holidays' : ' disabled', ' holiday_col">'; |
| 448 | 461 | // Show any holidays! |
| 449 | - if (!empty($day['holidays'])) |
|
| 450 | - echo implode('<br>', $day['holidays']); |
|
| 462 | + if (!empty($day['holidays'])) { |
|
| 463 | + echo implode('<br>', $day['holidays']); |
|
| 464 | + } |
|
| 451 | 465 | |
| 452 | 466 | echo '</td> |
| 453 | 467 | <td class="', implode(' ', $classes), '', !empty($day['birthdays']) ? ' birthdays' : ' disabled', ' birthday_col">'; |
@@ -467,8 +481,9 @@ discard block |
||
| 467 | 481 | } |
| 468 | 482 | |
| 469 | 483 | // We'll show the lower column after our last month is shown. |
| 470 | - if ($iteration == $num_months) |
|
| 471 | - template_calendar_base(4); |
|
| 484 | + if ($iteration == $num_months) { |
|
| 485 | + template_calendar_base(4); |
|
| 486 | + } |
|
| 472 | 487 | |
| 473 | 488 | // Increase iteration for loop counting. |
| 474 | 489 | ++$iteration; |
@@ -524,8 +539,9 @@ discard block |
||
| 524 | 539 | echo ' |
| 525 | 540 | <form action="', $scripturl, '?action=calendar;sa=post" method="post" name="postevent" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);smc_saveEntities(\'postevent\', [\'evtitle\']);" style="margin: 0;">'; |
| 526 | 541 | |
| 527 | - if (!empty($context['event']['new'])) |
|
| 528 | - echo '<input type="hidden" name="eventid" value="', $context['event']['eventid'], '">'; |
|
| 542 | + if (!empty($context['event']['new'])) { |
|
| 543 | + echo '<input type="hidden" name="eventid" value="', $context['event']['eventid'], '">'; |
|
| 544 | + } |
|
| 529 | 545 | |
| 530 | 546 | // Start the main table. |
| 531 | 547 | echo ' |
@@ -561,9 +577,10 @@ discard block |
||
| 561 | 577 | <select name="year" id="year" onchange="generateDays();">'; |
| 562 | 578 | |
| 563 | 579 | // Show a list of all the years we allow... |
| 564 | - for ($year = $context['calendar_resources']['min_year']; $year <= $context['calendar_resources']['max_year']; $year++) |
|
| 565 | - echo ' |
|
| 580 | + for ($year = $context['calendar_resources']['min_year']; $year <= $context['calendar_resources']['max_year']; $year++) { |
|
| 581 | + echo ' |
|
| 566 | 582 | <option value="', $year, '"', $year == $context['event']['year'] ? ' selected' : '', '>', $year, ' </option>'; |
| 583 | + } |
|
| 567 | 584 | |
| 568 | 585 | echo ' |
| 569 | 586 | </select> |
@@ -571,9 +588,10 @@ discard block |
||
| 571 | 588 | <select name="month" id="month" onchange="generateDays();">'; |
| 572 | 589 | |
| 573 | 590 | // There are 12 months per year - ensure that they all get listed. |
| 574 | - for ($month = 1; $month <= 12; $month++) |
|
| 575 | - echo ' |
|
| 591 | + for ($month = 1; $month <= 12; $month++) { |
|
| 592 | + echo ' |
|
| 576 | 593 | <option value="', $month, '"', $month == $context['event']['month'] ? ' selected' : '', '>', $txt['months'][$month], ' </option>'; |
| 594 | + } |
|
| 577 | 595 | |
| 578 | 596 | echo ' |
| 579 | 597 | </select> |
@@ -581,21 +599,23 @@ discard block |
||
| 581 | 599 | <select name="day" id="day">'; |
| 582 | 600 | |
| 583 | 601 | // This prints out all the days in the current month - this changes dynamically as we switch months. |
| 584 | - for ($day = 1; $day <= $context['event']['last_day']; $day++) |
|
| 585 | - echo ' |
|
| 602 | + for ($day = 1; $day <= $context['event']['last_day']; $day++) { |
|
| 603 | + echo ' |
|
| 586 | 604 | <option value="', $day, '"', $day == $context['event']['day'] ? ' selected' : '', '>', $day, ' </option>'; |
| 605 | + } |
|
| 587 | 606 | |
| 588 | 607 | echo ' |
| 589 | 608 | </select> |
| 590 | 609 | </div> |
| 591 | 610 | </fieldset>'; |
| 592 | 611 | |
| 593 | - if (!empty($modSettings['cal_allowspan']) || $context['event']['new']) |
|
| 594 | - echo ' |
|
| 612 | + if (!empty($modSettings['cal_allowspan']) || $context['event']['new']) { |
|
| 613 | + echo ' |
|
| 595 | 614 | <fieldset id="event_options"> |
| 596 | 615 | <legend>', $txt['calendar_event_options'], '</legend> |
| 597 | 616 | <div class="event_options smalltext"> |
| 598 | 617 | <ul class="event_options">'; |
| 618 | + } |
|
| 599 | 619 | |
| 600 | 620 | // If events can span more than one day then allow the user to select how long it should last. |
| 601 | 621 | if (!empty($modSettings['cal_allowspan'])) |
@@ -605,9 +625,10 @@ discard block |
||
| 605 | 625 | ', $txt['calendar_numb_days'], ' |
| 606 | 626 | <select name="span">'; |
| 607 | 627 | |
| 608 | - for ($days = 1; $days <= $modSettings['cal_maxspan']; $days++) |
|
| 609 | - echo ' |
|
| 628 | + for ($days = 1; $days <= $modSettings['cal_maxspan']; $days++) { |
|
| 629 | + echo ' |
|
| 610 | 630 | <option value="', $days, '"', $context['event']['span'] == $days ? ' selected' : '', '>', $days, ' </option>'; |
| 631 | + } |
|
| 611 | 632 | |
| 612 | 633 | echo ' |
| 613 | 634 | </select> |
@@ -629,9 +650,10 @@ discard block |
||
| 629 | 650 | { |
| 630 | 651 | echo ' |
| 631 | 652 | <optgroup label="', $category['name'], '">'; |
| 632 | - foreach ($category['boards'] as $board) |
|
| 633 | - echo ' |
|
| 653 | + foreach ($category['boards'] as $board) { |
|
| 654 | + echo ' |
|
| 634 | 655 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], ' </option>'; |
| 656 | + } |
|
| 635 | 657 | echo ' |
| 636 | 658 | </optgroup>'; |
| 637 | 659 | } |
@@ -640,18 +662,20 @@ discard block |
||
| 640 | 662 | </li>'; |
| 641 | 663 | } |
| 642 | 664 | |
| 643 | - if (!empty($modSettings['cal_allowspan']) || $context['event']['new']) |
|
| 644 | - echo ' |
|
| 665 | + if (!empty($modSettings['cal_allowspan']) || $context['event']['new']) { |
|
| 666 | + echo ' |
|
| 645 | 667 | </ul> |
| 646 | 668 | </div> |
| 647 | 669 | </fieldset>'; |
| 670 | + } |
|
| 648 | 671 | |
| 649 | 672 | echo ' |
| 650 | 673 | <input type="submit" value="', empty($context['event']['new']) ? $txt['save'] : $txt['post'], '" class="button_submit">'; |
| 651 | 674 | // Delete button? |
| 652 | - if (empty($context['event']['new'])) |
|
| 653 | - echo ' |
|
| 675 | + if (empty($context['event']['new'])) { |
|
| 676 | + echo ' |
|
| 654 | 677 | <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['calendar_confirm_delete'], '" class="button_submit you_sure">'; |
| 678 | + } |
|
| 655 | 679 | |
| 656 | 680 | echo ' |
| 657 | 681 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -695,9 +719,10 @@ discard block |
||
| 695 | 719 | |
| 696 | 720 | foreach ($context['clockicons'] as $t => $v) |
| 697 | 721 | { |
| 698 | - foreach ($v as $i) |
|
| 699 | - echo ' |
|
| 722 | + foreach ($v as $i) { |
|
| 723 | + echo ' |
|
| 700 | 724 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
| 725 | + } |
|
| 701 | 726 | } |
| 702 | 727 | |
| 703 | 728 | echo ' |
@@ -722,13 +747,14 @@ discard block |
||
| 722 | 747 | |
| 723 | 748 | foreach ($context['clockicons'] as $t => $v) |
| 724 | 749 | { |
| 725 | - foreach ($v as $i) |
|
| 726 | - echo ' |
|
| 750 | + foreach ($v as $i) { |
|
| 751 | + echo ' |
|
| 727 | 752 | if (', $t, ' >= ', $i, ') |
| 728 | 753 | { |
| 729 | 754 | turnon.push("', $t, '_', $i, '"); |
| 730 | 755 | ', $t, ' -= ', $i, '; |
| 731 | 756 | }'; |
| 757 | + } |
|
| 732 | 758 | } |
| 733 | 759 | |
| 734 | 760 | echo ' |
@@ -792,9 +818,10 @@ discard block |
||
| 792 | 818 | |
| 793 | 819 | foreach ($context['clockicons'] as $t => $v) |
| 794 | 820 | { |
| 795 | - foreach ($v as $i) |
|
| 796 | - echo ' |
|
| 821 | + foreach ($v as $i) { |
|
| 822 | + echo ' |
|
| 797 | 823 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
| 824 | + } |
|
| 798 | 825 | } |
| 799 | 826 | |
| 800 | 827 | echo ' |
@@ -811,13 +838,14 @@ discard block |
||
| 811 | 838 | |
| 812 | 839 | foreach ($context['clockicons'] as $t => $v) |
| 813 | 840 | { |
| 814 | - foreach ($v as $i) |
|
| 815 | - echo ' |
|
| 841 | + foreach ($v as $i) { |
|
| 842 | + echo ' |
|
| 816 | 843 | if (', $t, ' >= ', $i, ') |
| 817 | 844 | { |
| 818 | 845 | turnon.push("', $t, '_', $i, '"); |
| 819 | 846 | ', $t, ' -= ', $i, '; |
| 820 | 847 | }'; |
| 848 | + } |
|
| 821 | 849 | } |
| 822 | 850 | |
| 823 | 851 | echo ' |
@@ -876,9 +904,10 @@ discard block |
||
| 876 | 904 | |
| 877 | 905 | foreach ($context['clockicons'] as $t => $v) |
| 878 | 906 | { |
| 879 | - foreach ($v as $i) |
|
| 880 | - echo ' |
|
| 907 | + foreach ($v as $i) { |
|
| 908 | + echo ' |
|
| 881 | 909 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
| 910 | + } |
|
| 882 | 911 | } |
| 883 | 912 | |
| 884 | 913 | echo ' |
@@ -899,13 +928,14 @@ discard block |
||
| 899 | 928 | |
| 900 | 929 | foreach ($context['clockicons'] as $t => $v) |
| 901 | 930 | { |
| 902 | - foreach ($v as $i) |
|
| 903 | - echo ' |
|
| 931 | + foreach ($v as $i) { |
|
| 932 | + echo ' |
|
| 904 | 933 | if (', $t, ' >= ', $i, ') |
| 905 | 934 | { |
| 906 | 935 | turnon.push("', $t, '_', $i, '"); |
| 907 | 936 | ', $t, ' -= ', $i, '; |
| 908 | 937 | }'; |
| 938 | + } |
|
| 909 | 939 | } |
| 910 | 940 | |
| 911 | 941 | echo ' |
@@ -227,7 +227,7 @@ |
||
| 227 | 227 | * @param int|string $verify_id The verification control ID |
| 228 | 228 | * @param string $display_type What type to display. Can be 'single' to only show one verification option or 'all' to show all of them |
| 229 | 229 | * @param bool $reset Whether to reset the internal tracking counter |
| 230 | - * @return bool False if there's nothing else to show, true if $display_type is 'single', nothing otherwise |
|
| 230 | + * @return boolean|null False if there's nothing else to show, true if $display_type is 'single', nothing otherwise |
|
| 231 | 231 | */ |
| 232 | 232 | function template_control_verification($verify_id, $display_type = 'all', $reset = false) |
| 233 | 233 | { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | ', !empty($context['bbcodes_handlers']) ? $context['bbcodes_handlers'] : '', ' |
| 33 | 33 | |
| 34 | 34 | $("#', $editor_id, '").sceditor({ |
| 35 | - ',( $editor_id != 'quickReply' ? 'autofocus : true,' : '' ),' |
|
| 35 | + ',($editor_id != 'quickReply' ? 'autofocus : true,' : ''), ' |
|
| 36 | 36 | style: "', $settings['default_theme_url'], '/css/jquery.sceditor.default.css", |
| 37 | 37 | emoticonsCompat: true,', !empty($editor_context['locale']) ? ' |
| 38 | 38 | locale: \'' . $editor_context['locale'] . '\',' : '', !empty($context['right_to_left']) ? ' |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | if (!empty($context['drafts_pm_save'])) |
| 161 | 161 | echo ' |
| 162 | - <input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="submitThisOnce(this);" accesskey="d" class="button_submit"> |
|
| 162 | + <input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="submitThisOnce(this);" accesskey="d" class="button_submit"> |
|
| 163 | 163 | <input type="hidden" id="id_pm_draft" name="id_pm_draft" value="', empty($context['id_pm_draft']) ? 0 : $context['id_pm_draft'], '">'; |
| 164 | 164 | |
| 165 | 165 | if (!empty($context['drafts_save'])) |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | <span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"> </span> |
| 187 | 187 | <span id="draft_lastautosave" ></span> |
| 188 | 188 | </span> |
| 189 | - <script src="', $settings['default_theme_url'], '/scripts/drafts.js', $modSettings['browser_cache'] ,'"></script> |
|
| 189 | + <script src="', $settings['default_theme_url'], '/scripts/drafts.js', $modSettings['browser_cache'], '"></script> |
|
| 190 | 190 | <script> |
| 191 | 191 | var oDraftAutoSave = new smf_DraftAutoSave({ |
| 192 | 192 | sSelf: \'oDraftAutoSave\', |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | <span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"> </span> |
| 208 | 208 | <span id="draft_lastautosave" ></span> |
| 209 | 209 | </span> |
| 210 | - <script src="', $settings['default_theme_url'], '/scripts/drafts.js', $modSettings['browser_cache'] ,'"></script> |
|
| 210 | + <script src="', $settings['default_theme_url'], '/scripts/drafts.js', $modSettings['browser_cache'], '"></script> |
|
| 211 | 211 | <script> |
| 212 | 212 | var oDraftAutoSave = new smf_DraftAutoSave({ |
| 213 | 213 | sSelf: \'oDraftAutoSave\', |
@@ -53,14 +53,15 @@ discard block |
||
| 53 | 53 | foreach ($context['smileys'] as $location => $smileyRows) |
| 54 | 54 | { |
| 55 | 55 | $countLocations--; |
| 56 | - if ($location == 'postform') |
|
| 57 | - echo ' |
|
| 56 | + if ($location == 'postform') { |
|
| 57 | + echo ' |
|
| 58 | 58 | dropdown: |
| 59 | 59 | {'; |
| 60 | - elseif ($location == 'popup') |
|
| 61 | - echo ' |
|
| 60 | + } elseif ($location == 'popup') { |
|
| 61 | + echo ' |
|
| 62 | 62 | popup: |
| 63 | 63 | {'; |
| 64 | + } |
|
| 64 | 65 | |
| 65 | 66 | $numRows = count($smileyRows); |
| 66 | 67 | // This is needed because otherwise the editor will remove all the duplicate (empty) keys and leave only 1 additional line |
@@ -72,20 +73,21 @@ discard block |
||
| 72 | 73 | echo ' |
| 73 | 74 | ', JavaScriptEscape($smiley['code']), ': ', JavaScriptEscape($settings['smileys_url'] . '/' . $smiley['filename']), empty($smiley['isLast']) ? ',' : ''; |
| 74 | 75 | } |
| 75 | - if (empty($smileyRow['isLast']) && $numRows != 1) |
|
| 76 | - echo ', |
|
| 76 | + if (empty($smileyRow['isLast']) && $numRows != 1) { |
|
| 77 | + echo ', |
|
| 77 | 78 | \'-', $emptyPlaceholder++, '\': \'\','; |
| 79 | + } |
|
| 78 | 80 | } |
| 79 | 81 | echo ' |
| 80 | 82 | }', $countLocations != 0 ? ',' : ''; |
| 81 | 83 | } |
| 82 | 84 | echo ' |
| 83 | 85 | }'; |
| 84 | - } |
|
| 85 | - else |
|
| 86 | - echo ', |
|
| 86 | + } else { |
|
| 87 | + echo ', |
|
| 87 | 88 | emoticons: |
| 88 | 89 | {}'; |
| 90 | + } |
|
| 89 | 91 | |
| 90 | 92 | if ($context['show_bbc'] && $bbcContainer !== null) |
| 91 | 93 | { |
@@ -96,15 +98,16 @@ discard block |
||
| 96 | 98 | { |
| 97 | 99 | echo implode('|', $buttonRow); |
| 98 | 100 | $count_tags--; |
| 99 | - if (!empty($count_tags)) |
|
| 100 | - echo '||'; |
|
| 101 | + if (!empty($count_tags)) { |
|
| 102 | + echo '||'; |
|
| 103 | + } |
|
| 101 | 104 | } |
| 102 | 105 | |
| 103 | 106 | echo '",'; |
| 104 | - } |
|
| 105 | - else |
|
| 106 | - echo ', |
|
| 107 | + } else { |
|
| 108 | + echo ', |
|
| 107 | 109 | toolbar: "",'; |
| 110 | + } |
|
| 108 | 111 | |
| 109 | 112 | echo ' |
| 110 | 113 | }); |
@@ -145,43 +148,48 @@ discard block |
||
| 145 | 148 | </span>'; |
| 146 | 149 | |
| 147 | 150 | $tempTab = $context['tabindex']; |
| 148 | - if (!empty($context['drafts_pm_save'])) |
|
| 149 | - $tempTab++; |
|
| 150 | - elseif (!empty($context['drafts_save'])) |
|
| 151 | - $tempTab++; |
|
| 152 | - elseif ($editor_context['preview_type']) |
|
| 153 | - $tempTab++; |
|
| 154 | - elseif ($context['show_spellchecking']) |
|
| 155 | - $tempTab++; |
|
| 151 | + if (!empty($context['drafts_pm_save'])) { |
|
| 152 | + $tempTab++; |
|
| 153 | + } elseif (!empty($context['drafts_save'])) { |
|
| 154 | + $tempTab++; |
|
| 155 | + } elseif ($editor_context['preview_type']) { |
|
| 156 | + $tempTab++; |
|
| 157 | + } elseif ($context['show_spellchecking']) { |
|
| 158 | + $tempTab++; |
|
| 159 | + } |
|
| 156 | 160 | |
| 157 | 161 | $tempTab++; |
| 158 | 162 | $context['tabindex'] = $tempTab; |
| 159 | 163 | |
| 160 | - if (!empty($context['drafts_pm_save'])) |
|
| 161 | - echo ' |
|
| 164 | + if (!empty($context['drafts_pm_save'])) { |
|
| 165 | + echo ' |
|
| 162 | 166 | <input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="submitThisOnce(this);" accesskey="d" class="button_submit"> |
| 163 | 167 | <input type="hidden" id="id_pm_draft" name="id_pm_draft" value="', empty($context['id_pm_draft']) ? 0 : $context['id_pm_draft'], '">'; |
| 168 | + } |
|
| 164 | 169 | |
| 165 | - if (!empty($context['drafts_save'])) |
|
| 166 | - echo ' |
|
| 170 | + if (!empty($context['drafts_save'])) { |
|
| 171 | + echo ' |
|
| 167 | 172 | <input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" class="button_submit"> |
| 168 | 173 | <input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '">'; |
| 174 | + } |
|
| 169 | 175 | |
| 170 | - if ($context['show_spellchecking']) |
|
| 171 | - echo ' |
|
| 176 | + if ($context['show_spellchecking']) { |
|
| 177 | + echo ' |
|
| 172 | 178 | <input type="button" value="', $txt['spell_check'], '" tabindex="', --$tempTab, '" onclick="oEditorHandle_', $editor_id, '.spellCheckStart();" class="button_submit">'; |
| 179 | + } |
|
| 173 | 180 | |
| 174 | - if ($editor_context['preview_type']) |
|
| 175 | - echo ' |
|
| 181 | + if ($editor_context['preview_type']) { |
|
| 182 | + echo ' |
|
| 176 | 183 | <input type="submit" name="preview" value="', isset($editor_context['labels']['preview_button']) ? $editor_context['labels']['preview_button'] : $txt['preview'], '" tabindex="', --$tempTab, '" onclick="', $editor_context['preview_type'] == 2 ? 'return event.ctrlKey || previewPost();' : 'return submitThisOnce(this);', '" accesskey="p" class="button_submit">'; |
| 184 | + } |
|
| 177 | 185 | |
| 178 | 186 | |
| 179 | 187 | echo ' |
| 180 | 188 | <input type="submit" value="', isset($editor_context['labels']['post_button']) ? $editor_context['labels']['post_button'] : $txt['post'], '" name="post" tabindex="', --$tempTab, '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit">'; |
| 181 | 189 | |
| 182 | 190 | // Load in the PM autosaver if it's enabled |
| 183 | - if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave'])) |
|
| 184 | - echo ' |
|
| 191 | + if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave'])) { |
|
| 192 | + echo ' |
|
| 185 | 193 | <span class="righttext padding" style="display: block"> |
| 186 | 194 | <span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"> </span> |
| 187 | 195 | <span id="draft_lastautosave" ></span> |
@@ -199,10 +207,11 @@ discard block |
||
| 199 | 207 | iFreq: ', (empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000), ' |
| 200 | 208 | }); |
| 201 | 209 | </script>'; |
| 210 | + } |
|
| 202 | 211 | |
| 203 | 212 | // Start an instance of the auto saver if its enabled |
| 204 | - if (!empty($context['drafts_save']) && !empty($context['drafts_autosave'])) |
|
| 205 | - echo ' |
|
| 213 | + if (!empty($context['drafts_save']) && !empty($context['drafts_autosave'])) { |
|
| 214 | + echo ' |
|
| 206 | 215 | <span class="righttext padding" style="display: block"> |
| 207 | 216 | <span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"> </span> |
| 208 | 217 | <span id="draft_lastautosave" ></span> |
@@ -219,7 +228,8 @@ discard block |
||
| 219 | 228 | iFreq: ', $context['drafts_autosave_frequency'], ' |
| 220 | 229 | }); |
| 221 | 230 | </script>'; |
| 222 | -} |
|
| 231 | + } |
|
| 232 | + } |
|
| 223 | 233 | |
| 224 | 234 | /** |
| 225 | 235 | * This template displays a verification form |
@@ -236,50 +246,56 @@ discard block |
||
| 236 | 246 | $verify_context = &$context['controls']['verification'][$verify_id]; |
| 237 | 247 | |
| 238 | 248 | // Keep track of where we are. |
| 239 | - if (empty($verify_context['tracking']) || $reset) |
|
| 240 | - $verify_context['tracking'] = 0; |
|
| 249 | + if (empty($verify_context['tracking']) || $reset) { |
|
| 250 | + $verify_context['tracking'] = 0; |
|
| 251 | + } |
|
| 241 | 252 | |
| 242 | 253 | // How many items are there to display in total. |
| 243 | 254 | $total_items = count($verify_context['questions']) + ($verify_context['show_visual'] ? 1 : 0); |
| 244 | 255 | |
| 245 | 256 | // If we've gone too far, stop. |
| 246 | - if ($verify_context['tracking'] > $total_items) |
|
| 247 | - return false; |
|
| 257 | + if ($verify_context['tracking'] > $total_items) { |
|
| 258 | + return false; |
|
| 259 | + } |
|
| 248 | 260 | |
| 249 | 261 | // Loop through each item to show them. |
| 250 | 262 | for ($i = 0; $i < $total_items; $i++) |
| 251 | 263 | { |
| 252 | 264 | // If we're after a single item only show it if we're in the right place. |
| 253 | - if ($display_type == 'single' && $verify_context['tracking'] != $i) |
|
| 254 | - continue; |
|
| 265 | + if ($display_type == 'single' && $verify_context['tracking'] != $i) { |
|
| 266 | + continue; |
|
| 267 | + } |
|
| 255 | 268 | |
| 256 | - if ($display_type != 'single') |
|
| 257 | - echo ' |
|
| 269 | + if ($display_type != 'single') { |
|
| 270 | + echo ' |
|
| 258 | 271 | <div id="verification_control_', $i, '" class="verification_control">'; |
| 272 | + } |
|
| 259 | 273 | |
| 260 | 274 | // Display empty field, but only if we have one, and it's the first time. |
| 261 | - if ($verify_context['empty_field'] && empty($i)) |
|
| 262 | - echo ' |
|
| 275 | + if ($verify_context['empty_field'] && empty($i)) { |
|
| 276 | + echo ' |
|
| 263 | 277 | <div class="smalltext vv_special"> |
| 264 | 278 | ', $txt['visual_verification_hidden'], ': |
| 265 | 279 | <input type="text" name="', $_SESSION[$verify_id . '_vv']['empty_field'], '" autocomplete="off" size="30" value=""> |
| 266 | 280 | </div> |
| 267 | 281 | <br>'; |
| 282 | + } |
|
| 268 | 283 | |
| 269 | 284 | // Do the actual stuff - image first? |
| 270 | 285 | if ($i == 0 && $verify_context['show_visual']) |
| 271 | 286 | { |
| 272 | - if ($context['use_graphic_library']) |
|
| 273 | - echo ' |
|
| 287 | + if ($context['use_graphic_library']) { |
|
| 288 | + echo ' |
|
| 274 | 289 | <img src="', $verify_context['image_href'], '" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '">'; |
| 275 | - else |
|
| 276 | - echo ' |
|
| 290 | + } else { |
|
| 291 | + echo ' |
|
| 277 | 292 | <img src="', $verify_context['image_href'], ';letter=1" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_1"> |
| 278 | 293 | <img src="', $verify_context['image_href'], ';letter=2" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_2"> |
| 279 | 294 | <img src="', $verify_context['image_href'], ';letter=3" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_3"> |
| 280 | 295 | <img src="', $verify_context['image_href'], ';letter=4" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_4"> |
| 281 | 296 | <img src="', $verify_context['image_href'], ';letter=5" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_5"> |
| 282 | 297 | <img src="', $verify_context['image_href'], ';letter=6" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_6">'; |
| 298 | + } |
|
| 283 | 299 | |
| 284 | 300 | echo ' |
| 285 | 301 | <div class="smalltext" style="margin: 4px 0 8px 0;"> |
@@ -287,8 +303,7 @@ discard block |
||
| 287 | 303 | ', $txt['visual_verification_description'], ':', $display_type != 'quick_reply' ? '<br>' : '', ' |
| 288 | 304 | <input type="text" name="', $verify_id, '_vv[code]" value="', !empty($verify_context['text_value']) ? $verify_context['text_value'] : '', '" size="30" tabindex="', $context['tabindex']++, '" class="input_text" required> |
| 289 | 305 | </div>'; |
| 290 | - } |
|
| 291 | - else |
|
| 306 | + } else |
|
| 292 | 307 | { |
| 293 | 308 | // Where in the question array is this question? |
| 294 | 309 | $qIndex = $verify_context['show_visual'] ? $i - 1 : $i; |
@@ -300,21 +315,24 @@ discard block |
||
| 300 | 315 | </div>'; |
| 301 | 316 | } |
| 302 | 317 | |
| 303 | - if ($display_type != 'single') |
|
| 304 | - echo ' |
|
| 318 | + if ($display_type != 'single') { |
|
| 319 | + echo ' |
|
| 305 | 320 | </div>'; |
| 321 | + } |
|
| 306 | 322 | |
| 307 | 323 | // If we were displaying just one and we did it, break. |
| 308 | - if ($display_type == 'single' && $verify_context['tracking'] == $i) |
|
| 309 | - break; |
|
| 324 | + if ($display_type == 'single' && $verify_context['tracking'] == $i) { |
|
| 325 | + break; |
|
| 326 | + } |
|
| 310 | 327 | } |
| 311 | 328 | |
| 312 | 329 | // Assume we found something, always, |
| 313 | 330 | $verify_context['tracking']++; |
| 314 | 331 | |
| 315 | 332 | // Tell something displaying piecemeal to keep going. |
| 316 | - if ($display_type == 'single') |
|
| 317 | - return true; |
|
| 318 | -} |
|
| 333 | + if ($display_type == 'single') { |
|
| 334 | + return true; |
|
| 335 | + } |
|
| 336 | + } |
|
| 319 | 337 | |
| 320 | 338 | ?> |
| 321 | 339 | \ No newline at end of file |
@@ -83,6 +83,7 @@ |
||
| 83 | 83 | * Redirection topic options |
| 84 | 84 | * |
| 85 | 85 | * @var string $type What type of topic this is for - currently 'merge' or 'move'. Used to display appropriate text strings... |
| 86 | + * @param string $type |
|
| 86 | 87 | */ |
| 87 | 88 | function template_redirect_options($type) |
| 88 | 89 | { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | // Stick our "create a redirection topic" template in here... |
| 64 | 64 | template_redirect_options('move'); |
| 65 | 65 | |
| 66 | - echo ' |
|
| 66 | + echo ' |
|
| 67 | 67 | <input type="submit" value="', $txt['move_topic'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit"> |
| 68 | 68 | </div> |
| 69 | 69 | </div>'; |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function template_redirect_options($type) |
| 88 | 88 | { |
| 89 | - global $txt, $context, $modSettings; |
|
| 89 | + global $txt, $context, $modSettings; |
|
| 90 | 90 | |
| 91 | - echo ' |
|
| 91 | + echo ' |
|
| 92 | 92 | <label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect"', $context['is_approved'] ? ' checked' : '', ' onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt[$type . '_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check"> ', $txt['post_redirection'], '.</label> |
| 93 | 93 | <fieldset id="reasonArea" style="margin-top: 1ex;', $context['is_approved'] ? '' : 'display: none;', '"> |
| 94 | 94 | <dl class="settings"> |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | |
| 40 | 40 | foreach ($category['boards'] as $board) |
| 41 | 41 | echo ' |
| 42 | - <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level']-1) . '=> ' : '', $board['name'], '</option>'; |
|
| 42 | + <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=> ' : '', $board['name'], '</option>'; |
|
| 43 | 43 | echo ' |
| 44 | 44 | </optgroup>'; |
| 45 | 45 | } |
@@ -37,9 +37,10 @@ discard block |
||
| 37 | 37 | echo ' |
| 38 | 38 | <optgroup label="', $category['name'], '">'; |
| 39 | 39 | |
| 40 | - foreach ($category['boards'] as $board) |
|
| 41 | - echo ' |
|
| 40 | + foreach ($category['boards'] as $board) { |
|
| 41 | + echo ' |
|
| 42 | 42 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level']-1) . '=> ' : '', $board['name'], '</option>'; |
| 43 | + } |
|
| 43 | 44 | echo ' |
| 44 | 45 | </optgroup>'; |
| 45 | 46 | } |
@@ -68,9 +69,10 @@ discard block |
||
| 68 | 69 | </div> |
| 69 | 70 | </div>'; |
| 70 | 71 | |
| 71 | - if ($context['back_to_topic']) |
|
| 72 | - echo ' |
|
| 72 | + if ($context['back_to_topic']) { |
|
| 73 | + echo ' |
|
| 73 | 74 | <input type="hidden" name="goback" value="1">'; |
| 75 | + } |
|
| 74 | 76 | |
| 75 | 77 | echo ' |
| 76 | 78 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -120,8 +122,7 @@ discard block |
||
| 120 | 122 | <option value="86400">', $txt['two_months'], '</option> |
| 121 | 123 | </select> |
| 122 | 124 | </dd>'; |
| 123 | - } |
|
| 124 | - else |
|
| 125 | + } else |
|
| 125 | 126 | { |
| 126 | 127 | echo ' |
| 127 | 128 | <input type="hidden" name="redirect_expires" value="0">'; |
@@ -217,9 +218,9 @@ discard block |
||
| 217 | 218 | <input type="submit" value="', $txt['go'], '" class="button_submit"> |
| 218 | 219 | </form>'; |
| 219 | 220 | |
| 221 | + } else { |
|
| 222 | + echo $txt['target_below']; |
|
| 220 | 223 | } |
| 221 | - else |
|
| 222 | - echo $txt['target_below']; |
|
| 223 | 224 | |
| 224 | 225 | echo ' </h4> |
| 225 | 226 | </div>'; |
@@ -237,12 +238,13 @@ discard block |
||
| 237 | 238 | |
| 238 | 239 | $merge_button = create_button('merge', 'merge', ''); |
| 239 | 240 | |
| 240 | - foreach ($context['topics'] as $topic) |
|
| 241 | - echo ' |
|
| 241 | + foreach ($context['topics'] as $topic) { |
|
| 242 | + echo ' |
|
| 242 | 243 | <li> |
| 243 | 244 | <a href="', $scripturl, '?action=mergetopics;sa=options;board=', $context['current_board'], '.0;from=', $context['origin_topic'], ';to=', $topic['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $merge_button, '</a> |
| 244 | 245 | <a href="', $scripturl, '?topic=', $topic['id'], '.0" target="_blank" class="new_win">', $topic['subject'], '</a> ', $txt['started_by'], ' ', $topic['poster']['link'], ' |
| 245 | 246 | </li>'; |
| 247 | + } |
|
| 246 | 248 | |
| 247 | 249 | echo ' |
| 248 | 250 | </ul> |
@@ -251,8 +253,7 @@ discard block |
||
| 251 | 253 | <div class="pagesection"> |
| 252 | 254 | ', $context['page_index'], ' |
| 253 | 255 | </div>'; |
| 254 | - } |
|
| 255 | - else |
|
| 256 | + } else |
|
| 256 | 257 | { |
| 257 | 258 | // Just a nice "There aren't any topics" message |
| 258 | 259 | echo ' |
@@ -306,8 +307,8 @@ discard block |
||
| 306 | 307 | </tr> |
| 307 | 308 | </thead> |
| 308 | 309 | <tbody>'; |
| 309 | - foreach ($context['topics'] as $topic) |
|
| 310 | - echo ' |
|
| 310 | + foreach ($context['topics'] as $topic) { |
|
| 311 | + echo ' |
|
| 311 | 312 | <tr class="windowbg"> |
| 312 | 313 | <td> |
| 313 | 314 | <input type="checkbox" class="input_check" name="topics[]" value="' . $topic['id'] . '" checked> |
@@ -327,6 +328,7 @@ discard block |
||
| 327 | 328 | <input type="checkbox" class="input_check" name="notifications[]" value="' . $topic['id'] . '" checked> |
| 328 | 329 | </td> |
| 329 | 330 | </tr>'; |
| 331 | + } |
|
| 330 | 332 | echo ' |
| 331 | 333 | </tbody> |
| 332 | 334 | </table> |
@@ -337,9 +339,10 @@ discard block |
||
| 337 | 339 | <fieldset id="merge_subject" class="merge_options"> |
| 338 | 340 | <legend>', $txt['merge_select_subject'], '</legend> |
| 339 | 341 | <select name="subject" onchange="this.form.custom_subject.style.display = (this.options[this.selectedIndex].value != 0) ? \'none\': \'\' ;">'; |
| 340 | - foreach ($context['topics'] as $topic) |
|
| 341 | - echo ' |
|
| 342 | + foreach ($context['topics'] as $topic) { |
|
| 343 | + echo ' |
|
| 342 | 344 | <option value="', $topic['id'], '"' . ($topic['selected'] ? ' selected' : '') . '>', $topic['subject'], '</option>'; |
| 345 | + } |
|
| 343 | 346 | echo ' |
| 344 | 347 | <option value="0">', $txt['merge_custom_subject'], ':</option> |
| 345 | 348 | </select> |
@@ -357,11 +360,12 @@ discard block |
||
| 357 | 360 | <fieldset id="merge_board" class="merge_options"> |
| 358 | 361 | <legend>', $txt['merge_select_target_board'], '</legend> |
| 359 | 362 | <ul>'; |
| 360 | - foreach ($context['boards'] as $board) |
|
| 361 | - echo ' |
|
| 363 | + foreach ($context['boards'] as $board) { |
|
| 364 | + echo ' |
|
| 362 | 365 | <li> |
| 363 | 366 | <input type="radio" name="board" value="' . $board['id'] . '"' . ($board['selected'] ? ' checked' : '') . ' class="input_radio"> ' . $board['name'] . ' |
| 364 | 367 | </li>'; |
| 368 | + } |
|
| 365 | 369 | echo ' |
| 366 | 370 | </ul> |
| 367 | 371 | </fieldset>'; |
@@ -372,11 +376,12 @@ discard block |
||
| 372 | 376 | <fieldset id="merge_poll" class="merge_options"> |
| 373 | 377 | <legend>' . $txt['merge_select_poll'] . '</legend> |
| 374 | 378 | <ul>'; |
| 375 | - foreach ($context['polls'] as $poll) |
|
| 376 | - echo ' |
|
| 379 | + foreach ($context['polls'] as $poll) { |
|
| 380 | + echo ' |
|
| 377 | 381 | <li> |
| 378 | 382 | <input type="radio" name="poll" value="' . $poll['id'] . '"' . ($poll['selected'] ? ' checked' : '') . ' class="input_radio"> ' . $poll['question'] . ' (' . $txt['topic'] . ': <a href="' . $scripturl . '?topic=' . $poll['topic']['id'] . '.0" target="_blank" class="new_win">' . $poll['topic']['subject'] . '</a>) |
| 379 | 383 | </li>'; |
| 384 | + } |
|
| 380 | 385 | echo ' |
| 381 | 386 | <li> |
| 382 | 387 | <input type="radio" name="poll" value="-1" class="input_radio"> (' . $txt['merge_no_poll'] . ') |
@@ -1101,7 +1101,7 @@ |
||
| 1101 | 1101 | /** |
| 1102 | 1102 | * CHMOD control form |
| 1103 | 1103 | * |
| 1104 | - * @return bool False if nothing to do. |
|
| 1104 | + * @return false|null False if nothing to do. |
|
| 1105 | 1105 | */ |
| 1106 | 1106 | function template_control_chmod() |
| 1107 | 1107 | { |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | { |
| 917 | 917 | // 1. Some mod [ Download ]. |
| 918 | 918 | echo ' |
| 919 | - <strong><span id="ps_img_', $i, '_pkg_', $id, '" class="toggle_up" alt="*" style="display: none;"></span> ', $package['can_install'] || !empty($package['can_emulate_install']) ? '<strong>' . $package['name'] . '</strong> <a href="' . $package['download']['href'] . '">[ ' . $txt['download'] . ' ]</a>': $package['name'], '</strong> |
|
| 919 | + <strong><span id="ps_img_', $i, '_pkg_', $id, '" class="toggle_up" alt="*" style="display: none;"></span> ', $package['can_install'] || !empty($package['can_emulate_install']) ? '<strong>' . $package['name'] . '</strong> <a href="' . $package['download']['href'] . '">[ ' . $txt['download'] . ' ]</a>' : $package['name'], '</strong> |
|
| 920 | 920 | <ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">'; |
| 921 | 921 | |
| 922 | 922 | // Show the mod type? |
@@ -1289,10 +1289,10 @@ discard block |
||
| 1289 | 1289 | <head> |
| 1290 | 1290 | <meta charset="', $context['character_set'], '"> |
| 1291 | 1291 | <title>', $txt['operation_title'], '</title> |
| 1292 | - <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'] ,'"> |
|
| 1293 | - <link rel="stylesheet" href="', $settings['theme_url'], '/css/admin.css', $modSettings['browser_cache'] ,'"> |
|
| 1294 | - <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'] ,'"></script> |
|
| 1295 | - <script src="', $settings['default_theme_url'], '/scripts/theme.js', $modSettings['browser_cache'] ,'"></script> |
|
| 1292 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'], '"> |
|
| 1293 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/admin.css', $modSettings['browser_cache'], '"> |
|
| 1294 | + <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'], '"></script> |
|
| 1295 | + <script src="', $settings['default_theme_url'], '/scripts/theme.js', $modSettings['browser_cache'], '"></script> |
|
| 1296 | 1296 | </head> |
| 1297 | 1297 | <body> |
| 1298 | 1298 | <div class="padding windowbg"> |
@@ -31,12 +31,13 @@ discard block |
||
| 31 | 31 | </div> |
| 32 | 32 | <div class="information">'; |
| 33 | 33 | |
| 34 | - if ($context['is_installed']) |
|
| 35 | - echo ' |
|
| 34 | + if ($context['is_installed']) { |
|
| 35 | + echo ' |
|
| 36 | 36 | <strong>', $txt['package_installed_warning1'], '</strong><br> |
| 37 | 37 | <br> |
| 38 | 38 | ', $txt['package_installed_warning2'], '<br> |
| 39 | 39 | <br>'; |
| 40 | + } |
|
| 40 | 41 | |
| 41 | 42 | echo $txt['package_installed_warning3'], ' |
| 42 | 43 | </div><br>'; |
@@ -63,8 +64,9 @@ discard block |
||
| 63 | 64 | ', $context['package_readme'], ' |
| 64 | 65 | <span class="floatright">', $txt['package_available_readme_language'], ' |
| 65 | 66 | <select name="readme_language" id="readme_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=', $context['uninstalling'] ? 'uninstall' : 'install', ';package=', $context['filename'], ';readme=\' + this.options[this.selectedIndex].value + \';license=\' + get_selected(\'license_language\'));">'; |
| 66 | - foreach ($context['readmes'] as $a => $b) |
|
| 67 | - echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_readme_default'] : ucfirst($b), '</option>'; |
|
| 67 | + foreach ($context['readmes'] as $a => $b) { |
|
| 68 | + echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_readme_default'] : ucfirst($b), '</option>'; |
|
| 69 | + } |
|
| 68 | 70 | echo ' |
| 69 | 71 | </select> |
| 70 | 72 | </span> |
@@ -83,8 +85,9 @@ discard block |
||
| 83 | 85 | ', $context['package_license'], ' |
| 84 | 86 | <span class="floatright">', $txt['package_available_license_language'], ' |
| 85 | 87 | <select name="license_language" id="license_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=install', ';package=', $context['filename'], ';license=\' + this.options[this.selectedIndex].value + \';readme=\' + get_selected(\'readme_language\'));">'; |
| 86 | - foreach ($context['licenses'] as $a => $b) |
|
| 87 | - echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_license_default'] : ucfirst($b), '</option>'; |
|
| 88 | + foreach ($context['licenses'] as $a => $b) { |
|
| 89 | + echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_license_default'] : ucfirst($b), '</option>'; |
|
| 90 | + } |
|
| 88 | 91 | echo ' |
| 89 | 92 | </select> |
| 90 | 93 | </span> |
@@ -110,9 +113,10 @@ discard block |
||
| 110 | 113 | ', $txt['package_db_uninstall_actions'], ': |
| 111 | 114 | <ul>'; |
| 112 | 115 | |
| 113 | - foreach ($context['database_changes'] as $change) |
|
| 114 | - echo ' |
|
| 116 | + foreach ($context['database_changes'] as $change) { |
|
| 117 | + echo ' |
|
| 115 | 118 | <li>', $change, '</li>'; |
| 119 | + } |
|
| 116 | 120 | echo ' |
| 117 | 121 | </ul> |
| 118 | 122 | </div> |
@@ -122,14 +126,14 @@ discard block |
||
| 122 | 126 | echo ' |
| 123 | 127 | <div class="information">'; |
| 124 | 128 | |
| 125 | - if (empty($context['actions']) && empty($context['database_changes'])) |
|
| 126 | - echo ' |
|
| 129 | + if (empty($context['actions']) && empty($context['database_changes'])) { |
|
| 130 | + echo ' |
|
| 127 | 131 | <br> |
| 128 | 132 | <div class="errorbox"> |
| 129 | 133 | ', $txt['corrupt_compatible'], ' |
| 130 | 134 | </div> |
| 131 | 135 | </div>'; |
| 132 | - else |
|
| 136 | + } else |
|
| 133 | 137 | { |
| 134 | 138 | echo ' |
| 135 | 139 | ', $txt['perform_actions'], ' |
@@ -230,9 +234,10 @@ discard block |
||
| 230 | 234 | <tr class="title_bar"> |
| 231 | 235 | <td></td> |
| 232 | 236 | <td>'; |
| 233 | - if (!empty($context['themes_locked'])) |
|
| 234 | - echo ' |
|
| 237 | + if (!empty($context['themes_locked'])) { |
|
| 238 | + echo ' |
|
| 235 | 239 | <input type="hidden" name="custom_theme[]" value="', $id, '">'; |
| 240 | + } |
|
| 236 | 241 | echo ' |
| 237 | 242 | <input type="checkbox" name="custom_theme[]" id="custom_theme_', $id, '" value="', $id, '" class="input_check" onclick="', (!empty($theme['has_failure']) ? 'if (this.form.custom_theme_' . $id . '.checked && !confirm(\'' . $txt['package_theme_failure_warning'] . '\')) return false;' : ''), 'invertAll(this, this.form, \'dummy_theme_', $id, '\', true);"', !empty($context['themes_locked']) ? ' disabled checked' : '', '> |
| 238 | 243 | </td> |
@@ -373,14 +378,15 @@ discard block |
||
| 373 | 378 | </script>'; |
| 374 | 379 | |
| 375 | 380 | // And a bit more for database changes. |
| 376 | - if (!empty($context['database_changes'])) |
|
| 377 | - echo ' |
|
| 381 | + if (!empty($context['database_changes'])) { |
|
| 382 | + echo ' |
|
| 378 | 383 | <script> |
| 379 | 384 | var database_changes_area = document.getElementById(\'db_changes_div\'); |
| 380 | 385 | var db_vis = false; |
| 381 | 386 | database_changes_area.style.display = "none"; |
| 382 | 387 | </script>'; |
| 383 | -} |
|
| 388 | + } |
|
| 389 | + } |
|
| 384 | 390 | |
| 385 | 391 | /** |
| 386 | 392 | * Extract package contents |
@@ -412,12 +418,12 @@ discard block |
||
| 412 | 418 | <h3 class="catbg">', $context['uninstalling'] ? $txt['uninstall'] : $txt['extracting'], '</h3> |
| 413 | 419 | </div> |
| 414 | 420 | <div class="information">', $txt['package_installed_extract'], '</div>'; |
| 415 | - } |
|
| 416 | - else |
|
| 417 | - echo ' |
|
| 421 | + } else { |
|
| 422 | + echo ' |
|
| 418 | 423 | <div class="cat_bar"> |
| 419 | 424 | <h3 class="catbg">', $txt['package_installed_redirecting'], '</h3> |
| 420 | 425 | </div>'; |
| 426 | + } |
|
| 421 | 427 | |
| 422 | 428 | echo ' |
| 423 | 429 | <div class="windowbg">'; |
@@ -428,25 +434,25 @@ discard block |
||
| 428 | 434 | echo ' |
| 429 | 435 | ', $context['redirect_text'], '<br><br> |
| 430 | 436 | <a href="', $context['redirect_url'], '">', $txt['package_installed_redirect_go_now'], '</a> | <a href="', $scripturl, '?action=admin;area=packages;sa=browse">', $txt['package_installed_redirect_cancel'], '</a>'; |
| 431 | - } |
|
| 432 | - elseif ($context['uninstalling']) |
|
| 433 | - echo ' |
|
| 437 | + } elseif ($context['uninstalling']) { |
|
| 438 | + echo ' |
|
| 434 | 439 | ', $txt['package_uninstall_done']; |
| 435 | - elseif ($context['install_finished']) |
|
| 440 | + } elseif ($context['install_finished']) |
|
| 436 | 441 | { |
| 437 | - if ($context['extract_type'] == 'avatar') |
|
| 438 | - echo ' |
|
| 442 | + if ($context['extract_type'] == 'avatar') { |
|
| 443 | + echo ' |
|
| 439 | 444 | ', $txt['avatars_extracted']; |
| 440 | - elseif ($context['extract_type'] == 'language') |
|
| 441 | - echo ' |
|
| 445 | + } elseif ($context['extract_type'] == 'language') { |
|
| 446 | + echo ' |
|
| 442 | 447 | ', $txt['language_extracted']; |
| 443 | - else |
|
| 444 | - echo ' |
|
| 448 | + } else { |
|
| 449 | + echo ' |
|
| 445 | 450 | ', $txt['package_installed_done']; |
| 446 | - } |
|
| 447 | - else |
|
| 448 | - echo ' |
|
| 451 | + } |
|
| 452 | + } else { |
|
| 453 | + echo ' |
|
| 449 | 454 | ', $txt['corrupt_compatible']; |
| 455 | + } |
|
| 450 | 456 | |
| 451 | 457 | echo ' |
| 452 | 458 | </div>'; |
@@ -480,9 +486,10 @@ discard block |
||
| 480 | 486 | <div class="windowbg"> |
| 481 | 487 | <ol>'; |
| 482 | 488 | |
| 483 | - foreach ($context['files'] as $fileinfo) |
|
| 484 | - echo ' |
|
| 489 | + foreach ($context['files'] as $fileinfo) { |
|
| 490 | + echo ' |
|
| 485 | 491 | <li><a href="', $scripturl, '?action=admin;area=packages;sa=examine;package=', $context['filename'], ';file=', $fileinfo['filename'], '" title="', $txt['view'], '">', $fileinfo['filename'], '</a> (', $fileinfo['size'], ' ', $txt['package_bytes'], ')</li>'; |
| 492 | + } |
|
| 486 | 493 | |
| 487 | 494 | echo ' |
| 488 | 495 | </ol> |
@@ -546,9 +553,10 @@ discard block |
||
| 546 | 553 | </script> |
| 547 | 554 | <div id="yourVersion" style="display:none">', $context['forum_version'], '</div>'; |
| 548 | 555 | |
| 549 | - if (empty($modSettings['disable_smf_js'])) |
|
| 550 | - echo ' |
|
| 556 | + if (empty($modSettings['disable_smf_js'])) { |
|
| 557 | + echo ' |
|
| 551 | 558 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
| 559 | + } |
|
| 552 | 560 | |
| 553 | 561 | // This sets the announcements and current versions themselves ;). |
| 554 | 562 | echo ' |
@@ -587,12 +595,13 @@ discard block |
||
| 587 | 595 | } |
| 588 | 596 | } |
| 589 | 597 | |
| 590 | - if (!$mods_available) |
|
| 591 | - echo ' |
|
| 598 | + if (!$mods_available) { |
|
| 599 | + echo ' |
|
| 592 | 600 | <div class="noticebox">', $txt['no_packages'], '</div>'; |
| 593 | - else |
|
| 594 | - echo ' |
|
| 601 | + } else { |
|
| 602 | + echo ' |
|
| 595 | 603 | <br>'; |
| 604 | + } |
|
| 596 | 605 | |
| 597 | 606 | // the advanced (emulation) box, collapsed by default |
| 598 | 607 | echo ' |
@@ -681,11 +690,12 @@ discard block |
||
| 681 | 690 | { |
| 682 | 691 | global $context, $txt, $scripturl; |
| 683 | 692 | |
| 684 | - if (!empty($context['package_ftp']['error'])) |
|
| 685 | - echo ' |
|
| 693 | + if (!empty($context['package_ftp']['error'])) { |
|
| 694 | + echo ' |
|
| 686 | 695 | <div class="errorbox"> |
| 687 | 696 | <pre>', $context['package_ftp']['error'], '</pre> |
| 688 | 697 | </div>'; |
| 698 | + } |
|
| 689 | 699 | |
| 690 | 700 | echo ' |
| 691 | 701 | <div id="admin_form_wrapper"> |
@@ -767,13 +777,14 @@ discard block |
||
| 767 | 777 | <fieldset> |
| 768 | 778 | <legend>' . $txt['package_servers'] . '</legend> |
| 769 | 779 | <ul class="package_servers">'; |
| 770 | - foreach ($context['servers'] as $server) |
|
| 771 | - echo ' |
|
| 780 | + foreach ($context['servers'] as $server) { |
|
| 781 | + echo ' |
|
| 772 | 782 | <li class="flow_auto"> |
| 773 | 783 | <span class="floatleft">' . $server['name'] . '</span> |
| 774 | 784 | <span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=remove;server=' . $server['id'] . ';', $context['session_var'], '=', $context['session_id'], '">[ ' . $txt['delete'] . ' ]</a></span> |
| 775 | 785 | <span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $server['id'] . '">[ ' . $txt['package_browse'] . ' ]</a></span> |
| 776 | 786 | </li>'; |
| 787 | + } |
|
| 777 | 788 | echo ' |
| 778 | 789 | </ul> |
| 779 | 790 | </fieldset> |
@@ -862,11 +873,12 @@ discard block |
||
| 862 | 873 | <div class="windowbg2">'; |
| 863 | 874 | |
| 864 | 875 | // No packages, as yet. |
| 865 | - if (empty($context['package_list'])) |
|
| 866 | - echo ' |
|
| 876 | + if (empty($context['package_list'])) { |
|
| 877 | + echo ' |
|
| 867 | 878 | <ul> |
| 868 | 879 | <li>', $txt['no_packages'], '</li> |
| 869 | 880 | </ul>'; |
| 881 | + } |
|
| 870 | 882 | // List out the packages... |
| 871 | 883 | else |
| 872 | 884 | { |
@@ -878,11 +890,12 @@ discard block |
||
| 878 | 890 | <li> |
| 879 | 891 | <strong><span id="ps_img_', $i, '" class="toggle_up" alt="*" style="display: none;"></span> ', $packageSection['title'], '</strong>'; |
| 880 | 892 | |
| 881 | - if (!empty($packageSection['text'])) |
|
| 882 | - echo ' |
|
| 893 | + if (!empty($packageSection['text'])) { |
|
| 894 | + echo ' |
|
| 883 | 895 | <div class="sub_bar"> |
| 884 | 896 | <h3 class="subbg">', $packageSection['text'], '</h3> |
| 885 | 897 | </div>'; |
| 898 | + } |
|
| 886 | 899 | |
| 887 | 900 | echo ' |
| 888 | 901 | <', $context['list_type'], ' id="package_section_', $i, '" class="packages">'; |
@@ -892,13 +905,15 @@ discard block |
||
| 892 | 905 | echo ' |
| 893 | 906 | <li>'; |
| 894 | 907 | // Textual message. Could be empty just for a blank line... |
| 895 | - if ($package['is_text']) |
|
| 896 | - echo ' |
|
| 908 | + if ($package['is_text']) { |
|
| 909 | + echo ' |
|
| 897 | 910 | ', empty($package['name']) ? ' ' : $package['name']; |
| 911 | + } |
|
| 898 | 912 | // This is supposed to be a rule.. |
| 899 | - elseif ($package['is_line']) |
|
| 900 | - echo ' |
|
| 913 | + elseif ($package['is_line']) { |
|
| 914 | + echo ' |
|
| 901 | 915 | <hr>'; |
| 916 | + } |
|
| 902 | 917 | // A remote link. |
| 903 | 918 | elseif ($package['is_remote']) |
| 904 | 919 | { |
@@ -920,21 +935,25 @@ discard block |
||
| 920 | 935 | <ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">'; |
| 921 | 936 | |
| 922 | 937 | // Show the mod type? |
| 923 | - if ($package['type'] != '') |
|
| 924 | - echo ' |
|
| 938 | + if ($package['type'] != '') { |
|
| 939 | + echo ' |
|
| 925 | 940 | <li class="package_section">', $txt['package_type'], ': ', $smcFunc['ucwords']($smcFunc['strtolower']($package['type'])), '</li>'; |
| 941 | + } |
|
| 926 | 942 | // Show the version number? |
| 927 | - if ($package['version'] != '') |
|
| 928 | - echo ' |
|
| 943 | + if ($package['version'] != '') { |
|
| 944 | + echo ' |
|
| 929 | 945 | <li class="package_section">', $txt['mod_version'], ': ', $package['version'], '</li>'; |
| 946 | + } |
|
| 930 | 947 | // How 'bout the author? |
| 931 | - if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) |
|
| 932 | - echo ' |
|
| 948 | + if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) { |
|
| 949 | + echo ' |
|
| 933 | 950 | <li class="package_section">', $txt['mod_author'], ': ', $package['author']['link'], '</li>'; |
| 951 | + } |
|
| 934 | 952 | // The homepage.... |
| 935 | - if ($package['author']['website']['link'] != '') |
|
| 936 | - echo ' |
|
| 953 | + if ($package['author']['website']['link'] != '') { |
|
| 954 | + echo ' |
|
| 937 | 955 | <li class="package_section">', $txt['author_website'], ': ', $package['author']['website']['link'], '</li>'; |
| 956 | + } |
|
| 938 | 957 | |
| 939 | 958 | // Desciption: bleh bleh! |
| 940 | 959 | // Location of file: http://someplace/. |
@@ -987,8 +1006,8 @@ discard block |
||
| 987 | 1006 | |
| 988 | 1007 | foreach ($ps['items'] as $id => $package) |
| 989 | 1008 | { |
| 990 | - if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) |
|
| 991 | - echo ' |
|
| 1009 | + if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) { |
|
| 1010 | + echo ' |
|
| 992 | 1011 | var oPackageToggle_', $section, '_pkg_', $id, ' = new smc_Toggle({ |
| 993 | 1012 | bToggleEnabled: true, |
| 994 | 1013 | bCurrentlyCollapsed: true, |
@@ -1003,6 +1022,7 @@ discard block |
||
| 1003 | 1022 | } |
| 1004 | 1023 | ] |
| 1005 | 1024 | });'; |
| 1025 | + } |
|
| 1006 | 1026 | } |
| 1007 | 1027 | } |
| 1008 | 1028 | echo ' |
@@ -1043,9 +1063,10 @@ discard block |
||
| 1043 | 1063 | { |
| 1044 | 1064 | global $context, $txt, $scripturl; |
| 1045 | 1065 | |
| 1046 | - if (!empty($context['saved_successful'])) |
|
| 1047 | - echo ' |
|
| 1066 | + if (!empty($context['saved_successful'])) { |
|
| 1067 | + echo ' |
|
| 1048 | 1068 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 1069 | + } |
|
| 1049 | 1070 | |
| 1050 | 1071 | echo ' |
| 1051 | 1072 | <div id="admincenter"> |
@@ -1108,8 +1129,9 @@ discard block |
||
| 1108 | 1129 | global $context, $txt; |
| 1109 | 1130 | |
| 1110 | 1131 | // Nothing to do? Brilliant! |
| 1111 | - if (empty($context['package_ftp'])) |
|
| 1112 | - return false; |
|
| 1132 | + if (empty($context['package_ftp'])) { |
|
| 1133 | + return false; |
|
| 1134 | + } |
|
| 1113 | 1135 | |
| 1114 | 1136 | if (empty($context['package_ftp']['form_elements_only'])) |
| 1115 | 1137 | { |
@@ -1118,19 +1140,21 @@ discard block |
||
| 1118 | 1140 | <div id="need_writable_list" class="smalltext"> |
| 1119 | 1141 | ', $txt['package_ftp_why_file_list'], ' |
| 1120 | 1142 | <ul style="display: inline;">'; |
| 1121 | - if (!empty($context['notwritable_files'])) |
|
| 1122 | - foreach ($context['notwritable_files'] as $file) |
|
| 1143 | + if (!empty($context['notwritable_files'])) { |
|
| 1144 | + foreach ($context['notwritable_files'] as $file) |
|
| 1123 | 1145 | echo ' |
| 1124 | 1146 | <li>', $file, '</li>'; |
| 1147 | + } |
|
| 1125 | 1148 | |
| 1126 | 1149 | echo ' |
| 1127 | 1150 | </ul>'; |
| 1128 | 1151 | |
| 1129 | - if (!$context['server']['is_windows']) |
|
| 1130 | - echo ' |
|
| 1152 | + if (!$context['server']['is_windows']) { |
|
| 1153 | + echo ' |
|
| 1131 | 1154 | <hr /> |
| 1132 | 1155 | ', $txt['package_chmod_linux'], '<br /> |
| 1133 | 1156 | <tt># chmod a+w ', implode(' ', $context['notwritable_files']), '</tt>'; |
| 1157 | + } |
|
| 1134 | 1158 | |
| 1135 | 1159 | echo ' |
| 1136 | 1160 | </div>'; |
@@ -1141,9 +1165,10 @@ discard block |
||
| 1141 | 1165 | <tt id="ftp_error_message">', !empty($context['package_ftp']['error']) ? $context['package_ftp']['error'] : '', '</tt> |
| 1142 | 1166 | </div></div>'; |
| 1143 | 1167 | |
| 1144 | - if (!empty($context['package_ftp']['destination'])) |
|
| 1145 | - echo ' |
|
| 1168 | + if (!empty($context['package_ftp']['destination'])) { |
|
| 1169 | + echo ' |
|
| 1146 | 1170 | <form action="', $context['package_ftp']['destination'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">'; |
| 1171 | + } |
|
| 1147 | 1172 | |
| 1148 | 1173 | echo ' |
| 1149 | 1174 | <fieldset> |
@@ -1176,25 +1201,28 @@ discard block |
||
| 1176 | 1201 | </dl> |
| 1177 | 1202 | </fieldset>'; |
| 1178 | 1203 | |
| 1179 | - if (empty($context['package_ftp']['form_elements_only'])) |
|
| 1180 | - echo ' |
|
| 1204 | + if (empty($context['package_ftp']['form_elements_only'])) { |
|
| 1205 | + echo ' |
|
| 1181 | 1206 | |
| 1182 | 1207 | <div class="righttext" style="margin: 1ex;"> |
| 1183 | 1208 | <span id="test_ftp_placeholder_full"></span> |
| 1184 | 1209 | <input type="submit" value="', $txt['package_proceed'], '" class="button_submit"> |
| 1185 | 1210 | </div>'; |
| 1211 | + } |
|
| 1186 | 1212 | |
| 1187 | - if (!empty($context['package_ftp']['destination'])) |
|
| 1188 | - echo ' |
|
| 1213 | + if (!empty($context['package_ftp']['destination'])) { |
|
| 1214 | + echo ' |
|
| 1189 | 1215 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 1190 | 1216 | </form>'; |
| 1217 | + } |
|
| 1191 | 1218 | |
| 1192 | 1219 | // Hide the details of the list. |
| 1193 | - if (empty($context['package_ftp']['form_elements_only'])) |
|
| 1194 | - echo ' |
|
| 1220 | + if (empty($context['package_ftp']['form_elements_only'])) { |
|
| 1221 | + echo ' |
|
| 1195 | 1222 | <script> |
| 1196 | 1223 | document.getElementById(\'need_writable_list\').style.display = \'none\'; |
| 1197 | 1224 | </script>'; |
| 1225 | + } |
|
| 1198 | 1226 | |
| 1199 | 1227 | // Quick generate the test button. |
| 1200 | 1228 | echo ' |
@@ -1550,9 +1578,10 @@ discard block |
||
| 1550 | 1578 | <tr class="windowbg"> |
| 1551 | 1579 | <td width="30%"><strong>'; |
| 1552 | 1580 | |
| 1553 | - if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) |
|
| 1554 | - echo ' |
|
| 1581 | + if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) { |
|
| 1582 | + echo ' |
|
| 1555 | 1583 | <span class="generic_icons folder"></span>'; |
| 1584 | + } |
|
| 1556 | 1585 | |
| 1557 | 1586 | echo ' |
| 1558 | 1587 | ', $name, ' |
@@ -1569,8 +1598,9 @@ discard block |
||
| 1569 | 1598 | </tr> |
| 1570 | 1599 | '; |
| 1571 | 1600 | |
| 1572 | - if (!empty($dir['contents'])) |
|
| 1573 | - template_permission_show_contents($name, $dir['contents'], 1); |
|
| 1601 | + if (!empty($dir['contents'])) { |
|
| 1602 | + template_permission_show_contents($name, $dir['contents'], 1); |
|
| 1603 | + } |
|
| 1574 | 1604 | } |
| 1575 | 1605 | |
| 1576 | 1606 | echo ' |
@@ -1606,13 +1636,14 @@ discard block |
||
| 1606 | 1636 | </fieldset>'; |
| 1607 | 1637 | |
| 1608 | 1638 | // Likely to need FTP? |
| 1609 | - if (empty($context['ftp_connected'])) |
|
| 1610 | - echo ' |
|
| 1639 | + if (empty($context['ftp_connected'])) { |
|
| 1640 | + echo ' |
|
| 1611 | 1641 | <p> |
| 1612 | 1642 | ', $txt['package_file_perms_ftp_details'], ': |
| 1613 | 1643 | </p> |
| 1614 | 1644 | ', template_control_chmod(), ' |
| 1615 | 1645 | <div class="noticebox">', $txt['package_file_perms_ftp_retain'], '</div>'; |
| 1646 | + } |
|
| 1616 | 1647 | |
| 1617 | 1648 | echo ' |
| 1618 | 1649 | <span id="test_ftp_placeholder_full"></span> |
@@ -1621,9 +1652,10 @@ discard block |
||
| 1621 | 1652 | </div>'; |
| 1622 | 1653 | |
| 1623 | 1654 | // Any looks fors we've already done? |
| 1624 | - foreach ($context['look_for'] as $path) |
|
| 1625 | - echo ' |
|
| 1655 | + foreach ($context['look_for'] as $path) { |
|
| 1656 | + echo ' |
|
| 1626 | 1657 | <input type="hidden" name="back_look[]" value="', $path, '">'; |
| 1658 | + } |
|
| 1627 | 1659 | echo ' |
| 1628 | 1660 | </form><br>'; |
| 1629 | 1661 | } |
@@ -1662,9 +1694,10 @@ discard block |
||
| 1662 | 1694 | <td class="smalltext" width="30%">' . str_repeat(' ', $level * 5), ' |
| 1663 | 1695 | ', (!empty($dir['type']) && $dir['type'] == 'dir_recursive') || !empty($dir['list_contents']) ? '<a id="link_' . $cur_ident . '" href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident . '/' . $name) . ';back_look=' . $context['back_look_data'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . $cur_ident . '" onclick="return expandFolder(\'' . $cur_ident . '\', \'' . addcslashes($ident . '/' . $name, "'\\") . '\');">' : ''; |
| 1664 | 1696 | |
| 1665 | - if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) |
|
| 1666 | - echo ' |
|
| 1697 | + if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) { |
|
| 1698 | + echo ' |
|
| 1667 | 1699 | <span class="generic_icons folder"></span>'; |
| 1700 | + } |
|
| 1668 | 1701 | |
| 1669 | 1702 | echo ' |
| 1670 | 1703 | ', $name, ' |
@@ -1690,14 +1723,15 @@ discard block |
||
| 1690 | 1723 | } |
| 1691 | 1724 | |
| 1692 | 1725 | // We have more files to show? |
| 1693 | - if ($has_more) |
|
| 1694 | - echo ' |
|
| 1726 | + if ($has_more) { |
|
| 1727 | + echo ' |
|
| 1695 | 1728 | <tr class="windowbg" id="content_', $js_ident, '_more"> |
| 1696 | 1729 | <td class="smalltext" width="40%">' . str_repeat(' ', $level * 5), ' |
| 1697 | 1730 | « <a href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident) . ';fileoffset=', ($context['file_offset'] + $context['file_limit']), ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident) . '">', $txt['package_file_perms_more_files'], '</a> » |
| 1698 | 1731 | </td> |
| 1699 | 1732 | <td colspan="6"></td> |
| 1700 | 1733 | </tr>'; |
| 1734 | + } |
|
| 1701 | 1735 | |
| 1702 | 1736 | if ($drawn_div) |
| 1703 | 1737 | { |
@@ -1705,15 +1739,17 @@ discard block |
||
| 1705 | 1739 | $isFound = false; |
| 1706 | 1740 | foreach ($context['look_for'] as $tree) |
| 1707 | 1741 | { |
| 1708 | - if (substr($tree, 0, strlen($ident)) == $ident) |
|
| 1709 | - $isFound = true; |
|
| 1742 | + if (substr($tree, 0, strlen($ident)) == $ident) { |
|
| 1743 | + $isFound = true; |
|
| 1744 | + } |
|
| 1710 | 1745 | } |
| 1711 | 1746 | |
| 1712 | - if ($level > 1 && !$isFound) |
|
| 1713 | - echo ' |
|
| 1747 | + if ($level > 1 && !$isFound) { |
|
| 1748 | + echo ' |
|
| 1714 | 1749 | <script> |
| 1715 | 1750 | expandFolder(\'', $js_ident, '\', \'\'); |
| 1716 | 1751 | </script>'; |
| 1752 | + } |
|
| 1717 | 1753 | } |
| 1718 | 1754 | } |
| 1719 | 1755 | |
@@ -1733,11 +1769,12 @@ discard block |
||
| 1733 | 1769 | <h3 class="catbg">', $txt['package_file_perms_applying'], '</h3> |
| 1734 | 1770 | </div>'; |
| 1735 | 1771 | |
| 1736 | - if (!empty($context['skip_ftp'])) |
|
| 1737 | - echo ' |
|
| 1772 | + if (!empty($context['skip_ftp'])) { |
|
| 1773 | + echo ' |
|
| 1738 | 1774 | <div class="errorbox"> |
| 1739 | 1775 | ', $txt['package_file_perms_skipping_ftp'], ' |
| 1740 | 1776 | </div>'; |
| 1777 | + } |
|
| 1741 | 1778 | |
| 1742 | 1779 | // How many have we done? |
| 1743 | 1780 | $remaining_items = count($context['method'] == 'individual' ? $context['to_process'] : $context['directory_list']); |
@@ -1775,28 +1812,31 @@ discard block |
||
| 1775 | 1812 | <br>'; |
| 1776 | 1813 | |
| 1777 | 1814 | // Put out the right hidden data. |
| 1778 | - if ($context['method'] == 'individual') |
|
| 1779 | - echo ' |
|
| 1815 | + if ($context['method'] == 'individual') { |
|
| 1816 | + echo ' |
|
| 1780 | 1817 | <input type="hidden" name="custom_value" value="', $context['custom_value'], '"> |
| 1781 | 1818 | <input type="hidden" name="totalItems" value="', $context['total_items'], '"> |
| 1782 | 1819 | <input type="hidden" name="toProcess" value="', base64_encode(json_encode($context['to_process'])), '">'; |
| 1783 | - else |
|
| 1784 | - echo ' |
|
| 1820 | + } else { |
|
| 1821 | + echo ' |
|
| 1785 | 1822 | <input type="hidden" name="predefined" value="', $context['predefined_type'], '"> |
| 1786 | 1823 | <input type="hidden" name="fileOffset" value="', $context['file_offset'], '"> |
| 1787 | 1824 | <input type="hidden" name="totalItems" value="', $context['total_items'], '"> |
| 1788 | 1825 | <input type="hidden" name="dirList" value="', base64_encode(json_encode($context['directory_list'])), '"> |
| 1789 | 1826 | <input type="hidden" name="specialFiles" value="', base64_encode(json_encode($context['special_files'])), '">'; |
| 1827 | + } |
|
| 1790 | 1828 | |
| 1791 | 1829 | // Are we not using FTP for whatever reason. |
| 1792 | - if (!empty($context['skip_ftp'])) |
|
| 1793 | - echo ' |
|
| 1830 | + if (!empty($context['skip_ftp'])) { |
|
| 1831 | + echo ' |
|
| 1794 | 1832 | <input type="hidden" name="skip_ftp" value="1">'; |
| 1833 | + } |
|
| 1795 | 1834 | |
| 1796 | 1835 | // Retain state. |
| 1797 | - foreach ($context['back_look_data'] as $path) |
|
| 1798 | - echo ' |
|
| 1836 | + foreach ($context['back_look_data'] as $path) { |
|
| 1837 | + echo ' |
|
| 1799 | 1838 | <input type="hidden" name="back_look[]" value="', $path, '">'; |
| 1839 | + } |
|
| 1800 | 1840 | |
| 1801 | 1841 | echo ' |
| 1802 | 1842 | <input type="hidden" name="method" value="', $context['method'], '"> |
@@ -20,12 +20,12 @@ |
||
| 20 | 20 | // We completed some tasks? |
| 21 | 21 | if (!empty($context['tasks_were_run'])) |
| 22 | 22 | { |
| 23 | - if (empty($context['scheduled_errors'])) |
|
| 24 | - echo ' |
|
| 23 | + if (empty($context['scheduled_errors'])) { |
|
| 24 | + echo ' |
|
| 25 | 25 | <div class="infobox"> |
| 26 | 26 | ', $txt['scheduled_tasks_were_run'], ' |
| 27 | 27 | </div>'; |
| 28 | - else |
|
| 28 | + } else |
|
| 29 | 29 | { |
| 30 | 30 | echo ' |
| 31 | 31 | <div class="errorbox" id="errors"> |
@@ -67,8 +67,9 @@ discard block |
||
| 67 | 67 | foreach ($context['categories'] as $category) |
| 68 | 68 | { |
| 69 | 69 | // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed) |
| 70 | - if (empty($category['boards']) && !$category['is_collapsed']) |
|
| 71 | - continue; |
|
| 70 | + if (empty($category['boards']) && !$category['is_collapsed']) { |
|
| 71 | + continue; |
|
| 72 | + } |
|
| 72 | 73 | |
| 73 | 74 | echo ' |
| 74 | 75 | <div class="main_container"> |
@@ -76,9 +77,10 @@ discard block |
||
| 76 | 77 | <h3 class="catbg">'; |
| 77 | 78 | |
| 78 | 79 | // If this category even can collapse, show a link to collapse it. |
| 79 | - if ($category['can_collapse']) |
|
| 80 | - echo ' |
|
| 80 | + if ($category['can_collapse']) { |
|
| 81 | + echo ' |
|
| 81 | 82 | <span id="category_', $category['id'], '_upshrink" class="', $category['is_collapsed'] ? 'toggle_down' : 'toggle_up', ' floatright" data-collapsed="', (int) $category['is_collapsed'], '" title="', !$category['is_collapsed'] ? $txt['hide_category'] : $txt['show_category'] ,'" style="display: none;"></span>'; |
| 83 | + } |
|
| 82 | 84 | |
| 83 | 85 | echo ' |
| 84 | 86 | ', $category['link'], ' |
@@ -102,18 +104,20 @@ discard block |
||
| 102 | 104 | <a class="subject" href="', $board['href'], '" id="b', $board['id'], '">', $board['name'], '</a>'; |
| 103 | 105 | |
| 104 | 106 | // Has it outstanding posts for approval? |
| 105 | - if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) |
|
| 106 | - echo ' |
|
| 107 | + if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) { |
|
| 108 | + echo ' |
|
| 107 | 109 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>'; |
| 110 | + } |
|
| 108 | 111 | |
| 109 | 112 | echo ' |
| 110 | 113 | |
| 111 | 114 | <p class="board_description">', $board['description'] , '</p>'; |
| 112 | 115 | |
| 113 | 116 | // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.) |
| 114 | - if (!empty($board['link_moderators'])) |
|
| 115 | - echo ' |
|
| 117 | + if (!empty($board['link_moderators'])) { |
|
| 118 | + echo ' |
|
| 116 | 119 | <p class="moderators">', count($board['link_moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>'; |
| 120 | + } |
|
| 117 | 121 | |
| 118 | 122 | // Show some basic information about the number of posts, etc. |
| 119 | 123 | echo ' |
@@ -125,9 +129,10 @@ discard block |
||
| 125 | 129 | </div> |
| 126 | 130 | <div class="lastpost ',!empty($board['last_post']['id']) ? 'lpr_border' : 'hidden','">'; |
| 127 | 131 | |
| 128 | - if (!empty($board['last_post']['id'])) |
|
| 129 | - echo ' |
|
| 132 | + if (!empty($board['last_post']['id'])) { |
|
| 133 | + echo ' |
|
| 130 | 134 | <p>', $board['last_post']['last_post_message'], '</p>'; |
| 135 | + } |
|
| 131 | 136 | echo ' |
| 132 | 137 | </div>'; |
| 133 | 138 | // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...) |
@@ -139,14 +144,16 @@ discard block |
||
| 139 | 144 | id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */ |
| 140 | 145 | foreach ($board['children'] as $child) |
| 141 | 146 | { |
| 142 | - if (!$child['is_redirect']) |
|
| 143 | - $child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span>' : '') . '</a>'; |
|
| 144 | - else |
|
| 145 | - $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
| 147 | + if (!$child['is_redirect']) { |
|
| 148 | + $child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span>' : '') . '</a>'; |
|
| 149 | + } else { |
|
| 150 | + $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
| 151 | + } |
|
| 146 | 152 | |
| 147 | 153 | // Has it posts awaiting approval? |
| 148 | - if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) |
|
| 149 | - $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
| 154 | + if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) { |
|
| 155 | + $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
| 156 | + } |
|
| 150 | 157 | |
| 151 | 158 | $children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link']; |
| 152 | 159 | } |
@@ -170,10 +177,11 @@ discard block |
||
| 170 | 177 | </div>'; |
| 171 | 178 | |
| 172 | 179 | // Show the mark all as read button? |
| 173 | - if ($context['user']['is_logged'] && !empty($context['categories'])) |
|
| 174 | - echo ' |
|
| 180 | + if ($context['user']['is_logged'] && !empty($context['categories'])) { |
|
| 181 | + echo ' |
|
| 175 | 182 | <div class="mark_read">', template_button_strip($context['mark_read_button'], 'right'), '</div>'; |
| 176 | -} |
|
| 183 | + } |
|
| 184 | + } |
|
| 177 | 185 | |
| 178 | 186 | /** |
| 179 | 187 | * The lower part of the outer layer of the board index |
@@ -190,8 +198,9 @@ discard block |
||
| 190 | 198 | { |
| 191 | 199 | global $context, $options, $txt; |
| 192 | 200 | |
| 193 | - if (empty($context['info_center'])) |
|
| 194 | - return; |
|
| 201 | + if (empty($context['info_center'])) { |
|
| 202 | + return; |
|
| 203 | + } |
|
| 195 | 204 | |
| 196 | 205 | // Here's where the "Info Center" starts... |
| 197 | 206 | echo ' |
@@ -291,14 +300,15 @@ discard block |
||
| 291 | 300 | /* Each post in latest_posts has: |
| 292 | 301 | board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.), |
| 293 | 302 | subject, short_subject (shortened with...), time, link, and href. */ |
| 294 | - foreach ($context['latest_posts'] as $post) |
|
| 295 | - echo ' |
|
| 303 | + foreach ($context['latest_posts'] as $post) { |
|
| 304 | + echo ' |
|
| 296 | 305 | <tr class="windowbg"> |
| 297 | 306 | <td class="recentpost"><strong>', $post['link'], '</strong></td> |
| 298 | 307 | <td class="recentposter">', $post['poster']['link'], '</td> |
| 299 | 308 | <td class="recentboard">', $post['board']['link'], '</td> |
| 300 | 309 | <td class="recenttime">', $post['time'], '</td> |
| 301 | 310 | </tr>'; |
| 311 | + } |
|
| 302 | 312 | echo ' |
| 303 | 313 | </table>'; |
| 304 | 314 | } |
@@ -322,9 +332,10 @@ discard block |
||
| 322 | 332 | </div>'; |
| 323 | 333 | |
| 324 | 334 | // Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P. |
| 325 | - if (!empty($context['calendar_holidays'])) |
|
| 326 | - echo ' |
|
| 335 | + if (!empty($context['calendar_holidays'])) { |
|
| 336 | + echo ' |
|
| 327 | 337 | <p class="inline holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $context['calendar_holidays']), '</p>'; |
| 338 | + } |
|
| 328 | 339 | |
| 329 | 340 | // People's birthdays. Like mine. And yours, I guess. Kidding. |
| 330 | 341 | if (!empty($context['calendar_birthdays'])) |
@@ -333,9 +344,10 @@ discard block |
||
| 333 | 344 | <p class="inline"> |
| 334 | 345 | <span class="birthday">', $context['calendar_only_today'] ? $txt['birthdays'] : $txt['birthdays_upcoming'], '</span>'; |
| 335 | 346 | // Each member in calendar_birthdays has: id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) |
| 336 | - foreach ($context['calendar_birthdays'] as $member) |
|
| 337 | - echo ' |
|
| 347 | + foreach ($context['calendar_birthdays'] as $member) { |
|
| 348 | + echo ' |
|
| 338 | 349 | <a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<strong class="fix_rtl_names">' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '' : ', '; |
| 350 | + } |
|
| 339 | 351 | echo ' |
| 340 | 352 | </p>'; |
| 341 | 353 | } |
@@ -349,9 +361,10 @@ discard block |
||
| 349 | 361 | |
| 350 | 362 | // Each event in calendar_events should have: |
| 351 | 363 | // title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. |
| 352 | - foreach ($context['calendar_events'] as $event) |
|
| 353 | - echo ' |
|
| 364 | + foreach ($context['calendar_events'] as $event) { |
|
| 365 | + echo ' |
|
| 354 | 366 | ', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" title="' . $txt['calendar_edit'] . '"><span class="generic_icons calendar_modify"></span></a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<strong>' . $event['title'] . '</strong>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br>' : ', '; |
| 367 | + } |
|
| 355 | 368 | echo ' |
| 356 | 369 | </p>'; |
| 357 | 370 | } |
@@ -396,15 +409,19 @@ discard block |
||
| 396 | 409 | |
| 397 | 410 | // Handle hidden users and buddies. |
| 398 | 411 | $bracketList = array(); |
| 399 | - if ($context['show_buddies']) |
|
| 400 | - $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
| 401 | - if (!empty($context['num_spiders'])) |
|
| 402 | - $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
| 403 | - if (!empty($context['num_users_hidden'])) |
|
| 404 | - $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
| 412 | + if ($context['show_buddies']) { |
|
| 413 | + $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
| 414 | + } |
|
| 415 | + if (!empty($context['num_spiders'])) { |
|
| 416 | + $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
| 417 | + } |
|
| 418 | + if (!empty($context['num_users_hidden'])) { |
|
| 419 | + $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
| 420 | + } |
|
| 405 | 421 | |
| 406 | - if (!empty($bracketList)) |
|
| 407 | - echo ' (' . implode(', ', $bracketList) . ')'; |
|
| 422 | + if (!empty($bracketList)) { |
|
| 423 | + echo ' (' . implode(', ', $bracketList) . ')'; |
|
| 424 | + } |
|
| 408 | 425 | |
| 409 | 426 | echo $context['show_who'] ? '</a>' : '', ' |
| 410 | 427 | |
@@ -418,9 +435,10 @@ discard block |
||
| 418 | 435 | ', sprintf($txt['users_active'], $modSettings['lastActive']), ': ', implode(', ', $context['list_users_online']); |
| 419 | 436 | |
| 420 | 437 | // Showing membergroups? |
| 421 | - if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) |
|
| 422 | - echo ' |
|
| 438 | + if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) { |
|
| 439 | + echo ' |
|
| 423 | 440 | <span class="membergroups">' . implode(', ', $context['membergroups']). '</span>'; |
| 441 | + } |
|
| 424 | 442 | } |
| 425 | 443 | |
| 426 | 444 | echo ' |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | foreach ($context['news_lines'] as $news) |
| 35 | 35 | { |
| 36 | 36 | echo ' |
| 37 | - <li>', $news,'</li>'; |
|
| 37 | + <li>', $news, '</li>'; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | echo ' |
| 41 | 41 | </ul> |
| 42 | 42 | <script> |
| 43 | 43 | jQuery("#smf_slider").slippry({ |
| 44 | - pause: ', $settings['newsfader_time'],', |
|
| 44 | + pause: ', $settings['newsfader_time'], ', |
|
| 45 | 45 | adaptiveHeight: 0, |
| 46 | 46 | captions: 0, |
| 47 | 47 | controls: 0, |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | // If this category even can collapse, show a link to collapse it. |
| 79 | 79 | if ($category['can_collapse']) |
| 80 | 80 | echo ' |
| 81 | - <span id="category_', $category['id'], '_upshrink" class="', $category['is_collapsed'] ? 'toggle_down' : 'toggle_up', ' floatright" data-collapsed="', (int) $category['is_collapsed'], '" title="', !$category['is_collapsed'] ? $txt['hide_category'] : $txt['show_category'] ,'" style="display: none;"></span>'; |
|
| 81 | + <span id="category_', $category['id'], '_upshrink" class="', $category['is_collapsed'] ? 'toggle_down' : 'toggle_up', ' floatright" data-collapsed="', (int) $category['is_collapsed'], '" title="', !$category['is_collapsed'] ? $txt['hide_category'] : $txt['show_category'], '" style="display: none;"></span>'; |
|
| 82 | 82 | |
| 83 | 83 | echo ' |
| 84 | 84 | ', $category['link'], ' |
| 85 | 85 | </h3>', !empty($category['description']) ? ' |
| 86 | 86 | <div class="desc">' . $category['description'] . '</div>' : '', ' |
| 87 | 87 | </div> |
| 88 | - <div id="category_', $category['id'], '_boards" ', (!empty($category['css_class']) ? ('class="'. $category['css_class'] .'"') : '') ,'>'; |
|
| 88 | + <div id="category_', $category['id'], '_boards" ', (!empty($category['css_class']) ? ('class="' . $category['css_class'] . '"') : ''), '>'; |
|
| 89 | 89 | |
| 90 | 90 | /* Each board in each category's boards has: |
| 91 | 91 | new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.), |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | foreach ($category['boards'] as $board) |
| 95 | 95 | { |
| 96 | 96 | echo ' |
| 97 | - <div id="board_', $board['id'], '" class="up_contain ', (!empty($board['css_class']) ? $board['css_class'] : '') ,'"> |
|
| 97 | + <div id="board_', $board['id'], '" class="up_contain ', (!empty($board['css_class']) ? $board['css_class'] : ''), '"> |
|
| 98 | 98 | <div class="board_icon"> |
| 99 | 99 | <a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '" class="board_', $board['board_class'], '"', !empty($board['board_tooltip']) ? ' title="' . $board['board_tooltip'] . '"' : '', '></a> |
| 100 | 100 | </div> |
| 101 | 101 | <div class="info"> |
| 102 | 102 | <a class="subject mobile_subject" href="', $board['href'], '" id="b', $board['id'], '"> |
| 103 | 103 | ', $board['name'], ' |
| 104 | - <p class="board_description mobile_display">', $board['description'] , '</p> |
|
| 104 | + <p class="board_description mobile_display">', $board['description'], '</p> |
|
| 105 | 105 | </a>'; |
| 106 | 106 | |
| 107 | 107 | // Has it outstanding posts for approval? |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>'; |
| 111 | 111 | |
| 112 | 112 | echo ' |
| 113 | - <p class="board_description">', $board['description'] , '</p>'; |
|
| 113 | + <p class="board_description">', $board['description'], '</p>'; |
|
| 114 | 114 | |
| 115 | 115 | // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.) |
| 116 | 116 | if (!empty($board['link_moderators'])) |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | ', $board['is_redirect'] ? '' : '<br> ' . comma_format($board['topics']) . ' ' . $txt['board_topics'], ' |
| 126 | 126 | </p> |
| 127 | 127 | </div> |
| 128 | - <div class="lastpost ',!empty($board['last_post']['id']) ? 'lpr_border' : 'hidden','">'; |
|
| 128 | + <div class="lastpost ',!empty($board['last_post']['id']) ? 'lpr_border' : 'hidden', '">'; |
|
| 129 | 129 | |
| 130 | 130 | if (!empty($board['last_post']['id'])) |
| 131 | 131 | echo ' |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | </h4> |
| 375 | 375 | </div> |
| 376 | 376 | <p class="inline"> |
| 377 | - ', $context['common_stats']['boardindex_total_posts'], '', !empty($settings['show_latest_member']) ? ' - '. $txt['latest_member'] . ': <strong> ' . $context['common_stats']['latest_member']['link'] . '</strong>' : '', '<br> |
|
| 377 | + ', $context['common_stats']['boardindex_total_posts'], '', !empty($settings['show_latest_member']) ? ' - ' . $txt['latest_member'] . ': <strong> ' . $context['common_stats']['latest_member']['link'] . '</strong>' : '', '<br> |
|
| 378 | 378 | ', (!empty($context['latest_post']) ? $txt['latest_post'] . ': <strong>"' . $context['latest_post']['link'] . '"</strong> (' . $context['latest_post']['time'] . ')<br>' : ''), ' |
| 379 | 379 | <a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a> |
| 380 | 380 | </p>'; |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | // Showing membergroups? |
| 423 | 423 | if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) |
| 424 | 424 | echo ' |
| 425 | - <span class="membergroups">' . implode(', ', $context['membergroups']). '</span>'; |
|
| 425 | + <span class="membergroups">' . implode(', ', $context['membergroups']) . '</span>'; |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | echo ' |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | // Are we done sending the newsletter? |
| 21 | 21 | if (!empty($context['newsletter_sent'])) |
| 22 | 22 | echo ' |
| 23 | - <div class="infobox">', $txt['admin_news_newsletter_'. $context['newsletter_sent']] ,'</div>'; |
|
| 23 | + <div class="infobox">', $txt['admin_news_newsletter_' . $context['newsletter_sent']], '</div>'; |
|
| 24 | 24 | |
| 25 | 25 | echo ' |
| 26 | 26 | <div id="admincenter"> |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | <form name="newsmodify" action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '"> |
| 206 | 206 | <div class="cat_bar"> |
| 207 | 207 | <h3 class="catbg"> |
| 208 | - <a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'],'"></span></a> ', $txt['admin_newsletters'], ' |
|
| 208 | + <a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a> ', $txt['admin_newsletters'], ' |
|
| 209 | 209 | </h3> |
| 210 | 210 | </div> |
| 211 | 211 | <div class="information"> |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | <div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors"> |
| 216 | 216 | <dl> |
| 217 | 217 | <dt> |
| 218 | - <strong id="error_serious">', $txt['error_while_submitting'] , '</strong> |
|
| 218 | + <strong id="error_serious">', $txt['error_while_submitting'], '</strong> |
|
| 219 | 219 | </dt> |
| 220 | 220 | <dd class="error" id="error_list"> |
| 221 | 221 | ', empty($context['post_error']['messages']) ? '' : implode('<br>', $context['post_error']['messages']), ' |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | <span', (isset($context['post_error']['no_subject']) ? ' class="error"' : ''), ' id="caption_subject">', $txt['subject'], ':</span> |
| 228 | 228 | </dt> |
| 229 | 229 | <dd id="pm_subject"> |
| 230 | - <input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="60" maxlength="60"',isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', '/> |
|
| 230 | + <input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="60" maxlength="60"', isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', '/> |
|
| 231 | 231 | </dd> |
| 232 | 232 | </dl><hr class="clear"> |
| 233 | 233 | <div id="bbcBox_message"></div>'; |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | <form action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit"> |
| 393 | 393 | <div class="cat_bar"> |
| 394 | 394 | <h3 class="catbg"> |
| 395 | - <a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'],'"></span></a> ', $txt['admin_newsletters'], ' |
|
| 395 | + <a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a> ', $txt['admin_newsletters'], ' |
|
| 396 | 396 | </h3> |
| 397 | 397 | </div> |
| 398 | 398 | <div class="windowbg"> |
@@ -18,9 +18,10 @@ discard block |
||
| 18 | 18 | global $context, $txt, $scripturl; |
| 19 | 19 | |
| 20 | 20 | // Are we done sending the newsletter? |
| 21 | - if (!empty($context['newsletter_sent'])) |
|
| 22 | - echo ' |
|
| 21 | + if (!empty($context['newsletter_sent'])) { |
|
| 22 | + echo ' |
|
| 23 | 23 | <div class="infobox">', $txt['admin_news_newsletter_'. $context['newsletter_sent']] ,'</div>'; |
| 24 | + } |
|
| 24 | 25 | |
| 25 | 26 | echo ' |
| 26 | 27 | <div id="admincenter"> |
@@ -39,9 +40,10 @@ discard block |
||
| 39 | 40 | </dt> |
| 40 | 41 | <dd>'; |
| 41 | 42 | |
| 42 | - foreach ($context['groups'] as $group) |
|
| 43 | - echo ' |
|
| 43 | + foreach ($context['groups'] as $group) { |
|
| 44 | + echo ' |
|
| 44 | 45 | <label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked class="input_check"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | echo ' |
| 47 | 49 | <br> |
@@ -86,9 +88,10 @@ discard block |
||
| 86 | 88 | </dt> |
| 87 | 89 | <dd>'; |
| 88 | 90 | |
| 89 | - foreach ($context['groups'] as $group) |
|
| 90 | - echo ' |
|
| 91 | + foreach ($context['groups'] as $group) { |
|
| 92 | + echo ' |
|
| 91 | 93 | <label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '" class="input_check"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
| 94 | + } |
|
| 92 | 95 | |
| 93 | 96 | echo ' |
| 94 | 97 | <br> |
@@ -233,9 +236,10 @@ discard block |
||
| 233 | 236 | <div id="bbcBox_message"></div>'; |
| 234 | 237 | |
| 235 | 238 | // What about smileys? |
| 236 | - if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
| 237 | - echo ' |
|
| 239 | + if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) { |
|
| 240 | + echo ' |
|
| 238 | 241 | <div id="smileyBox_message"></div>'; |
| 242 | + } |
|
| 239 | 243 | |
| 240 | 244 | // Show BBC buttons, smileys and textbox. |
| 241 | 245 | echo ' |
@@ -256,9 +260,10 @@ discard block |
||
| 256 | 260 | <input type="hidden" name="email_force" value="', $context['email_force'], '"> |
| 257 | 261 | <input type="hidden" name="total_emails" value="', $context['total_emails'], '">'; |
| 258 | 262 | |
| 259 | - foreach ($context['recipients'] as $key => $values) |
|
| 260 | - echo ' |
|
| 263 | + foreach ($context['recipients'] as $key => $values) { |
|
| 264 | + echo ' |
|
| 261 | 265 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
| 266 | + } |
|
| 262 | 267 | |
| 263 | 268 | echo ' |
| 264 | 269 | <script>'; |
@@ -413,9 +418,10 @@ discard block |
||
| 413 | 418 | <input type="hidden" name="parse_html" value="', $context['parse_html'], '">'; |
| 414 | 419 | |
| 415 | 420 | // All the things we must remember! |
| 416 | - foreach ($context['recipients'] as $key => $values) |
|
| 417 | - echo ' |
|
| 421 | + foreach ($context['recipients'] as $key => $values) { |
|
| 422 | + echo ' |
|
| 418 | 423 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
| 424 | + } |
|
| 419 | 425 | |
| 420 | 426 | echo ' |
| 421 | 427 | </div> |
@@ -448,9 +454,10 @@ discard block |
||
| 448 | 454 | { |
| 449 | 455 | global $context, $txt; |
| 450 | 456 | |
| 451 | - if (!empty($context['saved_successful'])) |
|
| 452 | - echo ' |
|
| 457 | + if (!empty($context['saved_successful'])) { |
|
| 458 | + echo ' |
|
| 453 | 459 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 460 | + } |
|
| 454 | 461 | |
| 455 | 462 | template_show_list('news_lists'); |
| 456 | 463 | } |