@@ -41,37 +41,43 @@ discard block |
||
| 41 | 41 | define('TIME_START', microtime(true)); |
| 42 | 42 | |
| 43 | 43 | // Just being safe... |
| 44 | -foreach (array('db_character_set', 'cachedir') as $variable) |
|
| 44 | +foreach (array('db_character_set', 'cachedir') as $variable) { |
|
| 45 | 45 | if (isset($GLOBALS[$variable])) |
| 46 | 46 | unset($GLOBALS[$variable]); |
| 47 | +} |
|
| 47 | 48 | |
| 48 | 49 | // Get the forum's settings for database and file paths. |
| 49 | 50 | require_once(dirname(__FILE__) . '/Settings.php'); |
| 50 | 51 | |
| 51 | 52 | // Make absolutely sure the cache directory is defined. |
| 52 | -if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) |
|
| 53 | +if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) { |
|
| 53 | 54 | $cachedir = $boarddir . '/cache'; |
| 55 | +} |
|
| 54 | 56 | |
| 55 | 57 | // Don't do john didley if the forum's been shut down competely. |
| 56 | -if ($maintenance == 2) |
|
| 58 | +if ($maintenance == 2) { |
|
| 57 | 59 | die($mmessage); |
| 60 | +} |
|
| 58 | 61 | |
| 59 | 62 | // Fix for using the current directory as a path. |
| 60 | -if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') |
|
| 63 | +if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') { |
|
| 61 | 64 | $sourcedir = dirname(__FILE__) . substr($sourcedir, 1); |
| 65 | +} |
|
| 62 | 66 | |
| 63 | 67 | // Have we already turned this off? If so, exist gracefully. |
| 64 | -if (file_exists($cachedir . '/cron.lock')) |
|
| 68 | +if (file_exists($cachedir . '/cron.lock')) { |
|
| 65 | 69 | obExit_cron(); |
| 70 | +} |
|
| 66 | 71 | |
| 67 | 72 | // Before we go any further, if this is not a CLI request, we need to do some checking. |
| 68 | 73 | if (!FROM_CLI) |
| 69 | 74 | { |
| 70 | 75 | // We will clean up $_GET shortly. But we want to this ASAP. |
| 71 | 76 | $ts = isset($_GET['ts']) ? (int) $_GET['ts'] : 0; |
| 72 | - if ($ts <= 0 || $ts % 15 != 0 || time() - $ts < 0 || time() - $ts > 20) |
|
| 73 | - obExit_cron(); |
|
| 74 | -} |
|
| 77 | + if ($ts <= 0 || $ts % 15 != 0 || time() - $ts < 0 || time() - $ts > 20) { |
|
| 78 | + obExit_cron(); |
|
| 79 | + } |
|
| 80 | + } |
|
| 75 | 81 | |
| 76 | 82 | // Load the most important includes. In general, a background should be loading its own dependencies. |
| 77 | 83 | require_once($sourcedir . '/Errors.php'); |
@@ -123,8 +129,9 @@ discard block |
||
| 123 | 129 | global $smcFunc; |
| 124 | 130 | |
| 125 | 131 | // Check we haven't run over our time limit. |
| 126 | - if (microtime(true) - TIME_START > MAX_CRON_TIME) |
|
| 127 | - return false; |
|
| 132 | + if (microtime(true) - TIME_START > MAX_CRON_TIME) { |
|
| 133 | + return false; |
|
| 134 | + } |
|
| 128 | 135 | |
| 129 | 136 | // Try to find a task. Specifically, try to find one that hasn't been claimed previously, or failing that, |
| 130 | 137 | // a task that was claimed but failed for whatever reason and failed long enough ago. We should not care |
@@ -159,14 +166,12 @@ discard block |
||
| 159 | 166 | // Update the time and go back. |
| 160 | 167 | $row['claimed_time'] = time(); |
| 161 | 168 | return $row; |
| 162 | - } |
|
| 163 | - else |
|
| 169 | + } else |
|
| 164 | 170 | { |
| 165 | 171 | // Uh oh, we just missed it. Try to claim another one, and let it fall through if there aren't any. |
| 166 | 172 | return fetch_task(); |
| 167 | 173 | } |
| 168 | - } |
|
| 169 | - else |
|
| 174 | + } else |
|
| 170 | 175 | { |
| 171 | 176 | // No dice. Clean up and go home. |
| 172 | 177 | $smcFunc['db_free_result']($request); |
@@ -187,8 +192,9 @@ discard block |
||
| 187 | 192 | if (!empty($task_details['task_file'])) |
| 188 | 193 | { |
| 189 | 194 | $include = strtr(trim($task_details['task_file']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir)); |
| 190 | - if (file_exists($include)) |
|
| 191 | - require_once($include); |
|
| 195 | + if (file_exists($include)) { |
|
| 196 | + require_once($include); |
|
| 197 | + } |
|
| 192 | 198 | } |
| 193 | 199 | |
| 194 | 200 | if (empty($task_details['task_class'])) |
@@ -204,8 +210,7 @@ discard block |
||
| 204 | 210 | $details = empty($task_details['task_data']) ? array() : $smcFunc['json_decode']($task_details['task_data'], true); |
| 205 | 211 | $bgtask = new $task_details['task_class']($details); |
| 206 | 212 | return $bgtask->execute(); |
| 207 | - } |
|
| 208 | - else |
|
| 213 | + } else |
|
| 209 | 214 | { |
| 210 | 215 | log_error('Invalid background task specified: (class: ' . $task_details['task_class'] . ', ' . (empty($task_details['task_file']) ? ' no file' : ' to load ' . $task_details['task_file']) . ')'); |
| 211 | 216 | return true; // So we clear it from the queue. |
@@ -224,8 +229,9 @@ discard block |
||
| 224 | 229 | $scripturl = $boardurl . '/index.php'; |
| 225 | 230 | |
| 226 | 231 | // These keys shouldn't be set...ever. |
| 227 | - if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) |
|
| 228 | - die('Invalid request variable.'); |
|
| 232 | + if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) { |
|
| 233 | + die('Invalid request variable.'); |
|
| 234 | + } |
|
| 229 | 235 | |
| 230 | 236 | // Save some memory.. (since we don't use these anyway.) |
| 231 | 237 | unset($GLOBALS['HTTP_POST_VARS'], $GLOBALS['HTTP_POST_VARS']); |
@@ -246,26 +252,28 @@ discard block |
||
| 246 | 252 | global $modSettings; |
| 247 | 253 | |
| 248 | 254 | // Ignore errors if we're ignoring them or they are strict notices from PHP 5 |
| 249 | - if (error_reporting() == 0) |
|
| 250 | - return; |
|
| 255 | + if (error_reporting() == 0) { |
|
| 256 | + return; |
|
| 257 | + } |
|
| 251 | 258 | |
| 252 | 259 | $error_type = 'cron'; |
| 253 | 260 | |
| 254 | 261 | log_error($error_level . ': ' . $error_string, $error_type, $file, $line); |
| 255 | 262 | |
| 256 | 263 | // If this is an E_ERROR or E_USER_ERROR.... die. Violently so. |
| 257 | - if ($error_level % 255 == E_ERROR) |
|
| 258 | - die('No direct access...'); |
|
| 259 | -} |
|
| 264 | + if ($error_level % 255 == E_ERROR) { |
|
| 265 | + die('No direct access...'); |
|
| 266 | + } |
|
| 267 | + } |
|
| 260 | 268 | |
| 261 | 269 | /** |
| 262 | 270 | * The exit function |
| 263 | 271 | */ |
| 264 | 272 | function obExit_cron() |
| 265 | 273 | { |
| 266 | - if (FROM_CLI) |
|
| 267 | - die(0); |
|
| 268 | - else |
|
| 274 | + if (FROM_CLI) { |
|
| 275 | + die(0); |
|
| 276 | + } else |
|
| 269 | 277 | { |
| 270 | 278 | header('Content-Type: image/gif'); |
| 271 | 279 | die("\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B"); |
@@ -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(true); |
| 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(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"> |
| 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"> |
| 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 | { |
@@ -1942,12 +2044,14 @@ discard block |
||
| 1942 | 2044 | ) |
| 1943 | 2045 | ); |
| 1944 | 2046 | $posts = array(); |
| 1945 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1946 | - $posts[] = $row['id_first_msg']; |
|
| 2047 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 2048 | + $posts[] = $row['id_first_msg']; |
|
| 2049 | + } |
|
| 1947 | 2050 | $smcFunc['db_free_result']($request); |
| 1948 | 2051 | |
| 1949 | - if (empty($posts)) |
|
| 1950 | - return array(); |
|
| 2052 | + if (empty($posts)) { |
|
| 2053 | + return array(); |
|
| 2054 | + } |
|
| 1951 | 2055 | |
| 1952 | 2056 | // Find the posts. |
| 1953 | 2057 | $request = $smcFunc['db_query']('', ' |
@@ -1977,24 +2081,28 @@ discard block |
||
| 1977 | 2081 | $last_space = strrpos($row['body'], ' '); |
| 1978 | 2082 | $last_open = strrpos($row['body'], '<'); |
| 1979 | 2083 | $last_close = strrpos($row['body'], '>'); |
| 1980 | - 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) |
|
| 1981 | - $cutoff = $last_open; |
|
| 1982 | - elseif (empty($last_close) || $last_close < $last_open) |
|
| 1983 | - $cutoff = $last_space; |
|
| 2084 | + 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) { |
|
| 2085 | + $cutoff = $last_open; |
|
| 2086 | + } elseif (empty($last_close) || $last_close < $last_open) { |
|
| 2087 | + $cutoff = $last_space; |
|
| 2088 | + } |
|
| 1984 | 2089 | |
| 1985 | - if ($cutoff !== false) |
|
| 1986 | - $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); |
|
| 2090 | + if ($cutoff !== false) { |
|
| 2091 | + $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); |
|
| 2092 | + } |
|
| 1987 | 2093 | $row['body'] .= '...'; |
| 1988 | 2094 | } |
| 1989 | 2095 | |
| 1990 | 2096 | $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']); |
| 1991 | 2097 | |
| 1992 | - if (!empty($recycle_board) && $row['id_board'] == $recycle_board) |
|
| 1993 | - $row['icon'] = 'recycled'; |
|
| 2098 | + if (!empty($recycle_board) && $row['id_board'] == $recycle_board) { |
|
| 2099 | + $row['icon'] = 'recycled'; |
|
| 2100 | + } |
|
| 1994 | 2101 | |
| 1995 | 2102 | // Check that this message icon is there... |
| 1996 | - if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) |
|
| 1997 | - $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
| 2103 | + if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) { |
|
| 2104 | + $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
| 2105 | + } |
|
| 1998 | 2106 | |
| 1999 | 2107 | censorText($row['subject']); |
| 2000 | 2108 | censorText($row['body']); |
@@ -2031,16 +2139,18 @@ discard block |
||
| 2031 | 2139 | } |
| 2032 | 2140 | $smcFunc['db_free_result']($request); |
| 2033 | 2141 | |
| 2034 | - if (empty($return)) |
|
| 2035 | - return $return; |
|
| 2142 | + if (empty($return)) { |
|
| 2143 | + return $return; |
|
| 2144 | + } |
|
| 2036 | 2145 | |
| 2037 | 2146 | $return[count($return) - 1]['is_last'] = true; |
| 2038 | 2147 | |
| 2039 | 2148 | // If mods want to do somthing with this list of posts, let them do that now. |
| 2040 | 2149 | call_integration_hook('integrate_ssi_boardNews', array(&$return)); |
| 2041 | 2150 | |
| 2042 | - if ($output_method != 'echo') |
|
| 2043 | - return $return; |
|
| 2151 | + if ($output_method != 'echo') { |
|
| 2152 | + return $return; |
|
| 2153 | + } |
|
| 2044 | 2154 | |
| 2045 | 2155 | foreach ($return as $news) |
| 2046 | 2156 | { |
@@ -2092,9 +2202,10 @@ discard block |
||
| 2092 | 2202 | echo ' |
| 2093 | 2203 | </div>'; |
| 2094 | 2204 | |
| 2095 | - if (!$news['is_last']) |
|
| 2096 | - echo ' |
|
| 2205 | + if (!$news['is_last']) { |
|
| 2206 | + echo ' |
|
| 2097 | 2207 | <hr>'; |
| 2208 | + } |
|
| 2098 | 2209 | } |
| 2099 | 2210 | } |
| 2100 | 2211 | |
@@ -2108,8 +2219,9 @@ discard block |
||
| 2108 | 2219 | { |
| 2109 | 2220 | global $user_info, $scripturl, $modSettings, $txt, $context, $smcFunc; |
| 2110 | 2221 | |
| 2111 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
| 2112 | - return; |
|
| 2222 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
| 2223 | + return; |
|
| 2224 | + } |
|
| 2113 | 2225 | |
| 2114 | 2226 | // Find all events which are happening in the near future that the member can see. |
| 2115 | 2227 | $request = $smcFunc['db_query']('', ' |
@@ -2135,20 +2247,23 @@ discard block |
||
| 2135 | 2247 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2136 | 2248 | { |
| 2137 | 2249 | // 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. |
| 2138 | - if (!empty($duplicates[$row['title'] . $row['id_topic']])) |
|
| 2139 | - continue; |
|
| 2250 | + if (!empty($duplicates[$row['title'] . $row['id_topic']])) { |
|
| 2251 | + continue; |
|
| 2252 | + } |
|
| 2140 | 2253 | |
| 2141 | 2254 | // Censor the title. |
| 2142 | 2255 | censorText($row['title']); |
| 2143 | 2256 | |
| 2144 | - if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) |
|
| 2145 | - $date = strftime('%Y-%m-%d', forum_time(false)); |
|
| 2146 | - else |
|
| 2147 | - $date = $row['start_date']; |
|
| 2257 | + if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) { |
|
| 2258 | + $date = strftime('%Y-%m-%d', forum_time(false)); |
|
| 2259 | + } else { |
|
| 2260 | + $date = $row['start_date']; |
|
| 2261 | + } |
|
| 2148 | 2262 | |
| 2149 | 2263 | // If the topic it is attached to is not approved then don't link it. |
| 2150 | - if (!empty($row['id_first_msg']) && !$row['approved']) |
|
| 2151 | - $row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0; |
|
| 2264 | + if (!empty($row['id_first_msg']) && !$row['approved']) { |
|
| 2265 | + $row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0; |
|
| 2266 | + } |
|
| 2152 | 2267 | |
| 2153 | 2268 | $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; |
| 2154 | 2269 | |
@@ -2174,24 +2289,27 @@ discard block |
||
| 2174 | 2289 | } |
| 2175 | 2290 | $smcFunc['db_free_result']($request); |
| 2176 | 2291 | |
| 2177 | - foreach ($return as $mday => $array) |
|
| 2178 | - $return[$mday][count($array) - 1]['is_last'] = true; |
|
| 2292 | + foreach ($return as $mday => $array) { |
|
| 2293 | + $return[$mday][count($array) - 1]['is_last'] = true; |
|
| 2294 | + } |
|
| 2179 | 2295 | |
| 2180 | 2296 | // If mods want to do somthing with this list of events, let them do that now. |
| 2181 | 2297 | call_integration_hook('integrate_ssi_recentEvents', array(&$return)); |
| 2182 | 2298 | |
| 2183 | - if ($output_method != 'echo' || empty($return)) |
|
| 2184 | - return $return; |
|
| 2299 | + if ($output_method != 'echo' || empty($return)) { |
|
| 2300 | + return $return; |
|
| 2301 | + } |
|
| 2185 | 2302 | |
| 2186 | 2303 | // Well the output method is echo. |
| 2187 | 2304 | echo ' |
| 2188 | 2305 | <span class="event">' . $txt['events'] . '</span> '; |
| 2189 | - foreach ($return as $mday => $array) |
|
| 2190 | - foreach ($array as $event) |
|
| 2306 | + foreach ($return as $mday => $array) { |
|
| 2307 | + foreach ($array as $event) |
|
| 2191 | 2308 | { |
| 2192 | 2309 | if ($event['can_edit']) |
| 2193 | 2310 | echo ' |
| 2194 | 2311 | <a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> '; |
| 2312 | + } |
|
| 2195 | 2313 | |
| 2196 | 2314 | echo ' |
| 2197 | 2315 | ' . $event['link'] . (!$event['is_last'] ? ', ' : ''); |
@@ -2210,8 +2328,9 @@ discard block |
||
| 2210 | 2328 | global $smcFunc; |
| 2211 | 2329 | |
| 2212 | 2330 | // If $id is null, this was most likely called from a query string and should do nothing. |
| 2213 | - if ($id === null) |
|
| 2214 | - return; |
|
| 2331 | + if ($id === null) { |
|
| 2332 | + return; |
|
| 2333 | + } |
|
| 2215 | 2334 | |
| 2216 | 2335 | $request = $smcFunc['db_query']('', ' |
| 2217 | 2336 | SELECT passwd, member_name, is_activated |
@@ -2243,8 +2362,9 @@ discard block |
||
| 2243 | 2362 | $attachments_boards = boardsAllowedTo('view_attachments'); |
| 2244 | 2363 | |
| 2245 | 2364 | // No boards? Adios amigo. |
| 2246 | - if (empty($attachments_boards)) |
|
| 2247 | - return array(); |
|
| 2365 | + if (empty($attachments_boards)) { |
|
| 2366 | + return array(); |
|
| 2367 | + } |
|
| 2248 | 2368 | |
| 2249 | 2369 | // Is it an array? |
| 2250 | 2370 | $attachment_ext = (array) $attachment_ext; |
@@ -2328,8 +2448,9 @@ discard block |
||
| 2328 | 2448 | call_integration_hook('integrate_ssi_recentAttachments', array(&$attachments)); |
| 2329 | 2449 | |
| 2330 | 2450 | // So you just want an array? Here you can have it. |
| 2331 | - if ($output_method == 'array' || empty($attachments)) |
|
| 2332 | - return $attachments; |
|
| 2451 | + if ($output_method == 'array' || empty($attachments)) { |
|
| 2452 | + return $attachments; |
|
| 2453 | + } |
|
| 2333 | 2454 | |
| 2334 | 2455 | // Give them the default. |
| 2335 | 2456 | echo ' |
@@ -2340,14 +2461,15 @@ discard block |
||
| 2340 | 2461 | <th style="text-align: left; padding: 2">', $txt['downloads'], '</th> |
| 2341 | 2462 | <th style="text-align: left; padding: 2">', $txt['filesize'], '</th> |
| 2342 | 2463 | </tr>'; |
| 2343 | - foreach ($attachments as $attach) |
|
| 2344 | - echo ' |
|
| 2464 | + foreach ($attachments as $attach) { |
|
| 2465 | + echo ' |
|
| 2345 | 2466 | <tr> |
| 2346 | 2467 | <td>', $attach['file']['link'], '</td> |
| 2347 | 2468 | <td>', $attach['member']['link'], '</td> |
| 2348 | 2469 | <td style="text-align: center">', $attach['file']['downloads'], '</td> |
| 2349 | 2470 | <td>', $attach['file']['filesize'], '</td> |
| 2350 | 2471 | </tr>'; |
| 2472 | + } |
|
| 2351 | 2473 | echo ' |
| 2352 | 2474 | </table>'; |
| 2353 | 2475 | } |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * @version 2.1 Beta 4 |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -if (!defined('SMF')) |
|
| 18 | +if (!defined('SMF')) { |
|
| 19 | 19 | die('No direct access...'); |
| 20 | +} |
|
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * Log an error, if the error logging is enabled. |
@@ -41,17 +42,19 @@ discard block |
||
| 41 | 42 | // are we in a loop? |
| 42 | 43 | if($error_call > 2) |
| 43 | 44 | { |
| 44 | - if (!isset($db_show_debug) || $db_show_debug === false) |
|
| 45 | - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
|
| 46 | - else |
|
| 47 | - $backtrace = debug_backtrace(); |
|
| 45 | + if (!isset($db_show_debug) || $db_show_debug === false) { |
|
| 46 | + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
|
| 47 | + } else { |
|
| 48 | + $backtrace = debug_backtrace(); |
|
| 49 | + } |
|
| 48 | 50 | var_dump($backtrace); |
| 49 | 51 | die('Error loop.'); |
| 50 | 52 | } |
| 51 | 53 | |
| 52 | 54 | // Check if error logging is actually on. |
| 53 | - if (empty($modSettings['enableErrorLogging'])) |
|
| 54 | - return $error_message; |
|
| 55 | + if (empty($modSettings['enableErrorLogging'])) { |
|
| 56 | + return $error_message; |
|
| 57 | + } |
|
| 55 | 58 | |
| 56 | 59 | // Basically, htmlspecialchars it minus &. (for entities!) |
| 57 | 60 | $error_message = strtr($error_message, array('<' => '<', '>' => '>', '"' => '"')); |
@@ -59,33 +62,39 @@ discard block |
||
| 59 | 62 | |
| 60 | 63 | // Add a file and line to the error message? |
| 61 | 64 | // Don't use the actual txt entries for file and line but instead use %1$s for file and %2$s for line |
| 62 | - if ($file == null) |
|
| 63 | - $file = ''; |
|
| 64 | - else |
|
| 65 | - // Window style slashes don't play well, lets convert them to the unix style. |
|
| 65 | + if ($file == null) { |
|
| 66 | + $file = ''; |
|
| 67 | + } else { |
|
| 68 | + // Window style slashes don't play well, lets convert them to the unix style. |
|
| 66 | 69 | $file = str_replace('\\', '/', $file); |
| 70 | + } |
|
| 67 | 71 | |
| 68 | - if ($line == null) |
|
| 69 | - $line = 0; |
|
| 70 | - else |
|
| 71 | - $line = (int) $line; |
|
| 72 | + if ($line == null) { |
|
| 73 | + $line = 0; |
|
| 74 | + } else { |
|
| 75 | + $line = (int) $line; |
|
| 76 | + } |
|
| 72 | 77 | |
| 73 | 78 | // Just in case there's no id_member or IP set yet. |
| 74 | - if (empty($user_info['id'])) |
|
| 75 | - $user_info['id'] = 0; |
|
| 76 | - if (empty($user_info['ip'])) |
|
| 77 | - $user_info['ip'] = ''; |
|
| 79 | + if (empty($user_info['id'])) { |
|
| 80 | + $user_info['id'] = 0; |
|
| 81 | + } |
|
| 82 | + if (empty($user_info['ip'])) { |
|
| 83 | + $user_info['ip'] = ''; |
|
| 84 | + } |
|
| 78 | 85 | |
| 79 | 86 | // Find the best query string we can... |
| 80 | 87 | $query_string = empty($_SERVER['QUERY_STRING']) ? (empty($_SERVER['REQUEST_URL']) ? '' : str_replace($scripturl, '', $_SERVER['REQUEST_URL'])) : $_SERVER['QUERY_STRING']; |
| 81 | 88 | |
| 82 | 89 | // Don't log the session hash in the url twice, it's a waste. |
| 83 | - if (!empty($smcFunc['htmlspecialchars'])) |
|
| 84 | - $query_string = $smcFunc['htmlspecialchars']((SMF == 'SSI' || SMF == 'BACKGROUND' ? '' : '?') . preg_replace(array('~;sesc=[^&;]+~', '~' . session_name() . '=' . session_id() . '[&;]~'), array(';sesc', ''), $query_string)); |
|
| 90 | + if (!empty($smcFunc['htmlspecialchars'])) { |
|
| 91 | + $query_string = $smcFunc['htmlspecialchars']((SMF == 'SSI' || SMF == 'BACKGROUND' ? '' : '?') . preg_replace(array('~;sesc=[^&;]+~', '~' . session_name() . '=' . session_id() . '[&;]~'), array(';sesc', ''), $query_string)); |
|
| 92 | + } |
|
| 85 | 93 | |
| 86 | 94 | // Just so we know what board error messages are from. |
| 87 | - if (isset($_POST['board']) && !isset($_GET['board'])) |
|
| 88 | - $query_string .= ($query_string == '' ? 'board=' : ';board=') . $_POST['board']; |
|
| 95 | + if (isset($_POST['board']) && !isset($_GET['board'])) { |
|
| 96 | + $query_string .= ($query_string == '' ? 'board=' : ';board=') . $_POST['board']; |
|
| 97 | + } |
|
| 89 | 98 | |
| 90 | 99 | // What types of categories do we have? |
| 91 | 100 | $known_error_types = array( |
@@ -146,12 +155,14 @@ discard block |
||
| 146 | 155 | global $txt; |
| 147 | 156 | |
| 148 | 157 | // Send the appropriate HTTP status header - set this to 0 or false if you don't want to send one at all |
| 149 | - if (!empty($status)) |
|
| 150 | - send_http_status($status); |
|
| 158 | + if (!empty($status)) { |
|
| 159 | + send_http_status($status); |
|
| 160 | + } |
|
| 151 | 161 | |
| 152 | 162 | // We don't have $txt yet, but that's okay... |
| 153 | - if (empty($txt)) |
|
| 154 | - die($error); |
|
| 163 | + if (empty($txt)) { |
|
| 164 | + die($error); |
|
| 165 | + } |
|
| 155 | 166 | |
| 156 | 167 | log_error_online($error, false); |
| 157 | 168 | setup_fatal_error_context($log ? log_error($error, $log) : $error); |
@@ -178,8 +189,9 @@ discard block |
||
| 178 | 189 | static $fatal_error_called = false; |
| 179 | 190 | |
| 180 | 191 | // Send the status header - set this to 0 or false if you don't want to send one at all |
| 181 | - if (!empty($status)) |
|
| 182 | - send_http_status($status); |
|
| 192 | + if (!empty($status)) { |
|
| 193 | + send_http_status($status); |
|
| 194 | + } |
|
| 183 | 195 | |
| 184 | 196 | // Try to load a theme if we don't have one. |
| 185 | 197 | if (empty($context['theme_loaded']) && empty($fatal_error_called)) |
@@ -189,8 +201,9 @@ discard block |
||
| 189 | 201 | } |
| 190 | 202 | |
| 191 | 203 | // If we have no theme stuff we can't have the language file... |
| 192 | - if (empty($context['theme_loaded'])) |
|
| 193 | - die($error); |
|
| 204 | + if (empty($context['theme_loaded'])) { |
|
| 205 | + die($error); |
|
| 206 | + } |
|
| 194 | 207 | |
| 195 | 208 | $reload_lang_file = true; |
| 196 | 209 | // Log the error in the forum's language, but don't waste the time if we aren't logging |
@@ -226,8 +239,9 @@ discard block |
||
| 226 | 239 | global $settings, $modSettings, $db_show_debug; |
| 227 | 240 | |
| 228 | 241 | // Ignore errors if we're ignoring them or they are strict notices from PHP 5 |
| 229 | - if (error_reporting() == 0) |
|
| 230 | - return; |
|
| 242 | + if (error_reporting() == 0) { |
|
| 243 | + return; |
|
| 244 | + } |
|
| 231 | 245 | |
| 232 | 246 | if (strpos($file, 'eval()') !== false && !empty($settings['current_include_filename'])) |
| 233 | 247 | { |
@@ -235,19 +249,22 @@ discard block |
||
| 235 | 249 | $count = count($array); |
| 236 | 250 | for ($i = 0; $i < $count; $i++) |
| 237 | 251 | { |
| 238 | - if ($array[$i]['function'] != 'loadSubTemplate') |
|
| 239 | - continue; |
|
| 252 | + if ($array[$i]['function'] != 'loadSubTemplate') { |
|
| 253 | + continue; |
|
| 254 | + } |
|
| 240 | 255 | |
| 241 | 256 | // This is a bug in PHP, with eval, it seems! |
| 242 | - if (empty($array[$i]['args'])) |
|
| 243 | - $i++; |
|
| 257 | + if (empty($array[$i]['args'])) { |
|
| 258 | + $i++; |
|
| 259 | + } |
|
| 244 | 260 | break; |
| 245 | 261 | } |
| 246 | 262 | |
| 247 | - if (isset($array[$i]) && !empty($array[$i]['args'])) |
|
| 248 | - $file = realpath($settings['current_include_filename']) . ' (' . $array[$i]['args'][0] . ' sub template - eval?)'; |
|
| 249 | - else |
|
| 250 | - $file = realpath($settings['current_include_filename']) . ' (eval?)'; |
|
| 263 | + if (isset($array[$i]) && !empty($array[$i]['args'])) { |
|
| 264 | + $file = realpath($settings['current_include_filename']) . ' (' . $array[$i]['args'][0] . ' sub template - eval?)'; |
|
| 265 | + } else { |
|
| 266 | + $file = realpath($settings['current_include_filename']) . ' (eval?)'; |
|
| 267 | + } |
|
| 251 | 268 | } |
| 252 | 269 | |
| 253 | 270 | if (isset($db_show_debug) && $db_show_debug === true) |
@@ -256,8 +273,9 @@ discard block |
||
| 256 | 273 | if ($error_level % 255 != E_ERROR) |
| 257 | 274 | { |
| 258 | 275 | $temporary = ob_get_contents(); |
| 259 | - if (substr($temporary, -2) == '="') |
|
| 260 | - echo '"'; |
|
| 276 | + if (substr($temporary, -2) == '="') { |
|
| 277 | + echo '"'; |
|
| 278 | + } |
|
| 261 | 279 | } |
| 262 | 280 | |
| 263 | 281 | // Debugging! This should look like a PHP error message. |
@@ -273,23 +291,27 @@ discard block |
||
| 273 | 291 | call_integration_hook('integrate_output_error', array($message, $error_type, $error_level, $file, $line)); |
| 274 | 292 | |
| 275 | 293 | // Dying on these errors only causes MORE problems (blank pages!) |
| 276 | - if ($file == 'Unknown') |
|
| 277 | - return; |
|
| 294 | + if ($file == 'Unknown') { |
|
| 295 | + return; |
|
| 296 | + } |
|
| 278 | 297 | |
| 279 | 298 | // If this is an E_ERROR or E_USER_ERROR.... die. Violently so. |
| 280 | - if ($error_level % 255 == E_ERROR) |
|
| 281 | - obExit(false); |
|
| 282 | - else |
|
| 283 | - return; |
|
| 299 | + if ($error_level % 255 == E_ERROR) { |
|
| 300 | + obExit(false); |
|
| 301 | + } else { |
|
| 302 | + return; |
|
| 303 | + } |
|
| 284 | 304 | |
| 285 | 305 | // If this is an E_ERROR, E_USER_ERROR, E_WARNING, or E_USER_WARNING.... die. Violently so. |
| 286 | - if ($error_level % 255 == E_ERROR || $error_level % 255 == E_WARNING) |
|
| 287 | - fatal_error(allowedTo('admin_forum') ? $message : $error_string, false); |
|
| 306 | + if ($error_level % 255 == E_ERROR || $error_level % 255 == E_WARNING) { |
|
| 307 | + fatal_error(allowedTo('admin_forum') ? $message : $error_string, false); |
|
| 308 | + } |
|
| 288 | 309 | |
| 289 | 310 | // We should NEVER get to this point. Any fatal error MUST quit, or very bad things can happen. |
| 290 | - if ($error_level % 255 == E_ERROR) |
|
| 291 | - die('No direct access...'); |
|
| 292 | -} |
|
| 311 | + if ($error_level % 255 == E_ERROR) { |
|
| 312 | + die('No direct access...'); |
|
| 313 | + } |
|
| 314 | + } |
|
| 293 | 315 | |
| 294 | 316 | /** |
| 295 | 317 | * It is called by {@link fatal_error()} and {@link fatal_lang_error()}. |
@@ -305,24 +327,28 @@ discard block |
||
| 305 | 327 | |
| 306 | 328 | // Attempt to prevent a recursive loop. |
| 307 | 329 | ++$level; |
| 308 | - if ($level > 1) |
|
| 309 | - return false; |
|
| 330 | + if ($level > 1) { |
|
| 331 | + return false; |
|
| 332 | + } |
|
| 310 | 333 | |
| 311 | 334 | // Maybe they came from dlattach or similar? |
| 312 | - if (SMF != 'SSI' && SMF != 'BACKGROUND' && empty($context['theme_loaded'])) |
|
| 313 | - loadTheme(); |
|
| 335 | + if (SMF != 'SSI' && SMF != 'BACKGROUND' && empty($context['theme_loaded'])) { |
|
| 336 | + loadTheme(); |
|
| 337 | + } |
|
| 314 | 338 | |
| 315 | 339 | // Don't bother indexing errors mate... |
| 316 | 340 | $context['robot_no_index'] = true; |
| 317 | 341 | |
| 318 | - if (!isset($context['error_title'])) |
|
| 319 | - $context['error_title'] = $txt['error_occured']; |
|
| 342 | + if (!isset($context['error_title'])) { |
|
| 343 | + $context['error_title'] = $txt['error_occured']; |
|
| 344 | + } |
|
| 320 | 345 | $context['error_message'] = isset($context['error_message']) ? $context['error_message'] : $error_message; |
| 321 | 346 | |
| 322 | 347 | $context['error_code'] = isset($error_code) ? 'id="' . $error_code . '" ' : ''; |
| 323 | 348 | |
| 324 | - if (empty($context['page_title'])) |
|
| 325 | - $context['page_title'] = $context['error_title']; |
|
| 349 | + if (empty($context['page_title'])) { |
|
| 350 | + $context['page_title'] = $context['error_title']; |
|
| 351 | + } |
|
| 326 | 352 | |
| 327 | 353 | loadTemplate('Errors'); |
| 328 | 354 | $context['sub_template'] = 'fatal_error'; |
@@ -330,23 +356,26 @@ discard block |
||
| 330 | 356 | // If this is SSI, what do they want us to do? |
| 331 | 357 | if (SMF == 'SSI') |
| 332 | 358 | { |
| 333 | - if (!empty($ssi_on_error_method) && $ssi_on_error_method !== true && is_callable($ssi_on_error_method)) |
|
| 334 | - $ssi_on_error_method(); |
|
| 335 | - elseif (empty($ssi_on_error_method) || $ssi_on_error_method !== true) |
|
| 336 | - loadSubTemplate('fatal_error'); |
|
| 359 | + if (!empty($ssi_on_error_method) && $ssi_on_error_method !== true && is_callable($ssi_on_error_method)) { |
|
| 360 | + $ssi_on_error_method(); |
|
| 361 | + } elseif (empty($ssi_on_error_method) || $ssi_on_error_method !== true) { |
|
| 362 | + loadSubTemplate('fatal_error'); |
|
| 363 | + } |
|
| 337 | 364 | |
| 338 | 365 | // No layers? |
| 339 | - if (empty($ssi_on_error_method) || $ssi_on_error_method !== true) |
|
| 340 | - exit; |
|
| 366 | + if (empty($ssi_on_error_method) || $ssi_on_error_method !== true) { |
|
| 367 | + exit; |
|
| 368 | + } |
|
| 341 | 369 | } |
| 342 | 370 | // Alternatively from the cron call? |
| 343 | 371 | elseif (SMF == 'BACKGROUND') |
| 344 | 372 | { |
| 345 | 373 | // We can't rely on even having language files available. |
| 346 | - if (defined('FROM_CLI') && FROM_CLI) |
|
| 347 | - echo 'cron error: ', $context['error_message']; |
|
| 348 | - else |
|
| 349 | - echo 'An error occurred. More information may be available in your logs.'; |
|
| 374 | + if (defined('FROM_CLI') && FROM_CLI) { |
|
| 375 | + echo 'cron error: ', $context['error_message']; |
|
| 376 | + } else { |
|
| 377 | + echo 'An error occurred. More information may be available in your logs.'; |
|
| 378 | + } |
|
| 350 | 379 | exit; |
| 351 | 380 | } |
| 352 | 381 | |
@@ -374,8 +403,8 @@ discard block |
||
| 374 | 403 | |
| 375 | 404 | set_fatal_error_headers(); |
| 376 | 405 | |
| 377 | - if (!empty($maintenance)) |
|
| 378 | - echo '<!DOCTYPE html> |
|
| 406 | + if (!empty($maintenance)) { |
|
| 407 | + echo '<!DOCTYPE html> |
|
| 379 | 408 | <html> |
| 380 | 409 | <head> |
| 381 | 410 | <meta name="robots" content="noindex"> |
@@ -386,6 +415,7 @@ discard block |
||
| 386 | 415 | ', $mmessage, ' |
| 387 | 416 | </body> |
| 388 | 417 | </html>'; |
| 418 | + } |
|
| 389 | 419 | |
| 390 | 420 | die(); |
| 391 | 421 | } |
@@ -407,15 +437,17 @@ discard block |
||
| 407 | 437 | // For our purposes, we're gonna want this on if at all possible. |
| 408 | 438 | $modSettings['cache_enable'] = '1'; |
| 409 | 439 | |
| 410 | - if (($temp = cache_get_data('db_last_error', 600)) !== null) |
|
| 411 | - $db_last_error = max($db_last_error, $temp); |
|
| 440 | + if (($temp = cache_get_data('db_last_error', 600)) !== null) { |
|
| 441 | + $db_last_error = max($db_last_error, $temp); |
|
| 442 | + } |
|
| 412 | 443 | |
| 413 | 444 | if ($db_last_error < time() - 3600 * 24 * 3 && empty($maintenance) && !empty($db_error_send)) |
| 414 | 445 | { |
| 415 | 446 | // Avoid writing to the Settings.php file if at all possible; use shared memory instead. |
| 416 | 447 | cache_put_data('db_last_error', time(), 600); |
| 417 | - if (($temp = cache_get_data('db_last_error', 600)) === null) |
|
| 418 | - logLastDatabaseError(); |
|
| 448 | + if (($temp = cache_get_data('db_last_error', 600)) === null) { |
|
| 449 | + logLastDatabaseError(); |
|
| 450 | + } |
|
| 419 | 451 | |
| 420 | 452 | // Language files aren't loaded yet :(. |
| 421 | 453 | $db_error = @$smcFunc['db_error']($db_connection); |
@@ -496,12 +528,14 @@ discard block |
||
| 496 | 528 | global $smcFunc, $user_info, $modSettings; |
| 497 | 529 | |
| 498 | 530 | // Don't bother if Who's Online is disabled. |
| 499 | - if (empty($modSettings['who_enabled'])) |
|
| 500 | - return; |
|
| 531 | + if (empty($modSettings['who_enabled'])) { |
|
| 532 | + return; |
|
| 533 | + } |
|
| 501 | 534 | |
| 502 | 535 | // Maybe they came from SSI or similar where sessions are not recorded? |
| 503 | - if (SMF == 'SSI' || SMF == 'BACKGROUND') |
|
| 504 | - return; |
|
| 536 | + if (SMF == 'SSI' || SMF == 'BACKGROUND') { |
|
| 537 | + return; |
|
| 538 | + } |
|
| 505 | 539 | |
| 506 | 540 | $session_id = !empty($user_info['is_guest']) ? 'ip' . $user_info['ip'] : session_id(); |
| 507 | 541 | |
@@ -527,8 +561,9 @@ discard block |
||
| 527 | 561 | $url = $smcFunc['json_decode']($url, true); |
| 528 | 562 | $url['error'] = $error; |
| 529 | 563 | |
| 530 | - if (!empty($sprintf)) |
|
| 531 | - $url['error_params'] = $sprintf; |
|
| 564 | + if (!empty($sprintf)) { |
|
| 565 | + $url['error_params'] = $sprintf; |
|
| 566 | + } |
|
| 532 | 567 | |
| 533 | 568 | $smcFunc['db_query']('', ' |
| 534 | 569 | UPDATE {db_prefix}log_online |
@@ -559,10 +594,11 @@ discard block |
||
| 559 | 594 | |
| 560 | 595 | $protocol = preg_match('~HTTP/1\.[01]~i', $_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'; |
| 561 | 596 | |
| 562 | - if (!isset($statuses[$code])) |
|
| 563 | - header($protocol . ' 500 Internal Server Error'); |
|
| 564 | - else |
|
| 565 | - header($protocol . ' ' . $code . ' ' . $statuses[$code]); |
|
| 566 | -} |
|
| 597 | + if (!isset($statuses[$code])) { |
|
| 598 | + header($protocol . ' 500 Internal Server Error'); |
|
| 599 | + } else { |
|
| 600 | + header($protocol . ' ' . $code . ' ' . $statuses[$code]); |
|
| 601 | + } |
|
| 602 | + } |
|
| 567 | 603 | |
| 568 | 604 | ?> |
| 569 | 605 | \ No newline at end of file |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | class Attachments |
| 20 | 21 | { |
@@ -70,16 +71,18 @@ discard block |
||
| 70 | 71 | |
| 71 | 72 | $this->_sa = !empty($_REQUEST['sa']) ? $smcFunc['htmlspecialchars']($smcFunc['htmltrim']($_REQUEST['sa'])) : false; |
| 72 | 73 | |
| 73 | - if ($this->_canPostAttachment && $this->_sa && in_array($this->_sa, $this->_subActions)) |
|
| 74 | - $this->{$this->_sa}(); |
|
| 74 | + if ($this->_canPostAttachment && $this->_sa && in_array($this->_sa, $this->_subActions)) { |
|
| 75 | + $this->{$this->_sa}(); |
|
| 76 | + } |
|
| 75 | 77 | |
| 76 | 78 | // Just send a generic message. |
| 77 | - else |
|
| 78 | - $this->setResponse(array( |
|
| 79 | + else { |
|
| 80 | + $this->setResponse(array( |
|
| 79 | 81 | 'text' => $this->_sa == 'add' ? 'attach_error_title' : 'attached_file_deleted_error', |
| 80 | 82 | 'type' => 'error', |
| 81 | 83 | 'data' => false, |
| 82 | 84 | )); |
| 85 | + } |
|
| 83 | 86 | |
| 84 | 87 | // Back to the future, oh, to the browser! |
| 85 | 88 | $this->sendResponse(); |
@@ -95,12 +98,13 @@ discard block |
||
| 95 | 98 | $attachID = !empty($_REQUEST['attach']) && is_numeric($_REQUEST['attach']) ? (int) $_REQUEST['attach'] : 0; |
| 96 | 99 | |
| 97 | 100 | // Need something to work with. |
| 98 | - if (!$attachID || (!empty($_SESSION['already_attached']) && !isset($_SESSION['already_attached'][$attachID]))) |
|
| 99 | - return $this->setResponse(array( |
|
| 101 | + if (!$attachID || (!empty($_SESSION['already_attached']) && !isset($_SESSION['already_attached'][$attachID]))) { |
|
| 102 | + return $this->setResponse(array( |
|
| 100 | 103 | 'text' => 'attached_file_deleted_error', |
| 101 | 104 | 'type' => 'error', |
| 102 | 105 | 'data' => false, |
| 103 | 106 | )); |
| 107 | + } |
|
| 104 | 108 | |
| 105 | 109 | // Lets pass some params and see what happens :P |
| 106 | 110 | $affectedMessage = removeAttachments(array('id_attach' => $attachID), '', true, true); |
@@ -119,19 +123,21 @@ discard block |
||
| 119 | 123 | public function add() |
| 120 | 124 | { |
| 121 | 125 | // You gotta be able to post attachments. |
| 122 | - if (!$this->_canPostAttachment) |
|
| 123 | - return $this->setResponse(array( |
|
| 126 | + if (!$this->_canPostAttachment) { |
|
| 127 | + return $this->setResponse(array( |
|
| 124 | 128 | 'text' => 'attached_file_cannot', |
| 125 | 129 | 'type' => 'error', |
| 126 | 130 | 'data' => false, |
| 127 | 131 | )); |
| 132 | + } |
|
| 128 | 133 | |
| 129 | 134 | // Process them at once! |
| 130 | 135 | $this->processAttachments(); |
| 131 | 136 | |
| 132 | 137 | // The attachments was created and moved the the right folder, time to update the DB. |
| 133 | - if (!empty($_SESSION['temp_attachments'])) |
|
| 134 | - $this->createAtttach(); |
|
| 138 | + if (!empty($_SESSION['temp_attachments'])) { |
|
| 139 | + $this->createAtttach(); |
|
| 140 | + } |
|
| 135 | 141 | |
| 136 | 142 | // Set the response. |
| 137 | 143 | $this->setResponse(); |
@@ -144,8 +150,9 @@ discard block |
||
| 144 | 150 | { |
| 145 | 151 | global $context, $modSettings, $smcFunc, $user_info, $txt; |
| 146 | 152 | |
| 147 | - if (!isset($_FILES['attachment']['name'])) |
|
| 148 | - $_FILES['attachment']['tmp_name'] = array(); |
|
| 153 | + if (!isset($_FILES['attachment']['name'])) { |
|
| 154 | + $_FILES['attachment']['tmp_name'] = array(); |
|
| 155 | + } |
|
| 149 | 156 | |
| 150 | 157 | // If there are attachments, calculate the total size and how many. |
| 151 | 158 | $context['attachments']['total_size'] = 0; |
@@ -155,25 +162,30 @@ discard block |
||
| 155 | 162 | if (isset($_REQUEST['msg'])) |
| 156 | 163 | { |
| 157 | 164 | $context['attachments']['quantity'] = count($context['current_attachments']); |
| 158 | - foreach ($context['current_attachments'] as $attachment) |
|
| 159 | - $context['attachments']['total_size'] += $attachment['size']; |
|
| 165 | + foreach ($context['current_attachments'] as $attachment) { |
|
| 166 | + $context['attachments']['total_size'] += $attachment['size']; |
|
| 167 | + } |
|
| 160 | 168 | } |
| 161 | 169 | |
| 162 | 170 | // A bit of house keeping first. |
| 163 | - if (!empty($_SESSION['temp_attachments']) && count($_SESSION['temp_attachments']) == 1) |
|
| 164 | - unset($_SESSION['temp_attachments']); |
|
| 171 | + if (!empty($_SESSION['temp_attachments']) && count($_SESSION['temp_attachments']) == 1) { |
|
| 172 | + unset($_SESSION['temp_attachments']); |
|
| 173 | + } |
|
| 165 | 174 | |
| 166 | 175 | // Our infamous SESSION var, we are gonna have soo much fun with it! |
| 167 | - if (!isset($_SESSION['temp_attachments'])) |
|
| 168 | - $_SESSION['temp_attachments'] = array(); |
|
| 176 | + if (!isset($_SESSION['temp_attachments'])) { |
|
| 177 | + $_SESSION['temp_attachments'] = array(); |
|
| 178 | + } |
|
| 169 | 179 | |
| 170 | 180 | // Make sure we're uploading to the right place. |
| 171 | - if (!empty($modSettings['automanage_attachments'])) |
|
| 172 | - automanage_attachments_check_directory(); |
|
| 181 | + if (!empty($modSettings['automanage_attachments'])) { |
|
| 182 | + automanage_attachments_check_directory(); |
|
| 183 | + } |
|
| 173 | 184 | |
| 174 | 185 | // Is the attachments folder actually there? |
| 175 | - if (!empty($context['dir_creation_error'])) |
|
| 176 | - $this->_generalErrors[] = $context['dir_creation_error']; |
|
| 186 | + if (!empty($context['dir_creation_error'])) { |
|
| 187 | + $this->_generalErrors[] = $context['dir_creation_error']; |
|
| 188 | + } |
|
| 177 | 189 | |
| 178 | 190 | // The current attach folder ha some issues... |
| 179 | 191 | elseif (!is_dir($this->_attchDir)) |
@@ -198,13 +210,12 @@ discard block |
||
| 198 | 210 | ); |
| 199 | 211 | list ($context['attachments']['quantity'], $context['attachments']['total_size']) = $smcFunc['db_fetch_row']($request); |
| 200 | 212 | $smcFunc['db_free_result']($request); |
| 201 | - } |
|
| 202 | - |
|
| 203 | - else |
|
| 204 | - $context['attachments'] = array( |
|
| 213 | + } else { |
|
| 214 | + $context['attachments'] = array( |
|
| 205 | 215 | 'quantity' => 0, |
| 206 | 216 | 'total_size' => 0, |
| 207 | 217 | ); |
| 218 | + } |
|
| 208 | 219 | |
| 209 | 220 | // Check for other general errors here. |
| 210 | 221 | |
@@ -212,9 +223,10 @@ discard block |
||
| 212 | 223 | if (!empty($this->_generalErrors)) |
| 213 | 224 | { |
| 214 | 225 | // And delete the files 'cos they ain't going nowhere. |
| 215 | - foreach ($_FILES['attachment']['tmp_name'] as $n => $dummy) |
|
| 216 | - if (file_exists($_FILES['attachment']['tmp_name'][$n])) |
|
| 226 | + foreach ($_FILES['attachment']['tmp_name'] as $n => $dummy) { |
|
| 227 | + if (file_exists($_FILES['attachment']['tmp_name'][$n])) |
|
| 217 | 228 | unlink($_FILES['attachment']['tmp_name'][$n]); |
| 229 | + } |
|
| 218 | 230 | |
| 219 | 231 | $_FILES['attachment']['tmp_name'] = array(); |
| 220 | 232 | |
@@ -225,26 +237,29 @@ discard block |
||
| 225 | 237 | // Loop through $_FILES['attachment'] array and move each file to the current attachments folder. |
| 226 | 238 | foreach ($_FILES['attachment']['tmp_name'] as $n => $dummy) |
| 227 | 239 | { |
| 228 | - if ($_FILES['attachment']['name'][$n] == '') |
|
| 229 | - continue; |
|
| 240 | + if ($_FILES['attachment']['name'][$n] == '') { |
|
| 241 | + continue; |
|
| 242 | + } |
|
| 230 | 243 | |
| 231 | 244 | // First, let's first check for PHP upload errors. |
| 232 | 245 | $errors = array(); |
| 233 | 246 | if (!empty($_FILES['attachment']['error'][$n])) |
| 234 | 247 | { |
| 235 | - if ($_FILES['attachment']['error'][$n] == 2) |
|
| 236 | - $errors[] = array('file_too_big', array($modSettings['attachmentSizeLimit'])); |
|
| 237 | - |
|
| 238 | - else |
|
| 239 | - log_error($_FILES['attachment']['name'][$n] . ': ' . $txt['php_upload_error_' . $_FILES['attachment']['error'][$n]]); |
|
| 248 | + if ($_FILES['attachment']['error'][$n] == 2) { |
|
| 249 | + $errors[] = array('file_too_big', array($modSettings['attachmentSizeLimit'])); |
|
| 250 | + } else { |
|
| 251 | + log_error($_FILES['attachment']['name'][$n] . ': ' . $txt['php_upload_error_' . $_FILES['attachment']['error'][$n]]); |
|
| 252 | + } |
|
| 240 | 253 | |
| 241 | 254 | // Log this one, because... |
| 242 | - if ($_FILES['attachment']['error'][$n] == 6) |
|
| 243 | - log_error($_FILES['attachment']['name'][$n] . ': ' . $txt['php_upload_error_6'], 'critical'); |
|
| 255 | + if ($_FILES['attachment']['error'][$n] == 6) { |
|
| 256 | + log_error($_FILES['attachment']['name'][$n] . ': ' . $txt['php_upload_error_6'], 'critical'); |
|
| 257 | + } |
|
| 244 | 258 | |
| 245 | 259 | // Weird, no errors were cached, still fill out a generic one. |
| 246 | - if (empty($errors)) |
|
| 247 | - $errors[] = 'attach_php_error'; |
|
| 260 | + if (empty($errors)) { |
|
| 261 | + $errors[] = 'attach_php_error'; |
|
| 262 | + } |
|
| 248 | 263 | } |
| 249 | 264 | |
| 250 | 265 | // Try to move and rename the file before doing any more checks on it. |
@@ -256,8 +271,9 @@ discard block |
||
| 256 | 271 | { |
| 257 | 272 | // The reported MIME type of the attachment might not be reliable. |
| 258 | 273 | // Fortunately, PHP 5.3+ lets us easily verify the real MIME type. |
| 259 | - if (function_exists('mime_content_type')) |
|
| 260 | - $_FILES['attachment']['type'][$n] = mime_content_type($_FILES['attachment']['tmp_name'][$n]); |
|
| 274 | + if (function_exists('mime_content_type')) { |
|
| 275 | + $_FILES['attachment']['type'][$n] = mime_content_type($_FILES['attachment']['tmp_name'][$n]); |
|
| 276 | + } |
|
| 261 | 277 | |
| 262 | 278 | $_SESSION['temp_attachments'][$attachID] = array( |
| 263 | 279 | 'name' => $smcFunc['htmlspecialchars'](basename($_FILES['attachment']['name'][$n])), |
@@ -269,16 +285,18 @@ discard block |
||
| 269 | 285 | ); |
| 270 | 286 | |
| 271 | 287 | // Move the file to the attachments folder with a temp name for now. |
| 272 | - if (@move_uploaded_file($_FILES['attachment']['tmp_name'][$n], $destName)) |
|
| 273 | - smf_chmod($destName, 0644); |
|
| 288 | + if (@move_uploaded_file($_FILES['attachment']['tmp_name'][$n], $destName)) { |
|
| 289 | + smf_chmod($destName, 0644); |
|
| 290 | + } |
|
| 274 | 291 | |
| 275 | 292 | // This is madness!! |
| 276 | 293 | else |
| 277 | 294 | { |
| 278 | 295 | // File couldn't be moved. |
| 279 | 296 | $_SESSION['temp_attachments'][$attachID]['errors'][] = 'attach_timeout'; |
| 280 | - if (file_exists($_FILES['attachment']['tmp_name'][$n])) |
|
| 281 | - unlink($_FILES['attachment']['tmp_name'][$n]); |
|
| 297 | + if (file_exists($_FILES['attachment']['tmp_name'][$n])) { |
|
| 298 | + unlink($_FILES['attachment']['tmp_name'][$n]); |
|
| 299 | + } |
|
| 282 | 300 | } |
| 283 | 301 | } |
| 284 | 302 | |
@@ -291,13 +309,15 @@ discard block |
||
| 291 | 309 | 'errors' => $errors, |
| 292 | 310 | ); |
| 293 | 311 | |
| 294 | - if (file_exists($_FILES['attachment']['tmp_name'][$n])) |
|
| 295 | - unlink($_FILES['attachment']['tmp_name'][$n]); |
|
| 312 | + if (file_exists($_FILES['attachment']['tmp_name'][$n])) { |
|
| 313 | + unlink($_FILES['attachment']['tmp_name'][$n]); |
|
| 314 | + } |
|
| 296 | 315 | } |
| 297 | 316 | |
| 298 | 317 | // If there's no errors to this point. We still do need to apply some additional checks before we are finished. |
| 299 | - if (empty($_SESSION['temp_attachments'][$attachID]['errors'])) |
|
| 300 | - attachmentChecks($attachID); |
|
| 318 | + if (empty($_SESSION['temp_attachments'][$attachID]['errors'])) { |
|
| 319 | + attachmentChecks($attachID); |
|
| 320 | + } |
|
| 301 | 321 | } |
| 302 | 322 | |
| 303 | 323 | // Mod authors, finally a hook to hang an alternate attachment upload system upon |
@@ -344,14 +364,15 @@ discard block |
||
| 344 | 364 | |
| 345 | 365 | $_SESSION['already_attached'][$attachmentOptions['attachID']] = $attachmentOptions['attachID']; |
| 346 | 366 | |
| 347 | - if (!empty($attachmentOptions['thumb'])) |
|
| 348 | - $_SESSION['already_attached'][$attachmentOptions['thumb']] = $attachmentOptions['thumb']; |
|
| 367 | + if (!empty($attachmentOptions['thumb'])) { |
|
| 368 | + $_SESSION['already_attached'][$attachmentOptions['thumb']] = $attachmentOptions['thumb']; |
|
| 369 | + } |
|
| 349 | 370 | |
| 350 | - if ($this->_msg) |
|
| 351 | - assignAttachments($_SESSION['already_attached'], $this->_msg); |
|
| 371 | + if ($this->_msg) { |
|
| 372 | + assignAttachments($_SESSION['already_attached'], $this->_msg); |
|
| 373 | + } |
|
| 352 | 374 | } |
| 353 | - } |
|
| 354 | - else |
|
| 375 | + } else |
|
| 355 | 376 | { |
| 356 | 377 | // Sort out the errors for display and delete any associated files. |
| 357 | 378 | $log_these = array('attachments_no_create', 'attachments_no_write', 'attach_timeout', 'ran_out_of_space', 'cant_access_upload_path', 'attach_0_byte_file'); |
@@ -363,14 +384,16 @@ discard block |
||
| 363 | 384 | if (!is_array($error)) |
| 364 | 385 | { |
| 365 | 386 | $attachmentOptions['errors'][] = $txt[$error]; |
| 366 | - if (in_array($error, $log_these)) |
|
| 367 | - log_error($attachment['name'] . ': ' . $txt[$error], 'critical'); |
|
| 387 | + if (in_array($error, $log_these)) { |
|
| 388 | + log_error($attachment['name'] . ': ' . $txt[$error], 'critical'); |
|
| 389 | + } |
|
| 390 | + } else { |
|
| 391 | + $attachmentOptions['errors'][] = vsprintf($txt[$error[0]], $error[1]); |
|
| 368 | 392 | } |
| 369 | - else |
|
| 370 | - $attachmentOptions['errors'][] = vsprintf($txt[$error[0]], $error[1]); |
|
| 371 | 393 | } |
| 372 | - if (file_exists($attachment['tmp_name'])) |
|
| 373 | - unlink($attachment['tmp_name']); |
|
| 394 | + if (file_exists($attachment['tmp_name'])) { |
|
| 395 | + unlink($attachment['tmp_name']); |
|
| 396 | + } |
|
| 374 | 397 | } |
| 375 | 398 | |
| 376 | 399 | // You don't need to know. |
@@ -382,8 +405,9 @@ discard block |
||
| 382 | 405 | } |
| 383 | 406 | |
| 384 | 407 | // Temp save this on the db. |
| 385 | - if (!empty($_SESSION['already_attached'])) |
|
| 386 | - $this->_attachSuccess = $_SESSION['already_attached']; |
|
| 408 | + if (!empty($_SESSION['already_attached'])) { |
|
| 409 | + $this->_attachSuccess = $_SESSION['already_attached']; |
|
| 410 | + } |
|
| 387 | 411 | |
| 388 | 412 | unset($_SESSION['temp_attachments']); |
| 389 | 413 | } |
@@ -403,14 +427,16 @@ discard block |
||
| 403 | 427 | if ($this->_sa == 'add') |
| 404 | 428 | { |
| 405 | 429 | // Is there any generic errors? made some sense out of them! |
| 406 | - if ($this->_generalErrors) |
|
| 407 | - foreach ($this->_generalErrors as $k => $v) |
|
| 430 | + if ($this->_generalErrors) { |
|
| 431 | + foreach ($this->_generalErrors as $k => $v) |
|
| 408 | 432 | $this->_generalErrors[$k] = (is_array($v) ? vsprintf($txt[$v[0]], $v[1]) : $txt[$v]); |
| 433 | + } |
|
| 409 | 434 | |
| 410 | 435 | // Gotta urlencode the filename. |
| 411 | - if ($this->_attachResults) |
|
| 412 | - foreach ($this->_attachResults as $k => $v) |
|
| 436 | + if ($this->_attachResults) { |
|
| 437 | + foreach ($this->_attachResults as $k => $v) |
|
| 413 | 438 | $this->_attachResults[$k]['name'] = urlencode($this->_attachResults[$k]['name']); |
| 439 | + } |
|
| 414 | 440 | |
| 415 | 441 | $this->_response = array( |
| 416 | 442 | 'files' => $this->_attachResults ? $this->_attachResults : false, |
@@ -419,9 +445,10 @@ discard block |
||
| 419 | 445 | } |
| 420 | 446 | |
| 421 | 447 | // Rest of us mere mortals gets no special treatment... |
| 422 | - elseif (!empty($data)) |
|
| 423 | - if (!empty($data['text']) && !empty($txt[$data['text']])) |
|
| 448 | + elseif (!empty($data)) { |
|
| 449 | + if (!empty($data['text']) && !empty($txt[$data['text']])) |
|
| 424 | 450 | $this->_response['text'] = $txt[$data['text']]; |
| 451 | + } |
|
| 425 | 452 | } |
| 426 | 453 | |
| 427 | 454 | protected function sendResponse() |
@@ -430,11 +457,11 @@ discard block |
||
| 430 | 457 | |
| 431 | 458 | ob_end_clean(); |
| 432 | 459 | |
| 433 | - if (!empty($modSettings['CompressedOutput'])) |
|
| 434 | - @ob_start('ob_gzhandler'); |
|
| 435 | - |
|
| 436 | - else |
|
| 437 | - ob_start(); |
|
| 460 | + if (!empty($modSettings['CompressedOutput'])) { |
|
| 461 | + @ob_start('ob_gzhandler'); |
|
| 462 | + } else { |
|
| 463 | + ob_start(); |
|
| 464 | + } |
|
| 438 | 465 | |
| 439 | 466 | // Set the header. |
| 440 | 467 | header('Content-Type: application/json; charset='. $context['character_set'] .''); |
@@ -18,18 +18,20 @@ discard block |
||
| 18 | 18 | global $context, $settings, $options, $txt, $scripturl, $modSettings; |
| 19 | 19 | |
| 20 | 20 | // Let them know, if their report was a success! |
| 21 | - if ($context['report_sent']) |
|
| 22 | - echo ' |
|
| 21 | + if ($context['report_sent']) { |
|
| 22 | + echo ' |
|
| 23 | 23 | <div class="infobox"> |
| 24 | 24 | ', $txt['report_sent'], ' |
| 25 | 25 | </div>'; |
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | // Let them know why their message became unapproved. |
| 28 | - if ($context['becomesUnapproved']) |
|
| 29 | - echo ' |
|
| 29 | + if ($context['becomesUnapproved']) { |
|
| 30 | + echo ' |
|
| 30 | 31 | <div class="noticebox"> |
| 31 | 32 | ', $txt['post_becomesUnapproved'], ' |
| 32 | 33 | </div>'; |
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | // Show new topic info here? |
| 35 | 37 | echo ' |
@@ -49,11 +51,13 @@ discard block |
||
| 49 | 51 | <p>'; |
| 50 | 52 | |
| 51 | 53 | // Show just numbers...? |
| 52 | - if ($settings['display_who_viewing'] == 1) |
|
| 53 | - echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
| 54 | + if ($settings['display_who_viewing'] == 1) { |
|
| 55 | + echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
| 56 | + } |
|
| 54 | 57 | // Or show the actual people viewing the topic? |
| 55 | - else |
|
| 56 | - echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
| 58 | + else { |
|
| 59 | + echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
| 60 | + } |
|
| 57 | 61 | |
| 58 | 62 | // Now show how many guests are here too. |
| 59 | 63 | echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], ' |
@@ -91,10 +95,11 @@ discard block |
||
| 91 | 95 | <dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt> |
| 92 | 96 | <dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">'; |
| 93 | 97 | |
| 94 | - if ($context['allow_results_view']) |
|
| 95 | - echo ' |
|
| 98 | + if ($context['allow_results_view']) { |
|
| 99 | + echo ' |
|
| 96 | 100 | ', $option['bar_ndt'], ' |
| 97 | 101 | <span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>'; |
| 102 | + } |
|
| 98 | 103 | |
| 99 | 104 | echo ' |
| 100 | 105 | </dd>'; |
@@ -103,9 +108,10 @@ discard block |
||
| 103 | 108 | echo ' |
| 104 | 109 | </dl>'; |
| 105 | 110 | |
| 106 | - if ($context['allow_results_view']) |
|
| 107 | - echo ' |
|
| 111 | + if ($context['allow_results_view']) { |
|
| 112 | + echo ' |
|
| 108 | 113 | <p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>'; |
| 114 | + } |
|
| 109 | 115 | } |
| 110 | 116 | // They are allowed to vote! Go to it! |
| 111 | 117 | else |
@@ -114,17 +120,19 @@ discard block |
||
| 114 | 120 | <form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">'; |
| 115 | 121 | |
| 116 | 122 | // Show a warning if they are allowed more than one option. |
| 117 | - if ($context['poll']['allowed_warning']) |
|
| 118 | - echo ' |
|
| 123 | + if ($context['poll']['allowed_warning']) { |
|
| 124 | + echo ' |
|
| 119 | 125 | <p class="smallpadding">', $context['poll']['allowed_warning'], '</p>'; |
| 126 | + } |
|
| 120 | 127 | |
| 121 | 128 | echo ' |
| 122 | 129 | <ul class="options">'; |
| 123 | 130 | |
| 124 | 131 | // Show each option with its button - a radio likely. |
| 125 | - foreach ($context['poll']['options'] as $option) |
|
| 126 | - echo ' |
|
| 132 | + foreach ($context['poll']['options'] as $option) { |
|
| 133 | + echo ' |
|
| 127 | 134 | <li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>'; |
| 135 | + } |
|
| 128 | 136 | |
| 129 | 137 | echo ' |
| 130 | 138 | </ul> |
@@ -136,9 +144,10 @@ discard block |
||
| 136 | 144 | } |
| 137 | 145 | |
| 138 | 146 | // Is the clock ticking? |
| 139 | - if (!empty($context['poll']['expire_time'])) |
|
| 140 | - echo ' |
|
| 147 | + if (!empty($context['poll']['expire_time'])) { |
|
| 148 | + echo ' |
|
| 141 | 149 | <p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>'; |
| 150 | + } |
|
| 142 | 151 | |
| 143 | 152 | echo ' |
| 144 | 153 | </div><!-- #poll_options --> |
@@ -168,11 +177,13 @@ discard block |
||
| 168 | 177 | <li> |
| 169 | 178 | <strong class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></strong>'; |
| 170 | 179 | |
| 171 | - if ($event['can_edit']) |
|
| 172 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
| 180 | + if ($event['can_edit']) { |
|
| 181 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
| 182 | + } |
|
| 173 | 183 | |
| 174 | - if ($event['can_export']) |
|
| 175 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
| 184 | + if ($event['can_export']) { |
|
| 185 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
| 186 | + } |
|
| 176 | 187 | |
| 177 | 188 | echo ' |
| 178 | 189 | <br>'; |
@@ -180,14 +191,14 @@ discard block |
||
| 180 | 191 | if (!empty($event['allday'])) |
| 181 | 192 | { |
| 182 | 193 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' – <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : ''; |
| 183 | - } |
|
| 184 | - else |
|
| 194 | + } else |
|
| 185 | 195 | { |
| 186 | 196 | // Display event info relative to user's local timezone |
| 187 | 197 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
| 188 | 198 | |
| 189 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
| 190 | - echo trim($event['end_date_local']) . ', '; |
|
| 199 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
| 200 | + echo trim($event['end_date_local']) . ', '; |
|
| 201 | + } |
|
| 191 | 202 | |
| 192 | 203 | echo trim($event['end_time_local']); |
| 193 | 204 | |
@@ -196,24 +207,28 @@ discard block |
||
| 196 | 207 | { |
| 197 | 208 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
| 198 | 209 | |
| 199 | - if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) |
|
| 200 | - echo trim($event['start_date_orig']), ', '; |
|
| 210 | + if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) { |
|
| 211 | + echo trim($event['start_date_orig']), ', '; |
|
| 212 | + } |
|
| 201 | 213 | |
| 202 | 214 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
| 203 | 215 | |
| 204 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
| 205 | - echo trim($event['end_date_orig']) . ', '; |
|
| 216 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
| 217 | + echo trim($event['end_date_orig']) . ', '; |
|
| 218 | + } |
|
| 206 | 219 | |
| 207 | 220 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
| 208 | 221 | } |
| 209 | 222 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
| 210 | - else |
|
| 211 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
| 223 | + else { |
|
| 224 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
| 225 | + } |
|
| 212 | 226 | } |
| 213 | 227 | |
| 214 | - if (!empty($event['location'])) |
|
| 215 | - echo ' |
|
| 228 | + if (!empty($event['location'])) { |
|
| 229 | + echo ' |
|
| 216 | 230 | <br>', $event['location']; |
| 231 | + } |
|
| 217 | 232 | |
| 218 | 233 | echo ' |
| 219 | 234 | </li>'; |
@@ -250,8 +265,9 @@ discard block |
||
| 250 | 265 | $context['removableMessageIDs'] = array(); |
| 251 | 266 | |
| 252 | 267 | // Get all the messages... |
| 253 | - while ($message = $context['get_message']()) |
|
| 254 | - template_single_post($message); |
|
| 268 | + while ($message = $context['get_message']()) { |
|
| 269 | + template_single_post($message); |
|
| 270 | + } |
|
| 255 | 271 | |
| 256 | 272 | echo ' |
| 257 | 273 | </form> |
@@ -289,8 +305,9 @@ discard block |
||
| 289 | 305 | <div id="display_jump_to"></div>'; |
| 290 | 306 | |
| 291 | 307 | // Show quickreply |
| 292 | - if ($context['can_reply']) |
|
| 293 | - template_quickreply(); |
|
| 308 | + if ($context['can_reply']) { |
|
| 309 | + template_quickreply(); |
|
| 310 | + } |
|
| 294 | 311 | |
| 295 | 312 | // User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device. |
| 296 | 313 | echo ' |
@@ -305,8 +322,8 @@ discard block |
||
| 305 | 322 | </div>'; |
| 306 | 323 | |
| 307 | 324 | // Show the moderation button & pop only if user can moderate |
| 308 | - if ($context['can_moderate_forum'] || $context['user']['is_mod']) |
|
| 309 | - echo ' |
|
| 325 | + if ($context['can_moderate_forum'] || $context['user']['is_mod']) { |
|
| 326 | + echo ' |
|
| 310 | 327 | <div id="mobile_moderation" class="popup_container"> |
| 311 | 328 | <div class="popup_window description"> |
| 312 | 329 | <div class="popup_heading"> |
@@ -318,6 +335,7 @@ discard block |
||
| 318 | 335 | </div> |
| 319 | 336 | </div> |
| 320 | 337 | </div>'; |
| 338 | + } |
|
| 321 | 339 | |
| 322 | 340 | echo ' |
| 323 | 341 | <script>'; |
@@ -441,9 +459,10 @@ discard block |
||
| 441 | 459 | }); |
| 442 | 460 | }'; |
| 443 | 461 | |
| 444 | - if (!empty($context['ignoredMsgs'])) |
|
| 445 | - echo ' |
|
| 462 | + if (!empty($context['ignoredMsgs'])) { |
|
| 463 | + echo ' |
|
| 446 | 464 | ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');'; |
| 465 | + } |
|
| 447 | 466 | |
| 448 | 467 | echo ' |
| 449 | 468 | </script>'; |
@@ -460,8 +479,9 @@ discard block |
||
| 460 | 479 | |
| 461 | 480 | $ignoring = false; |
| 462 | 481 | |
| 463 | - if ($message['can_remove']) |
|
| 464 | - $context['removableMessageIDs'][] = $message['id']; |
|
| 482 | + if ($message['can_remove']) { |
|
| 483 | + $context['removableMessageIDs'][] = $message['id']; |
|
| 484 | + } |
|
| 465 | 485 | |
| 466 | 486 | // Are we ignoring this message? |
| 467 | 487 | if (!empty($message['is_ignored'])) |
@@ -488,9 +508,10 @@ discard block |
||
| 488 | 508 | <div class="custom_fields_above_member"> |
| 489 | 509 | <ul class="nolist">'; |
| 490 | 510 | |
| 491 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
| 492 | - echo ' |
|
| 511 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
| 512 | + echo ' |
|
| 493 | 513 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 514 | + } |
|
| 494 | 515 | |
| 495 | 516 | echo ' |
| 496 | 517 | </ul> |
@@ -501,25 +522,28 @@ discard block |
||
| 501 | 522 | <h4>'; |
| 502 | 523 | |
| 503 | 524 | // Show online and offline buttons? |
| 504 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
| 505 | - echo ' |
|
| 525 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
| 526 | + echo ' |
|
| 506 | 527 | ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : ''; |
| 528 | + } |
|
| 507 | 529 | |
| 508 | 530 | // Custom fields BEFORE the username? |
| 509 | - if (!empty($message['custom_fields']['before_member'])) |
|
| 510 | - foreach ($message['custom_fields']['before_member'] as $custom) |
|
| 531 | + if (!empty($message['custom_fields']['before_member'])) { |
|
| 532 | + foreach ($message['custom_fields']['before_member'] as $custom) |
|
| 511 | 533 | echo ' |
| 512 | 534 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
| 535 | + } |
|
| 513 | 536 | |
| 514 | 537 | // Show a link to the member's profile. |
| 515 | 538 | echo ' |
| 516 | 539 | ', $message['member']['link']; |
| 517 | 540 | |
| 518 | 541 | // Custom fields AFTER the username? |
| 519 | - if (!empty($message['custom_fields']['after_member'])) |
|
| 520 | - foreach ($message['custom_fields']['after_member'] as $custom) |
|
| 542 | + if (!empty($message['custom_fields']['after_member'])) { |
|
| 543 | + foreach ($message['custom_fields']['after_member'] as $custom) |
|
| 521 | 544 | echo ' |
| 522 | 545 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
| 546 | + } |
|
| 523 | 547 | |
| 524 | 548 | // Begin display of user info |
| 525 | 549 | echo ' |
@@ -527,51 +551,59 @@ discard block |
||
| 527 | 551 | <ul class="user_info">'; |
| 528 | 552 | |
| 529 | 553 | // Show the user's avatar. |
| 530 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
| 531 | - echo ' |
|
| 554 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
| 555 | + echo ' |
|
| 532 | 556 | <li class="avatar"> |
| 533 | 557 | <a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a> |
| 534 | 558 | </li>'; |
| 559 | + } |
|
| 535 | 560 | |
| 536 | 561 | // Are there any custom fields below the avatar? |
| 537 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
| 538 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 562 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
| 563 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 539 | 564 | echo ' |
| 540 | 565 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 566 | + } |
|
| 541 | 567 | |
| 542 | 568 | // Show the post group icons, but not for guests. |
| 543 | - if (!$message['member']['is_guest']) |
|
| 544 | - echo ' |
|
| 569 | + if (!$message['member']['is_guest']) { |
|
| 570 | + echo ' |
|
| 545 | 571 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
| 572 | + } |
|
| 546 | 573 | |
| 547 | 574 | // Show the member's primary group (like 'Administrator') if they have one. |
| 548 | - if (!empty($message['member']['group'])) |
|
| 549 | - echo ' |
|
| 575 | + if (!empty($message['member']['group'])) { |
|
| 576 | + echo ' |
|
| 550 | 577 | <li class="membergroup">', $message['member']['group'], '</li>'; |
| 578 | + } |
|
| 551 | 579 | |
| 552 | 580 | // Show the member's custom title, if they have one. |
| 553 | - if (!empty($message['member']['title'])) |
|
| 554 | - echo ' |
|
| 581 | + if (!empty($message['member']['title'])) { |
|
| 582 | + echo ' |
|
| 555 | 583 | <li class="title">', $message['member']['title'], '</li>'; |
| 584 | + } |
|
| 556 | 585 | |
| 557 | 586 | // Don't show these things for guests. |
| 558 | 587 | if (!$message['member']['is_guest']) |
| 559 | 588 | { |
| 560 | 589 | |
| 561 | 590 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
| 562 | - if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) |
|
| 563 | - echo ' |
|
| 591 | + if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) { |
|
| 592 | + echo ' |
|
| 564 | 593 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
| 594 | + } |
|
| 565 | 595 | |
| 566 | 596 | // Show how many posts they have made. |
| 567 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 568 | - echo ' |
|
| 597 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 598 | + echo ' |
|
| 569 | 599 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
| 600 | + } |
|
| 570 | 601 | |
| 571 | 602 | // Show their personal text? |
| 572 | - if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) |
|
| 573 | - echo ' |
|
| 603 | + if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) { |
|
| 604 | + echo ' |
|
| 574 | 605 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
| 606 | + } |
|
| 575 | 607 | |
| 576 | 608 | // Any custom fields to show as icons? |
| 577 | 609 | if (!empty($message['custom_fields']['icons'])) |
@@ -580,9 +612,10 @@ discard block |
||
| 580 | 612 | <li class="im_icons"> |
| 581 | 613 | <ol>'; |
| 582 | 614 | |
| 583 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
| 584 | - echo ' |
|
| 615 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
| 616 | + echo ' |
|
| 585 | 617 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 618 | + } |
|
| 586 | 619 | |
| 587 | 620 | echo ' |
| 588 | 621 | </ol> |
@@ -597,19 +630,22 @@ discard block |
||
| 597 | 630 | <ol class="profile_icons">'; |
| 598 | 631 | |
| 599 | 632 | // Don't show an icon if they haven't specified a website. |
| 600 | - if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) |
|
| 601 | - echo ' |
|
| 633 | + if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) { |
|
| 634 | + echo ' |
|
| 602 | 635 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 636 | + } |
|
| 603 | 637 | |
| 604 | 638 | // Since we know this person isn't a guest, you *can* message them. |
| 605 | - if ($context['can_send_pm']) |
|
| 606 | - echo ' |
|
| 639 | + if ($context['can_send_pm']) { |
|
| 640 | + echo ' |
|
| 607 | 641 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
| 642 | + } |
|
| 608 | 643 | |
| 609 | 644 | // Show the email if necessary |
| 610 | - if (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 611 | - echo ' |
|
| 645 | + if (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 646 | + echo ' |
|
| 612 | 647 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
| 648 | + } |
|
| 613 | 649 | |
| 614 | 650 | echo ' |
| 615 | 651 | </ol> |
@@ -617,58 +653,66 @@ discard block |
||
| 617 | 653 | } |
| 618 | 654 | |
| 619 | 655 | // Any custom fields for standard placement? |
| 620 | - if (!empty($message['custom_fields']['standard'])) |
|
| 621 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
| 656 | + if (!empty($message['custom_fields']['standard'])) { |
|
| 657 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
| 622 | 658 | echo ' |
| 623 | 659 | <li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>'; |
| 660 | + } |
|
| 624 | 661 | |
| 625 | 662 | } |
| 626 | 663 | // Otherwise, show the guest's email. |
| 627 | - elseif (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 628 | - echo ' |
|
| 664 | + elseif (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 665 | + echo ' |
|
| 629 | 666 | <li class="email"> |
| 630 | 667 | <a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a> |
| 631 | 668 | </li>'; |
| 669 | + } |
|
| 632 | 670 | |
| 633 | 671 | // Show the IP to this user for this post - because you can moderate? |
| 634 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
| 635 | - echo ' |
|
| 672 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
| 673 | + echo ' |
|
| 636 | 674 | <li class="poster_ip"> |
| 637 | 675 | <a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a> |
| 638 | 676 | </li>'; |
| 677 | + } |
|
| 639 | 678 | |
| 640 | 679 | // Or, should we show it because this is you? |
| 641 | - elseif ($message['can_see_ip']) |
|
| 642 | - echo ' |
|
| 680 | + elseif ($message['can_see_ip']) { |
|
| 681 | + echo ' |
|
| 643 | 682 | <li class="poster_ip"> |
| 644 | 683 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a> |
| 645 | 684 | </li>'; |
| 685 | + } |
|
| 646 | 686 | |
| 647 | 687 | // Okay, are you at least logged in? Then we can show something about why IPs are logged... |
| 648 | - elseif (!$context['user']['is_guest']) |
|
| 649 | - echo ' |
|
| 688 | + elseif (!$context['user']['is_guest']) { |
|
| 689 | + echo ' |
|
| 650 | 690 | <li class="poster_ip"> |
| 651 | 691 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a> |
| 652 | 692 | </li>'; |
| 693 | + } |
|
| 653 | 694 | |
| 654 | 695 | // Otherwise, you see NOTHING! |
| 655 | - else |
|
| 656 | - echo ' |
|
| 696 | + else { |
|
| 697 | + echo ' |
|
| 657 | 698 | <li class="poster_ip">', $txt['logged'], '</li>'; |
| 699 | + } |
|
| 658 | 700 | |
| 659 | 701 | // Are we showing the warning status? |
| 660 | 702 | // Don't show these things for guests. |
| 661 | - if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) |
|
| 662 | - echo ' |
|
| 703 | + if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) { |
|
| 704 | + echo ' |
|
| 663 | 705 | <li class="warning"> |
| 664 | 706 | ', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span> |
| 665 | 707 | </li>'; |
| 708 | + } |
|
| 666 | 709 | |
| 667 | 710 | // Are there any custom fields to show at the bottom of the poster info? |
| 668 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
| 669 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 711 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
| 712 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 670 | 713 | echo ' |
| 671 | 714 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 715 | + } |
|
| 672 | 716 | |
| 673 | 717 | // Poster info ends. |
| 674 | 718 | echo ' |
@@ -698,9 +742,10 @@ discard block |
||
| 698 | 742 | echo ' |
| 699 | 743 | <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">'; |
| 700 | 744 | |
| 701 | - if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
|
| 702 | - echo |
|
| 745 | + if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) { |
|
| 746 | + echo |
|
| 703 | 747 | $message['modified']['last_edit_text']; |
| 748 | + } |
|
| 704 | 749 | |
| 705 | 750 | echo ' |
| 706 | 751 | </span> |
@@ -709,22 +754,24 @@ discard block |
||
| 709 | 754 | </div><!-- .keyinfo -->'; |
| 710 | 755 | |
| 711 | 756 | // Ignoring this user? Hide the post. |
| 712 | - if ($ignoring) |
|
| 713 | - echo ' |
|
| 757 | + if ($ignoring) { |
|
| 758 | + echo ' |
|
| 714 | 759 | <div id="msg_', $message['id'], '_ignored_prompt"> |
| 715 | 760 | ', $txt['ignoring_user'], ' |
| 716 | 761 | <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a> |
| 717 | 762 | </div>'; |
| 763 | + } |
|
| 718 | 764 | |
| 719 | 765 | // Show the post itself, finally! |
| 720 | 766 | echo ' |
| 721 | 767 | <div class="post">'; |
| 722 | 768 | |
| 723 | - if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) |
|
| 724 | - echo ' |
|
| 769 | + if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) { |
|
| 770 | + echo ' |
|
| 725 | 771 | <div class="approve_post"> |
| 726 | 772 | ', $txt['post_awaiting_approval'], ' |
| 727 | 773 | </div>'; |
| 774 | + } |
|
| 728 | 775 | echo ' |
| 729 | 776 | <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '> |
| 730 | 777 | ', $message['body'], ' |
@@ -743,9 +790,9 @@ discard block |
||
| 743 | 790 | foreach ($message['attachment'] as $attachment) |
| 744 | 791 | { |
| 745 | 792 | // Do we want this attachment to not be showed here? |
| 746 | - if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) |
|
| 747 | - continue; |
|
| 748 | - elseif (!$div_output) |
|
| 793 | + if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) { |
|
| 794 | + continue; |
|
| 795 | + } elseif (!$div_output) |
|
| 749 | 796 | { |
| 750 | 797 | $div_output = true; |
| 751 | 798 | |
@@ -762,9 +809,10 @@ discard block |
||
| 762 | 809 | <legend> |
| 763 | 810 | ', $txt['attach_awaiting_approve']; |
| 764 | 811 | |
| 765 | - if ($context['can_approve']) |
|
| 766 | - echo ' |
|
| 812 | + if ($context['can_approve']) { |
|
| 813 | + echo ' |
|
| 767 | 814 | [<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]'; |
| 815 | + } |
|
| 768 | 816 | |
| 769 | 817 | echo ' |
| 770 | 818 | </legend>'; |
@@ -778,12 +826,13 @@ discard block |
||
| 778 | 826 | echo ' |
| 779 | 827 | <div class="attachments_top">'; |
| 780 | 828 | |
| 781 | - if ($attachment['thumbnail']['has_thumb']) |
|
| 782 | - echo ' |
|
| 829 | + if ($attachment['thumbnail']['has_thumb']) { |
|
| 830 | + echo ' |
|
| 783 | 831 | <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>'; |
| 784 | - else |
|
| 785 | - echo ' |
|
| 832 | + } else { |
|
| 833 | + echo ' |
|
| 786 | 834 | <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">'; |
| 835 | + } |
|
| 787 | 836 | |
| 788 | 837 | echo ' |
| 789 | 838 | </div><!-- .attachments_top -->'; |
@@ -793,9 +842,10 @@ discard block |
||
| 793 | 842 | <div class="attachments_bot"> |
| 794 | 843 | <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*"> ' . $attachment['name'] . '</a> '; |
| 795 | 844 | |
| 796 | - if (!$attachment['is_approved'] && $context['can_approve']) |
|
| 797 | - echo ' |
|
| 845 | + if (!$attachment['is_approved'] && $context['can_approve']) { |
|
| 846 | + echo ' |
|
| 798 | 847 | [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>] [<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] '; |
| 848 | + } |
|
| 799 | 849 | echo ' |
| 800 | 850 | <br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), ' |
| 801 | 851 | </div><!-- .attachments_bot -->'; |
@@ -804,35 +854,40 @@ discard block |
||
| 804 | 854 | </div><!-- .attached -->'; |
| 805 | 855 | |
| 806 | 856 | // Next attachment line ? |
| 807 | - if (++$i % $attachments_per_line === 0) |
|
| 808 | - echo ' |
|
| 857 | + if (++$i % $attachments_per_line === 0) { |
|
| 858 | + echo ' |
|
| 809 | 859 | <br>'; |
| 860 | + } |
|
| 810 | 861 | } |
| 811 | 862 | |
| 812 | 863 | // If we had unapproved attachments clean up. |
| 813 | - if ($last_approved_state == 0) |
|
| 814 | - echo ' |
|
| 864 | + if ($last_approved_state == 0) { |
|
| 865 | + echo ' |
|
| 815 | 866 | </fieldset>'; |
| 867 | + } |
|
| 816 | 868 | |
| 817 | 869 | // Only do this if we output a div above - otherwise it'll break things |
| 818 | - if ($div_output) |
|
| 819 | - echo ' |
|
| 870 | + if ($div_output) { |
|
| 871 | + echo ' |
|
| 820 | 872 | </div><!-- #msg_[id]_footer -->'; |
| 873 | + } |
|
| 821 | 874 | } |
| 822 | 875 | |
| 823 | 876 | // And stuff below the attachments. |
| 824 | - if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
| 825 | - echo ' |
|
| 877 | + if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
| 878 | + echo ' |
|
| 826 | 879 | <div class="under_message">'; |
| 880 | + } |
|
| 827 | 881 | |
| 828 | 882 | // Maybe they want to report this post to the moderator(s)? |
| 829 | - if ($context['can_report_moderator']) |
|
| 830 | - echo ' |
|
| 883 | + if ($context['can_report_moderator']) { |
|
| 884 | + echo ' |
|
| 831 | 885 | <ul class="floatright smalltext"> |
| 832 | 886 | <li class="report_link"> |
| 833 | 887 | <a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a> |
| 834 | 888 | </li> |
| 835 | 889 | </ul>'; |
| 890 | + } |
|
| 836 | 891 | |
| 837 | 892 | // What about likes? |
| 838 | 893 | if (!empty($modSettings['enable_likes'])) |
@@ -879,83 +934,95 @@ discard block |
||
| 879 | 934 | <ul class="quickbuttons">'; |
| 880 | 935 | |
| 881 | 936 | // Can they quote? if so they can select and quote as well! |
| 882 | - if ($context['can_quote']) |
|
| 883 | - echo ' |
|
| 937 | + if ($context['can_quote']) { |
|
| 938 | + echo ' |
|
| 884 | 939 | <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li> |
| 885 | 940 | <li style="display:none;" id="quoteSelected_', $message['id'], '"> |
| 886 | 941 | <a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'], '</a> |
| 887 | 942 | </li>'; |
| 943 | + } |
|
| 888 | 944 | |
| 889 | 945 | // Can the user modify the contents of this post? Show the modify inline image. |
| 890 | - if ($message['can_modify']) |
|
| 891 | - echo ' |
|
| 946 | + if ($message['can_modify']) { |
|
| 947 | + echo ' |
|
| 892 | 948 | <li class="quick_edit"> |
| 893 | 949 | <a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a> |
| 894 | 950 | </li>'; |
| 951 | + } |
|
| 895 | 952 | |
| 896 | - if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
| 897 | - echo ' |
|
| 953 | + if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
| 954 | + echo ' |
|
| 898 | 955 | <li class="post_options">', $txt['post_options']; |
| 956 | + } |
|
| 899 | 957 | |
| 900 | 958 | echo ' |
| 901 | 959 | <ul>'; |
| 902 | 960 | |
| 903 | 961 | // Can the user modify the contents of this post? |
| 904 | - if ($message['can_modify']) |
|
| 905 | - echo ' |
|
| 962 | + if ($message['can_modify']) { |
|
| 963 | + echo ' |
|
| 906 | 964 | <li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>'; |
| 965 | + } |
|
| 907 | 966 | |
| 908 | 967 | // How about... even... remove it entirely?! |
| 909 | - if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) |
|
| 910 | - echo ' |
|
| 968 | + if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) { |
|
| 969 | + echo ' |
|
| 911 | 970 | <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'], '</a></li>'; |
| 912 | - |
|
| 913 | - elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) |
|
| 914 | - echo ' |
|
| 971 | + } elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) { |
|
| 972 | + echo ' |
|
| 915 | 973 | <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
| 974 | + } |
|
| 916 | 975 | |
| 917 | 976 | // What about splitting it off the rest of the topic? |
| 918 | - if ($context['can_split'] && !empty($context['real_num_replies'])) |
|
| 919 | - echo ' |
|
| 977 | + if ($context['can_split'] && !empty($context['real_num_replies'])) { |
|
| 978 | + echo ' |
|
| 920 | 979 | <li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>'; |
| 980 | + } |
|
| 921 | 981 | |
| 922 | 982 | // Can we issue a warning because of this post? Remember, we can't give guests warnings. |
| 923 | - if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) |
|
| 924 | - echo ' |
|
| 983 | + if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) { |
|
| 984 | + echo ' |
|
| 925 | 985 | <li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>'; |
| 986 | + } |
|
| 926 | 987 | |
| 927 | 988 | // Can we restore topics? |
| 928 | - if ($context['can_restore_msg']) |
|
| 929 | - echo ' |
|
| 989 | + if ($context['can_restore_msg']) { |
|
| 990 | + echo ' |
|
| 930 | 991 | <li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>'; |
| 992 | + } |
|
| 931 | 993 | |
| 932 | 994 | // Maybe we can approve it, maybe we should? |
| 933 | - if ($message['can_approve']) |
|
| 934 | - echo ' |
|
| 995 | + if ($message['can_approve']) { |
|
| 996 | + echo ' |
|
| 935 | 997 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>'; |
| 998 | + } |
|
| 936 | 999 | |
| 937 | 1000 | // Maybe we can unapprove it? |
| 938 | - if ($message['can_unapprove']) |
|
| 939 | - echo ' |
|
| 1001 | + if ($message['can_unapprove']) { |
|
| 1002 | + echo ' |
|
| 940 | 1003 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>'; |
| 1004 | + } |
|
| 941 | 1005 | |
| 942 | 1006 | echo ' |
| 943 | 1007 | </ul> |
| 944 | 1008 | </li>'; |
| 945 | 1009 | |
| 946 | 1010 | // Show a checkbox for quick moderation? |
| 947 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) |
|
| 948 | - echo ' |
|
| 1011 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) { |
|
| 1012 | + echo ' |
|
| 949 | 1013 | <li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>'; |
| 1014 | + } |
|
| 950 | 1015 | |
| 951 | - if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
| 952 | - echo ' |
|
| 1016 | + if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
| 1017 | + echo ' |
|
| 953 | 1018 | </ul><!-- .quickbuttons -->'; |
| 1019 | + } |
|
| 954 | 1020 | } |
| 955 | 1021 | |
| 956 | - if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
| 957 | - echo ' |
|
| 1022 | + if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
| 1023 | + echo ' |
|
| 958 | 1024 | </div><!-- .under_message -->'; |
| 1025 | + } |
|
| 959 | 1026 | |
| 960 | 1027 | echo ' |
| 961 | 1028 | </div><!-- .postarea --> |
@@ -968,9 +1035,10 @@ discard block |
||
| 968 | 1035 | <div class="custom_fields_above_signature"> |
| 969 | 1036 | <ul class="nolist">'; |
| 970 | 1037 | |
| 971 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
| 972 | - echo ' |
|
| 1038 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
| 1039 | + echo ' |
|
| 973 | 1040 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 1041 | + } |
|
| 974 | 1042 | |
| 975 | 1043 | echo ' |
| 976 | 1044 | </ul> |
@@ -978,11 +1046,12 @@ discard block |
||
| 978 | 1046 | } |
| 979 | 1047 | |
| 980 | 1048 | // Show the member's signature? |
| 981 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
| 982 | - echo ' |
|
| 1049 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
| 1050 | + echo ' |
|
| 983 | 1051 | <div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '> |
| 984 | 1052 | ', $message['member']['signature'], ' |
| 985 | 1053 | </div>'; |
| 1054 | + } |
|
| 986 | 1055 | |
| 987 | 1056 | |
| 988 | 1057 | // Are there any custom profile fields for below the signature? |
@@ -992,9 +1061,10 @@ discard block |
||
| 992 | 1061 | <div class="custom_fields_below_signature"> |
| 993 | 1062 | <ul class="nolist">'; |
| 994 | 1063 | |
| 995 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
| 996 | - echo ' |
|
| 1064 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
| 1065 | + echo ' |
|
| 997 | 1066 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 1067 | + } |
|
| 998 | 1068 | |
| 999 | 1069 | echo ' |
| 1000 | 1070 | </ul> |
@@ -1044,8 +1114,8 @@ discard block |
||
| 1044 | 1114 | <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">'; |
| 1045 | 1115 | |
| 1046 | 1116 | // Guests just need more. |
| 1047 | - if ($context['user']['is_guest']) |
|
| 1048 | - echo ' |
|
| 1117 | + if ($context['user']['is_guest']) { |
|
| 1118 | + echo ' |
|
| 1049 | 1119 | <dl id="post_header"> |
| 1050 | 1120 | <dt> |
| 1051 | 1121 | ', $txt['name'], ': |
@@ -1060,6 +1130,7 @@ discard block |
||
| 1060 | 1130 | <input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" required> |
| 1061 | 1131 | </dd> |
| 1062 | 1132 | </dl>'; |
| 1133 | + } |
|
| 1063 | 1134 | |
| 1064 | 1135 | echo ' |
| 1065 | 1136 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), ' |
@@ -1084,12 +1155,13 @@ discard block |
||
| 1084 | 1155 | </script>'; |
| 1085 | 1156 | |
| 1086 | 1157 | // Is visual verification enabled? |
| 1087 | - if ($context['require_verification']) |
|
| 1088 | - echo ' |
|
| 1158 | + if ($context['require_verification']) { |
|
| 1159 | + echo ' |
|
| 1089 | 1160 | <div class="post_verification"> |
| 1090 | 1161 | <strong>', $txt['verification'], ':</strong> |
| 1091 | 1162 | ', template_control_verification($context['visual_verification_id'], 'all'), ' |
| 1092 | 1163 | </div>'; |
| 1164 | + } |
|
| 1093 | 1165 | |
| 1094 | 1166 | // Finally, the submit buttons. |
| 1095 | 1167 | echo ' |
@@ -1105,8 +1177,8 @@ discard block |
||
| 1105 | 1177 | <br class="clear">'; |
| 1106 | 1178 | |
| 1107 | 1179 | // Draft autosave available and the user has it enabled? |
| 1108 | - if (!empty($context['drafts_autosave'])) |
|
| 1109 | - echo ' |
|
| 1180 | + if (!empty($context['drafts_autosave'])) { |
|
| 1181 | + echo ' |
|
| 1110 | 1182 | <script> |
| 1111 | 1183 | var oDraftAutoSave = new smf_DraftAutoSave({ |
| 1112 | 1184 | sSelf: \'oDraftAutoSave\', |
@@ -1118,12 +1190,14 @@ discard block |
||
| 1118 | 1190 | iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), ' |
| 1119 | 1191 | }); |
| 1120 | 1192 | </script>'; |
| 1193 | + } |
|
| 1121 | 1194 | |
| 1122 | - if ($context['show_spellchecking']) |
|
| 1123 | - echo ' |
|
| 1195 | + if ($context['show_spellchecking']) { |
|
| 1196 | + echo ' |
|
| 1124 | 1197 | <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"> |
| 1125 | 1198 | <input type="hidden" name="spellstring" value=""> |
| 1126 | 1199 | </form>'; |
| 1200 | + } |
|
| 1127 | 1201 | |
| 1128 | 1202 | echo ' |
| 1129 | 1203 | <script> |
@@ -18,23 +18,25 @@ discard block |
||
| 18 | 18 | global $context; |
| 19 | 19 | |
| 20 | 20 | // Prevent Chrome from auto completing fields when viewing/editing other members profiles |
| 21 | - if (isBrowser('is_chrome') && !$context['user']['is_owner']) |
|
| 22 | - echo ' |
|
| 21 | + if (isBrowser('is_chrome') && !$context['user']['is_owner']) { |
|
| 22 | + echo ' |
|
| 23 | 23 | <script> |
| 24 | 24 | disableAutoComplete(); |
| 25 | 25 | </script>'; |
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | // If an error occurred while trying to save previously, give the user a clue! |
| 28 | 29 | echo ' |
| 29 | 30 | ', template_error_message(); |
| 30 | 31 | |
| 31 | 32 | // If the profile was update successfully, let the user know this. |
| 32 | - if (!empty($context['profile_updated'])) |
|
| 33 | - echo ' |
|
| 33 | + if (!empty($context['profile_updated'])) { |
|
| 34 | + echo ' |
|
| 34 | 35 | <div class="infobox"> |
| 35 | 36 | ', $context['profile_updated'], ' |
| 36 | 37 | </div>'; |
| 37 | -} |
|
| 38 | + } |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | /** |
| 40 | 42 | * Template for any HTML needed below the profile (closing off divs/tables, etc.) |
@@ -99,19 +101,19 @@ discard block |
||
| 99 | 101 | </div> |
| 100 | 102 | <div class="alerts_unread">'; |
| 101 | 103 | |
| 102 | - if (empty($context['unread_alerts'])) |
|
| 103 | - template_alerts_all_read(); |
|
| 104 | - |
|
| 105 | - else |
|
| 104 | + if (empty($context['unread_alerts'])) { |
|
| 105 | + template_alerts_all_read(); |
|
| 106 | + } else |
|
| 106 | 107 | { |
| 107 | - foreach ($context['unread_alerts'] as $id_alert => $details) |
|
| 108 | - echo ' |
|
| 108 | + foreach ($context['unread_alerts'] as $id_alert => $details) { |
|
| 109 | + echo ' |
|
| 109 | 110 | <div class="unread"> |
| 110 | 111 | ', !empty($details['sender']) ? $details['sender']['avatar']['image'] : '', ' |
| 111 | 112 | <div class="details"> |
| 112 | 113 | ', !empty($details['icon']) ? $details['icon'] : '', '<span>', $details['text'], '</span> - ', $details['time'], ' |
| 113 | 114 | </div> |
| 114 | 115 | </div>'; |
| 116 | + } |
|
| 115 | 117 | } |
| 116 | 118 | |
| 117 | 119 | echo ' |
@@ -161,10 +163,11 @@ discard block |
||
| 161 | 163 | <div class="custom_fields_above_name"> |
| 162 | 164 | <ul>'; |
| 163 | 165 | |
| 164 | - foreach ($context['print_custom_fields']['above_member'] as $field) |
|
| 165 | - if (!empty($field['output_html'])) |
|
| 166 | + foreach ($context['print_custom_fields']['above_member'] as $field) { |
|
| 167 | + if (!empty($field['output_html'])) |
|
| 166 | 168 | echo ' |
| 167 | 169 | <li>', $field['output_html'], '</li>'; |
| 170 | + } |
|
| 168 | 171 | |
| 169 | 172 | echo ' |
| 170 | 173 | </ul> |
@@ -176,20 +179,22 @@ discard block |
||
| 176 | 179 | <div class="username clear"> |
| 177 | 180 | <h4>'; |
| 178 | 181 | |
| 179 | - if (!empty($context['print_custom_fields']['before_member'])) |
|
| 180 | - foreach ($context['print_custom_fields']['before_member'] as $field) |
|
| 182 | + if (!empty($context['print_custom_fields']['before_member'])) { |
|
| 183 | + foreach ($context['print_custom_fields']['before_member'] as $field) |
|
| 181 | 184 | if (!empty($field['output_html'])) |
| 182 | 185 | echo ' |
| 183 | 186 | <span>', $field['output_html'], '</span>'; |
| 187 | + } |
|
| 184 | 188 | |
| 185 | 189 | echo ' |
| 186 | 190 | ', $context['member']['name']; |
| 187 | 191 | |
| 188 | - if (!empty($context['print_custom_fields']['after_member'])) |
|
| 189 | - foreach ($context['print_custom_fields']['after_member'] as $field) |
|
| 192 | + if (!empty($context['print_custom_fields']['after_member'])) { |
|
| 193 | + foreach ($context['print_custom_fields']['after_member'] as $field) |
|
| 190 | 194 | if (!empty($field['output_html'])) |
| 191 | 195 | echo ' |
| 192 | 196 | <span>', $field['output_html'], '</span>'; |
| 197 | + } |
|
| 193 | 198 | |
| 194 | 199 | |
| 195 | 200 | echo ' |
@@ -205,10 +210,11 @@ discard block |
||
| 205 | 210 | <div class="custom_fields_below_avatar"> |
| 206 | 211 | <ul>'; |
| 207 | 212 | |
| 208 | - foreach ($context['print_custom_fields']['below_avatar'] as $field) |
|
| 209 | - if (!empty($field['output_html'])) |
|
| 213 | + foreach ($context['print_custom_fields']['below_avatar'] as $field) { |
|
| 214 | + if (!empty($field['output_html'])) |
|
| 210 | 215 | echo ' |
| 211 | 216 | <li>', $field['output_html'], '</li>'; |
| 217 | + } |
|
| 212 | 218 | |
| 213 | 219 | echo ' |
| 214 | 220 | </ul> |
@@ -220,22 +226,25 @@ discard block |
||
| 220 | 226 | <ul class="clear">'; |
| 221 | 227 | |
| 222 | 228 | // Email is only visible if it's your profile or you have the moderate_forum permission |
| 223 | - if ($context['member']['show_email']) |
|
| 224 | - echo ' |
|
| 229 | + if ($context['member']['show_email']) { |
|
| 230 | + echo ' |
|
| 225 | 231 | <li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>'; |
| 232 | + } |
|
| 226 | 233 | |
| 227 | 234 | // Don't show an icon if they haven't specified a website. |
| 228 | - if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
|
| 229 | - echo ' |
|
| 235 | + if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) { |
|
| 236 | + echo ' |
|
| 230 | 237 | <li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 238 | + } |
|
| 231 | 239 | |
| 232 | 240 | // Are there any custom profile fields as icons? |
| 233 | 241 | if (!empty($context['print_custom_fields']['icons'])) |
| 234 | 242 | { |
| 235 | - foreach ($context['print_custom_fields']['icons'] as $field) |
|
| 236 | - if (!empty($field['output_html'])) |
|
| 243 | + foreach ($context['print_custom_fields']['icons'] as $field) { |
|
| 244 | + if (!empty($field['output_html'])) |
|
| 237 | 245 | echo ' |
| 238 | 246 | <li class="custom_field">', $field['output_html'], '</li>'; |
| 247 | + } |
|
| 239 | 248 | } |
| 240 | 249 | |
| 241 | 250 | echo ' |
@@ -244,24 +253,27 @@ discard block |
||
| 244 | 253 | ', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : ''; |
| 245 | 254 | |
| 246 | 255 | // Can they add this member as a buddy? |
| 247 | - if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
|
| 248 | - echo ' |
|
| 256 | + if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) { |
|
| 257 | + echo ' |
|
| 249 | 258 | <br> |
| 250 | 259 | <a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>'; |
| 260 | + } |
|
| 251 | 261 | |
| 252 | 262 | echo ' |
| 253 | 263 | </span>'; |
| 254 | 264 | |
| 255 | - if (!$context['user']['is_owner'] && $context['can_send_pm']) |
|
| 256 | - echo ' |
|
| 265 | + if (!$context['user']['is_owner'] && $context['can_send_pm']) { |
|
| 266 | + echo ' |
|
| 257 | 267 | <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>'; |
| 268 | + } |
|
| 258 | 269 | |
| 259 | 270 | echo ' |
| 260 | 271 | <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>'; |
| 261 | 272 | |
| 262 | - if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) |
|
| 263 | - echo ' |
|
| 273 | + if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) { |
|
| 274 | + echo ' |
|
| 264 | 275 | <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>'; |
| 276 | + } |
|
| 265 | 277 | |
| 266 | 278 | echo ' |
| 267 | 279 | <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>'; |
@@ -273,10 +285,11 @@ discard block |
||
| 273 | 285 | <div class="custom_fields_bottom"> |
| 274 | 286 | <ul class="nolist">'; |
| 275 | 287 | |
| 276 | - foreach ($context['print_custom_fields']['bottom_poster'] as $field) |
|
| 277 | - if (!empty($field['output_html'])) |
|
| 288 | + foreach ($context['print_custom_fields']['bottom_poster'] as $field) { |
|
| 289 | + if (!empty($field['output_html'])) |
|
| 278 | 290 | echo ' |
| 279 | 291 | <li>', $field['output_html'], '</li>'; |
| 292 | + } |
|
| 280 | 293 | |
| 281 | 294 | echo ' |
| 282 | 295 | </ul> |
@@ -289,30 +302,35 @@ discard block |
||
| 289 | 302 | <div id="detailedinfo"> |
| 290 | 303 | <dl class="settings">'; |
| 291 | 304 | |
| 292 | - if ($context['user']['is_owner'] || $context['user']['is_admin']) |
|
| 293 | - echo ' |
|
| 305 | + if ($context['user']['is_owner'] || $context['user']['is_admin']) { |
|
| 306 | + echo ' |
|
| 294 | 307 | <dt>', $txt['username'], ': </dt> |
| 295 | 308 | <dd>', $context['member']['username'], '</dd>'; |
| 309 | + } |
|
| 296 | 310 | |
| 297 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 298 | - echo ' |
|
| 311 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 312 | + echo ' |
|
| 299 | 313 | <dt>', $txt['profile_posts'], ': </dt> |
| 300 | 314 | <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
| 315 | + } |
|
| 301 | 316 | |
| 302 | - if ($context['member']['show_email']) |
|
| 303 | - echo ' |
|
| 317 | + if ($context['member']['show_email']) { |
|
| 318 | + echo ' |
|
| 304 | 319 | <dt>', $txt['email'], ': </dt> |
| 305 | 320 | <dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>'; |
| 321 | + } |
|
| 306 | 322 | |
| 307 | - if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
|
| 308 | - echo ' |
|
| 323 | + if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) { |
|
| 324 | + echo ' |
|
| 309 | 325 | <dt>', $txt['custom_title'], ': </dt> |
| 310 | 326 | <dd>', $context['member']['title'], '</dd>'; |
| 327 | + } |
|
| 311 | 328 | |
| 312 | - if (!empty($context['member']['blurb'])) |
|
| 313 | - echo ' |
|
| 329 | + if (!empty($context['member']['blurb'])) { |
|
| 330 | + echo ' |
|
| 314 | 331 | <dt>', $txt['personal_text'], ': </dt> |
| 315 | 332 | <dd>', $context['member']['blurb'], '</dd>'; |
| 333 | + } |
|
| 316 | 334 | |
| 317 | 335 | echo ' |
| 318 | 336 | <dt>', $txt['age'], ':</dt> |
@@ -326,19 +344,21 @@ discard block |
||
| 326 | 344 | { |
| 327 | 345 | $fields = array(); |
| 328 | 346 | |
| 329 | - foreach ($context['print_custom_fields']['standard'] as $field) |
|
| 330 | - if (!empty($field['output_html'])) |
|
| 347 | + foreach ($context['print_custom_fields']['standard'] as $field) { |
|
| 348 | + if (!empty($field['output_html'])) |
|
| 331 | 349 | $fields[] = $field; |
| 350 | + } |
|
| 332 | 351 | |
| 333 | 352 | if (count($fields) > 0) |
| 334 | 353 | { |
| 335 | 354 | echo ' |
| 336 | 355 | <dl class="settings">'; |
| 337 | 356 | |
| 338 | - foreach ($fields as $field) |
|
| 339 | - echo ' |
|
| 357 | + foreach ($fields as $field) { |
|
| 358 | + echo ' |
|
| 340 | 359 | <dt>', $field['name'], ':</dt> |
| 341 | 360 | <dd>', $field['output_html'], '</dd>'; |
| 361 | + } |
|
| 342 | 362 | |
| 343 | 363 | echo ' |
| 344 | 364 | </dl>'; |
@@ -358,9 +378,10 @@ discard block |
||
| 358 | 378 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>'; |
| 359 | 379 | |
| 360 | 380 | // Can we provide information on what this means? |
| 361 | - if (!empty($context['warning_status'])) |
|
| 362 | - echo ' |
|
| 381 | + if (!empty($context['warning_status'])) { |
|
| 382 | + echo ' |
|
| 363 | 383 | <span class="smalltext">(', $context['warning_status'], ')</span>'; |
| 384 | + } |
|
| 364 | 385 | |
| 365 | 386 | echo ' |
| 366 | 387 | </dd>'; |
@@ -371,11 +392,12 @@ discard block |
||
| 371 | 392 | { |
| 372 | 393 | |
| 373 | 394 | // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
| 374 | - if (!empty($context['activate_message'])) |
|
| 375 | - echo ' |
|
| 395 | + if (!empty($context['activate_message'])) { |
|
| 396 | + echo ' |
|
| 376 | 397 | <dt class="clear"> |
| 377 | 398 | <span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>) |
| 378 | 399 | </dt>'; |
| 400 | + } |
|
| 379 | 401 | |
| 380 | 402 | // If the current member is banned, show a message and possibly a link to the ban. |
| 381 | 403 | if (!empty($context['member']['bans'])) |
@@ -387,10 +409,11 @@ discard block |
||
| 387 | 409 | <dt class="clear" id="ban_info" style="display: none;"> |
| 388 | 410 | <strong>', $txt['user_banned_by_following'], ':</strong>'; |
| 389 | 411 | |
| 390 | - foreach ($context['member']['bans'] as $ban) |
|
| 391 | - echo ' |
|
| 412 | + foreach ($context['member']['bans'] as $ban) { |
|
| 413 | + echo ' |
|
| 392 | 414 | <br> |
| 393 | 415 | <span class="smalltext">', $ban['explanation'], '</span>'; |
| 416 | + } |
|
| 394 | 417 | |
| 395 | 418 | echo ' |
| 396 | 419 | </dt>'; |
@@ -404,30 +427,34 @@ discard block |
||
| 404 | 427 | // If the person looking is allowed, they can check the members IP address and hostname. |
| 405 | 428 | if ($context['can_see_ip']) |
| 406 | 429 | { |
| 407 | - if (!empty($context['member']['ip'])) |
|
| 408 | - echo ' |
|
| 430 | + if (!empty($context['member']['ip'])) { |
|
| 431 | + echo ' |
|
| 409 | 432 | <dt>', $txt['ip'], ': </dt> |
| 410 | 433 | <dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
| 434 | + } |
|
| 411 | 435 | |
| 412 | - if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
|
| 413 | - echo ' |
|
| 436 | + if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) { |
|
| 437 | + echo ' |
|
| 414 | 438 | <dt>', $txt['hostname'], ': </dt> |
| 415 | 439 | <dd>', $context['member']['hostname'], '</dd>'; |
| 440 | + } |
|
| 416 | 441 | } |
| 417 | 442 | |
| 418 | 443 | echo ' |
| 419 | 444 | <dt>', $txt['local_time'], ':</dt> |
| 420 | 445 | <dd>', $context['member']['local_time'], '</dd>'; |
| 421 | 446 | |
| 422 | - if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
|
| 423 | - echo ' |
|
| 447 | + if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) { |
|
| 448 | + echo ' |
|
| 424 | 449 | <dt>', $txt['language'], ':</dt> |
| 425 | 450 | <dd>', $context['member']['language'], '</dd>'; |
| 451 | + } |
|
| 426 | 452 | |
| 427 | - if ($context['member']['show_last_login']) |
|
| 428 | - echo ' |
|
| 453 | + if ($context['member']['show_last_login']) { |
|
| 454 | + echo ' |
|
| 429 | 455 | <dt>', $txt['lastLoggedIn'], ': </dt> |
| 430 | 456 | <dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>'; |
| 457 | + } |
|
| 431 | 458 | |
| 432 | 459 | echo ' |
| 433 | 460 | </dl>'; |
@@ -439,10 +466,11 @@ discard block |
||
| 439 | 466 | <div class="custom_fields_above_signature"> |
| 440 | 467 | <ul class="nolist">'; |
| 441 | 468 | |
| 442 | - foreach ($context['print_custom_fields']['above_signature'] as $field) |
|
| 443 | - if (!empty($field['output_html'])) |
|
| 469 | + foreach ($context['print_custom_fields']['above_signature'] as $field) { |
|
| 470 | + if (!empty($field['output_html'])) |
|
| 444 | 471 | echo ' |
| 445 | 472 | <li>', $field['output_html'], '</li>'; |
| 473 | + } |
|
| 446 | 474 | |
| 447 | 475 | echo ' |
| 448 | 476 | </ul> |
@@ -450,12 +478,13 @@ discard block |
||
| 450 | 478 | } |
| 451 | 479 | |
| 452 | 480 | // Show the users signature. |
| 453 | - if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
|
| 454 | - echo ' |
|
| 481 | + if ($context['signature_enabled'] && !empty($context['member']['signature'])) { |
|
| 482 | + echo ' |
|
| 455 | 483 | <div class="signature"> |
| 456 | 484 | <h5>', $txt['signature'], ':</h5> |
| 457 | 485 | ', $context['member']['signature'], ' |
| 458 | 486 | </div>'; |
| 487 | + } |
|
| 459 | 488 | |
| 460 | 489 | // Are there any custom profile fields for below the signature? |
| 461 | 490 | if (!empty($context['print_custom_fields']['below_signature'])) |
@@ -464,10 +493,11 @@ discard block |
||
| 464 | 493 | <div class="custom_fields_below_signature"> |
| 465 | 494 | <ul class="nolist">'; |
| 466 | 495 | |
| 467 | - foreach ($context['print_custom_fields']['below_signature'] as $field) |
|
| 468 | - if (!empty($field['output_html'])) |
|
| 496 | + foreach ($context['print_custom_fields']['below_signature'] as $field) { |
|
| 497 | + if (!empty($field['output_html'])) |
|
| 469 | 498 | echo ' |
| 470 | 499 | <li>', $field['output_html'], '</li>'; |
| 500 | + } |
|
| 471 | 501 | |
| 472 | 502 | echo ' |
| 473 | 503 | </ul> |
@@ -513,62 +543,70 @@ discard block |
||
| 513 | 543 | </div> |
| 514 | 544 | <div class="list_posts">'; |
| 515 | 545 | |
| 516 | - if (!$post['approved']) |
|
| 517 | - echo ' |
|
| 546 | + if (!$post['approved']) { |
|
| 547 | + echo ' |
|
| 518 | 548 | <div class="approve_post"> |
| 519 | 549 | <em>', $txt['post_awaiting_approval'], '</em> |
| 520 | 550 | </div>'; |
| 551 | + } |
|
| 521 | 552 | |
| 522 | 553 | echo ' |
| 523 | 554 | ', $post['body'], ' |
| 524 | 555 | </div>'; |
| 525 | 556 | |
| 526 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 527 | - echo ' |
|
| 557 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 558 | + echo ' |
|
| 528 | 559 | <div class="floatright"> |
| 529 | 560 | <ul class="quickbuttons">'; |
| 561 | + } |
|
| 530 | 562 | |
| 531 | 563 | // If they *can* reply? |
| 532 | - if ($post['can_reply']) |
|
| 533 | - echo ' |
|
| 564 | + if ($post['can_reply']) { |
|
| 565 | + echo ' |
|
| 534 | 566 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
| 567 | + } |
|
| 535 | 568 | |
| 536 | 569 | // If they *can* quote? |
| 537 | - if ($post['can_quote']) |
|
| 538 | - echo ' |
|
| 570 | + if ($post['can_quote']) { |
|
| 571 | + echo ' |
|
| 539 | 572 | <li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
| 573 | + } |
|
| 540 | 574 | |
| 541 | 575 | // How about... even... remove it entirely?! |
| 542 | - if ($post['can_delete']) |
|
| 543 | - echo ' |
|
| 576 | + if ($post['can_delete']) { |
|
| 577 | + echo ' |
|
| 544 | 578 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
| 579 | + } |
|
| 545 | 580 | |
| 546 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 547 | - echo ' |
|
| 581 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 582 | + echo ' |
|
| 548 | 583 | </ul> |
| 549 | 584 | </div><!-- .floatright -->'; |
| 585 | + } |
|
| 550 | 586 | |
| 551 | 587 | echo ' |
| 552 | 588 | </div><!-- $post[css_class] -->'; |
| 553 | 589 | } |
| 590 | + } else { |
|
| 591 | + template_show_list('attachments'); |
|
| 554 | 592 | } |
| 555 | - else |
|
| 556 | - template_show_list('attachments'); |
|
| 557 | 593 | |
| 558 | 594 | // No posts? Just end with a informative message. |
| 559 | - if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) |
|
| 560 | - echo ' |
|
| 595 | + if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) { |
|
| 596 | + echo ' |
|
| 561 | 597 | <div class="windowbg2"> |
| 562 | 598 | ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), ' |
| 563 | 599 | </div>'; |
| 600 | + } |
|
| 564 | 601 | |
| 565 | 602 | // Show more page numbers. |
| 566 | - if (!empty($context['page_index'])) |
|
| 567 | - echo ' |
|
| 603 | + if (!empty($context['page_index'])) { |
|
| 604 | + echo ' |
|
| 568 | 605 | <div class="pagesection"> |
| 569 | 606 | <div class="pagelinks">', $context['page_index'], '</div> |
| 570 | 607 | </div>'; |
| 571 | -} |
|
| 608 | + } |
|
| 609 | + } |
|
| 572 | 610 | |
| 573 | 611 | /** |
| 574 | 612 | * Template for showing alerts within the alerts popup |
@@ -578,11 +616,12 @@ discard block |
||
| 578 | 616 | global $context, $txt, $scripturl; |
| 579 | 617 | |
| 580 | 618 | // Do we have an update message? |
| 581 | - if (!empty($context['update_message'])) |
|
| 582 | - echo ' |
|
| 619 | + if (!empty($context['update_message'])) { |
|
| 620 | + echo ' |
|
| 583 | 621 | <div class="infobox"> |
| 584 | 622 | ', $context['update_message'], '. |
| 585 | 623 | </div>'; |
| 624 | + } |
|
| 586 | 625 | |
| 587 | 626 | echo ' |
| 588 | 627 | <div class="cat_bar"> |
@@ -591,13 +630,12 @@ discard block |
||
| 591 | 630 | </h3> |
| 592 | 631 | </div>'; |
| 593 | 632 | |
| 594 | - if (empty($context['alerts'])) |
|
| 595 | - echo ' |
|
| 633 | + if (empty($context['alerts'])) { |
|
| 634 | + echo ' |
|
| 596 | 635 | <div class="information"> |
| 597 | 636 | ', $txt['alerts_none'], ' |
| 598 | 637 | </div>'; |
| 599 | - |
|
| 600 | - else |
|
| 638 | + } else |
|
| 601 | 639 | { |
| 602 | 640 | // Start the form. |
| 603 | 641 | echo ' |
@@ -659,12 +697,12 @@ discard block |
||
| 659 | 697 | </div>' : ''; |
| 660 | 698 | |
| 661 | 699 | // No drafts? Just show an informative message. |
| 662 | - if (empty($context['drafts'])) |
|
| 663 | - echo ' |
|
| 700 | + if (empty($context['drafts'])) { |
|
| 701 | + echo ' |
|
| 664 | 702 | <div class="windowbg2 centertext"> |
| 665 | 703 | ', $txt['draft_none'], ' |
| 666 | 704 | </div>'; |
| 667 | - else |
|
| 705 | + } else |
|
| 668 | 706 | { |
| 669 | 707 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
| 670 | 708 | foreach ($context['drafts'] as $draft) |
@@ -676,13 +714,15 @@ discard block |
||
| 676 | 714 | <h5> |
| 677 | 715 | <strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> '; |
| 678 | 716 | |
| 679 | - if (!empty($draft['sticky'])) |
|
| 680 | - echo ' |
|
| 717 | + if (!empty($draft['sticky'])) { |
|
| 718 | + echo ' |
|
| 681 | 719 | <span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
| 720 | + } |
|
| 682 | 721 | |
| 683 | - if (!empty($draft['locked'])) |
|
| 684 | - echo ' |
|
| 722 | + if (!empty($draft['locked'])) { |
|
| 723 | + echo ' |
|
| 685 | 724 | <span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
| 725 | + } |
|
| 686 | 726 | |
| 687 | 727 | echo ' |
| 688 | 728 | </h5> |
@@ -715,13 +755,13 @@ discard block |
||
| 715 | 755 | { |
| 716 | 756 | global $context, $scripturl, $txt; |
| 717 | 757 | |
| 718 | - if (!empty($context['saved_successful'])) |
|
| 719 | - echo ' |
|
| 758 | + if (!empty($context['saved_successful'])) { |
|
| 759 | + echo ' |
|
| 720 | 760 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
| 721 | - |
|
| 722 | - elseif (!empty($context['saved_failed'])) |
|
| 723 | - echo ' |
|
| 761 | + } elseif (!empty($context['saved_failed'])) { |
|
| 762 | + echo ' |
|
| 724 | 763 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
| 764 | + } |
|
| 725 | 765 | |
| 726 | 766 | echo ' |
| 727 | 767 | <div id="edit_buddies"> |
@@ -736,14 +776,16 @@ discard block |
||
| 736 | 776 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
| 737 | 777 | <th scope="col">', $txt['status'], '</th>'; |
| 738 | 778 | |
| 739 | - if (allowedTo('moderate_forum')) |
|
| 740 | - echo ' |
|
| 779 | + if (allowedTo('moderate_forum')) { |
|
| 780 | + echo ' |
|
| 741 | 781 | <th scope="col">', $txt['email'], '</th>'; |
| 782 | + } |
|
| 742 | 783 | |
| 743 | - if (!empty($context['custom_pf'])) |
|
| 744 | - foreach ($context['custom_pf'] as $column) |
|
| 784 | + if (!empty($context['custom_pf'])) { |
|
| 785 | + foreach ($context['custom_pf'] as $column) |
|
| 745 | 786 | echo ' |
| 746 | 787 | <th scope="col">', $column['label'], '</th>'; |
| 788 | + } |
|
| 747 | 789 | |
| 748 | 790 | echo ' |
| 749 | 791 | <th scope="col">', $txt['remove'], '</th> |
@@ -752,13 +794,14 @@ discard block |
||
| 752 | 794 | <tbody>'; |
| 753 | 795 | |
| 754 | 796 | // If they don't have any buddies don't list them! |
| 755 | - if (empty($context['buddies'])) |
|
| 756 | - echo ' |
|
| 797 | + if (empty($context['buddies'])) { |
|
| 798 | + echo ' |
|
| 757 | 799 | <tr class="windowbg"> |
| 758 | 800 | <td colspan="', allowedTo('moderate_forum') ? '10' : '9', '"> |
| 759 | 801 | <strong>', $txt['no_buddies'], '</strong> |
| 760 | 802 | </td> |
| 761 | 803 | </tr>'; |
| 804 | + } |
|
| 762 | 805 | |
| 763 | 806 | // Now loop through each buddy showing info on each. |
| 764 | 807 | else |
@@ -772,17 +815,19 @@ discard block |
||
| 772 | 815 | <a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a> |
| 773 | 816 | </td>'; |
| 774 | 817 | |
| 775 | - if ($buddy['show_email']) |
|
| 776 | - echo ' |
|
| 818 | + if ($buddy['show_email']) { |
|
| 819 | + echo ' |
|
| 777 | 820 | <td> |
| 778 | 821 | <a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a> |
| 779 | 822 | </td>'; |
| 823 | + } |
|
| 780 | 824 | |
| 781 | 825 | // Show the custom profile fields for this user. |
| 782 | - if (!empty($context['custom_pf'])) |
|
| 783 | - foreach ($context['custom_pf'] as $key => $column) |
|
| 826 | + if (!empty($context['custom_pf'])) { |
|
| 827 | + foreach ($context['custom_pf'] as $key => $column) |
|
| 784 | 828 | echo ' |
| 785 | 829 | <td class="lefttext">', $buddy['options'][$key], '</td>'; |
| 830 | + } |
|
| 786 | 831 | |
| 787 | 832 | echo ' |
| 788 | 833 | <td> |
@@ -815,9 +860,10 @@ discard block |
||
| 815 | 860 | </dl> |
| 816 | 861 | </div>'; |
| 817 | 862 | |
| 818 | - if (!empty($context['token_check'])) |
|
| 819 | - echo ' |
|
| 863 | + if (!empty($context['token_check'])) { |
|
| 864 | + echo ' |
|
| 820 | 865 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 866 | + } |
|
| 821 | 867 | |
| 822 | 868 | echo ' |
| 823 | 869 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -843,13 +889,13 @@ discard block |
||
| 843 | 889 | { |
| 844 | 890 | global $context, $scripturl, $txt; |
| 845 | 891 | |
| 846 | - if (!empty($context['saved_successful'])) |
|
| 847 | - echo ' |
|
| 892 | + if (!empty($context['saved_successful'])) { |
|
| 893 | + echo ' |
|
| 848 | 894 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
| 849 | - |
|
| 850 | - elseif (!empty($context['saved_failed'])) |
|
| 851 | - echo ' |
|
| 895 | + } elseif (!empty($context['saved_failed'])) { |
|
| 896 | + echo ' |
|
| 852 | 897 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
| 898 | + } |
|
| 853 | 899 | |
| 854 | 900 | echo ' |
| 855 | 901 | <div id="edit_buddies"> |
@@ -864,9 +910,10 @@ discard block |
||
| 864 | 910 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
| 865 | 911 | <th scope="col">', $txt['status'], '</th>'; |
| 866 | 912 | |
| 867 | - if (allowedTo('moderate_forum')) |
|
| 868 | - echo ' |
|
| 913 | + if (allowedTo('moderate_forum')) { |
|
| 914 | + echo ' |
|
| 869 | 915 | <th scope="col">', $txt['email'], '</th>'; |
| 916 | + } |
|
| 870 | 917 | |
| 871 | 918 | echo ' |
| 872 | 919 | <th scope="col">', $txt['ignore_remove'], '</th> |
@@ -875,13 +922,14 @@ discard block |
||
| 875 | 922 | <tbody>'; |
| 876 | 923 | |
| 877 | 924 | // If they don't have anyone on their ignore list, don't list it! |
| 878 | - if (empty($context['ignore_list'])) |
|
| 879 | - echo ' |
|
| 925 | + if (empty($context['ignore_list'])) { |
|
| 926 | + echo ' |
|
| 880 | 927 | <tr class="windowbg"> |
| 881 | 928 | <td colspan="', allowedTo('moderate_forum') ? '4' : '3', '"> |
| 882 | 929 | <strong>', $txt['no_ignore'], '</strong> |
| 883 | 930 | </td> |
| 884 | 931 | </tr>'; |
| 932 | + } |
|
| 885 | 933 | |
| 886 | 934 | // Now loop through each buddy showing info on each. |
| 887 | 935 | foreach ($context['ignore_list'] as $member) |
@@ -893,11 +941,12 @@ discard block |
||
| 893 | 941 | <a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a> |
| 894 | 942 | </td>'; |
| 895 | 943 | |
| 896 | - if ($member['show_email']) |
|
| 897 | - echo ' |
|
| 944 | + if ($member['show_email']) { |
|
| 945 | + echo ' |
|
| 898 | 946 | <td> |
| 899 | 947 | <a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a> |
| 900 | 948 | </td>'; |
| 949 | + } |
|
| 901 | 950 | echo ' |
| 902 | 951 | <td> |
| 903 | 952 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a> |
@@ -927,9 +976,10 @@ discard block |
||
| 927 | 976 | </dl> |
| 928 | 977 | </div>'; |
| 929 | 978 | |
| 930 | - if (!empty($context['token_check'])) |
|
| 931 | - echo ' |
|
| 979 | + if (!empty($context['token_check'])) { |
|
| 980 | + echo ' |
|
| 932 | 981 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 982 | + } |
|
| 933 | 983 | |
| 934 | 984 | echo ' |
| 935 | 985 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -975,9 +1025,10 @@ discard block |
||
| 975 | 1025 | <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>'; |
| 976 | 1026 | |
| 977 | 1027 | // Second address detected? |
| 978 | - if (!empty($context['last_ip2'])) |
|
| 979 | - echo ' |
|
| 1028 | + if (!empty($context['last_ip2'])) { |
|
| 1029 | + echo ' |
|
| 980 | 1030 | , <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>'; |
| 1031 | + } |
|
| 981 | 1032 | |
| 982 | 1033 | echo ' |
| 983 | 1034 | </dd>'; |
@@ -1043,9 +1094,10 @@ discard block |
||
| 1043 | 1094 | </div> |
| 1044 | 1095 | <div class="windowbg2 noup">'; |
| 1045 | 1096 | |
| 1046 | - foreach ($context['whois_servers'] as $server) |
|
| 1047 | - echo ' |
|
| 1097 | + foreach ($context['whois_servers'] as $server) { |
|
| 1098 | + echo ' |
|
| 1048 | 1099 | <a href="', $server['url'], '" target="_blank"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>'; |
| 1100 | + } |
|
| 1049 | 1101 | echo ' |
| 1050 | 1102 | </div> |
| 1051 | 1103 | <br>'; |
@@ -1057,13 +1109,12 @@ discard block |
||
| 1057 | 1109 | <h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3> |
| 1058 | 1110 | </div>'; |
| 1059 | 1111 | |
| 1060 | - if (empty($context['ips'])) |
|
| 1061 | - echo ' |
|
| 1112 | + if (empty($context['ips'])) { |
|
| 1113 | + echo ' |
|
| 1062 | 1114 | <p class="windowbg2 description"> |
| 1063 | 1115 | <em>', $txt['no_members_from_ip'], '</em> |
| 1064 | 1116 | </p>'; |
| 1065 | - |
|
| 1066 | - else |
|
| 1117 | + } else |
|
| 1067 | 1118 | { |
| 1068 | 1119 | echo ' |
| 1069 | 1120 | <table class="table_grid"> |
@@ -1076,12 +1127,13 @@ discard block |
||
| 1076 | 1127 | <tbody>'; |
| 1077 | 1128 | |
| 1078 | 1129 | // Loop through each of the members and display them. |
| 1079 | - foreach ($context['ips'] as $ip => $memberlist) |
|
| 1080 | - echo ' |
|
| 1130 | + foreach ($context['ips'] as $ip => $memberlist) { |
|
| 1131 | + echo ' |
|
| 1081 | 1132 | <tr class="windowbg"> |
| 1082 | 1133 | <td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td> |
| 1083 | 1134 | <td>', implode(', ', $memberlist), '</td> |
| 1084 | 1135 | </tr>'; |
| 1136 | + } |
|
| 1085 | 1137 | |
| 1086 | 1138 | echo ' |
| 1087 | 1139 | </tbody> |
@@ -1123,11 +1175,10 @@ discard block |
||
| 1123 | 1175 | </h3> |
| 1124 | 1176 | </div>'; |
| 1125 | 1177 | |
| 1126 | - if ($context['member']['has_all_permissions']) |
|
| 1127 | - echo ' |
|
| 1178 | + if ($context['member']['has_all_permissions']) { |
|
| 1179 | + echo ' |
|
| 1128 | 1180 | <div class="information">', $txt['showPermissions_all'], '</div>'; |
| 1129 | - |
|
| 1130 | - else |
|
| 1181 | + } else |
|
| 1131 | 1182 | { |
| 1132 | 1183 | echo ' |
| 1133 | 1184 | <div class="information">',$txt['showPermissions_help'], '</div> |
@@ -1142,9 +1193,10 @@ discard block |
||
| 1142 | 1193 | <div class="windowbg smalltext"> |
| 1143 | 1194 | ', $txt['showPermissions_restricted_boards_desc'], ':<br>'; |
| 1144 | 1195 | |
| 1145 | - foreach ($context['no_access_boards'] as $no_access_board) |
|
| 1146 | - echo ' |
|
| 1196 | + foreach ($context['no_access_boards'] as $no_access_board) { |
|
| 1197 | + echo ' |
|
| 1147 | 1198 | <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', '; |
| 1199 | + } |
|
| 1148 | 1200 | echo ' |
| 1149 | 1201 | </div>'; |
| 1150 | 1202 | } |
@@ -1176,12 +1228,13 @@ discard block |
||
| 1176 | 1228 | </td> |
| 1177 | 1229 | <td class="smalltext">'; |
| 1178 | 1230 | |
| 1179 | - if ($permission['is_denied']) |
|
| 1180 | - echo ' |
|
| 1231 | + if ($permission['is_denied']) { |
|
| 1232 | + echo ' |
|
| 1181 | 1233 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
| 1182 | - else |
|
| 1183 | - echo ' |
|
| 1234 | + } else { |
|
| 1235 | + echo ' |
|
| 1184 | 1236 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
| 1237 | + } |
|
| 1185 | 1238 | |
| 1186 | 1239 | echo ' |
| 1187 | 1240 | </td> |
@@ -1192,10 +1245,10 @@ discard block |
||
| 1192 | 1245 | </table> |
| 1193 | 1246 | </div><!-- .tborder --> |
| 1194 | 1247 | <br>'; |
| 1195 | - } |
|
| 1196 | - else |
|
| 1197 | - echo ' |
|
| 1248 | + } else { |
|
| 1249 | + echo ' |
|
| 1198 | 1250 | <p class="windowbg2">', $txt['showPermissions_none_general'], '</p>'; |
| 1251 | + } |
|
| 1199 | 1252 | |
| 1200 | 1253 | // Board permission section. |
| 1201 | 1254 | echo ' |
@@ -1206,14 +1259,16 @@ discard block |
||
| 1206 | 1259 | <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
| 1207 | 1260 | <option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '</option>'; |
| 1208 | 1261 | |
| 1209 | - if (!empty($context['boards'])) |
|
| 1210 | - echo ' |
|
| 1262 | + if (!empty($context['boards'])) { |
|
| 1263 | + echo ' |
|
| 1211 | 1264 | <option value="" disabled>---------------------------</option>'; |
| 1265 | + } |
|
| 1212 | 1266 | |
| 1213 | 1267 | // Fill the box with any local permission boards. |
| 1214 | - foreach ($context['boards'] as $board) |
|
| 1215 | - echo ' |
|
| 1268 | + foreach ($context['boards'] as $board) { |
|
| 1269 | + echo ' |
|
| 1216 | 1270 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
| 1271 | + } |
|
| 1217 | 1272 | |
| 1218 | 1273 | echo ' |
| 1219 | 1274 | </select> |
@@ -1242,13 +1297,13 @@ discard block |
||
| 1242 | 1297 | </td> |
| 1243 | 1298 | <td class="smalltext">'; |
| 1244 | 1299 | |
| 1245 | - if ($permission['is_denied']) |
|
| 1246 | - echo ' |
|
| 1300 | + if ($permission['is_denied']) { |
|
| 1301 | + echo ' |
|
| 1247 | 1302 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
| 1248 | - |
|
| 1249 | - else |
|
| 1250 | - echo ' |
|
| 1303 | + } else { |
|
| 1304 | + echo ' |
|
| 1251 | 1305 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
| 1306 | + } |
|
| 1252 | 1307 | |
| 1253 | 1308 | echo ' |
| 1254 | 1309 | </td> |
@@ -1257,10 +1312,10 @@ discard block |
||
| 1257 | 1312 | echo ' |
| 1258 | 1313 | </tbody> |
| 1259 | 1314 | </table>'; |
| 1260 | - } |
|
| 1261 | - else |
|
| 1262 | - echo ' |
|
| 1315 | + } else { |
|
| 1316 | + echo ' |
|
| 1263 | 1317 | <p class="windowbg2">', $txt['showPermissions_none_board'], '</p>'; |
| 1318 | + } |
|
| 1264 | 1319 | echo ' |
| 1265 | 1320 | </div><!-- #permissions -->'; |
| 1266 | 1321 | } |
@@ -1301,9 +1356,10 @@ discard block |
||
| 1301 | 1356 | </div>'; |
| 1302 | 1357 | |
| 1303 | 1358 | // If they haven't post at all, don't draw the graph. |
| 1304 | - if (empty($context['posts_by_time'])) |
|
| 1305 | - echo ' |
|
| 1359 | + if (empty($context['posts_by_time'])) { |
|
| 1360 | + echo ' |
|
| 1306 | 1361 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1362 | + } |
|
| 1307 | 1363 | |
| 1308 | 1364 | // Otherwise do! |
| 1309 | 1365 | else |
@@ -1312,8 +1368,8 @@ discard block |
||
| 1312 | 1368 | <ul class="activity_stats flow_hidden">'; |
| 1313 | 1369 | |
| 1314 | 1370 | // The labels. |
| 1315 | - foreach ($context['posts_by_time'] as $time_of_day) |
|
| 1316 | - echo ' |
|
| 1371 | + foreach ($context['posts_by_time'] as $time_of_day) { |
|
| 1372 | + echo ' |
|
| 1317 | 1373 | <li', $time_of_day['is_last'] ? ' class="last"' : '', '> |
| 1318 | 1374 | <div class="bar" style="padding-top: ', ((int) (100 - $time_of_day['relative_percent'])), 'px;" title="', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '"> |
| 1319 | 1375 | <div style="height: ', (int) $time_of_day['relative_percent'], 'px;"> |
@@ -1322,6 +1378,7 @@ discard block |
||
| 1322 | 1378 | </div> |
| 1323 | 1379 | <span class="stats_hour">', $time_of_day['hour_format'], '</span> |
| 1324 | 1380 | </li>'; |
| 1381 | + } |
|
| 1325 | 1382 | |
| 1326 | 1383 | echo ' |
| 1327 | 1384 | </ul>'; |
@@ -1340,11 +1397,10 @@ discard block |
||
| 1340 | 1397 | </h3> |
| 1341 | 1398 | </div>'; |
| 1342 | 1399 | |
| 1343 | - if (empty($context['popular_boards'])) |
|
| 1344 | - echo ' |
|
| 1400 | + if (empty($context['popular_boards'])) { |
|
| 1401 | + echo ' |
|
| 1345 | 1402 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1346 | - |
|
| 1347 | - else |
|
| 1403 | + } else |
|
| 1348 | 1404 | { |
| 1349 | 1405 | echo ' |
| 1350 | 1406 | <dl class="stats">'; |
@@ -1374,10 +1430,10 @@ discard block |
||
| 1374 | 1430 | </h3> |
| 1375 | 1431 | </div>'; |
| 1376 | 1432 | |
| 1377 | - if (empty($context['board_activity'])) |
|
| 1378 | - echo ' |
|
| 1433 | + if (empty($context['board_activity'])) { |
|
| 1434 | + echo ' |
|
| 1379 | 1435 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1380 | - else |
|
| 1436 | + } else |
|
| 1381 | 1437 | { |
| 1382 | 1438 | echo ' |
| 1383 | 1439 | <dl class="stats">'; |
@@ -1428,90 +1484,97 @@ discard block |
||
| 1428 | 1484 | <h3 class="catbg profile_hd">'; |
| 1429 | 1485 | |
| 1430 | 1486 | // Don't say "Profile" if this isn't the profile... |
| 1431 | - if (!empty($context['profile_header_text'])) |
|
| 1432 | - echo ' |
|
| 1487 | + if (!empty($context['profile_header_text'])) { |
|
| 1488 | + echo ' |
|
| 1433 | 1489 | ', $context['profile_header_text']; |
| 1434 | - else |
|
| 1435 | - echo ' |
|
| 1490 | + } else { |
|
| 1491 | + echo ' |
|
| 1436 | 1492 | ', $txt['profile']; |
| 1493 | + } |
|
| 1437 | 1494 | |
| 1438 | 1495 | echo ' |
| 1439 | 1496 | </h3> |
| 1440 | 1497 | </div>'; |
| 1441 | 1498 | |
| 1442 | 1499 | // Have we some description? |
| 1443 | - if ($context['page_desc']) |
|
| 1444 | - echo ' |
|
| 1500 | + if ($context['page_desc']) { |
|
| 1501 | + echo ' |
|
| 1445 | 1502 | <p class="information">', $context['page_desc'], '</p>'; |
| 1503 | + } |
|
| 1446 | 1504 | |
| 1447 | 1505 | echo ' |
| 1448 | 1506 | <div class="roundframe">'; |
| 1449 | 1507 | |
| 1450 | 1508 | // Any bits at the start? |
| 1451 | - if (!empty($context['profile_prehtml'])) |
|
| 1452 | - echo ' |
|
| 1509 | + if (!empty($context['profile_prehtml'])) { |
|
| 1510 | + echo ' |
|
| 1453 | 1511 | <div>', $context['profile_prehtml'], '</div>'; |
| 1512 | + } |
|
| 1454 | 1513 | |
| 1455 | - if (!empty($context['profile_fields'])) |
|
| 1456 | - echo ' |
|
| 1514 | + if (!empty($context['profile_fields'])) { |
|
| 1515 | + echo ' |
|
| 1457 | 1516 | <dl class="settings">'; |
| 1517 | + } |
|
| 1458 | 1518 | |
| 1459 | 1519 | // Start the big old loop 'of love. |
| 1460 | 1520 | $lastItem = 'hr'; |
| 1461 | 1521 | foreach ($context['profile_fields'] as $key => $field) |
| 1462 | 1522 | { |
| 1463 | 1523 | // We add a little hack to be sure we never get more than one hr in a row! |
| 1464 | - if ($lastItem == 'hr' && $field['type'] == 'hr') |
|
| 1465 | - continue; |
|
| 1524 | + if ($lastItem == 'hr' && $field['type'] == 'hr') { |
|
| 1525 | + continue; |
|
| 1526 | + } |
|
| 1466 | 1527 | |
| 1467 | 1528 | $lastItem = $field['type']; |
| 1468 | - if ($field['type'] == 'hr') |
|
| 1469 | - echo ' |
|
| 1529 | + if ($field['type'] == 'hr') { |
|
| 1530 | + echo ' |
|
| 1470 | 1531 | </dl> |
| 1471 | 1532 | <hr> |
| 1472 | 1533 | <dl class="settings">'; |
| 1473 | - |
|
| 1474 | - elseif ($field['type'] == 'callback') |
|
| 1534 | + } elseif ($field['type'] == 'callback') |
|
| 1475 | 1535 | { |
| 1476 | 1536 | if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) |
| 1477 | 1537 | { |
| 1478 | 1538 | $callback_func = 'template_profile_' . $field['callback_func']; |
| 1479 | 1539 | $callback_func(); |
| 1480 | 1540 | } |
| 1481 | - } |
|
| 1482 | - else |
|
| 1541 | + } else |
|
| 1483 | 1542 | { |
| 1484 | 1543 | echo ' |
| 1485 | 1544 | <dt> |
| 1486 | 1545 | <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>'; |
| 1487 | 1546 | |
| 1488 | 1547 | // Does it have any subtext to show? |
| 1489 | - if (!empty($field['subtext'])) |
|
| 1490 | - echo ' |
|
| 1548 | + if (!empty($field['subtext'])) { |
|
| 1549 | + echo ' |
|
| 1491 | 1550 | <br> |
| 1492 | 1551 | <span class="smalltext">', $field['subtext'], '</span>'; |
| 1552 | + } |
|
| 1493 | 1553 | |
| 1494 | 1554 | echo ' |
| 1495 | 1555 | </dt> |
| 1496 | 1556 | <dd>'; |
| 1497 | 1557 | |
| 1498 | 1558 | // Want to put something infront of the box? |
| 1499 | - if (!empty($field['preinput'])) |
|
| 1500 | - echo ' |
|
| 1559 | + if (!empty($field['preinput'])) { |
|
| 1560 | + echo ' |
|
| 1501 | 1561 | ', $field['preinput']; |
| 1562 | + } |
|
| 1502 | 1563 | |
| 1503 | 1564 | // What type of data are we showing? |
| 1504 | - if ($field['type'] == 'label') |
|
| 1505 | - echo ' |
|
| 1565 | + if ($field['type'] == 'label') { |
|
| 1566 | + echo ' |
|
| 1506 | 1567 | ', $field['value']; |
| 1568 | + } |
|
| 1507 | 1569 | |
| 1508 | 1570 | // Maybe it's a text box - very likely! |
| 1509 | 1571 | elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) |
| 1510 | 1572 | { |
| 1511 | - if ($field['type'] == 'int' || $field['type'] == 'float') |
|
| 1512 | - $type = 'number'; |
|
| 1513 | - else |
|
| 1514 | - $type = $field['type']; |
|
| 1573 | + if ($field['type'] == 'int' || $field['type'] == 'float') { |
|
| 1574 | + $type = 'number'; |
|
| 1575 | + } else { |
|
| 1576 | + $type = $field['type']; |
|
| 1577 | + } |
|
| 1515 | 1578 | $step = $field['type'] == 'float' ? ' step="0.1"' : ''; |
| 1516 | 1579 | |
| 1517 | 1580 | |
@@ -1519,10 +1582,11 @@ discard block |
||
| 1519 | 1582 | <input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>'; |
| 1520 | 1583 | } |
| 1521 | 1584 | // You "checking" me out? ;) |
| 1522 | - elseif ($field['type'] == 'check') |
|
| 1523 | - echo ' |
|
| 1585 | + elseif ($field['type'] == 'check') { |
|
| 1586 | + echo ' |
|
| 1524 | 1587 | <input type="hidden" name="', $key, '" value="0"> |
| 1525 | 1588 | <input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>'; |
| 1589 | + } |
|
| 1526 | 1590 | |
| 1527 | 1591 | // Always fun - select boxes! |
| 1528 | 1592 | elseif ($field['type'] == 'select') |
@@ -1533,14 +1597,16 @@ discard block |
||
| 1533 | 1597 | if (isset($field['options'])) |
| 1534 | 1598 | { |
| 1535 | 1599 | // Is this some code to generate the options? |
| 1536 | - if (!is_array($field['options'])) |
|
| 1537 | - $field['options'] = $field['options'](); |
|
| 1600 | + if (!is_array($field['options'])) { |
|
| 1601 | + $field['options'] = $field['options'](); |
|
| 1602 | + } |
|
| 1538 | 1603 | |
| 1539 | 1604 | // Assuming we now have some! |
| 1540 | - if (is_array($field['options'])) |
|
| 1541 | - foreach ($field['options'] as $value => $name) |
|
| 1605 | + if (is_array($field['options'])) { |
|
| 1606 | + foreach ($field['options'] as $value => $name) |
|
| 1542 | 1607 | echo ' |
| 1543 | 1608 | <option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
| 1609 | + } |
|
| 1544 | 1610 | } |
| 1545 | 1611 | |
| 1546 | 1612 | echo ' |
@@ -1548,31 +1614,34 @@ discard block |
||
| 1548 | 1614 | } |
| 1549 | 1615 | |
| 1550 | 1616 | // Something to end with? |
| 1551 | - if (!empty($field['postinput'])) |
|
| 1552 | - echo ' |
|
| 1617 | + if (!empty($field['postinput'])) { |
|
| 1618 | + echo ' |
|
| 1553 | 1619 | ', $field['postinput']; |
| 1620 | + } |
|
| 1554 | 1621 | |
| 1555 | 1622 | echo ' |
| 1556 | 1623 | </dd>'; |
| 1557 | 1624 | } |
| 1558 | 1625 | } |
| 1559 | 1626 | |
| 1560 | - if (!empty($context['profile_fields'])) |
|
| 1561 | - echo ' |
|
| 1627 | + if (!empty($context['profile_fields'])) { |
|
| 1628 | + echo ' |
|
| 1562 | 1629 | </dl>'; |
| 1630 | + } |
|
| 1563 | 1631 | |
| 1564 | 1632 | // Are there any custom profile fields - if so print them! |
| 1565 | 1633 | if (!empty($context['custom_fields'])) |
| 1566 | 1634 | { |
| 1567 | - if ($lastItem != 'hr') |
|
| 1568 | - echo ' |
|
| 1635 | + if ($lastItem != 'hr') { |
|
| 1636 | + echo ' |
|
| 1569 | 1637 | <hr>'; |
| 1638 | + } |
|
| 1570 | 1639 | |
| 1571 | 1640 | echo ' |
| 1572 | 1641 | <dl class="settings">'; |
| 1573 | 1642 | |
| 1574 | - foreach ($context['custom_fields'] as $field) |
|
| 1575 | - echo ' |
|
| 1643 | + foreach ($context['custom_fields'] as $field) { |
|
| 1644 | + echo ' |
|
| 1576 | 1645 | <dt> |
| 1577 | 1646 | <strong>', $field['name'], ': </strong><br> |
| 1578 | 1647 | <span class="smalltext">', $field['desc'], '</span> |
@@ -1580,6 +1649,7 @@ discard block |
||
| 1580 | 1649 | <dd> |
| 1581 | 1650 | ', $field['input_html'], ' |
| 1582 | 1651 | </dd>'; |
| 1652 | + } |
|
| 1583 | 1653 | |
| 1584 | 1654 | echo ' |
| 1585 | 1655 | </dl>'; |
@@ -1587,13 +1657,14 @@ discard block |
||
| 1587 | 1657 | } |
| 1588 | 1658 | |
| 1589 | 1659 | // Any closing HTML? |
| 1590 | - if (!empty($context['profile_posthtml'])) |
|
| 1591 | - echo ' |
|
| 1660 | + if (!empty($context['profile_posthtml'])) { |
|
| 1661 | + echo ' |
|
| 1592 | 1662 | <div>', $context['profile_posthtml'], '</div>'; |
| 1663 | + } |
|
| 1593 | 1664 | |
| 1594 | 1665 | // Only show the password box if it's actually needed. |
| 1595 | - if ($context['require_password']) |
|
| 1596 | - echo ' |
|
| 1666 | + if ($context['require_password']) { |
|
| 1667 | + echo ' |
|
| 1597 | 1668 | <dl class="settings"> |
| 1598 | 1669 | <dt> |
| 1599 | 1670 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br> |
@@ -1603,18 +1674,21 @@ discard block |
||
| 1603 | 1674 | <input type="password" name="oldpasswrd" id="oldpasswrd" size="20"> |
| 1604 | 1675 | </dd> |
| 1605 | 1676 | </dl>'; |
| 1677 | + } |
|
| 1606 | 1678 | |
| 1607 | 1679 | // The button shouldn't say "Change profile" unless we're changing the profile... |
| 1608 | - if (!empty($context['submit_button_text'])) |
|
| 1609 | - echo ' |
|
| 1680 | + if (!empty($context['submit_button_text'])) { |
|
| 1681 | + echo ' |
|
| 1610 | 1682 | <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button">'; |
| 1611 | - else |
|
| 1612 | - echo ' |
|
| 1683 | + } else { |
|
| 1684 | + echo ' |
|
| 1613 | 1685 | <input type="submit" name="save" value="', $txt['change_profile'], '" class="button">'; |
| 1686 | + } |
|
| 1614 | 1687 | |
| 1615 | - if (!empty($context['token_check'])) |
|
| 1616 | - echo ' |
|
| 1688 | + if (!empty($context['token_check'])) { |
|
| 1689 | + echo ' |
|
| 1617 | 1690 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 1691 | + } |
|
| 1618 | 1692 | |
| 1619 | 1693 | echo ' |
| 1620 | 1694 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1624,10 +1698,11 @@ discard block |
||
| 1624 | 1698 | </form>'; |
| 1625 | 1699 | |
| 1626 | 1700 | // Any final spellchecking stuff? |
| 1627 | - if (!empty($context['show_spellchecking'])) |
|
| 1628 | - echo ' |
|
| 1701 | + if (!empty($context['show_spellchecking'])) { |
|
| 1702 | + echo ' |
|
| 1629 | 1703 | <form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>'; |
| 1630 | -} |
|
| 1704 | + } |
|
| 1705 | + } |
|
| 1631 | 1706 | |
| 1632 | 1707 | /** |
| 1633 | 1708 | * Personal Message settings. |
@@ -1664,10 +1739,11 @@ discard block |
||
| 1664 | 1739 | <select name="pm_receive_from" id="pm_receive_from"> |
| 1665 | 1740 | <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>'; |
| 1666 | 1741 | |
| 1667 | - if (!empty($modSettings['enable_buddylist'])) |
|
| 1668 | - echo ' |
|
| 1742 | + if (!empty($modSettings['enable_buddylist'])) { |
|
| 1743 | + echo ' |
|
| 1669 | 1744 | <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option> |
| 1670 | 1745 | <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>'; |
| 1746 | + } |
|
| 1671 | 1747 | |
| 1672 | 1748 | echo ' |
| 1673 | 1749 | <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option> |
@@ -1710,11 +1786,12 @@ discard block |
||
| 1710 | 1786 | if (empty($setting) || !is_array($setting)) |
| 1711 | 1787 | { |
| 1712 | 1788 | // Insert a separator (unless this is the first item in the list) |
| 1713 | - if ($i !== $first_option_key) |
|
| 1714 | - echo ' |
|
| 1789 | + if ($i !== $first_option_key) { |
|
| 1790 | + echo ' |
|
| 1715 | 1791 | </dl> |
| 1716 | 1792 | <hr> |
| 1717 | 1793 | <dl class="settings">'; |
| 1794 | + } |
|
| 1718 | 1795 | |
| 1719 | 1796 | // Should we give a name to this section? |
| 1720 | 1797 | if (is_string($setting) && !empty($setting)) |
@@ -1723,69 +1800,67 @@ discard block |
||
| 1723 | 1800 | echo ' |
| 1724 | 1801 | <dt><strong>' . $setting . '</strong></dt> |
| 1725 | 1802 | <dd></dd>'; |
| 1803 | + } else { |
|
| 1804 | + $titled_section = false; |
|
| 1726 | 1805 | } |
| 1727 | - else |
|
| 1728 | - $titled_section = false; |
|
| 1729 | 1806 | |
| 1730 | 1807 | continue; |
| 1731 | 1808 | } |
| 1732 | 1809 | |
| 1733 | 1810 | // Is this disabled? |
| 1734 | - if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) |
|
| 1735 | - continue; |
|
| 1736 | - |
|
| 1737 | - elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) |
|
| 1738 | - continue; |
|
| 1739 | - |
|
| 1740 | - elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) |
|
| 1741 | - continue; |
|
| 1742 | - |
|
| 1743 | - elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) |
|
| 1744 | - continue; |
|
| 1745 | - |
|
| 1746 | - elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) |
|
| 1747 | - continue; |
|
| 1748 | - |
|
| 1749 | - elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
| 1750 | - continue; |
|
| 1751 | - |
|
| 1752 | - elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
| 1753 | - continue; |
|
| 1811 | + if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) { |
|
| 1812 | + continue; |
|
| 1813 | + } elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) { |
|
| 1814 | + continue; |
|
| 1815 | + } elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) { |
|
| 1816 | + continue; |
|
| 1817 | + } elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) { |
|
| 1818 | + continue; |
|
| 1819 | + } elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) { |
|
| 1820 | + continue; |
|
| 1821 | + } elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
| 1822 | + continue; |
|
| 1823 | + } elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
| 1824 | + continue; |
|
| 1825 | + } |
|
| 1754 | 1826 | |
| 1755 | 1827 | // Some of these may not be set... Set to defaults here |
| 1756 | 1828 | $opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod'); |
| 1757 | - if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) |
|
| 1758 | - $context['member']['options'][$setting['id']] = 0; |
|
| 1759 | - |
|
| 1760 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
| 1761 | - $setting['type'] = 'checkbox'; |
|
| 1762 | - |
|
| 1763 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
| 1764 | - $setting['type'] = 'number'; |
|
| 1829 | + if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) { |
|
| 1830 | + $context['member']['options'][$setting['id']] = 0; |
|
| 1831 | + } |
|
| 1765 | 1832 | |
| 1766 | - elseif ($setting['type'] == 'string') |
|
| 1767 | - $setting['type'] = 'text'; |
|
| 1833 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
| 1834 | + $setting['type'] = 'checkbox'; |
|
| 1835 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
| 1836 | + $setting['type'] = 'number'; |
|
| 1837 | + } elseif ($setting['type'] == 'string') { |
|
| 1838 | + $setting['type'] = 'text'; |
|
| 1839 | + } |
|
| 1768 | 1840 | |
| 1769 | - if (isset($setting['options'])) |
|
| 1770 | - $setting['type'] = 'list'; |
|
| 1841 | + if (isset($setting['options'])) { |
|
| 1842 | + $setting['type'] = 'list'; |
|
| 1843 | + } |
|
| 1771 | 1844 | |
| 1772 | 1845 | echo ' |
| 1773 | 1846 | <dt> |
| 1774 | 1847 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
| 1775 | 1848 | |
| 1776 | - if (isset($setting['description'])) |
|
| 1777 | - echo ' |
|
| 1849 | + if (isset($setting['description'])) { |
|
| 1850 | + echo ' |
|
| 1778 | 1851 | <br> |
| 1779 | 1852 | <span class="smalltext">', $setting['description'], '</span>'; |
| 1853 | + } |
|
| 1780 | 1854 | echo ' |
| 1781 | 1855 | </dt> |
| 1782 | 1856 | <dd>'; |
| 1783 | 1857 | |
| 1784 | 1858 | // Display checkbox options |
| 1785 | - if ($setting['type'] == 'checkbox') |
|
| 1786 | - echo ' |
|
| 1859 | + if ($setting['type'] == 'checkbox') { |
|
| 1860 | + echo ' |
|
| 1787 | 1861 | <input type="hidden" name="default_options[' . $setting['id'] . ']" value="0"> |
| 1788 | 1862 | <input type="checkbox" name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($context['member']['options'][$setting['id']]) ? ' checked' : '', ' value="1">'; |
| 1863 | + } |
|
| 1789 | 1864 | |
| 1790 | 1865 | // How about selection lists, we all love them |
| 1791 | 1866 | elseif ($setting['type'] == 'list') |
@@ -1793,9 +1868,10 @@ discard block |
||
| 1793 | 1868 | echo ' |
| 1794 | 1869 | <select name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', '>'; |
| 1795 | 1870 | |
| 1796 | - foreach ($setting['options'] as $value => $label) |
|
| 1797 | - echo ' |
|
| 1871 | + foreach ($setting['options'] as $value => $label) { |
|
| 1872 | + echo ' |
|
| 1798 | 1873 | <option value="', $value, '"', $value == $context['member']['options'][$setting['id']] ? ' selected' : '', '>', $label, '</option>'; |
| 1874 | + } |
|
| 1799 | 1875 | |
| 1800 | 1876 | echo ' |
| 1801 | 1877 | </select>'; |
@@ -1811,14 +1887,13 @@ discard block |
||
| 1811 | 1887 | |
| 1812 | 1888 | echo ' |
| 1813 | 1889 | <input type="number"', $min . $max . $step; |
| 1814 | - } |
|
| 1815 | - elseif (isset($setting['type']) && $setting['type'] == 'url') |
|
| 1816 | - echo' |
|
| 1890 | + } elseif (isset($setting['type']) && $setting['type'] == 'url') { |
|
| 1891 | + echo' |
|
| 1817 | 1892 | <input type="url"'; |
| 1818 | - |
|
| 1819 | - else |
|
| 1820 | - echo ' |
|
| 1893 | + } else { |
|
| 1894 | + echo ' |
|
| 1821 | 1895 | <input type="text"'; |
| 1896 | + } |
|
| 1822 | 1897 | |
| 1823 | 1898 | echo ' name="default_options[', $setting['id'], ']" id="', $setting['id'], '" value="', isset($context['member']['options'][$setting['id']]) ? $context['member']['options'][$setting['id']] : $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : '', '>'; |
| 1824 | 1899 | } |
@@ -1855,8 +1930,8 @@ discard block |
||
| 1855 | 1930 | <dl class="settings">'; |
| 1856 | 1931 | |
| 1857 | 1932 | // Allow notification on announcements to be disabled? |
| 1858 | - if (!empty($modSettings['allow_disableAnnounce'])) |
|
| 1859 | - echo ' |
|
| 1933 | + if (!empty($modSettings['allow_disableAnnounce'])) { |
|
| 1934 | + echo ' |
|
| 1860 | 1935 | <dt> |
| 1861 | 1936 | <label for="notify_announcements">', $txt['notify_important_email'], '</label> |
| 1862 | 1937 | </dt> |
@@ -1864,15 +1939,17 @@ discard block |
||
| 1864 | 1939 | <input type="hidden" name="notify_announcements" value="0"> |
| 1865 | 1940 | <input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '> |
| 1866 | 1941 | </dd>'; |
| 1942 | + } |
|
| 1867 | 1943 | |
| 1868 | - if (!empty($modSettings['enable_ajax_alerts'])) |
|
| 1869 | - echo ' |
|
| 1944 | + if (!empty($modSettings['enable_ajax_alerts'])) { |
|
| 1945 | + echo ' |
|
| 1870 | 1946 | <dt> |
| 1871 | 1947 | <label for="notify_send_body">', $txt['notify_alert_timeout'], '</label> |
| 1872 | 1948 | </dt> |
| 1873 | 1949 | <dd> |
| 1874 | 1950 | <input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '"> |
| 1875 | 1951 | </dd>'; |
| 1952 | + } |
|
| 1876 | 1953 | |
| 1877 | 1954 | echo ' |
| 1878 | 1955 | </dl> |
@@ -1904,9 +1981,10 @@ discard block |
||
| 1904 | 1981 | |
| 1905 | 1982 | $label = $txt['alert_opt_' . $opts[1]]; |
| 1906 | 1983 | $label_pos = isset($opts['label']) ? $opts['label'] : ''; |
| 1907 | - if ($label_pos == 'before') |
|
| 1908 | - echo ' |
|
| 1984 | + if ($label_pos == 'before') { |
|
| 1985 | + echo ' |
|
| 1909 | 1986 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
| 1987 | + } |
|
| 1910 | 1988 | |
| 1911 | 1989 | $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; |
| 1912 | 1990 | switch ($opts[0]) |
@@ -1920,17 +1998,19 @@ discard block |
||
| 1920 | 1998 | echo ' |
| 1921 | 1999 | <select name="opt_', $opts[1], '" id="opt_', $opts[1], '">'; |
| 1922 | 2000 | |
| 1923 | - foreach ($opts['opts'] as $k => $v) |
|
| 1924 | - echo ' |
|
| 2001 | + foreach ($opts['opts'] as $k => $v) { |
|
| 2002 | + echo ' |
|
| 1925 | 2003 | <option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>'; |
| 2004 | + } |
|
| 1926 | 2005 | echo ' |
| 1927 | 2006 | </select>'; |
| 1928 | 2007 | break; |
| 1929 | 2008 | } |
| 1930 | 2009 | |
| 1931 | - if ($label_pos == 'after') |
|
| 1932 | - echo ' |
|
| 2010 | + if ($label_pos == 'after') { |
|
| 2011 | + echo ' |
|
| 1933 | 2012 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
| 2013 | + } |
|
| 1934 | 2014 | |
| 1935 | 2015 | echo ' |
| 1936 | 2016 | </td> |
@@ -2047,11 +2127,12 @@ discard block |
||
| 2047 | 2127 | <p class="information">', $txt['groupMembership_info'], '</p>'; |
| 2048 | 2128 | |
| 2049 | 2129 | // Do we have an update message? |
| 2050 | - if (!empty($context['update_message'])) |
|
| 2051 | - echo ' |
|
| 2130 | + if (!empty($context['update_message'])) { |
|
| 2131 | + echo ' |
|
| 2052 | 2132 | <div class="infobox"> |
| 2053 | 2133 | ', $context['update_message'], '. |
| 2054 | 2134 | </div>'; |
| 2135 | + } |
|
| 2055 | 2136 | |
| 2056 | 2137 | echo ' |
| 2057 | 2138 | <div id="groups">'; |
@@ -2073,8 +2154,7 @@ discard block |
||
| 2073 | 2154 | </div> |
| 2074 | 2155 | </div> |
| 2075 | 2156 | </div><!-- .groupmembership -->'; |
| 2076 | - } |
|
| 2077 | - else |
|
| 2157 | + } else |
|
| 2078 | 2158 | { |
| 2079 | 2159 | echo ' |
| 2080 | 2160 | <div class="title_bar"> |
@@ -2086,27 +2166,30 @@ discard block |
||
| 2086 | 2166 | echo ' |
| 2087 | 2167 | <div class="windowbg" id="primdiv_', $group['id'], '">'; |
| 2088 | 2168 | |
| 2089 | - if ($context['can_edit_primary']) |
|
| 2090 | - echo ' |
|
| 2169 | + if ($context['can_edit_primary']) { |
|
| 2170 | + echo ' |
|
| 2091 | 2171 | <input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>'; |
| 2172 | + } |
|
| 2092 | 2173 | |
| 2093 | 2174 | echo ' |
| 2094 | 2175 | <label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>'; |
| 2095 | 2176 | |
| 2096 | 2177 | // Can they leave their group? |
| 2097 | - if ($group['can_leave']) |
|
| 2098 | - echo ' |
|
| 2178 | + if ($group['can_leave']) { |
|
| 2179 | + echo ' |
|
| 2099 | 2180 | <a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>'; |
| 2181 | + } |
|
| 2100 | 2182 | |
| 2101 | 2183 | echo ' |
| 2102 | 2184 | </div><!-- .windowbg -->'; |
| 2103 | 2185 | } |
| 2104 | 2186 | |
| 2105 | - if ($context['can_edit_primary']) |
|
| 2106 | - echo ' |
|
| 2187 | + if ($context['can_edit_primary']) { |
|
| 2188 | + echo ' |
|
| 2107 | 2189 | <div class="padding righttext"> |
| 2108 | 2190 | <input type="submit" value="', $txt['make_primary'], '" class="button"> |
| 2109 | 2191 | </div>'; |
| 2192 | + } |
|
| 2110 | 2193 | |
| 2111 | 2194 | // Any groups they can join? |
| 2112 | 2195 | if (!empty($context['groups']['available'])) |
@@ -2122,17 +2205,16 @@ discard block |
||
| 2122 | 2205 | <div class="windowbg"> |
| 2123 | 2206 | <strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), ''; |
| 2124 | 2207 | |
| 2125 | - if ($group['type'] == 3) |
|
| 2126 | - echo ' |
|
| 2208 | + if ($group['type'] == 3) { |
|
| 2209 | + echo ' |
|
| 2127 | 2210 | <a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>'; |
| 2128 | - |
|
| 2129 | - elseif ($group['type'] == 2 && $group['pending']) |
|
| 2130 | - echo ' |
|
| 2211 | + } elseif ($group['type'] == 2 && $group['pending']) { |
|
| 2212 | + echo ' |
|
| 2131 | 2213 | <span class="floatright">', $txt['approval_pending'], '</span>'; |
| 2132 | - |
|
| 2133 | - elseif ($group['type'] == 2) |
|
| 2134 | - echo ' |
|
| 2214 | + } elseif ($group['type'] == 2) { |
|
| 2215 | + echo ' |
|
| 2135 | 2216 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>'; |
| 2217 | + } |
|
| 2136 | 2218 | |
| 2137 | 2219 | echo ' |
| 2138 | 2220 | </div><!-- .windowbg -->'; |
@@ -2155,9 +2237,10 @@ discard block |
||
| 2155 | 2237 | |
| 2156 | 2238 | prevDiv.className = "windowbg"; |
| 2157 | 2239 | }'; |
| 2158 | - if (isset($context['groups']['member'][$context['primary_group']])) |
|
| 2159 | - echo ' |
|
| 2240 | + if (isset($context['groups']['member'][$context['primary_group']])) { |
|
| 2241 | + echo ' |
|
| 2160 | 2242 | highlightSelected("primdiv_' . $context['primary_group'] . '");'; |
| 2243 | + } |
|
| 2161 | 2244 | |
| 2162 | 2245 | echo ' |
| 2163 | 2246 | </script>'; |
@@ -2166,9 +2249,10 @@ discard block |
||
| 2166 | 2249 | echo ' |
| 2167 | 2250 | </div><!-- #groups -->'; |
| 2168 | 2251 | |
| 2169 | - if (!empty($context['token_check'])) |
|
| 2170 | - echo ' |
|
| 2252 | + if (!empty($context['token_check'])) { |
|
| 2253 | + echo ' |
|
| 2171 | 2254 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2255 | + } |
|
| 2172 | 2256 | |
| 2173 | 2257 | echo ' |
| 2174 | 2258 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2216,14 +2300,15 @@ discard block |
||
| 2216 | 2300 | |
| 2217 | 2301 | foreach ($category['boards'] as $board) |
| 2218 | 2302 | { |
| 2219 | - if ($i == $limit) |
|
| 2220 | - echo ' |
|
| 2303 | + if ($i == $limit) { |
|
| 2304 | + echo ' |
|
| 2221 | 2305 | </ul> |
| 2222 | 2306 | </li> |
| 2223 | 2307 | </ul> |
| 2224 | 2308 | <ul class="ignoreboards floatright"> |
| 2225 | 2309 | <li class="category"> |
| 2226 | 2310 | <ul>'; |
| 2311 | + } |
|
| 2227 | 2312 | |
| 2228 | 2313 | echo ' |
| 2229 | 2314 | <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"> |
@@ -2269,10 +2354,11 @@ discard block |
||
| 2269 | 2354 | |
| 2270 | 2355 | // Work out the starting color. |
| 2271 | 2356 | $context['current_color'] = $context['colors'][0]; |
| 2272 | - foreach ($context['colors'] as $limit => $color) |
|
| 2273 | - if ($context['member']['warning'] >= $limit) |
|
| 2357 | + foreach ($context['colors'] as $limit => $color) { |
|
| 2358 | + if ($context['member']['warning'] >= $limit) |
|
| 2274 | 2359 | $context['current_color'] = $color; |
| 2275 | -} |
|
| 2360 | + } |
|
| 2361 | + } |
|
| 2276 | 2362 | |
| 2277 | 2363 | // Show all warnings of a user? |
| 2278 | 2364 | function template_viewWarning() |
@@ -2311,14 +2397,15 @@ discard block |
||
| 2311 | 2397 | </dd>'; |
| 2312 | 2398 | |
| 2313 | 2399 | // There's some impact of this? |
| 2314 | - if (!empty($context['level_effects'][$context['current_level']])) |
|
| 2315 | - echo ' |
|
| 2400 | + if (!empty($context['level_effects'][$context['current_level']])) { |
|
| 2401 | + echo ' |
|
| 2316 | 2402 | <dt> |
| 2317 | 2403 | <strong>', $txt['profile_viewwarning_impact'], ':</strong> |
| 2318 | 2404 | </dt> |
| 2319 | 2405 | <dd> |
| 2320 | 2406 | ', $context['level_effects'][$context['current_level']], ' |
| 2321 | 2407 | </dd>'; |
| 2408 | + } |
|
| 2322 | 2409 | |
| 2323 | 2410 | echo ' |
| 2324 | 2411 | </dl> |
@@ -2356,10 +2443,11 @@ discard block |
||
| 2356 | 2443 | |
| 2357 | 2444 | // Otherwise see what we can do...'; |
| 2358 | 2445 | |
| 2359 | - foreach ($context['notification_templates'] as $k => $type) |
|
| 2360 | - echo ' |
|
| 2446 | + foreach ($context['notification_templates'] as $k => $type) { |
|
| 2447 | + echo ' |
|
| 2361 | 2448 | if (index == ', $k, ') |
| 2362 | 2449 | document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; |
| 2450 | + } |
|
| 2363 | 2451 | |
| 2364 | 2452 | echo ' |
| 2365 | 2453 | } |
@@ -2369,10 +2457,11 @@ discard block |
||
| 2369 | 2457 | // Also set the right effect. |
| 2370 | 2458 | effectText = "";'; |
| 2371 | 2459 | |
| 2372 | - foreach ($context['level_effects'] as $limit => $text) |
|
| 2373 | - echo ' |
|
| 2460 | + foreach ($context['level_effects'] as $limit => $text) { |
|
| 2461 | + echo ' |
|
| 2374 | 2462 | if (slideAmount >= ', $limit, ') |
| 2375 | 2463 | effectText = "', $text, '";'; |
| 2464 | + } |
|
| 2376 | 2465 | |
| 2377 | 2466 | echo ' |
| 2378 | 2467 | setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\'); |
@@ -2387,32 +2476,35 @@ discard block |
||
| 2387 | 2476 | </h3> |
| 2388 | 2477 | </div>'; |
| 2389 | 2478 | |
| 2390 | - if (!$context['user']['is_owner']) |
|
| 2391 | - echo ' |
|
| 2479 | + if (!$context['user']['is_owner']) { |
|
| 2480 | + echo ' |
|
| 2392 | 2481 | <p class="information">', $txt['profile_warning_desc'], '</p>'; |
| 2482 | + } |
|
| 2393 | 2483 | |
| 2394 | 2484 | echo ' |
| 2395 | 2485 | <div class="windowbg"> |
| 2396 | 2486 | <dl class="settings">'; |
| 2397 | 2487 | |
| 2398 | - if (!$context['user']['is_owner']) |
|
| 2399 | - echo ' |
|
| 2488 | + if (!$context['user']['is_owner']) { |
|
| 2489 | + echo ' |
|
| 2400 | 2490 | <dt> |
| 2401 | 2491 | <strong>', $txt['profile_warning_name'], ':</strong> |
| 2402 | 2492 | </dt> |
| 2403 | 2493 | <dd> |
| 2404 | 2494 | <strong>', $context['member']['name'], '</strong> |
| 2405 | 2495 | </dd>'; |
| 2496 | + } |
|
| 2406 | 2497 | |
| 2407 | 2498 | echo ' |
| 2408 | 2499 | <dt> |
| 2409 | 2500 | <strong>', $txt['profile_warning_level'], ':</strong>'; |
| 2410 | 2501 | |
| 2411 | 2502 | // Is there only so much they can apply? |
| 2412 | - if ($context['warning_limit']) |
|
| 2413 | - echo ' |
|
| 2503 | + if ($context['warning_limit']) { |
|
| 2504 | + echo ' |
|
| 2414 | 2505 | <br> |
| 2415 | 2506 | <span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; |
| 2507 | + } |
|
| 2416 | 2508 | |
| 2417 | 2509 | echo ' |
| 2418 | 2510 | </dt> |
@@ -2467,9 +2559,10 @@ discard block |
||
| 2467 | 2559 | <option value="-1">', $txt['profile_warning_notify_template'], '</option> |
| 2468 | 2560 | <option value="-1" disabled>------------------------------</option>'; |
| 2469 | 2561 | |
| 2470 | - foreach ($context['notification_templates'] as $id_template => $template) |
|
| 2471 | - echo ' |
|
| 2562 | + foreach ($context['notification_templates'] as $id_template => $template) { |
|
| 2563 | + echo ' |
|
| 2472 | 2564 | <option value="', $id_template, '">', $template['title'], '</option>'; |
| 2565 | + } |
|
| 2473 | 2566 | |
| 2474 | 2567 | echo ' |
| 2475 | 2568 | </select> |
@@ -2482,9 +2575,10 @@ discard block |
||
| 2482 | 2575 | </dl> |
| 2483 | 2576 | <div class="righttext">'; |
| 2484 | 2577 | |
| 2485 | - if (!empty($context['token_check'])) |
|
| 2486 | - echo ' |
|
| 2578 | + if (!empty($context['token_check'])) { |
|
| 2579 | + echo ' |
|
| 2487 | 2580 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2581 | + } |
|
| 2488 | 2582 | |
| 2489 | 2583 | echo ' |
| 2490 | 2584 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2500,8 +2594,8 @@ discard block |
||
| 2500 | 2594 | echo ' |
| 2501 | 2595 | <script>'; |
| 2502 | 2596 | |
| 2503 | - if (!$context['user']['is_owner']) |
|
| 2504 | - echo ' |
|
| 2597 | + if (!$context['user']['is_owner']) { |
|
| 2598 | + echo ' |
|
| 2505 | 2599 | modifyWarnNotify(); |
| 2506 | 2600 | $(document).ready(function() { |
| 2507 | 2601 | $("#preview_button").click(function() { |
@@ -2540,6 +2634,7 @@ discard block |
||
| 2540 | 2634 | }); |
| 2541 | 2635 | return false; |
| 2542 | 2636 | }'; |
| 2637 | + } |
|
| 2543 | 2638 | |
| 2544 | 2639 | echo ' |
| 2545 | 2640 | </script>'; |
@@ -2562,17 +2657,19 @@ discard block |
||
| 2562 | 2657 | </div>'; |
| 2563 | 2658 | |
| 2564 | 2659 | // If deleting another account give them a lovely info box. |
| 2565 | - if (!$context['user']['is_owner']) |
|
| 2566 | - echo ' |
|
| 2660 | + if (!$context['user']['is_owner']) { |
|
| 2661 | + echo ' |
|
| 2567 | 2662 | <p class="information">', $txt['deleteAccount_desc'], '</p>'; |
| 2663 | + } |
|
| 2568 | 2664 | |
| 2569 | 2665 | echo ' |
| 2570 | 2666 | <div class="windowbg2">'; |
| 2571 | 2667 | |
| 2572 | 2668 | // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) |
| 2573 | - if ($context['needs_approval']) |
|
| 2574 | - echo ' |
|
| 2669 | + if ($context['needs_approval']) { |
|
| 2670 | + echo ' |
|
| 2575 | 2671 | <div class="errorbox">', $txt['deleteAccount_approval'], '</div>'; |
| 2672 | + } |
|
| 2576 | 2673 | |
| 2577 | 2674 | // If the user is deleting their own account warn them first - and require a password! |
| 2578 | 2675 | if ($context['user']['is_owner']) |
@@ -2584,9 +2681,10 @@ discard block |
||
| 2584 | 2681 | <input type="password" name="oldpasswrd" size="20"> |
| 2585 | 2682 | <input type="submit" value="', $txt['yes'], '" class="button">'; |
| 2586 | 2683 | |
| 2587 | - if (!empty($context['token_check'])) |
|
| 2588 | - echo ' |
|
| 2684 | + if (!empty($context['token_check'])) { |
|
| 2685 | + echo ' |
|
| 2589 | 2686 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2687 | + } |
|
| 2590 | 2688 | |
| 2591 | 2689 | echo ' |
| 2592 | 2690 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2616,10 +2714,11 @@ discard block |
||
| 2616 | 2714 | <option value="topics">', $txt['deleteAccount_topics'], '</option> |
| 2617 | 2715 | </select>'; |
| 2618 | 2716 | |
| 2619 | - if ($context['show_perma_delete']) |
|
| 2620 | - echo ' |
|
| 2717 | + if ($context['show_perma_delete']) { |
|
| 2718 | + echo ' |
|
| 2621 | 2719 | <br> |
| 2622 | 2720 | <label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>'; |
| 2721 | + } |
|
| 2623 | 2722 | |
| 2624 | 2723 | echo ' |
| 2625 | 2724 | </div>'; |
@@ -2632,9 +2731,10 @@ discard block |
||
| 2632 | 2731 | <div> |
| 2633 | 2732 | <input type="submit" value="', $txt['delete'], '" class="button">'; |
| 2634 | 2733 | |
| 2635 | - if (!empty($context['token_check'])) |
|
| 2636 | - echo ' |
|
| 2734 | + if (!empty($context['token_check'])) { |
|
| 2735 | + echo ' |
|
| 2637 | 2736 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2737 | + } |
|
| 2638 | 2738 | |
| 2639 | 2739 | echo ' |
| 2640 | 2740 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2660,8 +2760,8 @@ discard block |
||
| 2660 | 2760 | <hr>'; |
| 2661 | 2761 | |
| 2662 | 2762 | // Only show the password box if it's actually needed. |
| 2663 | - if ($context['require_password']) |
|
| 2664 | - echo ' |
|
| 2763 | + if ($context['require_password']) { |
|
| 2764 | + echo ' |
|
| 2665 | 2765 | <dl class="settings"> |
| 2666 | 2766 | <dt> |
| 2667 | 2767 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br> |
@@ -2671,13 +2771,15 @@ discard block |
||
| 2671 | 2771 | <input type="password" name="oldpasswrd" size="20"> |
| 2672 | 2772 | </dd> |
| 2673 | 2773 | </dl>'; |
| 2774 | + } |
|
| 2674 | 2775 | |
| 2675 | 2776 | echo ' |
| 2676 | 2777 | <div class="righttext">'; |
| 2677 | 2778 | |
| 2678 | - if (!empty($context['token_check'])) |
|
| 2679 | - echo ' |
|
| 2779 | + if (!empty($context['token_check'])) { |
|
| 2780 | + echo ' |
|
| 2680 | 2781 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2782 | + } |
|
| 2681 | 2783 | |
| 2682 | 2784 | echo ' |
| 2683 | 2785 | <input type="submit" value="', $txt['change_profile'], '" class="button"> |
@@ -2704,9 +2806,10 @@ discard block |
||
| 2704 | 2806 | <ul id="list_errors">'; |
| 2705 | 2807 | |
| 2706 | 2808 | // Cycle through each error and display an error message. |
| 2707 | - foreach ($context['post_errors'] as $error) |
|
| 2708 | - echo ' |
|
| 2809 | + foreach ($context['post_errors'] as $error) { |
|
| 2810 | + echo ' |
|
| 2709 | 2811 | <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>'; |
| 2812 | + } |
|
| 2710 | 2813 | |
| 2711 | 2814 | echo ' |
| 2712 | 2815 | </ul>'; |
@@ -2732,12 +2835,13 @@ discard block |
||
| 2732 | 2835 | <select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 && !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>'; |
| 2733 | 2836 | |
| 2734 | 2837 | // Fill the select box with all primary member groups that can be assigned to a member. |
| 2735 | - foreach ($context['member_groups'] as $member_group) |
|
| 2736 | - if (!empty($member_group['can_be_primary'])) |
|
| 2838 | + foreach ($context['member_groups'] as $member_group) { |
|
| 2839 | + if (!empty($member_group['can_be_primary'])) |
|
| 2737 | 2840 | echo ' |
| 2738 | 2841 | <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '> |
| 2739 | 2842 | ', $member_group['name'], ' |
| 2740 | 2843 | </option>'; |
| 2844 | + } |
|
| 2741 | 2845 | |
| 2742 | 2846 | echo ' |
| 2743 | 2847 | </select> |
@@ -2750,10 +2854,11 @@ discard block |
||
| 2750 | 2854 | <input type="hidden" name="additional_groups[]" value="0">'; |
| 2751 | 2855 | |
| 2752 | 2856 | // For each membergroup show a checkbox so members can be assigned to more than one group. |
| 2753 | - foreach ($context['member_groups'] as $member_group) |
|
| 2754 | - if ($member_group['can_be_additional']) |
|
| 2857 | + foreach ($context['member_groups'] as $member_group) { |
|
| 2858 | + if ($member_group['can_be_additional']) |
|
| 2755 | 2859 | echo ' |
| 2756 | 2860 | <label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>'; |
| 2861 | + } |
|
| 2757 | 2862 | |
| 2758 | 2863 | echo ' |
| 2759 | 2864 | </span> |
@@ -2813,9 +2918,10 @@ discard block |
||
| 2813 | 2918 | <span class="smalltext">', $txt['sig_info'], '</span><br> |
| 2814 | 2919 | <br>'; |
| 2815 | 2920 | |
| 2816 | - if ($context['show_spellchecking']) |
|
| 2817 | - echo ' |
|
| 2921 | + if ($context['show_spellchecking']) { |
|
| 2922 | + echo ' |
|
| 2818 | 2923 | <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">'; |
| 2924 | + } |
|
| 2819 | 2925 | |
| 2820 | 2926 | echo ' |
| 2821 | 2927 | </dt> |
@@ -2823,17 +2929,20 @@ discard block |
||
| 2823 | 2929 | <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>'; |
| 2824 | 2930 | |
| 2825 | 2931 | // If there is a limit at all! |
| 2826 | - if (!empty($context['signature_limits']['max_length'])) |
|
| 2827 | - echo ' |
|
| 2932 | + if (!empty($context['signature_limits']['max_length'])) { |
|
| 2933 | + echo ' |
|
| 2828 | 2934 | <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>'; |
| 2935 | + } |
|
| 2829 | 2936 | |
| 2830 | - if (!empty($context['show_preview_button'])) |
|
| 2831 | - echo ' |
|
| 2937 | + if (!empty($context['show_preview_button'])) { |
|
| 2938 | + echo ' |
|
| 2832 | 2939 | <input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button">'; |
| 2940 | + } |
|
| 2833 | 2941 | |
| 2834 | - if ($context['signature_warning']) |
|
| 2835 | - echo ' |
|
| 2942 | + if ($context['signature_warning']) { |
|
| 2943 | + echo ' |
|
| 2836 | 2944 | <span class="smalltext">', $context['signature_warning'], '</span>'; |
| 2945 | + } |
|
| 2837 | 2946 | |
| 2838 | 2947 | // Some javascript used to count how many characters have been used so far in the signature. |
| 2839 | 2948 | echo ' |
@@ -2878,9 +2987,10 @@ discard block |
||
| 2878 | 2987 | <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">'; |
| 2879 | 2988 | |
| 2880 | 2989 | // This lists all the file categories. |
| 2881 | - foreach ($context['avatars'] as $avatar) |
|
| 2882 | - echo ' |
|
| 2990 | + foreach ($context['avatars'] as $avatar) { |
|
| 2991 | + echo ' |
|
| 2883 | 2992 | <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>'; |
| 2993 | + } |
|
| 2884 | 2994 | |
| 2885 | 2995 | echo ' |
| 2886 | 2996 | </select> |
@@ -2912,20 +3022,22 @@ discard block |
||
| 2912 | 3022 | } |
| 2913 | 3023 | |
| 2914 | 3024 | // If the user can link to an off server avatar, show them a box to input the address. |
| 2915 | - if (!empty($context['member']['avatar']['allow_external'])) |
|
| 2916 | - echo ' |
|
| 3025 | + if (!empty($context['member']['avatar']['allow_external'])) { |
|
| 3026 | + echo ' |
|
| 2917 | 3027 | <div id="avatar_external"> |
| 2918 | 3028 | <div class="smalltext">', $txt['avatar_by_url'], '</div>', !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_download_and_resize' ? template_max_size('external') : '', ' |
| 2919 | 3029 | <input type="text" name="userpicpersonal" size="45" value="', ((stristr($context['member']['avatar']['external'], 'http://') || stristr($context['member']['avatar']['external'], 'https://')) ? $context['member']['avatar']['external'] : 'http://'), '" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'external\');" onchange="if (typeof(previewExternalAvatar) != \'undefined\') previewExternalAvatar(this.value);"> |
| 2920 | 3030 | </div>'; |
| 3031 | + } |
|
| 2921 | 3032 | |
| 2922 | 3033 | // If the user is able to upload avatars to the server show them an upload box. |
| 2923 | - if (!empty($context['member']['avatar']['allow_upload'])) |
|
| 2924 | - echo ' |
|
| 3034 | + if (!empty($context['member']['avatar']['allow_upload'])) { |
|
| 3035 | + echo ' |
|
| 2925 | 3036 | <div id="avatar_upload"> |
| 2926 | 3037 | <input type="file" size="44" name="attachment" id="avatar_upload_box" value="" onchange="readfromUpload(this)" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" accept="image/gif, image/jpeg, image/jpg, image/png">', template_max_size('upload'), ' |
| 2927 | 3038 | ', (!empty($context['member']['avatar']['id_attach']) ? '<br><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&') . 'time=' . time() . '" alt="" id="attached_image"><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '">' : ''), ' |
| 2928 | 3039 | </div>'; |
| 3040 | + } |
|
| 2929 | 3041 | |
| 2930 | 3042 | // if the user is able to use Gravatar avatars show then the image preview |
| 2931 | 3043 | if (!empty($context['member']['avatar']['allow_gravatar'])) |
@@ -2934,16 +3046,17 @@ discard block |
||
| 2934 | 3046 | <div id="avatar_gravatar"> |
| 2935 | 3047 | <img src="' . $context['member']['avatar']['href'] . '" alt="">'; |
| 2936 | 3048 | |
| 2937 | - if (empty($modSettings['gravatarAllowExtraEmail'])) |
|
| 2938 | - echo ' |
|
| 3049 | + if (empty($modSettings['gravatarAllowExtraEmail'])) { |
|
| 3050 | + echo ' |
|
| 2939 | 3051 | <div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>'; |
| 2940 | - else |
|
| 3052 | + } else |
|
| 2941 | 3053 | { |
| 2942 | 3054 | // Depending on other stuff, the stored value here might have some odd things in it from other areas. |
| 2943 | - if ($context['member']['avatar']['external'] == $context['member']['email']) |
|
| 2944 | - $textbox_value = ''; |
|
| 2945 | - else |
|
| 2946 | - $textbox_value = $context['member']['avatar']['external']; |
|
| 3055 | + if ($context['member']['avatar']['external'] == $context['member']['email']) { |
|
| 3056 | + $textbox_value = ''; |
|
| 3057 | + } else { |
|
| 3058 | + $textbox_value = $context['member']['avatar']['external']; |
|
| 3059 | + } |
|
| 2947 | 3060 | |
| 2948 | 3061 | echo ' |
| 2949 | 3062 | <div class="smalltext">', $txt['gravatar_alternateEmail'], '</div> |
@@ -3015,8 +3128,9 @@ discard block |
||
| 3015 | 3128 | $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; |
| 3016 | 3129 | |
| 3017 | 3130 | $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); |
| 3018 | - if (empty($suffix)) |
|
| 3019 | - return; |
|
| 3131 | + if (empty($suffix)) { |
|
| 3132 | + return; |
|
| 3133 | + } |
|
| 3020 | 3134 | |
| 3021 | 3135 | echo ' |
| 3022 | 3136 | <div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>'; |
@@ -3041,9 +3155,10 @@ discard block |
||
| 3041 | 3155 | <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">'; |
| 3042 | 3156 | |
| 3043 | 3157 | // Help the user by showing a list of common time formats. |
| 3044 | - foreach ($context['easy_timeformats'] as $time_format) |
|
| 3045 | - echo ' |
|
| 3158 | + foreach ($context['easy_timeformats'] as $time_format) { |
|
| 3159 | + echo ' |
|
| 3046 | 3160 | <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>'; |
| 3161 | + } |
|
| 3047 | 3162 | |
| 3048 | 3163 | echo ' |
| 3049 | 3164 | </select><br> |
@@ -3081,9 +3196,10 @@ discard block |
||
| 3081 | 3196 | <dd> |
| 3082 | 3197 | <select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.gif\';">'; |
| 3083 | 3198 | |
| 3084 | - foreach ($context['smiley_sets'] as $set) |
|
| 3085 | - echo ' |
|
| 3199 | + foreach ($context['smiley_sets'] as $set) { |
|
| 3200 | + echo ' |
|
| 3086 | 3201 | <option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>'; |
| 3202 | + } |
|
| 3087 | 3203 | |
| 3088 | 3204 | echo ' |
| 3089 | 3205 | </select> |
@@ -3135,10 +3251,11 @@ discard block |
||
| 3135 | 3251 | <img src="', $context['tfa_qr_url'], '" alt=""> |
| 3136 | 3252 | </div>'; |
| 3137 | 3253 | |
| 3138 | - if (!empty($context['from_ajax'])) |
|
| 3139 | - echo ' |
|
| 3254 | + if (!empty($context['from_ajax'])) { |
|
| 3255 | + echo ' |
|
| 3140 | 3256 | <br> |
| 3141 | 3257 | <a href="javascript:self.close();"></a>'; |
| 3258 | + } |
|
| 3142 | 3259 | |
| 3143 | 3260 | echo ' |
| 3144 | 3261 | </div> |
@@ -3178,17 +3295,16 @@ discard block |
||
| 3178 | 3295 | </dt> |
| 3179 | 3296 | <dd>'; |
| 3180 | 3297 | |
| 3181 | - if (!$context['tfa_enabled'] && $context['user']['is_owner']) |
|
| 3182 | - echo ' |
|
| 3298 | + if (!$context['tfa_enabled'] && $context['user']['is_owner']) { |
|
| 3299 | + echo ' |
|
| 3183 | 3300 | <a href="', !empty($modSettings['force_ssl']) && $modSettings['force_ssl'] < 2 ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>'; |
| 3184 | - |
|
| 3185 | - elseif (!$context['tfa_enabled']) |
|
| 3186 | - echo ' |
|
| 3301 | + } elseif (!$context['tfa_enabled']) { |
|
| 3302 | + echo ' |
|
| 3187 | 3303 | ', $txt['tfa_profile_disabled']; |
| 3188 | - |
|
| 3189 | - else |
|
| 3190 | - echo ' |
|
| 3304 | + } else { |
|
| 3305 | + echo ' |
|
| 3191 | 3306 | ', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable'); |
| 3307 | + } |
|
| 3192 | 3308 | |
| 3193 | 3309 | echo ' |
| 3194 | 3310 | </dd>'; |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | <div id="personal_messages">'; |
| 22 | 22 | |
| 23 | 23 | // Show the capacity bar, if available. |
| 24 | - if (!empty($context['limit_bar'])) |
|
| 25 | - echo ' |
|
| 24 | + if (!empty($context['limit_bar'])) { |
|
| 25 | + echo ' |
|
| 26 | 26 | <div class="cat_bar"> |
| 27 | 27 | <h3 class="catbg"> |
| 28 | 28 | <span class="floatleft">', $txt['pm_capacity'], ':</span> |
@@ -32,14 +32,16 @@ discard block |
||
| 32 | 32 | <span class="floatright', $context['limit_bar']['percent'] > 90 ? ' alert' : '', '">', $context['limit_bar']['text'], '</span> |
| 33 | 33 | </h3> |
| 34 | 34 | </div>'; |
| 35 | + } |
|
| 35 | 36 | |
| 36 | 37 | // Message sent? Show a small indication. |
| 37 | - if (isset($context['pm_sent'])) |
|
| 38 | - echo ' |
|
| 38 | + if (isset($context['pm_sent'])) { |
|
| 39 | + echo ' |
|
| 39 | 40 | <div class="infobox"> |
| 40 | 41 | ', $txt['pm_sent'], ' |
| 41 | 42 | </div>'; |
| 42 | -} |
|
| 43 | + } |
|
| 44 | + } |
|
| 43 | 45 | |
| 44 | 46 | /** |
| 45 | 47 | * Just the end of the index bar, nothing special. |
@@ -68,13 +70,13 @@ discard block |
||
| 68 | 70 | </div> |
| 69 | 71 | <div class="pm_unread">'; |
| 70 | 72 | |
| 71 | - if (empty($context['unread_pms'])) |
|
| 72 | - echo ' |
|
| 73 | + if (empty($context['unread_pms'])) { |
|
| 74 | + echo ' |
|
| 73 | 75 | <div class="no_unread">', $txt['pm_no_unread'], '</div>'; |
| 74 | - else |
|
| 76 | + } else |
|
| 75 | 77 | { |
| 76 | - foreach ($context['unread_pms'] as $id_pm => $pm_details) |
|
| 77 | - echo ' |
|
| 78 | + foreach ($context['unread_pms'] as $id_pm => $pm_details) { |
|
| 79 | + echo ' |
|
| 78 | 80 | <div class="unread"> |
| 79 | 81 | ', !empty($pm_details['member']) ? $pm_details['member']['avatar']['image'] : '', ' |
| 80 | 82 | <div class="details"> |
@@ -85,6 +87,7 @@ discard block |
||
| 85 | 87 | </div> |
| 86 | 88 | </div> |
| 87 | 89 | </div>'; |
| 90 | + } |
|
| 88 | 91 | } |
| 89 | 92 | |
| 90 | 93 | echo ' |
@@ -193,14 +196,15 @@ discard block |
||
| 193 | 196 | if ($context['get_pmessage']('message', true)) |
| 194 | 197 | { |
| 195 | 198 | // Show the helpful titlebar - generally. |
| 196 | - if ($context['display_mode'] != 1) |
|
| 197 | - echo ' |
|
| 199 | + if ($context['display_mode'] != 1) { |
|
| 200 | + echo ' |
|
| 198 | 201 | <div class="cat_bar"> |
| 199 | 202 | <h3 class="catbg"> |
| 200 | 203 | <span id="author">', $txt['author'], '</span> |
| 201 | 204 | <span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span> |
| 202 | 205 | </h3> |
| 203 | 206 | </div>'; |
| 207 | + } |
|
| 204 | 208 | |
| 205 | 209 | // Show a few buttons if we are in conversation mode and outputting the first message. |
| 206 | 210 | if ($context['display_mode'] == 2) |
@@ -229,9 +233,10 @@ discard block |
||
| 229 | 233 | <div class="custom_fields_above_member"> |
| 230 | 234 | <ul class="nolist">'; |
| 231 | 235 | |
| 232 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
| 233 | - echo ' |
|
| 236 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
| 237 | + echo ' |
|
| 234 | 238 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 239 | + } |
|
| 235 | 240 | |
| 236 | 241 | echo ' |
| 237 | 242 | </ul> |
@@ -243,25 +248,28 @@ discard block |
||
| 243 | 248 | <a id="msg', $message['id'], '"></a>'; |
| 244 | 249 | |
| 245 | 250 | // Show online and offline buttons? |
| 246 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
| 247 | - echo ' |
|
| 251 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
| 252 | + echo ' |
|
| 248 | 253 | <span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>'; |
| 254 | + } |
|
| 249 | 255 | |
| 250 | 256 | // Custom fields BEFORE the username? |
| 251 | - if (!empty($message['custom_fields']['before_member'])) |
|
| 252 | - foreach ($message['custom_fields']['before_member'] as $custom) |
|
| 257 | + if (!empty($message['custom_fields']['before_member'])) { |
|
| 258 | + foreach ($message['custom_fields']['before_member'] as $custom) |
|
| 253 | 259 | echo ' |
| 254 | 260 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
| 261 | + } |
|
| 255 | 262 | |
| 256 | 263 | // Show a link to the member's profile. |
| 257 | 264 | echo ' |
| 258 | 265 | ', $message['member']['link']; |
| 259 | 266 | |
| 260 | 267 | // Custom fields AFTER the username? |
| 261 | - if (!empty($message['custom_fields']['after_member'])) |
|
| 262 | - foreach ($message['custom_fields']['after_member'] as $custom) |
|
| 268 | + if (!empty($message['custom_fields']['after_member'])) { |
|
| 269 | + foreach ($message['custom_fields']['after_member'] as $custom) |
|
| 263 | 270 | echo ' |
| 264 | 271 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
| 272 | + } |
|
| 265 | 273 | |
| 266 | 274 | echo ' |
| 267 | 275 | </h4>'; |
@@ -270,48 +278,56 @@ discard block |
||
| 270 | 278 | <ul class="user_info">'; |
| 271 | 279 | |
| 272 | 280 | // Show the user's avatar. |
| 273 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
| 274 | - echo ' |
|
| 281 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
| 282 | + echo ' |
|
| 275 | 283 | <li class="avatar"> |
| 276 | 284 | <a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a> |
| 277 | 285 | </li>'; |
| 286 | + } |
|
| 278 | 287 | |
| 279 | 288 | // Are there any custom fields below the avatar? |
| 280 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
| 281 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 289 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
| 290 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 282 | 291 | echo ' |
| 283 | 292 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 293 | + } |
|
| 284 | 294 | |
| 285 | - if (!$message['member']['is_guest']) |
|
| 286 | - echo ' |
|
| 295 | + if (!$message['member']['is_guest']) { |
|
| 296 | + echo ' |
|
| 287 | 297 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
| 298 | + } |
|
| 288 | 299 | // Show the member's primary group (like 'Administrator') if they have one. |
| 289 | - if (isset($message['member']['group']) && $message['member']['group'] != '') |
|
| 290 | - echo ' |
|
| 300 | + if (isset($message['member']['group']) && $message['member']['group'] != '') { |
|
| 301 | + echo ' |
|
| 291 | 302 | <li class="membergroup">', $message['member']['group'], '</li>'; |
| 303 | + } |
|
| 292 | 304 | |
| 293 | 305 | // Show the member's custom title, if they have one. |
| 294 | - if (isset($message['member']['title']) && $message['member']['title'] != '') |
|
| 295 | - echo ' |
|
| 306 | + if (isset($message['member']['title']) && $message['member']['title'] != '') { |
|
| 307 | + echo ' |
|
| 296 | 308 | <li class="title">', $message['member']['title'], '</li>'; |
| 309 | + } |
|
| 297 | 310 | |
| 298 | 311 | // Don't show these things for guests. |
| 299 | 312 | if (!$message['member']['is_guest']) |
| 300 | 313 | { |
| 301 | 314 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
| 302 | - if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') |
|
| 303 | - echo ' |
|
| 315 | + if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') { |
|
| 316 | + echo ' |
|
| 304 | 317 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
| 318 | + } |
|
| 305 | 319 | |
| 306 | 320 | // Show how many posts they have made. |
| 307 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 308 | - echo ' |
|
| 321 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 322 | + echo ' |
|
| 309 | 323 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
| 324 | + } |
|
| 310 | 325 | |
| 311 | 326 | // Show their personal text? |
| 312 | - if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') |
|
| 313 | - echo ' |
|
| 327 | + if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') { |
|
| 328 | + echo ' |
|
| 314 | 329 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
| 330 | + } |
|
| 315 | 331 | |
| 316 | 332 | // Any custom fields to show as icons? |
| 317 | 333 | if (!empty($message['custom_fields']['icons'])) |
@@ -320,9 +336,10 @@ discard block |
||
| 320 | 336 | <li class="im_icons"> |
| 321 | 337 | <ol>'; |
| 322 | 338 | |
| 323 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
| 324 | - echo ' |
|
| 339 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
| 340 | + echo ' |
|
| 325 | 341 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 342 | + } |
|
| 326 | 343 | |
| 327 | 344 | echo ' |
| 328 | 345 | </ol> |
@@ -330,25 +347,28 @@ discard block |
||
| 330 | 347 | } |
| 331 | 348 | |
| 332 | 349 | // Show the IP to this user for this post - because you can moderate? |
| 333 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
| 334 | - echo ' |
|
| 350 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
| 351 | + echo ' |
|
| 335 | 352 | <li class="poster_ip"> |
| 336 | 353 | <a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a> |
| 337 | 354 | </li>'; |
| 355 | + } |
|
| 338 | 356 | |
| 339 | 357 | // Or, should we show it because this is you? |
| 340 | - elseif ($message['can_see_ip']) |
|
| 341 | - echo ' |
|
| 358 | + elseif ($message['can_see_ip']) { |
|
| 359 | + echo ' |
|
| 342 | 360 | <li class="poster_ip"> |
| 343 | 361 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a> |
| 344 | 362 | </li>'; |
| 363 | + } |
|
| 345 | 364 | |
| 346 | 365 | // Okay, you are logged in, then we can show something about why IPs are logged... |
| 347 | - else |
|
| 348 | - echo ' |
|
| 366 | + else { |
|
| 367 | + echo ' |
|
| 349 | 368 | <li class="poster_ip"> |
| 350 | 369 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a> |
| 351 | 370 | </li>'; |
| 371 | + } |
|
| 352 | 372 | |
| 353 | 373 | // Show the profile, website, email address, and personal message buttons. |
| 354 | 374 | if ($message['member']['show_profile_buttons']) |
@@ -358,24 +378,28 @@ discard block |
||
| 358 | 378 | <ol class="profile_icons">'; |
| 359 | 379 | |
| 360 | 380 | // Show the profile button |
| 361 | - if ($message['member']['can_view_profile']) |
|
| 362 | - echo ' |
|
| 381 | + if ($message['member']['can_view_profile']) { |
|
| 382 | + echo ' |
|
| 363 | 383 | <li><a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '">' : $txt['view_profile']), '</a></li>'; |
| 384 | + } |
|
| 364 | 385 | |
| 365 | 386 | // Don't show an icon if they haven't specified a website. |
| 366 | - if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) |
|
| 367 | - echo ' |
|
| 387 | + if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) { |
|
| 388 | + echo ' |
|
| 368 | 389 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 390 | + } |
|
| 369 | 391 | |
| 370 | 392 | // Don't show the email address if they want it hidden. |
| 371 | - if ($message['member']['show_email']) |
|
| 372 | - echo ' |
|
| 393 | + if ($message['member']['show_email']) { |
|
| 394 | + echo ' |
|
| 373 | 395 | <li><a href="mailto:', $message['member']['email'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
| 396 | + } |
|
| 374 | 397 | |
| 375 | 398 | // Since we know this person isn't a guest, you *can* message them. |
| 376 | - if ($context['can_send_pm']) |
|
| 377 | - echo ' |
|
| 399 | + if ($context['can_send_pm']) { |
|
| 400 | + echo ' |
|
| 378 | 401 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
| 402 | + } |
|
| 379 | 403 | |
| 380 | 404 | echo ' |
| 381 | 405 | </ol> |
@@ -383,21 +407,24 @@ discard block |
||
| 383 | 407 | } |
| 384 | 408 | |
| 385 | 409 | // Any custom fields for standard placement? |
| 386 | - if (!empty($message['custom_fields']['standard'])) |
|
| 387 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
| 410 | + if (!empty($message['custom_fields']['standard'])) { |
|
| 411 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
| 388 | 412 | echo ' |
| 389 | 413 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
| 414 | + } |
|
| 390 | 415 | |
| 391 | 416 | // Are we showing the warning status? |
| 392 | - if ($message['member']['can_see_warning']) |
|
| 393 | - echo ' |
|
| 417 | + if ($message['member']['can_see_warning']) { |
|
| 418 | + echo ' |
|
| 394 | 419 | <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span>', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
| 420 | + } |
|
| 395 | 421 | |
| 396 | 422 | // Are there any custom fields to show at the bottom of the poster info? |
| 397 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
| 398 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 423 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
| 424 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 399 | 425 | echo ' |
| 400 | 426 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 427 | + } |
|
| 401 | 428 | } |
| 402 | 429 | |
| 403 | 430 | // Done with the information about the poster... on to the post itself. |
@@ -416,25 +443,29 @@ discard block |
||
| 416 | 443 | <span class="smalltext">« <strong> ', $txt['sent_to'], ':</strong> '; |
| 417 | 444 | |
| 418 | 445 | // People it was sent directly to.... |
| 419 | - if (!empty($message['recipients']['to'])) |
|
| 420 | - echo implode(', ', $message['recipients']['to']); |
|
| 446 | + if (!empty($message['recipients']['to'])) { |
|
| 447 | + echo implode(', ', $message['recipients']['to']); |
|
| 448 | + } |
|
| 421 | 449 | |
| 422 | 450 | // Otherwise, we're just going to say "some people"... |
| 423 | - elseif ($context['folder'] != 'sent') |
|
| 424 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
| 451 | + elseif ($context['folder'] != 'sent') { |
|
| 452 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
| 453 | + } |
|
| 425 | 454 | |
| 426 | 455 | echo ' |
| 427 | 456 | <strong> ', $txt['on'], ':</strong> ', $message['time'], ' » |
| 428 | 457 | </span>'; |
| 429 | 458 | |
| 430 | 459 | // If we're in the sent items, show who it was sent to besides the "To:" people. |
| 431 | - if (!empty($message['recipients']['bcc'])) |
|
| 432 | - echo '<br> |
|
| 460 | + if (!empty($message['recipients']['bcc'])) { |
|
| 461 | + echo '<br> |
|
| 433 | 462 | <span class="smalltext">« <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' »</span>'; |
| 463 | + } |
|
| 434 | 464 | |
| 435 | - if (!empty($message['is_replied_to'])) |
|
| 436 | - echo '<br> |
|
| 465 | + if (!empty($message['is_replied_to'])) { |
|
| 466 | + echo '<br> |
|
| 437 | 467 | <span class="smalltext">« ', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' »</span>'; |
| 468 | + } |
|
| 438 | 469 | |
| 439 | 470 | echo ' |
| 440 | 471 | </div><!-- .keyinfo --> |
@@ -444,13 +475,15 @@ discard block |
||
| 444 | 475 | ', $message['body'], ' |
| 445 | 476 | </div>'; |
| 446 | 477 | |
| 447 | - if ($message['can_report'] || $context['can_send_pm']) |
|
| 448 | - echo ' |
|
| 478 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
| 479 | + echo ' |
|
| 449 | 480 | <div class="under_message">'; |
| 481 | + } |
|
| 450 | 482 | |
| 451 | - if ($message['can_report']) |
|
| 452 | - echo ' |
|
| 483 | + if ($message['can_report']) { |
|
| 484 | + echo ' |
|
| 453 | 485 | <a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '" class="floatright">' . $txt['pm_report_to_admin'] . '</a>'; |
| 486 | + } |
|
| 454 | 487 | |
| 455 | 488 | echo ' |
| 456 | 489 | <ul class="quickbuttons">'; |
@@ -462,32 +495,36 @@ discard block |
||
| 462 | 495 | if (!$message['member']['is_guest']) |
| 463 | 496 | { |
| 464 | 497 | // Is there than more than one recipient you can reply to? |
| 465 | - if ($message['number_recipients'] > 1) |
|
| 466 | - echo ' |
|
| 498 | + if ($message['number_recipients'] > 1) { |
|
| 499 | + echo ' |
|
| 467 | 500 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all"><span class="generic_icons reply_all_button"></span>', $txt['reply_to_all'], '</a></li>'; |
| 501 | + } |
|
| 468 | 502 | |
| 469 | 503 | echo ' |
| 470 | 504 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li> |
| 471 | 505 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
| 472 | 506 | } |
| 473 | 507 | // This is for "forwarding" - even if the member is gone. |
| 474 | - else |
|
| 475 | - echo ' |
|
| 508 | + else { |
|
| 509 | + echo ' |
|
| 476 | 510 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote"><span class="generic_icons quote"></span>', $txt['reply_quote'], '</a></li>'; |
| 511 | + } |
|
| 477 | 512 | } |
| 478 | 513 | echo ' |
| 479 | 514 | <li><a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions%5b', $message['id'], '%5D=delete;f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', addslashes($txt['remove_message_question']), '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li>'; |
| 480 | 515 | |
| 481 | - if (empty($context['display_mode'])) |
|
| 482 | - echo ' |
|
| 516 | + if (empty($context['display_mode'])) { |
|
| 517 | + echo ' |
|
| 483 | 518 | <li><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;"></li>'; |
| 519 | + } |
|
| 484 | 520 | |
| 485 | 521 | echo ' |
| 486 | 522 | </ul>'; |
| 487 | 523 | |
| 488 | - if ($message['can_report'] || $context['can_send_pm']) |
|
| 489 | - echo ' |
|
| 524 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
| 525 | + echo ' |
|
| 490 | 526 | </div><!-- .under_message -->'; |
| 527 | + } |
|
| 491 | 528 | |
| 492 | 529 | // Are there any custom profile fields for above the signature? |
| 493 | 530 | if (!empty($message['custom_fields']['above_signature'])) |
@@ -496,9 +533,10 @@ discard block |
||
| 496 | 533 | <div class="custom_fields_above_signature"> |
| 497 | 534 | <ul class="nolist">'; |
| 498 | 535 | |
| 499 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
| 500 | - echo ' |
|
| 536 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
| 537 | + echo ' |
|
| 501 | 538 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 539 | + } |
|
| 502 | 540 | |
| 503 | 541 | echo ' |
| 504 | 542 | </ul> |
@@ -506,11 +544,12 @@ discard block |
||
| 506 | 544 | } |
| 507 | 545 | |
| 508 | 546 | // Show the member's signature? |
| 509 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
| 510 | - echo ' |
|
| 547 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
| 548 | + echo ' |
|
| 511 | 549 | <div class="signature"> |
| 512 | 550 | ', $message['member']['signature'], ' |
| 513 | 551 | </div>'; |
| 552 | + } |
|
| 514 | 553 | |
| 515 | 554 | // Are there any custom profile fields for below the signature? |
| 516 | 555 | if (!empty($message['custom_fields']['below_signature'])) |
@@ -519,9 +558,10 @@ discard block |
||
| 519 | 558 | <div class="custom_fields_below_signature"> |
| 520 | 559 | <ul class="nolist">'; |
| 521 | 560 | |
| 522 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
| 523 | - echo ' |
|
| 561 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
| 562 | + echo ' |
|
| 524 | 563 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 564 | + } |
|
| 525 | 565 | |
| 526 | 566 | echo ' |
| 527 | 567 | </ul> |
@@ -548,10 +588,11 @@ discard block |
||
| 548 | 588 | echo ' |
| 549 | 589 | <option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>'; |
| 550 | 590 | |
| 551 | - foreach ($context['labels'] as $label) |
|
| 552 | - if (!isset($message['labels'][$label['id']])) |
|
| 591 | + foreach ($context['labels'] as $label) { |
|
| 592 | + if (!isset($message['labels'][$label['id']])) |
|
| 553 | 593 | echo ' |
| 554 | 594 | <option value="', $label['id'], '">', $label['name'], '</option>'; |
| 595 | + } |
|
| 555 | 596 | } |
| 556 | 597 | |
| 557 | 598 | // ... and are there any that can be removed? |
@@ -560,9 +601,10 @@ discard block |
||
| 560 | 601 | echo ' |
| 561 | 602 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
| 562 | 603 | |
| 563 | - foreach ($message['labels'] as $label) |
|
| 564 | - echo ' |
|
| 604 | + foreach ($message['labels'] as $label) { |
|
| 605 | + echo ' |
|
| 565 | 606 | <option value="', $label['id'], '"> ', $label['name'], '</option>'; |
| 607 | + } |
|
| 566 | 608 | } |
| 567 | 609 | echo ' |
| 568 | 610 | </select> |
@@ -581,14 +623,15 @@ discard block |
||
| 581 | 623 | </div><!-- .windowbg -->'; |
| 582 | 624 | } |
| 583 | 625 | |
| 584 | - if (empty($context['display_mode'])) |
|
| 585 | - echo ' |
|
| 626 | + if (empty($context['display_mode'])) { |
|
| 627 | + echo ' |
|
| 586 | 628 | <div class="pagesection"> |
| 587 | 629 | <div class="floatleft">', $context['page_index'], '</div> |
| 588 | 630 | <div class="floatright"> |
| 589 | 631 | <input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button"> |
| 590 | 632 | </div> |
| 591 | 633 | </div>'; |
| 634 | + } |
|
| 592 | 635 | |
| 593 | 636 | // Show a few buttons if we are in conversation mode and outputting the first message. |
| 594 | 637 | elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons'])) |
@@ -648,11 +691,12 @@ discard block |
||
| 648 | 691 | </thead> |
| 649 | 692 | <tbody>'; |
| 650 | 693 | |
| 651 | - if (!$context['show_delete']) |
|
| 652 | - echo ' |
|
| 694 | + if (!$context['show_delete']) { |
|
| 695 | + echo ' |
|
| 653 | 696 | <tr class="windowbg"> |
| 654 | 697 | <td colspan="5">', $txt['pm_alert_none'], '</td> |
| 655 | 698 | </tr>'; |
| 699 | + } |
|
| 656 | 700 | |
| 657 | 701 | while ($message = $context['get_pmessage']('subject')) |
| 658 | 702 | { |
@@ -710,17 +754,19 @@ discard block |
||
| 710 | 754 | |
| 711 | 755 | foreach ($context['labels'] as $label) |
| 712 | 756 | { |
| 713 | - if ($label['id'] != $context['current_label_id']) |
|
| 714 | - echo ' |
|
| 757 | + if ($label['id'] != $context['current_label_id']) { |
|
| 758 | + echo ' |
|
| 715 | 759 | <option value="add_', $label['id'], '"> ', $label['name'], '</option>'; |
| 760 | + } |
|
| 716 | 761 | } |
| 717 | 762 | |
| 718 | 763 | echo ' |
| 719 | 764 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
| 720 | 765 | |
| 721 | - foreach ($context['labels'] as $label) |
|
| 722 | - echo ' |
|
| 766 | + foreach ($context['labels'] as $label) { |
|
| 767 | + echo ' |
|
| 723 | 768 | <option value="rem_', $label['id'], '"> ', $label['name'], '</option>'; |
| 769 | + } |
|
| 724 | 770 | |
| 725 | 771 | echo ' |
| 726 | 772 | </select> |
@@ -751,11 +797,12 @@ discard block |
||
| 751 | 797 | <h3 class="catbg">', $txt['pm_search_title'], '</h3> |
| 752 | 798 | </div>'; |
| 753 | 799 | |
| 754 | - if (!empty($context['search_errors'])) |
|
| 755 | - echo ' |
|
| 800 | + if (!empty($context['search_errors'])) { |
|
| 801 | + echo ' |
|
| 756 | 802 | <div class="errorbox"> |
| 757 | 803 | ', implode('<br>', $context['search_errors']['messages']), ' |
| 758 | 804 | </div>'; |
| 805 | + } |
|
| 759 | 806 | |
| 760 | 807 | |
| 761 | 808 | echo ' |
@@ -804,9 +851,10 @@ discard block |
||
| 804 | 851 | </dd> |
| 805 | 852 | </dl>'; |
| 806 | 853 | |
| 807 | - if (!$context['currently_using_labels']) |
|
| 808 | - echo ' |
|
| 854 | + if (!$context['currently_using_labels']) { |
|
| 855 | + echo ' |
|
| 809 | 856 | <input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button">'; |
| 857 | + } |
|
| 810 | 858 | |
| 811 | 859 | echo ' |
| 812 | 860 | <br class="clear_right"> |
@@ -827,12 +875,13 @@ discard block |
||
| 827 | 875 | <div id="advanced_panel_div"> |
| 828 | 876 | <ul id="searchLabelsExpand">'; |
| 829 | 877 | |
| 830 | - foreach ($context['search_labels'] as $label) |
|
| 831 | - echo ' |
|
| 878 | + foreach ($context['search_labels'] as $label) { |
|
| 879 | + echo ' |
|
| 832 | 880 | <li> |
| 833 | 881 | <label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', '> |
| 834 | 882 | ', $label['name'], '</label> |
| 835 | 883 | </li>'; |
| 884 | + } |
|
| 836 | 885 | |
| 837 | 886 | echo ' |
| 838 | 887 | </ul> |
@@ -894,8 +943,8 @@ discard block |
||
| 894 | 943 | </div>'; |
| 895 | 944 | |
| 896 | 945 | // Complete results? |
| 897 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
| 898 | - echo ' |
|
| 946 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
| 947 | + echo ' |
|
| 899 | 948 | <table class="table_grid"> |
| 900 | 949 | <thead> |
| 901 | 950 | <tr class="title_bar"> |
@@ -905,6 +954,7 @@ discard block |
||
| 905 | 954 | </tr> |
| 906 | 955 | </thead> |
| 907 | 956 | <tbody>'; |
| 957 | + } |
|
| 908 | 958 | |
| 909 | 959 | // Print each message out... |
| 910 | 960 | foreach ($context['personal_messages'] as $message) |
@@ -924,12 +974,14 @@ discard block |
||
| 924 | 974 | |
| 925 | 975 | // Show the recipients. |
| 926 | 976 | // @todo This doesn't deal with the sent item searching quite right for bcc. |
| 927 | - if (!empty($message['recipients']['to'])) |
|
| 928 | - echo implode(', ', $message['recipients']['to']); |
|
| 977 | + if (!empty($message['recipients']['to'])) { |
|
| 978 | + echo implode(', ', $message['recipients']['to']); |
|
| 979 | + } |
|
| 929 | 980 | |
| 930 | 981 | // Otherwise, we're just going to say "some people"... |
| 931 | - elseif ($context['folder'] != 'sent') |
|
| 932 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
| 982 | + elseif ($context['folder'] != 'sent') { |
|
| 983 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
| 984 | + } |
|
| 933 | 985 | |
| 934 | 986 | echo ' |
| 935 | 987 | </h3> |
@@ -944,15 +996,17 @@ discard block |
||
| 944 | 996 | $reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"'); |
| 945 | 997 | |
| 946 | 998 | // You can only reply if they are not a guest... |
| 947 | - if (!$message['member']['is_guest']) |
|
| 948 | - echo ' |
|
| 999 | + if (!$message['member']['is_guest']) { |
|
| 1000 | + echo ' |
|
| 949 | 1001 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], ' |
| 950 | 1002 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator']; |
| 1003 | + } |
|
| 951 | 1004 | |
| 952 | 1005 | // This is for "forwarding" - even if the member is gone. |
| 953 | - else |
|
| 954 | - echo ' |
|
| 1006 | + else { |
|
| 1007 | + echo ' |
|
| 955 | 1008 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator']; |
| 1009 | + } |
|
| 956 | 1010 | } |
| 957 | 1011 | |
| 958 | 1012 | echo ' |
@@ -961,27 +1015,30 @@ discard block |
||
| 961 | 1015 | } |
| 962 | 1016 | // Otherwise just a simple list! |
| 963 | 1017 | // @todo No context at all of the search? |
| 964 | - else |
|
| 965 | - echo ' |
|
| 1018 | + else { |
|
| 1019 | + echo ' |
|
| 966 | 1020 | <tr class="windowbg"> |
| 967 | 1021 | <td>', $message['time'], '</td> |
| 968 | 1022 | <td>', $message['link'], '</td> |
| 969 | 1023 | <td>', $message['member']['link'], '</td> |
| 970 | 1024 | </tr>'; |
| 1025 | + } |
|
| 971 | 1026 | } |
| 972 | 1027 | |
| 973 | 1028 | // Finish off the page... |
| 974 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
| 975 | - echo ' |
|
| 1029 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
| 1030 | + echo ' |
|
| 976 | 1031 | </tbody> |
| 977 | 1032 | </table>'; |
| 1033 | + } |
|
| 978 | 1034 | |
| 979 | 1035 | // No results? |
| 980 | - if (empty($context['personal_messages'])) |
|
| 981 | - echo ' |
|
| 1036 | + if (empty($context['personal_messages'])) { |
|
| 1037 | + echo ' |
|
| 982 | 1038 | <div class="windowbg"> |
| 983 | 1039 | <p class="centertext">', $txt['pm_search_none_found'], '</p> |
| 984 | 1040 | </div>'; |
| 1041 | + } |
|
| 985 | 1042 | |
| 986 | 1043 | echo ' |
| 987 | 1044 | <div class="pagesection"> |
@@ -1006,15 +1063,17 @@ discard block |
||
| 1006 | 1063 | </div> |
| 1007 | 1064 | <div class="windowbg">'; |
| 1008 | 1065 | |
| 1009 | - if (!empty($context['send_log']['sent'])) |
|
| 1010 | - foreach ($context['send_log']['sent'] as $log_entry) |
|
| 1066 | + if (!empty($context['send_log']['sent'])) { |
|
| 1067 | + foreach ($context['send_log']['sent'] as $log_entry) |
|
| 1011 | 1068 | echo ' |
| 1012 | 1069 | <span class="error">', $log_entry, '</span><br>'; |
| 1070 | + } |
|
| 1013 | 1071 | |
| 1014 | - if (!empty($context['send_log']['failed'])) |
|
| 1015 | - foreach ($context['send_log']['failed'] as $log_entry) |
|
| 1072 | + if (!empty($context['send_log']['failed'])) { |
|
| 1073 | + foreach ($context['send_log']['failed'] as $log_entry) |
|
| 1016 | 1074 | echo ' |
| 1017 | 1075 | <span class="error">', $log_entry, '</span><br>'; |
| 1076 | + } |
|
| 1018 | 1077 | |
| 1019 | 1078 | echo ' |
| 1020 | 1079 | </div> |
@@ -1063,12 +1122,13 @@ discard block |
||
| 1063 | 1122 | </dl> |
| 1064 | 1123 | </div>'; |
| 1065 | 1124 | |
| 1066 | - if (!empty($modSettings['drafts_pm_enabled'])) |
|
| 1067 | - echo ' |
|
| 1125 | + if (!empty($modSettings['drafts_pm_enabled'])) { |
|
| 1126 | + echo ' |
|
| 1068 | 1127 | <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
| 1069 | 1128 | sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), ' |
| 1070 | 1129 | ', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
| 1071 | 1130 | </div>'; |
| 1131 | + } |
|
| 1072 | 1132 | |
| 1073 | 1133 | echo ' |
| 1074 | 1134 | <dl id="post_header">'; |
@@ -1117,26 +1177,29 @@ discard block |
||
| 1117 | 1177 | <hr>'; |
| 1118 | 1178 | |
| 1119 | 1179 | // Showing BBC? |
| 1120 | - if ($context['show_bbc']) |
|
| 1121 | - echo ' |
|
| 1180 | + if ($context['show_bbc']) { |
|
| 1181 | + echo ' |
|
| 1122 | 1182 | <div id="bbcBox_message"></div>'; |
| 1183 | + } |
|
| 1123 | 1184 | |
| 1124 | 1185 | // What about smileys? |
| 1125 | - if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
| 1126 | - echo ' |
|
| 1186 | + if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) { |
|
| 1187 | + echo ' |
|
| 1127 | 1188 | <div id="smileyBox_message"></div>'; |
| 1189 | + } |
|
| 1128 | 1190 | |
| 1129 | 1191 | // Show BBC buttons, smileys and textbox. |
| 1130 | 1192 | echo ' |
| 1131 | 1193 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'); |
| 1132 | 1194 | |
| 1133 | 1195 | // Require an image to be typed to save spamming? |
| 1134 | - if ($context['require_verification']) |
|
| 1135 | - echo ' |
|
| 1196 | + if ($context['require_verification']) { |
|
| 1197 | + echo ' |
|
| 1136 | 1198 | <div class="post_verification"> |
| 1137 | 1199 | <strong>', $txt['pm_visual_verification_label'], ':</strong> |
| 1138 | 1200 | ', template_control_verification($context['visual_verification_id'], 'all'), ' |
| 1139 | 1201 | </div>'; |
| 1202 | + } |
|
| 1140 | 1203 | |
| 1141 | 1204 | // Send, Preview, spellcheck buttons. |
| 1142 | 1205 | echo ' |
@@ -1169,10 +1232,11 @@ discard block |
||
| 1169 | 1232 | <dt><strong>', $txt['subject'], '</strong></dt> |
| 1170 | 1233 | <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
| 1171 | 1234 | |
| 1172 | - foreach ($context['drafts'] as $draft) |
|
| 1173 | - echo ' |
|
| 1235 | + foreach ($context['drafts'] as $draft) { |
|
| 1236 | + echo ' |
|
| 1174 | 1237 | <dt>', $draft['link'], '</dt> |
| 1175 | 1238 | <dd>', $draft['poster_time'], '</dd>'; |
| 1239 | + } |
|
| 1176 | 1240 | echo ' |
| 1177 | 1241 | </dl> |
| 1178 | 1242 | </div>'; |
@@ -1279,8 +1343,8 @@ discard block |
||
| 1279 | 1343 | }'; |
| 1280 | 1344 | |
| 1281 | 1345 | // Code for showing and hiding drafts |
| 1282 | - if (!empty($context['drafts'])) |
|
| 1283 | - echo ' |
|
| 1346 | + if (!empty($context['drafts'])) { |
|
| 1347 | + echo ' |
|
| 1284 | 1348 | var oSwapDraftOptions = new smc_Toggle({ |
| 1285 | 1349 | bToggleEnabled: true, |
| 1286 | 1350 | bCurrentlyCollapsed: true, |
@@ -1302,13 +1366,14 @@ discard block |
||
| 1302 | 1366 | } |
| 1303 | 1367 | ] |
| 1304 | 1368 | });'; |
| 1369 | + } |
|
| 1305 | 1370 | |
| 1306 | 1371 | echo ' |
| 1307 | 1372 | </script>'; |
| 1308 | 1373 | |
| 1309 | 1374 | // Show the message you're replying to. |
| 1310 | - if ($context['reply']) |
|
| 1311 | - echo ' |
|
| 1375 | + if ($context['reply']) { |
|
| 1376 | + echo ' |
|
| 1312 | 1377 | <br><br> |
| 1313 | 1378 | <div class="cat_bar"> |
| 1314 | 1379 | <h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3> |
@@ -1322,6 +1387,7 @@ discard block |
||
| 1322 | 1387 | ', $context['quoted_message']['body'], ' |
| 1323 | 1388 | </div> |
| 1324 | 1389 | <br class="clear">'; |
| 1390 | + } |
|
| 1325 | 1391 | |
| 1326 | 1392 | echo ' |
| 1327 | 1393 | <script> |
@@ -1333,23 +1399,25 @@ discard block |
||
| 1333 | 1399 | sToControlId: \'to_control\', |
| 1334 | 1400 | aToRecipients: ['; |
| 1335 | 1401 | |
| 1336 | - foreach ($context['recipients']['to'] as $i => $member) |
|
| 1337 | - echo ' |
|
| 1402 | + foreach ($context['recipients']['to'] as $i => $member) { |
|
| 1403 | + echo ' |
|
| 1338 | 1404 | { |
| 1339 | 1405 | sItemId: ', JavaScriptEscape($member['id']), ', |
| 1340 | 1406 | sItemName: ', JavaScriptEscape($member['name']), ' |
| 1341 | 1407 | }', $i == count($context['recipients']['to']) - 1 ? '' : ','; |
| 1408 | + } |
|
| 1342 | 1409 | |
| 1343 | 1410 | echo ' |
| 1344 | 1411 | ], |
| 1345 | 1412 | aBccRecipients: ['; |
| 1346 | 1413 | |
| 1347 | - foreach ($context['recipients']['bcc'] as $i => $member) |
|
| 1348 | - echo ' |
|
| 1414 | + foreach ($context['recipients']['bcc'] as $i => $member) { |
|
| 1415 | + echo ' |
|
| 1349 | 1416 | { |
| 1350 | 1417 | sItemId: ', JavaScriptEscape($member['id']), ', |
| 1351 | 1418 | sItemName: ', JavaScriptEscape($member['name']), ' |
| 1352 | 1419 | }', $i == count($context['recipients']['bcc']) - 1 ? '' : ','; |
| 1420 | + } |
|
| 1353 | 1421 | |
| 1354 | 1422 | echo ' |
| 1355 | 1423 | ], |
@@ -1438,26 +1506,28 @@ discard block |
||
| 1438 | 1506 | </th> |
| 1439 | 1507 | <th class="centertext table_icon">'; |
| 1440 | 1508 | |
| 1441 | - if (count($context['labels']) > 2) |
|
| 1442 | - echo ' |
|
| 1509 | + if (count($context['labels']) > 2) { |
|
| 1510 | + echo ' |
|
| 1443 | 1511 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
| 1512 | + } |
|
| 1444 | 1513 | |
| 1445 | 1514 | echo ' |
| 1446 | 1515 | </th> |
| 1447 | 1516 | </tr> |
| 1448 | 1517 | </thead> |
| 1449 | 1518 | <tbody>'; |
| 1450 | - if (count($context['labels']) < 2) |
|
| 1451 | - echo ' |
|
| 1519 | + if (count($context['labels']) < 2) { |
|
| 1520 | + echo ' |
|
| 1452 | 1521 | <tr class="windowbg"> |
| 1453 | 1522 | <td colspan="2">', $txt['pm_labels_no_exist'], '</td> |
| 1454 | 1523 | </tr>'; |
| 1455 | - else |
|
| 1524 | + } else |
|
| 1456 | 1525 | { |
| 1457 | 1526 | foreach ($context['labels'] as $label) |
| 1458 | 1527 | { |
| 1459 | - if ($label['id'] == -1) |
|
| 1460 | - continue; |
|
| 1528 | + if ($label['id'] == -1) { |
|
| 1529 | + continue; |
|
| 1530 | + } |
|
| 1461 | 1531 | |
| 1462 | 1532 | echo ' |
| 1463 | 1533 | <tr class="windowbg"> |
@@ -1472,12 +1542,13 @@ discard block |
||
| 1472 | 1542 | </tbody> |
| 1473 | 1543 | </table>'; |
| 1474 | 1544 | |
| 1475 | - if (!count($context['labels']) < 2) |
|
| 1476 | - echo ' |
|
| 1545 | + if (!count($context['labels']) < 2) { |
|
| 1546 | + echo ' |
|
| 1477 | 1547 | <div class="padding"> |
| 1478 | 1548 | <input type="submit" name="save" value="', $txt['save'], '" class="button"> |
| 1479 | 1549 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure"> |
| 1480 | 1550 | </div>'; |
| 1551 | + } |
|
| 1481 | 1552 | |
| 1482 | 1553 | echo ' |
| 1483 | 1554 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1534,9 +1605,10 @@ discard block |
||
| 1534 | 1605 | <select name="id_admin"> |
| 1535 | 1606 | <option value="0">', $txt['pm_report_all_admins'], '</option>'; |
| 1536 | 1607 | |
| 1537 | - foreach ($context['admins'] as $id => $name) |
|
| 1538 | - echo ' |
|
| 1608 | + foreach ($context['admins'] as $id => $name) { |
|
| 1609 | + echo ' |
|
| 1539 | 1610 | <option value="', $id, '">', $name, '</option>'; |
| 1611 | + } |
|
| 1540 | 1612 | |
| 1541 | 1613 | echo ' |
| 1542 | 1614 | </select> |
@@ -1599,9 +1671,10 @@ discard block |
||
| 1599 | 1671 | </th> |
| 1600 | 1672 | <th class="centertext table_icon">'; |
| 1601 | 1673 | |
| 1602 | - if (!empty($context['rules'])) |
|
| 1603 | - echo ' |
|
| 1674 | + if (!empty($context['rules'])) { |
|
| 1675 | + echo ' |
|
| 1604 | 1676 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
| 1677 | + } |
|
| 1605 | 1678 | |
| 1606 | 1679 | echo ' |
| 1607 | 1680 | </th> |
@@ -1609,16 +1682,17 @@ discard block |
||
| 1609 | 1682 | </thead> |
| 1610 | 1683 | <tbody>'; |
| 1611 | 1684 | |
| 1612 | - if (empty($context['rules'])) |
|
| 1613 | - echo ' |
|
| 1685 | + if (empty($context['rules'])) { |
|
| 1686 | + echo ' |
|
| 1614 | 1687 | <tr class="windowbg"> |
| 1615 | 1688 | <td colspan="2"> |
| 1616 | 1689 | ', $txt['pm_rules_none'], ' |
| 1617 | 1690 | </td> |
| 1618 | 1691 | </tr>'; |
| 1692 | + } |
|
| 1619 | 1693 | |
| 1620 | - foreach ($context['rules'] as $rule) |
|
| 1621 | - echo ' |
|
| 1694 | + foreach ($context['rules'] as $rule) { |
|
| 1695 | + echo ' |
|
| 1622 | 1696 | <tr class="windowbg"> |
| 1623 | 1697 | <td> |
| 1624 | 1698 | <a href="', $scripturl, '?action=pm;sa=manrules;add;rid=', $rule['id'], '">', $rule['name'], '</a> |
@@ -1627,6 +1701,7 @@ discard block |
||
| 1627 | 1701 | <input type="checkbox" name="delrule[', $rule['id'], ']"> |
| 1628 | 1702 | </td> |
| 1629 | 1703 | </tr>'; |
| 1704 | + } |
|
| 1630 | 1705 | |
| 1631 | 1706 | echo ' |
| 1632 | 1707 | </tbody> |
@@ -1634,14 +1709,16 @@ discard block |
||
| 1634 | 1709 | <div class="righttext"> |
| 1635 | 1710 | <a class="button" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>'; |
| 1636 | 1711 | |
| 1637 | - if (!empty($context['rules'])) |
|
| 1638 | - echo ' |
|
| 1712 | + if (!empty($context['rules'])) { |
|
| 1713 | + echo ' |
|
| 1639 | 1714 | [<a href="', $scripturl, '?action=pm;sa=manrules;apply;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['pm_js_apply_rules_confirm'], '\');">', $txt['pm_apply_rules'], '</a>]'; |
| 1715 | + } |
|
| 1640 | 1716 | |
| 1641 | - if (!empty($context['rules'])) |
|
| 1642 | - echo ' |
|
| 1717 | + if (!empty($context['rules'])) { |
|
| 1718 | + echo ' |
|
| 1643 | 1719 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 1644 | 1720 | <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">'; |
| 1721 | + } |
|
| 1645 | 1722 | |
| 1646 | 1723 | echo ' |
| 1647 | 1724 | </div> |
@@ -1663,14 +1740,16 @@ discard block |
||
| 1663 | 1740 | var groups = new Array() |
| 1664 | 1741 | var labels = new Array()'; |
| 1665 | 1742 | |
| 1666 | - foreach ($context['groups'] as $id => $title) |
|
| 1667 | - echo ' |
|
| 1743 | + foreach ($context['groups'] as $id => $title) { |
|
| 1744 | + echo ' |
|
| 1668 | 1745 | groups[', $id, '] = "', addslashes($title), '";'; |
| 1746 | + } |
|
| 1669 | 1747 | |
| 1670 | - foreach ($context['labels'] as $label) |
|
| 1671 | - if ($label['id'] != -1) |
|
| 1748 | + foreach ($context['labels'] as $label) { |
|
| 1749 | + if ($label['id'] != -1) |
|
| 1672 | 1750 | echo ' |
| 1673 | 1751 | labels[', ($label['id']), '] = "', addslashes($label['name']), '";'; |
| 1752 | + } |
|
| 1674 | 1753 | |
| 1675 | 1754 | echo ' |
| 1676 | 1755 | function addCriteriaOption() |
@@ -1685,8 +1764,9 @@ discard block |
||
| 1685 | 1764 | |
| 1686 | 1765 | setOuterHTML(document.getElementById("criteriaAddHere"), \'<br><select name="ruletype[\' + criteriaNum + \']" id="ruletype\' + criteriaNum + \'" onchange="updateRuleDef(\' + criteriaNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_criteria_pick']), ':<\' + \'/option><option value="mid">', addslashes($txt['pm_rule_mid']), '<\' + \'/option><option value="gid">', addslashes($txt['pm_rule_gid']), '<\' + \'/option><option value="sub">', addslashes($txt['pm_rule_sub']), '<\' + \'/option><option value="msg">', addslashes($txt['pm_rule_msg']), '<\' + \'/option><option value="bud">', addslashes($txt['pm_rule_bud']), '<\' + \'/option><\' + \'/select> <span id="defdiv\' + criteriaNum + \'" style="display: none;"><input type="text" name="ruledef[\' + criteriaNum + \']" id="ruledef\' + criteriaNum + \'" onkeyup="rebuildRuleDesc();" value=""><\' + \'/span><span id="defseldiv\' + criteriaNum + \'" style="display: none;"><select name="ruledefgroup[\' + criteriaNum + \']" id="ruledefgroup\' + criteriaNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_group']), '<\' + \'/option>'; |
| 1687 | 1766 | |
| 1688 | - foreach ($context['groups'] as $id => $group) |
|
| 1689 | - echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
| 1767 | + foreach ($context['groups'] as $id => $group) { |
|
| 1768 | + echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
| 1769 | + } |
|
| 1690 | 1770 | |
| 1691 | 1771 | echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\'); |
| 1692 | 1772 | } |
@@ -1703,9 +1783,10 @@ discard block |
||
| 1703 | 1783 | |
| 1704 | 1784 | setOuterHTML(document.getElementById("actionAddHere"), \'<br><select name="acttype[\' + actionNum + \']" id="acttype\' + actionNum + \'" onchange="updateActionDef(\' + actionNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_action']), ':<\' + \'/option><option value="lab">', addslashes($txt['pm_rule_label']), '<\' + \'/option><option value="del">', addslashes($txt['pm_rule_delete']), '<\' + \'/option><\' + \'/select> <span id="labdiv\' + actionNum + \'" style="display: none;"><select name="labdef[\' + actionNum + \']" id="labdef\' + actionNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_label']), '<\' + \'/option>'; |
| 1705 | 1785 | |
| 1706 | - foreach ($context['labels'] as $label) |
|
| 1707 | - if ($label['id'] != -1) |
|
| 1786 | + foreach ($context['labels'] as $label) { |
|
| 1787 | + if ($label['id'] != -1) |
|
| 1708 | 1788 | echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>'; |
| 1789 | + } |
|
| 1709 | 1790 | |
| 1710 | 1791 | echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\'); |
| 1711 | 1792 | } |
@@ -1819,19 +1900,20 @@ discard block |
||
| 1819 | 1900 | $isFirst = true; |
| 1820 | 1901 | foreach ($context['rule']['criteria'] as $k => $criteria) |
| 1821 | 1902 | { |
| 1822 | - if (!$isFirst && $criteria['t'] == '') |
|
| 1823 | - echo '<div id="removeonjs1">'; |
|
| 1824 | - |
|
| 1825 | - elseif (!$isFirst) |
|
| 1826 | - echo '<br>'; |
|
| 1903 | + if (!$isFirst && $criteria['t'] == '') { |
|
| 1904 | + echo '<div id="removeonjs1">'; |
|
| 1905 | + } elseif (!$isFirst) { |
|
| 1906 | + echo '<br>'; |
|
| 1907 | + } |
|
| 1827 | 1908 | |
| 1828 | 1909 | echo ' |
| 1829 | 1910 | <select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();"> |
| 1830 | 1911 | <option value="">', $txt['pm_rule_criteria_pick'], ':</option>'; |
| 1831 | 1912 | |
| 1832 | - foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) |
|
| 1833 | - echo ' |
|
| 1913 | + foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) { |
|
| 1914 | + echo ' |
|
| 1834 | 1915 | <option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>'; |
| 1916 | + } |
|
| 1835 | 1917 | |
| 1836 | 1918 | echo ' |
| 1837 | 1919 | </select> |
@@ -1842,19 +1924,20 @@ discard block |
||
| 1842 | 1924 | <select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();"> |
| 1843 | 1925 | <option value="">', $txt['pm_rule_sel_group'], '</option>'; |
| 1844 | 1926 | |
| 1845 | - foreach ($context['groups'] as $id => $group) |
|
| 1846 | - echo ' |
|
| 1927 | + foreach ($context['groups'] as $id => $group) { |
|
| 1928 | + echo ' |
|
| 1847 | 1929 | <option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>'; |
| 1930 | + } |
|
| 1848 | 1931 | echo ' |
| 1849 | 1932 | </select> |
| 1850 | 1933 | </span>'; |
| 1851 | 1934 | |
| 1852 | 1935 | // If this is the dummy we add a means to hide for non js users. |
| 1853 | - if ($isFirst) |
|
| 1854 | - $isFirst = false; |
|
| 1855 | - |
|
| 1856 | - elseif ($criteria['t'] == '') |
|
| 1857 | - echo '</div><!-- .removeonjs1 -->'; |
|
| 1936 | + if ($isFirst) { |
|
| 1937 | + $isFirst = false; |
|
| 1938 | + } elseif ($criteria['t'] == '') { |
|
| 1939 | + echo '</div><!-- .removeonjs1 -->'; |
|
| 1940 | + } |
|
| 1858 | 1941 | } |
| 1859 | 1942 | |
| 1860 | 1943 | echo ' |
@@ -1877,10 +1960,11 @@ discard block |
||
| 1877 | 1960 | $isFirst = true; |
| 1878 | 1961 | foreach ($context['rule']['actions'] as $k => $action) |
| 1879 | 1962 | { |
| 1880 | - if (!$isFirst && $action['t'] == '') |
|
| 1881 | - echo '<div id="removeonjs2">'; |
|
| 1882 | - elseif (!$isFirst) |
|
| 1883 | - echo '<br>'; |
|
| 1963 | + if (!$isFirst && $action['t'] == '') { |
|
| 1964 | + echo '<div id="removeonjs2">'; |
|
| 1965 | + } elseif (!$isFirst) { |
|
| 1966 | + echo '<br>'; |
|
| 1967 | + } |
|
| 1884 | 1968 | |
| 1885 | 1969 | echo ' |
| 1886 | 1970 | <select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();"> |
@@ -1892,20 +1976,21 @@ discard block |
||
| 1892 | 1976 | <select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();"> |
| 1893 | 1977 | <option value="">', $txt['pm_rule_sel_label'], '</option>'; |
| 1894 | 1978 | |
| 1895 | - foreach ($context['labels'] as $label) |
|
| 1896 | - if ($label['id'] != -1) |
|
| 1979 | + foreach ($context['labels'] as $label) { |
|
| 1980 | + if ($label['id'] != -1) |
|
| 1897 | 1981 | echo ' |
| 1898 | 1982 | <option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>'; |
| 1983 | + } |
|
| 1899 | 1984 | |
| 1900 | 1985 | echo ' |
| 1901 | 1986 | </select> |
| 1902 | 1987 | </span>'; |
| 1903 | 1988 | |
| 1904 | - if ($isFirst) |
|
| 1905 | - $isFirst = false; |
|
| 1906 | - |
|
| 1907 | - elseif ($action['t'] == '') |
|
| 1908 | - echo '</div><!-- .removeonjs2 -->'; |
|
| 1989 | + if ($isFirst) { |
|
| 1990 | + $isFirst = false; |
|
| 1991 | + } elseif ($action['t'] == '') { |
|
| 1992 | + echo '</div><!-- .removeonjs2 -->'; |
|
| 1993 | + } |
|
| 1909 | 1994 | } |
| 1910 | 1995 | |
| 1911 | 1996 | echo ' |
@@ -1929,22 +2014,25 @@ discard block |
||
| 1929 | 2014 | echo ' |
| 1930 | 2015 | <script>'; |
| 1931 | 2016 | |
| 1932 | - foreach ($context['rule']['criteria'] as $k => $c) |
|
| 1933 | - echo ' |
|
| 2017 | + foreach ($context['rule']['criteria'] as $k => $c) { |
|
| 2018 | + echo ' |
|
| 1934 | 2019 | updateRuleDef(', $k, ');'; |
| 2020 | + } |
|
| 1935 | 2021 | |
| 1936 | - foreach ($context['rule']['actions'] as $k => $c) |
|
| 1937 | - echo ' |
|
| 2022 | + foreach ($context['rule']['actions'] as $k => $c) { |
|
| 2023 | + echo ' |
|
| 1938 | 2024 | updateActionDef(', $k, ');'; |
| 2025 | + } |
|
| 1939 | 2026 | |
| 1940 | 2027 | echo ' |
| 1941 | 2028 | rebuildRuleDesc();'; |
| 1942 | 2029 | |
| 1943 | 2030 | // If this isn't a new rule and we have JS enabled remove the JS compatibility stuff. |
| 1944 | - if ($context['rid']) |
|
| 1945 | - echo ' |
|
| 2031 | + if ($context['rid']) { |
|
| 2032 | + echo ' |
|
| 1946 | 2033 | document.getElementById("removeonjs1").style.display = "none"; |
| 1947 | 2034 | document.getElementById("removeonjs2").style.display = "none";'; |
| 2035 | + } |
|
| 1948 | 2036 | |
| 1949 | 2037 | echo ' |
| 1950 | 2038 | document.getElementById("addonjs1").style.display = ""; |
@@ -1972,12 +2060,12 @@ discard block |
||
| 1972 | 2060 | </div>'; |
| 1973 | 2061 | |
| 1974 | 2062 | // No drafts? Just show an informative message. |
| 1975 | - if (empty($context['drafts'])) |
|
| 1976 | - echo ' |
|
| 2063 | + if (empty($context['drafts'])) { |
|
| 2064 | + echo ' |
|
| 1977 | 2065 | <div class="windowbg2 centertext"> |
| 1978 | 2066 | ', $txt['draft_none'], ' |
| 1979 | 2067 | </div>'; |
| 1980 | - else |
|
| 2068 | + } else |
|
| 1981 | 2069 | { |
| 1982 | 2070 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
| 1983 | 2071 | foreach ($context['drafts'] as $draft) |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 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 news dispatcher; doesn't do anything, just delegates. |
@@ -67,8 +68,9 @@ discard block |
||
| 67 | 68 | ); |
| 68 | 69 | |
| 69 | 70 | // Force the right area... |
| 70 | - if (substr($_REQUEST['sa'], 0, 7) == 'mailing') |
|
| 71 | - $context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers'; |
|
| 71 | + if (substr($_REQUEST['sa'], 0, 7) == 'mailing') { |
|
| 72 | + $context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers'; |
|
| 73 | + } |
|
| 72 | 74 | |
| 73 | 75 | call_helper($subActions[$_REQUEST['sa']][0]); |
| 74 | 76 | } |
@@ -99,9 +101,10 @@ discard block |
||
| 99 | 101 | $temp_news = explode("\n", $modSettings['news']); |
| 100 | 102 | |
| 101 | 103 | // Remove the items that were selected. |
| 102 | - foreach ($temp_news as $i => $news) |
|
| 103 | - if (in_array($i, $_POST['remove'])) |
|
| 104 | + foreach ($temp_news as $i => $news) { |
|
| 105 | + if (in_array($i, $_POST['remove'])) |
|
| 104 | 106 | unset($temp_news[$i]); |
| 107 | + } |
|
| 105 | 108 | |
| 106 | 109 | // Update the database. |
| 107 | 110 | updateSettings(array('news' => implode("\n", $temp_news))); |
@@ -117,9 +120,9 @@ discard block |
||
| 117 | 120 | |
| 118 | 121 | foreach ($_POST['news'] as $i => $news) |
| 119 | 122 | { |
| 120 | - if (trim($news) == '') |
|
| 121 | - unset($_POST['news'][$i]); |
|
| 122 | - else |
|
| 123 | + if (trim($news) == '') { |
|
| 124 | + unset($_POST['news'][$i]); |
|
| 125 | + } else |
|
| 123 | 126 | { |
| 124 | 127 | $_POST['news'][$i] = $smcFunc['htmlspecialchars']($_POST['news'][$i], ENT_QUOTES); |
| 125 | 128 | preparsecode($_POST['news'][$i]); |
@@ -155,12 +158,13 @@ discard block |
||
| 155 | 158 | 'data' => array( |
| 156 | 159 | 'function' => function($news) |
| 157 | 160 | { |
| 158 | - if (is_numeric($news['id'])) |
|
| 159 | - return ' |
|
| 161 | + if (is_numeric($news['id'])) { |
|
| 162 | + return ' |
|
| 160 | 163 | <textarea id="data_' . $news['id'] . '" rows="3" cols="50" name="news[]" class="padding block">' . $news['unparsed'] . '</textarea> |
| 161 | 164 | <div class="floatleft" id="preview_' . $news['id'] . '"></div>'; |
| 162 | - else |
|
| 163 | - return $news['unparsed']; |
|
| 165 | + } else { |
|
| 166 | + return $news['unparsed']; |
|
| 167 | + } |
|
| 164 | 168 | }, |
| 165 | 169 | 'class' => 'half_table', |
| 166 | 170 | ), |
@@ -186,10 +190,11 @@ discard block |
||
| 186 | 190 | 'data' => array( |
| 187 | 191 | 'function' => function($news) |
| 188 | 192 | { |
| 189 | - if (is_numeric($news['id'])) |
|
| 190 | - return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '">'; |
|
| 191 | - else |
|
| 192 | - return ''; |
|
| 193 | + if (is_numeric($news['id'])) { |
|
| 194 | + return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '">'; |
|
| 195 | + } else { |
|
| 196 | + return ''; |
|
| 197 | + } |
|
| 193 | 198 | }, |
| 194 | 199 | 'class' => 'centercol icon', |
| 195 | 200 | ), |
@@ -283,12 +288,13 @@ discard block |
||
| 283 | 288 | |
| 284 | 289 | $admin_current_news = array(); |
| 285 | 290 | // Ready the current news. |
| 286 | - foreach (explode("\n", $modSettings['news']) as $id => $line) |
|
| 287 | - $admin_current_news[$id] = array( |
|
| 291 | + foreach (explode("\n", $modSettings['news']) as $id => $line) { |
|
| 292 | + $admin_current_news[$id] = array( |
|
| 288 | 293 | 'id' => $id, |
| 289 | 294 | 'unparsed' => un_preparsecode($line), |
| 290 | 295 | 'parsed' => preg_replace('~<([/]?)form[^>]*?[>]*>~i', '<em class="smalltext"><$1form></em>', parse_bbc($line)), |
| 291 | 296 | ); |
| 297 | + } |
|
| 292 | 298 | |
| 293 | 299 | $admin_current_news['last'] = array( |
| 294 | 300 | 'id' => 'last', |
@@ -355,10 +361,11 @@ discard block |
||
| 355 | 361 | 'member_count' => 0, |
| 356 | 362 | ); |
| 357 | 363 | |
| 358 | - if ($row['min_posts'] == -1) |
|
| 359 | - $normalGroups[$row['id_group']] = $row['id_group']; |
|
| 360 | - else |
|
| 361 | - $postGroups[$row['id_group']] = $row['id_group']; |
|
| 364 | + if ($row['min_posts'] == -1) { |
|
| 365 | + $normalGroups[$row['id_group']] = $row['id_group']; |
|
| 366 | + } else { |
|
| 367 | + $postGroups[$row['id_group']] = $row['id_group']; |
|
| 368 | + } |
|
| 362 | 369 | } |
| 363 | 370 | $smcFunc['db_free_result']($request); |
| 364 | 371 | |
@@ -374,8 +381,9 @@ discard block |
||
| 374 | 381 | 'post_group_list' => $postGroups, |
| 375 | 382 | ) |
| 376 | 383 | ); |
| 377 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 378 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 384 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 385 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 386 | + } |
|
| 379 | 387 | $smcFunc['db_free_result']($query); |
| 380 | 388 | } |
| 381 | 389 | |
@@ -391,8 +399,9 @@ discard block |
||
| 391 | 399 | 'normal_group_list' => $normalGroups, |
| 392 | 400 | ) |
| 393 | 401 | ); |
| 394 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 395 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 402 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 403 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 404 | + } |
|
| 396 | 405 | $smcFunc['db_free_result']($query); |
| 397 | 406 | |
| 398 | 407 | // Also do those who have it as an additional membergroup - this ones more yucky... |
@@ -409,8 +418,9 @@ discard block |
||
| 409 | 418 | 'blank_string' => '', |
| 410 | 419 | ) |
| 411 | 420 | ); |
| 412 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 413 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 421 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 422 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 423 | + } |
|
| 414 | 424 | $smcFunc['db_free_result']($query); |
| 415 | 425 | } |
| 416 | 426 | |
@@ -461,10 +471,11 @@ discard block |
||
| 461 | 471 | { |
| 462 | 472 | $context[$key] = !empty($_REQUEST[$post]) ? $_REQUEST[$post] : ''; |
| 463 | 473 | |
| 464 | - if (empty($context[$key]) && empty($_REQUEST['xml'])) |
|
| 465 | - $context['post_error']['messages'][] = $txt['error_no_' . $post]; |
|
| 466 | - elseif (!empty($_REQUEST['xml'])) |
|
| 467 | - continue; |
|
| 474 | + if (empty($context[$key]) && empty($_REQUEST['xml'])) { |
|
| 475 | + $context['post_error']['messages'][] = $txt['error_no_' . $post]; |
|
| 476 | + } elseif (!empty($_REQUEST['xml'])) { |
|
| 477 | + continue; |
|
| 478 | + } |
|
| 468 | 479 | |
| 469 | 480 | preparsecode($context[$key]); |
| 470 | 481 | if ($html) |
@@ -543,10 +554,12 @@ discard block |
||
| 543 | 554 | |
| 544 | 555 | // Start by finding any members! |
| 545 | 556 | $toClean = array(); |
| 546 | - if (!empty($_POST['members'])) |
|
| 547 | - $toClean[] = 'members'; |
|
| 548 | - if (!empty($_POST['exclude_members'])) |
|
| 549 | - $toClean[] = 'exclude_members'; |
|
| 557 | + if (!empty($_POST['members'])) { |
|
| 558 | + $toClean[] = 'members'; |
|
| 559 | + } |
|
| 560 | + if (!empty($_POST['exclude_members'])) { |
|
| 561 | + $toClean[] = 'exclude_members'; |
|
| 562 | + } |
|
| 550 | 563 | if (!empty($toClean)) |
| 551 | 564 | { |
| 552 | 565 | require_once($sourcedir . '/Subs-Auth.php'); |
@@ -558,11 +571,13 @@ discard block |
||
| 558 | 571 | preg_match_all('~"([^"]+)"~', $_POST[$type], $matches); |
| 559 | 572 | $_POST[$type] = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $_POST[$type])))); |
| 560 | 573 | |
| 561 | - foreach ($_POST[$type] as $index => $member) |
|
| 562 | - if (strlen(trim($member)) > 0) |
|
| 574 | + foreach ($_POST[$type] as $index => $member) { |
|
| 575 | + if (strlen(trim($member)) > 0) |
|
| 563 | 576 | $_POST[$type][$index] = $smcFunc['htmlspecialchars']($smcFunc['strtolower'](trim($member))); |
| 564 | - else |
|
| 565 | - unset($_POST[$type][$index]); |
|
| 577 | + } |
|
| 578 | + else { |
|
| 579 | + unset($_POST[$type][$index]); |
|
| 580 | + } |
|
| 566 | 581 | |
| 567 | 582 | // Find the members |
| 568 | 583 | $_POST[$type] = implode(',', array_keys(findMembers($_POST[$type]))); |
@@ -572,16 +587,18 @@ discard block |
||
| 572 | 587 | if (isset($_POST['member_list']) && is_array($_POST['member_list'])) |
| 573 | 588 | { |
| 574 | 589 | $members = array(); |
| 575 | - foreach ($_POST['member_list'] as $member_id) |
|
| 576 | - $members[] = (int) $member_id; |
|
| 590 | + foreach ($_POST['member_list'] as $member_id) { |
|
| 591 | + $members[] = (int) $member_id; |
|
| 592 | + } |
|
| 577 | 593 | $_POST['members'] = implode(',', $members); |
| 578 | 594 | } |
| 579 | 595 | |
| 580 | 596 | if (isset($_POST['exclude_member_list']) && is_array($_POST['exclude_member_list'])) |
| 581 | 597 | { |
| 582 | 598 | $members = array(); |
| 583 | - foreach ($_POST['exclude_member_list'] as $member_id) |
|
| 584 | - $members[] = (int) $member_id; |
|
| 599 | + foreach ($_POST['exclude_member_list'] as $member_id) { |
|
| 600 | + $members[] = (int) $member_id; |
|
| 601 | + } |
|
| 585 | 602 | $_POST['exclude_members'] = implode(',', $members); |
| 586 | 603 | } |
| 587 | 604 | |
@@ -605,8 +622,9 @@ discard block |
||
| 605 | 622 | 'current_time' => time(), |
| 606 | 623 | ) |
| 607 | 624 | ); |
| 608 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 609 | - $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 625 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 626 | + $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 627 | + } |
|
| 610 | 628 | $smcFunc['db_free_result']($request); |
| 611 | 629 | |
| 612 | 630 | $request = $smcFunc['db_query']('', ' |
@@ -641,8 +659,9 @@ discard block |
||
| 641 | 659 | WHERE email_address IN(' . implode(', ', $condition_array) . ')', |
| 642 | 660 | $condition_array_params |
| 643 | 661 | ); |
| 644 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 645 | - $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 662 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 663 | + $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 664 | + } |
|
| 646 | 665 | $smcFunc['db_free_result']($request); |
| 647 | 666 | } |
| 648 | 667 | |
@@ -660,10 +679,11 @@ discard block |
||
| 660 | 679 | ); |
| 661 | 680 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 662 | 681 | { |
| 663 | - if (in_array(3, $context['recipients'])) |
|
| 664 | - $context['recipients']['exclude_members'][] = $row['identifier']; |
|
| 665 | - else |
|
| 666 | - $context['recipients']['members'][] = $row['identifier']; |
|
| 682 | + if (in_array(3, $context['recipients'])) { |
|
| 683 | + $context['recipients']['exclude_members'][] = $row['identifier']; |
|
| 684 | + } else { |
|
| 685 | + $context['recipients']['members'][] = $row['identifier']; |
|
| 686 | + } |
|
| 667 | 687 | } |
| 668 | 688 | $smcFunc['db_free_result']($request); |
| 669 | 689 | } |
@@ -710,8 +730,9 @@ discard block |
||
| 710 | 730 | $num_at_once = 1000; |
| 711 | 731 | |
| 712 | 732 | // If by PM's I suggest we half the above number. |
| 713 | - if (!empty($_POST['send_pm'])) |
|
| 714 | - $num_at_once /= 2; |
|
| 733 | + if (!empty($_POST['send_pm'])) { |
|
| 734 | + $num_at_once /= 2; |
|
| 735 | + } |
|
| 715 | 736 | |
| 716 | 737 | checkSession(); |
| 717 | 738 | |
@@ -734,8 +755,7 @@ discard block |
||
| 734 | 755 | ); |
| 735 | 756 | list ($context['total_members']) = $smcFunc['db_fetch_row']($request); |
| 736 | 757 | $smcFunc['db_free_result']($request); |
| 737 | - } |
|
| 738 | - else |
|
| 758 | + } else |
|
| 739 | 759 | { |
| 740 | 760 | $context['total_members'] = (int) $_REQUEST['total_members']; |
| 741 | 761 | } |
@@ -753,32 +773,35 @@ discard block |
||
| 753 | 773 | if (!empty($_POST['exclude_members'])) |
| 754 | 774 | { |
| 755 | 775 | $members = explode(',', $_POST['exclude_members']); |
| 756 | - foreach ($members as $member) |
|
| 757 | - if ($member >= $context['start']) |
|
| 776 | + foreach ($members as $member) { |
|
| 777 | + if ($member >= $context['start']) |
|
| 758 | 778 | $context['recipients']['exclude_members'][] = (int) $member; |
| 779 | + } |
|
| 759 | 780 | } |
| 760 | 781 | |
| 761 | 782 | // What about members we *must* do? |
| 762 | 783 | if (!empty($_POST['members'])) |
| 763 | 784 | { |
| 764 | 785 | $members = explode(',', $_POST['members']); |
| 765 | - foreach ($members as $member) |
|
| 766 | - if ($member >= $context['start']) |
|
| 786 | + foreach ($members as $member) { |
|
| 787 | + if ($member >= $context['start']) |
|
| 767 | 788 | $context['recipients']['members'][] = (int) $member; |
| 789 | + } |
|
| 768 | 790 | } |
| 769 | 791 | // Cleaning groups is simple - although deal with both checkbox and commas. |
| 770 | 792 | if (isset($_POST['groups'])) |
| 771 | 793 | { |
| 772 | 794 | if (is_array($_POST['groups'])) |
| 773 | 795 | { |
| 774 | - foreach ($_POST['groups'] as $group => $dummy) |
|
| 775 | - $context['recipients']['groups'][] = (int) $group; |
|
| 776 | - } |
|
| 777 | - else |
|
| 796 | + foreach ($_POST['groups'] as $group => $dummy) { |
|
| 797 | + $context['recipients']['groups'][] = (int) $group; |
|
| 798 | + } |
|
| 799 | + } else |
|
| 778 | 800 | { |
| 779 | 801 | $groups = explode(',', $_POST['groups']); |
| 780 | - foreach ($groups as $group) |
|
| 781 | - $context['recipients']['groups'][] = (int) $group; |
|
| 802 | + foreach ($groups as $group) { |
|
| 803 | + $context['recipients']['groups'][] = (int) $group; |
|
| 804 | + } |
|
| 782 | 805 | } |
| 783 | 806 | } |
| 784 | 807 | // Same for excluded groups |
@@ -786,15 +809,17 @@ discard block |
||
| 786 | 809 | { |
| 787 | 810 | if (is_array($_POST['exclude_groups'])) |
| 788 | 811 | { |
| 789 | - foreach ($_POST['exclude_groups'] as $group => $dummy) |
|
| 790 | - $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 812 | + foreach ($_POST['exclude_groups'] as $group => $dummy) { |
|
| 813 | + $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 814 | + } |
|
| 791 | 815 | } |
| 792 | 816 | // Ignore an empty string - we don't want to exclude "Regular Members" unless it's specifically selected |
| 793 | 817 | elseif ($_POST['exclude_groups'] != '') |
| 794 | 818 | { |
| 795 | 819 | $groups = explode(',', $_POST['exclude_groups']); |
| 796 | - foreach ($groups as $group) |
|
| 797 | - $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 820 | + foreach ($groups as $group) { |
|
| 821 | + $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 822 | + } |
|
| 798 | 823 | } |
| 799 | 824 | } |
| 800 | 825 | // Finally - emails! |
@@ -804,14 +829,16 @@ discard block |
||
| 804 | 829 | foreach ($addressed as $curmem) |
| 805 | 830 | { |
| 806 | 831 | $curmem = trim($curmem); |
| 807 | - if ($curmem != '' && filter_var($curmem, FILTER_VALIDATE_EMAIL)) |
|
| 808 | - $context['recipients']['emails'][$curmem] = $curmem; |
|
| 832 | + if ($curmem != '' && filter_var($curmem, FILTER_VALIDATE_EMAIL)) { |
|
| 833 | + $context['recipients']['emails'][$curmem] = $curmem; |
|
| 834 | + } |
|
| 809 | 835 | } |
| 810 | 836 | } |
| 811 | 837 | |
| 812 | 838 | // If we're only cleaning drop out here. |
| 813 | - if ($clean_only) |
|
| 814 | - return; |
|
| 839 | + if ($clean_only) { |
|
| 840 | + return; |
|
| 841 | + } |
|
| 815 | 842 | |
| 816 | 843 | require_once($sourcedir . '/Subs-Post.php'); |
| 817 | 844 | |
@@ -827,16 +854,18 @@ discard block |
||
| 827 | 854 | if (!$context['send_pm'] && !empty($_POST['send_html'])) |
| 828 | 855 | { |
| 829 | 856 | // Prepare the message for HTML. |
| 830 | - if (!empty($_POST['parse_html'])) |
|
| 831 | - $_POST['message'] = str_replace(array("\n", ' '), array('<br>' . "\n", ' '), $_POST['message']); |
|
| 857 | + if (!empty($_POST['parse_html'])) { |
|
| 858 | + $_POST['message'] = str_replace(array("\n", ' '), array('<br>' . "\n", ' '), $_POST['message']); |
|
| 859 | + } |
|
| 832 | 860 | |
| 833 | 861 | // This is here to prevent spam filters from tagging this as spam. |
| 834 | 862 | if (preg_match('~\<html~i', $_POST['message']) == 0) |
| 835 | 863 | { |
| 836 | - if (preg_match('~\<body~i', $_POST['message']) == 0) |
|
| 837 | - $_POST['message'] = '<html><head><title>' . $_POST['subject'] . '</title></head>' . "\n" . '<body>' . $_POST['message'] . '</body></html>'; |
|
| 838 | - else |
|
| 839 | - $_POST['message'] = '<html>' . $_POST['message'] . '</html>'; |
|
| 864 | + if (preg_match('~\<body~i', $_POST['message']) == 0) { |
|
| 865 | + $_POST['message'] = '<html><head><title>' . $_POST['subject'] . '</title></head>' . "\n" . '<body>' . $_POST['message'] . '</body></html>'; |
|
| 866 | + } else { |
|
| 867 | + $_POST['message'] = '<html>' . $_POST['message'] . '</html>'; |
|
| 868 | + } |
|
| 840 | 869 | } |
| 841 | 870 | } |
| 842 | 871 | |
@@ -890,15 +919,17 @@ discard block |
||
| 890 | 919 | foreach ($context['recipients']['emails'] as $k => $email) |
| 891 | 920 | { |
| 892 | 921 | // Done as many as we can? |
| 893 | - if ($i >= $num_at_once) |
|
| 894 | - break; |
|
| 922 | + if ($i >= $num_at_once) { |
|
| 923 | + break; |
|
| 924 | + } |
|
| 895 | 925 | |
| 896 | 926 | // Don't sent it twice! |
| 897 | 927 | unset($context['recipients']['emails'][$k]); |
| 898 | 928 | |
| 899 | 929 | // Dammit - can't PM emails! |
| 900 | - if ($context['send_pm']) |
|
| 901 | - continue; |
|
| 930 | + if ($context['send_pm']) { |
|
| 931 | + continue; |
|
| 932 | + } |
|
| 902 | 933 | |
| 903 | 934 | $to_member = array( |
| 904 | 935 | $email, |
@@ -932,8 +963,9 @@ discard block |
||
| 932 | 963 | $queryBuild[] = 'mem.id_post_group = {int:group_' . $group . '}'; |
| 933 | 964 | } |
| 934 | 965 | } |
| 935 | - if (!empty($queryBuild)) |
|
| 936 | - $sendQuery .= implode(' OR ', $queryBuild); |
|
| 966 | + if (!empty($queryBuild)) { |
|
| 967 | + $sendQuery .= implode(' OR ', $queryBuild); |
|
| 968 | + } |
|
| 937 | 969 | } |
| 938 | 970 | if (!empty($context['recipients']['members'])) |
| 939 | 971 | { |
@@ -952,8 +984,9 @@ discard block |
||
| 952 | 984 | } |
| 953 | 985 | |
| 954 | 986 | // Anything to exclude? |
| 955 | - if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) |
|
| 956 | - $sendQuery .= ' AND mem.id_group != {int:regular_group}'; |
|
| 987 | + if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) { |
|
| 988 | + $sendQuery .= ' AND mem.id_group != {int:regular_group}'; |
|
| 989 | + } |
|
| 957 | 990 | if (!empty($context['recipients']['exclude_members'])) |
| 958 | 991 | { |
| 959 | 992 | $sendQuery .= ' AND mem.id_member NOT IN ({array_int:exclude_members})'; |
@@ -989,21 +1022,24 @@ discard block |
||
| 989 | 1022 | foreach ($rows as $row) |
| 990 | 1023 | { |
| 991 | 1024 | // Force them to have it? |
| 992 | - if (empty($context['email_force']) && empty($prefs[$row['id_member']]['announcements'])) |
|
| 993 | - continue; |
|
| 1025 | + if (empty($context['email_force']) && empty($prefs[$row['id_member']]['announcements'])) { |
|
| 1026 | + continue; |
|
| 1027 | + } |
|
| 994 | 1028 | |
| 995 | 1029 | // What groups are we looking at here? |
| 996 | - if (empty($row['additional_groups'])) |
|
| 997 | - $groups = array($row['id_group'], $row['id_post_group']); |
|
| 998 | - else |
|
| 999 | - $groups = array_merge( |
|
| 1030 | + if (empty($row['additional_groups'])) { |
|
| 1031 | + $groups = array($row['id_group'], $row['id_post_group']); |
|
| 1032 | + } else { |
|
| 1033 | + $groups = array_merge( |
|
| 1000 | 1034 | array($row['id_group'], $row['id_post_group']), |
| 1001 | 1035 | explode(',', $row['additional_groups']) |
| 1002 | 1036 | ); |
| 1037 | + } |
|
| 1003 | 1038 | |
| 1004 | 1039 | // Excluded groups? |
| 1005 | - if (array_intersect($groups, $context['recipients']['exclude_groups'])) |
|
| 1006 | - continue; |
|
| 1040 | + if (array_intersect($groups, $context['recipients']['exclude_groups'])) { |
|
| 1041 | + continue; |
|
| 1042 | + } |
|
| 1007 | 1043 | |
| 1008 | 1044 | // We might need this |
| 1009 | 1045 | $cleanMemberName = empty($_POST['send_html']) || $context['send_pm'] ? un_htmlspecialchars($row['real_name']) : $row['real_name']; |
@@ -1026,10 +1062,11 @@ discard block |
||
| 1026 | 1062 | ), $_POST['subject']); |
| 1027 | 1063 | |
| 1028 | 1064 | // Send the actual email - or a PM! |
| 1029 | - if (!$context['send_pm']) |
|
| 1030 | - sendmail($row['email_address'], $subject, $message, null, 'news', !empty($_POST['send_html']), 5); |
|
| 1031 | - else |
|
| 1032 | - sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message); |
|
| 1065 | + if (!$context['send_pm']) { |
|
| 1066 | + sendmail($row['email_address'], $subject, $message, null, 'news', !empty($_POST['send_html']), 5); |
|
| 1067 | + } else { |
|
| 1068 | + sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message); |
|
| 1069 | + } |
|
| 1033 | 1070 | } |
| 1034 | 1071 | } |
| 1035 | 1072 | |
@@ -1079,8 +1116,9 @@ discard block |
||
| 1079 | 1116 | |
| 1080 | 1117 | call_integration_hook('integrate_modify_news_settings', array(&$config_vars)); |
| 1081 | 1118 | |
| 1082 | - if ($return_config) |
|
| 1083 | - return $config_vars; |
|
| 1119 | + if ($return_config) { |
|
| 1120 | + return $config_vars; |
|
| 1121 | + } |
|
| 1084 | 1122 | |
| 1085 | 1123 | $context['page_title'] = $txt['admin_edit_news'] . ' - ' . $txt['settings']; |
| 1086 | 1124 | $context['sub_template'] = 'show_settings'; |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * @version 2.1 Beta 4 |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -if (!defined('SMF')) |
|
| 18 | +if (!defined('SMF')) { |
|
| 19 | 19 | die('No direct access...'); |
| 20 | +} |
|
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * This defines every profile field known to man. |
@@ -29,8 +30,9 @@ discard block |
||
| 29 | 30 | global $sourcedir, $profile_vars; |
| 30 | 31 | |
| 31 | 32 | // Don't load this twice! |
| 32 | - if (!empty($profile_fields) && !$force_reload) |
|
| 33 | - return; |
|
| 33 | + if (!empty($profile_fields) && !$force_reload) { |
|
| 34 | + return; |
|
| 35 | + } |
|
| 34 | 36 | |
| 35 | 37 | /* This horrific array defines all the profile fields in the whole world! |
| 36 | 38 | In general each "field" has one array - the key of which is the database column name associated with said field. Each item |
@@ -103,13 +105,14 @@ discard block |
||
| 103 | 105 | if (isset($_POST['bday2'], $_POST['bday3']) && $value > 0 && $_POST['bday2'] > 0) |
| 104 | 106 | { |
| 105 | 107 | // Set to blank? |
| 106 | - if ((int) $_POST['bday3'] == 1 && (int) $_POST['bday2'] == 1 && (int) $value == 1) |
|
| 107 | - $value = '1004-01-01'; |
|
| 108 | - else |
|
| 109 | - $value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 1004 ? 1004 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 1004 ? 1004 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '1004-01-01'; |
|
| 108 | + if ((int) $_POST['bday3'] == 1 && (int) $_POST['bday2'] == 1 && (int) $value == 1) { |
|
| 109 | + $value = '1004-01-01'; |
|
| 110 | + } else { |
|
| 111 | + $value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 1004 ? 1004 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 1004 ? 1004 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '1004-01-01'; |
|
| 112 | + } |
|
| 113 | + } else { |
|
| 114 | + $value = '1004-01-01'; |
|
| 110 | 115 | } |
| 111 | - else |
|
| 112 | - $value = '1004-01-01'; |
|
| 113 | 116 | |
| 114 | 117 | $profile_vars['birthdate'] = $value; |
| 115 | 118 | $cur_profile['birthdate'] = $value; |
@@ -127,8 +130,7 @@ discard block |
||
| 127 | 130 | { |
| 128 | 131 | $value = checkdate($dates[2], $dates[3], $dates[1] < 4 ? 4 : $dates[1]) ? sprintf('%04d-%02d-%02d', $dates[1] < 4 ? 4 : $dates[1], $dates[2], $dates[3]) : '1004-01-01'; |
| 129 | 132 | return true; |
| 130 | - } |
|
| 131 | - else |
|
| 133 | + } else |
|
| 132 | 134 | { |
| 133 | 135 | $value = empty($cur_profile['birthdate']) ? '1004-01-01' : $cur_profile['birthdate']; |
| 134 | 136 | return false; |
@@ -150,10 +152,11 @@ discard block |
||
| 150 | 152 | return $txt['invalid_registration'] . ' ' . strftime('%d %b %Y ' . (strpos($user_info['time_format'], '%H') !== false ? '%I:%M:%S %p' : '%H:%M:%S'), forum_time(false)); |
| 151 | 153 | } |
| 152 | 154 | // As long as it doesn't equal "N/A"... |
| 153 | - elseif ($value != $txt['not_applicable'] && $value != strtotime(strftime('%Y-%m-%d', $cur_profile['date_registered'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600))) |
|
| 154 | - $value = $value - ($user_info['time_offset'] + $modSettings['time_offset']) * 3600; |
|
| 155 | - else |
|
| 156 | - $value = $cur_profile['date_registered']; |
|
| 155 | + elseif ($value != $txt['not_applicable'] && $value != strtotime(strftime('%Y-%m-%d', $cur_profile['date_registered'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600))) { |
|
| 156 | + $value = $value - ($user_info['time_offset'] + $modSettings['time_offset']) * 3600; |
|
| 157 | + } else { |
|
| 158 | + $value = $cur_profile['date_registered']; |
|
| 159 | + } |
|
| 157 | 160 | |
| 158 | 161 | return true; |
| 159 | 162 | }, |
@@ -177,8 +180,9 @@ discard block |
||
| 177 | 180 | { |
| 178 | 181 | global $context, $old_profile, $profile_vars, $sourcedir, $modSettings; |
| 179 | 182 | |
| 180 | - if (strtolower($value) == strtolower($old_profile['email_address'])) |
|
| 181 | - return false; |
|
| 183 | + if (strtolower($value) == strtolower($old_profile['email_address'])) { |
|
| 184 | + return false; |
|
| 185 | + } |
|
| 182 | 186 | |
| 183 | 187 | $isValid = profileValidateEmail($value, $context['id_member']); |
| 184 | 188 | |
@@ -254,11 +258,11 @@ discard block |
||
| 254 | 258 | |
| 255 | 259 | if (isset($context['profile_languages'][$value])) |
| 256 | 260 | { |
| 257 | - if ($context['user']['is_owner'] && empty($context['password_auth_failed'])) |
|
| 258 | - $_SESSION['language'] = $value; |
|
| 261 | + if ($context['user']['is_owner'] && empty($context['password_auth_failed'])) { |
|
| 262 | + $_SESSION['language'] = $value; |
|
| 263 | + } |
|
| 259 | 264 | return true; |
| 260 | - } |
|
| 261 | - else |
|
| 265 | + } else |
|
| 262 | 266 | { |
| 263 | 267 | $value = $cur_profile['lngfile']; |
| 264 | 268 | return false; |
@@ -282,13 +286,14 @@ discard block |
||
| 282 | 286 | |
| 283 | 287 | // Maybe they are trying to change their password as well? |
| 284 | 288 | $resetPassword = true; |
| 285 | - if (isset($_POST['passwrd1']) && $_POST['passwrd1'] != '' && isset($_POST['passwrd2']) && $_POST['passwrd1'] == $_POST['passwrd2'] && validatePassword($_POST['passwrd1'], $value, array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])) == null) |
|
| 286 | - $resetPassword = false; |
|
| 289 | + if (isset($_POST['passwrd1']) && $_POST['passwrd1'] != '' && isset($_POST['passwrd2']) && $_POST['passwrd1'] == $_POST['passwrd2'] && validatePassword($_POST['passwrd1'], $value, array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])) == null) { |
|
| 290 | + $resetPassword = false; |
|
| 291 | + } |
|
| 287 | 292 | |
| 288 | 293 | // Do the reset... this will send them an email too. |
| 289 | - if ($resetPassword) |
|
| 290 | - resetPassword($context['id_member'], $value); |
|
| 291 | - elseif ($value !== null) |
|
| 294 | + if ($resetPassword) { |
|
| 295 | + resetPassword($context['id_member'], $value); |
|
| 296 | + } elseif ($value !== null) |
|
| 292 | 297 | { |
| 293 | 298 | validateUsername($context['id_member'], trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $value))); |
| 294 | 299 | updateMemberData($context['id_member'], array('member_name' => $value)); |
@@ -312,20 +317,23 @@ discard block |
||
| 312 | 317 | 'input_validate' => function(&$value) use ($sourcedir, $user_info, $smcFunc, $cur_profile) |
| 313 | 318 | { |
| 314 | 319 | // If we didn't try it then ignore it! |
| 315 | - if ($value == '') |
|
| 316 | - return false; |
|
| 320 | + if ($value == '') { |
|
| 321 | + return false; |
|
| 322 | + } |
|
| 317 | 323 | |
| 318 | 324 | // Do the two entries for the password even match? |
| 319 | - if (!isset($_POST['passwrd2']) || $value != $_POST['passwrd2']) |
|
| 320 | - return 'bad_new_password'; |
|
| 325 | + if (!isset($_POST['passwrd2']) || $value != $_POST['passwrd2']) { |
|
| 326 | + return 'bad_new_password'; |
|
| 327 | + } |
|
| 321 | 328 | |
| 322 | 329 | // Let's get the validation function into play... |
| 323 | 330 | require_once($sourcedir . '/Subs-Auth.php'); |
| 324 | 331 | $passwordErrors = validatePassword($value, $cur_profile['member_name'], array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])); |
| 325 | 332 | |
| 326 | 333 | // Were there errors? |
| 327 | - if ($passwordErrors != null) |
|
| 328 | - return 'password_' . $passwordErrors; |
|
| 334 | + if ($passwordErrors != null) { |
|
| 335 | + return 'password_' . $passwordErrors; |
|
| 336 | + } |
|
| 329 | 337 | |
| 330 | 338 | // Set up the new password variable... ready for storage. |
| 331 | 339 | $value = hash_password($cur_profile['member_name'], un_htmlspecialchars($value)); |
@@ -350,8 +358,9 @@ discard block |
||
| 350 | 358 | 'permission' => 'profile_blurb', |
| 351 | 359 | 'input_validate' => function(&$value) use ($smcFunc) |
| 352 | 360 | { |
| 353 | - if ($smcFunc['strlen']($value) > 50) |
|
| 354 | - return 'personal_text_too_long'; |
|
| 361 | + if ($smcFunc['strlen']($value) > 50) { |
|
| 362 | + return 'personal_text_too_long'; |
|
| 363 | + } |
|
| 355 | 364 | |
| 356 | 365 | return true; |
| 357 | 366 | }, |
@@ -386,10 +395,11 @@ discard block |
||
| 386 | 395 | 'permission' => 'moderate_forum', |
| 387 | 396 | 'input_validate' => function(&$value) |
| 388 | 397 | { |
| 389 | - if (!is_numeric($value)) |
|
| 390 | - return 'digits_only'; |
|
| 391 | - else |
|
| 392 | - $value = $value != '' ? strtr($value, array(',' => '', '.' => '', ' ' => '')) : 0; |
|
| 398 | + if (!is_numeric($value)) { |
|
| 399 | + return 'digits_only'; |
|
| 400 | + } else { |
|
| 401 | + $value = $value != '' ? strtr($value, array(',' => '', '.' => '', ' ' => '')) : 0; |
|
| 402 | + } |
|
| 393 | 403 | return true; |
| 394 | 404 | }, |
| 395 | 405 | ), |
@@ -405,15 +415,16 @@ discard block |
||
| 405 | 415 | { |
| 406 | 416 | $value = trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $value)); |
| 407 | 417 | |
| 408 | - if (trim($value) == '') |
|
| 409 | - return 'no_name'; |
|
| 410 | - elseif ($smcFunc['strlen']($value) > 60) |
|
| 411 | - return 'name_too_long'; |
|
| 412 | - elseif ($cur_profile['real_name'] != $value) |
|
| 418 | + if (trim($value) == '') { |
|
| 419 | + return 'no_name'; |
|
| 420 | + } elseif ($smcFunc['strlen']($value) > 60) { |
|
| 421 | + return 'name_too_long'; |
|
| 422 | + } elseif ($cur_profile['real_name'] != $value) |
|
| 413 | 423 | { |
| 414 | 424 | require_once($sourcedir . '/Subs-Members.php'); |
| 415 | - if (isReservedName($value, $context['id_member'])) |
|
| 416 | - return 'name_taken'; |
|
| 425 | + if (isReservedName($value, $context['id_member'])) { |
|
| 426 | + return 'name_taken'; |
|
| 427 | + } |
|
| 417 | 428 | } |
| 418 | 429 | return true; |
| 419 | 430 | }, |
@@ -471,8 +482,9 @@ discard block |
||
| 471 | 482 | 'selected' => $set == $context['member']['smiley_set']['id'] |
| 472 | 483 | ); |
| 473 | 484 | |
| 474 | - if ($context['smiley_sets'][$i]['selected']) |
|
| 475 | - $context['member']['smiley_set']['name'] = $set_names[$i]; |
|
| 485 | + if ($context['smiley_sets'][$i]['selected']) { |
|
| 486 | + $context['member']['smiley_set']['name'] = $set_names[$i]; |
|
| 487 | + } |
|
| 476 | 488 | } |
| 477 | 489 | return true; |
| 478 | 490 | }, |
@@ -481,8 +493,9 @@ discard block |
||
| 481 | 493 | global $modSettings; |
| 482 | 494 | |
| 483 | 495 | $smiley_sets = explode(',', $modSettings['smiley_sets_known']); |
| 484 | - if (!in_array($value, $smiley_sets) && $value != 'none') |
|
| 485 | - $value = ''; |
|
| 496 | + if (!in_array($value, $smiley_sets) && $value != 'none') { |
|
| 497 | + $value = ''; |
|
| 498 | + } |
|
| 486 | 499 | return true; |
| 487 | 500 | }, |
| 488 | 501 | ), |
@@ -497,8 +510,9 @@ discard block |
||
| 497 | 510 | loadLanguage('Settings'); |
| 498 | 511 | |
| 499 | 512 | $context['allow_no_censored'] = false; |
| 500 | - if ($user_info['is_admin'] || $context['user']['is_owner']) |
|
| 501 | - $context['allow_no_censored'] = !empty($modSettings['allow_no_censored']); |
|
| 513 | + if ($user_info['is_admin'] || $context['user']['is_owner']) { |
|
| 514 | + $context['allow_no_censored'] = !empty($modSettings['allow_no_censored']); |
|
| 515 | + } |
|
| 502 | 516 | |
| 503 | 517 | return true; |
| 504 | 518 | }, |
@@ -545,8 +559,9 @@ discard block |
||
| 545 | 559 | 'input_validate' => function($value) |
| 546 | 560 | { |
| 547 | 561 | $tz = smf_list_timezones(); |
| 548 | - if (!isset($tz[$value])) |
|
| 549 | - return 'bad_timezone'; |
|
| 562 | + if (!isset($tz[$value])) { |
|
| 563 | + return 'bad_timezone'; |
|
| 564 | + } |
|
| 550 | 565 | |
| 551 | 566 | return true; |
| 552 | 567 | }, |
@@ -561,8 +576,9 @@ discard block |
||
| 561 | 576 | 'enabled' => !empty($modSettings['titlesEnable']), |
| 562 | 577 | 'input_validate' => function(&$value) use ($smcFunc) |
| 563 | 578 | { |
| 564 | - if ($smcFunc['strlen']($value) > 50) |
|
| 565 | - return 'user_title_too_long'; |
|
| 579 | + if ($smcFunc['strlen']($value) > 50) { |
|
| 580 | + return 'user_title_too_long'; |
|
| 581 | + } |
|
| 566 | 582 | |
| 567 | 583 | return true; |
| 568 | 584 | }, |
@@ -584,10 +600,12 @@ discard block |
||
| 584 | 600 | // Fix the URL... |
| 585 | 601 | 'input_validate' => function(&$value) |
| 586 | 602 | { |
| 587 | - if (strlen(trim($value)) > 0 && strpos($value, '://') === false) |
|
| 588 | - $value = 'http://' . $value; |
|
| 589 | - if (strlen($value) < 8 || (substr($value, 0, 7) !== 'http://' && substr($value, 0, 8) !== 'https://')) |
|
| 590 | - $value = ''; |
|
| 603 | + if (strlen(trim($value)) > 0 && strpos($value, '://') === false) { |
|
| 604 | + $value = 'http://' . $value; |
|
| 605 | + } |
|
| 606 | + if (strlen($value) < 8 || (substr($value, 0, 7) !== 'http://' && substr($value, 0, 8) !== 'https://')) { |
|
| 607 | + $value = ''; |
|
| 608 | + } |
|
| 591 | 609 | return true; |
| 592 | 610 | }, |
| 593 | 611 | 'link_with' => 'website', |
@@ -601,16 +619,19 @@ discard block |
||
| 601 | 619 | foreach ($profile_fields as $key => $field) |
| 602 | 620 | { |
| 603 | 621 | // Do we have permission to do this? |
| 604 | - if (isset($field['permission']) && !allowedTo(($context['user']['is_owner'] ? array($field['permission'] . '_own', $field['permission'] . '_any') : $field['permission'] . '_any')) && !allowedTo($field['permission'])) |
|
| 605 | - unset($profile_fields[$key]); |
|
| 622 | + if (isset($field['permission']) && !allowedTo(($context['user']['is_owner'] ? array($field['permission'] . '_own', $field['permission'] . '_any') : $field['permission'] . '_any')) && !allowedTo($field['permission'])) { |
|
| 623 | + unset($profile_fields[$key]); |
|
| 624 | + } |
|
| 606 | 625 | |
| 607 | 626 | // Is it enabled? |
| 608 | - if (isset($field['enabled']) && !$field['enabled']) |
|
| 609 | - unset($profile_fields[$key]); |
|
| 627 | + if (isset($field['enabled']) && !$field['enabled']) { |
|
| 628 | + unset($profile_fields[$key]); |
|
| 629 | + } |
|
| 610 | 630 | |
| 611 | 631 | // Is it specifically disabled? |
| 612 | - if (in_array($key, $disabled_fields) || (isset($field['link_with']) && in_array($field['link_with'], $disabled_fields))) |
|
| 613 | - unset($profile_fields[$key]); |
|
| 632 | + if (in_array($key, $disabled_fields) || (isset($field['link_with']) && in_array($field['link_with'], $disabled_fields))) { |
|
| 633 | + unset($profile_fields[$key]); |
|
| 634 | + } |
|
| 614 | 635 | } |
| 615 | 636 | } |
| 616 | 637 | |
@@ -635,9 +656,10 @@ discard block |
||
| 635 | 656 | loadProfileFields(true); |
| 636 | 657 | |
| 637 | 658 | // First check for any linked sets. |
| 638 | - foreach ($profile_fields as $key => $field) |
|
| 639 | - if (isset($field['link_with']) && in_array($field['link_with'], $fields)) |
|
| 659 | + foreach ($profile_fields as $key => $field) { |
|
| 660 | + if (isset($field['link_with']) && in_array($field['link_with'], $fields)) |
|
| 640 | 661 | $fields[] = $key; |
| 662 | + } |
|
| 641 | 663 | |
| 642 | 664 | $i = 0; |
| 643 | 665 | $last_type = ''; |
@@ -649,38 +671,46 @@ discard block |
||
| 649 | 671 | $cur_field = &$profile_fields[$field]; |
| 650 | 672 | |
| 651 | 673 | // Does it have a preload and does that preload succeed? |
| 652 | - if (isset($cur_field['preload']) && !$cur_field['preload']()) |
|
| 653 | - continue; |
|
| 674 | + if (isset($cur_field['preload']) && !$cur_field['preload']()) { |
|
| 675 | + continue; |
|
| 676 | + } |
|
| 654 | 677 | |
| 655 | 678 | // If this is anything but complex we need to do more cleaning! |
| 656 | 679 | if ($cur_field['type'] != 'callback' && $cur_field['type'] != 'hidden') |
| 657 | 680 | { |
| 658 | - if (!isset($cur_field['label'])) |
|
| 659 | - $cur_field['label'] = isset($txt[$field]) ? $txt[$field] : $field; |
|
| 681 | + if (!isset($cur_field['label'])) { |
|
| 682 | + $cur_field['label'] = isset($txt[$field]) ? $txt[$field] : $field; |
|
| 683 | + } |
|
| 660 | 684 | |
| 661 | 685 | // Everything has a value! |
| 662 | - if (!isset($cur_field['value'])) |
|
| 663 | - $cur_field['value'] = isset($cur_profile[$field]) ? $cur_profile[$field] : ''; |
|
| 686 | + if (!isset($cur_field['value'])) { |
|
| 687 | + $cur_field['value'] = isset($cur_profile[$field]) ? $cur_profile[$field] : ''; |
|
| 688 | + } |
|
| 664 | 689 | |
| 665 | 690 | // Any input attributes? |
| 666 | 691 | $cur_field['input_attr'] = !empty($cur_field['input_attr']) ? implode(',', $cur_field['input_attr']) : ''; |
| 667 | 692 | } |
| 668 | 693 | |
| 669 | 694 | // Was there an error with this field on posting? |
| 670 | - if (isset($context['profile_errors'][$field])) |
|
| 671 | - $cur_field['is_error'] = true; |
|
| 695 | + if (isset($context['profile_errors'][$field])) { |
|
| 696 | + $cur_field['is_error'] = true; |
|
| 697 | + } |
|
| 672 | 698 | |
| 673 | 699 | // Any javascript stuff? |
| 674 | - if (!empty($cur_field['js_submit'])) |
|
| 675 | - $context['profile_onsubmit_javascript'] .= $cur_field['js_submit']; |
|
| 676 | - if (!empty($cur_field['js'])) |
|
| 677 | - $context['profile_javascript'] .= $cur_field['js']; |
|
| 700 | + if (!empty($cur_field['js_submit'])) { |
|
| 701 | + $context['profile_onsubmit_javascript'] .= $cur_field['js_submit']; |
|
| 702 | + } |
|
| 703 | + if (!empty($cur_field['js'])) { |
|
| 704 | + $context['profile_javascript'] .= $cur_field['js']; |
|
| 705 | + } |
|
| 678 | 706 | |
| 679 | 707 | // Any template stuff? |
| 680 | - if (!empty($cur_field['prehtml'])) |
|
| 681 | - $context['profile_prehtml'] .= $cur_field['prehtml']; |
|
| 682 | - if (!empty($cur_field['posthtml'])) |
|
| 683 | - $context['profile_posthtml'] .= $cur_field['posthtml']; |
|
| 708 | + if (!empty($cur_field['prehtml'])) { |
|
| 709 | + $context['profile_prehtml'] .= $cur_field['prehtml']; |
|
| 710 | + } |
|
| 711 | + if (!empty($cur_field['posthtml'])) { |
|
| 712 | + $context['profile_posthtml'] .= $cur_field['posthtml']; |
|
| 713 | + } |
|
| 684 | 714 | |
| 685 | 715 | // Finally put it into context? |
| 686 | 716 | if ($cur_field['type'] != 'hidden') |
@@ -713,12 +743,14 @@ discard block |
||
| 713 | 743 | }, false);' : ''), true); |
| 714 | 744 | |
| 715 | 745 | // Any onsubmit javascript? |
| 716 | - if (!empty($context['profile_onsubmit_javascript'])) |
|
| 717 | - addInlineJavaScript($context['profile_onsubmit_javascript'], true); |
|
| 746 | + if (!empty($context['profile_onsubmit_javascript'])) { |
|
| 747 | + addInlineJavaScript($context['profile_onsubmit_javascript'], true); |
|
| 748 | + } |
|
| 718 | 749 | |
| 719 | 750 | // Any totally custom stuff? |
| 720 | - if (!empty($context['profile_javascript'])) |
|
| 721 | - addInlineJavaScript($context['profile_javascript'], true); |
|
| 751 | + if (!empty($context['profile_javascript'])) { |
|
| 752 | + addInlineJavaScript($context['profile_javascript'], true); |
|
| 753 | + } |
|
| 722 | 754 | |
| 723 | 755 | // Free up some memory. |
| 724 | 756 | unset($profile_fields); |
@@ -739,8 +771,9 @@ discard block |
||
| 739 | 771 | |
| 740 | 772 | // This allows variables to call activities when they save - by default just to reload their settings |
| 741 | 773 | $context['profile_execute_on_save'] = array(); |
| 742 | - if ($context['user']['is_owner']) |
|
| 743 | - $context['profile_execute_on_save']['reload_user'] = 'profileReloadUser'; |
|
| 774 | + if ($context['user']['is_owner']) { |
|
| 775 | + $context['profile_execute_on_save']['reload_user'] = 'profileReloadUser'; |
|
| 776 | + } |
|
| 744 | 777 | |
| 745 | 778 | // Assume we log nothing. |
| 746 | 779 | $context['log_changes'] = array(); |
@@ -748,8 +781,9 @@ discard block |
||
| 748 | 781 | // Cycle through the profile fields working out what to do! |
| 749 | 782 | foreach ($profile_fields as $key => $field) |
| 750 | 783 | { |
| 751 | - if (!isset($_POST[$key]) || !empty($field['is_dummy']) || (isset($_POST['preview_signature']) && $key == 'signature')) |
|
| 752 | - continue; |
|
| 784 | + if (!isset($_POST[$key]) || !empty($field['is_dummy']) || (isset($_POST['preview_signature']) && $key == 'signature')) { |
|
| 785 | + continue; |
|
| 786 | + } |
|
| 753 | 787 | |
| 754 | 788 | // What gets updated? |
| 755 | 789 | $db_key = isset($field['save_key']) ? $field['save_key'] : $key; |
@@ -777,12 +811,13 @@ discard block |
||
| 777 | 811 | $field['cast_type'] = empty($field['cast_type']) ? $field['type'] : $field['cast_type']; |
| 778 | 812 | |
| 779 | 813 | // Finally, clean up certain types. |
| 780 | - if ($field['cast_type'] == 'int') |
|
| 781 | - $_POST[$key] = (int) $_POST[$key]; |
|
| 782 | - elseif ($field['cast_type'] == 'float') |
|
| 783 | - $_POST[$key] = (float) $_POST[$key]; |
|
| 784 | - elseif ($field['cast_type'] == 'check') |
|
| 785 | - $_POST[$key] = !empty($_POST[$key]) ? 1 : 0; |
|
| 814 | + if ($field['cast_type'] == 'int') { |
|
| 815 | + $_POST[$key] = (int) $_POST[$key]; |
|
| 816 | + } elseif ($field['cast_type'] == 'float') { |
|
| 817 | + $_POST[$key] = (float) $_POST[$key]; |
|
| 818 | + } elseif ($field['cast_type'] == 'check') { |
|
| 819 | + $_POST[$key] = !empty($_POST[$key]) ? 1 : 0; |
|
| 820 | + } |
|
| 786 | 821 | |
| 787 | 822 | // If we got here we're doing OK. |
| 788 | 823 | if ($field['type'] != 'hidden' && (!isset($old_profile[$key]) || $_POST[$key] != $old_profile[$key])) |
@@ -793,11 +828,12 @@ discard block |
||
| 793 | 828 | $cur_profile[$key] = $_POST[$key]; |
| 794 | 829 | |
| 795 | 830 | // Are we logging it? |
| 796 | - if (!empty($field['log_change']) && isset($old_profile[$key])) |
|
| 797 | - $context['log_changes'][$key] = array( |
|
| 831 | + if (!empty($field['log_change']) && isset($old_profile[$key])) { |
|
| 832 | + $context['log_changes'][$key] = array( |
|
| 798 | 833 | 'previous' => $old_profile[$key], |
| 799 | 834 | 'new' => $_POST[$key], |
| 800 | 835 | ); |
| 836 | + } |
|
| 801 | 837 | } |
| 802 | 838 | |
| 803 | 839 | // Logging group changes are a bit different... |
@@ -830,10 +866,11 @@ discard block |
||
| 830 | 866 | { |
| 831 | 867 | foreach ($groups as $id => $group) |
| 832 | 868 | { |
| 833 | - if (isset($context['member_groups'][$group])) |
|
| 834 | - $additional_groups[$type][$id] = $context['member_groups'][$group]['name']; |
|
| 835 | - else |
|
| 836 | - unset($additional_groups[$type][$id]); |
|
| 869 | + if (isset($context['member_groups'][$group])) { |
|
| 870 | + $additional_groups[$type][$id] = $context['member_groups'][$group]['name']; |
|
| 871 | + } else { |
|
| 872 | + unset($additional_groups[$type][$id]); |
|
| 873 | + } |
|
| 837 | 874 | } |
| 838 | 875 | $additional_groups[$type] = implode(', ', $additional_groups[$type]); |
| 839 | 876 | } |
@@ -844,10 +881,11 @@ discard block |
||
| 844 | 881 | } |
| 845 | 882 | |
| 846 | 883 | // @todo Temporary |
| 847 | - if ($context['user']['is_owner']) |
|
| 848 | - $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own')); |
|
| 849 | - else |
|
| 850 | - $changeOther = allowedTo('profile_extra_any'); |
|
| 884 | + if ($context['user']['is_owner']) { |
|
| 885 | + $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own')); |
|
| 886 | + } else { |
|
| 887 | + $changeOther = allowedTo('profile_extra_any'); |
|
| 888 | + } |
|
| 851 | 889 | if ($changeOther && empty($post_errors)) |
| 852 | 890 | { |
| 853 | 891 | makeThemeChanges($context['id_member'], isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']); |
@@ -855,8 +893,9 @@ discard block |
||
| 855 | 893 | { |
| 856 | 894 | $custom_fields_errors = makeCustomFieldChanges($context['id_member'], $_REQUEST['sa'], false, true); |
| 857 | 895 | |
| 858 | - if (!empty($custom_fields_errors)) |
|
| 859 | - $post_errors = array_merge($post_errors, $custom_fields_errors); |
|
| 896 | + if (!empty($custom_fields_errors)) { |
|
| 897 | + $post_errors = array_merge($post_errors, $custom_fields_errors); |
|
| 898 | + } |
|
| 860 | 899 | } |
| 861 | 900 | } |
| 862 | 901 | |
@@ -882,9 +921,9 @@ discard block |
||
| 882 | 921 | if ($context['user']['is_owner']) |
| 883 | 922 | { |
| 884 | 923 | $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own', 'profile_website_any', 'profile_website_own', 'profile_signature_any', 'profile_signature_own')); |
| 924 | + } else { |
|
| 925 | + $changeOther = allowedTo(array('profile_extra_any', 'profile_website_any', 'profile_signature_any')); |
|
| 885 | 926 | } |
| 886 | - else |
|
| 887 | - $changeOther = allowedTo(array('profile_extra_any', 'profile_website_any', 'profile_signature_any')); |
|
| 888 | 927 | |
| 889 | 928 | // Arrays of all the changes - makes things easier. |
| 890 | 929 | $profile_bools = array(); |
@@ -895,22 +934,25 @@ discard block |
||
| 895 | 934 | 'ignore_boards', |
| 896 | 935 | ); |
| 897 | 936 | |
| 898 | - if (isset($_POST['sa']) && $_POST['sa'] == 'ignoreboards' && empty($_POST['ignore_brd'])) |
|
| 899 | - $_POST['ignore_brd'] = array(); |
|
| 937 | + if (isset($_POST['sa']) && $_POST['sa'] == 'ignoreboards' && empty($_POST['ignore_brd'])) { |
|
| 938 | + $_POST['ignore_brd'] = array(); |
|
| 939 | + } |
|
| 900 | 940 | |
| 901 | 941 | unset($_POST['ignore_boards']); // Whatever it is set to is a dirty filthy thing. Kinda like our minds. |
| 902 | 942 | if (isset($_POST['ignore_brd'])) |
| 903 | 943 | { |
| 904 | - if (!is_array($_POST['ignore_brd'])) |
|
| 905 | - $_POST['ignore_brd'] = array($_POST['ignore_brd']); |
|
| 944 | + if (!is_array($_POST['ignore_brd'])) { |
|
| 945 | + $_POST['ignore_brd'] = array($_POST['ignore_brd']); |
|
| 946 | + } |
|
| 906 | 947 | |
| 907 | 948 | foreach ($_POST['ignore_brd'] as $k => $d) |
| 908 | 949 | { |
| 909 | 950 | $d = (int) $d; |
| 910 | - if ($d != 0) |
|
| 911 | - $_POST['ignore_brd'][$k] = $d; |
|
| 912 | - else |
|
| 913 | - unset($_POST['ignore_brd'][$k]); |
|
| 951 | + if ($d != 0) { |
|
| 952 | + $_POST['ignore_brd'][$k] = $d; |
|
| 953 | + } else { |
|
| 954 | + unset($_POST['ignore_brd'][$k]); |
|
| 955 | + } |
|
| 914 | 956 | } |
| 915 | 957 | $_POST['ignore_boards'] = implode(',', $_POST['ignore_brd']); |
| 916 | 958 | unset($_POST['ignore_brd']); |
@@ -923,21 +965,26 @@ discard block |
||
| 923 | 965 | makeThemeChanges($memID, isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']); |
| 924 | 966 | //makeAvatarChanges($memID, $post_errors); |
| 925 | 967 | |
| 926 | - if (!empty($_REQUEST['sa'])) |
|
| 927 | - makeCustomFieldChanges($memID, $_REQUEST['sa'], false); |
|
| 968 | + if (!empty($_REQUEST['sa'])) { |
|
| 969 | + makeCustomFieldChanges($memID, $_REQUEST['sa'], false); |
|
| 970 | + } |
|
| 928 | 971 | |
| 929 | - foreach ($profile_bools as $var) |
|
| 930 | - if (isset($_POST[$var])) |
|
| 972 | + foreach ($profile_bools as $var) { |
|
| 973 | + if (isset($_POST[$var])) |
|
| 931 | 974 | $profile_vars[$var] = empty($_POST[$var]) ? '0' : '1'; |
| 932 | - foreach ($profile_ints as $var) |
|
| 933 | - if (isset($_POST[$var])) |
|
| 975 | + } |
|
| 976 | + foreach ($profile_ints as $var) { |
|
| 977 | + if (isset($_POST[$var])) |
|
| 934 | 978 | $profile_vars[$var] = $_POST[$var] != '' ? (int) $_POST[$var] : ''; |
| 935 | - foreach ($profile_floats as $var) |
|
| 936 | - if (isset($_POST[$var])) |
|
| 979 | + } |
|
| 980 | + foreach ($profile_floats as $var) { |
|
| 981 | + if (isset($_POST[$var])) |
|
| 937 | 982 | $profile_vars[$var] = (float) $_POST[$var]; |
| 938 | - foreach ($profile_strings as $var) |
|
| 939 | - if (isset($_POST[$var])) |
|
| 983 | + } |
|
| 984 | + foreach ($profile_strings as $var) { |
|
| 985 | + if (isset($_POST[$var])) |
|
| 940 | 986 | $profile_vars[$var] = $_POST[$var]; |
| 987 | + } |
|
| 941 | 988 | } |
| 942 | 989 | } |
| 943 | 990 | |
@@ -971,8 +1018,9 @@ discard block |
||
| 971 | 1018 | ); |
| 972 | 1019 | |
| 973 | 1020 | // Can't change reserved vars. |
| 974 | - if ((isset($_POST['options']) && count(array_intersect(array_keys($_POST['options']), $reservedVars)) != 0) || (isset($_POST['default_options']) && count(array_intersect(array_keys($_POST['default_options']), $reservedVars)) != 0)) |
|
| 975 | - fatal_lang_error('no_access', false); |
|
| 1021 | + if ((isset($_POST['options']) && count(array_intersect(array_keys($_POST['options']), $reservedVars)) != 0) || (isset($_POST['default_options']) && count(array_intersect(array_keys($_POST['default_options']), $reservedVars)) != 0)) { |
|
| 1022 | + fatal_lang_error('no_access', false); |
|
| 1023 | + } |
|
| 976 | 1024 | |
| 977 | 1025 | // Don't allow any overriding of custom fields with default or non-default options. |
| 978 | 1026 | $request = $smcFunc['db_query']('', ' |
@@ -984,8 +1032,9 @@ discard block |
||
| 984 | 1032 | ) |
| 985 | 1033 | ); |
| 986 | 1034 | $custom_fields = array(); |
| 987 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 988 | - $custom_fields[] = $row['col_name']; |
|
| 1035 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1036 | + $custom_fields[] = $row['col_name']; |
|
| 1037 | + } |
|
| 989 | 1038 | $smcFunc['db_free_result']($request); |
| 990 | 1039 | |
| 991 | 1040 | // These are the theme changes... |
@@ -994,33 +1043,39 @@ discard block |
||
| 994 | 1043 | { |
| 995 | 1044 | foreach ($_POST['options'] as $opt => $val) |
| 996 | 1045 | { |
| 997 | - if (in_array($opt, $custom_fields)) |
|
| 998 | - continue; |
|
| 1046 | + if (in_array($opt, $custom_fields)) { |
|
| 1047 | + continue; |
|
| 1048 | + } |
|
| 999 | 1049 | |
| 1000 | 1050 | // These need to be controlled. |
| 1001 | - if ($opt == 'topics_per_page' || $opt == 'messages_per_page') |
|
| 1002 | - $val = max(0, min($val, 50)); |
|
| 1051 | + if ($opt == 'topics_per_page' || $opt == 'messages_per_page') { |
|
| 1052 | + $val = max(0, min($val, 50)); |
|
| 1053 | + } |
|
| 1003 | 1054 | // We don't set this per theme anymore. |
| 1004 | - elseif ($opt == 'allow_no_censored') |
|
| 1005 | - continue; |
|
| 1055 | + elseif ($opt == 'allow_no_censored') { |
|
| 1056 | + continue; |
|
| 1057 | + } |
|
| 1006 | 1058 | |
| 1007 | 1059 | $themeSetArray[] = array($memID, $id_theme, $opt, is_array($val) ? implode(',', $val) : $val); |
| 1008 | 1060 | } |
| 1009 | 1061 | } |
| 1010 | 1062 | |
| 1011 | 1063 | $erase_options = array(); |
| 1012 | - if (isset($_POST['default_options']) && is_array($_POST['default_options'])) |
|
| 1013 | - foreach ($_POST['default_options'] as $opt => $val) |
|
| 1064 | + if (isset($_POST['default_options']) && is_array($_POST['default_options'])) { |
|
| 1065 | + foreach ($_POST['default_options'] as $opt => $val) |
|
| 1014 | 1066 | { |
| 1015 | 1067 | if (in_array($opt, $custom_fields)) |
| 1016 | 1068 | continue; |
| 1069 | + } |
|
| 1017 | 1070 | |
| 1018 | 1071 | // These need to be controlled. |
| 1019 | - if ($opt == 'topics_per_page' || $opt == 'messages_per_page') |
|
| 1020 | - $val = max(0, min($val, 50)); |
|
| 1072 | + if ($opt == 'topics_per_page' || $opt == 'messages_per_page') { |
|
| 1073 | + $val = max(0, min($val, 50)); |
|
| 1074 | + } |
|
| 1021 | 1075 | // Only let admins and owners change the censor. |
| 1022 | - elseif ($opt == 'allow_no_censored' && !$user_info['is_admin'] && !$context['user']['is_owner']) |
|
| 1023 | - continue; |
|
| 1076 | + elseif ($opt == 'allow_no_censored' && !$user_info['is_admin'] && !$context['user']['is_owner']) { |
|
| 1077 | + continue; |
|
| 1078 | + } |
|
| 1024 | 1079 | |
| 1025 | 1080 | $themeSetArray[] = array($memID, 1, $opt, is_array($val) ? implode(',', $val) : $val); |
| 1026 | 1081 | $erase_options[] = $opt; |
@@ -1056,8 +1111,9 @@ discard block |
||
| 1056 | 1111 | |
| 1057 | 1112 | // Admins can choose any theme, even if it's not enabled... |
| 1058 | 1113 | $themes = allowedTo('admin_forum') ? explode(',', $modSettings['knownThemes']) : explode(',', $modSettings['enableThemes']); |
| 1059 | - foreach ($themes as $t) |
|
| 1060 | - cache_put_data('theme_settings-' . $t . ':' . $memID, null, 60); |
|
| 1114 | + foreach ($themes as $t) { |
|
| 1115 | + cache_put_data('theme_settings-' . $t . ':' . $memID, null, 60); |
|
| 1116 | + } |
|
| 1061 | 1117 | } |
| 1062 | 1118 | } |
| 1063 | 1119 | |
@@ -1076,8 +1132,9 @@ discard block |
||
| 1076 | 1132 | if (isset($_POST['edit_notify_boards']) && !empty($_POST['notify_boards'])) |
| 1077 | 1133 | { |
| 1078 | 1134 | // Make sure only integers are deleted. |
| 1079 | - foreach ($_POST['notify_boards'] as $index => $id) |
|
| 1080 | - $_POST['notify_boards'][$index] = (int) $id; |
|
| 1135 | + foreach ($_POST['notify_boards'] as $index => $id) { |
|
| 1136 | + $_POST['notify_boards'][$index] = (int) $id; |
|
| 1137 | + } |
|
| 1081 | 1138 | |
| 1082 | 1139 | // id_board = 0 is reserved for topic notifications. |
| 1083 | 1140 | $_POST['notify_boards'] = array_diff($_POST['notify_boards'], array(0)); |
@@ -1096,8 +1153,9 @@ discard block |
||
| 1096 | 1153 | // We are editing topic notifications...... |
| 1097 | 1154 | elseif (isset($_POST['edit_notify_topics']) && !empty($_POST['notify_topics'])) |
| 1098 | 1155 | { |
| 1099 | - foreach ($_POST['notify_topics'] as $index => $id) |
|
| 1100 | - $_POST['notify_topics'][$index] = (int) $id; |
|
| 1156 | + foreach ($_POST['notify_topics'] as $index => $id) { |
|
| 1157 | + $_POST['notify_topics'][$index] = (int) $id; |
|
| 1158 | + } |
|
| 1101 | 1159 | |
| 1102 | 1160 | // Make sure there are no zeros left. |
| 1103 | 1161 | $_POST['notify_topics'] = array_diff($_POST['notify_topics'], array(0)); |
@@ -1111,16 +1169,18 @@ discard block |
||
| 1111 | 1169 | 'selected_member' => $memID, |
| 1112 | 1170 | ) |
| 1113 | 1171 | ); |
| 1114 | - foreach ($_POST['notify_topics'] as $topic) |
|
| 1115 | - setNotifyPrefs($memID, array('topic_notify_' . $topic => 0)); |
|
| 1172 | + foreach ($_POST['notify_topics'] as $topic) { |
|
| 1173 | + setNotifyPrefs($memID, array('topic_notify_' . $topic => 0)); |
|
| 1174 | + } |
|
| 1116 | 1175 | } |
| 1117 | 1176 | |
| 1118 | 1177 | // We are removing topic preferences |
| 1119 | 1178 | elseif (isset($_POST['remove_notify_topics']) && !empty($_POST['notify_topics'])) |
| 1120 | 1179 | { |
| 1121 | 1180 | $prefs = array(); |
| 1122 | - foreach ($_POST['notify_topics'] as $topic) |
|
| 1123 | - $prefs[] = 'topic_notify_' . $topic; |
|
| 1181 | + foreach ($_POST['notify_topics'] as $topic) { |
|
| 1182 | + $prefs[] = 'topic_notify_' . $topic; |
|
| 1183 | + } |
|
| 1124 | 1184 | deleteNotifyPrefs($memID, $prefs); |
| 1125 | 1185 | } |
| 1126 | 1186 | |
@@ -1128,8 +1188,9 @@ discard block |
||
| 1128 | 1188 | elseif (isset($_POST['remove_notify_board']) && !empty($_POST['notify_boards'])) |
| 1129 | 1189 | { |
| 1130 | 1190 | $prefs = array(); |
| 1131 | - foreach ($_POST['notify_boards'] as $board) |
|
| 1132 | - $prefs[] = 'board_notify_' . $board; |
|
| 1191 | + foreach ($_POST['notify_boards'] as $board) { |
|
| 1192 | + $prefs[] = 'board_notify_' . $board; |
|
| 1193 | + } |
|
| 1133 | 1194 | deleteNotifyPrefs($memID, $prefs); |
| 1134 | 1195 | } |
| 1135 | 1196 | } |
@@ -1150,8 +1211,9 @@ discard block |
||
| 1150 | 1211 | |
| 1151 | 1212 | $errors = array(); |
| 1152 | 1213 | |
| 1153 | - if ($sanitize && isset($_POST['customfield'])) |
|
| 1154 | - $_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']); |
|
| 1214 | + if ($sanitize && isset($_POST['customfield'])) { |
|
| 1215 | + $_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']); |
|
| 1216 | + } |
|
| 1155 | 1217 | |
| 1156 | 1218 | $where = $area == 'register' ? 'show_reg != 0' : 'show_profile = {string:area}'; |
| 1157 | 1219 | |
@@ -1176,26 +1238,29 @@ discard block |
||
| 1176 | 1238 | - The data is not invisible to users but editable by the owner (or if it is the user is not the owner) |
| 1177 | 1239 | - The area isn't registration, and if it is that the field is not supposed to be shown there. |
| 1178 | 1240 | */ |
| 1179 | - if ($row['private'] != 0 && !allowedTo('admin_forum') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area != 'register' || $row['show_reg'] == 0)) |
|
| 1180 | - continue; |
|
| 1241 | + if ($row['private'] != 0 && !allowedTo('admin_forum') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area != 'register' || $row['show_reg'] == 0)) { |
|
| 1242 | + continue; |
|
| 1243 | + } |
|
| 1181 | 1244 | |
| 1182 | 1245 | // Validate the user data. |
| 1183 | - if ($row['field_type'] == 'check') |
|
| 1184 | - $value = isset($_POST['customfield'][$row['col_name']]) ? 1 : 0; |
|
| 1185 | - elseif ($row['field_type'] == 'select' || $row['field_type'] == 'radio') |
|
| 1246 | + if ($row['field_type'] == 'check') { |
|
| 1247 | + $value = isset($_POST['customfield'][$row['col_name']]) ? 1 : 0; |
|
| 1248 | + } elseif ($row['field_type'] == 'select' || $row['field_type'] == 'radio') |
|
| 1186 | 1249 | { |
| 1187 | 1250 | $value = $row['default_value']; |
| 1188 | - foreach (explode(',', $row['field_options']) as $k => $v) |
|
| 1189 | - if (isset($_POST['customfield'][$row['col_name']]) && $_POST['customfield'][$row['col_name']] == $k) |
|
| 1251 | + foreach (explode(',', $row['field_options']) as $k => $v) { |
|
| 1252 | + if (isset($_POST['customfield'][$row['col_name']]) && $_POST['customfield'][$row['col_name']] == $k) |
|
| 1190 | 1253 | $value = $v; |
| 1254 | + } |
|
| 1191 | 1255 | } |
| 1192 | 1256 | // Otherwise some form of text! |
| 1193 | 1257 | else |
| 1194 | 1258 | { |
| 1195 | 1259 | $value = isset($_POST['customfield'][$row['col_name']]) ? $_POST['customfield'][$row['col_name']] : ''; |
| 1196 | 1260 | |
| 1197 | - if ($row['field_length']) |
|
| 1198 | - $value = $smcFunc['substr']($value, 0, $row['field_length']); |
|
| 1261 | + if ($row['field_length']) { |
|
| 1262 | + $value = $smcFunc['substr']($value, 0, $row['field_length']); |
|
| 1263 | + } |
|
| 1199 | 1264 | |
| 1200 | 1265 | // Any masks? |
| 1201 | 1266 | if ($row['field_type'] == 'text' && !empty($row['mask']) && $row['mask'] != 'none') |
@@ -1204,36 +1269,34 @@ discard block |
||
| 1204 | 1269 | $valueReference = un_htmlspecialchars($value); |
| 1205 | 1270 | |
| 1206 | 1271 | // Try and avoid some checks. '0' could be a valid non-empty value. |
| 1207 | - if (empty($value) && !is_numeric($value)) |
|
| 1208 | - $value = ''; |
|
| 1272 | + if (empty($value) && !is_numeric($value)) { |
|
| 1273 | + $value = ''; |
|
| 1274 | + } |
|
| 1209 | 1275 | |
| 1210 | 1276 | if ($row['mask'] == 'nohtml' && ($valueReference != strip_tags($valueReference) || $value != filter_var($value, FILTER_SANITIZE_STRING) || preg_match('/<(.+?)[\s]*\/?[\s]*>/si', $valueReference))) |
| 1211 | 1277 | { |
| 1212 | - if ($returnErrors) |
|
| 1213 | - $errors[] = 'custom_field_nohtml_fail'; |
|
| 1214 | - |
|
| 1215 | - else |
|
| 1216 | - $value = ''; |
|
| 1217 | - } |
|
| 1218 | - elseif ($row['mask'] == 'email' && (!filter_var($value, FILTER_VALIDATE_EMAIL) || strlen($value) > 255)) |
|
| 1278 | + if ($returnErrors) { |
|
| 1279 | + $errors[] = 'custom_field_nohtml_fail'; |
|
| 1280 | + } else { |
|
| 1281 | + $value = ''; |
|
| 1282 | + } |
|
| 1283 | + } elseif ($row['mask'] == 'email' && (!filter_var($value, FILTER_VALIDATE_EMAIL) || strlen($value) > 255)) |
|
| 1219 | 1284 | { |
| 1220 | - if ($returnErrors) |
|
| 1221 | - $errors[] = 'custom_field_mail_fail'; |
|
| 1222 | - |
|
| 1223 | - else |
|
| 1224 | - $value = ''; |
|
| 1225 | - } |
|
| 1226 | - elseif ($row['mask'] == 'number') |
|
| 1285 | + if ($returnErrors) { |
|
| 1286 | + $errors[] = 'custom_field_mail_fail'; |
|
| 1287 | + } else { |
|
| 1288 | + $value = ''; |
|
| 1289 | + } |
|
| 1290 | + } elseif ($row['mask'] == 'number') |
|
| 1227 | 1291 | { |
| 1228 | 1292 | $value = (int) $value; |
| 1229 | - } |
|
| 1230 | - elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0) |
|
| 1293 | + } elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0) |
|
| 1231 | 1294 | { |
| 1232 | - if ($returnErrors) |
|
| 1233 | - $errors[] = 'custom_field_regex_fail'; |
|
| 1234 | - |
|
| 1235 | - else |
|
| 1236 | - $value = ''; |
|
| 1295 | + if ($returnErrors) { |
|
| 1296 | + $errors[] = 'custom_field_regex_fail'; |
|
| 1297 | + } else { |
|
| 1298 | + $value = ''; |
|
| 1299 | + } |
|
| 1237 | 1300 | } |
| 1238 | 1301 | |
| 1239 | 1302 | unset($valueReference); |
@@ -1261,8 +1324,9 @@ discard block |
||
| 1261 | 1324 | |
| 1262 | 1325 | $hook_errors = call_integration_hook('integrate_save_custom_profile_fields', array(&$changes, &$log_changes, &$errors, $returnErrors, $memID, $area, $sanitize)); |
| 1263 | 1326 | |
| 1264 | - if (!empty($hook_errors) && is_array($hook_errors)) |
|
| 1265 | - $errors = array_merge($errors, $hook_errors); |
|
| 1327 | + if (!empty($hook_errors) && is_array($hook_errors)) { |
|
| 1328 | + $errors = array_merge($errors, $hook_errors); |
|
| 1329 | + } |
|
| 1266 | 1330 | |
| 1267 | 1331 | // Make those changes! |
| 1268 | 1332 | if (!empty($changes) && empty($context['password_auth_failed']) && empty($errors)) |
@@ -1280,9 +1344,10 @@ discard block |
||
| 1280 | 1344 | } |
| 1281 | 1345 | } |
| 1282 | 1346 | |
| 1283 | - if ($returnErrors) |
|
| 1284 | - return $errors; |
|
| 1285 | -} |
|
| 1347 | + if ($returnErrors) { |
|
| 1348 | + return $errors; |
|
| 1349 | + } |
|
| 1350 | + } |
|
| 1286 | 1351 | |
| 1287 | 1352 | /** |
| 1288 | 1353 | * Show all the users buddies, as well as a add/delete interface. |
@@ -1294,8 +1359,9 @@ discard block |
||
| 1294 | 1359 | global $context, $txt, $modSettings; |
| 1295 | 1360 | |
| 1296 | 1361 | // Do a quick check to ensure people aren't getting here illegally! |
| 1297 | - if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist'])) |
|
| 1298 | - fatal_lang_error('no_access', false); |
|
| 1362 | + if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist'])) { |
|
| 1363 | + fatal_lang_error('no_access', false); |
|
| 1364 | + } |
|
| 1299 | 1365 | |
| 1300 | 1366 | // Can we email the user direct? |
| 1301 | 1367 | $context['can_moderate_forum'] = allowedTo('moderate_forum'); |
@@ -1325,9 +1391,10 @@ discard block |
||
| 1325 | 1391 | $context['sub_template'] = $subActions[$context['list_area']][0]; |
| 1326 | 1392 | $call = call_helper($subActions[$context['list_area']][0], true); |
| 1327 | 1393 | |
| 1328 | - if (!empty($call)) |
|
| 1329 | - call_user_func($call, $memID); |
|
| 1330 | -} |
|
| 1394 | + if (!empty($call)) { |
|
| 1395 | + call_user_func($call, $memID); |
|
| 1396 | + } |
|
| 1397 | + } |
|
| 1331 | 1398 | |
| 1332 | 1399 | /** |
| 1333 | 1400 | * Show all the users buddies, as well as a add/delete interface. |
@@ -1341,9 +1408,10 @@ discard block |
||
| 1341 | 1408 | |
| 1342 | 1409 | // For making changes! |
| 1343 | 1410 | $buddiesArray = explode(',', $user_profile[$memID]['buddy_list']); |
| 1344 | - foreach ($buddiesArray as $k => $dummy) |
|
| 1345 | - if ($dummy == '') |
|
| 1411 | + foreach ($buddiesArray as $k => $dummy) { |
|
| 1412 | + if ($dummy == '') |
|
| 1346 | 1413 | unset($buddiesArray[$k]); |
| 1414 | + } |
|
| 1347 | 1415 | |
| 1348 | 1416 | // Removing a buddy? |
| 1349 | 1417 | if (isset($_GET['remove'])) |
@@ -1355,10 +1423,11 @@ discard block |
||
| 1355 | 1423 | $_SESSION['prf-save'] = $txt['could_not_remove_person']; |
| 1356 | 1424 | |
| 1357 | 1425 | // Heh, I'm lazy, do it the easy way... |
| 1358 | - foreach ($buddiesArray as $key => $buddy) |
|
| 1359 | - if ($buddy == (int) $_GET['remove']) |
|
| 1426 | + foreach ($buddiesArray as $key => $buddy) { |
|
| 1427 | + if ($buddy == (int) $_GET['remove']) |
|
| 1360 | 1428 | { |
| 1361 | 1429 | unset($buddiesArray[$key]); |
| 1430 | + } |
|
| 1362 | 1431 | $_SESSION['prf-save'] = true; |
| 1363 | 1432 | } |
| 1364 | 1433 | |
@@ -1368,8 +1437,7 @@ discard block |
||
| 1368 | 1437 | |
| 1369 | 1438 | // Redirect off the page because we don't like all this ugly query stuff to stick in the history. |
| 1370 | 1439 | redirectexit('action=profile;area=lists;sa=buddies;u=' . $memID); |
| 1371 | - } |
|
| 1372 | - elseif (isset($_POST['new_buddy'])) |
|
| 1440 | + } elseif (isset($_POST['new_buddy'])) |
|
| 1373 | 1441 | { |
| 1374 | 1442 | checkSession(); |
| 1375 | 1443 | |
@@ -1382,8 +1450,9 @@ discard block |
||
| 1382 | 1450 | { |
| 1383 | 1451 | $new_buddies[$k] = strtr(trim($new_buddies[$k]), array('\'' => ''')); |
| 1384 | 1452 | |
| 1385 | - if (strlen($new_buddies[$k]) == 0 || in_array($new_buddies[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) |
|
| 1386 | - unset($new_buddies[$k]); |
|
| 1453 | + if (strlen($new_buddies[$k]) == 0 || in_array($new_buddies[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) { |
|
| 1454 | + unset($new_buddies[$k]); |
|
| 1455 | + } |
|
| 1387 | 1456 | } |
| 1388 | 1457 | |
| 1389 | 1458 | call_integration_hook('integrate_add_buddies', array($memID, &$new_buddies)); |
@@ -1403,16 +1472,18 @@ discard block |
||
| 1403 | 1472 | ) |
| 1404 | 1473 | ); |
| 1405 | 1474 | |
| 1406 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 1407 | - $_SESSION['prf-save'] = true; |
|
| 1475 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 1476 | + $_SESSION['prf-save'] = true; |
|
| 1477 | + } |
|
| 1408 | 1478 | |
| 1409 | 1479 | // Add the new member to the buddies array. |
| 1410 | 1480 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1411 | 1481 | { |
| 1412 | - if (in_array($row['id_member'], $buddiesArray)) |
|
| 1413 | - continue; |
|
| 1414 | - else |
|
| 1415 | - $buddiesArray[] = (int) $row['id_member']; |
|
| 1482 | + if (in_array($row['id_member'], $buddiesArray)) { |
|
| 1483 | + continue; |
|
| 1484 | + } else { |
|
| 1485 | + $buddiesArray[] = (int) $row['id_member']; |
|
| 1486 | + } |
|
| 1416 | 1487 | } |
| 1417 | 1488 | $smcFunc['db_free_result']($request); |
| 1418 | 1489 | |
@@ -1442,18 +1513,20 @@ discard block |
||
| 1442 | 1513 | |
| 1443 | 1514 | $context['custom_pf'] = array(); |
| 1444 | 1515 | $disabled_fields = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array(); |
| 1445 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1446 | - if (!isset($disabled_fields[$row['col_name']])) |
|
| 1516 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1517 | + if (!isset($disabled_fields[$row['col_name']])) |
|
| 1447 | 1518 | $context['custom_pf'][$row['col_name']] = array( |
| 1448 | 1519 | 'label' => $row['field_name'], |
| 1449 | 1520 | 'type' => $row['field_type'], |
| 1450 | 1521 | 'bbc' => !empty($row['bbc']), |
| 1451 | 1522 | 'enclose' => $row['enclose'], |
| 1452 | 1523 | ); |
| 1524 | + } |
|
| 1453 | 1525 | |
| 1454 | 1526 | // Gotta disable the gender option. |
| 1455 | - if (isset($context['custom_pf']['cust_gender']) && $context['custom_pf']['cust_gender'] == 'None') |
|
| 1456 | - unset($context['custom_pf']['cust_gender']); |
|
| 1527 | + if (isset($context['custom_pf']['cust_gender']) && $context['custom_pf']['cust_gender'] == 'None') { |
|
| 1528 | + unset($context['custom_pf']['cust_gender']); |
|
| 1529 | + } |
|
| 1457 | 1530 | |
| 1458 | 1531 | $smcFunc['db_free_result']($request); |
| 1459 | 1532 | |
@@ -1470,8 +1543,9 @@ discard block |
||
| 1470 | 1543 | 'buddy_list_count' => substr_count($user_profile[$memID]['buddy_list'], ',') + 1, |
| 1471 | 1544 | ) |
| 1472 | 1545 | ); |
| 1473 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
| 1474 | - $buddies[] = $row['id_member']; |
|
| 1546 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
| 1547 | + $buddies[] = $row['id_member']; |
|
| 1548 | + } |
|
| 1475 | 1549 | $smcFunc['db_free_result']($result); |
| 1476 | 1550 | } |
| 1477 | 1551 | |
@@ -1499,30 +1573,32 @@ discard block |
||
| 1499 | 1573 | continue; |
| 1500 | 1574 | } |
| 1501 | 1575 | |
| 1502 | - if ($column['bbc'] && !empty($context['buddies'][$buddy]['options'][$key])) |
|
| 1503 | - $context['buddies'][$buddy]['options'][$key] = strip_tags(parse_bbc($context['buddies'][$buddy]['options'][$key])); |
|
| 1504 | - |
|
| 1505 | - elseif ($column['type'] == 'check') |
|
| 1506 | - $context['buddies'][$buddy]['options'][$key] = $context['buddies'][$buddy]['options'][$key] == 0 ? $txt['no'] : $txt['yes']; |
|
| 1576 | + if ($column['bbc'] && !empty($context['buddies'][$buddy]['options'][$key])) { |
|
| 1577 | + $context['buddies'][$buddy]['options'][$key] = strip_tags(parse_bbc($context['buddies'][$buddy]['options'][$key])); |
|
| 1578 | + } elseif ($column['type'] == 'check') { |
|
| 1579 | + $context['buddies'][$buddy]['options'][$key] = $context['buddies'][$buddy]['options'][$key] == 0 ? $txt['no'] : $txt['yes']; |
|
| 1580 | + } |
|
| 1507 | 1581 | |
| 1508 | 1582 | // Enclosing the user input within some other text? |
| 1509 | - if (!empty($column['enclose']) && !empty($context['buddies'][$buddy]['options'][$key])) |
|
| 1510 | - $context['buddies'][$buddy]['options'][$key] = strtr($column['enclose'], array( |
|
| 1583 | + if (!empty($column['enclose']) && !empty($context['buddies'][$buddy]['options'][$key])) { |
|
| 1584 | + $context['buddies'][$buddy]['options'][$key] = strtr($column['enclose'], array( |
|
| 1511 | 1585 | '{SCRIPTURL}' => $scripturl, |
| 1512 | 1586 | '{IMAGES_URL}' => $settings['images_url'], |
| 1513 | 1587 | '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], |
| 1514 | 1588 | '{INPUT}' => $context['buddies'][$buddy]['options'][$key], |
| 1515 | 1589 | )); |
| 1590 | + } |
|
| 1516 | 1591 | } |
| 1517 | 1592 | } |
| 1518 | 1593 | } |
| 1519 | 1594 | |
| 1520 | 1595 | if (isset($_SESSION['prf-save'])) |
| 1521 | 1596 | { |
| 1522 | - if ($_SESSION['prf-save'] === true) |
|
| 1523 | - $context['saved_successful'] = true; |
|
| 1524 | - else |
|
| 1525 | - $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1597 | + if ($_SESSION['prf-save'] === true) { |
|
| 1598 | + $context['saved_successful'] = true; |
|
| 1599 | + } else { |
|
| 1600 | + $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1601 | + } |
|
| 1526 | 1602 | |
| 1527 | 1603 | unset($_SESSION['prf-save']); |
| 1528 | 1604 | } |
@@ -1542,9 +1618,10 @@ discard block |
||
| 1542 | 1618 | |
| 1543 | 1619 | // For making changes! |
| 1544 | 1620 | $ignoreArray = explode(',', $user_profile[$memID]['pm_ignore_list']); |
| 1545 | - foreach ($ignoreArray as $k => $dummy) |
|
| 1546 | - if ($dummy == '') |
|
| 1621 | + foreach ($ignoreArray as $k => $dummy) { |
|
| 1622 | + if ($dummy == '') |
|
| 1547 | 1623 | unset($ignoreArray[$k]); |
| 1624 | + } |
|
| 1548 | 1625 | |
| 1549 | 1626 | // Removing a member from the ignore list? |
| 1550 | 1627 | if (isset($_GET['remove'])) |
@@ -1554,10 +1631,11 @@ discard block |
||
| 1554 | 1631 | $_SESSION['prf-save'] = $txt['could_not_remove_person']; |
| 1555 | 1632 | |
| 1556 | 1633 | // Heh, I'm lazy, do it the easy way... |
| 1557 | - foreach ($ignoreArray as $key => $id_remove) |
|
| 1558 | - if ($id_remove == (int) $_GET['remove']) |
|
| 1634 | + foreach ($ignoreArray as $key => $id_remove) { |
|
| 1635 | + if ($id_remove == (int) $_GET['remove']) |
|
| 1559 | 1636 | { |
| 1560 | 1637 | unset($ignoreArray[$key]); |
| 1638 | + } |
|
| 1561 | 1639 | $_SESSION['prf-save'] = true; |
| 1562 | 1640 | } |
| 1563 | 1641 | |
@@ -1567,8 +1645,7 @@ discard block |
||
| 1567 | 1645 | |
| 1568 | 1646 | // Redirect off the page because we don't like all this ugly query stuff to stick in the history. |
| 1569 | 1647 | redirectexit('action=profile;area=lists;sa=ignore;u=' . $memID); |
| 1570 | - } |
|
| 1571 | - elseif (isset($_POST['new_ignore'])) |
|
| 1648 | + } elseif (isset($_POST['new_ignore'])) |
|
| 1572 | 1649 | { |
| 1573 | 1650 | checkSession(); |
| 1574 | 1651 | // Prepare the string for extraction... |
@@ -1580,8 +1657,9 @@ discard block |
||
| 1580 | 1657 | { |
| 1581 | 1658 | $new_entries[$k] = strtr(trim($new_entries[$k]), array('\'' => ''')); |
| 1582 | 1659 | |
| 1583 | - if (strlen($new_entries[$k]) == 0 || in_array($new_entries[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) |
|
| 1584 | - unset($new_entries[$k]); |
|
| 1660 | + if (strlen($new_entries[$k]) == 0 || in_array($new_entries[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) { |
|
| 1661 | + unset($new_entries[$k]); |
|
| 1662 | + } |
|
| 1585 | 1663 | } |
| 1586 | 1664 | |
| 1587 | 1665 | $_SESSION['prf-save'] = $txt['could_not_add_person']; |
@@ -1599,16 +1677,18 @@ discard block |
||
| 1599 | 1677 | ) |
| 1600 | 1678 | ); |
| 1601 | 1679 | |
| 1602 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 1603 | - $_SESSION['prf-save'] = true; |
|
| 1680 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 1681 | + $_SESSION['prf-save'] = true; |
|
| 1682 | + } |
|
| 1604 | 1683 | |
| 1605 | 1684 | // Add the new member to the buddies array. |
| 1606 | 1685 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1607 | 1686 | { |
| 1608 | - if (in_array($row['id_member'], $ignoreArray)) |
|
| 1609 | - continue; |
|
| 1610 | - else |
|
| 1611 | - $ignoreArray[] = (int) $row['id_member']; |
|
| 1687 | + if (in_array($row['id_member'], $ignoreArray)) { |
|
| 1688 | + continue; |
|
| 1689 | + } else { |
|
| 1690 | + $ignoreArray[] = (int) $row['id_member']; |
|
| 1691 | + } |
|
| 1612 | 1692 | } |
| 1613 | 1693 | $smcFunc['db_free_result']($request); |
| 1614 | 1694 | |
@@ -1637,8 +1717,9 @@ discard block |
||
| 1637 | 1717 | 'ignore_list_count' => substr_count($user_profile[$memID]['pm_ignore_list'], ',') + 1, |
| 1638 | 1718 | ) |
| 1639 | 1719 | ); |
| 1640 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
| 1641 | - $ignored[] = $row['id_member']; |
|
| 1720 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
| 1721 | + $ignored[] = $row['id_member']; |
|
| 1722 | + } |
|
| 1642 | 1723 | $smcFunc['db_free_result']($result); |
| 1643 | 1724 | } |
| 1644 | 1725 | |
@@ -1657,10 +1738,11 @@ discard block |
||
| 1657 | 1738 | |
| 1658 | 1739 | if (isset($_SESSION['prf-save'])) |
| 1659 | 1740 | { |
| 1660 | - if ($_SESSION['prf-save'] === true) |
|
| 1661 | - $context['saved_successful'] = true; |
|
| 1662 | - else |
|
| 1663 | - $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1741 | + if ($_SESSION['prf-save'] === true) { |
|
| 1742 | + $context['saved_successful'] = true; |
|
| 1743 | + } else { |
|
| 1744 | + $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1745 | + } |
|
| 1664 | 1746 | |
| 1665 | 1747 | unset($_SESSION['prf-save']); |
| 1666 | 1748 | } |
@@ -1676,8 +1758,9 @@ discard block |
||
| 1676 | 1758 | global $context, $txt; |
| 1677 | 1759 | |
| 1678 | 1760 | loadThemeOptions($memID); |
| 1679 | - if (allowedTo(array('profile_identity_own', 'profile_identity_any', 'profile_password_own', 'profile_password_any'))) |
|
| 1680 | - loadCustomFields($memID, 'account'); |
|
| 1761 | + if (allowedTo(array('profile_identity_own', 'profile_identity_any', 'profile_password_own', 'profile_password_any'))) { |
|
| 1762 | + loadCustomFields($memID, 'account'); |
|
| 1763 | + } |
|
| 1681 | 1764 | |
| 1682 | 1765 | $context['sub_template'] = 'edit_options'; |
| 1683 | 1766 | $context['page_desc'] = $txt['account_info']; |
@@ -1704,8 +1787,9 @@ discard block |
||
| 1704 | 1787 | global $context, $txt; |
| 1705 | 1788 | |
| 1706 | 1789 | loadThemeOptions($memID); |
| 1707 | - if (allowedTo(array('profile_forum_own', 'profile_forum_any'))) |
|
| 1708 | - loadCustomFields($memID, 'forumprofile'); |
|
| 1790 | + if (allowedTo(array('profile_forum_own', 'profile_forum_any'))) { |
|
| 1791 | + loadCustomFields($memID, 'forumprofile'); |
|
| 1792 | + } |
|
| 1709 | 1793 | |
| 1710 | 1794 | $context['sub_template'] = 'edit_options'; |
| 1711 | 1795 | $context['page_desc'] = $txt['forumProfile_info']; |
@@ -1738,18 +1822,21 @@ discard block |
||
| 1738 | 1822 | $dirs = array(); |
| 1739 | 1823 | $files = array(); |
| 1740 | 1824 | |
| 1741 | - if (!$dir) |
|
| 1742 | - return array(); |
|
| 1825 | + if (!$dir) { |
|
| 1826 | + return array(); |
|
| 1827 | + } |
|
| 1743 | 1828 | |
| 1744 | 1829 | while ($line = $dir->read()) |
| 1745 | 1830 | { |
| 1746 | - if (in_array($line, array('.', '..', 'blank.png', 'index.php'))) |
|
| 1747 | - continue; |
|
| 1831 | + if (in_array($line, array('.', '..', 'blank.png', 'index.php'))) { |
|
| 1832 | + continue; |
|
| 1833 | + } |
|
| 1748 | 1834 | |
| 1749 | - if (is_dir($modSettings['avatar_directory'] . '/' . $directory . (!empty($directory) ? '/' : '') . $line)) |
|
| 1750 | - $dirs[] = $line; |
|
| 1751 | - else |
|
| 1752 | - $files[] = $line; |
|
| 1835 | + if (is_dir($modSettings['avatar_directory'] . '/' . $directory . (!empty($directory) ? '/' : '') . $line)) { |
|
| 1836 | + $dirs[] = $line; |
|
| 1837 | + } else { |
|
| 1838 | + $files[] = $line; |
|
| 1839 | + } |
|
| 1753 | 1840 | } |
| 1754 | 1841 | $dir->close(); |
| 1755 | 1842 | |
@@ -1770,14 +1857,15 @@ discard block |
||
| 1770 | 1857 | foreach ($dirs as $line) |
| 1771 | 1858 | { |
| 1772 | 1859 | $tmp = getAvatars($directory . (!empty($directory) ? '/' : '') . $line, $level + 1); |
| 1773 | - if (!empty($tmp)) |
|
| 1774 | - $result[] = array( |
|
| 1860 | + if (!empty($tmp)) { |
|
| 1861 | + $result[] = array( |
|
| 1775 | 1862 | 'filename' => $smcFunc['htmlspecialchars']($line), |
| 1776 | 1863 | 'checked' => strpos($context['member']['avatar']['server_pic'], $line . '/') !== false, |
| 1777 | 1864 | 'name' => '[' . $smcFunc['htmlspecialchars'](str_replace('_', ' ', $line)) . ']', |
| 1778 | 1865 | 'is_dir' => true, |
| 1779 | 1866 | 'files' => $tmp |
| 1780 | 1867 | ); |
| 1868 | + } |
|
| 1781 | 1869 | unset($tmp); |
| 1782 | 1870 | } |
| 1783 | 1871 | |
@@ -1787,8 +1875,9 @@ discard block |
||
| 1787 | 1875 | $extension = substr(strrchr($line, '.'), 1); |
| 1788 | 1876 | |
| 1789 | 1877 | // Make sure it is an image. |
| 1790 | - if (strcasecmp($extension, 'gif') != 0 && strcasecmp($extension, 'jpg') != 0 && strcasecmp($extension, 'jpeg') != 0 && strcasecmp($extension, 'png') != 0 && strcasecmp($extension, 'bmp') != 0) |
|
| 1791 | - continue; |
|
| 1878 | + if (strcasecmp($extension, 'gif') != 0 && strcasecmp($extension, 'jpg') != 0 && strcasecmp($extension, 'jpeg') != 0 && strcasecmp($extension, 'png') != 0 && strcasecmp($extension, 'bmp') != 0) { |
|
| 1879 | + continue; |
|
| 1880 | + } |
|
| 1792 | 1881 | |
| 1793 | 1882 | $result[] = array( |
| 1794 | 1883 | 'filename' => $smcFunc['htmlspecialchars']($line), |
@@ -1796,8 +1885,9 @@ discard block |
||
| 1796 | 1885 | 'name' => $smcFunc['htmlspecialchars'](str_replace('_', ' ', $filename)), |
| 1797 | 1886 | 'is_dir' => false |
| 1798 | 1887 | ); |
| 1799 | - if ($level == 1) |
|
| 1800 | - $context['avatar_list'][] = $directory . '/' . $line; |
|
| 1888 | + if ($level == 1) { |
|
| 1889 | + $context['avatar_list'][] = $directory . '/' . $line; |
|
| 1890 | + } |
|
| 1801 | 1891 | } |
| 1802 | 1892 | |
| 1803 | 1893 | return $result; |
@@ -1816,8 +1906,9 @@ discard block |
||
| 1816 | 1906 | loadSubTemplate('options'); |
| 1817 | 1907 | |
| 1818 | 1908 | loadThemeOptions($memID); |
| 1819 | - if (allowedTo(array('profile_extra_own', 'profile_extra_any'))) |
|
| 1820 | - loadCustomFields($memID, 'theme'); |
|
| 1909 | + if (allowedTo(array('profile_extra_own', 'profile_extra_any'))) { |
|
| 1910 | + loadCustomFields($memID, 'theme'); |
|
| 1911 | + } |
|
| 1821 | 1912 | |
| 1822 | 1913 | $context['sub_template'] = 'edit_options'; |
| 1823 | 1914 | $context['page_desc'] = $txt['theme_info']; |
@@ -1871,16 +1962,19 @@ discard block |
||
| 1871 | 1962 | { |
| 1872 | 1963 | global $txt, $context, $modSettings, $smcFunc, $sourcedir; |
| 1873 | 1964 | |
| 1874 | - if (!isset($context['token_check'])) |
|
| 1875 | - $context['token_check'] = 'profile-nt' . $memID; |
|
| 1965 | + if (!isset($context['token_check'])) { |
|
| 1966 | + $context['token_check'] = 'profile-nt' . $memID; |
|
| 1967 | + } |
|
| 1876 | 1968 | |
| 1877 | 1969 | is_not_guest(); |
| 1878 | - if (!$context['user']['is_owner']) |
|
| 1879 | - isAllowedTo('profile_extra_any'); |
|
| 1970 | + if (!$context['user']['is_owner']) { |
|
| 1971 | + isAllowedTo('profile_extra_any'); |
|
| 1972 | + } |
|
| 1880 | 1973 | |
| 1881 | 1974 | // Set the post action if we're coming from the profile... |
| 1882 | - if (!isset($context['action'])) |
|
| 1883 | - $context['action'] = 'action=profile;area=notification;sa=alerts;u=' . $memID; |
|
| 1975 | + if (!isset($context['action'])) { |
|
| 1976 | + $context['action'] = 'action=profile;area=notification;sa=alerts;u=' . $memID; |
|
| 1977 | + } |
|
| 1884 | 1978 | |
| 1885 | 1979 | // What options are set |
| 1886 | 1980 | loadThemeOptions($memID); |
@@ -1967,28 +2061,34 @@ discard block |
||
| 1967 | 2061 | ); |
| 1968 | 2062 | |
| 1969 | 2063 | // There are certain things that are disabled at the group level. |
| 1970 | - if (empty($modSettings['cal_enabled'])) |
|
| 1971 | - unset($alert_types['calendar']); |
|
| 2064 | + if (empty($modSettings['cal_enabled'])) { |
|
| 2065 | + unset($alert_types['calendar']); |
|
| 2066 | + } |
|
| 1972 | 2067 | |
| 1973 | 2068 | // Disable paid subscriptions at group level if they're disabled |
| 1974 | - if (empty($modSettings['paid_enabled'])) |
|
| 1975 | - unset($alert_types['paidsubs']); |
|
| 2069 | + if (empty($modSettings['paid_enabled'])) { |
|
| 2070 | + unset($alert_types['paidsubs']); |
|
| 2071 | + } |
|
| 1976 | 2072 | |
| 1977 | 2073 | // Disable membergroup requests at group level if they're disabled |
| 1978 | - if (empty($modSettings['show_group_membership'])) |
|
| 1979 | - unset($alert_types['groupr'], $alert_types['members']['request_group']); |
|
| 2074 | + if (empty($modSettings['show_group_membership'])) { |
|
| 2075 | + unset($alert_types['groupr'], $alert_types['members']['request_group']); |
|
| 2076 | + } |
|
| 1980 | 2077 | |
| 1981 | 2078 | // Disable mentions if they're disabled |
| 1982 | - if (empty($modSettings['enable_mentions'])) |
|
| 1983 | - unset($alert_types['msg']['msg_mention']); |
|
| 2079 | + if (empty($modSettings['enable_mentions'])) { |
|
| 2080 | + unset($alert_types['msg']['msg_mention']); |
|
| 2081 | + } |
|
| 1984 | 2082 | |
| 1985 | 2083 | // Disable likes if they're disabled |
| 1986 | - if (empty($modSettings['enable_likes'])) |
|
| 1987 | - unset($alert_types['msg']['msg_like']); |
|
| 2084 | + if (empty($modSettings['enable_likes'])) { |
|
| 2085 | + unset($alert_types['msg']['msg_like']); |
|
| 2086 | + } |
|
| 1988 | 2087 | |
| 1989 | 2088 | // Disable buddy requests if they're disabled |
| 1990 | - if (empty($modSettings['enable_buddylist'])) |
|
| 1991 | - unset($alert_types['members']['buddy_request']); |
|
| 2089 | + if (empty($modSettings['enable_buddylist'])) { |
|
| 2090 | + unset($alert_types['members']['buddy_request']); |
|
| 2091 | + } |
|
| 1992 | 2092 | |
| 1993 | 2093 | // Now, now, we could pass this through global but we should really get into the habit of |
| 1994 | 2094 | // passing content to hooks, not expecting hooks to splatter everything everywhere. |
@@ -2016,15 +2116,17 @@ discard block |
||
| 2016 | 2116 | $perms_cache['manage_membergroups'] = in_array($memID, $members); |
| 2017 | 2117 | } |
| 2018 | 2118 | |
| 2019 | - if (!($perms_cache['manage_membergroups'] || $can_mod != 0)) |
|
| 2020 | - unset($alert_types['members']['request_group']); |
|
| 2119 | + if (!($perms_cache['manage_membergroups'] || $can_mod != 0)) { |
|
| 2120 | + unset($alert_types['members']['request_group']); |
|
| 2121 | + } |
|
| 2021 | 2122 | |
| 2022 | 2123 | foreach ($alert_types as $group => $items) |
| 2023 | 2124 | { |
| 2024 | 2125 | foreach ($items as $alert_key => $alert_value) |
| 2025 | 2126 | { |
| 2026 | - if (!isset($alert_value['permission'])) |
|
| 2027 | - continue; |
|
| 2127 | + if (!isset($alert_value['permission'])) { |
|
| 2128 | + continue; |
|
| 2129 | + } |
|
| 2028 | 2130 | if (!isset($perms_cache[$alert_value['permission']['name']])) |
| 2029 | 2131 | { |
| 2030 | 2132 | $in_board = !empty($alert_value['permission']['is_board']) ? 0 : null; |
@@ -2032,12 +2134,14 @@ discard block |
||
| 2032 | 2134 | $perms_cache[$alert_value['permission']['name']] = in_array($memID, $members); |
| 2033 | 2135 | } |
| 2034 | 2136 | |
| 2035 | - if (!$perms_cache[$alert_value['permission']['name']]) |
|
| 2036 | - unset ($alert_types[$group][$alert_key]); |
|
| 2137 | + if (!$perms_cache[$alert_value['permission']['name']]) { |
|
| 2138 | + unset ($alert_types[$group][$alert_key]); |
|
| 2139 | + } |
|
| 2037 | 2140 | } |
| 2038 | 2141 | |
| 2039 | - if (empty($alert_types[$group])) |
|
| 2040 | - unset ($alert_types[$group]); |
|
| 2142 | + if (empty($alert_types[$group])) { |
|
| 2143 | + unset ($alert_types[$group]); |
|
| 2144 | + } |
|
| 2041 | 2145 | } |
| 2042 | 2146 | } |
| 2043 | 2147 | |
@@ -2069,9 +2173,9 @@ discard block |
||
| 2069 | 2173 | $update_prefs[$this_option[1]] = !empty($_POST['opt_' . $this_option[1]]) ? 1 : 0; |
| 2070 | 2174 | break; |
| 2071 | 2175 | case 'select': |
| 2072 | - if (isset($_POST['opt_' . $this_option[1]], $this_option['opts'][$_POST['opt_' . $this_option[1]]])) |
|
| 2073 | - $update_prefs[$this_option[1]] = $_POST['opt_' . $this_option[1]]; |
|
| 2074 | - else |
|
| 2176 | + if (isset($_POST['opt_' . $this_option[1]], $this_option['opts'][$_POST['opt_' . $this_option[1]]])) { |
|
| 2177 | + $update_prefs[$this_option[1]] = $_POST['opt_' . $this_option[1]]; |
|
| 2178 | + } else |
|
| 2075 | 2179 | { |
| 2076 | 2180 | // We didn't have a sane value. Let's grab the first item from the possibles. |
| 2077 | 2181 | $keys = array_keys($this_option['opts']); |
@@ -2091,23 +2195,28 @@ discard block |
||
| 2091 | 2195 | $this_value = 0; |
| 2092 | 2196 | foreach ($context['alert_bits'] as $type => $bitvalue) |
| 2093 | 2197 | { |
| 2094 | - if ($this_options[$type] == 'yes' && !empty($_POST[$type . '_' . $item_key]) || $this_options[$type] == 'always') |
|
| 2095 | - $this_value |= $bitvalue; |
|
| 2198 | + if ($this_options[$type] == 'yes' && !empty($_POST[$type . '_' . $item_key]) || $this_options[$type] == 'always') { |
|
| 2199 | + $this_value |= $bitvalue; |
|
| 2200 | + } |
|
| 2201 | + } |
|
| 2202 | + if (!isset($context['alert_prefs'][$item_key]) || $context['alert_prefs'][$item_key] != $this_value) { |
|
| 2203 | + $update_prefs[$item_key] = $this_value; |
|
| 2096 | 2204 | } |
| 2097 | - if (!isset($context['alert_prefs'][$item_key]) || $context['alert_prefs'][$item_key] != $this_value) |
|
| 2098 | - $update_prefs[$item_key] = $this_value; |
|
| 2099 | 2205 | } |
| 2100 | 2206 | } |
| 2101 | 2207 | |
| 2102 | - if (!empty($_POST['opt_alert_timeout'])) |
|
| 2103 | - $update_prefs['alert_timeout'] = $context['member']['alert_timeout'] = (int) $_POST['opt_alert_timeout']; |
|
| 2208 | + if (!empty($_POST['opt_alert_timeout'])) { |
|
| 2209 | + $update_prefs['alert_timeout'] = $context['member']['alert_timeout'] = (int) $_POST['opt_alert_timeout']; |
|
| 2210 | + } |
|
| 2104 | 2211 | |
| 2105 | - if (!empty($_POST['notify_announcements'])) |
|
| 2106 | - $update_prefs['announcements'] = $context['member']['notify_announcements'] = (int) $_POST['notify_announcements']; |
|
| 2212 | + if (!empty($_POST['notify_announcements'])) { |
|
| 2213 | + $update_prefs['announcements'] = $context['member']['notify_announcements'] = (int) $_POST['notify_announcements']; |
|
| 2214 | + } |
|
| 2107 | 2215 | |
| 2108 | 2216 | setNotifyPrefs((int) $memID, $update_prefs); |
| 2109 | - foreach ($update_prefs as $pref => $value) |
|
| 2110 | - $context['alert_prefs'][$pref] = $value; |
|
| 2217 | + foreach ($update_prefs as $pref => $value) { |
|
| 2218 | + $context['alert_prefs'][$pref] = $value; |
|
| 2219 | + } |
|
| 2111 | 2220 | |
| 2112 | 2221 | makeNotificationChanges($memID); |
| 2113 | 2222 | |
@@ -2137,8 +2246,9 @@ discard block |
||
| 2137 | 2246 | |
| 2138 | 2247 | // Now we're all set up. |
| 2139 | 2248 | is_not_guest(); |
| 2140 | - if (!$context['user']['is_owner']) |
|
| 2141 | - fatal_error('no_access'); |
|
| 2249 | + if (!$context['user']['is_owner']) { |
|
| 2250 | + fatal_error('no_access'); |
|
| 2251 | + } |
|
| 2142 | 2252 | |
| 2143 | 2253 | checkSession('get'); |
| 2144 | 2254 | |
@@ -2170,8 +2280,9 @@ discard block |
||
| 2170 | 2280 | { |
| 2171 | 2281 | global $smcFunc; |
| 2172 | 2282 | |
| 2173 | - if (empty($toMark) || empty($memID)) |
|
| 2174 | - return false; |
|
| 2283 | + if (empty($toMark) || empty($memID)) { |
|
| 2284 | + return false; |
|
| 2285 | + } |
|
| 2175 | 2286 | |
| 2176 | 2287 | $toMark = (array) $toMark; |
| 2177 | 2288 | |
@@ -2205,8 +2316,9 @@ discard block |
||
| 2205 | 2316 | { |
| 2206 | 2317 | global $smcFunc; |
| 2207 | 2318 | |
| 2208 | - if (empty($toDelete)) |
|
| 2209 | - return false; |
|
| 2319 | + if (empty($toDelete)) { |
|
| 2320 | + return false; |
|
| 2321 | + } |
|
| 2210 | 2322 | |
| 2211 | 2323 | $toDelete = (array) $toDelete; |
| 2212 | 2324 | |
@@ -2241,8 +2353,9 @@ discard block |
||
| 2241 | 2353 | { |
| 2242 | 2354 | global $smcFunc; |
| 2243 | 2355 | |
| 2244 | - if (empty($memID)) |
|
| 2245 | - return false; |
|
| 2356 | + if (empty($memID)) { |
|
| 2357 | + return false; |
|
| 2358 | + } |
|
| 2246 | 2359 | |
| 2247 | 2360 | $request = $smcFunc['db_query']('', ' |
| 2248 | 2361 | SELECT id_alert |
@@ -2319,8 +2432,9 @@ discard block |
||
| 2319 | 2432 | { |
| 2320 | 2433 | $link = $topic['link']; |
| 2321 | 2434 | |
| 2322 | - if ($topic['new']) |
|
| 2323 | - $link .= ' <a href="' . $topic['new_href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
| 2435 | + if ($topic['new']) { |
|
| 2436 | + $link .= ' <a href="' . $topic['new_href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
| 2437 | + } |
|
| 2324 | 2438 | |
| 2325 | 2439 | $link .= '<br><span class="smalltext"><em>' . $txt['in'] . ' ' . $topic['board_link'] . '</em></span>'; |
| 2326 | 2440 | |
@@ -2471,8 +2585,9 @@ discard block |
||
| 2471 | 2585 | { |
| 2472 | 2586 | $link = $board['link']; |
| 2473 | 2587 | |
| 2474 | - if ($board['new']) |
|
| 2475 | - $link .= ' <a href="' . $board['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
| 2588 | + if ($board['new']) { |
|
| 2589 | + $link .= ' <a href="' . $board['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
| 2590 | + } |
|
| 2476 | 2591 | |
| 2477 | 2592 | return $link; |
| 2478 | 2593 | }, |
@@ -2672,8 +2787,8 @@ discard block |
||
| 2672 | 2787 | ) |
| 2673 | 2788 | ); |
| 2674 | 2789 | $notification_boards = array(); |
| 2675 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 2676 | - $notification_boards[] = array( |
|
| 2790 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 2791 | + $notification_boards[] = array( |
|
| 2677 | 2792 | 'id' => $row['id_board'], |
| 2678 | 2793 | 'name' => $row['name'], |
| 2679 | 2794 | 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', |
@@ -2681,6 +2796,7 @@ discard block |
||
| 2681 | 2796 | 'new' => $row['board_read'] < $row['id_msg_updated'], |
| 2682 | 2797 | 'notify_pref' => isset($prefs['board_notify_' . $row['id_board']]) ? $prefs['board_notify_' . $row['id_board']] : (!empty($prefs['board_notify']) ? $prefs['board_notify'] : 0), |
| 2683 | 2798 | ); |
| 2799 | + } |
|
| 2684 | 2800 | $smcFunc['db_free_result']($request); |
| 2685 | 2801 | |
| 2686 | 2802 | return $notification_boards; |
@@ -2695,17 +2811,18 @@ discard block |
||
| 2695 | 2811 | { |
| 2696 | 2812 | global $context, $options, $cur_profile, $smcFunc; |
| 2697 | 2813 | |
| 2698 | - if (isset($_POST['default_options'])) |
|
| 2699 | - $_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options']; |
|
| 2814 | + if (isset($_POST['default_options'])) { |
|
| 2815 | + $_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options']; |
|
| 2816 | + } |
|
| 2700 | 2817 | |
| 2701 | 2818 | if ($context['user']['is_owner']) |
| 2702 | 2819 | { |
| 2703 | 2820 | $context['member']['options'] = $options; |
| 2704 | - if (isset($_POST['options']) && is_array($_POST['options'])) |
|
| 2705 | - foreach ($_POST['options'] as $k => $v) |
|
| 2821 | + if (isset($_POST['options']) && is_array($_POST['options'])) { |
|
| 2822 | + foreach ($_POST['options'] as $k => $v) |
|
| 2706 | 2823 | $context['member']['options'][$k] = $v; |
| 2707 | - } |
|
| 2708 | - else |
|
| 2824 | + } |
|
| 2825 | + } else |
|
| 2709 | 2826 | { |
| 2710 | 2827 | $request = $smcFunc['db_query']('', ' |
| 2711 | 2828 | SELECT id_member, variable, value |
@@ -2726,8 +2843,9 @@ discard block |
||
| 2726 | 2843 | continue; |
| 2727 | 2844 | } |
| 2728 | 2845 | |
| 2729 | - if (isset($_POST['options'][$row['variable']])) |
|
| 2730 | - $row['value'] = $_POST['options'][$row['variable']]; |
|
| 2846 | + if (isset($_POST['options'][$row['variable']])) { |
|
| 2847 | + $row['value'] = $_POST['options'][$row['variable']]; |
|
| 2848 | + } |
|
| 2731 | 2849 | $context['member']['options'][$row['variable']] = $row['value']; |
| 2732 | 2850 | } |
| 2733 | 2851 | $smcFunc['db_free_result']($request); |
@@ -2735,8 +2853,9 @@ discard block |
||
| 2735 | 2853 | // Load up the default theme options for any missing. |
| 2736 | 2854 | foreach ($temp as $k => $v) |
| 2737 | 2855 | { |
| 2738 | - if (!isset($context['member']['options'][$k])) |
|
| 2739 | - $context['member']['options'][$k] = $v; |
|
| 2856 | + if (!isset($context['member']['options'][$k])) { |
|
| 2857 | + $context['member']['options'][$k] = $v; |
|
| 2858 | + } |
|
| 2740 | 2859 | } |
| 2741 | 2860 | } |
| 2742 | 2861 | } |
@@ -2751,8 +2870,9 @@ discard block |
||
| 2751 | 2870 | global $context, $modSettings, $smcFunc, $cur_profile, $sourcedir; |
| 2752 | 2871 | |
| 2753 | 2872 | // Have the admins enabled this option? |
| 2754 | - if (empty($modSettings['allow_ignore_boards'])) |
|
| 2755 | - fatal_lang_error('ignoreboards_disallowed', 'user'); |
|
| 2873 | + if (empty($modSettings['allow_ignore_boards'])) { |
|
| 2874 | + fatal_lang_error('ignoreboards_disallowed', 'user'); |
|
| 2875 | + } |
|
| 2756 | 2876 | |
| 2757 | 2877 | // Find all the boards this user is allowed to see. |
| 2758 | 2878 | $request = $smcFunc['db_query']('order_by_board_order', ' |
@@ -2772,12 +2892,13 @@ discard block |
||
| 2772 | 2892 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2773 | 2893 | { |
| 2774 | 2894 | // This category hasn't been set up yet.. |
| 2775 | - if (!isset($context['categories'][$row['id_cat']])) |
|
| 2776 | - $context['categories'][$row['id_cat']] = array( |
|
| 2895 | + if (!isset($context['categories'][$row['id_cat']])) { |
|
| 2896 | + $context['categories'][$row['id_cat']] = array( |
|
| 2777 | 2897 | 'id' => $row['id_cat'], |
| 2778 | 2898 | 'name' => $row['cat_name'], |
| 2779 | 2899 | 'boards' => array() |
| 2780 | 2900 | ); |
| 2901 | + } |
|
| 2781 | 2902 | |
| 2782 | 2903 | // Set this board up, and let the template know when it's a child. (indent them..) |
| 2783 | 2904 | $context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array( |
@@ -2807,18 +2928,20 @@ discard block |
||
| 2807 | 2928 | } |
| 2808 | 2929 | |
| 2809 | 2930 | $max_boards = ceil(count($temp_boards) / 2); |
| 2810 | - if ($max_boards == 1) |
|
| 2811 | - $max_boards = 2; |
|
| 2931 | + if ($max_boards == 1) { |
|
| 2932 | + $max_boards = 2; |
|
| 2933 | + } |
|
| 2812 | 2934 | |
| 2813 | 2935 | // Now, alternate them so they can be shown left and right ;). |
| 2814 | 2936 | $context['board_columns'] = array(); |
| 2815 | 2937 | for ($i = 0; $i < $max_boards; $i++) |
| 2816 | 2938 | { |
| 2817 | 2939 | $context['board_columns'][] = $temp_boards[$i]; |
| 2818 | - if (isset($temp_boards[$i + $max_boards])) |
|
| 2819 | - $context['board_columns'][] = $temp_boards[$i + $max_boards]; |
|
| 2820 | - else |
|
| 2821 | - $context['board_columns'][] = array(); |
|
| 2940 | + if (isset($temp_boards[$i + $max_boards])) { |
|
| 2941 | + $context['board_columns'][] = $temp_boards[$i + $max_boards]; |
|
| 2942 | + } else { |
|
| 2943 | + $context['board_columns'][] = array(); |
|
| 2944 | + } |
|
| 2822 | 2945 | } |
| 2823 | 2946 | |
| 2824 | 2947 | loadThemeOptions($memID); |
@@ -2887,8 +3010,9 @@ discard block |
||
| 2887 | 3010 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2888 | 3011 | { |
| 2889 | 3012 | // We should skip the administrator group if they don't have the admin_forum permission! |
| 2890 | - if ($row['id_group'] == 1 && !allowedTo('admin_forum')) |
|
| 2891 | - continue; |
|
| 3013 | + if ($row['id_group'] == 1 && !allowedTo('admin_forum')) { |
|
| 3014 | + continue; |
|
| 3015 | + } |
|
| 2892 | 3016 | |
| 2893 | 3017 | $context['member_groups'][$row['id_group']] = array( |
| 2894 | 3018 | 'id' => $row['id_group'], |
@@ -2934,16 +3058,17 @@ discard block |
||
| 2934 | 3058 | $context['max_signature_length'] = $context['signature_limits']['max_length']; |
| 2935 | 3059 | // Warning message for signature image limits? |
| 2936 | 3060 | $context['signature_warning'] = ''; |
| 2937 | - if ($context['signature_limits']['max_image_width'] && $context['signature_limits']['max_image_height']) |
|
| 2938 | - $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_size'], $context['signature_limits']['max_image_width'], $context['signature_limits']['max_image_height']); |
|
| 2939 | - elseif ($context['signature_limits']['max_image_width'] || $context['signature_limits']['max_image_height']) |
|
| 2940 | - $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_' . ($context['signature_limits']['max_image_width'] ? 'width' : 'height')], $context['signature_limits'][$context['signature_limits']['max_image_width'] ? 'max_image_width' : 'max_image_height']); |
|
| 3061 | + if ($context['signature_limits']['max_image_width'] && $context['signature_limits']['max_image_height']) { |
|
| 3062 | + $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_size'], $context['signature_limits']['max_image_width'], $context['signature_limits']['max_image_height']); |
|
| 3063 | + } elseif ($context['signature_limits']['max_image_width'] || $context['signature_limits']['max_image_height']) { |
|
| 3064 | + $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_' . ($context['signature_limits']['max_image_width'] ? 'width' : 'height')], $context['signature_limits'][$context['signature_limits']['max_image_width'] ? 'max_image_width' : 'max_image_height']); |
|
| 3065 | + } |
|
| 2941 | 3066 | |
| 2942 | 3067 | $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && (function_exists('pspell_new') || (function_exists('enchant_broker_init') && ($txt['lang_charset'] == 'UTF-8' || function_exists('iconv')))); |
| 2943 | 3068 | |
| 2944 | - if (empty($context['do_preview'])) |
|
| 2945 | - $context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br>', '<', '>', '"', '\''), array("\n", '<', '>', '"', '''), $cur_profile['signature']); |
|
| 2946 | - else |
|
| 3069 | + if (empty($context['do_preview'])) { |
|
| 3070 | + $context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br>', '<', '>', '"', '\''), array("\n", '<', '>', '"', '''), $cur_profile['signature']); |
|
| 3071 | + } else |
|
| 2947 | 3072 | { |
| 2948 | 3073 | $signature = !empty($_POST['signature']) ? $_POST['signature'] : ''; |
| 2949 | 3074 | $validation = profileValidateSignature($signature); |
@@ -2953,8 +3078,9 @@ discard block |
||
| 2953 | 3078 | $context['post_errors'] = array(); |
| 2954 | 3079 | } |
| 2955 | 3080 | $context['post_errors'][] = 'signature_not_yet_saved'; |
| 2956 | - if ($validation !== true && $validation !== false) |
|
| 2957 | - $context['post_errors'][] = $validation; |
|
| 3081 | + if ($validation !== true && $validation !== false) { |
|
| 3082 | + $context['post_errors'][] = $validation; |
|
| 3083 | + } |
|
| 2958 | 3084 | |
| 2959 | 3085 | censorText($context['member']['signature']); |
| 2960 | 3086 | $context['member']['current_signature'] = $context['member']['signature']; |
@@ -2964,8 +3090,9 @@ discard block |
||
| 2964 | 3090 | } |
| 2965 | 3091 | |
| 2966 | 3092 | // Load the spell checker? |
| 2967 | - if ($context['show_spellchecking']) |
|
| 2968 | - loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck'); |
|
| 3093 | + if ($context['show_spellchecking']) { |
|
| 3094 | + loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck'); |
|
| 3095 | + } |
|
| 2969 | 3096 | |
| 2970 | 3097 | return true; |
| 2971 | 3098 | } |
@@ -2999,8 +3126,7 @@ discard block |
||
| 2999 | 3126 | 'external' => $cur_profile['avatar'] == 'gravatar://' || empty($modSettings['gravatarAllowExtraEmail']) || !empty($modSettings['gravatarOverride']) ? $cur_profile['email_address'] : substr($cur_profile['avatar'], 11) |
| 3000 | 3127 | ); |
| 3001 | 3128 | $context['member']['avatar']['href'] = get_gravatar_url($context['member']['avatar']['external']); |
| 3002 | - } |
|
| 3003 | - elseif ($cur_profile['avatar'] == '' && $cur_profile['id_attach'] > 0 && $context['member']['avatar']['allow_upload']) |
|
| 3129 | + } elseif ($cur_profile['avatar'] == '' && $cur_profile['id_attach'] > 0 && $context['member']['avatar']['allow_upload']) |
|
| 3004 | 3130 | { |
| 3005 | 3131 | $context['member']['avatar'] += array( |
| 3006 | 3132 | 'choice' => 'upload', |
@@ -3010,33 +3136,34 @@ discard block |
||
| 3010 | 3136 | $context['member']['avatar']['href'] = empty($cur_profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $cur_profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $cur_profile['filename']; |
| 3011 | 3137 | } |
| 3012 | 3138 | // Use "avatar_original" here so we show what the user entered even if the image proxy is enabled |
| 3013 | - elseif ((stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) && $context['member']['avatar']['allow_external']) |
|
| 3014 | - $context['member']['avatar'] += array( |
|
| 3139 | + elseif ((stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) && $context['member']['avatar']['allow_external']) { |
|
| 3140 | + $context['member']['avatar'] += array( |
|
| 3015 | 3141 | 'choice' => 'external', |
| 3016 | 3142 | 'server_pic' => 'blank.png', |
| 3017 | 3143 | 'external' => $cur_profile['avatar_original'] |
| 3018 | 3144 | ); |
| 3019 | - elseif ($cur_profile['avatar'] != '' && file_exists($modSettings['avatar_directory'] . '/' . $cur_profile['avatar']) && $context['member']['avatar']['allow_server_stored']) |
|
| 3020 | - $context['member']['avatar'] += array( |
|
| 3145 | + } elseif ($cur_profile['avatar'] != '' && file_exists($modSettings['avatar_directory'] . '/' . $cur_profile['avatar']) && $context['member']['avatar']['allow_server_stored']) { |
|
| 3146 | + $context['member']['avatar'] += array( |
|
| 3021 | 3147 | 'choice' => 'server_stored', |
| 3022 | 3148 | 'server_pic' => $cur_profile['avatar'] == '' ? 'blank.png' : $cur_profile['avatar'], |
| 3023 | 3149 | 'external' => 'http://' |
| 3024 | 3150 | ); |
| 3025 | - else |
|
| 3026 | - $context['member']['avatar'] += array( |
|
| 3151 | + } else { |
|
| 3152 | + $context['member']['avatar'] += array( |
|
| 3027 | 3153 | 'choice' => 'none', |
| 3028 | 3154 | 'server_pic' => 'blank.png', |
| 3029 | 3155 | 'external' => 'http://' |
| 3030 | 3156 | ); |
| 3157 | + } |
|
| 3031 | 3158 | |
| 3032 | 3159 | // Get a list of all the avatars. |
| 3033 | 3160 | if ($context['member']['avatar']['allow_server_stored']) |
| 3034 | 3161 | { |
| 3035 | 3162 | $context['avatar_list'] = array(); |
| 3036 | 3163 | $context['avatars'] = is_dir($modSettings['avatar_directory']) ? getAvatars('', 0) : array(); |
| 3164 | + } else { |
|
| 3165 | + $context['avatars'] = array(); |
|
| 3037 | 3166 | } |
| 3038 | - else |
|
| 3039 | - $context['avatars'] = array(); |
|
| 3040 | 3167 | |
| 3041 | 3168 | // Second level selected avatar... |
| 3042 | 3169 | $context['avatar_selected'] = substr(strrchr($context['member']['avatar']['server_pic'], '/'), 1); |
@@ -3065,19 +3192,22 @@ discard block |
||
| 3065 | 3192 | ) |
| 3066 | 3193 | ); |
| 3067 | 3194 | $protected_groups = array(1); |
| 3068 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 3069 | - $protected_groups[] = $row['id_group']; |
|
| 3195 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 3196 | + $protected_groups[] = $row['id_group']; |
|
| 3197 | + } |
|
| 3070 | 3198 | $smcFunc['db_free_result']($request); |
| 3071 | 3199 | |
| 3072 | 3200 | $protected_groups = array_unique($protected_groups); |
| 3073 | 3201 | } |
| 3074 | 3202 | |
| 3075 | 3203 | // The account page allows the change of your id_group - but not to a protected group! |
| 3076 | - if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0) |
|
| 3077 | - $value = (int) $value; |
|
| 3204 | + if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0) { |
|
| 3205 | + $value = (int) $value; |
|
| 3206 | + } |
|
| 3078 | 3207 | // ... otherwise it's the old group sir. |
| 3079 | - else |
|
| 3080 | - $value = $old_profile['id_group']; |
|
| 3208 | + else { |
|
| 3209 | + $value = $old_profile['id_group']; |
|
| 3210 | + } |
|
| 3081 | 3211 | |
| 3082 | 3212 | // Find the additional membergroups (if any) |
| 3083 | 3213 | if (isset($_POST['additional_groups']) && is_array($_POST['additional_groups'])) |
@@ -3086,16 +3216,18 @@ discard block |
||
| 3086 | 3216 | foreach ($_POST['additional_groups'] as $group_id) |
| 3087 | 3217 | { |
| 3088 | 3218 | $group_id = (int) $group_id; |
| 3089 | - if (!empty($group_id) && (empty($protected_groups) || !in_array($group_id, $protected_groups))) |
|
| 3090 | - $additional_groups[] = $group_id; |
|
| 3219 | + if (!empty($group_id) && (empty($protected_groups) || !in_array($group_id, $protected_groups))) { |
|
| 3220 | + $additional_groups[] = $group_id; |
|
| 3221 | + } |
|
| 3091 | 3222 | } |
| 3092 | 3223 | |
| 3093 | 3224 | // Put the protected groups back in there if you don't have permission to take them away. |
| 3094 | 3225 | $old_additional_groups = explode(',', $old_profile['additional_groups']); |
| 3095 | 3226 | foreach ($old_additional_groups as $group_id) |
| 3096 | 3227 | { |
| 3097 | - if (!empty($protected_groups) && in_array($group_id, $protected_groups)) |
|
| 3098 | - $additional_groups[] = $group_id; |
|
| 3228 | + if (!empty($protected_groups) && in_array($group_id, $protected_groups)) { |
|
| 3229 | + $additional_groups[] = $group_id; |
|
| 3230 | + } |
|
| 3099 | 3231 | } |
| 3100 | 3232 | |
| 3101 | 3233 | if (implode(',', $additional_groups) !== $old_profile['additional_groups']) |
@@ -3127,18 +3259,20 @@ discard block |
||
| 3127 | 3259 | list ($another) = $smcFunc['db_fetch_row']($request); |
| 3128 | 3260 | $smcFunc['db_free_result']($request); |
| 3129 | 3261 | |
| 3130 | - if (empty($another)) |
|
| 3131 | - fatal_lang_error('at_least_one_admin', 'critical'); |
|
| 3262 | + if (empty($another)) { |
|
| 3263 | + fatal_lang_error('at_least_one_admin', 'critical'); |
|
| 3264 | + } |
|
| 3132 | 3265 | } |
| 3133 | 3266 | } |
| 3134 | 3267 | |
| 3135 | 3268 | // If we are changing group status, update permission cache as necessary. |
| 3136 | 3269 | if ($value != $old_profile['id_group'] || isset($profile_vars['additional_groups'])) |
| 3137 | 3270 | { |
| 3138 | - if ($context['user']['is_owner']) |
|
| 3139 | - $_SESSION['mc']['time'] = 0; |
|
| 3140 | - else |
|
| 3141 | - updateSettings(array('settings_updated' => time())); |
|
| 3271 | + if ($context['user']['is_owner']) { |
|
| 3272 | + $_SESSION['mc']['time'] = 0; |
|
| 3273 | + } else { |
|
| 3274 | + updateSettings(array('settings_updated' => time())); |
|
| 3275 | + } |
|
| 3142 | 3276 | } |
| 3143 | 3277 | |
| 3144 | 3278 | // Announce to any hooks that we have changed groups, but don't allow them to change it. |
@@ -3159,8 +3293,9 @@ discard block |
||
| 3159 | 3293 | global $modSettings, $sourcedir, $smcFunc, $profile_vars, $cur_profile, $context; |
| 3160 | 3294 | |
| 3161 | 3295 | $memID = $context['id_member']; |
| 3162 | - if (empty($memID) && !empty($context['password_auth_failed'])) |
|
| 3163 | - return false; |
|
| 3296 | + if (empty($memID) && !empty($context['password_auth_failed'])) { |
|
| 3297 | + return false; |
|
| 3298 | + } |
|
| 3164 | 3299 | |
| 3165 | 3300 | require_once($sourcedir . '/ManageAttachments.php'); |
| 3166 | 3301 | |
@@ -3171,8 +3306,9 @@ discard block |
||
| 3171 | 3306 | $downloadedExternalAvatar = false; |
| 3172 | 3307 | if ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && strlen($_POST['userpicpersonal']) > 7 && !empty($modSettings['avatar_download_external'])) |
| 3173 | 3308 | { |
| 3174 | - if (!is_writable($uploadDir)) |
|
| 3175 | - fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3309 | + if (!is_writable($uploadDir)) { |
|
| 3310 | + fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3311 | + } |
|
| 3176 | 3312 | |
| 3177 | 3313 | require_once($sourcedir . '/Subs-Package.php'); |
| 3178 | 3314 | |
@@ -3216,19 +3352,18 @@ discard block |
||
| 3216 | 3352 | |
| 3217 | 3353 | // Get rid of their old avatar. (if uploaded.) |
| 3218 | 3354 | removeAttachments(array('id_member' => $memID)); |
| 3219 | - } |
|
| 3220 | - elseif ($value == 'gravatar' && !empty($modSettings['gravatarEnabled'])) |
|
| 3355 | + } elseif ($value == 'gravatar' && !empty($modSettings['gravatarEnabled'])) |
|
| 3221 | 3356 | { |
| 3222 | 3357 | // One wasn't specified, or it's not allowed to use extra email addresses, or it's not a valid one, reset to default Gravatar. |
| 3223 | - if (empty($_POST['gravatarEmail']) || empty($modSettings['gravatarAllowExtraEmail']) || !filter_var($_POST['gravatarEmail'], FILTER_VALIDATE_EMAIL)) |
|
| 3224 | - $profile_vars['avatar'] = 'gravatar://'; |
|
| 3225 | - else |
|
| 3226 | - $profile_vars['avatar'] = 'gravatar://' . ($_POST['gravatarEmail'] != $cur_profile['email_address'] ? $_POST['gravatarEmail'] : ''); |
|
| 3358 | + if (empty($_POST['gravatarEmail']) || empty($modSettings['gravatarAllowExtraEmail']) || !filter_var($_POST['gravatarEmail'], FILTER_VALIDATE_EMAIL)) { |
|
| 3359 | + $profile_vars['avatar'] = 'gravatar://'; |
|
| 3360 | + } else { |
|
| 3361 | + $profile_vars['avatar'] = 'gravatar://' . ($_POST['gravatarEmail'] != $cur_profile['email_address'] ? $_POST['gravatarEmail'] : ''); |
|
| 3362 | + } |
|
| 3227 | 3363 | |
| 3228 | 3364 | // Get rid of their old avatar. (if uploaded.) |
| 3229 | 3365 | removeAttachments(array('id_member' => $memID)); |
| 3230 | - } |
|
| 3231 | - elseif ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && empty($modSettings['avatar_download_external'])) |
|
| 3366 | + } elseif ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && empty($modSettings['avatar_download_external'])) |
|
| 3232 | 3367 | { |
| 3233 | 3368 | // We need these clean... |
| 3234 | 3369 | $cur_profile['id_attach'] = 0; |
@@ -3240,11 +3375,13 @@ discard block |
||
| 3240 | 3375 | |
| 3241 | 3376 | $profile_vars['avatar'] = str_replace(' ', '%20', preg_replace('~action(?:=|%3d)(?!dlattach)~i', 'action-', $_POST['userpicpersonal'])); |
| 3242 | 3377 | |
| 3243 | - if ($profile_vars['avatar'] == 'http://' || $profile_vars['avatar'] == 'http:///') |
|
| 3244 | - $profile_vars['avatar'] = ''; |
|
| 3378 | + if ($profile_vars['avatar'] == 'http://' || $profile_vars['avatar'] == 'http:///') { |
|
| 3379 | + $profile_vars['avatar'] = ''; |
|
| 3380 | + } |
|
| 3245 | 3381 | // Trying to make us do something we'll regret? |
| 3246 | - elseif (substr($profile_vars['avatar'], 0, 7) != 'http://' && substr($profile_vars['avatar'], 0, 8) != 'https://') |
|
| 3247 | - return 'bad_avatar_invalid_url'; |
|
| 3382 | + elseif (substr($profile_vars['avatar'], 0, 7) != 'http://' && substr($profile_vars['avatar'], 0, 8) != 'https://') { |
|
| 3383 | + return 'bad_avatar_invalid_url'; |
|
| 3384 | + } |
|
| 3248 | 3385 | // Should we check dimensions? |
| 3249 | 3386 | elseif (!empty($modSettings['avatar_max_height_external']) || !empty($modSettings['avatar_max_width_external'])) |
| 3250 | 3387 | { |
@@ -3254,9 +3391,9 @@ discard block |
||
| 3254 | 3391 | if (is_array($sizes) && (($sizes[0] > $modSettings['avatar_max_width_external'] && !empty($modSettings['avatar_max_width_external'])) || ($sizes[1] > $modSettings['avatar_max_height_external'] && !empty($modSettings['avatar_max_height_external'])))) |
| 3255 | 3392 | { |
| 3256 | 3393 | // Houston, we have a problem. The avatar is too large!! |
| 3257 | - if ($modSettings['avatar_action_too_large'] == 'option_refuse') |
|
| 3258 | - return 'bad_avatar_too_large'; |
|
| 3259 | - elseif ($modSettings['avatar_action_too_large'] == 'option_download_and_resize') |
|
| 3394 | + if ($modSettings['avatar_action_too_large'] == 'option_refuse') { |
|
| 3395 | + return 'bad_avatar_too_large'; |
|
| 3396 | + } elseif ($modSettings['avatar_action_too_large'] == 'option_download_and_resize') |
|
| 3260 | 3397 | { |
| 3261 | 3398 | // @todo remove this if appropriate |
| 3262 | 3399 | require_once($sourcedir . '/Subs-Graphics.php'); |
@@ -3266,26 +3403,27 @@ discard block |
||
| 3266 | 3403 | $cur_profile['id_attach'] = $modSettings['new_avatar_data']['id']; |
| 3267 | 3404 | $cur_profile['filename'] = $modSettings['new_avatar_data']['filename']; |
| 3268 | 3405 | $cur_profile['attachment_type'] = $modSettings['new_avatar_data']['type']; |
| 3406 | + } else { |
|
| 3407 | + return 'bad_avatar'; |
|
| 3269 | 3408 | } |
| 3270 | - else |
|
| 3271 | - return 'bad_avatar'; |
|
| 3272 | 3409 | } |
| 3273 | 3410 | } |
| 3274 | 3411 | } |
| 3275 | - } |
|
| 3276 | - elseif (($value == 'upload' && allowedTo('profile_upload_avatar')) || $downloadedExternalAvatar) |
|
| 3412 | + } elseif (($value == 'upload' && allowedTo('profile_upload_avatar')) || $downloadedExternalAvatar) |
|
| 3277 | 3413 | { |
| 3278 | 3414 | if ((isset($_FILES['attachment']['name']) && $_FILES['attachment']['name'] != '') || $downloadedExternalAvatar) |
| 3279 | 3415 | { |
| 3280 | 3416 | // Get the dimensions of the image. |
| 3281 | 3417 | if (!$downloadedExternalAvatar) |
| 3282 | 3418 | { |
| 3283 | - if (!is_writable($uploadDir)) |
|
| 3284 | - fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3419 | + if (!is_writable($uploadDir)) { |
|
| 3420 | + fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3421 | + } |
|
| 3285 | 3422 | |
| 3286 | 3423 | $new_filename = $uploadDir . '/' . getAttachmentFilename('avatar_tmp_' . $memID, false, null, true); |
| 3287 | - if (!move_uploaded_file($_FILES['attachment']['tmp_name'], $new_filename)) |
|
| 3288 | - fatal_lang_error('attach_timeout', 'critical'); |
|
| 3424 | + if (!move_uploaded_file($_FILES['attachment']['tmp_name'], $new_filename)) { |
|
| 3425 | + fatal_lang_error('attach_timeout', 'critical'); |
|
| 3426 | + } |
|
| 3289 | 3427 | |
| 3290 | 3428 | $_FILES['attachment']['tmp_name'] = $new_filename; |
| 3291 | 3429 | } |
@@ -3398,17 +3536,19 @@ discard block |
||
| 3398 | 3536 | $profile_vars['avatar'] = ''; |
| 3399 | 3537 | |
| 3400 | 3538 | // Delete any temporary file. |
| 3401 | - if (file_exists($_FILES['attachment']['tmp_name'])) |
|
| 3402 | - @unlink($_FILES['attachment']['tmp_name']); |
|
| 3539 | + if (file_exists($_FILES['attachment']['tmp_name'])) { |
|
| 3540 | + @unlink($_FILES['attachment']['tmp_name']); |
|
| 3541 | + } |
|
| 3403 | 3542 | } |
| 3404 | 3543 | // Selected the upload avatar option and had one already uploaded before or didn't upload one. |
| 3405 | - else |
|
| 3544 | + else { |
|
| 3545 | + $profile_vars['avatar'] = ''; |
|
| 3546 | + } |
|
| 3547 | + } elseif ($value == 'gravatar' && allowedTo('profile_gravatar_avatar')) { |
|
| 3548 | + $profile_vars['avatar'] = 'gravatar://www.gravatar.com/avatar/' . md5(strtolower(trim($cur_profile['email_address']))); |
|
| 3549 | + } else { |
|
| 3406 | 3550 | $profile_vars['avatar'] = ''; |
| 3407 | 3551 | } |
| 3408 | - elseif ($value == 'gravatar' && allowedTo('profile_gravatar_avatar')) |
|
| 3409 | - $profile_vars['avatar'] = 'gravatar://www.gravatar.com/avatar/' . md5(strtolower(trim($cur_profile['email_address']))); |
|
| 3410 | - else |
|
| 3411 | - $profile_vars['avatar'] = ''; |
|
| 3412 | 3552 | |
| 3413 | 3553 | // Setup the profile variables so it shows things right on display! |
| 3414 | 3554 | $cur_profile['avatar'] = $profile_vars['avatar']; |
@@ -3456,9 +3596,9 @@ discard block |
||
| 3456 | 3596 | $smiley_parsed = $unparsed_signature; |
| 3457 | 3597 | parsesmileys($smiley_parsed); |
| 3458 | 3598 | $smiley_count = substr_count(strtolower($smiley_parsed), '<img') - substr_count(strtolower($unparsed_signature), '<img'); |
| 3459 | - if (!empty($sig_limits[4]) && $sig_limits[4] == -1 && $smiley_count > 0) |
|
| 3460 | - return 'signature_allow_smileys'; |
|
| 3461 | - elseif (!empty($sig_limits[4]) && $sig_limits[4] > 0 && $smiley_count > $sig_limits[4]) |
|
| 3599 | + if (!empty($sig_limits[4]) && $sig_limits[4] == -1 && $smiley_count > 0) { |
|
| 3600 | + return 'signature_allow_smileys'; |
|
| 3601 | + } elseif (!empty($sig_limits[4]) && $sig_limits[4] > 0 && $smiley_count > $sig_limits[4]) |
|
| 3462 | 3602 | { |
| 3463 | 3603 | $txt['profile_error_signature_max_smileys'] = sprintf($txt['profile_error_signature_max_smileys'], $sig_limits[4]); |
| 3464 | 3604 | return 'signature_max_smileys'; |
@@ -3471,14 +3611,15 @@ discard block |
||
| 3471 | 3611 | { |
| 3472 | 3612 | $limit_broke = 0; |
| 3473 | 3613 | // Attempt to allow all sizes of abuse, so to speak. |
| 3474 | - if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) |
|
| 3475 | - $limit_broke = $sig_limits[7] . 'px'; |
|
| 3476 | - elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) |
|
| 3477 | - $limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt'; |
|
| 3478 | - elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) |
|
| 3479 | - $limit_broke = ((float) $sig_limits[7] / 16) . 'em'; |
|
| 3480 | - elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) |
|
| 3481 | - $limit_broke = 'large'; |
|
| 3614 | + if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) { |
|
| 3615 | + $limit_broke = $sig_limits[7] . 'px'; |
|
| 3616 | + } elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) { |
|
| 3617 | + $limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt'; |
|
| 3618 | + } elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) { |
|
| 3619 | + $limit_broke = ((float) $sig_limits[7] / 16) . 'em'; |
|
| 3620 | + } elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) { |
|
| 3621 | + $limit_broke = 'large'; |
|
| 3622 | + } |
|
| 3482 | 3623 | |
| 3483 | 3624 | if ($limit_broke) |
| 3484 | 3625 | { |
@@ -3520,24 +3661,26 @@ discard block |
||
| 3520 | 3661 | $width = -1; $height = -1; |
| 3521 | 3662 | |
| 3522 | 3663 | // Does it have predefined restraints? Width first. |
| 3523 | - if ($matches[6][$key]) |
|
| 3524 | - $matches[2][$key] = $matches[6][$key]; |
|
| 3664 | + if ($matches[6][$key]) { |
|
| 3665 | + $matches[2][$key] = $matches[6][$key]; |
|
| 3666 | + } |
|
| 3525 | 3667 | if ($matches[2][$key] && $sig_limits[5] && $matches[2][$key] > $sig_limits[5]) |
| 3526 | 3668 | { |
| 3527 | 3669 | $width = $sig_limits[5]; |
| 3528 | 3670 | $matches[4][$key] = $matches[4][$key] * ($width / $matches[2][$key]); |
| 3671 | + } elseif ($matches[2][$key]) { |
|
| 3672 | + $width = $matches[2][$key]; |
|
| 3529 | 3673 | } |
| 3530 | - elseif ($matches[2][$key]) |
|
| 3531 | - $width = $matches[2][$key]; |
|
| 3532 | 3674 | // ... and height. |
| 3533 | 3675 | if ($matches[4][$key] && $sig_limits[6] && $matches[4][$key] > $sig_limits[6]) |
| 3534 | 3676 | { |
| 3535 | 3677 | $height = $sig_limits[6]; |
| 3536 | - if ($width != -1) |
|
| 3537 | - $width = $width * ($height / $matches[4][$key]); |
|
| 3678 | + if ($width != -1) { |
|
| 3679 | + $width = $width * ($height / $matches[4][$key]); |
|
| 3680 | + } |
|
| 3681 | + } elseif ($matches[4][$key]) { |
|
| 3682 | + $height = $matches[4][$key]; |
|
| 3538 | 3683 | } |
| 3539 | - elseif ($matches[4][$key]) |
|
| 3540 | - $height = $matches[4][$key]; |
|
| 3541 | 3684 | |
| 3542 | 3685 | // If the dimensions are still not fixed - we need to check the actual image. |
| 3543 | 3686 | if (($width == -1 && $sig_limits[5]) || ($height == -1 && $sig_limits[6])) |
@@ -3555,21 +3698,24 @@ discard block |
||
| 3555 | 3698 | if ($sizes[1] > $sig_limits[6] && $sig_limits[6]) |
| 3556 | 3699 | { |
| 3557 | 3700 | $height = $sig_limits[6]; |
| 3558 | - if ($width == -1) |
|
| 3559 | - $width = $sizes[0]; |
|
| 3701 | + if ($width == -1) { |
|
| 3702 | + $width = $sizes[0]; |
|
| 3703 | + } |
|
| 3560 | 3704 | $width = $width * ($height / $sizes[1]); |
| 3705 | + } elseif ($width != -1) { |
|
| 3706 | + $height = $sizes[1]; |
|
| 3561 | 3707 | } |
| 3562 | - elseif ($width != -1) |
|
| 3563 | - $height = $sizes[1]; |
|
| 3564 | 3708 | } |
| 3565 | 3709 | } |
| 3566 | 3710 | |
| 3567 | 3711 | // Did we come up with some changes? If so remake the string. |
| 3568 | - if ($width != -1 || $height != -1) |
|
| 3569 | - $replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]'; |
|
| 3712 | + if ($width != -1 || $height != -1) { |
|
| 3713 | + $replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]'; |
|
| 3714 | + } |
|
| 3715 | + } |
|
| 3716 | + if (!empty($replaces)) { |
|
| 3717 | + $value = str_replace(array_keys($replaces), array_values($replaces), $value); |
|
| 3570 | 3718 | } |
| 3571 | - if (!empty($replaces)) |
|
| 3572 | - $value = str_replace(array_keys($replaces), array_values($replaces), $value); |
|
| 3573 | 3719 | } |
| 3574 | 3720 | } |
| 3575 | 3721 | |
@@ -3613,10 +3759,12 @@ discard block |
||
| 3613 | 3759 | $email = strtr($email, array(''' => '\'')); |
| 3614 | 3760 | |
| 3615 | 3761 | // Check the name and email for validity. |
| 3616 | - if (trim($email) == '') |
|
| 3617 | - return 'no_email'; |
|
| 3618 | - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) |
|
| 3619 | - return 'bad_email'; |
|
| 3762 | + if (trim($email) == '') { |
|
| 3763 | + return 'no_email'; |
|
| 3764 | + } |
|
| 3765 | + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
| 3766 | + return 'bad_email'; |
|
| 3767 | + } |
|
| 3620 | 3768 | |
| 3621 | 3769 | // Email addresses should be and stay unique. |
| 3622 | 3770 | $request = $smcFunc['db_query']('', ' |
@@ -3631,8 +3779,9 @@ discard block |
||
| 3631 | 3779 | ) |
| 3632 | 3780 | ); |
| 3633 | 3781 | |
| 3634 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 3635 | - return 'email_taken'; |
|
| 3782 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 3783 | + return 'email_taken'; |
|
| 3784 | + } |
|
| 3636 | 3785 | $smcFunc['db_free_result']($request); |
| 3637 | 3786 | |
| 3638 | 3787 | return true; |
@@ -3645,8 +3794,9 @@ discard block |
||
| 3645 | 3794 | { |
| 3646 | 3795 | global $modSettings, $context, $cur_profile; |
| 3647 | 3796 | |
| 3648 | - if (isset($_POST['passwrd2']) && $_POST['passwrd2'] != '') |
|
| 3649 | - setLoginCookie(60 * $modSettings['cookieTime'], $context['id_member'], hash_salt($_POST['passwrd1'], $cur_profile['password_salt'])); |
|
| 3797 | + if (isset($_POST['passwrd2']) && $_POST['passwrd2'] != '') { |
|
| 3798 | + setLoginCookie(60 * $modSettings['cookieTime'], $context['id_member'], hash_salt($_POST['passwrd1'], $cur_profile['password_salt'])); |
|
| 3799 | + } |
|
| 3650 | 3800 | |
| 3651 | 3801 | loadUserSettings(); |
| 3652 | 3802 | writeLog(); |
@@ -3662,8 +3812,9 @@ discard block |
||
| 3662 | 3812 | require_once($sourcedir . '/Subs-Post.php'); |
| 3663 | 3813 | |
| 3664 | 3814 | // Shouldn't happen but just in case. |
| 3665 | - if (empty($profile_vars['email_address'])) |
|
| 3666 | - return; |
|
| 3815 | + if (empty($profile_vars['email_address'])) { |
|
| 3816 | + return; |
|
| 3817 | + } |
|
| 3667 | 3818 | |
| 3668 | 3819 | $replacements = array( |
| 3669 | 3820 | 'ACTIVATIONLINK' => $scripturl . '?action=activate;u=' . $context['id_member'] . ';code=' . $profile_vars['validation_code'], |
@@ -3686,8 +3837,9 @@ discard block |
||
| 3686 | 3837 | $_SESSION['log_time'] = 0; |
| 3687 | 3838 | $_SESSION['login_' . $cookiename] = $smcFunc['json_encode'](array(0, '', 0)); |
| 3688 | 3839 | |
| 3689 | - if (isset($_COOKIE[$cookiename])) |
|
| 3690 | - $_COOKIE[$cookiename] = ''; |
|
| 3840 | + if (isset($_COOKIE[$cookiename])) { |
|
| 3841 | + $_COOKIE[$cookiename] = ''; |
|
| 3842 | + } |
|
| 3691 | 3843 | |
| 3692 | 3844 | loadUserSettings(); |
| 3693 | 3845 | |
@@ -3720,11 +3872,13 @@ discard block |
||
| 3720 | 3872 | $groups[] = $curMember['id_group']; |
| 3721 | 3873 | |
| 3722 | 3874 | // Ensure the query doesn't croak! |
| 3723 | - if (empty($groups)) |
|
| 3724 | - $groups = array(0); |
|
| 3875 | + if (empty($groups)) { |
|
| 3876 | + $groups = array(0); |
|
| 3877 | + } |
|
| 3725 | 3878 | // Just to be sure... |
| 3726 | - foreach ($groups as $k => $v) |
|
| 3727 | - $groups[$k] = (int) $v; |
|
| 3879 | + foreach ($groups as $k => $v) { |
|
| 3880 | + $groups[$k] = (int) $v; |
|
| 3881 | + } |
|
| 3728 | 3882 | |
| 3729 | 3883 | // Get all the membergroups they can join. |
| 3730 | 3884 | $request = $smcFunc['db_query']('', ' |
@@ -3754,12 +3908,14 @@ discard block |
||
| 3754 | 3908 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 3755 | 3909 | { |
| 3756 | 3910 | // Can they edit their primary group? |
| 3757 | - if (($row['id_group'] == $context['primary_group'] && $row['group_type'] > 1) || ($row['hidden'] != 2 && $context['primary_group'] == 0 && in_array($row['id_group'], $groups))) |
|
| 3758 | - $context['can_edit_primary'] = true; |
|
| 3911 | + if (($row['id_group'] == $context['primary_group'] && $row['group_type'] > 1) || ($row['hidden'] != 2 && $context['primary_group'] == 0 && in_array($row['id_group'], $groups))) { |
|
| 3912 | + $context['can_edit_primary'] = true; |
|
| 3913 | + } |
|
| 3759 | 3914 | |
| 3760 | 3915 | // If they can't manage (protected) groups, and it's not publically joinable or already assigned, they can't see it. |
| 3761 | - if (((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) && $row['id_group'] != $context['primary_group']) |
|
| 3762 | - continue; |
|
| 3916 | + if (((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) && $row['id_group'] != $context['primary_group']) { |
|
| 3917 | + continue; |
|
| 3918 | + } |
|
| 3763 | 3919 | |
| 3764 | 3920 | $context['groups'][in_array($row['id_group'], $groups) ? 'member' : 'available'][$row['id_group']] = array( |
| 3765 | 3921 | 'id' => $row['id_group'], |
@@ -3788,13 +3944,15 @@ discard block |
||
| 3788 | 3944 | ); |
| 3789 | 3945 | |
| 3790 | 3946 | // No changing primary one unless you have enough groups! |
| 3791 | - if (count($context['groups']['member']) < 2) |
|
| 3792 | - $context['can_edit_primary'] = false; |
|
| 3947 | + if (count($context['groups']['member']) < 2) { |
|
| 3948 | + $context['can_edit_primary'] = false; |
|
| 3949 | + } |
|
| 3793 | 3950 | |
| 3794 | 3951 | // In the special case that someone is requesting membership of a group, setup some special context vars. |
| 3795 | - if (isset($_REQUEST['request']) && isset($context['groups']['available'][(int) $_REQUEST['request']]) && $context['groups']['available'][(int) $_REQUEST['request']]['type'] == 2) |
|
| 3796 | - $context['group_request'] = $context['groups']['available'][(int) $_REQUEST['request']]; |
|
| 3797 | -} |
|
| 3952 | + if (isset($_REQUEST['request']) && isset($context['groups']['available'][(int) $_REQUEST['request']]) && $context['groups']['available'][(int) $_REQUEST['request']]['type'] == 2) { |
|
| 3953 | + $context['group_request'] = $context['groups']['available'][(int) $_REQUEST['request']]; |
|
| 3954 | + } |
|
| 3955 | + } |
|
| 3798 | 3956 | |
| 3799 | 3957 | /** |
| 3800 | 3958 | * This function actually makes all the group changes |
@@ -3809,10 +3967,12 @@ discard block |
||
| 3809 | 3967 | global $user_info, $context, $user_profile, $modSettings, $smcFunc; |
| 3810 | 3968 | |
| 3811 | 3969 | // Let's be extra cautious... |
| 3812 | - if (!$context['user']['is_owner'] || empty($modSettings['show_group_membership'])) |
|
| 3813 | - isAllowedTo('manage_membergroups'); |
|
| 3814 | - if (!isset($_REQUEST['gid']) && !isset($_POST['primary'])) |
|
| 3815 | - fatal_lang_error('no_access', false); |
|
| 3970 | + if (!$context['user']['is_owner'] || empty($modSettings['show_group_membership'])) { |
|
| 3971 | + isAllowedTo('manage_membergroups'); |
|
| 3972 | + } |
|
| 3973 | + if (!isset($_REQUEST['gid']) && !isset($_POST['primary'])) { |
|
| 3974 | + fatal_lang_error('no_access', false); |
|
| 3975 | + } |
|
| 3816 | 3976 | |
| 3817 | 3977 | checkSession(isset($_GET['gid']) ? 'get' : 'post'); |
| 3818 | 3978 | |
@@ -3831,8 +3991,9 @@ discard block |
||
| 3831 | 3991 | $foundTarget = $changeType == 'primary' && $group_id == 0 ? true : false; |
| 3832 | 3992 | |
| 3833 | 3993 | // Sanity check!! |
| 3834 | - if ($group_id == 1) |
|
| 3835 | - isAllowedTo('admin_forum'); |
|
| 3994 | + if ($group_id == 1) { |
|
| 3995 | + isAllowedTo('admin_forum'); |
|
| 3996 | + } |
|
| 3836 | 3997 | // Protected groups too! |
| 3837 | 3998 | else |
| 3838 | 3999 | { |
@@ -3849,8 +4010,9 @@ discard block |
||
| 3849 | 4010 | list ($is_protected) = $smcFunc['db_fetch_row']($request); |
| 3850 | 4011 | $smcFunc['db_free_result']($request); |
| 3851 | 4012 | |
| 3852 | - if ($is_protected == 1) |
|
| 3853 | - isAllowedTo('admin_forum'); |
|
| 4013 | + if ($is_protected == 1) { |
|
| 4014 | + isAllowedTo('admin_forum'); |
|
| 4015 | + } |
|
| 3854 | 4016 | } |
| 3855 | 4017 | |
| 3856 | 4018 | // What ever we are doing, we need to determine if changing primary is possible! |
@@ -3872,36 +4034,43 @@ discard block |
||
| 3872 | 4034 | $group_name = $row['group_name']; |
| 3873 | 4035 | |
| 3874 | 4036 | // Does the group type match what we're doing - are we trying to request a non-requestable group? |
| 3875 | - if ($changeType == 'request' && $row['group_type'] != 2) |
|
| 3876 | - fatal_lang_error('no_access', false); |
|
| 4037 | + if ($changeType == 'request' && $row['group_type'] != 2) { |
|
| 4038 | + fatal_lang_error('no_access', false); |
|
| 4039 | + } |
|
| 3877 | 4040 | // What about leaving a requestable group we are not a member of? |
| 3878 | - elseif ($changeType == 'free' && $row['group_type'] == 2 && $old_profile['id_group'] != $row['id_group'] && !isset($addGroups[$row['id_group']])) |
|
| 3879 | - fatal_lang_error('no_access', false); |
|
| 3880 | - elseif ($changeType == 'free' && $row['group_type'] != 3 && $row['group_type'] != 2) |
|
| 3881 | - fatal_lang_error('no_access', false); |
|
| 4041 | + elseif ($changeType == 'free' && $row['group_type'] == 2 && $old_profile['id_group'] != $row['id_group'] && !isset($addGroups[$row['id_group']])) { |
|
| 4042 | + fatal_lang_error('no_access', false); |
|
| 4043 | + } elseif ($changeType == 'free' && $row['group_type'] != 3 && $row['group_type'] != 2) { |
|
| 4044 | + fatal_lang_error('no_access', false); |
|
| 4045 | + } |
|
| 3882 | 4046 | |
| 3883 | 4047 | // We can't change the primary group if this is hidden! |
| 3884 | - if ($row['hidden'] == 2) |
|
| 3885 | - $canChangePrimary = false; |
|
| 4048 | + if ($row['hidden'] == 2) { |
|
| 4049 | + $canChangePrimary = false; |
|
| 4050 | + } |
|
| 3886 | 4051 | } |
| 3887 | 4052 | |
| 3888 | 4053 | // If this is their old primary, can we change it? |
| 3889 | - if ($row['id_group'] == $old_profile['id_group'] && ($row['group_type'] > 1 || $context['can_manage_membergroups']) && $canChangePrimary !== false) |
|
| 3890 | - $canChangePrimary = 1; |
|
| 4054 | + if ($row['id_group'] == $old_profile['id_group'] && ($row['group_type'] > 1 || $context['can_manage_membergroups']) && $canChangePrimary !== false) { |
|
| 4055 | + $canChangePrimary = 1; |
|
| 4056 | + } |
|
| 3891 | 4057 | |
| 3892 | 4058 | // If we are not doing a force primary move, don't do it automatically if current primary is not 0. |
| 3893 | - if ($changeType != 'primary' && $old_profile['id_group'] != 0) |
|
| 3894 | - $canChangePrimary = false; |
|
| 4059 | + if ($changeType != 'primary' && $old_profile['id_group'] != 0) { |
|
| 4060 | + $canChangePrimary = false; |
|
| 4061 | + } |
|
| 3895 | 4062 | |
| 3896 | 4063 | // If this is the one we are acting on, can we even act? |
| 3897 | - if ((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) |
|
| 3898 | - $canChangePrimary = false; |
|
| 4064 | + if ((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) { |
|
| 4065 | + $canChangePrimary = false; |
|
| 4066 | + } |
|
| 3899 | 4067 | } |
| 3900 | 4068 | $smcFunc['db_free_result']($request); |
| 3901 | 4069 | |
| 3902 | 4070 | // Didn't find the target? |
| 3903 | - if (!$foundTarget) |
|
| 3904 | - fatal_lang_error('no_access', false); |
|
| 4071 | + if (!$foundTarget) { |
|
| 4072 | + fatal_lang_error('no_access', false); |
|
| 4073 | + } |
|
| 3905 | 4074 | |
| 3906 | 4075 | // Final security check, don't allow users to promote themselves to admin. |
| 3907 | 4076 | if ($context['can_manage_membergroups'] && !allowedTo('admin_forum')) |
@@ -3921,8 +4090,9 @@ discard block |
||
| 3921 | 4090 | list ($disallow) = $smcFunc['db_fetch_row']($request); |
| 3922 | 4091 | $smcFunc['db_free_result']($request); |
| 3923 | 4092 | |
| 3924 | - if ($disallow) |
|
| 3925 | - isAllowedTo('admin_forum'); |
|
| 4093 | + if ($disallow) { |
|
| 4094 | + isAllowedTo('admin_forum'); |
|
| 4095 | + } |
|
| 3926 | 4096 | } |
| 3927 | 4097 | |
| 3928 | 4098 | // If we're requesting, add the note then return. |
@@ -3940,8 +4110,9 @@ discard block |
||
| 3940 | 4110 | 'status_open' => 0, |
| 3941 | 4111 | ) |
| 3942 | 4112 | ); |
| 3943 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 3944 | - fatal_lang_error('profile_error_already_requested_group'); |
|
| 4113 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 4114 | + fatal_lang_error('profile_error_already_requested_group'); |
|
| 4115 | + } |
|
| 3945 | 4116 | $smcFunc['db_free_result']($request); |
| 3946 | 4117 | |
| 3947 | 4118 | // Log the request. |
@@ -3975,10 +4146,11 @@ discard block |
||
| 3975 | 4146 | // Are we leaving? |
| 3976 | 4147 | if ($old_profile['id_group'] == $group_id || isset($addGroups[$group_id])) |
| 3977 | 4148 | { |
| 3978 | - if ($old_profile['id_group'] == $group_id) |
|
| 3979 | - $newPrimary = 0; |
|
| 3980 | - else |
|
| 3981 | - unset($addGroups[$group_id]); |
|
| 4149 | + if ($old_profile['id_group'] == $group_id) { |
|
| 4150 | + $newPrimary = 0; |
|
| 4151 | + } else { |
|
| 4152 | + unset($addGroups[$group_id]); |
|
| 4153 | + } |
|
| 3982 | 4154 | } |
| 3983 | 4155 | // ... if not, must be joining. |
| 3984 | 4156 | else |
@@ -3986,36 +4158,42 @@ discard block |
||
| 3986 | 4158 | // Can we change the primary, and do we want to? |
| 3987 | 4159 | if ($canChangePrimary) |
| 3988 | 4160 | { |
| 3989 | - if ($old_profile['id_group'] != 0) |
|
| 3990 | - $addGroups[$old_profile['id_group']] = -1; |
|
| 4161 | + if ($old_profile['id_group'] != 0) { |
|
| 4162 | + $addGroups[$old_profile['id_group']] = -1; |
|
| 4163 | + } |
|
| 3991 | 4164 | $newPrimary = $group_id; |
| 3992 | 4165 | } |
| 3993 | 4166 | // Otherwise it's an additional group... |
| 3994 | - else |
|
| 3995 | - $addGroups[$group_id] = -1; |
|
| 4167 | + else { |
|
| 4168 | + $addGroups[$group_id] = -1; |
|
| 4169 | + } |
|
| 3996 | 4170 | } |
| 3997 | 4171 | } |
| 3998 | 4172 | // Finally, we must be setting the primary. |
| 3999 | 4173 | elseif ($canChangePrimary) |
| 4000 | 4174 | { |
| 4001 | - if ($old_profile['id_group'] != 0) |
|
| 4002 | - $addGroups[$old_profile['id_group']] = -1; |
|
| 4003 | - if (isset($addGroups[$group_id])) |
|
| 4004 | - unset($addGroups[$group_id]); |
|
| 4175 | + if ($old_profile['id_group'] != 0) { |
|
| 4176 | + $addGroups[$old_profile['id_group']] = -1; |
|
| 4177 | + } |
|
| 4178 | + if (isset($addGroups[$group_id])) { |
|
| 4179 | + unset($addGroups[$group_id]); |
|
| 4180 | + } |
|
| 4005 | 4181 | $newPrimary = $group_id; |
| 4006 | 4182 | } |
| 4007 | 4183 | |
| 4008 | 4184 | // Finally, we can make the changes! |
| 4009 | - foreach ($addGroups as $id => $dummy) |
|
| 4010 | - if (empty($id)) |
|
| 4185 | + foreach ($addGroups as $id => $dummy) { |
|
| 4186 | + if (empty($id)) |
|
| 4011 | 4187 | unset($addGroups[$id]); |
| 4188 | + } |
|
| 4012 | 4189 | $addGroups = implode(',', array_flip($addGroups)); |
| 4013 | 4190 | |
| 4014 | 4191 | // Ensure that we don't cache permissions if the group is changing. |
| 4015 | - if ($context['user']['is_owner']) |
|
| 4016 | - $_SESSION['mc']['time'] = 0; |
|
| 4017 | - else |
|
| 4018 | - updateSettings(array('settings_updated' => time())); |
|
| 4192 | + if ($context['user']['is_owner']) { |
|
| 4193 | + $_SESSION['mc']['time'] = 0; |
|
| 4194 | + } else { |
|
| 4195 | + updateSettings(array('settings_updated' => time())); |
|
| 4196 | + } |
|
| 4019 | 4197 | |
| 4020 | 4198 | updateMemberData($memID, array('id_group' => $newPrimary, 'additional_groups' => $addGroups)); |
| 4021 | 4199 | |
@@ -4038,8 +4216,9 @@ discard block |
||
| 4038 | 4216 | if (empty($user_settings['tfa_secret']) && $context['user']['is_owner']) |
| 4039 | 4217 | { |
| 4040 | 4218 | // Check to ensure we're forcing SSL for authentication |
| 4041 | - if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) |
|
| 4042 | - fatal_lang_error('login_ssl_required'); |
|
| 4219 | + if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) { |
|
| 4220 | + fatal_lang_error('login_ssl_required'); |
|
| 4221 | + } |
|
| 4043 | 4222 | |
| 4044 | 4223 | // In some cases (forced 2FA or backup code) they would be forced to be redirected here, |
| 4045 | 4224 | // we do not want too much AJAX to confuse them. |
@@ -4076,8 +4255,7 @@ discard block |
||
| 4076 | 4255 | $context['sub_template'] = 'tfasetup_backup'; |
| 4077 | 4256 | |
| 4078 | 4257 | return; |
| 4079 | - } |
|
| 4080 | - else |
|
| 4258 | + } else |
|
| 4081 | 4259 | { |
| 4082 | 4260 | $context['tfa_secret'] = $_SESSION['tfa_secret']; |
| 4083 | 4261 | $context['tfa_error'] = !$valid_code; |
@@ -4085,8 +4263,7 @@ discard block |
||
| 4085 | 4263 | $context['tfa_pass_value'] = $_POST['passwd']; |
| 4086 | 4264 | $context['tfa_value'] = $_POST['tfa_code']; |
| 4087 | 4265 | } |
| 4088 | - } |
|
| 4089 | - else |
|
| 4266 | + } else |
|
| 4090 | 4267 | { |
| 4091 | 4268 | $totp = new \TOTP\Auth(); |
| 4092 | 4269 | $secret = $totp->generateCode(); |
@@ -4096,17 +4273,16 @@ discard block |
||
| 4096 | 4273 | } |
| 4097 | 4274 | |
| 4098 | 4275 | $context['tfa_qr_url'] = $totp->getQrCodeUrl($context['forum_name'] . ':' . $user_info['name'], $context['tfa_secret']); |
| 4099 | - } |
|
| 4100 | - elseif (isset($_REQUEST['disable'])) |
|
| 4276 | + } elseif (isset($_REQUEST['disable'])) |
|
| 4101 | 4277 | { |
| 4102 | 4278 | updateMemberData($memID, array( |
| 4103 | 4279 | 'tfa_secret' => '', |
| 4104 | 4280 | 'tfa_backup' => '', |
| 4105 | 4281 | )); |
| 4106 | 4282 | redirectexit('action=profile;area=account;u=' . $memID); |
| 4283 | + } else { |
|
| 4284 | + redirectexit('action=profile;area=account;u=' . $memID); |
|
| 4285 | + } |
|
| 4107 | 4286 | } |
| 4108 | - else |
|
| 4109 | - redirectexit('action=profile;area=account;u=' . $memID); |
|
| 4110 | -} |
|
| 4111 | 4287 | |
| 4112 | 4288 | ?> |
| 4113 | 4289 | \ No newline at end of file |