@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 4 |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('SMF')) |
|
14 | +if (!defined('SMF')) { |
|
15 | 15 | die('Hacking attempt...'); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * PostgreSQL Cache API class |
@@ -49,8 +50,9 @@ discard block |
||
49 | 50 | |
50 | 51 | $result = pg_execute($db_connection, '', array('public', $db_prefix . 'cache')); |
51 | 52 | |
52 | - if (pg_affected_rows($result) === 0) |
|
53 | - pg_query($db_connection, 'CREATE UNLOGGED TABLE ' . $db_prefix . 'cache (key text, value text, ttl bigint, PRIMARY KEY (key))'); |
|
53 | + if (pg_affected_rows($result) === 0) { |
|
54 | + pg_query($db_connection, 'CREATE UNLOGGED TABLE ' . $db_prefix . 'cache (key text, value text, ttl bigint, PRIMARY KEY (key))'); |
|
55 | + } |
|
54 | 56 | } |
55 | 57 | |
56 | 58 | /** |
@@ -60,14 +62,16 @@ discard block |
||
60 | 62 | { |
61 | 63 | global $smcFunc, $db_connection; |
62 | 64 | |
63 | - if ($smcFunc['db_title'] !== 'PostgreSQL') |
|
64 | - return false; |
|
65 | + if ($smcFunc['db_title'] !== 'PostgreSQL') { |
|
66 | + return false; |
|
67 | + } |
|
65 | 68 | |
66 | 69 | $result = pg_query($db_connection, 'SHOW server_version_num'); |
67 | 70 | $res = pg_fetch_assoc($result); |
68 | 71 | |
69 | - if ($res['server_version_num'] < 90500) |
|
70 | - return false; |
|
72 | + if ($res['server_version_num'] < 90500) { |
|
73 | + return false; |
|
74 | + } |
|
71 | 75 | |
72 | 76 | return $test ? true : parent::isSupported(); |
73 | 77 | } |
@@ -81,13 +85,15 @@ discard block |
||
81 | 85 | |
82 | 86 | $ttl = time() - $ttl; |
83 | 87 | |
84 | - if (empty($this->pg_get_data_prep)) |
|
85 | - $this->pg_get_data_prep = pg_prepare($db_connection, 'smf_cache_get_data', 'SELECT value FROM ' . $db_prefix . 'cache WHERE key = $1 AND ttl >= $2 LIMIT 1'); |
|
88 | + if (empty($this->pg_get_data_prep)) { |
|
89 | + $this->pg_get_data_prep = pg_prepare($db_connection, 'smf_cache_get_data', 'SELECT value FROM ' . $db_prefix . 'cache WHERE key = $1 AND ttl >= $2 LIMIT 1'); |
|
90 | + } |
|
86 | 91 | |
87 | 92 | $result = pg_execute($db_connection, 'smf_cache_get_data', array($key, $ttl)); |
88 | 93 | |
89 | - if (pg_affected_rows($result) === 0) |
|
90 | - return null; |
|
94 | + if (pg_affected_rows($result) === 0) { |
|
95 | + return null; |
|
96 | + } |
|
91 | 97 | |
92 | 98 | $res = pg_fetch_assoc($result); |
93 | 99 | |
@@ -101,23 +107,26 @@ discard block |
||
101 | 107 | { |
102 | 108 | global $db_prefix, $db_connection; |
103 | 109 | |
104 | - if (!isset($value)) |
|
105 | - $value = ''; |
|
110 | + if (!isset($value)) { |
|
111 | + $value = ''; |
|
112 | + } |
|
106 | 113 | |
107 | 114 | $ttl = time() + $ttl; |
108 | 115 | |
109 | - if (empty($this->pg_put_data_prep)) |
|
110 | - $this->pg_put_data_prep = pg_prepare($db_connection, 'smf_cache_put_data', |
|
116 | + if (empty($this->pg_put_data_prep)) { |
|
117 | + $this->pg_put_data_prep = pg_prepare($db_connection, 'smf_cache_put_data', |
|
111 | 118 | 'INSERT INTO ' . $db_prefix . 'cache(key,value,ttl) VALUES($1,$2,$3) |
112 | 119 | ON CONFLICT(key) DO UPDATE SET value = excluded.value, ttl = excluded.ttl' |
113 | 120 | ); |
121 | + } |
|
114 | 122 | |
115 | 123 | $result = pg_execute($db_connection, 'smf_cache_put_data', array($key, $value, $ttl)); |
116 | 124 | |
117 | - if (pg_affected_rows($result) > 0) |
|
118 | - return true; |
|
119 | - else |
|
120 | - return false; |
|
125 | + if (pg_affected_rows($result) > 0) { |
|
126 | + return true; |
|
127 | + } else { |
|
128 | + return false; |
|
129 | + } |
|
121 | 130 | } |
122 | 131 | |
123 | 132 | /** |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 4 |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('SMF')) |
|
14 | +if (!defined('SMF')) { |
|
15 | 15 | die('Hacking attempt...'); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * SQLite Cache API class |
@@ -68,8 +69,9 @@ discard block |
||
68 | 69 | { |
69 | 70 | $supported = class_exists("SQLite3") && is_writable($this->cachedir); |
70 | 71 | |
71 | - if ($test) |
|
72 | - return $supported; |
|
72 | + if ($test) { |
|
73 | + return $supported; |
|
74 | + } |
|
73 | 75 | |
74 | 76 | return parent::isSupported() && $supported; |
75 | 77 | } |
@@ -84,8 +86,9 @@ discard block |
||
84 | 86 | $result = $this->cacheDB->query($query); |
85 | 87 | |
86 | 88 | $value = null; |
87 | - while ($res = $result->fetchArray(SQLITE3_ASSOC)) |
|
88 | - $value = $res['value']; |
|
89 | + while ($res = $result->fetchArray(SQLITE3_ASSOC)) { |
|
90 | + $value = $res['value']; |
|
91 | + } |
|
89 | 92 | |
90 | 93 | return !empty($value) ? $value : null; |
91 | 94 | } |
@@ -108,10 +111,11 @@ discard block |
||
108 | 111 | */ |
109 | 112 | public function cleanCache($type = '') |
110 | 113 | { |
111 | - if($type == 'expired') |
|
112 | - $query = 'DELETE FROM cache WHERE ttl >= ' . time().';'; |
|
113 | - else |
|
114 | - $query = 'DELETE FROM cache;'; |
|
114 | + if($type == 'expired') { |
|
115 | + $query = 'DELETE FROM cache WHERE ttl >= ' . time().';'; |
|
116 | + } else { |
|
117 | + $query = 'DELETE FROM cache;'; |
|
118 | + } |
|
115 | 119 | |
116 | 120 | $result = $this->cacheDB->exec($query); |
117 | 121 | |
@@ -131,8 +135,9 @@ discard block |
||
131 | 135 | $config_vars[] = $txt['cache_sqlite_settings']; |
132 | 136 | $config_vars[] = array('cachedir_sqlite', $txt['cachedir_sqlite'], 'file', 'text', 36, 'cache_sqlite_cachedir'); |
133 | 137 | |
134 | - if (!isset($context['settings_post_javascript'])) |
|
135 | - $context['settings_post_javascript'] = ''; |
|
138 | + if (!isset($context['settings_post_javascript'])) { |
|
139 | + $context['settings_post_javascript'] = ''; |
|
140 | + } |
|
136 | 141 | |
137 | 142 | $context['settings_post_javascript'] .= ' |
138 | 143 | $("#cache_accelerator").change(function (e) { |
@@ -155,13 +160,15 @@ discard block |
||
155 | 160 | global $cachedir, $cachedir_sqlite; |
156 | 161 | |
157 | 162 | // If its invalid, use SMF's. |
158 | - if (is_null($dir) || !is_writable($dir)) |
|
159 | - if(is_null($cachedir_sqlite) || !is_writable($cachedir_sqlite)) |
|
163 | + if (is_null($dir) || !is_writable($dir)) { |
|
164 | + if(is_null($cachedir_sqlite) || !is_writable($cachedir_sqlite)) |
|
160 | 165 | $this->cachedir = $cachedir; |
161 | - else |
|
162 | - $this->cachedir = $cachedir_sqlite; |
|
163 | - else |
|
164 | - $this->cachedir = $dir; |
|
166 | + } else { |
|
167 | + $this->cachedir = $cachedir_sqlite; |
|
168 | + } |
|
169 | + else { |
|
170 | + $this->cachedir = $dir; |
|
171 | + } |
|
165 | 172 | } |
166 | 173 | |
167 | 174 | /** |
@@ -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 | * Activate an account. |
@@ -48,8 +49,9 @@ discard block |
||
48 | 49 | logAction('approve_member', array('member' => $memID), 'admin'); |
49 | 50 | |
50 | 51 | // If we are doing approval, update the stats for the member just in case. |
51 | - if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 5, 13, 14, 15))) |
|
52 | - updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0))); |
|
52 | + if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 5, 13, 14, 15))) { |
|
53 | + updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0))); |
|
54 | + } |
|
53 | 55 | |
54 | 56 | // Make sure we update the stats too. |
55 | 57 | updateStats('member', false); |
@@ -76,8 +78,9 @@ discard block |
||
76 | 78 | $issueErrors = array(); |
77 | 79 | |
78 | 80 | // Doesn't hurt to be overly cautious. |
79 | - if (empty($modSettings['warning_enable']) || ($context['user']['is_owner'] && !$cur_profile['warning']) || !allowedTo('issue_warning')) |
|
80 | - fatal_lang_error('no_access', false); |
|
81 | + if (empty($modSettings['warning_enable']) || ($context['user']['is_owner'] && !$cur_profile['warning']) || !allowedTo('issue_warning')) { |
|
82 | + fatal_lang_error('no_access', false); |
|
83 | + } |
|
81 | 84 | |
82 | 85 | // Get the base (errors related) stuff done. |
83 | 86 | loadLanguage('Errors'); |
@@ -135,16 +138,18 @@ discard block |
||
135 | 138 | |
136 | 139 | // This cannot be empty! |
137 | 140 | $_POST['warn_reason'] = isset($_POST['warn_reason']) ? trim($_POST['warn_reason']) : ''; |
138 | - if ($_POST['warn_reason'] == '' && !$context['user']['is_owner']) |
|
139 | - $issueErrors[] = 'warning_no_reason'; |
|
141 | + if ($_POST['warn_reason'] == '' && !$context['user']['is_owner']) { |
|
142 | + $issueErrors[] = 'warning_no_reason'; |
|
143 | + } |
|
140 | 144 | $_POST['warn_reason'] = $smcFunc['htmlspecialchars']($_POST['warn_reason']); |
141 | 145 | |
142 | 146 | $_POST['warning_level'] = (int) $_POST['warning_level']; |
143 | 147 | $_POST['warning_level'] = max(0, min(100, $_POST['warning_level'])); |
144 | - if ($_POST['warning_level'] < $context['min_allowed']) |
|
145 | - $_POST['warning_level'] = $context['min_allowed']; |
|
146 | - elseif ($_POST['warning_level'] > $context['max_allowed']) |
|
147 | - $_POST['warning_level'] = $context['max_allowed']; |
|
148 | + if ($_POST['warning_level'] < $context['min_allowed']) { |
|
149 | + $_POST['warning_level'] = $context['min_allowed']; |
|
150 | + } elseif ($_POST['warning_level'] > $context['max_allowed']) { |
|
151 | + $_POST['warning_level'] = $context['max_allowed']; |
|
152 | + } |
|
148 | 153 | |
149 | 154 | // Do we actually have to issue them with a PM? |
150 | 155 | $id_notice = 0; |
@@ -152,8 +157,9 @@ discard block |
||
152 | 157 | { |
153 | 158 | $_POST['warn_sub'] = trim($_POST['warn_sub']); |
154 | 159 | $_POST['warn_body'] = trim($_POST['warn_body']); |
155 | - if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) |
|
156 | - $issueErrors[] = 'warning_notify_blank'; |
|
160 | + if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) { |
|
161 | + $issueErrors[] = 'warning_notify_blank'; |
|
162 | + } |
|
157 | 163 | // Send the PM? |
158 | 164 | else |
159 | 165 | { |
@@ -190,8 +196,8 @@ discard block |
||
190 | 196 | if (empty($issueErrors)) |
191 | 197 | { |
192 | 198 | // Log what we've done! |
193 | - if (!$context['user']['is_owner']) |
|
194 | - $smcFunc['db_insert']('', |
|
199 | + if (!$context['user']['is_owner']) { |
|
200 | + $smcFunc['db_insert']('', |
|
195 | 201 | '{db_prefix}log_comments', |
196 | 202 | array( |
197 | 203 | 'id_member' => 'int', 'member_name' => 'string', 'comment_type' => 'string', 'id_recipient' => 'int', 'recipient_name' => 'string-255', |
@@ -203,14 +209,14 @@ discard block |
||
203 | 209 | ), |
204 | 210 | array('id_comment') |
205 | 211 | ); |
212 | + } |
|
206 | 213 | |
207 | 214 | // Make the change. |
208 | 215 | updateMemberData($memID, array('warning' => $_POST['warning_level'])); |
209 | 216 | |
210 | 217 | // Leave a lovely message. |
211 | 218 | $context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : $txt['profile_warning_success']; |
212 | - } |
|
213 | - else |
|
219 | + } else |
|
214 | 220 | { |
215 | 221 | // Try to remember some bits. |
216 | 222 | $context['warning_data'] = array( |
@@ -229,8 +235,9 @@ discard block |
||
229 | 235 | { |
230 | 236 | $warning_body = !empty($_POST['warn_body']) ? trim(censorText($_POST['warn_body'])) : ''; |
231 | 237 | $context['preview_subject'] = !empty($_POST['warn_sub']) ? trim($smcFunc['htmlspecialchars']($_POST['warn_sub'])) : ''; |
232 | - if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) |
|
233 | - $issueErrors[] = 'warning_notify_blank'; |
|
238 | + if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) { |
|
239 | + $issueErrors[] = 'warning_notify_blank'; |
|
240 | + } |
|
234 | 241 | |
235 | 242 | if (!empty($_POST['warn_body'])) |
236 | 243 | { |
@@ -254,8 +261,9 @@ discard block |
||
254 | 261 | { |
255 | 262 | // Fill in the suite of errors. |
256 | 263 | $context['post_errors'] = array(); |
257 | - foreach ($issueErrors as $error) |
|
258 | - $context['post_errors'][] = $txt[$error]; |
|
264 | + foreach ($issueErrors as $error) { |
|
265 | + $context['post_errors'][] = $txt[$error]; |
|
266 | + } |
|
259 | 267 | } |
260 | 268 | |
261 | 269 | |
@@ -272,9 +280,10 @@ discard block |
||
272 | 280 | $modSettings['warning_mute'] => $txt['profile_warning_effect_mute'], |
273 | 281 | ); |
274 | 282 | $context['current_level'] = 0; |
275 | - foreach ($context['level_effects'] as $limit => $dummy) |
|
276 | - if ($context['member']['warning'] >= $limit) |
|
283 | + foreach ($context['level_effects'] as $limit => $dummy) { |
|
284 | + if ($context['member']['warning'] >= $limit) |
|
277 | 285 | $context['current_level'] = $limit; |
286 | + } |
|
278 | 287 | |
279 | 288 | $listOptions = array( |
280 | 289 | 'id' => 'view_warnings', |
@@ -337,11 +346,12 @@ discard block |
||
337 | 346 | ' . $warning['reason'] . ' |
338 | 347 | </div>'; |
339 | 348 | |
340 | - if (!empty($warning['id_notice'])) |
|
341 | - $ret .= ' |
|
349 | + if (!empty($warning['id_notice'])) { |
|
350 | + $ret .= ' |
|
342 | 351 | <div class="floatright"> |
343 | 352 | <a href="' . $scripturl . '?action=moderate;area=notice;nid=' . $warning['id_notice'] . '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" rel="noopener" title="' . $txt['profile_warning_previous_notice'] . '"><span class="generic_icons filter centericon"></span></a> |
344 | 353 | </div>'; |
354 | + } |
|
345 | 355 | |
346 | 356 | return $ret; |
347 | 357 | }, |
@@ -413,8 +423,9 @@ discard block |
||
413 | 423 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
414 | 424 | { |
415 | 425 | // If we're not warning for a message skip any that are. |
416 | - if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false) |
|
417 | - continue; |
|
426 | + if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false) { |
|
427 | + continue; |
|
428 | + } |
|
418 | 429 | |
419 | 430 | $context['notification_templates'][] = array( |
420 | 431 | 'title' => $row['template_title'], |
@@ -424,16 +435,18 @@ discard block |
||
424 | 435 | $smcFunc['db_free_result']($request); |
425 | 436 | |
426 | 437 | // Setup the "default" templates. |
427 | - foreach (array('spamming', 'offence', 'insulting') as $type) |
|
428 | - $context['notification_templates'][] = array( |
|
438 | + foreach (array('spamming', 'offence', 'insulting') as $type) { |
|
439 | + $context['notification_templates'][] = array( |
|
429 | 440 | 'title' => $txt['profile_warning_notify_title_' . $type], |
430 | 441 | 'body' => sprintf($txt['profile_warning_notify_template_outline' . (!empty($context['warning_for_message']) ? '_post' : '')], $txt['profile_warning_notify_for_' . $type]), |
431 | 442 | ); |
443 | + } |
|
432 | 444 | |
433 | 445 | // Replace all the common variables in the templates. |
434 | - foreach ($context['notification_templates'] as $k => $name) |
|
435 | - $context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team'])); |
|
436 | -} |
|
446 | + foreach ($context['notification_templates'] as $k => $name) { |
|
447 | + $context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team'])); |
|
448 | + } |
|
449 | + } |
|
437 | 450 | |
438 | 451 | /** |
439 | 452 | * Get the number of warnings a user has. Callback for $listOptions['get_count'] in issueWarning() |
@@ -517,10 +530,11 @@ discard block |
||
517 | 530 | { |
518 | 531 | global $txt, $context, $modSettings, $cur_profile; |
519 | 532 | |
520 | - if (!$context['user']['is_owner']) |
|
521 | - isAllowedTo('profile_remove_any'); |
|
522 | - elseif (!allowedTo('profile_remove_any')) |
|
523 | - isAllowedTo('profile_remove_own'); |
|
533 | + if (!$context['user']['is_owner']) { |
|
534 | + isAllowedTo('profile_remove_any'); |
|
535 | + } elseif (!allowedTo('profile_remove_any')) { |
|
536 | + isAllowedTo('profile_remove_own'); |
|
537 | + } |
|
524 | 538 | |
525 | 539 | // Permissions for removing stuff... |
526 | 540 | $context['can_delete_posts'] = !$context['user']['is_owner'] && allowedTo('moderate_forum'); |
@@ -547,10 +561,11 @@ discard block |
||
547 | 561 | |
548 | 562 | // @todo Add a way to delete pms as well? |
549 | 563 | |
550 | - if (!$context['user']['is_owner']) |
|
551 | - isAllowedTo('profile_remove_any'); |
|
552 | - elseif (!allowedTo('profile_remove_any')) |
|
553 | - isAllowedTo('profile_remove_own'); |
|
564 | + if (!$context['user']['is_owner']) { |
|
565 | + isAllowedTo('profile_remove_any'); |
|
566 | + } elseif (!allowedTo('profile_remove_any')) { |
|
567 | + isAllowedTo('profile_remove_own'); |
|
568 | + } |
|
554 | 569 | |
555 | 570 | checkSession(); |
556 | 571 | |
@@ -576,8 +591,9 @@ discard block |
||
576 | 591 | list ($another) = $smcFunc['db_fetch_row']($request); |
577 | 592 | $smcFunc['db_free_result']($request); |
578 | 593 | |
579 | - if (empty($another)) |
|
580 | - fatal_lang_error('at_least_one_admin', 'critical'); |
|
594 | + if (empty($another)) { |
|
595 | + fatal_lang_error('at_least_one_admin', 'critical'); |
|
596 | + } |
|
581 | 597 | } |
582 | 598 | |
583 | 599 | // This file is needed for the deleteMembers function. |
@@ -656,8 +672,9 @@ discard block |
||
656 | 672 | ) |
657 | 673 | ); |
658 | 674 | $topicIDs = array(); |
659 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
660 | - $topicIDs[] = $row['id_topic']; |
|
675 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
676 | + $topicIDs[] = $row['id_topic']; |
|
677 | + } |
|
661 | 678 | $smcFunc['db_free_result']($request); |
662 | 679 | |
663 | 680 | // Actually remove the topics. Ignore recycling if we want to perma-delete things... |
@@ -680,8 +697,9 @@ discard block |
||
680 | 697 | // This could take a while... but ya know it's gonna be worth it in the end. |
681 | 698 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
682 | 699 | { |
683 | - if (function_exists('apache_reset_timeout')) |
|
684 | - @apache_reset_timeout(); |
|
700 | + if (function_exists('apache_reset_timeout')) { |
|
701 | + @apache_reset_timeout(); |
|
702 | + } |
|
685 | 703 | |
686 | 704 | removeMessage($row['id_msg']); |
687 | 705 | } |
@@ -689,8 +707,9 @@ discard block |
||
689 | 707 | } |
690 | 708 | |
691 | 709 | // Only delete this poor members account if they are actually being booted out of camp. |
692 | - if (isset($_POST['deleteAccount'])) |
|
693 | - deleteMembers($memID); |
|
710 | + if (isset($_POST['deleteAccount'])) { |
|
711 | + deleteMembers($memID); |
|
712 | + } |
|
694 | 713 | } |
695 | 714 | // Do they need approval to delete? |
696 | 715 | elseif (!empty($modSettings['approveAccountDeletion']) && !allowedTo('moderate_forum')) |
@@ -741,18 +760,18 @@ discard block |
||
741 | 760 | { |
742 | 761 | foreach ($costs as $duration => $cost) |
743 | 762 | { |
744 | - if ($cost != 0) |
|
745 | - $cost_array[$duration] = $cost; |
|
763 | + if ($cost != 0) { |
|
764 | + $cost_array[$duration] = $cost; |
|
765 | + } |
|
746 | 766 | } |
747 | - } |
|
748 | - else |
|
767 | + } else |
|
749 | 768 | { |
750 | 769 | $cost_array['fixed'] = $costs['fixed']; |
751 | 770 | } |
752 | 771 | |
753 | - if (empty($cost_array)) |
|
754 | - unset($context['subscriptions'][$id]); |
|
755 | - else |
|
772 | + if (empty($cost_array)) { |
|
773 | + unset($context['subscriptions'][$id]); |
|
774 | + } else |
|
756 | 775 | { |
757 | 776 | $context['subscriptions'][$id]['member'] = 0; |
758 | 777 | $context['subscriptions'][$id]['subscribed'] = false; |
@@ -765,13 +784,15 @@ discard block |
||
765 | 784 | foreach ($gateways as $id => $gateway) |
766 | 785 | { |
767 | 786 | $gateways[$id] = new $gateway['display_class'](); |
768 | - if (!$gateways[$id]->gatewayEnabled()) |
|
769 | - unset($gateways[$id]); |
|
787 | + if (!$gateways[$id]->gatewayEnabled()) { |
|
788 | + unset($gateways[$id]); |
|
789 | + } |
|
770 | 790 | } |
771 | 791 | |
772 | 792 | // No gateways yet? |
773 | - if (empty($gateways)) |
|
774 | - fatal_error($txt['paid_admin_not_setup_gateway']); |
|
793 | + if (empty($gateways)) { |
|
794 | + fatal_error($txt['paid_admin_not_setup_gateway']); |
|
795 | + } |
|
775 | 796 | |
776 | 797 | // Get the current subscriptions. |
777 | 798 | $request = $smcFunc['db_query']('', ' |
@@ -786,8 +807,9 @@ discard block |
||
786 | 807 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
787 | 808 | { |
788 | 809 | // The subscription must exist! |
789 | - if (!isset($context['subscriptions'][$row['id_subscribe']])) |
|
790 | - continue; |
|
810 | + if (!isset($context['subscriptions'][$row['id_subscribe']])) { |
|
811 | + continue; |
|
812 | + } |
|
791 | 813 | |
792 | 814 | $context['current'][$row['id_subscribe']] = array( |
793 | 815 | 'id' => $row['id_sublog'], |
@@ -801,8 +823,9 @@ discard block |
||
801 | 823 | 'status_text' => $row['status'] == 0 ? ($row['payments_pending'] ? $txt['paid_pending'] : $txt['paid_finished']) : $txt['paid_active'], |
802 | 824 | ); |
803 | 825 | |
804 | - if ($row['status'] == 1) |
|
805 | - $context['subscriptions'][$row['id_subscribe']]['subscribed'] = true; |
|
826 | + if ($row['status'] == 1) { |
|
827 | + $context['subscriptions'][$row['id_subscribe']]['subscribed'] = true; |
|
828 | + } |
|
806 | 829 | } |
807 | 830 | $smcFunc['db_free_result']($request); |
808 | 831 | |
@@ -853,21 +876,25 @@ discard block |
||
853 | 876 | if (isset($_GET['confirm']) && isset($_POST['sub_id']) && is_array($_POST['sub_id'])) |
854 | 877 | { |
855 | 878 | // Hopefully just one. |
856 | - foreach ($_POST['sub_id'] as $k => $v) |
|
857 | - $ID_SUB = (int) $k; |
|
879 | + foreach ($_POST['sub_id'] as $k => $v) { |
|
880 | + $ID_SUB = (int) $k; |
|
881 | + } |
|
858 | 882 | |
859 | - if (!isset($context['subscriptions'][$ID_SUB]) || $context['subscriptions'][$ID_SUB]['active'] == 0) |
|
860 | - fatal_lang_error('paid_sub_not_active'); |
|
883 | + if (!isset($context['subscriptions'][$ID_SUB]) || $context['subscriptions'][$ID_SUB]['active'] == 0) { |
|
884 | + fatal_lang_error('paid_sub_not_active'); |
|
885 | + } |
|
861 | 886 | |
862 | 887 | // Simplify... |
863 | 888 | $context['sub'] = $context['subscriptions'][$ID_SUB]; |
864 | 889 | $period = 'xx'; |
865 | - if ($context['sub']['flexible']) |
|
866 | - $period = isset($_POST['cur'][$ID_SUB]) && isset($context['sub']['costs'][$_POST['cur'][$ID_SUB]]) ? $_POST['cur'][$ID_SUB] : 'xx'; |
|
890 | + if ($context['sub']['flexible']) { |
|
891 | + $period = isset($_POST['cur'][$ID_SUB]) && isset($context['sub']['costs'][$_POST['cur'][$ID_SUB]]) ? $_POST['cur'][$ID_SUB] : 'xx'; |
|
892 | + } |
|
867 | 893 | |
868 | 894 | // Check we have a valid cost. |
869 | - if ($context['sub']['flexible'] && $period == 'xx') |
|
870 | - fatal_lang_error('paid_sub_not_active'); |
|
895 | + if ($context['sub']['flexible'] && $period == 'xx') { |
|
896 | + fatal_lang_error('paid_sub_not_active'); |
|
897 | + } |
|
871 | 898 | |
872 | 899 | // Sort out the cost/currency. |
873 | 900 | $context['currency'] = $modSettings['paid_currency_code']; |
@@ -880,8 +907,7 @@ discard block |
||
880 | 907 | $context['cost'] = sprintf($modSettings['paid_currency_symbol'], $context['value']) . '/' . $txt[$_POST['cur'][$ID_SUB]]; |
881 | 908 | // The period value for paypal. |
882 | 909 | $context['paypal_period'] = strtoupper(substr($_POST['cur'][$ID_SUB], 0, 1)); |
883 | - } |
|
884 | - else |
|
910 | + } else |
|
885 | 911 | { |
886 | 912 | // Real cost... |
887 | 913 | $context['value'] = $context['sub']['costs']['fixed']; |
@@ -898,13 +924,15 @@ discard block |
||
898 | 924 | foreach ($gateways as $id => $gateway) |
899 | 925 | { |
900 | 926 | $fields = $gateways[$id]->fetchGatewayFields($context['sub']['id'] . '+' . $memID, $context['sub'], $context['value'], $period, $scripturl . '?action=profile;u=' . $memID . ';area=subscriptions;sub_id=' . $context['sub']['id'] . ';done'); |
901 | - if (!empty($fields['form'])) |
|
902 | - $context['gateways'][] = $fields; |
|
927 | + if (!empty($fields['form'])) { |
|
928 | + $context['gateways'][] = $fields; |
|
929 | + } |
|
903 | 930 | } |
904 | 931 | |
905 | 932 | // Bugger?! |
906 | - if (empty($context['gateways'])) |
|
907 | - fatal_error($txt['paid_admin_not_setup_gateway']); |
|
933 | + if (empty($context['gateways'])) { |
|
934 | + fatal_error($txt['paid_admin_not_setup_gateway']); |
|
935 | + } |
|
908 | 936 | |
909 | 937 | // Now we are going to assume they want to take this out ;) |
910 | 938 | $new_data = array($context['sub']['id'], $context['value'], $period, 'prepay'); |
@@ -912,16 +940,19 @@ discard block |
||
912 | 940 | { |
913 | 941 | // What are the details like? |
914 | 942 | $current_pending = array(); |
915 | - if ($context['current'][$context['sub']['id']]['pending_details'] != '') |
|
916 | - $current_pending = $smcFunc['json_decode']($context['current'][$context['sub']['id']]['pending_details'], true); |
|
943 | + if ($context['current'][$context['sub']['id']]['pending_details'] != '') { |
|
944 | + $current_pending = $smcFunc['json_decode']($context['current'][$context['sub']['id']]['pending_details'], true); |
|
945 | + } |
|
917 | 946 | // Don't get silly. |
918 | - if (count($current_pending) > 9) |
|
919 | - $current_pending = array(); |
|
947 | + if (count($current_pending) > 9) { |
|
948 | + $current_pending = array(); |
|
949 | + } |
|
920 | 950 | $pending_count = 0; |
921 | 951 | // Only record real pending payments as will otherwise confuse the admin! |
922 | - foreach ($current_pending as $pending) |
|
923 | - if ($pending[3] == 'payback') |
|
952 | + foreach ($current_pending as $pending) { |
|
953 | + if ($pending[3] == 'payback') |
|
924 | 954 | $pending_count++; |
955 | + } |
|
925 | 956 | |
926 | 957 | if (!in_array($new_data, $current_pending)) |
927 | 958 | { |
@@ -966,9 +997,9 @@ discard block |
||
966 | 997 | |
967 | 998 | // Quit. |
968 | 999 | return; |
1000 | + } else { |
|
1001 | + $context['sub_template'] = 'user_subscription'; |
|
1002 | + } |
|
969 | 1003 | } |
970 | - else |
|
971 | - $context['sub_template'] = 'user_subscription'; |
|
972 | -} |
|
973 | 1004 | |
974 | 1005 | ?> |
975 | 1006 | \ 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 | /** |
20 | 21 | * Entry point for the moderation center. |
@@ -26,8 +27,9 @@ discard block |
||
26 | 27 | global $smcFunc, $txt, $context, $scripturl, $modSettings, $user_info, $sourcedir, $options; |
27 | 28 | |
28 | 29 | // Don't run this twice... and don't conflict with the admin bar. |
29 | - if (isset($context['admin_area'])) |
|
30 | - return; |
|
30 | + if (isset($context['admin_area'])) { |
|
31 | + return; |
|
32 | + } |
|
31 | 33 | |
32 | 34 | $context['can_moderate_boards'] = $user_info['mod_cache']['bq'] != '0=1'; |
33 | 35 | $context['can_moderate_groups'] = $user_info['mod_cache']['gq'] != '0=1'; |
@@ -35,8 +37,9 @@ discard block |
||
35 | 37 | $context['can_moderate_users'] = allowedTo('moderate_forum'); |
36 | 38 | |
37 | 39 | // Everyone using this area must be allowed here! |
38 | - if (!$context['can_moderate_boards'] && !$context['can_moderate_groups'] && !$context['can_moderate_approvals'] && !$context['can_moderate_users']) |
|
39 | - isAllowedTo('access_mod_center'); |
|
40 | + if (!$context['can_moderate_boards'] && !$context['can_moderate_groups'] && !$context['can_moderate_approvals'] && !$context['can_moderate_users']) { |
|
41 | + isAllowedTo('access_mod_center'); |
|
42 | + } |
|
40 | 43 | |
41 | 44 | // We're gonna want a menu of some kind. |
42 | 45 | require_once($sourcedir . '/Subs-Menu.php'); |
@@ -195,8 +198,9 @@ discard block |
||
195 | 198 | unset($moderation_areas); |
196 | 199 | |
197 | 200 | // We got something - didn't we? DIDN'T WE! |
198 | - if ($mod_include_data == false) |
|
199 | - fatal_lang_error('no_access', false); |
|
201 | + if ($mod_include_data == false) { |
|
202 | + fatal_lang_error('no_access', false); |
|
203 | + } |
|
200 | 204 | |
201 | 205 | // Retain the ID information in case required by a subaction. |
202 | 206 | $context['moderation_menu_id'] = $context['max_menu_id']; |
@@ -219,22 +223,25 @@ discard block |
||
219 | 223 | 'url' => $scripturl . '?action=moderate', |
220 | 224 | 'name' => $txt['moderation_center'], |
221 | 225 | ); |
222 | - if (isset($mod_include_data['current_area']) && $mod_include_data['current_area'] != 'index') |
|
223 | - $context['linktree'][] = array( |
|
226 | + if (isset($mod_include_data['current_area']) && $mod_include_data['current_area'] != 'index') { |
|
227 | + $context['linktree'][] = array( |
|
224 | 228 | 'url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'], |
225 | 229 | 'name' => $mod_include_data['label'], |
226 | 230 | ); |
227 | - if (!empty($mod_include_data['current_subsection']) && $mod_include_data['subsections'][$mod_include_data['current_subsection']][0] != $mod_include_data['label']) |
|
228 | - $context['linktree'][] = array( |
|
231 | + } |
|
232 | + if (!empty($mod_include_data['current_subsection']) && $mod_include_data['subsections'][$mod_include_data['current_subsection']][0] != $mod_include_data['label']) { |
|
233 | + $context['linktree'][] = array( |
|
229 | 234 | 'url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'] . ';sa=' . $mod_include_data['current_subsection'], |
230 | 235 | 'name' => $mod_include_data['subsections'][$mod_include_data['current_subsection']][0], |
231 | 236 | ); |
237 | + } |
|
232 | 238 | |
233 | 239 | // Now - finally - the bit before the encore - the main performance of course! |
234 | 240 | if (!$dont_call) |
235 | 241 | { |
236 | - if (isset($mod_include_data['file'])) |
|
237 | - require_once($sourcedir . '/' . $mod_include_data['file']); |
|
242 | + if (isset($mod_include_data['file'])) { |
|
243 | + require_once($sourcedir . '/' . $mod_include_data['file']); |
|
244 | + } |
|
238 | 245 | |
239 | 246 | call_helper($mod_include_data['function']); |
240 | 247 | } |
@@ -259,8 +266,9 @@ discard block |
||
259 | 266 | // Load what blocks the user actually can see... |
260 | 267 | $valid_blocks = array(); |
261 | 268 | |
262 | - if ($context['can_moderate_groups']) |
|
263 | - $valid_blocks['g'] = 'GroupRequests'; |
|
269 | + if ($context['can_moderate_groups']) { |
|
270 | + $valid_blocks['g'] = 'GroupRequests'; |
|
271 | + } |
|
264 | 272 | if ($context['can_moderate_boards']) |
265 | 273 | { |
266 | 274 | $valid_blocks['r'] = 'ReportedPosts'; |
@@ -269,8 +277,9 @@ discard block |
||
269 | 277 | if ($context['can_moderate_users']) |
270 | 278 | { |
271 | 279 | // This falls under the category of moderating users as well... |
272 | - if (!$context['can_moderate_boards']) |
|
273 | - $valid_blocks['w'] = 'WatchedUsers'; |
|
280 | + if (!$context['can_moderate_boards']) { |
|
281 | + $valid_blocks['w'] = 'WatchedUsers'; |
|
282 | + } |
|
274 | 283 | |
275 | 284 | $valid_blocks['rm'] = 'ReportedMembers'; |
276 | 285 | } |
@@ -281,8 +290,9 @@ discard block |
||
281 | 290 | foreach ($valid_blocks as $k => $block) |
282 | 291 | { |
283 | 292 | $block = 'ModBlock' . $block; |
284 | - if (function_exists($block)) |
|
285 | - $context['mod_blocks'][] = $block(); |
|
293 | + if (function_exists($block)) { |
|
294 | + $context['mod_blocks'][] = $block(); |
|
295 | + } |
|
286 | 296 | } |
287 | 297 | |
288 | 298 | $context['admin_prefs'] = !empty($options['admin_preferences']) ? $smcFunc['json_decode']($options['admin_preferences'], true) : array(); |
@@ -309,8 +319,9 @@ discard block |
||
309 | 319 | ) |
310 | 320 | ); |
311 | 321 | $watched_users = array(); |
312 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
313 | - $watched_users[] = $row; |
|
322 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
323 | + $watched_users[] = $row; |
|
324 | + } |
|
314 | 325 | $smcFunc['db_free_result']($request); |
315 | 326 | |
316 | 327 | cache_put_data('recent_user_watches', $watched_users, 240); |
@@ -402,8 +413,9 @@ discard block |
||
402 | 413 | $note_owner = $smcFunc['db_num_rows']($get_owner); |
403 | 414 | $smcFunc['db_free_result']($get_owner); |
404 | 415 | |
405 | - if (empty($note_owner)) |
|
406 | - fatal_lang_error('mc_notes_delete_own', false); |
|
416 | + if (empty($note_owner)) { |
|
417 | + fatal_lang_error('mc_notes_delete_own', false); |
|
418 | + } |
|
407 | 419 | } |
408 | 420 | |
409 | 421 | // Lets delete it. |
@@ -460,12 +472,14 @@ discard block |
||
460 | 472 | ) |
461 | 473 | ); |
462 | 474 | $moderator_notes = array(); |
463 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
464 | - $moderator_notes[] = $row; |
|
475 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
476 | + $moderator_notes[] = $row; |
|
477 | + } |
|
465 | 478 | $smcFunc['db_free_result']($request); |
466 | 479 | |
467 | - if ($offset == 0) |
|
468 | - cache_put_data('moderator_notes', $moderator_notes, 240); |
|
480 | + if ($offset == 0) { |
|
481 | + cache_put_data('moderator_notes', $moderator_notes, 240); |
|
482 | + } |
|
469 | 483 | } |
470 | 484 | |
471 | 485 | // Lets construct a page index. |
@@ -504,8 +518,9 @@ discard block |
||
504 | 518 | // Got the info already? |
505 | 519 | $cachekey = md5($smcFunc['json_encode']($user_info['mod_cache']['bq'])); |
506 | 520 | $context['reported_posts'] = array(); |
507 | - if ($user_info['mod_cache']['bq'] == '0=1') |
|
508 | - return 'reported_posts_block'; |
|
521 | + if ($user_info['mod_cache']['bq'] == '0=1') { |
|
522 | + return 'reported_posts_block'; |
|
523 | + } |
|
509 | 524 | |
510 | 525 | if (($reported_posts = cache_get_data('reported_posts_' . $cachekey, 90)) === null) |
511 | 526 | { |
@@ -529,8 +544,9 @@ discard block |
||
529 | 544 | ) |
530 | 545 | ); |
531 | 546 | $reported_posts = array(); |
532 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
533 | - $reported_posts[] = $row; |
|
547 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
548 | + $reported_posts[] = $row; |
|
549 | + } |
|
534 | 550 | $smcFunc['db_free_result']($request); |
535 | 551 | |
536 | 552 | // Cache it. |
@@ -568,8 +584,9 @@ discard block |
||
568 | 584 | |
569 | 585 | $context['group_requests'] = array(); |
570 | 586 | // Make sure they can even moderate someone! |
571 | - if ($user_info['mod_cache']['gq'] == '0=1') |
|
572 | - return 'group_requests_block'; |
|
587 | + if ($user_info['mod_cache']['gq'] == '0=1') { |
|
588 | + return 'group_requests_block'; |
|
589 | + } |
|
573 | 590 | |
574 | 591 | // What requests are outstanding? |
575 | 592 | $request = $smcFunc['db_query']('', ' |
@@ -618,8 +635,9 @@ discard block |
||
618 | 635 | // Got the info already? |
619 | 636 | $cachekey = md5($smcFunc['json_encode']((int) allowedTo('moderate_forum'))); |
620 | 637 | $context['reported_users'] = array(); |
621 | - if (!allowedTo('moderate_forum')) |
|
622 | - return 'reported_users_block'; |
|
638 | + if (!allowedTo('moderate_forum')) { |
|
639 | + return 'reported_users_block'; |
|
640 | + } |
|
623 | 641 | |
624 | 642 | if (($reported_users = cache_get_data('reported_users_' . $cachekey, 90)) === null) |
625 | 643 | { |
@@ -642,8 +660,9 @@ discard block |
||
642 | 660 | ) |
643 | 661 | ); |
644 | 662 | $reported_users = array(); |
645 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
646 | - $reported_users[] = $row; |
|
663 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
664 | + $reported_users[] = $row; |
|
665 | + } |
|
647 | 666 | $smcFunc['db_free_result']($request); |
648 | 667 | |
649 | 668 | // Cache it. |
@@ -742,15 +761,15 @@ discard block |
||
742 | 761 | // Time to update. |
743 | 762 | updateSettings(array('last_mod_report_action' => time())); |
744 | 763 | recountOpenReports('members'); |
745 | - } |
|
746 | - elseif (isset($_POST['close']) && isset($_POST['close_selected'])) |
|
764 | + } elseif (isset($_POST['close']) && isset($_POST['close_selected'])) |
|
747 | 765 | { |
748 | 766 | checkSession(); |
749 | 767 | |
750 | 768 | // All the ones to update... |
751 | 769 | $toClose = array(); |
752 | - foreach ($_POST['close'] as $rid) |
|
753 | - $toClose[] = (int) $rid; |
|
770 | + foreach ($_POST['close'] as $rid) { |
|
771 | + $toClose[] = (int) $rid; |
|
772 | + } |
|
754 | 773 | |
755 | 774 | if (!empty($toClose)) |
756 | 775 | { |
@@ -903,8 +922,9 @@ discard block |
||
903 | 922 | global $context, $user_info; |
904 | 923 | |
905 | 924 | // You need to be allowed to moderate groups... |
906 | - if ($user_info['mod_cache']['gq'] == '0=1') |
|
907 | - isAllowedTo('manage_membergroups'); |
|
925 | + if ($user_info['mod_cache']['gq'] == '0=1') { |
|
926 | + isAllowedTo('manage_membergroups'); |
|
927 | + } |
|
908 | 928 | |
909 | 929 | // Load the group templates. |
910 | 930 | loadTemplate('ModerationCenter'); |
@@ -915,8 +935,9 @@ discard block |
||
915 | 935 | 'view' => 'ViewGroups', |
916 | 936 | ); |
917 | 937 | |
918 | - if (!isset($_GET['sa']) || !isset($subActions[$_GET['sa']])) |
|
919 | - $_GET['sa'] = 'view'; |
|
938 | + if (!isset($_GET['sa']) || !isset($subActions[$_GET['sa']])) { |
|
939 | + $_GET['sa'] = 'view'; |
|
940 | + } |
|
920 | 941 | $context['sub_action'] = $_GET['sa']; |
921 | 942 | |
922 | 943 | // Call the relevant function. |
@@ -946,8 +967,9 @@ discard block |
||
946 | 967 | 'id_notice' => $id_notice, |
947 | 968 | ) |
948 | 969 | ); |
949 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
950 | - fatal_lang_error('no_access', false); |
|
970 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
971 | + fatal_lang_error('no_access', false); |
|
972 | + } |
|
951 | 973 | list ($context['notice_body'], $context['notice_subject']) = $smcFunc['db_fetch_row']($request); |
952 | 974 | $smcFunc['db_free_result']($request); |
953 | 975 | |
@@ -984,18 +1006,20 @@ discard block |
||
984 | 1006 | checkSession(!is_array($_REQUEST['delete']) ? 'get' : 'post'); |
985 | 1007 | |
986 | 1008 | $toDelete = array(); |
987 | - if (!is_array($_REQUEST['delete'])) |
|
988 | - $toDelete[] = (int) $_REQUEST['delete']; |
|
989 | - else |
|
990 | - foreach ($_REQUEST['delete'] as $did) |
|
1009 | + if (!is_array($_REQUEST['delete'])) { |
|
1010 | + $toDelete[] = (int) $_REQUEST['delete']; |
|
1011 | + } else { |
|
1012 | + foreach ($_REQUEST['delete'] as $did) |
|
991 | 1013 | $toDelete[] = (int) $did; |
1014 | + } |
|
992 | 1015 | |
993 | 1016 | if (!empty($toDelete)) |
994 | 1017 | { |
995 | 1018 | require_once($sourcedir . '/RemoveTopic.php'); |
996 | 1019 | // If they don't have permission we'll let it error - either way no chance of a security slip here! |
997 | - foreach ($toDelete as $did) |
|
998 | - removeMessage($did); |
|
1020 | + foreach ($toDelete as $did) { |
|
1021 | + removeMessage($did); |
|
1022 | + } |
|
999 | 1023 | } |
1000 | 1024 | } |
1001 | 1025 | |
@@ -1004,20 +1028,21 @@ discard block |
||
1004 | 1028 | { |
1005 | 1029 | $approve_query = ''; |
1006 | 1030 | $delete_boards = array(); |
1007 | - } |
|
1008 | - else |
|
1031 | + } else |
|
1009 | 1032 | { |
1010 | 1033 | // Still obey permissions! |
1011 | 1034 | $approve_boards = boardsAllowedTo('approve_posts'); |
1012 | 1035 | $delete_boards = boardsAllowedTo('delete_any'); |
1013 | 1036 | |
1014 | - if ($approve_boards == array(0)) |
|
1015 | - $approve_query = ''; |
|
1016 | - elseif (!empty($approve_boards)) |
|
1017 | - $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
1037 | + if ($approve_boards == array(0)) { |
|
1038 | + $approve_query = ''; |
|
1039 | + } elseif (!empty($approve_boards)) { |
|
1040 | + $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
1041 | + } |
|
1018 | 1042 | // Nada, zip, etc... |
1019 | - else |
|
1020 | - $approve_query = ' AND 1=0'; |
|
1043 | + else { |
|
1044 | + $approve_query = ' AND 1=0'; |
|
1045 | + } |
|
1021 | 1046 | } |
1022 | 1047 | |
1023 | 1048 | require_once($sourcedir . '/Subs-List.php'); |
@@ -1116,10 +1141,11 @@ discard block |
||
1116 | 1141 | 'data' => array( |
1117 | 1142 | 'function' => function($member) use ($scripturl) |
1118 | 1143 | { |
1119 | - if ($member['last_post_id']) |
|
1120 | - return '<a href="' . $scripturl . '?msg=' . $member['last_post_id'] . '">' . $member['last_post'] . '</a>'; |
|
1121 | - else |
|
1122 | - return $member['last_post']; |
|
1144 | + if ($member['last_post_id']) { |
|
1145 | + return '<a href="' . $scripturl . '?msg=' . $member['last_post_id'] . '">' . $member['last_post'] . '</a>'; |
|
1146 | + } else { |
|
1147 | + return $member['last_post']; |
|
1148 | + } |
|
1123 | 1149 | }, |
1124 | 1150 | ), |
1125 | 1151 | ), |
@@ -1247,8 +1273,9 @@ discard block |
||
1247 | 1273 | ) |
1248 | 1274 | ); |
1249 | 1275 | $latest_posts = array(); |
1250 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1251 | - $latest_posts[$row['id_member']] = $row['last_post_id']; |
|
1276 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1277 | + $latest_posts[$row['id_member']] = $row['last_post_id']; |
|
1278 | + } |
|
1252 | 1279 | |
1253 | 1280 | if (!empty($latest_posts)) |
1254 | 1281 | { |
@@ -1439,15 +1466,17 @@ discard block |
||
1439 | 1466 | // Setup the direction stuff... |
1440 | 1467 | $context['order'] = isset($_REQUEST['sort']) && isset($sort_types[$_REQUEST['sort']]) ? $_REQUEST['sort'] : 'member'; |
1441 | 1468 | |
1442 | - if (!isset($search_params['string']) || (!empty($_REQUEST['search']) && $search_params['string'] != $_REQUEST['search'])) |
|
1443 | - $search_params_string = empty($_REQUEST['search']) ? '' : $_REQUEST['search']; |
|
1444 | - else |
|
1445 | - $search_params_string = $search_params['string']; |
|
1469 | + if (!isset($search_params['string']) || (!empty($_REQUEST['search']) && $search_params['string'] != $_REQUEST['search'])) { |
|
1470 | + $search_params_string = empty($_REQUEST['search']) ? '' : $_REQUEST['search']; |
|
1471 | + } else { |
|
1472 | + $search_params_string = $search_params['string']; |
|
1473 | + } |
|
1446 | 1474 | |
1447 | - if (isset($_REQUEST['search_type']) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']])) |
|
1448 | - $search_params_type = isset($_REQUEST['search_type']) && isset($searchTypes[$_REQUEST['search_type']]) ? $_REQUEST['search_type'] : (isset($searchTypes[$context['order']]) ? $context['order'] : 'member'); |
|
1449 | - else |
|
1450 | - $search_params_type = $search_params['type']; |
|
1475 | + if (isset($_REQUEST['search_type']) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']])) { |
|
1476 | + $search_params_type = isset($_REQUEST['search_type']) && isset($searchTypes[$_REQUEST['search_type']]) ? $_REQUEST['search_type'] : (isset($searchTypes[$context['order']]) ? $context['order'] : 'member'); |
|
1477 | + } else { |
|
1478 | + $search_params_type = $search_params['type']; |
|
1479 | + } |
|
1451 | 1480 | |
1452 | 1481 | $search_params = array( |
1453 | 1482 | 'string' => $search_params_string, |
@@ -1530,9 +1559,10 @@ discard block |
||
1530 | 1559 | ' . $rowData['reason'] . ' |
1531 | 1560 | </div>'; |
1532 | 1561 | |
1533 | - if (!empty($rowData['id_notice'])) |
|
1534 | - $output .= ' |
|
1562 | + if (!empty($rowData['id_notice'])) { |
|
1563 | + $output .= ' |
|
1535 | 1564 | <a href="' . $scripturl . '?action=moderate;area=notice;nid=' . $rowData['id_notice'] . '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" rel="noopener" title="' . $txt['profile_warning_previous_notice'] . '"><span class="generic_icons filter centericon"></span></a>'; |
1565 | + } |
|
1536 | 1566 | return $output; |
1537 | 1567 | }, |
1538 | 1568 | ), |
@@ -1650,9 +1680,9 @@ discard block |
||
1650 | 1680 | global $smcFunc, $modSettings, $context, $txt, $scripturl, $sourcedir, $user_info; |
1651 | 1681 | |
1652 | 1682 | // Submitting a new one? |
1653 | - if (isset($_POST['add'])) |
|
1654 | - return ModifyWarningTemplate(); |
|
1655 | - elseif (isset($_POST['delete']) && !empty($_POST['deltpl'])) |
|
1683 | + if (isset($_POST['add'])) { |
|
1684 | + return ModifyWarningTemplate(); |
|
1685 | + } elseif (isset($_POST['delete']) && !empty($_POST['deltpl'])) |
|
1656 | 1686 | { |
1657 | 1687 | checkSession(); |
1658 | 1688 | validateToken('mod-wt'); |
@@ -1671,8 +1701,9 @@ discard block |
||
1671 | 1701 | 'current_member' => $user_info['id'], |
1672 | 1702 | ) |
1673 | 1703 | ); |
1674 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1675 | - logAction('delete_warn_template', array('template' => $row['recipient_name'])); |
|
1704 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1705 | + logAction('delete_warn_template', array('template' => $row['recipient_name'])); |
|
1706 | + } |
|
1676 | 1707 | $smcFunc['db_free_result']($request); |
1677 | 1708 | |
1678 | 1709 | // Do the deletes. |
@@ -1963,16 +1994,18 @@ discard block |
||
1963 | 1994 | ); |
1964 | 1995 | |
1965 | 1996 | // If it wasn't visible and now is they've effectively added it. |
1966 | - if ($context['template_data']['personal'] && !$recipient_id) |
|
1967 | - logAction('add_warn_template', array('template' => $_POST['template_title'])); |
|
1997 | + if ($context['template_data']['personal'] && !$recipient_id) { |
|
1998 | + logAction('add_warn_template', array('template' => $_POST['template_title'])); |
|
1999 | + } |
|
1968 | 2000 | // Conversely if they made it personal it's a delete. |
1969 | - elseif (!$context['template_data']['personal'] && $recipient_id) |
|
1970 | - logAction('delete_warn_template', array('template' => $_POST['template_title'])); |
|
2001 | + elseif (!$context['template_data']['personal'] && $recipient_id) { |
|
2002 | + logAction('delete_warn_template', array('template' => $_POST['template_title'])); |
|
2003 | + } |
|
1971 | 2004 | // Otherwise just an edit. |
1972 | - else |
|
1973 | - logAction('modify_warn_template', array('template' => $_POST['template_title'])); |
|
1974 | - } |
|
1975 | - else |
|
2005 | + else { |
|
2006 | + logAction('modify_warn_template', array('template' => $_POST['template_title'])); |
|
2007 | + } |
|
2008 | + } else |
|
1976 | 2009 | { |
1977 | 2010 | $smcFunc['db_insert']('', |
1978 | 2011 | '{db_prefix}log_comments', |
@@ -1992,17 +2025,18 @@ discard block |
||
1992 | 2025 | |
1993 | 2026 | // Get out of town... |
1994 | 2027 | redirectexit('action=moderate;area=warnings;sa=templates'); |
1995 | - } |
|
1996 | - else |
|
2028 | + } else |
|
1997 | 2029 | { |
1998 | 2030 | $context['warning_errors'] = array(); |
1999 | 2031 | $context['template_data']['title'] = !empty($_POST['template_title']) ? $_POST['template_title'] : ''; |
2000 | 2032 | $context['template_data']['body'] = !empty($_POST['template_body']) ? $_POST['template_body'] : $txt['mc_warning_template_body_default']; |
2001 | 2033 | $context['template_data']['personal'] = !empty($_POST['make_personal']); |
2002 | - if (empty($_POST['template_title'])) |
|
2003 | - $context['warning_errors'][] = $txt['mc_warning_template_error_no_title']; |
|
2004 | - if (empty($_POST['template_body'])) |
|
2005 | - $context['warning_errors'][] = $txt['mc_warning_template_error_no_body']; |
|
2034 | + if (empty($_POST['template_title'])) { |
|
2035 | + $context['warning_errors'][] = $txt['mc_warning_template_error_no_title']; |
|
2036 | + } |
|
2037 | + if (empty($_POST['template_body'])) { |
|
2038 | + $context['warning_errors'][] = $txt['mc_warning_template_error_no_body']; |
|
2039 | + } |
|
2006 | 2040 | } |
2007 | 2041 | } |
2008 | 2042 | |
@@ -2047,8 +2081,9 @@ discard block |
||
2047 | 2081 | // Now check other options! |
2048 | 2082 | $pref_binary = 0; |
2049 | 2083 | |
2050 | - if ($context['can_moderate_approvals'] && !empty($_POST['mod_notify_approval'])) |
|
2051 | - $pref_binary |= 4; |
|
2084 | + if ($context['can_moderate_approvals'] && !empty($_POST['mod_notify_approval'])) { |
|
2085 | + $pref_binary |= 4; |
|
2086 | + } |
|
2052 | 2087 | |
2053 | 2088 | // Put it all together. |
2054 | 2089 | $mod_prefs = '0||' . $pref_binary; |
@@ -2072,9 +2107,10 @@ discard block |
||
2072 | 2107 | unset($_SESSION['moderate_time']); |
2073 | 2108 | |
2074 | 2109 | // Clean any moderator tokens as well. |
2075 | - foreach ($_SESSION['token'] as $key => $token) |
|
2076 | - if (strpos($key, '-mod') !== false) |
|
2110 | + foreach ($_SESSION['token'] as $key => $token) { |
|
2111 | + if (strpos($key, '-mod') !== false) |
|
2077 | 2112 | unset($_SESSION['token'][$key]); |
2113 | + } |
|
2078 | 2114 | |
2079 | 2115 | redirectexit(); |
2080 | 2116 | } |
@@ -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" rel="noopener">', ($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) |
@@ -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" rel="noopener">', ($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> |
@@ -86,11 +86,12 @@ discard block |
||
86 | 86 | <span class="smalltext"><em>', $txt['find_wildcards'], '</em></span><br>'; |
87 | 87 | |
88 | 88 | // Only offer to search for buddies if we have some! |
89 | - if (!empty($context['show_buddies'])) |
|
90 | - echo ' |
|
89 | + if (!empty($context['show_buddies'])) { |
|
90 | + echo ' |
|
91 | 91 | <span class="smalltext"> |
92 | 92 | <label for="buddies"><input type="checkbox" name="buddies" id="buddies"', !empty($context['buddy_search']) ? ' checked' : '', '> ', $txt['find_buddies'], '</label> |
93 | 93 | </span><br>'; |
94 | + } |
|
94 | 95 | |
95 | 96 | echo ' |
96 | 97 | <div class="padding righttext"> |
@@ -105,20 +106,21 @@ discard block |
||
105 | 106 | <h3 class="catbg">', $txt['find_results'], '</h3> |
106 | 107 | </div>'; |
107 | 108 | |
108 | - if (empty($context['results'])) |
|
109 | - echo ' |
|
109 | + if (empty($context['results'])) { |
|
110 | + echo ' |
|
110 | 111 | <p class="error">', $txt['find_no_results'], '</p>'; |
111 | - else |
|
112 | + } else |
|
112 | 113 | { |
113 | 114 | echo ' |
114 | 115 | <ul class="padding">'; |
115 | 116 | |
116 | - foreach ($context['results'] as $result) |
|
117 | - echo ' |
|
117 | + foreach ($context['results'] as $result) { |
|
118 | + echo ' |
|
118 | 119 | <li class="windowbg"> |
119 | 120 | <a href="', $result['href'], '" target="_blank" rel="noopener"> <span class="generic_icons profile_sm"></span> |
120 | 121 | <a href="javascript:void(0);" onclick="addMember(this.innerHTML); return false;">', $result['name'], '</a> |
121 | 122 | </li>'; |
123 | + } |
|
122 | 124 | |
123 | 125 | echo ' |
124 | 126 | </ul> |
@@ -134,11 +136,12 @@ discard block |
||
134 | 136 | <input type="hidden" name="quote" value="', $context['quote_results'] ? '1' : '0', '"> |
135 | 137 | </form>'; |
136 | 138 | |
137 | - if (empty($context['results'])) |
|
138 | - echo ' |
|
139 | + if (empty($context['results'])) { |
|
140 | + echo ' |
|
139 | 141 | <script> |
140 | 142 | document.getElementById("search").focus(); |
141 | 143 | </script>'; |
144 | + } |
|
142 | 145 | |
143 | 146 | echo ' |
144 | 147 | </body> |
@@ -162,9 +165,10 @@ discard block |
||
162 | 165 | <p>', $txt['manual_introduction'], '</p> |
163 | 166 | <ul>'; |
164 | 167 | |
165 | - foreach ($context['manual_sections'] as $section_id => $wiki_id) |
|
166 | - echo ' |
|
168 | + foreach ($context['manual_sections'] as $section_id => $wiki_id) { |
|
169 | + echo ' |
|
167 | 170 | <li><a href="', $context['wiki_url'], '/', $context['wiki_prefix'], $wiki_id, ($txt['lang_dictionary'] != 'en' ? '/' . $txt['lang_dictionary'] : ''), '" target="_blank" rel="noopener">', $txt['manual_section_' . $section_id . '_title'], '</a> - ', $txt['manual_section_' . $section_id . '_desc'], '</li>'; |
171 | + } |
|
168 | 172 | |
169 | 173 | echo ' |
170 | 174 | </ul> |
@@ -180,8 +184,8 @@ discard block |
||
180 | 184 | { |
181 | 185 | global $txt, $context, $modSettings; |
182 | 186 | |
183 | - if (!empty($modSettings['requireAgreement'])) |
|
184 | - echo ' |
|
187 | + if (!empty($modSettings['requireAgreement'])) { |
|
188 | + echo ' |
|
185 | 189 | <div class="cat_bar"> |
186 | 190 | <h3 class="catbg"> |
187 | 191 | ', $txt['terms_and_rules'], ' - ', $context['forum_name_html_safe'], ' |
@@ -190,11 +194,12 @@ discard block |
||
190 | 194 | <div class="roundframe"> |
191 | 195 | ', $context['agreement'], ' |
192 | 196 | </div>'; |
193 | - else |
|
194 | - echo ' |
|
197 | + } else { |
|
198 | + echo ' |
|
195 | 199 | <div class="noticebox"> |
196 | 200 | ', $txt['agreement_disabled'], ' |
197 | 201 | </div>'; |
198 | -} |
|
202 | + } |
|
203 | + } |
|
199 | 204 | |
200 | 205 | ?> |
201 | 206 | \ No newline at end of file |
@@ -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 | * The main designating function for modifying profiles. Loads up info, determins what to do, etc. |
@@ -29,18 +30,21 @@ discard block |
||
29 | 30 | global $modSettings, $memberContext, $profile_vars, $post_errors, $smcFunc; |
30 | 31 | |
31 | 32 | // Don't reload this as we may have processed error strings. |
32 | - if (empty($post_errors)) |
|
33 | - loadLanguage('Profile+Drafts'); |
|
33 | + if (empty($post_errors)) { |
|
34 | + loadLanguage('Profile+Drafts'); |
|
35 | + } |
|
34 | 36 | loadTemplate('Profile'); |
35 | 37 | |
36 | 38 | require_once($sourcedir . '/Subs-Menu.php'); |
37 | 39 | |
38 | 40 | // Did we get the user by name... |
39 | - if (isset($_REQUEST['user'])) |
|
40 | - $memberResult = loadMemberData($_REQUEST['user'], true, 'profile'); |
|
41 | + if (isset($_REQUEST['user'])) { |
|
42 | + $memberResult = loadMemberData($_REQUEST['user'], true, 'profile'); |
|
43 | + } |
|
41 | 44 | // ... or by id_member? |
42 | - elseif (!empty($_REQUEST['u'])) |
|
43 | - $memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile'); |
|
45 | + elseif (!empty($_REQUEST['u'])) { |
|
46 | + $memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile'); |
|
47 | + } |
|
44 | 48 | // If it was just ?action=profile, edit your own profile, but only if you're not a guest. |
45 | 49 | else |
46 | 50 | { |
@@ -50,8 +54,9 @@ discard block |
||
50 | 54 | } |
51 | 55 | |
52 | 56 | // Check if loadMemberData() has returned a valid result. |
53 | - if (!$memberResult) |
|
54 | - fatal_lang_error('not_a_user', false, 404); |
|
57 | + if (!$memberResult) { |
|
58 | + fatal_lang_error('not_a_user', false, 404); |
|
59 | + } |
|
55 | 60 | |
56 | 61 | // If all went well, we have a valid member ID! |
57 | 62 | list ($memID) = $memberResult; |
@@ -67,8 +72,9 @@ discard block |
||
67 | 72 | |
68 | 73 | // Group management isn't actually a permission. But we need it to be for this, so we need a phantom permission. |
69 | 74 | // And we care about what the current user can do, not what the user whose profile it is. |
70 | - if ($user_info['mod_cache']['gq'] != '0=1') |
|
71 | - $user_info['permissions'][] = 'approve_group_requests'; |
|
75 | + if ($user_info['mod_cache']['gq'] != '0=1') { |
|
76 | + $user_info['permissions'][] = 'approve_group_requests'; |
|
77 | + } |
|
72 | 78 | |
73 | 79 | // If paid subscriptions are enabled, make sure we actually have at least one subscription available... |
74 | 80 | $context['subs_available'] = false; |
@@ -436,21 +442,25 @@ discard block |
||
436 | 442 | foreach ($section['areas'] as $area_id => $area) |
437 | 443 | { |
438 | 444 | // If it said no permissions that meant it wasn't valid! |
439 | - if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) |
|
440 | - $profile_areas[$section_id]['areas'][$area_id]['enabled'] = false; |
|
445 | + if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) { |
|
446 | + $profile_areas[$section_id]['areas'][$area_id]['enabled'] = false; |
|
447 | + } |
|
441 | 448 | // Otherwise pick the right set. |
442 | - else |
|
443 | - $profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any']; |
|
449 | + else { |
|
450 | + $profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any']; |
|
451 | + } |
|
444 | 452 | |
445 | 453 | // Password required in most cases |
446 | - if (!empty($area['password'])) |
|
447 | - $context['password_areas'][] = $area_id; |
|
454 | + if (!empty($area['password'])) { |
|
455 | + $context['password_areas'][] = $area_id; |
|
456 | + } |
|
448 | 457 | } |
449 | 458 | } |
450 | 459 | |
451 | 460 | // Is there an updated message to show? |
452 | - if (isset($_GET['updated'])) |
|
453 | - $context['profile_updated'] = $txt['profile_updated_own']; |
|
461 | + if (isset($_GET['updated'])) { |
|
462 | + $context['profile_updated'] = $txt['profile_updated_own']; |
|
463 | + } |
|
454 | 464 | |
455 | 465 | // Set a few options for the menu. |
456 | 466 | $menuOptions = array( |
@@ -465,8 +475,9 @@ discard block |
||
465 | 475 | $profile_include_data = createMenu($profile_areas, $menuOptions); |
466 | 476 | |
467 | 477 | // No menu means no access. |
468 | - if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) |
|
469 | - fatal_lang_error('no_access', false); |
|
478 | + if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) { |
|
479 | + fatal_lang_error('no_access', false); |
|
480 | + } |
|
470 | 481 | |
471 | 482 | // Make a note of the Unique ID for this menu. |
472 | 483 | $context['profile_menu_id'] = $context['max_menu_id']; |
@@ -492,8 +503,9 @@ discard block |
||
492 | 503 | if ($current_area == $area_id) |
493 | 504 | { |
494 | 505 | // This can't happen - but is a security check. |
495 | - if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false)) |
|
496 | - fatal_lang_error('no_access', false); |
|
506 | + if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false)) { |
|
507 | + fatal_lang_error('no_access', false); |
|
508 | + } |
|
497 | 509 | |
498 | 510 | // Are we saving data in a valid area? |
499 | 511 | if (isset($area['sc']) && (isset($_REQUEST['save']) || $context['do_preview'])) |
@@ -512,12 +524,14 @@ discard block |
||
512 | 524 | } |
513 | 525 | |
514 | 526 | // Does this require session validating? |
515 | - if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) |
|
516 | - $security_checks['validate'] = true; |
|
527 | + if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) { |
|
528 | + $security_checks['validate'] = true; |
|
529 | + } |
|
517 | 530 | |
518 | 531 | // Permissions for good measure. |
519 | - if (!empty($profile_include_data['permission'])) |
|
520 | - $security_checks['permission'] = $profile_include_data['permission']; |
|
532 | + if (!empty($profile_include_data['permission'])) { |
|
533 | + $security_checks['permission'] = $profile_include_data['permission']; |
|
534 | + } |
|
521 | 535 | |
522 | 536 | // Either way got something. |
523 | 537 | $found_area = true; |
@@ -526,21 +540,26 @@ discard block |
||
526 | 540 | } |
527 | 541 | |
528 | 542 | // Oh dear, some serious security lapse is going on here... we'll put a stop to that! |
529 | - if (!$found_area) |
|
530 | - fatal_lang_error('no_access', false); |
|
543 | + if (!$found_area) { |
|
544 | + fatal_lang_error('no_access', false); |
|
545 | + } |
|
531 | 546 | |
532 | 547 | // Release this now. |
533 | 548 | unset($profile_areas); |
534 | 549 | |
535 | 550 | // Now the context is setup have we got any security checks to carry out additional to that above? |
536 | - if (isset($security_checks['session'])) |
|
537 | - checkSession($security_checks['session']); |
|
538 | - if (isset($security_checks['validate'])) |
|
539 | - validateSession(); |
|
540 | - if (isset($security_checks['validateToken'])) |
|
541 | - validateToken($token_name, $token_type); |
|
542 | - if (isset($security_checks['permission'])) |
|
543 | - isAllowedTo($security_checks['permission']); |
|
551 | + if (isset($security_checks['session'])) { |
|
552 | + checkSession($security_checks['session']); |
|
553 | + } |
|
554 | + if (isset($security_checks['validate'])) { |
|
555 | + validateSession(); |
|
556 | + } |
|
557 | + if (isset($security_checks['validateToken'])) { |
|
558 | + validateToken($token_name, $token_type); |
|
559 | + } |
|
560 | + if (isset($security_checks['permission'])) { |
|
561 | + isAllowedTo($security_checks['permission']); |
|
562 | + } |
|
544 | 563 | |
545 | 564 | // Create a token if needed. |
546 | 565 | if (isset($security_checks['needsToken']) || isset($security_checks['validateToken'])) |
@@ -550,8 +569,9 @@ discard block |
||
550 | 569 | } |
551 | 570 | |
552 | 571 | // File to include? |
553 | - if (isset($profile_include_data['file'])) |
|
554 | - require_once($sourcedir . '/' . $profile_include_data['file']); |
|
572 | + if (isset($profile_include_data['file'])) { |
|
573 | + require_once($sourcedir . '/' . $profile_include_data['file']); |
|
574 | + } |
|
555 | 575 | |
556 | 576 | // Build the link tree. |
557 | 577 | $context['linktree'][] = array( |
@@ -559,17 +579,19 @@ discard block |
||
559 | 579 | 'name' => sprintf($txt['profile_of_username'], $context['member']['name']), |
560 | 580 | ); |
561 | 581 | |
562 | - if (!empty($profile_include_data['label'])) |
|
563 | - $context['linktree'][] = array( |
|
582 | + if (!empty($profile_include_data['label'])) { |
|
583 | + $context['linktree'][] = array( |
|
564 | 584 | 'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'], |
565 | 585 | 'name' => $profile_include_data['label'], |
566 | 586 | ); |
587 | + } |
|
567 | 588 | |
568 | - if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) |
|
569 | - $context['linktree'][] = array( |
|
589 | + if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) { |
|
590 | + $context['linktree'][] = array( |
|
570 | 591 | 'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'] . ';sa=' . $profile_include_data['current_subsection'], |
571 | 592 | 'name' => $profile_include_data['subsections'][$profile_include_data['current_subsection']][0], |
572 | 593 | ); |
594 | + } |
|
573 | 595 | |
574 | 596 | // Set the template for this area and add the profile layer. |
575 | 597 | $context['sub_template'] = $profile_include_data['function']; |
@@ -595,12 +617,14 @@ discard block |
||
595 | 617 | if ($check_password) |
596 | 618 | { |
597 | 619 | // Check to ensure we're forcing SSL for authentication |
598 | - if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) |
|
599 | - fatal_lang_error('login_ssl_required'); |
|
620 | + if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) { |
|
621 | + fatal_lang_error('login_ssl_required'); |
|
622 | + } |
|
600 | 623 | |
601 | 624 | // You didn't even enter a password! |
602 | - if (trim($_POST['oldpasswrd']) == '') |
|
603 | - $post_errors[] = 'no_password'; |
|
625 | + if (trim($_POST['oldpasswrd']) == '') { |
|
626 | + $post_errors[] = 'no_password'; |
|
627 | + } |
|
604 | 628 | |
605 | 629 | // Since the password got modified due to all the $_POST cleaning, lets undo it so we can get the correct password |
606 | 630 | $_POST['oldpasswrd'] = un_htmlspecialchars($_POST['oldpasswrd']); |
@@ -609,42 +633,43 @@ discard block |
||
609 | 633 | $good_password = in_array(true, call_integration_hook('integrate_verify_password', array($cur_profile['member_name'], $_POST['oldpasswrd'], false)), true); |
610 | 634 | |
611 | 635 | // Bad password!!! |
612 | - if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd'])) |
|
613 | - $post_errors[] = 'bad_password'; |
|
636 | + if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd'])) { |
|
637 | + $post_errors[] = 'bad_password'; |
|
638 | + } |
|
614 | 639 | |
615 | 640 | // Warn other elements not to jump the gun and do custom changes! |
616 | - if (in_array('bad_password', $post_errors)) |
|
617 | - $context['password_auth_failed'] = true; |
|
641 | + if (in_array('bad_password', $post_errors)) { |
|
642 | + $context['password_auth_failed'] = true; |
|
643 | + } |
|
618 | 644 | } |
619 | 645 | |
620 | 646 | // Change the IP address in the database. |
621 | - if ($context['user']['is_owner']) |
|
622 | - $profile_vars['member_ip'] = $user_info['ip']; |
|
647 | + if ($context['user']['is_owner']) { |
|
648 | + $profile_vars['member_ip'] = $user_info['ip']; |
|
649 | + } |
|
623 | 650 | |
624 | 651 | // Now call the sub-action function... |
625 | 652 | if ($current_area == 'activateaccount') |
626 | 653 | { |
627 | - if (empty($post_errors)) |
|
628 | - activateAccount($memID); |
|
629 | - } |
|
630 | - elseif ($current_area == 'deleteaccount') |
|
654 | + if (empty($post_errors)) { |
|
655 | + activateAccount($memID); |
|
656 | + } |
|
657 | + } elseif ($current_area == 'deleteaccount') |
|
631 | 658 | { |
632 | 659 | if (empty($post_errors)) |
633 | 660 | { |
634 | 661 | deleteAccount2($memID); |
635 | 662 | redirectexit(); |
636 | 663 | } |
637 | - } |
|
638 | - elseif ($current_area == 'groupmembership' && empty($post_errors)) |
|
664 | + } elseif ($current_area == 'groupmembership' && empty($post_errors)) |
|
639 | 665 | { |
640 | 666 | $msg = groupMembership2($profile_vars, $post_errors, $memID); |
641 | 667 | |
642 | 668 | // Whatever we've done, we have nothing else to do here... |
643 | 669 | redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=groupmembership' . (!empty($msg) ? ';msg=' . $msg : '')); |
644 | - } |
|
645 | - elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) |
|
646 | - saveProfileFields(); |
|
647 | - else |
|
670 | + } elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) { |
|
671 | + saveProfileFields(); |
|
672 | + } else |
|
648 | 673 | { |
649 | 674 | $force_redirect = true; |
650 | 675 | // Ensure we include this. |
@@ -660,34 +685,36 @@ discard block |
||
660 | 685 | // Load the language file so we can give a nice explanation of the errors. |
661 | 686 | loadLanguage('Errors'); |
662 | 687 | $context['post_errors'] = $post_errors; |
663 | - } |
|
664 | - elseif (!empty($profile_vars)) |
|
688 | + } elseif (!empty($profile_vars)) |
|
665 | 689 | { |
666 | 690 | // If we've changed the password, notify any integration that may be listening in. |
667 | - if (isset($profile_vars['passwd'])) |
|
668 | - call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2'])); |
|
691 | + if (isset($profile_vars['passwd'])) { |
|
692 | + call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2'])); |
|
693 | + } |
|
669 | 694 | |
670 | 695 | updateMemberData($memID, $profile_vars); |
671 | 696 | |
672 | 697 | // What if this is the newest member? |
673 | - if ($modSettings['latestMember'] == $memID) |
|
674 | - updateStats('member'); |
|
675 | - elseif (isset($profile_vars['real_name'])) |
|
676 | - updateSettings(array('memberlist_updated' => time())); |
|
698 | + if ($modSettings['latestMember'] == $memID) { |
|
699 | + updateStats('member'); |
|
700 | + } elseif (isset($profile_vars['real_name'])) { |
|
701 | + updateSettings(array('memberlist_updated' => time())); |
|
702 | + } |
|
677 | 703 | |
678 | 704 | // If the member changed his/her birthdate, update calendar statistics. |
679 | - if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) |
|
680 | - updateSettings(array( |
|
705 | + if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) { |
|
706 | + updateSettings(array( |
|
681 | 707 | 'calendar_updated' => time(), |
682 | 708 | )); |
709 | + } |
|
683 | 710 | |
684 | 711 | // Anything worth logging? |
685 | 712 | if (!empty($context['log_changes']) && !empty($modSettings['modlog_enabled'])) |
686 | 713 | { |
687 | 714 | $log_changes = array(); |
688 | 715 | require_once($sourcedir . '/Logging.php'); |
689 | - foreach ($context['log_changes'] as $k => $v) |
|
690 | - $log_changes[] = array( |
|
716 | + foreach ($context['log_changes'] as $k => $v) { |
|
717 | + $log_changes[] = array( |
|
691 | 718 | 'action' => $k, |
692 | 719 | 'log_type' => 'user', |
693 | 720 | 'extra' => array_merge($v, array( |
@@ -695,14 +722,16 @@ discard block |
||
695 | 722 | 'member_affected' => $memID, |
696 | 723 | )), |
697 | 724 | ); |
725 | + } |
|
698 | 726 | |
699 | 727 | logActions($log_changes); |
700 | 728 | } |
701 | 729 | |
702 | 730 | // Have we got any post save functions to execute? |
703 | - if (!empty($context['profile_execute_on_save'])) |
|
704 | - foreach ($context['profile_execute_on_save'] as $saveFunc) |
|
731 | + if (!empty($context['profile_execute_on_save'])) { |
|
732 | + foreach ($context['profile_execute_on_save'] as $saveFunc) |
|
705 | 733 | $saveFunc(); |
734 | + } |
|
706 | 735 | |
707 | 736 | // Let them know it worked! |
708 | 737 | $context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $cur_profile['member_name']); |
@@ -716,27 +745,31 @@ discard block |
||
716 | 745 | if (!empty($post_errors)) |
717 | 746 | { |
718 | 747 | // Set all the errors so the template knows what went wrong. |
719 | - foreach ($post_errors as $error_type) |
|
720 | - $context['modify_error'][$error_type] = true; |
|
748 | + foreach ($post_errors as $error_type) { |
|
749 | + $context['modify_error'][$error_type] = true; |
|
750 | + } |
|
721 | 751 | } |
722 | 752 | // If it's you then we should redirect upon save. |
723 | - elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) |
|
724 | - redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated'); |
|
725 | - elseif (!empty($force_redirect)) |
|
726 | - redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area); |
|
753 | + elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) { |
|
754 | + redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated'); |
|
755 | + } elseif (!empty($force_redirect)) { |
|
756 | + redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area); |
|
757 | + } |
|
727 | 758 | |
728 | 759 | |
729 | 760 | // Get the right callable. |
730 | 761 | $call = call_helper($profile_include_data['function'], true); |
731 | 762 | |
732 | 763 | // Is it valid? |
733 | - if (!empty($call)) |
|
734 | - call_user_func($call, $memID); |
|
764 | + if (!empty($call)) { |
|
765 | + call_user_func($call, $memID); |
|
766 | + } |
|
735 | 767 | |
736 | 768 | // Set the page title if it's not already set... |
737 | - if (!isset($context['page_title'])) |
|
738 | - $context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : ''); |
|
739 | -} |
|
769 | + if (!isset($context['page_title'])) { |
|
770 | + $context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : ''); |
|
771 | + } |
|
772 | + } |
|
740 | 773 | |
741 | 774 | /** |
742 | 775 | * Set up the requirements for the profile popup - the area that is shown as the popup menu for the current user. |
@@ -859,16 +892,18 @@ discard block |
||
859 | 892 | if (!allowedTo('admin_forum') && $area != 'register') |
860 | 893 | { |
861 | 894 | // If it's the owner they can see two types of private fields, regardless. |
862 | - if ($memID == $user_info['id']) |
|
863 | - $where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)'; |
|
864 | - else |
|
865 | - $where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0'; |
|
895 | + if ($memID == $user_info['id']) { |
|
896 | + $where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)'; |
|
897 | + } else { |
|
898 | + $where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0'; |
|
899 | + } |
|
866 | 900 | } |
867 | 901 | |
868 | - if ($area == 'register') |
|
869 | - $where .= ' AND show_reg != 0'; |
|
870 | - elseif ($area != 'summary') |
|
871 | - $where .= ' AND show_profile = {string:area}'; |
|
902 | + if ($area == 'register') { |
|
903 | + $where .= ' AND show_reg != 0'; |
|
904 | + } elseif ($area != 'summary') { |
|
905 | + $where .= ' AND show_profile = {string:area}'; |
|
906 | + } |
|
872 | 907 | |
873 | 908 | // Load all the relevant fields - and data. |
874 | 909 | $request = $smcFunc['db_query']('', ' |
@@ -894,13 +929,15 @@ discard block |
||
894 | 929 | if (isset($_POST['customfield']) && isset($_POST['customfield'][$row['col_name']])) |
895 | 930 | { |
896 | 931 | $value = $smcFunc['htmlspecialchars']($_POST['customfield'][$row['col_name']]); |
897 | - if (in_array($row['field_type'], array('select', 'radio'))) |
|
898 | - $value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : ''; |
|
932 | + if (in_array($row['field_type'], array('select', 'radio'))) { |
|
933 | + $value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : ''; |
|
934 | + } |
|
899 | 935 | } |
900 | 936 | |
901 | 937 | // Don't show the "disabled" option for the "gender" field if we are on the "summary" area. |
902 | - if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'None') |
|
903 | - continue; |
|
938 | + if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'None') { |
|
939 | + continue; |
|
940 | + } |
|
904 | 941 | |
905 | 942 | // HTML for the input form. |
906 | 943 | $output_html = $value; |
@@ -909,8 +946,7 @@ discard block |
||
909 | 946 | $true = (!$exists && $row['default_value']) || $value; |
910 | 947 | $input_html = '<input type="checkbox" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($true ? ' checked' : '') . '>'; |
911 | 948 | $output_html = $true ? $txt['yes'] : $txt['no']; |
912 | - } |
|
913 | - elseif ($row['field_type'] == 'select') |
|
949 | + } elseif ($row['field_type'] == 'select') |
|
914 | 950 | { |
915 | 951 | $input_html = '<select name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"><option value="-1"></option>'; |
916 | 952 | $options = explode(',', $row['field_options']); |
@@ -918,13 +954,13 @@ discard block |
||
918 | 954 | { |
919 | 955 | $true = (!$exists && $row['default_value'] == $v) || $value == $v; |
920 | 956 | $input_html .= '<option value="' . $k . '"' . ($true ? ' selected' : '') . '>' . $v . '</option>'; |
921 | - if ($true) |
|
922 | - $output_html = $v; |
|
957 | + if ($true) { |
|
958 | + $output_html = $v; |
|
959 | + } |
|
923 | 960 | } |
924 | 961 | |
925 | 962 | $input_html .= '</select>'; |
926 | - } |
|
927 | - elseif ($row['field_type'] == 'radio') |
|
963 | + } elseif ($row['field_type'] == 'radio') |
|
928 | 964 | { |
929 | 965 | $input_html = '<fieldset>'; |
930 | 966 | $options = explode(',', $row['field_options']); |
@@ -932,36 +968,37 @@ discard block |
||
932 | 968 | { |
933 | 969 | $true = (!$exists && $row['default_value'] == $v) || $value == $v; |
934 | 970 | $input_html .= '<label for="customfield_' . $row['col_name'] . '_' . $k . '"><input type="radio" name="customfield[' . $row['col_name'] . ']" id="customfield_' . $row['col_name'] . '_' . $k . '" value="' . $k . '"' . ($true ? ' checked' : '') . '>' . $v . '</label><br>'; |
935 | - if ($true) |
|
936 | - $output_html = $v; |
|
971 | + if ($true) { |
|
972 | + $output_html = $v; |
|
973 | + } |
|
937 | 974 | } |
938 | 975 | $input_html .= '</fieldset>'; |
939 | - } |
|
940 | - elseif ($row['field_type'] == 'text') |
|
976 | + } elseif ($row['field_type'] == 'text') |
|
941 | 977 | { |
942 | 978 | $input_html = '<input type="text" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($row['field_length'] != 0 ? ' maxlength="' . $row['field_length'] . '"' : '') . ' size="' . ($row['field_length'] == 0 || $row['field_length'] >= 50 ? 50 : ($row['field_length'] > 30 ? 30 : ($row['field_length'] > 10 ? 20 : 10))) . '" value="' . un_htmlspecialchars($value) . '"' . ($row['show_reg'] == 2 ? ' required' : '') . '>'; |
943 | - } |
|
944 | - else |
|
979 | + } else |
|
945 | 980 | { |
946 | 981 | @list ($rows, $cols) = @explode(',', $row['default_value']); |
947 | 982 | $input_html = '<textarea name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . (!empty($rows) ? ' rows="' . $rows . '"' : '') . (!empty($cols) ? ' cols="' . $cols . '"' : '') . ($row['show_reg'] == 2 ? ' required' : '') . '>' . un_htmlspecialchars($value) . '</textarea>'; |
948 | 983 | } |
949 | 984 | |
950 | 985 | // Parse BBCode |
951 | - if ($row['bbc']) |
|
952 | - $output_html = parse_bbc($output_html); |
|
953 | - elseif ($row['field_type'] == 'textarea') |
|
954 | - // Allow for newlines at least |
|
986 | + if ($row['bbc']) { |
|
987 | + $output_html = parse_bbc($output_html); |
|
988 | + } elseif ($row['field_type'] == 'textarea') { |
|
989 | + // Allow for newlines at least |
|
955 | 990 | $output_html = strtr($output_html, array("\n" => '<br>')); |
991 | + } |
|
956 | 992 | |
957 | 993 | // Enclosing the user input within some other text? |
958 | - if (!empty($row['enclose']) && !empty($output_html)) |
|
959 | - $output_html = strtr($row['enclose'], array( |
|
994 | + if (!empty($row['enclose']) && !empty($output_html)) { |
|
995 | + $output_html = strtr($row['enclose'], array( |
|
960 | 996 | '{SCRIPTURL}' => $scripturl, |
961 | 997 | '{IMAGES_URL}' => $settings['images_url'], |
962 | 998 | '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], |
963 | 999 | '{INPUT}' => un_htmlspecialchars($output_html), |
964 | 1000 | )); |
1001 | + } |
|
965 | 1002 | |
966 | 1003 | $context['custom_fields'][] = array( |
967 | 1004 | 'name' => $row['field_name'], |
@@ -27,9 +27,10 @@ discard block |
||
27 | 27 | <h3 class="catbg"> |
28 | 28 | <span class="floatleft">', $txt['members_list'], '</span>'; |
29 | 29 | |
30 | - if (!isset($context['old_search'])) |
|
31 | - echo ' |
|
30 | + if (!isset($context['old_search'])) { |
|
31 | + echo ' |
|
32 | 32 | <span class="floatright">', $context['letter_links'], '</span>'; |
33 | + } |
|
33 | 34 | echo ' |
34 | 35 | </h3> |
35 | 36 | </div>'; |
@@ -44,20 +45,23 @@ discard block |
||
44 | 45 | foreach ($context['columns'] as $key => $column) |
45 | 46 | { |
46 | 47 | // @TODO maybe find something nicer? |
47 | - if ($key == 'email_address' && !$context['can_send_email']) |
|
48 | - continue; |
|
48 | + if ($key == 'email_address' && !$context['can_send_email']) { |
|
49 | + continue; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | // This is a selected column, so underline it or some such. |
51 | - if ($column['selected']) |
|
52 | - echo ' |
|
53 | + if ($column['selected']) { |
|
54 | + echo ' |
|
53 | 55 | <th scope="col" class="', $key, isset($column['class']) ? ' ' . $column['class'] : '', ' selected" style="width: auto;"' . (isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '') . '> |
54 | 56 | <a href="' . $column['href'] . '" rel="nofollow">' . $column['label'] . '</a><span class="generic_icons sort_' . $context['sort_direction'] . '"></span></th>'; |
57 | + } |
|
55 | 58 | |
56 | 59 | // This is just some column... show the link and be done with it. |
57 | - else |
|
58 | - echo ' |
|
60 | + else { |
|
61 | + echo ' |
|
59 | 62 | <th scope="col" class="', $key, isset($column['class']) ? ' ' . $column['class'] : '', '"', isset($column['width']) ? ' style="width: ' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '> |
60 | 63 | ', $column['link'], '</th>'; |
64 | + } |
|
61 | 65 | } |
62 | 66 | |
63 | 67 | echo ' |
@@ -77,9 +81,10 @@ discard block |
||
77 | 81 | </td> |
78 | 82 | <td class="lefttext">', $member['link'], '</td>'; |
79 | 83 | |
80 | - if (!isset($context['disabled_fields']['website'])) |
|
81 | - echo ' |
|
84 | + if (!isset($context['disabled_fields']['website'])) { |
|
85 | + echo ' |
|
82 | 86 | <td class="centertext website_url">', $member['website']['url'] != '' ? '<a href="' . $member['website']['url'] . '" target="_blank" rel="noopener"><span class="generic_icons www" title="' . $member['website']['title'] . '"></span></a>' : '', '</td>'; |
87 | + } |
|
83 | 88 | |
84 | 89 | // Group and date. |
85 | 90 | echo ' |
@@ -92,32 +97,35 @@ discard block |
||
92 | 97 | <td class="centertext" style="white-space: nowrap; width: 15px">', $member['posts'], '</td> |
93 | 98 | <td class="centertext statsbar" style="width: 120px">'; |
94 | 99 | |
95 | - if (!empty($member['post_percent'])) |
|
96 | - echo ' |
|
100 | + if (!empty($member['post_percent'])) { |
|
101 | + echo ' |
|
97 | 102 | <div class="bar" style="width: ', $member['post_percent'] + 4, 'px;"> |
98 | 103 | <div style="width: ', $member['post_percent'], 'px;"></div> |
99 | 104 | </div>'; |
105 | + } |
|
100 | 106 | |
101 | 107 | echo ' |
102 | 108 | </td>'; |
103 | 109 | } |
104 | 110 | |
105 | 111 | // Show custom fields marked to be shown here |
106 | - if (!empty($context['custom_profile_fields']['columns'])) |
|
107 | - foreach ($context['custom_profile_fields']['columns'] as $key => $column) |
|
112 | + if (!empty($context['custom_profile_fields']['columns'])) { |
|
113 | + foreach ($context['custom_profile_fields']['columns'] as $key => $column) |
|
108 | 114 | echo ' |
109 | 115 | <td class="righttext">', $member['options'][$key], '</td>'; |
116 | + } |
|
110 | 117 | |
111 | 118 | echo ' |
112 | 119 | </tr>'; |
113 | 120 | } |
114 | 121 | } |
115 | 122 | // No members? |
116 | - else |
|
117 | - echo ' |
|
123 | + else { |
|
124 | + echo ' |
|
118 | 125 | <tr> |
119 | 126 | <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td> |
120 | 127 | </tr>'; |
128 | + } |
|
121 | 129 | |
122 | 130 | echo ' |
123 | 131 | </tbody> |
@@ -130,11 +138,12 @@ discard block |
||
130 | 138 | <div class="pagelinks floatleft">', $context['page_index'], '</div>'; |
131 | 139 | |
132 | 140 | // If it is displaying the result of a search show a "search again" link to edit their criteria. |
133 | - if (isset($context['old_search'])) |
|
134 | - echo ' |
|
141 | + if (isset($context['old_search'])) { |
|
142 | + echo ' |
|
135 | 143 | <div class="buttonlist floatright"> |
136 | 144 | <a class="button" href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a> |
137 | 145 | </div>'; |
146 | + } |
|
138 | 147 | echo ' |
139 | 148 | </div> |
140 | 149 | </div><!-- #memberlist -->'; |
@@ -174,12 +183,13 @@ discard block |
||
174 | 183 | <dd> |
175 | 184 | <ul>'; |
176 | 185 | |
177 | - foreach ($context['search_fields'] as $id => $title) |
|
178 | - echo ' |
|
186 | + foreach ($context['search_fields'] as $id => $title) { |
|
187 | + echo ' |
|
179 | 188 | <li> |
180 | 189 | <input type="checkbox" name="fields[]" id="fields-', $id, '" value="', $id, '"', in_array($id, $context['search_defaults']) ? ' checked' : '', '> |
181 | 190 | <label for="fields-', $id, '">', $title, '</label> |
182 | 191 | </li>'; |
192 | + } |
|
183 | 193 | |
184 | 194 | echo ' |
185 | 195 | </ul> |