@@ -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}', |
@@ -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 |
@@ -259,15 +270,17 @@ discard block |
||
| 259 | 270 | $context['preview_subject'] = !empty($_POST['title']) ? trim($smcFunc['htmlspecialchars']($_POST['title'])) : ''; |
| 260 | 271 | if (isset($_POST['issuing'])) |
| 261 | 272 | { |
| 262 | - if (empty($_POST['title']) || empty($_POST['body'])) |
|
| 263 | - $context['post_error']['messages'][] = $txt['warning_notify_blank']; |
|
| 264 | - } |
|
| 265 | - else |
|
| 273 | + if (empty($_POST['title']) || empty($_POST['body'])) { |
|
| 274 | + $context['post_error']['messages'][] = $txt['warning_notify_blank']; |
|
| 275 | + } |
|
| 276 | + } else |
|
| 266 | 277 | { |
| 267 | - if (empty($_POST['title'])) |
|
| 268 | - $context['post_error']['messages'][] = $txt['mc_warning_template_error_no_title']; |
|
| 269 | - if (empty($_POST['body'])) |
|
| 270 | - $context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body']; |
|
| 278 | + if (empty($_POST['title'])) { |
|
| 279 | + $context['post_error']['messages'][] = $txt['mc_warning_template_error_no_title']; |
|
| 280 | + } |
|
| 281 | + if (empty($_POST['body'])) { |
|
| 282 | + $context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body']; |
|
| 283 | + } |
|
| 271 | 284 | // Add in few replacements. |
| 272 | 285 | /** |
| 273 | 286 | * These are the defaults: |
@@ -298,9 +311,9 @@ discard block |
||
| 298 | 311 | $warning_body = parse_bbc($warning_body, true); |
| 299 | 312 | } |
| 300 | 313 | $context['preview_message'] = $warning_body; |
| 314 | + } else { |
|
| 315 | + $context['post_error']['messages'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error')); |
|
| 301 | 316 | } |
| 302 | - else |
|
| 303 | - $context['post_error']['messages'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error')); |
|
| 304 | 317 | |
| 305 | 318 | $context['sub_template'] = 'warning'; |
| 306 | 319 | } |
@@ -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 | { |
@@ -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 | |
@@ -28,16 +29,18 @@ discard block |
||
| 28 | 29 | $time_start = microtime(); |
| 29 | 30 | |
| 30 | 31 | // Just being safe... |
| 31 | -foreach (array('db_character_set', 'cachedir') as $variable) |
|
| 32 | +foreach (array('db_character_set', 'cachedir') as $variable) { |
|
| 32 | 33 | if (isset($GLOBALS[$variable])) |
| 33 | 34 | unset($GLOBALS[$variable]); |
| 35 | +} |
|
| 34 | 36 | |
| 35 | 37 | // Get the forum's settings for database and file paths. |
| 36 | 38 | require_once(dirname(__FILE__) . '/Settings.php'); |
| 37 | 39 | |
| 38 | 40 | // Make absolutely sure the cache directory is defined. |
| 39 | -if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) |
|
| 41 | +if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) { |
|
| 40 | 42 | $cachedir = $boarddir . '/cache'; |
| 43 | +} |
|
| 41 | 44 | |
| 42 | 45 | $ssi_error_reporting = error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL); |
| 43 | 46 | /* Set this to one of three values depending on what you want to happen in the case of a fatal error. |
@@ -48,12 +51,14 @@ discard block |
||
| 48 | 51 | $ssi_on_error_method = false; |
| 49 | 52 | |
| 50 | 53 | // Don't do john didley if the forum's been shut down completely. |
| 51 | -if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true)) |
|
| 54 | +if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true)) { |
|
| 52 | 55 | die($mmessage); |
| 56 | +} |
|
| 53 | 57 | |
| 54 | 58 | // Fix for using the current directory as a path. |
| 55 | -if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') |
|
| 59 | +if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') { |
|
| 56 | 60 | $sourcedir = dirname(__FILE__) . substr($sourcedir, 1); |
| 61 | +} |
|
| 57 | 62 | |
| 58 | 63 | // Load the important includes. |
| 59 | 64 | require_once($sourcedir . '/QueryString.php'); |
@@ -78,34 +83,38 @@ discard block |
||
| 78 | 83 | cleanRequest(); |
| 79 | 84 | |
| 80 | 85 | // Seed the random generator? |
| 81 | -if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) |
|
| 86 | +if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) { |
|
| 82 | 87 | smf_seed_generator(); |
| 88 | +} |
|
| 83 | 89 | |
| 84 | 90 | // Check on any hacking attempts. |
| 85 | -if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) |
|
| 91 | +if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) { |
|
| 86 | 92 | die('No direct access...'); |
| 87 | -elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme) |
|
| 93 | +} elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme) { |
|
| 88 | 94 | die('No direct access...'); |
| 89 | -elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme) |
|
| 95 | +} elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme) { |
|
| 90 | 96 | die('No direct access...'); |
| 91 | -elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers) |
|
| 97 | +} elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers) { |
|
| 92 | 98 | die('No direct access...'); |
| 93 | -if (isset($_REQUEST['context'])) |
|
| 99 | +} |
|
| 100 | +if (isset($_REQUEST['context'])) { |
|
| 94 | 101 | die('No direct access...'); |
| 102 | +} |
|
| 95 | 103 | |
| 96 | 104 | // Gzip output? (because it must be boolean and true, this can't be hacked.) |
| 97 | -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', '>=')) |
|
| 105 | +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', '>=')) { |
|
| 98 | 106 | ob_start('ob_gzhandler'); |
| 99 | -else |
|
| 107 | +} else { |
|
| 100 | 108 | $modSettings['enableCompressedOutput'] = '0'; |
| 109 | +} |
|
| 101 | 110 | |
| 102 | 111 | // Primarily, this is to fix the URLs... |
| 103 | 112 | ob_start('ob_sessrewrite'); |
| 104 | 113 | |
| 105 | 114 | // Start the session... known to scramble SSI includes in cases... |
| 106 | -if (!headers_sent()) |
|
| 115 | +if (!headers_sent()) { |
|
| 107 | 116 | loadSession(); |
| 108 | -else |
|
| 117 | +} else |
|
| 109 | 118 | { |
| 110 | 119 | if (isset($_COOKIE[session_name()]) || isset($_REQUEST[session_name()])) |
| 111 | 120 | { |
@@ -139,12 +148,14 @@ discard block |
||
| 139 | 148 | loadTheme(isset($ssi_theme) ? (int) $ssi_theme : 0); |
| 140 | 149 | |
| 141 | 150 | // @todo: probably not the best place, but somewhere it should be set... |
| 142 | -if (!headers_sent()) |
|
| 151 | +if (!headers_sent()) { |
|
| 143 | 152 | 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'])); |
| 153 | +} |
|
| 144 | 154 | |
| 145 | 155 | // Take care of any banning that needs to be done. |
| 146 | -if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true)) |
|
| 156 | +if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true)) { |
|
| 147 | 157 | is_not_banned(); |
| 158 | +} |
|
| 148 | 159 | |
| 149 | 160 | // Do we allow guests in here? |
| 150 | 161 | if (empty($ssi_guest_access) && empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && basename($_SERVER['PHP_SELF']) != 'SSI.php') |
@@ -159,17 +170,19 @@ discard block |
||
| 159 | 170 | { |
| 160 | 171 | $context['template_layers'] = $ssi_layers; |
| 161 | 172 | template_header(); |
| 162 | -} |
|
| 163 | -else |
|
| 173 | +} else { |
|
| 164 | 174 | setupThemeContext(); |
| 175 | +} |
|
| 165 | 176 | |
| 166 | 177 | // Make sure they didn't muss around with the settings... but only if it's not cli. |
| 167 | -if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '') |
|
| 178 | +if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '') { |
|
| 168 | 179 | trigger_error($txt['ssi_session_broken'], E_USER_NOTICE); |
| 180 | +} |
|
| 169 | 181 | |
| 170 | 182 | // Without visiting the forum this session variable might not be set on submit. |
| 171 | -if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) |
|
| 183 | +if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) { |
|
| 172 | 184 | $_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT']; |
| 185 | +} |
|
| 173 | 186 | |
| 174 | 187 | // Have the ability to easily add functions to SSI. |
| 175 | 188 | call_integration_hook('integrate_SSI'); |
@@ -178,11 +191,13 @@ discard block |
||
| 178 | 191 | if (basename($_SERVER['PHP_SELF']) == 'SSI.php') |
| 179 | 192 | { |
| 180 | 193 | // You shouldn't just access SSI.php directly by URL!! |
| 181 | - if (!isset($_GET['ssi_function'])) |
|
| 182 | - die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\'')); |
|
| 194 | + if (!isset($_GET['ssi_function'])) { |
|
| 195 | + die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\'')); |
|
| 196 | + } |
|
| 183 | 197 | // Call a function passed by GET. |
| 184 | - if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest'])) |
|
| 185 | - call_user_func('ssi_' . $_GET['ssi_function']); |
|
| 198 | + if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest'])) { |
|
| 199 | + call_user_func('ssi_' . $_GET['ssi_function']); |
|
| 200 | + } |
|
| 186 | 201 | exit; |
| 187 | 202 | } |
| 188 | 203 | |
@@ -199,9 +214,10 @@ discard block |
||
| 199 | 214 | */ |
| 200 | 215 | function ssi_shutdown() |
| 201 | 216 | { |
| 202 | - if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') |
|
| 203 | - template_footer(); |
|
| 204 | -} |
|
| 217 | + if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') { |
|
| 218 | + template_footer(); |
|
| 219 | + } |
|
| 220 | + } |
|
| 205 | 221 | |
| 206 | 222 | /** |
| 207 | 223 | * Display a welcome message, like: Hey, User, you have 0 messages, 0 are new. |
@@ -214,15 +230,17 @@ discard block |
||
| 214 | 230 | |
| 215 | 231 | if ($output_method == 'echo') |
| 216 | 232 | { |
| 217 | - if ($context['user']['is_guest']) |
|
| 218 | - 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'); |
|
| 219 | - else |
|
| 220 | - 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'])))) : ''; |
|
| 233 | + if ($context['user']['is_guest']) { |
|
| 234 | + 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'); |
|
| 235 | + } else { |
|
| 236 | + 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 | + } |
|
| 221 | 238 | } |
| 222 | 239 | // Don't echo... then do what?! |
| 223 | - else |
|
| 224 | - return $context['user']; |
|
| 225 | -} |
|
| 240 | + else { |
|
| 241 | + return $context['user']; |
|
| 242 | + } |
|
| 243 | + } |
|
| 226 | 244 | |
| 227 | 245 | /** |
| 228 | 246 | * Display a menu bar, like is displayed at the top of the forum. |
@@ -233,12 +251,14 @@ discard block |
||
| 233 | 251 | { |
| 234 | 252 | global $context; |
| 235 | 253 | |
| 236 | - if ($output_method == 'echo') |
|
| 237 | - template_menu(); |
|
| 254 | + if ($output_method == 'echo') { |
|
| 255 | + template_menu(); |
|
| 256 | + } |
|
| 238 | 257 | // What else could this do? |
| 239 | - else |
|
| 240 | - return $context['menu_buttons']; |
|
| 241 | -} |
|
| 258 | + else { |
|
| 259 | + return $context['menu_buttons']; |
|
| 260 | + } |
|
| 261 | + } |
|
| 242 | 262 | |
| 243 | 263 | /** |
| 244 | 264 | * Show a logout link. |
@@ -250,20 +270,23 @@ discard block |
||
| 250 | 270 | { |
| 251 | 271 | global $context, $txt, $scripturl; |
| 252 | 272 | |
| 253 | - if ($redirect_to != '') |
|
| 254 | - $_SESSION['logout_url'] = $redirect_to; |
|
| 273 | + if ($redirect_to != '') { |
|
| 274 | + $_SESSION['logout_url'] = $redirect_to; |
|
| 275 | + } |
|
| 255 | 276 | |
| 256 | 277 | // Guests can't log out. |
| 257 | - if ($context['user']['is_guest']) |
|
| 258 | - return false; |
|
| 278 | + if ($context['user']['is_guest']) { |
|
| 279 | + return false; |
|
| 280 | + } |
|
| 259 | 281 | |
| 260 | 282 | $link = '<a href="' . $scripturl . '?action=logout;' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['logout'] . '</a>'; |
| 261 | 283 | |
| 262 | - if ($output_method == 'echo') |
|
| 263 | - echo $link; |
|
| 264 | - else |
|
| 265 | - return $link; |
|
| 266 | -} |
|
| 284 | + if ($output_method == 'echo') { |
|
| 285 | + echo $link; |
|
| 286 | + } else { |
|
| 287 | + return $link; |
|
| 288 | + } |
|
| 289 | + } |
|
| 267 | 290 | |
| 268 | 291 | /** |
| 269 | 292 | * Recent post list: [board] Subject by Poster Date |
@@ -279,17 +302,17 @@ discard block |
||
| 279 | 302 | global $modSettings, $context; |
| 280 | 303 | |
| 281 | 304 | // Excluding certain boards... |
| 282 | - if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) |
|
| 283 | - $exclude_boards = array($modSettings['recycle_board']); |
|
| 284 | - else |
|
| 285 | - $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
| 305 | + if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) { |
|
| 306 | + $exclude_boards = array($modSettings['recycle_board']); |
|
| 307 | + } else { |
|
| 308 | + $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
| 309 | + } |
|
| 286 | 310 | |
| 287 | 311 | // What about including certain boards - note we do some protection here as pre-2.0 didn't have this parameter. |
| 288 | 312 | if (is_array($include_boards) || (int) $include_boards === $include_boards) |
| 289 | 313 | { |
| 290 | 314 | $include_boards = is_array($include_boards) ? $include_boards : array($include_boards); |
| 291 | - } |
|
| 292 | - elseif ($include_boards != null) |
|
| 315 | + } elseif ($include_boards != null) |
|
| 293 | 316 | { |
| 294 | 317 | $include_boards = array(); |
| 295 | 318 | } |
@@ -326,8 +349,9 @@ discard block |
||
| 326 | 349 | { |
| 327 | 350 | global $modSettings; |
| 328 | 351 | |
| 329 | - if (empty($post_ids)) |
|
| 330 | - return; |
|
| 352 | + if (empty($post_ids)) { |
|
| 353 | + return; |
|
| 354 | + } |
|
| 331 | 355 | |
| 332 | 356 | // Allow the user to request more than one - why not? |
| 333 | 357 | $post_ids = is_array($post_ids) ? $post_ids : array($post_ids); |
@@ -362,8 +386,9 @@ discard block |
||
| 362 | 386 | global $scripturl, $txt, $user_info; |
| 363 | 387 | global $modSettings, $smcFunc, $context; |
| 364 | 388 | |
| 365 | - if (!empty($modSettings['enable_likes'])) |
|
| 366 | - $context['can_like'] = allowedTo('likes_like'); |
|
| 389 | + if (!empty($modSettings['enable_likes'])) { |
|
| 390 | + $context['can_like'] = allowedTo('likes_like'); |
|
| 391 | + } |
|
| 367 | 392 | |
| 368 | 393 | // Find all the posts. Newer ones will have higher IDs. |
| 369 | 394 | $request = $smcFunc['db_query']('substring', ' |
@@ -429,12 +454,13 @@ discard block |
||
| 429 | 454 | ); |
| 430 | 455 | |
| 431 | 456 | // Get the likes for each message. |
| 432 | - if (!empty($modSettings['enable_likes'])) |
|
| 433 | - $posts[$row['id_msg']]['likes'] = array( |
|
| 457 | + if (!empty($modSettings['enable_likes'])) { |
|
| 458 | + $posts[$row['id_msg']]['likes'] = array( |
|
| 434 | 459 | 'count' => $row['likes'], |
| 435 | 460 | 'you' => in_array($row['id_msg'], prepareLikesContext($row['id_topic'])), |
| 436 | 461 | 'can_like' => !$context['user']['is_guest'] && $row['id_member'] != $context['user']['id'] && !empty($context['can_like']), |
| 437 | 462 | ); |
| 463 | + } |
|
| 438 | 464 | } |
| 439 | 465 | $smcFunc['db_free_result']($request); |
| 440 | 466 | |
@@ -442,13 +468,14 @@ discard block |
||
| 442 | 468 | call_integration_hook('integrate_ssi_queryPosts', array(&$posts)); |
| 443 | 469 | |
| 444 | 470 | // Just return it. |
| 445 | - if ($output_method != 'echo' || empty($posts)) |
|
| 446 | - return $posts; |
|
| 471 | + if ($output_method != 'echo' || empty($posts)) { |
|
| 472 | + return $posts; |
|
| 473 | + } |
|
| 447 | 474 | |
| 448 | 475 | echo ' |
| 449 | 476 | <table style="border: none" class="ssi_table">'; |
| 450 | - foreach ($posts as $post) |
|
| 451 | - echo ' |
|
| 477 | + foreach ($posts as $post) { |
|
| 478 | + echo ' |
|
| 452 | 479 | <tr> |
| 453 | 480 | <td style="text-align: right; vertical-align: top; white-space: nowrap"> |
| 454 | 481 | [', $post['board']['link'], '] |
@@ -462,6 +489,7 @@ discard block |
||
| 462 | 489 | ', $post['time'], ' |
| 463 | 490 | </td> |
| 464 | 491 | </tr>'; |
| 492 | + } |
|
| 465 | 493 | echo ' |
| 466 | 494 | </table>'; |
| 467 | 495 | } |
@@ -479,25 +507,26 @@ discard block |
||
| 479 | 507 | global $settings, $scripturl, $txt, $user_info; |
| 480 | 508 | global $modSettings, $smcFunc, $context; |
| 481 | 509 | |
| 482 | - if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) |
|
| 483 | - $exclude_boards = array($modSettings['recycle_board']); |
|
| 484 | - else |
|
| 485 | - $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
| 510 | + if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) { |
|
| 511 | + $exclude_boards = array($modSettings['recycle_board']); |
|
| 512 | + } else { |
|
| 513 | + $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
| 514 | + } |
|
| 486 | 515 | |
| 487 | 516 | // Only some boards?. |
| 488 | 517 | if (is_array($include_boards) || (int) $include_boards === $include_boards) |
| 489 | 518 | { |
| 490 | 519 | $include_boards = is_array($include_boards) ? $include_boards : array($include_boards); |
| 491 | - } |
|
| 492 | - elseif ($include_boards != null) |
|
| 520 | + } elseif ($include_boards != null) |
|
| 493 | 521 | { |
| 494 | 522 | $output_method = $include_boards; |
| 495 | 523 | $include_boards = array(); |
| 496 | 524 | } |
| 497 | 525 | |
| 498 | 526 | $icon_sources = array(); |
| 499 | - foreach ($context['stable_icons'] as $icon) |
|
| 500 | - $icon_sources[$icon] = 'images_url'; |
|
| 527 | + foreach ($context['stable_icons'] as $icon) { |
|
| 528 | + $icon_sources[$icon] = 'images_url'; |
|
| 529 | + } |
|
| 501 | 530 | |
| 502 | 531 | // Find all the posts in distinct topics. Newer ones will have higher IDs. |
| 503 | 532 | $request = $smcFunc['db_query']('substring', ' |
@@ -522,13 +551,15 @@ discard block |
||
| 522 | 551 | ) |
| 523 | 552 | ); |
| 524 | 553 | $topics = array(); |
| 525 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 526 | - $topics[$row['id_topic']] = $row; |
|
| 554 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 555 | + $topics[$row['id_topic']] = $row; |
|
| 556 | + } |
|
| 527 | 557 | $smcFunc['db_free_result']($request); |
| 528 | 558 | |
| 529 | 559 | // Did we find anything? If not, bail. |
| 530 | - if (empty($topics)) |
|
| 531 | - return array(); |
|
| 560 | + if (empty($topics)) { |
|
| 561 | + return array(); |
|
| 562 | + } |
|
| 532 | 563 | |
| 533 | 564 | $recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0; |
| 534 | 565 | |
@@ -556,19 +587,22 @@ discard block |
||
| 556 | 587 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 557 | 588 | { |
| 558 | 589 | $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br>' => ' '))); |
| 559 | - if ($smcFunc['strlen']($row['body']) > 128) |
|
| 560 | - $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...'; |
|
| 590 | + if ($smcFunc['strlen']($row['body']) > 128) { |
|
| 591 | + $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...'; |
|
| 592 | + } |
|
| 561 | 593 | |
| 562 | 594 | // Censor the subject. |
| 563 | 595 | censorText($row['subject']); |
| 564 | 596 | censorText($row['body']); |
| 565 | 597 | |
| 566 | 598 | // Recycled icon |
| 567 | - if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board']) |
|
| 568 | - $row['icon'] = 'recycled'; |
|
| 599 | + if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board']) { |
|
| 600 | + $row['icon'] = 'recycled'; |
|
| 601 | + } |
|
| 569 | 602 | |
| 570 | - if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) |
|
| 571 | - $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
| 603 | + if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) { |
|
| 604 | + $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
| 605 | + } |
|
| 572 | 606 | |
| 573 | 607 | // Build the array. |
| 574 | 608 | $posts[] = array( |
@@ -607,13 +641,14 @@ discard block |
||
| 607 | 641 | call_integration_hook('integrate_ssi_recentTopics', array(&$posts)); |
| 608 | 642 | |
| 609 | 643 | // Just return it. |
| 610 | - if ($output_method != 'echo' || empty($posts)) |
|
| 611 | - return $posts; |
|
| 644 | + if ($output_method != 'echo' || empty($posts)) { |
|
| 645 | + return $posts; |
|
| 646 | + } |
|
| 612 | 647 | |
| 613 | 648 | echo ' |
| 614 | 649 | <table style="border: none" class="ssi_table">'; |
| 615 | - foreach ($posts as $post) |
|
| 616 | - echo ' |
|
| 650 | + foreach ($posts as $post) { |
|
| 651 | + echo ' |
|
| 617 | 652 | <tr> |
| 618 | 653 | <td style="text-align: right; vertical-align: top; white-space: nowrap"> |
| 619 | 654 | [', $post['board']['link'], '] |
@@ -627,6 +662,7 @@ discard block |
||
| 627 | 662 | ', $post['time'], ' |
| 628 | 663 | </td> |
| 629 | 664 | </tr>'; |
| 665 | + } |
|
| 630 | 666 | echo ' |
| 631 | 667 | </table>'; |
| 632 | 668 | } |
@@ -651,27 +687,30 @@ discard block |
||
| 651 | 687 | ) |
| 652 | 688 | ); |
| 653 | 689 | $return = array(); |
| 654 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 655 | - $return[] = array( |
|
| 690 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 691 | + $return[] = array( |
|
| 656 | 692 | 'id' => $row['id_member'], |
| 657 | 693 | 'name' => $row['real_name'], |
| 658 | 694 | 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], |
| 659 | 695 | 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>', |
| 660 | 696 | 'posts' => $row['posts'] |
| 661 | 697 | ); |
| 698 | + } |
|
| 662 | 699 | $smcFunc['db_free_result']($request); |
| 663 | 700 | |
| 664 | 701 | // If mods want to do somthing with this list of members, let them do that now. |
| 665 | 702 | call_integration_hook('integrate_ssi_topPoster', array(&$return)); |
| 666 | 703 | |
| 667 | 704 | // Just return all the top posters. |
| 668 | - if ($output_method != 'echo') |
|
| 669 | - return $return; |
|
| 705 | + if ($output_method != 'echo') { |
|
| 706 | + return $return; |
|
| 707 | + } |
|
| 670 | 708 | |
| 671 | 709 | // Make a quick array to list the links in. |
| 672 | 710 | $temp_array = array(); |
| 673 | - foreach ($return as $member) |
|
| 674 | - $temp_array[] = $member['link']; |
|
| 711 | + foreach ($return as $member) { |
|
| 712 | + $temp_array[] = $member['link']; |
|
| 713 | + } |
|
| 675 | 714 | |
| 676 | 715 | echo implode(', ', $temp_array); |
| 677 | 716 | } |
@@ -703,8 +742,8 @@ discard block |
||
| 703 | 742 | ) |
| 704 | 743 | ); |
| 705 | 744 | $boards = array(); |
| 706 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 707 | - $boards[] = array( |
|
| 745 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 746 | + $boards[] = array( |
|
| 708 | 747 | 'id' => $row['id_board'], |
| 709 | 748 | 'num_posts' => $row['num_posts'], |
| 710 | 749 | 'num_topics' => $row['num_topics'], |
@@ -713,14 +752,16 @@ discard block |
||
| 713 | 752 | 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', |
| 714 | 753 | 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>' |
| 715 | 754 | ); |
| 755 | + } |
|
| 716 | 756 | $smcFunc['db_free_result']($request); |
| 717 | 757 | |
| 718 | 758 | // If mods want to do somthing with this list of boards, let them do that now. |
| 719 | 759 | call_integration_hook('integrate_ssi_topBoards', array(&$boards)); |
| 720 | 760 | |
| 721 | 761 | // If we shouldn't output or have nothing to output, just jump out. |
| 722 | - if ($output_method != 'echo' || empty($boards)) |
|
| 723 | - return $boards; |
|
| 762 | + if ($output_method != 'echo' || empty($boards)) { |
|
| 763 | + return $boards; |
|
| 764 | + } |
|
| 724 | 765 | |
| 725 | 766 | echo ' |
| 726 | 767 | <table class="ssi_table"> |
@@ -729,13 +770,14 @@ discard block |
||
| 729 | 770 | <th style="text-align: left">', $txt['board_topics'], '</th> |
| 730 | 771 | <th style="text-align: left">', $txt['posts'], '</th> |
| 731 | 772 | </tr>'; |
| 732 | - foreach ($boards as $sBoard) |
|
| 733 | - echo ' |
|
| 773 | + foreach ($boards as $sBoard) { |
|
| 774 | + echo ' |
|
| 734 | 775 | <tr> |
| 735 | 776 | <td>', $sBoard['link'], $sBoard['new'] ? ' <a href="' . $sBoard['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>' : '', '</td> |
| 736 | 777 | <td style="text-align: right">', comma_format($sBoard['num_topics']), '</td> |
| 737 | 778 | <td style="text-align: right">', comma_format($sBoard['num_posts']), '</td> |
| 738 | 779 | </tr>'; |
| 780 | + } |
|
| 739 | 781 | echo ' |
| 740 | 782 | </table>'; |
| 741 | 783 | } |
@@ -768,12 +810,13 @@ discard block |
||
| 768 | 810 | ) |
| 769 | 811 | ); |
| 770 | 812 | $topic_ids = array(); |
| 771 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 772 | - $topic_ids[] = $row['id_topic']; |
|
| 813 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 814 | + $topic_ids[] = $row['id_topic']; |
|
| 815 | + } |
|
| 773 | 816 | $smcFunc['db_free_result']($request); |
| 817 | + } else { |
|
| 818 | + $topic_ids = array(); |
|
| 774 | 819 | } |
| 775 | - else |
|
| 776 | - $topic_ids = array(); |
|
| 777 | 820 | |
| 778 | 821 | $request = $smcFunc['db_query']('', ' |
| 779 | 822 | SELECT m.subject, m.id_topic, t.num_views, t.num_replies |
@@ -812,8 +855,9 @@ discard block |
||
| 812 | 855 | // If mods want to do somthing with this list of topics, let them do that now. |
| 813 | 856 | call_integration_hook('integrate_ssi_topTopics', array(&$topics, $type)); |
| 814 | 857 | |
| 815 | - if ($output_method != 'echo' || empty($topics)) |
|
| 816 | - return $topics; |
|
| 858 | + if ($output_method != 'echo' || empty($topics)) { |
|
| 859 | + return $topics; |
|
| 860 | + } |
|
| 817 | 861 | |
| 818 | 862 | echo ' |
| 819 | 863 | <table class="ssi_table"> |
@@ -822,8 +866,8 @@ discard block |
||
| 822 | 866 | <th style="text-align: left">', $txt['views'], '</th> |
| 823 | 867 | <th style="text-align: left">', $txt['replies'], '</th> |
| 824 | 868 | </tr>'; |
| 825 | - foreach ($topics as $sTopic) |
|
| 826 | - echo ' |
|
| 869 | + foreach ($topics as $sTopic) { |
|
| 870 | + echo ' |
|
| 827 | 871 | <tr> |
| 828 | 872 | <td style="text-align: left"> |
| 829 | 873 | ', $sTopic['link'], ' |
@@ -831,6 +875,7 @@ discard block |
||
| 831 | 875 | <td style="text-align: right">', comma_format($sTopic['num_views']), '</td> |
| 832 | 876 | <td style="text-align: right">', comma_format($sTopic['num_replies']), '</td> |
| 833 | 877 | </tr>'; |
| 878 | + } |
|
| 834 | 879 | echo ' |
| 835 | 880 | </table>'; |
| 836 | 881 | } |
@@ -866,12 +911,13 @@ discard block |
||
| 866 | 911 | { |
| 867 | 912 | global $txt, $context; |
| 868 | 913 | |
| 869 | - if ($output_method == 'echo') |
|
| 870 | - echo ' |
|
| 914 | + if ($output_method == 'echo') { |
|
| 915 | + echo ' |
|
| 871 | 916 | ', sprintf($txt['welcome_newest_member'], $context['common_stats']['latest_member']['link']), '<br>'; |
| 872 | - else |
|
| 873 | - return $context['common_stats']['latest_member']; |
|
| 874 | -} |
|
| 917 | + } else { |
|
| 918 | + return $context['common_stats']['latest_member']; |
|
| 919 | + } |
|
| 920 | + } |
|
| 875 | 921 | |
| 876 | 922 | /** |
| 877 | 923 | * Fetches a random member. |
@@ -920,8 +966,9 @@ discard block |
||
| 920 | 966 | } |
| 921 | 967 | |
| 922 | 968 | // Just to be sure put the random generator back to something... random. |
| 923 | - if ($random_type != '') |
|
| 924 | - mt_srand(time()); |
|
| 969 | + if ($random_type != '') { |
|
| 970 | + mt_srand(time()); |
|
| 971 | + } |
|
| 925 | 972 | |
| 926 | 973 | return $result; |
| 927 | 974 | } |
@@ -934,8 +981,9 @@ discard block |
||
| 934 | 981 | */ |
| 935 | 982 | function ssi_fetchMember($member_ids = array(), $output_method = 'echo') |
| 936 | 983 | { |
| 937 | - if (empty($member_ids)) |
|
| 938 | - return; |
|
| 984 | + if (empty($member_ids)) { |
|
| 985 | + return; |
|
| 986 | + } |
|
| 939 | 987 | |
| 940 | 988 | // Can have more than one member if you really want... |
| 941 | 989 | $member_ids = is_array($member_ids) ? $member_ids : array($member_ids); |
@@ -960,8 +1008,9 @@ discard block |
||
| 960 | 1008 | */ |
| 961 | 1009 | function ssi_fetchGroupMembers($group_id = null, $output_method = 'echo') |
| 962 | 1010 | { |
| 963 | - if ($group_id === null) |
|
| 964 | - return; |
|
| 1011 | + if ($group_id === null) { |
|
| 1012 | + return; |
|
| 1013 | + } |
|
| 965 | 1014 | |
| 966 | 1015 | $query_where = ' |
| 967 | 1016 | id_group = {int:id_group} |
@@ -988,8 +1037,9 @@ discard block |
||
| 988 | 1037 | { |
| 989 | 1038 | global $smcFunc, $memberContext; |
| 990 | 1039 | |
| 991 | - if ($query_where === null) |
|
| 992 | - return; |
|
| 1040 | + if ($query_where === null) { |
|
| 1041 | + return; |
|
| 1042 | + } |
|
| 993 | 1043 | |
| 994 | 1044 | // Fetch the members in question. |
| 995 | 1045 | $request = $smcFunc['db_query']('', ' |
@@ -1002,12 +1052,14 @@ discard block |
||
| 1002 | 1052 | )) |
| 1003 | 1053 | ); |
| 1004 | 1054 | $members = array(); |
| 1005 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1006 | - $members[] = $row['id_member']; |
|
| 1055 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1056 | + $members[] = $row['id_member']; |
|
| 1057 | + } |
|
| 1007 | 1058 | $smcFunc['db_free_result']($request); |
| 1008 | 1059 | |
| 1009 | - if (empty($members)) |
|
| 1010 | - return array(); |
|
| 1060 | + if (empty($members)) { |
|
| 1061 | + return array(); |
|
| 1062 | + } |
|
| 1011 | 1063 | |
| 1012 | 1064 | // If mods want to do somthing with this list of members, let them do that now. |
| 1013 | 1065 | call_integration_hook('integrate_ssi_queryMembers', array(&$members)); |
@@ -1016,23 +1068,25 @@ discard block |
||
| 1016 | 1068 | loadMemberData($members); |
| 1017 | 1069 | |
| 1018 | 1070 | // Draw the table! |
| 1019 | - if ($output_method == 'echo') |
|
| 1020 | - echo ' |
|
| 1071 | + if ($output_method == 'echo') { |
|
| 1072 | + echo ' |
|
| 1021 | 1073 | <table style="border: none" class="ssi_table">'; |
| 1074 | + } |
|
| 1022 | 1075 | |
| 1023 | 1076 | $query_members = array(); |
| 1024 | 1077 | foreach ($members as $member) |
| 1025 | 1078 | { |
| 1026 | 1079 | // Load their context data. |
| 1027 | - if (!loadMemberContext($member)) |
|
| 1028 | - continue; |
|
| 1080 | + if (!loadMemberContext($member)) { |
|
| 1081 | + continue; |
|
| 1082 | + } |
|
| 1029 | 1083 | |
| 1030 | 1084 | // Store this member's information. |
| 1031 | 1085 | $query_members[$member] = $memberContext[$member]; |
| 1032 | 1086 | |
| 1033 | 1087 | // Only do something if we're echo'ing. |
| 1034 | - if ($output_method == 'echo') |
|
| 1035 | - echo ' |
|
| 1088 | + if ($output_method == 'echo') { |
|
| 1089 | + echo ' |
|
| 1036 | 1090 | <tr> |
| 1037 | 1091 | <td style="text-align: right; vertical-align: top; white-space: nowrap"> |
| 1038 | 1092 | ', $query_members[$member]['link'], ' |
@@ -1040,12 +1094,14 @@ discard block |
||
| 1040 | 1094 | <br>', $query_members[$member]['avatar']['image'], ' |
| 1041 | 1095 | </td> |
| 1042 | 1096 | </tr>'; |
| 1097 | + } |
|
| 1043 | 1098 | } |
| 1044 | 1099 | |
| 1045 | 1100 | // End the table if appropriate. |
| 1046 | - if ($output_method == 'echo') |
|
| 1047 | - echo ' |
|
| 1101 | + if ($output_method == 'echo') { |
|
| 1102 | + echo ' |
|
| 1048 | 1103 | </table>'; |
| 1104 | + } |
|
| 1049 | 1105 | |
| 1050 | 1106 | // Send back the data. |
| 1051 | 1107 | return $query_members; |
@@ -1060,8 +1116,9 @@ discard block |
||
| 1060 | 1116 | { |
| 1061 | 1117 | global $txt, $scripturl, $modSettings, $smcFunc; |
| 1062 | 1118 | |
| 1063 | - if (!allowedTo('view_stats')) |
|
| 1064 | - return; |
|
| 1119 | + if (!allowedTo('view_stats')) { |
|
| 1120 | + return; |
|
| 1121 | + } |
|
| 1065 | 1122 | |
| 1066 | 1123 | $totals = array( |
| 1067 | 1124 | 'members' => $modSettings['totalMembers'], |
@@ -1090,8 +1147,9 @@ discard block |
||
| 1090 | 1147 | // If mods want to do somthing with the board stats, let them do that now. |
| 1091 | 1148 | call_integration_hook('integrate_ssi_boardStats', array(&$totals)); |
| 1092 | 1149 | |
| 1093 | - if ($output_method != 'echo') |
|
| 1094 | - return $totals; |
|
| 1150 | + if ($output_method != 'echo') { |
|
| 1151 | + return $totals; |
|
| 1152 | + } |
|
| 1095 | 1153 | |
| 1096 | 1154 | echo ' |
| 1097 | 1155 | ', $txt['total_members'], ': <a href="', $scripturl . '?action=mlist">', comma_format($totals['members']), '</a><br> |
@@ -1120,8 +1178,8 @@ discard block |
||
| 1120 | 1178 | call_integration_hook('integrate_ssi_whosOnline', array(&$return)); |
| 1121 | 1179 | |
| 1122 | 1180 | // Add some redundancy for backwards compatibility reasons. |
| 1123 | - if ($output_method != 'echo') |
|
| 1124 | - return $return + array( |
|
| 1181 | + if ($output_method != 'echo') { |
|
| 1182 | + return $return + array( |
|
| 1125 | 1183 | 'users' => $return['users_online'], |
| 1126 | 1184 | 'guests' => $return['num_guests'], |
| 1127 | 1185 | 'hidden' => $return['num_users_hidden'], |
@@ -1129,29 +1187,35 @@ discard block |
||
| 1129 | 1187 | 'num_users' => $return['num_users_online'], |
| 1130 | 1188 | 'total_users' => $return['num_users_online'] + $return['num_guests'], |
| 1131 | 1189 | ); |
| 1190 | + } |
|
| 1132 | 1191 | |
| 1133 | 1192 | echo ' |
| 1134 | 1193 | ', 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']; |
| 1135 | 1194 | |
| 1136 | 1195 | $bracketList = array(); |
| 1137 | - if (!empty($user_info['buddies'])) |
|
| 1138 | - $bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
| 1139 | - if (!empty($return['num_spiders'])) |
|
| 1140 | - $bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
| 1141 | - if (!empty($return['num_users_hidden'])) |
|
| 1142 | - $bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden']; |
|
| 1196 | + if (!empty($user_info['buddies'])) { |
|
| 1197 | + $bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
| 1198 | + } |
|
| 1199 | + if (!empty($return['num_spiders'])) { |
|
| 1200 | + $bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
| 1201 | + } |
|
| 1202 | + if (!empty($return['num_users_hidden'])) { |
|
| 1203 | + $bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden']; |
|
| 1204 | + } |
|
| 1143 | 1205 | |
| 1144 | - if (!empty($bracketList)) |
|
| 1145 | - echo ' (' . implode(', ', $bracketList) . ')'; |
|
| 1206 | + if (!empty($bracketList)) { |
|
| 1207 | + echo ' (' . implode(', ', $bracketList) . ')'; |
|
| 1208 | + } |
|
| 1146 | 1209 | |
| 1147 | 1210 | echo '<br> |
| 1148 | 1211 | ', implode(', ', $return['list_users_online']); |
| 1149 | 1212 | |
| 1150 | 1213 | // Showing membergroups? |
| 1151 | - if (!empty($settings['show_group_key']) && !empty($return['membergroups'])) |
|
| 1152 | - echo '<br> |
|
| 1214 | + if (!empty($settings['show_group_key']) && !empty($return['membergroups'])) { |
|
| 1215 | + echo '<br> |
|
| 1153 | 1216 | [' . implode('] [', $return['membergroups']) . ']'; |
| 1154 | -} |
|
| 1217 | + } |
|
| 1218 | + } |
|
| 1155 | 1219 | |
| 1156 | 1220 | /** |
| 1157 | 1221 | * Just like whosOnline except it also logs the online presence. |
@@ -1162,11 +1226,12 @@ discard block |
||
| 1162 | 1226 | { |
| 1163 | 1227 | writeLog(); |
| 1164 | 1228 | |
| 1165 | - if ($output_method != 'echo') |
|
| 1166 | - return ssi_whosOnline($output_method); |
|
| 1167 | - else |
|
| 1168 | - ssi_whosOnline($output_method); |
|
| 1169 | -} |
|
| 1229 | + if ($output_method != 'echo') { |
|
| 1230 | + return ssi_whosOnline($output_method); |
|
| 1231 | + } else { |
|
| 1232 | + ssi_whosOnline($output_method); |
|
| 1233 | + } |
|
| 1234 | + } |
|
| 1170 | 1235 | |
| 1171 | 1236 | // Shows a login box. |
| 1172 | 1237 | /** |
@@ -1179,11 +1244,13 @@ discard block |
||
| 1179 | 1244 | { |
| 1180 | 1245 | global $scripturl, $txt, $user_info, $context; |
| 1181 | 1246 | |
| 1182 | - if ($redirect_to != '') |
|
| 1183 | - $_SESSION['login_url'] = $redirect_to; |
|
| 1247 | + if ($redirect_to != '') { |
|
| 1248 | + $_SESSION['login_url'] = $redirect_to; |
|
| 1249 | + } |
|
| 1184 | 1250 | |
| 1185 | - if ($output_method != 'echo' || !$user_info['is_guest']) |
|
| 1186 | - return $user_info['is_guest']; |
|
| 1251 | + if ($output_method != 'echo' || !$user_info['is_guest']) { |
|
| 1252 | + return $user_info['is_guest']; |
|
| 1253 | + } |
|
| 1187 | 1254 | |
| 1188 | 1255 | // Create a login token |
| 1189 | 1256 | createToken('login'); |
@@ -1235,8 +1302,9 @@ discard block |
||
| 1235 | 1302 | |
| 1236 | 1303 | $boardsAllowed = array_intersect(boardsAllowedTo('poll_view'), boardsAllowedTo('poll_vote')); |
| 1237 | 1304 | |
| 1238 | - if (empty($boardsAllowed)) |
|
| 1239 | - return array(); |
|
| 1305 | + if (empty($boardsAllowed)) { |
|
| 1306 | + return array(); |
|
| 1307 | + } |
|
| 1240 | 1308 | |
| 1241 | 1309 | $request = $smcFunc['db_query']('', ' |
| 1242 | 1310 | SELECT p.id_poll, p.question, t.id_topic, p.max_votes, p.guest_vote, p.hide_results, p.expire_time |
@@ -1269,12 +1337,14 @@ discard block |
||
| 1269 | 1337 | $smcFunc['db_free_result']($request); |
| 1270 | 1338 | |
| 1271 | 1339 | // This user has voted on all the polls. |
| 1272 | - if (empty($row) || !is_array($row)) |
|
| 1273 | - return array(); |
|
| 1340 | + if (empty($row) || !is_array($row)) { |
|
| 1341 | + return array(); |
|
| 1342 | + } |
|
| 1274 | 1343 | |
| 1275 | 1344 | // If this is a guest who's voted we'll through ourselves to show poll to show the results. |
| 1276 | - if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))) |
|
| 1277 | - return ssi_showPoll($row['id_topic'], $output_method); |
|
| 1345 | + if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))) { |
|
| 1346 | + return ssi_showPoll($row['id_topic'], $output_method); |
|
| 1347 | + } |
|
| 1278 | 1348 | |
| 1279 | 1349 | $request = $smcFunc['db_query']('', ' |
| 1280 | 1350 | SELECT COUNT(DISTINCT id_member) |
@@ -1338,8 +1408,9 @@ discard block |
||
| 1338 | 1408 | // If mods want to do somthing with this list of polls, let them do that now. |
| 1339 | 1409 | call_integration_hook('integrate_ssi_recentPoll', array(&$return, $topPollInstead)); |
| 1340 | 1410 | |
| 1341 | - if ($output_method != 'echo') |
|
| 1342 | - return $return; |
|
| 1411 | + if ($output_method != 'echo') { |
|
| 1412 | + return $return; |
|
| 1413 | + } |
|
| 1343 | 1414 | |
| 1344 | 1415 | if ($allow_view_results) |
| 1345 | 1416 | { |
@@ -1348,19 +1419,20 @@ discard block |
||
| 1348 | 1419 | <strong>', $return['question'], '</strong><br> |
| 1349 | 1420 | ', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : ''; |
| 1350 | 1421 | |
| 1351 | - foreach ($return['options'] as $option) |
|
| 1352 | - echo ' |
|
| 1422 | + foreach ($return['options'] as $option) { |
|
| 1423 | + echo ' |
|
| 1353 | 1424 | <label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>'; |
| 1425 | + } |
|
| 1354 | 1426 | |
| 1355 | 1427 | echo ' |
| 1356 | 1428 | <input type="submit" value="', $txt['poll_vote'], '" class="button_submit"> |
| 1357 | 1429 | <input type="hidden" name="poll" value="', $return['id'], '"> |
| 1358 | 1430 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 1359 | 1431 | </form>'; |
| 1432 | + } else { |
|
| 1433 | + echo $txt['poll_cannot_see']; |
|
| 1434 | + } |
|
| 1360 | 1435 | } |
| 1361 | - else |
|
| 1362 | - echo $txt['poll_cannot_see']; |
|
| 1363 | -} |
|
| 1364 | 1436 | |
| 1365 | 1437 | /** |
| 1366 | 1438 | * Shows the poll from the specified topic |
@@ -1374,13 +1446,15 @@ discard block |
||
| 1374 | 1446 | |
| 1375 | 1447 | $boardsAllowed = boardsAllowedTo('poll_view'); |
| 1376 | 1448 | |
| 1377 | - if (empty($boardsAllowed)) |
|
| 1378 | - return array(); |
|
| 1449 | + if (empty($boardsAllowed)) { |
|
| 1450 | + return array(); |
|
| 1451 | + } |
|
| 1379 | 1452 | |
| 1380 | - if ($topic === null && isset($_REQUEST['ssi_topic'])) |
|
| 1381 | - $topic = (int) $_REQUEST['ssi_topic']; |
|
| 1382 | - else |
|
| 1383 | - $topic = (int) $topic; |
|
| 1453 | + if ($topic === null && isset($_REQUEST['ssi_topic'])) { |
|
| 1454 | + $topic = (int) $_REQUEST['ssi_topic']; |
|
| 1455 | + } else { |
|
| 1456 | + $topic = (int) $topic; |
|
| 1457 | + } |
|
| 1384 | 1458 | |
| 1385 | 1459 | $request = $smcFunc['db_query']('', ' |
| 1386 | 1460 | SELECT |
@@ -1401,17 +1475,18 @@ discard block |
||
| 1401 | 1475 | ); |
| 1402 | 1476 | |
| 1403 | 1477 | // Either this topic has no poll, or the user cannot view it. |
| 1404 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 1405 | - return array(); |
|
| 1478 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 1479 | + return array(); |
|
| 1480 | + } |
|
| 1406 | 1481 | |
| 1407 | 1482 | $row = $smcFunc['db_fetch_assoc']($request); |
| 1408 | 1483 | $smcFunc['db_free_result']($request); |
| 1409 | 1484 | |
| 1410 | 1485 | // Check if they can vote. |
| 1411 | 1486 | $already_voted = false; |
| 1412 | - if (!empty($row['expire_time']) && $row['expire_time'] < time()) |
|
| 1413 | - $allow_vote = false; |
|
| 1414 | - elseif ($user_info['is_guest']) |
|
| 1487 | + if (!empty($row['expire_time']) && $row['expire_time'] < time()) { |
|
| 1488 | + $allow_vote = false; |
|
| 1489 | + } elseif ($user_info['is_guest']) |
|
| 1415 | 1490 | { |
| 1416 | 1491 | // There's a difference between "allowed to vote" and "already voted"... |
| 1417 | 1492 | $allow_vote = $row['guest_vote']; |
@@ -1421,10 +1496,9 @@ discard block |
||
| 1421 | 1496 | { |
| 1422 | 1497 | $already_voted = true; |
| 1423 | 1498 | } |
| 1424 | - } |
|
| 1425 | - elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board'])) |
|
| 1426 | - $allow_vote = false; |
|
| 1427 | - else |
|
| 1499 | + } elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board'])) { |
|
| 1500 | + $allow_vote = false; |
|
| 1501 | + } else |
|
| 1428 | 1502 | { |
| 1429 | 1503 | $request = $smcFunc['db_query']('', ' |
| 1430 | 1504 | SELECT id_member |
@@ -1506,8 +1580,9 @@ discard block |
||
| 1506 | 1580 | // If mods want to do somthing with this poll, let them do that now. |
| 1507 | 1581 | call_integration_hook('integrate_ssi_showPoll', array(&$return)); |
| 1508 | 1582 | |
| 1509 | - if ($output_method != 'echo') |
|
| 1510 | - return $return; |
|
| 1583 | + if ($output_method != 'echo') { |
|
| 1584 | + return $return; |
|
| 1585 | + } |
|
| 1511 | 1586 | |
| 1512 | 1587 | if ($return['allow_vote']) |
| 1513 | 1588 | { |
@@ -1516,17 +1591,17 @@ discard block |
||
| 1516 | 1591 | <strong>', $return['question'], '</strong><br> |
| 1517 | 1592 | ', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : ''; |
| 1518 | 1593 | |
| 1519 | - foreach ($return['options'] as $option) |
|
| 1520 | - echo ' |
|
| 1594 | + foreach ($return['options'] as $option) { |
|
| 1595 | + echo ' |
|
| 1521 | 1596 | <label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>'; |
| 1597 | + } |
|
| 1522 | 1598 | |
| 1523 | 1599 | echo ' |
| 1524 | 1600 | <input type="submit" value="', $txt['poll_vote'], '" class="button_submit"> |
| 1525 | 1601 | <input type="hidden" name="poll" value="', $return['id'], '"> |
| 1526 | 1602 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 1527 | 1603 | </form>'; |
| 1528 | - } |
|
| 1529 | - else |
|
| 1604 | + } else |
|
| 1530 | 1605 | { |
| 1531 | 1606 | echo ' |
| 1532 | 1607 | <div class="ssi_poll"> |
@@ -1606,27 +1681,32 @@ discard block |
||
| 1606 | 1681 | 'is_approved' => 1, |
| 1607 | 1682 | ) |
| 1608 | 1683 | ); |
| 1609 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 1610 | - die; |
|
| 1684 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 1685 | + die; |
|
| 1686 | + } |
|
| 1611 | 1687 | $row = $smcFunc['db_fetch_assoc']($request); |
| 1612 | 1688 | $smcFunc['db_free_result']($request); |
| 1613 | 1689 | |
| 1614 | - if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time'])) |
|
| 1615 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1690 | + if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time'])) { |
|
| 1691 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1692 | + } |
|
| 1616 | 1693 | |
| 1617 | 1694 | // Too many options checked? |
| 1618 | - if (count($_REQUEST['options']) > $row['max_votes']) |
|
| 1619 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1695 | + if (count($_REQUEST['options']) > $row['max_votes']) { |
|
| 1696 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1697 | + } |
|
| 1620 | 1698 | |
| 1621 | 1699 | // It's a guest who has already voted? |
| 1622 | 1700 | if ($user_info['is_guest']) |
| 1623 | 1701 | { |
| 1624 | 1702 | // Guest voting disabled? |
| 1625 | - if (!$row['guest_vote']) |
|
| 1626 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1703 | + if (!$row['guest_vote']) { |
|
| 1704 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1705 | + } |
|
| 1627 | 1706 | // Already voted? |
| 1628 | - elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) |
|
| 1629 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1707 | + elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) { |
|
| 1708 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
| 1709 | + } |
|
| 1630 | 1710 | } |
| 1631 | 1711 | |
| 1632 | 1712 | $sOptions = array(); |
@@ -1680,11 +1760,13 @@ discard block |
||
| 1680 | 1760 | { |
| 1681 | 1761 | global $scripturl, $txt, $context; |
| 1682 | 1762 | |
| 1683 | - if (!allowedTo('search_posts')) |
|
| 1684 | - return; |
|
| 1763 | + if (!allowedTo('search_posts')) { |
|
| 1764 | + return; |
|
| 1765 | + } |
|
| 1685 | 1766 | |
| 1686 | - if ($output_method != 'echo') |
|
| 1687 | - return $scripturl . '?action=search'; |
|
| 1767 | + if ($output_method != 'echo') { |
|
| 1768 | + return $scripturl . '?action=search'; |
|
| 1769 | + } |
|
| 1688 | 1770 | |
| 1689 | 1771 | echo ' |
| 1690 | 1772 | <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '"> |
@@ -1706,8 +1788,9 @@ discard block |
||
| 1706 | 1788 | // 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. |
| 1707 | 1789 | call_integration_hook('integrate_ssi_news'); |
| 1708 | 1790 | |
| 1709 | - if ($output_method != 'echo') |
|
| 1710 | - return $context['random_news_line']; |
|
| 1791 | + if ($output_method != 'echo') { |
|
| 1792 | + return $context['random_news_line']; |
|
| 1793 | + } |
|
| 1711 | 1794 | |
| 1712 | 1795 | echo $context['random_news_line']; |
| 1713 | 1796 | } |
@@ -1721,8 +1804,9 @@ discard block |
||
| 1721 | 1804 | { |
| 1722 | 1805 | global $scripturl, $modSettings, $user_info; |
| 1723 | 1806 | |
| 1724 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view')) |
|
| 1725 | - return; |
|
| 1807 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view')) { |
|
| 1808 | + return; |
|
| 1809 | + } |
|
| 1726 | 1810 | |
| 1727 | 1811 | $eventOptions = array( |
| 1728 | 1812 | 'include_birthdays' => true, |
@@ -1733,13 +1817,15 @@ discard block |
||
| 1733 | 1817 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
| 1734 | 1818 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
| 1735 | 1819 | |
| 1736 | - if ($output_method != 'echo') |
|
| 1737 | - return $return['calendar_birthdays']; |
|
| 1820 | + if ($output_method != 'echo') { |
|
| 1821 | + return $return['calendar_birthdays']; |
|
| 1822 | + } |
|
| 1738 | 1823 | |
| 1739 | - foreach ($return['calendar_birthdays'] as $member) |
|
| 1740 | - echo ' |
|
| 1824 | + foreach ($return['calendar_birthdays'] as $member) { |
|
| 1825 | + echo ' |
|
| 1741 | 1826 | <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'] ? ', ' : ''); |
| 1742 | -} |
|
| 1827 | + } |
|
| 1828 | + } |
|
| 1743 | 1829 | |
| 1744 | 1830 | /** |
| 1745 | 1831 | * Shows today's holidays. |
@@ -1750,8 +1836,9 @@ discard block |
||
| 1750 | 1836 | { |
| 1751 | 1837 | global $modSettings, $user_info; |
| 1752 | 1838 | |
| 1753 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
| 1754 | - return; |
|
| 1839 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
| 1840 | + return; |
|
| 1841 | + } |
|
| 1755 | 1842 | |
| 1756 | 1843 | $eventOptions = array( |
| 1757 | 1844 | 'include_holidays' => true, |
@@ -1762,8 +1849,9 @@ discard block |
||
| 1762 | 1849 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
| 1763 | 1850 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
| 1764 | 1851 | |
| 1765 | - if ($output_method != 'echo') |
|
| 1766 | - return $return['calendar_holidays']; |
|
| 1852 | + if ($output_method != 'echo') { |
|
| 1853 | + return $return['calendar_holidays']; |
|
| 1854 | + } |
|
| 1767 | 1855 | |
| 1768 | 1856 | echo ' |
| 1769 | 1857 | ', implode(', ', $return['calendar_holidays']); |
@@ -1777,8 +1865,9 @@ discard block |
||
| 1777 | 1865 | { |
| 1778 | 1866 | global $modSettings, $user_info; |
| 1779 | 1867 | |
| 1780 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
| 1781 | - return; |
|
| 1868 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
| 1869 | + return; |
|
| 1870 | + } |
|
| 1782 | 1871 | |
| 1783 | 1872 | $eventOptions = array( |
| 1784 | 1873 | 'include_events' => true, |
@@ -1789,14 +1878,16 @@ discard block |
||
| 1789 | 1878 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
| 1790 | 1879 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
| 1791 | 1880 | |
| 1792 | - if ($output_method != 'echo') |
|
| 1793 | - return $return['calendar_events']; |
|
| 1881 | + if ($output_method != 'echo') { |
|
| 1882 | + return $return['calendar_events']; |
|
| 1883 | + } |
|
| 1794 | 1884 | |
| 1795 | 1885 | foreach ($return['calendar_events'] as $event) |
| 1796 | 1886 | { |
| 1797 | - if ($event['can_edit']) |
|
| 1798 | - echo ' |
|
| 1887 | + if ($event['can_edit']) { |
|
| 1888 | + echo ' |
|
| 1799 | 1889 | <a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> '; |
| 1890 | + } |
|
| 1800 | 1891 | echo ' |
| 1801 | 1892 | ' . $event['link'] . (!$event['is_last'] ? ', ' : ''); |
| 1802 | 1893 | } |
@@ -1811,8 +1902,9 @@ discard block |
||
| 1811 | 1902 | { |
| 1812 | 1903 | global $modSettings, $txt, $scripturl, $user_info; |
| 1813 | 1904 | |
| 1814 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
| 1815 | - return; |
|
| 1905 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
| 1906 | + return; |
|
| 1907 | + } |
|
| 1816 | 1908 | |
| 1817 | 1909 | $eventOptions = array( |
| 1818 | 1910 | 'include_birthdays' => allowedTo('profile_view'), |
@@ -1825,19 +1917,22 @@ discard block |
||
| 1825 | 1917 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
| 1826 | 1918 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
| 1827 | 1919 | |
| 1828 | - if ($output_method != 'echo') |
|
| 1829 | - return $return; |
|
| 1920 | + if ($output_method != 'echo') { |
|
| 1921 | + return $return; |
|
| 1922 | + } |
|
| 1830 | 1923 | |
| 1831 | - if (!empty($return['calendar_holidays'])) |
|
| 1832 | - echo ' |
|
| 1924 | + if (!empty($return['calendar_holidays'])) { |
|
| 1925 | + echo ' |
|
| 1833 | 1926 | <span class="holiday">' . $txt['calendar_prompt'] . ' ' . implode(', ', $return['calendar_holidays']) . '<br></span>'; |
| 1927 | + } |
|
| 1834 | 1928 | if (!empty($return['calendar_birthdays'])) |
| 1835 | 1929 | { |
| 1836 | 1930 | echo ' |
| 1837 | 1931 | <span class="birthday">' . $txt['birthdays_upcoming'] . '</span> '; |
| 1838 | - foreach ($return['calendar_birthdays'] as $member) |
|
| 1839 | - echo ' |
|
| 1932 | + foreach ($return['calendar_birthdays'] as $member) { |
|
| 1933 | + echo ' |
|
| 1840 | 1934 | <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'] ? ', ' : ''; |
| 1935 | + } |
|
| 1841 | 1936 | echo ' |
| 1842 | 1937 | <br>'; |
| 1843 | 1938 | } |
@@ -1847,9 +1942,10 @@ discard block |
||
| 1847 | 1942 | <span class="event">' . $txt['events_upcoming'] . '</span> '; |
| 1848 | 1943 | foreach ($return['calendar_events'] as $event) |
| 1849 | 1944 | { |
| 1850 | - if ($event['can_edit']) |
|
| 1851 | - echo ' |
|
| 1945 | + if ($event['can_edit']) { |
|
| 1946 | + echo ' |
|
| 1852 | 1947 | <a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> '; |
| 1948 | + } |
|
| 1853 | 1949 | echo ' |
| 1854 | 1950 | ' . $event['link'] . (!$event['is_last'] ? ', ' : ''); |
| 1855 | 1951 | } |
@@ -1873,25 +1969,29 @@ discard block |
||
| 1873 | 1969 | loadLanguage('Stats'); |
| 1874 | 1970 | |
| 1875 | 1971 | // Must be integers.... |
| 1876 | - if ($limit === null) |
|
| 1877 | - $limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5; |
|
| 1878 | - else |
|
| 1879 | - $limit = (int) $limit; |
|
| 1880 | - |
|
| 1881 | - if ($start === null) |
|
| 1882 | - $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
| 1883 | - else |
|
| 1884 | - $start = (int) $start; |
|
| 1885 | - |
|
| 1886 | - if ($board !== null) |
|
| 1887 | - $board = (int) $board; |
|
| 1888 | - elseif (isset($_GET['board'])) |
|
| 1889 | - $board = (int) $_GET['board']; |
|
| 1890 | - |
|
| 1891 | - if ($length === null) |
|
| 1892 | - $length = isset($_GET['length']) ? (int) $_GET['length'] : 0; |
|
| 1893 | - else |
|
| 1894 | - $length = (int) $length; |
|
| 1972 | + if ($limit === null) { |
|
| 1973 | + $limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5; |
|
| 1974 | + } else { |
|
| 1975 | + $limit = (int) $limit; |
|
| 1976 | + } |
|
| 1977 | + |
|
| 1978 | + if ($start === null) { |
|
| 1979 | + $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
| 1980 | + } else { |
|
| 1981 | + $start = (int) $start; |
|
| 1982 | + } |
|
| 1983 | + |
|
| 1984 | + if ($board !== null) { |
|
| 1985 | + $board = (int) $board; |
|
| 1986 | + } elseif (isset($_GET['board'])) { |
|
| 1987 | + $board = (int) $_GET['board']; |
|
| 1988 | + } |
|
| 1989 | + |
|
| 1990 | + if ($length === null) { |
|
| 1991 | + $length = isset($_GET['length']) ? (int) $_GET['length'] : 0; |
|
| 1992 | + } else { |
|
| 1993 | + $length = (int) $length; |
|
| 1994 | + } |
|
| 1895 | 1995 | |
| 1896 | 1996 | $limit = max(0, $limit); |
| 1897 | 1997 | $start = max(0, $start); |
@@ -1909,17 +2009,19 @@ discard block |
||
| 1909 | 2009 | ); |
| 1910 | 2010 | if ($smcFunc['db_num_rows']($request) == 0) |
| 1911 | 2011 | { |
| 1912 | - if ($output_method == 'echo') |
|
| 1913 | - die($txt['ssi_no_guests']); |
|
| 1914 | - else |
|
| 1915 | - return array(); |
|
| 2012 | + if ($output_method == 'echo') { |
|
| 2013 | + die($txt['ssi_no_guests']); |
|
| 2014 | + } else { |
|
| 2015 | + return array(); |
|
| 2016 | + } |
|
| 1916 | 2017 | } |
| 1917 | 2018 | list ($board) = $smcFunc['db_fetch_row']($request); |
| 1918 | 2019 | $smcFunc['db_free_result']($request); |
| 1919 | 2020 | |
| 1920 | 2021 | $icon_sources = array(); |
| 1921 | - foreach ($context['stable_icons'] as $icon) |
|
| 1922 | - $icon_sources[$icon] = 'images_url'; |
|
| 2022 | + foreach ($context['stable_icons'] as $icon) { |
|
| 2023 | + $icon_sources[$icon] = 'images_url'; |
|
| 2024 | + } |
|
| 1923 | 2025 | |
| 1924 | 2026 | if (!empty($modSettings['enable_likes'])) |
| 1925 | 2027 | { |
@@ -1943,12 +2045,14 @@ discard block |
||
| 1943 | 2045 | ) |
| 1944 | 2046 | ); |
| 1945 | 2047 | $posts = array(); |
| 1946 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1947 | - $posts[] = $row['id_first_msg']; |
|
| 2048 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 2049 | + $posts[] = $row['id_first_msg']; |
|
| 2050 | + } |
|
| 1948 | 2051 | $smcFunc['db_free_result']($request); |
| 1949 | 2052 | |
| 1950 | - if (empty($posts)) |
|
| 1951 | - return array(); |
|
| 2053 | + if (empty($posts)) { |
|
| 2054 | + return array(); |
|
| 2055 | + } |
|
| 1952 | 2056 | |
| 1953 | 2057 | // Find the posts. |
| 1954 | 2058 | $request = $smcFunc['db_query']('', ' |
@@ -1978,24 +2082,28 @@ discard block |
||
| 1978 | 2082 | $last_space = strrpos($row['body'], ' '); |
| 1979 | 2083 | $last_open = strrpos($row['body'], '<'); |
| 1980 | 2084 | $last_close = strrpos($row['body'], '>'); |
| 1981 | - 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) |
|
| 1982 | - $cutoff = $last_open; |
|
| 1983 | - elseif (empty($last_close) || $last_close < $last_open) |
|
| 1984 | - $cutoff = $last_space; |
|
| 2085 | + 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) { |
|
| 2086 | + $cutoff = $last_open; |
|
| 2087 | + } elseif (empty($last_close) || $last_close < $last_open) { |
|
| 2088 | + $cutoff = $last_space; |
|
| 2089 | + } |
|
| 1985 | 2090 | |
| 1986 | - if ($cutoff !== false) |
|
| 1987 | - $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); |
|
| 2091 | + if ($cutoff !== false) { |
|
| 2092 | + $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); |
|
| 2093 | + } |
|
| 1988 | 2094 | $row['body'] .= '...'; |
| 1989 | 2095 | } |
| 1990 | 2096 | |
| 1991 | 2097 | $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']); |
| 1992 | 2098 | |
| 1993 | - if (!empty($recycle_board) && $row['id_board'] == $recycle_board) |
|
| 1994 | - $row['icon'] = 'recycled'; |
|
| 2099 | + if (!empty($recycle_board) && $row['id_board'] == $recycle_board) { |
|
| 2100 | + $row['icon'] = 'recycled'; |
|
| 2101 | + } |
|
| 1995 | 2102 | |
| 1996 | 2103 | // Check that this message icon is there... |
| 1997 | - if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) |
|
| 1998 | - $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
| 2104 | + if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) { |
|
| 2105 | + $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
| 2106 | + } |
|
| 1999 | 2107 | |
| 2000 | 2108 | censorText($row['subject']); |
| 2001 | 2109 | censorText($row['body']); |
@@ -2032,16 +2140,18 @@ discard block |
||
| 2032 | 2140 | } |
| 2033 | 2141 | $smcFunc['db_free_result']($request); |
| 2034 | 2142 | |
| 2035 | - if (empty($return)) |
|
| 2036 | - return $return; |
|
| 2143 | + if (empty($return)) { |
|
| 2144 | + return $return; |
|
| 2145 | + } |
|
| 2037 | 2146 | |
| 2038 | 2147 | $return[count($return) - 1]['is_last'] = true; |
| 2039 | 2148 | |
| 2040 | 2149 | // If mods want to do somthing with this list of posts, let them do that now. |
| 2041 | 2150 | call_integration_hook('integrate_ssi_boardNews', array(&$return)); |
| 2042 | 2151 | |
| 2043 | - if ($output_method != 'echo') |
|
| 2044 | - return $return; |
|
| 2152 | + if ($output_method != 'echo') { |
|
| 2153 | + return $return; |
|
| 2154 | + } |
|
| 2045 | 2155 | |
| 2046 | 2156 | foreach ($return as $news) |
| 2047 | 2157 | { |
@@ -2093,9 +2203,10 @@ discard block |
||
| 2093 | 2203 | echo ' |
| 2094 | 2204 | </div>'; |
| 2095 | 2205 | |
| 2096 | - if (!$news['is_last']) |
|
| 2097 | - echo ' |
|
| 2206 | + if (!$news['is_last']) { |
|
| 2207 | + echo ' |
|
| 2098 | 2208 | <hr>'; |
| 2209 | + } |
|
| 2099 | 2210 | } |
| 2100 | 2211 | } |
| 2101 | 2212 | |
@@ -2109,8 +2220,9 @@ discard block |
||
| 2109 | 2220 | { |
| 2110 | 2221 | global $user_info, $scripturl, $modSettings, $txt, $context, $smcFunc; |
| 2111 | 2222 | |
| 2112 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
| 2113 | - return; |
|
| 2223 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
| 2224 | + return; |
|
| 2225 | + } |
|
| 2114 | 2226 | |
| 2115 | 2227 | // Find all events which are happening in the near future that the member can see. |
| 2116 | 2228 | $request = $smcFunc['db_query']('', ' |
@@ -2136,20 +2248,23 @@ discard block |
||
| 2136 | 2248 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2137 | 2249 | { |
| 2138 | 2250 | // 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. |
| 2139 | - if (!empty($duplicates[$row['title'] . $row['id_topic']])) |
|
| 2140 | - continue; |
|
| 2251 | + if (!empty($duplicates[$row['title'] . $row['id_topic']])) { |
|
| 2252 | + continue; |
|
| 2253 | + } |
|
| 2141 | 2254 | |
| 2142 | 2255 | // Censor the title. |
| 2143 | 2256 | censorText($row['title']); |
| 2144 | 2257 | |
| 2145 | - if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) |
|
| 2146 | - $date = strftime('%Y-%m-%d', forum_time(false)); |
|
| 2147 | - else |
|
| 2148 | - $date = $row['start_date']; |
|
| 2258 | + if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) { |
|
| 2259 | + $date = strftime('%Y-%m-%d', forum_time(false)); |
|
| 2260 | + } else { |
|
| 2261 | + $date = $row['start_date']; |
|
| 2262 | + } |
|
| 2149 | 2263 | |
| 2150 | 2264 | // If the topic it is attached to is not approved then don't link it. |
| 2151 | - if (!empty($row['id_first_msg']) && !$row['approved']) |
|
| 2152 | - $row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0; |
|
| 2265 | + if (!empty($row['id_first_msg']) && !$row['approved']) { |
|
| 2266 | + $row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0; |
|
| 2267 | + } |
|
| 2153 | 2268 | |
| 2154 | 2269 | $allday = (empty($row['start_time']) || empty($row['end_time']) || empty($row['timezone']) || !in_array($row['timezone'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) ? true : false; |
| 2155 | 2270 | |
@@ -2175,24 +2290,27 @@ discard block |
||
| 2175 | 2290 | } |
| 2176 | 2291 | $smcFunc['db_free_result']($request); |
| 2177 | 2292 | |
| 2178 | - foreach ($return as $mday => $array) |
|
| 2179 | - $return[$mday][count($array) - 1]['is_last'] = true; |
|
| 2293 | + foreach ($return as $mday => $array) { |
|
| 2294 | + $return[$mday][count($array) - 1]['is_last'] = true; |
|
| 2295 | + } |
|
| 2180 | 2296 | |
| 2181 | 2297 | // If mods want to do somthing with this list of events, let them do that now. |
| 2182 | 2298 | call_integration_hook('integrate_ssi_recentEvents', array(&$return)); |
| 2183 | 2299 | |
| 2184 | - if ($output_method != 'echo' || empty($return)) |
|
| 2185 | - return $return; |
|
| 2300 | + if ($output_method != 'echo' || empty($return)) { |
|
| 2301 | + return $return; |
|
| 2302 | + } |
|
| 2186 | 2303 | |
| 2187 | 2304 | // Well the output method is echo. |
| 2188 | 2305 | echo ' |
| 2189 | 2306 | <span class="event">' . $txt['events'] . '</span> '; |
| 2190 | - foreach ($return as $mday => $array) |
|
| 2191 | - foreach ($array as $event) |
|
| 2307 | + foreach ($return as $mday => $array) { |
|
| 2308 | + foreach ($array as $event) |
|
| 2192 | 2309 | { |
| 2193 | 2310 | if ($event['can_edit']) |
| 2194 | 2311 | echo ' |
| 2195 | 2312 | <a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> '; |
| 2313 | + } |
|
| 2196 | 2314 | |
| 2197 | 2315 | echo ' |
| 2198 | 2316 | ' . $event['link'] . (!$event['is_last'] ? ', ' : ''); |
@@ -2211,8 +2329,9 @@ discard block |
||
| 2211 | 2329 | global $smcFunc; |
| 2212 | 2330 | |
| 2213 | 2331 | // If $id is null, this was most likely called from a query string and should do nothing. |
| 2214 | - if ($id === null) |
|
| 2215 | - return; |
|
| 2332 | + if ($id === null) { |
|
| 2333 | + return; |
|
| 2334 | + } |
|
| 2216 | 2335 | |
| 2217 | 2336 | $request = $smcFunc['db_query']('', ' |
| 2218 | 2337 | SELECT passwd, member_name, is_activated |
@@ -2244,8 +2363,9 @@ discard block |
||
| 2244 | 2363 | $attachments_boards = boardsAllowedTo('view_attachments'); |
| 2245 | 2364 | |
| 2246 | 2365 | // No boards? Adios amigo. |
| 2247 | - if (empty($attachments_boards)) |
|
| 2248 | - return array(); |
|
| 2366 | + if (empty($attachments_boards)) { |
|
| 2367 | + return array(); |
|
| 2368 | + } |
|
| 2249 | 2369 | |
| 2250 | 2370 | // Is it an array? |
| 2251 | 2371 | $attachment_ext = (array) $attachment_ext; |
@@ -2329,8 +2449,9 @@ discard block |
||
| 2329 | 2449 | call_integration_hook('integrate_ssi_recentAttachments', array(&$attachments)); |
| 2330 | 2450 | |
| 2331 | 2451 | // So you just want an array? Here you can have it. |
| 2332 | - if ($output_method == 'array' || empty($attachments)) |
|
| 2333 | - return $attachments; |
|
| 2452 | + if ($output_method == 'array' || empty($attachments)) { |
|
| 2453 | + return $attachments; |
|
| 2454 | + } |
|
| 2334 | 2455 | |
| 2335 | 2456 | // Give them the default. |
| 2336 | 2457 | echo ' |
@@ -2341,14 +2462,15 @@ discard block |
||
| 2341 | 2462 | <th style="text-align: left; padding: 2">', $txt['downloads'], '</th> |
| 2342 | 2463 | <th style="text-align: left; padding: 2">', $txt['filesize'], '</th> |
| 2343 | 2464 | </tr>'; |
| 2344 | - foreach ($attachments as $attach) |
|
| 2345 | - echo ' |
|
| 2465 | + foreach ($attachments as $attach) { |
|
| 2466 | + echo ' |
|
| 2346 | 2467 | <tr> |
| 2347 | 2468 | <td>', $attach['file']['link'], '</td> |
| 2348 | 2469 | <td>', $attach['member']['link'], '</td> |
| 2349 | 2470 | <td style="text-align: center">', $attach['file']['downloads'], '</td> |
| 2350 | 2471 | <td>', $attach['file']['filesize'], '</td> |
| 2351 | 2472 | </tr>'; |
| 2473 | + } |
|
| 2352 | 2474 | echo ' |
| 2353 | 2475 | </table>'; |
| 2354 | 2476 | } |
@@ -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 | { |
@@ -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,21 +73,22 @@ 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 | {}, |
| 89 | 90 | emoticonsEnabled:false'; |
| 91 | + } |
|
| 90 | 92 | |
| 91 | 93 | if ($context['show_bbc'] && $bbcContainer !== null) |
| 92 | 94 | { |
@@ -97,15 +99,16 @@ discard block |
||
| 97 | 99 | { |
| 98 | 100 | echo implode('|', $buttonRow); |
| 99 | 101 | $count_tags--; |
| 100 | - if (!empty($count_tags)) |
|
| 101 | - echo '||'; |
|
| 102 | + if (!empty($count_tags)) { |
|
| 103 | + echo '||'; |
|
| 104 | + } |
|
| 102 | 105 | } |
| 103 | 106 | |
| 104 | 107 | echo '",'; |
| 105 | - } |
|
| 106 | - else |
|
| 107 | - echo ', |
|
| 108 | + } else { |
|
| 109 | + echo ', |
|
| 108 | 110 | toolbar: "",'; |
| 111 | + } |
|
| 109 | 112 | |
| 110 | 113 | echo ' |
| 111 | 114 | }); |
@@ -146,43 +149,48 @@ discard block |
||
| 146 | 149 | </span>'; |
| 147 | 150 | |
| 148 | 151 | $tempTab = $context['tabindex']; |
| 149 | - if (!empty($context['drafts_pm_save'])) |
|
| 150 | - $tempTab++; |
|
| 151 | - elseif (!empty($context['drafts_save'])) |
|
| 152 | - $tempTab++; |
|
| 153 | - elseif ($editor_context['preview_type']) |
|
| 154 | - $tempTab++; |
|
| 155 | - elseif ($context['show_spellchecking']) |
|
| 156 | - $tempTab++; |
|
| 152 | + if (!empty($context['drafts_pm_save'])) { |
|
| 153 | + $tempTab++; |
|
| 154 | + } elseif (!empty($context['drafts_save'])) { |
|
| 155 | + $tempTab++; |
|
| 156 | + } elseif ($editor_context['preview_type']) { |
|
| 157 | + $tempTab++; |
|
| 158 | + } elseif ($context['show_spellchecking']) { |
|
| 159 | + $tempTab++; |
|
| 160 | + } |
|
| 157 | 161 | |
| 158 | 162 | $tempTab++; |
| 159 | 163 | $context['tabindex'] = $tempTab; |
| 160 | 164 | |
| 161 | - if (!empty($context['drafts_pm_save'])) |
|
| 162 | - echo ' |
|
| 165 | + if (!empty($context['drafts_pm_save'])) { |
|
| 166 | + echo ' |
|
| 163 | 167 | <input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="submitThisOnce(this);" accesskey="d" class="button_submit"> |
| 164 | 168 | <input type="hidden" id="id_pm_draft" name="id_pm_draft" value="', empty($context['id_pm_draft']) ? 0 : $context['id_pm_draft'], '">'; |
| 169 | + } |
|
| 165 | 170 | |
| 166 | - if (!empty($context['drafts_save'])) |
|
| 167 | - echo ' |
|
| 171 | + if (!empty($context['drafts_save'])) { |
|
| 172 | + echo ' |
|
| 168 | 173 | <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"> |
| 169 | 174 | <input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '">'; |
| 175 | + } |
|
| 170 | 176 | |
| 171 | - if ($context['show_spellchecking']) |
|
| 172 | - echo ' |
|
| 177 | + if ($context['show_spellchecking']) { |
|
| 178 | + echo ' |
|
| 173 | 179 | <input type="button" value="', $txt['spell_check'], '" tabindex="', --$tempTab, '" onclick="oEditorHandle_', $editor_id, '.spellCheckStart();" class="button_submit">'; |
| 180 | + } |
|
| 174 | 181 | |
| 175 | - if ($editor_context['preview_type']) |
|
| 176 | - echo ' |
|
| 182 | + if ($editor_context['preview_type']) { |
|
| 183 | + echo ' |
|
| 177 | 184 | <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">'; |
| 185 | + } |
|
| 178 | 186 | |
| 179 | 187 | |
| 180 | 188 | echo ' |
| 181 | 189 | <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">'; |
| 182 | 190 | |
| 183 | 191 | // Load in the PM autosaver if it's enabled |
| 184 | - if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave'])) |
|
| 185 | - echo ' |
|
| 192 | + if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave'])) { |
|
| 193 | + echo ' |
|
| 186 | 194 | <span class="righttext padding" style="display: block"> |
| 187 | 195 | <span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"> </span> |
| 188 | 196 | <span id="draft_lastautosave" ></span> |
@@ -200,10 +208,11 @@ discard block |
||
| 200 | 208 | iFreq: ', (empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000), ' |
| 201 | 209 | }); |
| 202 | 210 | </script>'; |
| 211 | + } |
|
| 203 | 212 | |
| 204 | 213 | // Start an instance of the auto saver if its enabled |
| 205 | - if (!empty($context['drafts_save']) && !empty($context['drafts_autosave'])) |
|
| 206 | - echo ' |
|
| 214 | + if (!empty($context['drafts_save']) && !empty($context['drafts_autosave'])) { |
|
| 215 | + echo ' |
|
| 207 | 216 | <span class="righttext padding" style="display: block"> |
| 208 | 217 | <span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"> </span> |
| 209 | 218 | <span id="draft_lastautosave" ></span> |
@@ -220,7 +229,8 @@ discard block |
||
| 220 | 229 | iFreq: ', $context['drafts_autosave_frequency'], ' |
| 221 | 230 | }); |
| 222 | 231 | </script>'; |
| 223 | -} |
|
| 232 | + } |
|
| 233 | + } |
|
| 224 | 234 | |
| 225 | 235 | /** |
| 226 | 236 | * This template displays a verification form |
@@ -237,51 +247,57 @@ discard block |
||
| 237 | 247 | $verify_context = &$context['controls']['verification'][$verify_id]; |
| 238 | 248 | |
| 239 | 249 | // Keep track of where we are. |
| 240 | - if (empty($verify_context['tracking']) || $reset) |
|
| 241 | - $verify_context['tracking'] = 0; |
|
| 250 | + if (empty($verify_context['tracking']) || $reset) { |
|
| 251 | + $verify_context['tracking'] = 0; |
|
| 252 | + } |
|
| 242 | 253 | |
| 243 | 254 | // How many items are there to display in total. |
| 244 | 255 | $total_items = count($verify_context['questions']) + ($verify_context['show_visual'] || $verify_context['can_recaptcha'] ? 1 : 0); |
| 245 | 256 | |
| 246 | 257 | // If we've gone too far, stop. |
| 247 | - if ($verify_context['tracking'] > $total_items) |
|
| 248 | - return false; |
|
| 258 | + if ($verify_context['tracking'] > $total_items) { |
|
| 259 | + return false; |
|
| 260 | + } |
|
| 249 | 261 | |
| 250 | 262 | // Loop through each item to show them. |
| 251 | 263 | for ($i = 0; $i < $total_items; $i++) |
| 252 | 264 | { |
| 253 | 265 | // If we're after a single item only show it if we're in the right place. |
| 254 | - if ($display_type == 'single' && $verify_context['tracking'] != $i) |
|
| 255 | - continue; |
|
| 266 | + if ($display_type == 'single' && $verify_context['tracking'] != $i) { |
|
| 267 | + continue; |
|
| 268 | + } |
|
| 256 | 269 | |
| 257 | - if ($display_type != 'single') |
|
| 258 | - echo ' |
|
| 270 | + if ($display_type != 'single') { |
|
| 271 | + echo ' |
|
| 259 | 272 | <div id="verification_control_', $i, '" class="verification_control">'; |
| 273 | + } |
|
| 260 | 274 | |
| 261 | 275 | // Display empty field, but only if we have one, and it's the first time. |
| 262 | - if ($verify_context['empty_field'] && empty($i)) |
|
| 263 | - echo ' |
|
| 276 | + if ($verify_context['empty_field'] && empty($i)) { |
|
| 277 | + echo ' |
|
| 264 | 278 | <div class="smalltext vv_special"> |
| 265 | 279 | ', $txt['visual_verification_hidden'], ': |
| 266 | 280 | <input type="text" name="', $_SESSION[$verify_id . '_vv']['empty_field'], '" autocomplete="off" size="30" value=""> |
| 267 | 281 | </div>'; |
| 282 | + } |
|
| 268 | 283 | |
| 269 | 284 | // Do the actual stuff |
| 270 | 285 | if ($i == 0 && ($verify_context['show_visual'] || $verify_context['can_recaptcha'])) |
| 271 | 286 | { |
| 272 | 287 | if ($verify_context['show_visual']) |
| 273 | 288 | { |
| 274 | - if ($context['use_graphic_library']) |
|
| 275 | - echo ' |
|
| 289 | + if ($context['use_graphic_library']) { |
|
| 290 | + echo ' |
|
| 276 | 291 | <img src="', $verify_context['image_href'], '" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '">'; |
| 277 | - else |
|
| 278 | - echo ' |
|
| 292 | + } else { |
|
| 293 | + echo ' |
|
| 279 | 294 | <img src="', $verify_context['image_href'], ';letter=1" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_1"> |
| 280 | 295 | <img src="', $verify_context['image_href'], ';letter=2" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_2"> |
| 281 | 296 | <img src="', $verify_context['image_href'], ';letter=3" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_3"> |
| 282 | 297 | <img src="', $verify_context['image_href'], ';letter=4" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_4"> |
| 283 | 298 | <img src="', $verify_context['image_href'], ';letter=5" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_5"> |
| 284 | 299 | <img src="', $verify_context['image_href'], ';letter=6" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_6">'; |
| 300 | + } |
|
| 285 | 301 | |
| 286 | 302 | echo ' |
| 287 | 303 | <div class="smalltext" style="margin: 4px 0 8px 0;"> |
@@ -297,8 +313,7 @@ discard block |
||
| 297 | 313 | <div class="g-recaptcha centertext" data-sitekey="' . $verify_context['recaptcha_site_key'] . '" data-theme="' . $verify_context['recaptcha_theme'] . '"></div><br> |
| 298 | 314 | <script type="text/javascript" src="https://www.google.com/recaptcha/api.js"></script>'; |
| 299 | 315 | } |
| 300 | - } |
|
| 301 | - else |
|
| 316 | + } else |
|
| 302 | 317 | { |
| 303 | 318 | // Where in the question array is this question? |
| 304 | 319 | $qIndex = $verify_context['show_visual'] ? $i - 1 : $i; |
@@ -310,21 +325,24 @@ discard block |
||
| 310 | 325 | </div>'; |
| 311 | 326 | } |
| 312 | 327 | |
| 313 | - if ($display_type != 'single') |
|
| 314 | - echo ' |
|
| 328 | + if ($display_type != 'single') { |
|
| 329 | + echo ' |
|
| 315 | 330 | </div>'; |
| 331 | + } |
|
| 316 | 332 | |
| 317 | 333 | // If we were displaying just one and we did it, break. |
| 318 | - if ($display_type == 'single' && $verify_context['tracking'] == $i) |
|
| 319 | - break; |
|
| 334 | + if ($display_type == 'single' && $verify_context['tracking'] == $i) { |
|
| 335 | + break; |
|
| 336 | + } |
|
| 320 | 337 | } |
| 321 | 338 | |
| 322 | 339 | // Assume we found something, always, |
| 323 | 340 | $verify_context['tracking']++; |
| 324 | 341 | |
| 325 | 342 | // Tell something displaying piecemeal to keep going. |
| 326 | - if ($display_type == 'single') |
|
| 327 | - return true; |
|
| 328 | -} |
|
| 343 | + if ($display_type == 'single') { |
|
| 344 | + return true; |
|
| 345 | + } |
|
| 346 | + } |
|
| 329 | 347 | |
| 330 | 348 | ?> |
| 331 | 349 | \ 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'] . ') |
@@ -1096,7 +1096,7 @@ |
||
| 1096 | 1096 | /** |
| 1097 | 1097 | * CHMOD control form |
| 1098 | 1098 | * |
| 1099 | - * @return bool False if nothing to do. |
|
| 1099 | + * @return false|null False if nothing to do. |
|
| 1100 | 1100 | */ |
| 1101 | 1101 | function template_control_chmod() |
| 1102 | 1102 | { |
@@ -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'], ' |
@@ -229,9 +233,10 @@ discard block |
||
| 229 | 233 | <tr class="title_bar"> |
| 230 | 234 | <td></td> |
| 231 | 235 | <td>'; |
| 232 | - if (!empty($context['themes_locked'])) |
|
| 233 | - echo ' |
|
| 236 | + if (!empty($context['themes_locked'])) { |
|
| 237 | + echo ' |
|
| 234 | 238 | <input type="hidden" name="custom_theme[]" value="', $id, '">'; |
| 239 | + } |
|
| 235 | 240 | echo ' |
| 236 | 241 | <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' : '', '> |
| 237 | 242 | </td> |
@@ -372,14 +377,15 @@ discard block |
||
| 372 | 377 | </script>'; |
| 373 | 378 | |
| 374 | 379 | // And a bit more for database changes. |
| 375 | - if (!empty($context['database_changes'])) |
|
| 376 | - echo ' |
|
| 380 | + if (!empty($context['database_changes'])) { |
|
| 381 | + echo ' |
|
| 377 | 382 | <script> |
| 378 | 383 | var database_changes_area = document.getElementById(\'db_changes_div\'); |
| 379 | 384 | var db_vis = false; |
| 380 | 385 | database_changes_area.style.display = "none"; |
| 381 | 386 | </script>'; |
| 382 | -} |
|
| 387 | + } |
|
| 388 | + } |
|
| 383 | 389 | |
| 384 | 390 | /** |
| 385 | 391 | * Extract package contents |
@@ -411,12 +417,12 @@ discard block |
||
| 411 | 417 | <h3 class="catbg">', $context['uninstalling'] ? $txt['uninstall'] : $txt['extracting'], '</h3> |
| 412 | 418 | </div> |
| 413 | 419 | <div class="information">', $txt['package_installed_extract'], '</div>'; |
| 414 | - } |
|
| 415 | - else |
|
| 416 | - echo ' |
|
| 420 | + } else { |
|
| 421 | + echo ' |
|
| 417 | 422 | <div class="cat_bar"> |
| 418 | 423 | <h3 class="catbg">', $txt['package_installed_redirecting'], '</h3> |
| 419 | 424 | </div>'; |
| 425 | + } |
|
| 420 | 426 | |
| 421 | 427 | echo ' |
| 422 | 428 | <div class="windowbg">'; |
@@ -427,25 +433,25 @@ discard block |
||
| 427 | 433 | echo ' |
| 428 | 434 | ', $context['redirect_text'], '<br><br> |
| 429 | 435 | <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>'; |
| 430 | - } |
|
| 431 | - elseif ($context['uninstalling']) |
|
| 432 | - echo ' |
|
| 436 | + } elseif ($context['uninstalling']) { |
|
| 437 | + echo ' |
|
| 433 | 438 | ', $txt['package_uninstall_done']; |
| 434 | - elseif ($context['install_finished']) |
|
| 439 | + } elseif ($context['install_finished']) |
|
| 435 | 440 | { |
| 436 | - if ($context['extract_type'] == 'avatar') |
|
| 437 | - echo ' |
|
| 441 | + if ($context['extract_type'] == 'avatar') { |
|
| 442 | + echo ' |
|
| 438 | 443 | ', $txt['avatars_extracted']; |
| 439 | - elseif ($context['extract_type'] == 'language') |
|
| 440 | - echo ' |
|
| 444 | + } elseif ($context['extract_type'] == 'language') { |
|
| 445 | + echo ' |
|
| 441 | 446 | ', $txt['language_extracted']; |
| 442 | - else |
|
| 443 | - echo ' |
|
| 447 | + } else { |
|
| 448 | + echo ' |
|
| 444 | 449 | ', $txt['package_installed_done']; |
| 445 | - } |
|
| 446 | - else |
|
| 447 | - echo ' |
|
| 450 | + } |
|
| 451 | + } else { |
|
| 452 | + echo ' |
|
| 448 | 453 | ', $txt['corrupt_compatible']; |
| 454 | + } |
|
| 449 | 455 | |
| 450 | 456 | echo ' |
| 451 | 457 | </div>'; |
@@ -479,9 +485,10 @@ discard block |
||
| 479 | 485 | <div class="windowbg"> |
| 480 | 486 | <ol>'; |
| 481 | 487 | |
| 482 | - foreach ($context['files'] as $fileinfo) |
|
| 483 | - echo ' |
|
| 488 | + foreach ($context['files'] as $fileinfo) { |
|
| 489 | + echo ' |
|
| 484 | 490 | <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>'; |
| 491 | + } |
|
| 485 | 492 | |
| 486 | 493 | echo ' |
| 487 | 494 | </ol> |
@@ -545,9 +552,10 @@ discard block |
||
| 545 | 552 | </script> |
| 546 | 553 | <div id="yourVersion" style="display:none">', $context['forum_version'], '</div>'; |
| 547 | 554 | |
| 548 | - if (empty($modSettings['disable_smf_js'])) |
|
| 549 | - echo ' |
|
| 555 | + if (empty($modSettings['disable_smf_js'])) { |
|
| 556 | + echo ' |
|
| 550 | 557 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
| 558 | + } |
|
| 551 | 559 | |
| 552 | 560 | // This sets the announcements and current versions themselves ;). |
| 553 | 561 | echo ' |
@@ -586,12 +594,13 @@ discard block |
||
| 586 | 594 | } |
| 587 | 595 | } |
| 588 | 596 | |
| 589 | - if (!$mods_available) |
|
| 590 | - echo ' |
|
| 597 | + if (!$mods_available) { |
|
| 598 | + echo ' |
|
| 591 | 599 | <div class="noticebox">', $txt['no_packages'], '</div>'; |
| 592 | - else |
|
| 593 | - echo ' |
|
| 600 | + } else { |
|
| 601 | + echo ' |
|
| 594 | 602 | <br>'; |
| 603 | + } |
|
| 595 | 604 | |
| 596 | 605 | // the advanced (emulation) box, collapsed by default |
| 597 | 606 | echo ' |
@@ -680,11 +689,12 @@ discard block |
||
| 680 | 689 | { |
| 681 | 690 | global $context, $txt, $scripturl; |
| 682 | 691 | |
| 683 | - if (!empty($context['package_ftp']['error'])) |
|
| 684 | - echo ' |
|
| 692 | + if (!empty($context['package_ftp']['error'])) { |
|
| 693 | + echo ' |
|
| 685 | 694 | <div class="errorbox"> |
| 686 | 695 | <pre>', $context['package_ftp']['error'], '</pre> |
| 687 | 696 | </div>'; |
| 697 | + } |
|
| 688 | 698 | |
| 689 | 699 | echo ' |
| 690 | 700 | <div id="admin_form_wrapper"> |
@@ -765,13 +775,14 @@ discard block |
||
| 765 | 775 | <fieldset> |
| 766 | 776 | <legend>' . $txt['package_servers'] . '</legend> |
| 767 | 777 | <ul class="package_servers">'; |
| 768 | - foreach ($context['servers'] as $server) |
|
| 769 | - echo ' |
|
| 778 | + foreach ($context['servers'] as $server) { |
|
| 779 | + echo ' |
|
| 770 | 780 | <li class="flow_auto"> |
| 771 | 781 | <span class="floatleft">' . $server['name'] . '</span> |
| 772 | 782 | <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> |
| 773 | 783 | <span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $server['id'] . '">[ ' . $txt['package_browse'] . ' ]</a></span> |
| 774 | 784 | </li>'; |
| 785 | + } |
|
| 775 | 786 | echo ' |
| 776 | 787 | </ul> |
| 777 | 788 | </fieldset> |
@@ -858,11 +869,12 @@ discard block |
||
| 858 | 869 | <div class="windowbg2">'; |
| 859 | 870 | |
| 860 | 871 | // No packages, as yet. |
| 861 | - if (empty($context['package_list'])) |
|
| 862 | - echo ' |
|
| 872 | + if (empty($context['package_list'])) { |
|
| 873 | + echo ' |
|
| 863 | 874 | <ul> |
| 864 | 875 | <li>', $txt['no_packages'], '</li> |
| 865 | 876 | </ul>'; |
| 877 | + } |
|
| 866 | 878 | // List out the packages... |
| 867 | 879 | else |
| 868 | 880 | { |
@@ -874,11 +886,12 @@ discard block |
||
| 874 | 886 | <li> |
| 875 | 887 | <strong><span id="ps_img_', $i, '" class="toggle_up" alt="*" style="display: none;"></span> ', $packageSection['title'], '</strong>'; |
| 876 | 888 | |
| 877 | - if (!empty($packageSection['text'])) |
|
| 878 | - echo ' |
|
| 889 | + if (!empty($packageSection['text'])) { |
|
| 890 | + echo ' |
|
| 879 | 891 | <div class="sub_bar"> |
| 880 | 892 | <h3 class="subbg">', $packageSection['text'], '</h3> |
| 881 | 893 | </div>'; |
| 894 | + } |
|
| 882 | 895 | |
| 883 | 896 | echo ' |
| 884 | 897 | <', $context['list_type'], ' id="package_section_', $i, '" class="packages">'; |
@@ -888,13 +901,15 @@ discard block |
||
| 888 | 901 | echo ' |
| 889 | 902 | <li>'; |
| 890 | 903 | // Textual message. Could be empty just for a blank line... |
| 891 | - if ($package['is_text']) |
|
| 892 | - echo ' |
|
| 904 | + if ($package['is_text']) { |
|
| 905 | + echo ' |
|
| 893 | 906 | ', empty($package['name']) ? ' ' : $package['name']; |
| 907 | + } |
|
| 894 | 908 | // This is supposed to be a rule.. |
| 895 | - elseif ($package['is_line']) |
|
| 896 | - echo ' |
|
| 909 | + elseif ($package['is_line']) { |
|
| 910 | + echo ' |
|
| 897 | 911 | <hr>'; |
| 912 | + } |
|
| 898 | 913 | // A remote link. |
| 899 | 914 | elseif ($package['is_remote']) |
| 900 | 915 | { |
@@ -916,21 +931,25 @@ discard block |
||
| 916 | 931 | <ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">'; |
| 917 | 932 | |
| 918 | 933 | // Show the mod type? |
| 919 | - if ($package['type'] != '') |
|
| 920 | - echo ' |
|
| 934 | + if ($package['type'] != '') { |
|
| 935 | + echo ' |
|
| 921 | 936 | <li class="package_section">', $txt['package_type'], ': ', $smcFunc['ucwords']($smcFunc['strtolower']($package['type'])), '</li>'; |
| 937 | + } |
|
| 922 | 938 | // Show the version number? |
| 923 | - if ($package['version'] != '') |
|
| 924 | - echo ' |
|
| 939 | + if ($package['version'] != '') { |
|
| 940 | + echo ' |
|
| 925 | 941 | <li class="package_section">', $txt['mod_version'], ': ', $package['version'], '</li>'; |
| 942 | + } |
|
| 926 | 943 | // How 'bout the author? |
| 927 | - if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) |
|
| 928 | - echo ' |
|
| 944 | + if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) { |
|
| 945 | + echo ' |
|
| 929 | 946 | <li class="package_section">', $txt['mod_author'], ': ', $package['author']['link'], '</li>'; |
| 947 | + } |
|
| 930 | 948 | // The homepage.... |
| 931 | - if ($package['author']['website']['link'] != '') |
|
| 932 | - echo ' |
|
| 949 | + if ($package['author']['website']['link'] != '') { |
|
| 950 | + echo ' |
|
| 933 | 951 | <li class="package_section">', $txt['author_website'], ': ', $package['author']['website']['link'], '</li>'; |
| 952 | + } |
|
| 934 | 953 | |
| 935 | 954 | // Desciption: bleh bleh! |
| 936 | 955 | // Location of file: http://someplace/. |
@@ -983,8 +1002,8 @@ discard block |
||
| 983 | 1002 | |
| 984 | 1003 | foreach ($ps['items'] as $id => $package) |
| 985 | 1004 | { |
| 986 | - if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) |
|
| 987 | - echo ' |
|
| 1005 | + if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) { |
|
| 1006 | + echo ' |
|
| 988 | 1007 | var oPackageToggle_', $section, '_pkg_', $id, ' = new smc_Toggle({ |
| 989 | 1008 | bToggleEnabled: true, |
| 990 | 1009 | bCurrentlyCollapsed: true, |
@@ -999,6 +1018,7 @@ discard block |
||
| 999 | 1018 | } |
| 1000 | 1019 | ] |
| 1001 | 1020 | });'; |
| 1021 | + } |
|
| 1002 | 1022 | } |
| 1003 | 1023 | } |
| 1004 | 1024 | echo ' |
@@ -1039,9 +1059,10 @@ discard block |
||
| 1039 | 1059 | { |
| 1040 | 1060 | global $context, $txt, $scripturl; |
| 1041 | 1061 | |
| 1042 | - if (!empty($context['saved_successful'])) |
|
| 1043 | - echo ' |
|
| 1062 | + if (!empty($context['saved_successful'])) { |
|
| 1063 | + echo ' |
|
| 1044 | 1064 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 1065 | + } |
|
| 1045 | 1066 | |
| 1046 | 1067 | echo ' |
| 1047 | 1068 | <div id="admincenter"> |
@@ -1103,8 +1124,9 @@ discard block |
||
| 1103 | 1124 | global $context, $txt; |
| 1104 | 1125 | |
| 1105 | 1126 | // Nothing to do? Brilliant! |
| 1106 | - if (empty($context['package_ftp'])) |
|
| 1107 | - return false; |
|
| 1127 | + if (empty($context['package_ftp'])) { |
|
| 1128 | + return false; |
|
| 1129 | + } |
|
| 1108 | 1130 | |
| 1109 | 1131 | if (empty($context['package_ftp']['form_elements_only'])) |
| 1110 | 1132 | { |
@@ -1113,19 +1135,21 @@ discard block |
||
| 1113 | 1135 | <div id="need_writable_list" class="smalltext"> |
| 1114 | 1136 | ', $txt['package_ftp_why_file_list'], ' |
| 1115 | 1137 | <ul style="display: inline;">'; |
| 1116 | - if (!empty($context['notwritable_files'])) |
|
| 1117 | - foreach ($context['notwritable_files'] as $file) |
|
| 1138 | + if (!empty($context['notwritable_files'])) { |
|
| 1139 | + foreach ($context['notwritable_files'] as $file) |
|
| 1118 | 1140 | echo ' |
| 1119 | 1141 | <li>', $file, '</li>'; |
| 1142 | + } |
|
| 1120 | 1143 | |
| 1121 | 1144 | echo ' |
| 1122 | 1145 | </ul>'; |
| 1123 | 1146 | |
| 1124 | - if (!$context['server']['is_windows']) |
|
| 1125 | - echo ' |
|
| 1147 | + if (!$context['server']['is_windows']) { |
|
| 1148 | + echo ' |
|
| 1126 | 1149 | <hr> |
| 1127 | 1150 | ', $txt['package_chmod_linux'], '<br /> |
| 1128 | 1151 | <tt># chmod a+w ', implode(' ', $context['notwritable_files']), '</tt>'; |
| 1152 | + } |
|
| 1129 | 1153 | |
| 1130 | 1154 | echo ' |
| 1131 | 1155 | </div>'; |
@@ -1136,9 +1160,10 @@ discard block |
||
| 1136 | 1160 | <tt id="ftp_error_message">', !empty($context['package_ftp']['error']) ? $context['package_ftp']['error'] : '', '</tt> |
| 1137 | 1161 | </div></div>'; |
| 1138 | 1162 | |
| 1139 | - if (!empty($context['package_ftp']['destination'])) |
|
| 1140 | - echo ' |
|
| 1163 | + if (!empty($context['package_ftp']['destination'])) { |
|
| 1164 | + echo ' |
|
| 1141 | 1165 | <form action="', $context['package_ftp']['destination'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">'; |
| 1166 | + } |
|
| 1142 | 1167 | |
| 1143 | 1168 | echo ' |
| 1144 | 1169 | <fieldset> |
@@ -1171,25 +1196,28 @@ discard block |
||
| 1171 | 1196 | </dl> |
| 1172 | 1197 | </fieldset>'; |
| 1173 | 1198 | |
| 1174 | - if (empty($context['package_ftp']['form_elements_only'])) |
|
| 1175 | - echo ' |
|
| 1199 | + if (empty($context['package_ftp']['form_elements_only'])) { |
|
| 1200 | + echo ' |
|
| 1176 | 1201 | |
| 1177 | 1202 | <div class="righttext" style="margin: 1ex;"> |
| 1178 | 1203 | <span id="test_ftp_placeholder_full"></span> |
| 1179 | 1204 | <input type="submit" value="', $txt['package_proceed'], '" class="button_submit"> |
| 1180 | 1205 | </div>'; |
| 1206 | + } |
|
| 1181 | 1207 | |
| 1182 | - if (!empty($context['package_ftp']['destination'])) |
|
| 1183 | - echo ' |
|
| 1208 | + if (!empty($context['package_ftp']['destination'])) { |
|
| 1209 | + echo ' |
|
| 1184 | 1210 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 1185 | 1211 | </form>'; |
| 1212 | + } |
|
| 1186 | 1213 | |
| 1187 | 1214 | // Hide the details of the list. |
| 1188 | - if (empty($context['package_ftp']['form_elements_only'])) |
|
| 1189 | - echo ' |
|
| 1215 | + if (empty($context['package_ftp']['form_elements_only'])) { |
|
| 1216 | + echo ' |
|
| 1190 | 1217 | <script> |
| 1191 | 1218 | document.getElementById(\'need_writable_list\').style.display = \'none\'; |
| 1192 | 1219 | </script>'; |
| 1220 | + } |
|
| 1193 | 1221 | |
| 1194 | 1222 | // Quick generate the test button. |
| 1195 | 1223 | echo ' |
@@ -1545,9 +1573,10 @@ discard block |
||
| 1545 | 1573 | <tr class="windowbg"> |
| 1546 | 1574 | <td width="30%"><strong>'; |
| 1547 | 1575 | |
| 1548 | - if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) |
|
| 1549 | - echo ' |
|
| 1576 | + if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) { |
|
| 1577 | + echo ' |
|
| 1550 | 1578 | <span class="generic_icons folder"></span>'; |
| 1579 | + } |
|
| 1551 | 1580 | |
| 1552 | 1581 | echo ' |
| 1553 | 1582 | ', $name, ' |
@@ -1564,8 +1593,9 @@ discard block |
||
| 1564 | 1593 | </tr> |
| 1565 | 1594 | '; |
| 1566 | 1595 | |
| 1567 | - if (!empty($dir['contents'])) |
|
| 1568 | - template_permission_show_contents($name, $dir['contents'], 1); |
|
| 1596 | + if (!empty($dir['contents'])) { |
|
| 1597 | + template_permission_show_contents($name, $dir['contents'], 1); |
|
| 1598 | + } |
|
| 1569 | 1599 | } |
| 1570 | 1600 | |
| 1571 | 1601 | echo ' |
@@ -1601,13 +1631,14 @@ discard block |
||
| 1601 | 1631 | </fieldset>'; |
| 1602 | 1632 | |
| 1603 | 1633 | // Likely to need FTP? |
| 1604 | - if (empty($context['ftp_connected'])) |
|
| 1605 | - echo ' |
|
| 1634 | + if (empty($context['ftp_connected'])) { |
|
| 1635 | + echo ' |
|
| 1606 | 1636 | <p> |
| 1607 | 1637 | ', $txt['package_file_perms_ftp_details'], ': |
| 1608 | 1638 | </p> |
| 1609 | 1639 | ', template_control_chmod(), ' |
| 1610 | 1640 | <div class="noticebox">', $txt['package_file_perms_ftp_retain'], '</div>'; |
| 1641 | + } |
|
| 1611 | 1642 | |
| 1612 | 1643 | echo ' |
| 1613 | 1644 | <span id="test_ftp_placeholder_full"></span> |
@@ -1616,9 +1647,10 @@ discard block |
||
| 1616 | 1647 | </div>'; |
| 1617 | 1648 | |
| 1618 | 1649 | // Any looks fors we've already done? |
| 1619 | - foreach ($context['look_for'] as $path) |
|
| 1620 | - echo ' |
|
| 1650 | + foreach ($context['look_for'] as $path) { |
|
| 1651 | + echo ' |
|
| 1621 | 1652 | <input type="hidden" name="back_look[]" value="', $path, '">'; |
| 1653 | + } |
|
| 1622 | 1654 | echo ' |
| 1623 | 1655 | </form><br>'; |
| 1624 | 1656 | } |
@@ -1657,9 +1689,10 @@ discard block |
||
| 1657 | 1689 | <td class="smalltext" width="30%">' . str_repeat(' ', $level * 5), ' |
| 1658 | 1690 | ', (!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, "'\\") . '\');">' : ''; |
| 1659 | 1691 | |
| 1660 | - if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) |
|
| 1661 | - echo ' |
|
| 1692 | + if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) { |
|
| 1693 | + echo ' |
|
| 1662 | 1694 | <span class="generic_icons folder"></span>'; |
| 1695 | + } |
|
| 1663 | 1696 | |
| 1664 | 1697 | echo ' |
| 1665 | 1698 | ', $name, ' |
@@ -1685,14 +1718,15 @@ discard block |
||
| 1685 | 1718 | } |
| 1686 | 1719 | |
| 1687 | 1720 | // We have more files to show? |
| 1688 | - if ($has_more) |
|
| 1689 | - echo ' |
|
| 1721 | + if ($has_more) { |
|
| 1722 | + echo ' |
|
| 1690 | 1723 | <tr class="windowbg" id="content_', $js_ident, '_more"> |
| 1691 | 1724 | <td class="smalltext" width="40%">' . str_repeat(' ', $level * 5), ' |
| 1692 | 1725 | « <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> » |
| 1693 | 1726 | </td> |
| 1694 | 1727 | <td colspan="6"></td> |
| 1695 | 1728 | </tr>'; |
| 1729 | + } |
|
| 1696 | 1730 | |
| 1697 | 1731 | if ($drawn_div) |
| 1698 | 1732 | { |
@@ -1700,15 +1734,17 @@ discard block |
||
| 1700 | 1734 | $isFound = false; |
| 1701 | 1735 | foreach ($context['look_for'] as $tree) |
| 1702 | 1736 | { |
| 1703 | - if (substr($tree, 0, strlen($ident)) == $ident) |
|
| 1704 | - $isFound = true; |
|
| 1737 | + if (substr($tree, 0, strlen($ident)) == $ident) { |
|
| 1738 | + $isFound = true; |
|
| 1739 | + } |
|
| 1705 | 1740 | } |
| 1706 | 1741 | |
| 1707 | - if ($level > 1 && !$isFound) |
|
| 1708 | - echo ' |
|
| 1742 | + if ($level > 1 && !$isFound) { |
|
| 1743 | + echo ' |
|
| 1709 | 1744 | <script> |
| 1710 | 1745 | expandFolder(\'', $js_ident, '\', \'\'); |
| 1711 | 1746 | </script>'; |
| 1747 | + } |
|
| 1712 | 1748 | } |
| 1713 | 1749 | } |
| 1714 | 1750 | |
@@ -1728,11 +1764,12 @@ discard block |
||
| 1728 | 1764 | <h3 class="catbg">', $txt['package_file_perms_applying'], '</h3> |
| 1729 | 1765 | </div>'; |
| 1730 | 1766 | |
| 1731 | - if (!empty($context['skip_ftp'])) |
|
| 1732 | - echo ' |
|
| 1767 | + if (!empty($context['skip_ftp'])) { |
|
| 1768 | + echo ' |
|
| 1733 | 1769 | <div class="errorbox"> |
| 1734 | 1770 | ', $txt['package_file_perms_skipping_ftp'], ' |
| 1735 | 1771 | </div>'; |
| 1772 | + } |
|
| 1736 | 1773 | |
| 1737 | 1774 | // How many have we done? |
| 1738 | 1775 | $remaining_items = count($context['method'] == 'individual' ? $context['to_process'] : $context['directory_list']); |
@@ -1770,28 +1807,31 @@ discard block |
||
| 1770 | 1807 | <br>'; |
| 1771 | 1808 | |
| 1772 | 1809 | // Put out the right hidden data. |
| 1773 | - if ($context['method'] == 'individual') |
|
| 1774 | - echo ' |
|
| 1810 | + if ($context['method'] == 'individual') { |
|
| 1811 | + echo ' |
|
| 1775 | 1812 | <input type="hidden" name="custom_value" value="', $context['custom_value'], '"> |
| 1776 | 1813 | <input type="hidden" name="totalItems" value="', $context['total_items'], '"> |
| 1777 | 1814 | <input type="hidden" name="toProcess" value="', base64_encode(json_encode($context['to_process'])), '">'; |
| 1778 | - else |
|
| 1779 | - echo ' |
|
| 1815 | + } else { |
|
| 1816 | + echo ' |
|
| 1780 | 1817 | <input type="hidden" name="predefined" value="', $context['predefined_type'], '"> |
| 1781 | 1818 | <input type="hidden" name="fileOffset" value="', $context['file_offset'], '"> |
| 1782 | 1819 | <input type="hidden" name="totalItems" value="', $context['total_items'], '"> |
| 1783 | 1820 | <input type="hidden" name="dirList" value="', base64_encode(json_encode($context['directory_list'])), '"> |
| 1784 | 1821 | <input type="hidden" name="specialFiles" value="', base64_encode(json_encode($context['special_files'])), '">'; |
| 1822 | + } |
|
| 1785 | 1823 | |
| 1786 | 1824 | // Are we not using FTP for whatever reason. |
| 1787 | - if (!empty($context['skip_ftp'])) |
|
| 1788 | - echo ' |
|
| 1825 | + if (!empty($context['skip_ftp'])) { |
|
| 1826 | + echo ' |
|
| 1789 | 1827 | <input type="hidden" name="skip_ftp" value="1">'; |
| 1828 | + } |
|
| 1790 | 1829 | |
| 1791 | 1830 | // Retain state. |
| 1792 | - foreach ($context['back_look_data'] as $path) |
|
| 1793 | - echo ' |
|
| 1831 | + foreach ($context['back_look_data'] as $path) { |
|
| 1832 | + echo ' |
|
| 1794 | 1833 | <input type="hidden" name="back_look[]" value="', $path, '">'; |
| 1834 | + } |
|
| 1795 | 1835 | |
| 1796 | 1836 | echo ' |
| 1797 | 1837 | <input type="hidden" name="method" value="', $context['method'], '"> |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -583,8 +583,7 @@ discard block |
||
| 583 | 583 | { |
| 584 | 584 | $header = '<?php require("' . ($user_info['is_admin'] ? addslashes(realpath($boarddir . '/SSI.php')) : 'SSI.php') . '"); ?>' . "\n" . $header; |
| 585 | 585 | return $header . template_homepage_sample1_html() . $footer; |
| 586 | - } |
|
| 587 | - else |
|
| 586 | + } else |
|
| 588 | 587 | { |
| 589 | 588 | echo $header; |
| 590 | 589 | template_homepage_sample1_php(); |
@@ -599,9 +598,10 @@ discard block |
||
| 599 | 598 | |
| 600 | 599 | $topics = ssi_recentTopics(8, null, null, 'array'); |
| 601 | 600 | |
| 602 | - foreach ($topics as $topic) |
|
| 603 | - echo ' |
|
| 601 | + foreach ($topics as $topic) { |
|
| 602 | + echo ' |
|
| 604 | 603 | <li><a href="', $topic['href'], '">', $topic['subject'], '</a> ', $txt['by'], ' ', $topic['poster']['link'], '</li>'; |
| 604 | + } |
|
| 605 | 605 | |
| 606 | 606 | unset($topics); |
| 607 | 607 | |
@@ -186,8 +186,9 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | ########## Error-Catching ########## |
| 188 | 188 | # Note: You shouldn't touch these settings. |
| 189 | -if (file_exists(dirname(__FILE__) . '/db_last_error.php')) |
|
| 189 | +if (file_exists(dirname(__FILE__) . '/db_last_error.php')) { |
|
| 190 | 190 | include(dirname(__FILE__) . '/db_last_error.php'); |
| 191 | +} |
|
| 191 | 192 | |
| 192 | 193 | if (!isset($db_last_error)) |
| 193 | 194 | { |
@@ -202,11 +203,14 @@ discard block |
||
| 202 | 203 | } |
| 203 | 204 | |
| 204 | 205 | # Make sure the paths are correct... at least try to fix them. |
| 205 | -if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt')) |
|
| 206 | +if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt')) { |
|
| 206 | 207 | $boarddir = dirname(__FILE__); |
| 207 | -if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources')) |
|
| 208 | +} |
|
| 209 | +if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources')) { |
|
| 208 | 210 | $sourcedir = $boarddir . '/Sources'; |
| 209 | -if (!file_exists($cachedir) && file_exists($boarddir . '/cache')) |
|
| 211 | +} |
|
| 212 | +if (!file_exists($cachedir) && file_exists($boarddir . '/cache')) { |
|
| 210 | 213 | $cachedir = $boarddir . '/cache'; |
| 214 | +} |
|
| 211 | 215 | |
| 212 | 216 | ?> |
| 213 | 217 | \ No newline at end of file |