@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $returns = array(); |
| 43 | 43 | while ($row = $db->fetch_assoc($request)) |
| 44 | - $returns[$row['derived_from']][] = $row; |
|
| 44 | + { |
|
| 45 | + $returns[$row['derived_from']][] = $row; |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | return $returns; |
| 47 | 49 | } |
@@ -72,7 +74,9 @@ discard block |
||
| 72 | 74 | |
| 73 | 75 | $returns = array(); |
| 74 | 76 | while ($row = $db->fetch_assoc($request)) |
| 75 | - $returns = $row; |
|
| 77 | + { |
|
| 78 | + $returns = $row; |
|
| 79 | + } |
|
| 76 | 80 | |
| 77 | 81 | return $returns; |
| 78 | 82 | } |
@@ -46,7 +46,9 @@ discard block |
||
| 46 | 46 | ); |
| 47 | 47 | $boards = array(); |
| 48 | 48 | while ($row = $db->fetch_assoc($request)) |
| 49 | - $boards[] = $row; |
|
| 49 | + { |
|
| 50 | + $boards[] = $row; |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | return $boards; |
| 52 | 54 | } |
@@ -83,7 +85,9 @@ discard block |
||
| 83 | 85 | ); |
| 84 | 86 | $member_groups = array(); |
| 85 | 87 | while ($row = $db->fetch_assoc($request)) |
| 86 | - $member_groups[$row['id_group']] = $row['group_name']; |
|
| 88 | + { |
|
| 89 | + $member_groups[$row['id_group']] = $row['group_name']; |
|
| 90 | + } |
|
| 87 | 91 | $db->free_result($request); |
| 88 | 92 | |
| 89 | 93 | return $member_groups; |
@@ -118,7 +122,9 @@ discard block |
||
| 118 | 122 | ) |
| 119 | 123 | ); |
| 120 | 124 | while ($row = $db->fetch_assoc($request)) |
| 121 | - $board_permissions[] = $row; |
|
| 125 | + { |
|
| 126 | + $board_permissions[] = $row; |
|
| 127 | + } |
|
| 122 | 128 | |
| 123 | 129 | $db->free_result($request); |
| 124 | 130 | |
@@ -168,7 +174,9 @@ discard block |
||
| 168 | 174 | ), |
| 169 | 175 | ); |
| 170 | 176 | while ($row = $db->fetch_assoc($request)) |
| 171 | - $rows[] = $row; |
|
| 177 | + { |
|
| 178 | + $rows[] = $row; |
|
| 179 | + } |
|
| 172 | 180 | $db->free_result($request); |
| 173 | 181 | |
| 174 | 182 | return $rows; |
@@ -202,7 +210,9 @@ discard block |
||
| 202 | 210 | |
| 203 | 211 | $perms = array(); |
| 204 | 212 | while ($row = $db->fetch_assoc($request)) |
| 205 | - $perms[] = $row; |
|
| 213 | + { |
|
| 214 | + $perms[] = $row; |
|
| 215 | + } |
|
| 206 | 216 | $db->free_result($request); |
| 207 | 217 | |
| 208 | 218 | return $perms; |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | 'value' => $txt['mc_unapproved_attach_poster'], |
| 376 | 376 | ), |
| 377 | 377 | 'data' => array( |
| 378 | - 'function' => function ($data) { |
|
| 378 | + 'function' => function($data) { |
|
| 379 | 379 | return $data['poster']['link']; |
| 380 | 380 | }, |
| 381 | 381 | ), |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | 'value' => $txt['post'], |
| 405 | 405 | ), |
| 406 | 406 | 'data' => array( |
| 407 | - 'function' => function ($data) { |
|
| 407 | + 'function' => function($data) { |
|
| 408 | 408 | global $modSettings; |
| 409 | 409 | |
| 410 | 410 | return '<a href="' . $data['message']['href'] . '">' . Util::shorten_text($data['message']['subject'], !empty($modSettings['subject_length']) ? $modSettings['subject_length'] : 24) . '</a>'; |
@@ -79,12 +79,17 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | if ($approve_boards == array(0)) |
| 82 | - $approve_query = ''; |
|
| 82 | + { |
|
| 83 | + $approve_query = ''; |
|
| 84 | + } |
|
| 83 | 85 | elseif (!empty($approve_boards)) |
| 84 | - $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
| 86 | + { |
|
| 87 | + $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
| 88 | + } |
|
| 85 | 89 | // Nada, zip, etc... |
| 86 | - else |
|
| 87 | - $approve_query = ' AND 1=0'; |
|
| 90 | + else { |
|
| 91 | + $approve_query = ' AND 1=0'; |
|
| 92 | + } |
|
| 88 | 93 | |
| 89 | 94 | // We also need to know where we can delete topics and/or replies to. |
| 90 | 95 | if ($context['current_view'] === 'topics') |
@@ -105,19 +110,29 @@ discard block |
||
| 105 | 110 | |
| 106 | 111 | // Check if we have something to do? |
| 107 | 112 | if (isset($this->_req->query->approve)) |
| 108 | - $toAction[] = (int) $this->_req->query->approve; |
|
| 113 | + { |
|
| 114 | + $toAction[] = (int) $this->_req->query->approve; |
|
| 115 | + } |
|
| 109 | 116 | // Just a deletion? |
| 110 | 117 | elseif (isset($this->_req->query->delete)) |
| 111 | - $toAction[] = (int) $this->_req->query->delete; |
|
| 118 | + { |
|
| 119 | + $toAction[] = (int) $this->_req->query->delete; |
|
| 120 | + } |
|
| 112 | 121 | // Lots of approvals? |
| 113 | 122 | elseif (isset($this->_req->post->item)) |
| 114 | - $toAction = array_map('intval', $this->_req->post->item); |
|
| 123 | + { |
|
| 124 | + $toAction = array_map('intval', $this->_req->post->item); |
|
| 125 | + } |
|
| 115 | 126 | |
| 116 | 127 | // What are we actually doing. |
| 117 | 128 | if (isset($this->_req->query->approve) || (isset($this->_req->post->do) && $this->_req->post->do === 'approve')) |
| 118 | - $curAction = 'approve'; |
|
| 129 | + { |
|
| 130 | + $curAction = 'approve'; |
|
| 131 | + } |
|
| 119 | 132 | elseif (isset($this->_req->query->delete) || (isset($this->_req->post->do) && $this->_req->post->do === 'delete')) |
| 120 | - $curAction = 'delete'; |
|
| 133 | + { |
|
| 134 | + $curAction = 'delete'; |
|
| 135 | + } |
|
| 121 | 136 | |
| 122 | 137 | // Right, so we have something to do? |
| 123 | 138 | if (!empty($toAction) && isset($curAction)) |
@@ -153,25 +168,35 @@ discard block |
||
| 153 | 168 | { |
| 154 | 169 | // If it's not within what our view is ignore it... |
| 155 | 170 | if (($row['id_msg'] == $row['id_first_msg'] && $context['current_view'] !== 'topics') || ($row['id_msg'] != $row['id_first_msg'] && $context['current_view'] !== 'replies')) |
| 156 | - continue; |
|
| 171 | + { |
|
| 172 | + continue; |
|
| 173 | + } |
|
| 157 | 174 | |
| 158 | 175 | $can_add = false; |
| 159 | 176 | |
| 160 | 177 | // If we're approving this is simple. |
| 161 | 178 | if ($curAction === 'approve' && ($any_array == array(0) || in_array($row['id_board'], $any_array))) |
| 162 | - $can_add = true; |
|
| 179 | + { |
|
| 180 | + $can_add = true; |
|
| 181 | + } |
|
| 163 | 182 | // Delete requires more permission checks... |
| 164 | 183 | elseif ($curAction === 'delete') |
| 165 | 184 | { |
| 166 | 185 | // Own post is easy! |
| 167 | 186 | if ($row['id_member'] == $user_info['id'] && ($delete_own_boards == array(0) || in_array($row['id_board'], $delete_own_boards))) |
| 168 | - $can_add = true; |
|
| 187 | + { |
|
| 188 | + $can_add = true; |
|
| 189 | + } |
|
| 169 | 190 | // Is it a reply to their own topic? |
| 170 | 191 | elseif ($row['id_member'] == $row['id_member_started'] && $row['id_msg'] != $row['id_first_msg'] && ($delete_own_replies == array(0) || in_array($row['id_board'], $delete_own_replies))) |
| 171 | - $can_add = true; |
|
| 192 | + { |
|
| 193 | + $can_add = true; |
|
| 194 | + } |
|
| 172 | 195 | // Someone else's? |
| 173 | 196 | elseif ($row['id_member'] != $user_info['id'] && ($delete_any_boards == array(0) || in_array($row['id_board'], $delete_any_boards))) |
| 174 | - $can_add = true; |
|
| 197 | + { |
|
| 198 | + $can_add = true; |
|
| 199 | + } |
|
| 175 | 200 | } |
| 176 | 201 | |
| 177 | 202 | if ($can_add) |
@@ -192,9 +217,12 @@ discard block |
||
| 192 | 217 | if (!empty($toAction)) |
| 193 | 218 | { |
| 194 | 219 | if ($curAction === 'approve') |
| 195 | - approveMessages($toAction, $details, $context['current_view']); |
|
| 196 | - else |
|
| 197 | - removeMessages($toAction, $details, $context['current_view']); |
|
| 220 | + { |
|
| 221 | + approveMessages($toAction, $details, $context['current_view']); |
|
| 222 | + } |
|
| 223 | + else { |
|
| 224 | + removeMessages($toAction, $details, $context['current_view']); |
|
| 225 | + } |
|
| 198 | 226 | |
| 199 | 227 | Cache::instance()->remove('num_menu_errors'); |
| 200 | 228 | } |
@@ -274,29 +302,44 @@ discard block |
||
| 274 | 302 | $approve_boards = !empty($user_info['mod_cache']['ap']) ? $user_info['mod_cache']['ap'] : boardsAllowedTo('approve_posts'); |
| 275 | 303 | |
| 276 | 304 | if ($approve_boards == array(0)) |
| 277 | - $approve_query = ''; |
|
| 305 | + { |
|
| 306 | + $approve_query = ''; |
|
| 307 | + } |
|
| 278 | 308 | elseif (!empty($approve_boards)) |
| 279 | - $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
| 280 | - else |
|
| 281 | - $approve_query = ' AND 0'; |
|
| 309 | + { |
|
| 310 | + $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
| 311 | + } |
|
| 312 | + else { |
|
| 313 | + $approve_query = ' AND 0'; |
|
| 314 | + } |
|
| 282 | 315 | |
| 283 | 316 | // Get together the array of things to act on, if any. |
| 284 | 317 | $attachments = array(); |
| 285 | 318 | if (isset($this->_req->query->approve)) |
| 286 | - $attachments[] = (int) $this->_req->query->approve; |
|
| 319 | + { |
|
| 320 | + $attachments[] = (int) $this->_req->query->approve; |
|
| 321 | + } |
|
| 287 | 322 | elseif (isset($this->_req->query->delete)) |
| 288 | - $attachments[] = (int) $this->_req->query->delete; |
|
| 323 | + { |
|
| 324 | + $attachments[] = (int) $this->_req->query->delete; |
|
| 325 | + } |
|
| 289 | 326 | elseif (isset($this->_req->post->item)) |
| 290 | 327 | { |
| 291 | 328 | foreach ($this->_req->post->item as $item) |
| 292 | - $attachments[] = (int) $item; |
|
| 329 | + { |
|
| 330 | + $attachments[] = (int) $item; |
|
| 331 | + } |
|
| 293 | 332 | } |
| 294 | 333 | |
| 295 | 334 | // Are we approving or deleting? |
| 296 | 335 | if (isset($this->_req->query->approve) || (isset($this->_req->post->do) && $this->_req->post->do === 'approve')) |
| 297 | - $curAction = 'approve'; |
|
| 336 | + { |
|
| 337 | + $curAction = 'approve'; |
|
| 338 | + } |
|
| 298 | 339 | elseif (isset($this->_req->query->delete) || (isset($this->_req->post->do) && $this->_req->post->do === 'delete')) |
| 299 | - $curAction = 'delete'; |
|
| 340 | + { |
|
| 341 | + $curAction = 'delete'; |
|
| 342 | + } |
|
| 300 | 343 | |
| 301 | 344 | // Something to do, let's do it! |
| 302 | 345 | if (!empty($attachments) && isset($curAction)) |
@@ -313,9 +356,12 @@ discard block |
||
| 313 | 356 | if (!empty($attachments)) |
| 314 | 357 | { |
| 315 | 358 | if ($curAction === 'approve') |
| 316 | - approveAttachments($attachments); |
|
| 317 | - else |
|
| 318 | - removeAttachments(array('id_attach' => $attachments, 'do_logging' => true)); |
|
| 359 | + { |
|
| 360 | + approveAttachments($attachments); |
|
| 361 | + } |
|
| 362 | + else { |
|
| 363 | + removeAttachments(array('id_attach' => $attachments, 'do_logging' => true)); |
|
| 364 | + } |
|
| 319 | 365 | |
| 320 | 366 | Cache::instance()->remove('num_menu_errors'); |
| 321 | 367 | } |
@@ -489,13 +535,17 @@ discard block |
||
| 489 | 535 | |
| 490 | 536 | // If it's the first in a topic then the whole topic gets approved! |
| 491 | 537 | if ($message_info['id_first_msg'] == $current_msg) |
| 492 | - approveTopics($topic, !$message_info['approved'], $message_info['id_member_started'] != $user_info['id']); |
|
| 538 | + { |
|
| 539 | + approveTopics($topic, !$message_info['approved'], $message_info['id_member_started'] != $user_info['id']); |
|
| 540 | + } |
|
| 493 | 541 | else |
| 494 | 542 | { |
| 495 | 543 | approvePosts($current_msg, !$message_info['approved']); |
| 496 | 544 | |
| 497 | 545 | if ($message_info['id_member'] != $user_info['id']) |
| 498 | - logAction(($message_info['approved'] ? 'un' : '') . 'approve', array('topic' => $topic, 'subject' => $message_info['subject'], 'member' => $message_info['id_member'], 'board' => $board)); |
|
| 546 | + { |
|
| 547 | + logAction(($message_info['approved'] ? 'un' : '') . 'approve', array('topic' => $topic, 'subject' => $message_info['subject'], 'member' => $message_info['id_member'], 'board' => $board)); |
|
| 548 | + } |
|
| 499 | 549 | } |
| 500 | 550 | |
| 501 | 551 | Cache::instance()->remove('num_menu_errors'); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | 'value' => $txt['name'], |
| 123 | 123 | ), |
| 124 | 124 | 'data' => array( |
| 125 | - 'function' => function ($rowData) use ($base_url) { |
|
| 125 | + 'function' => function($rowData) use ($base_url) { |
|
| 126 | 126 | global $scripturl; |
| 127 | 127 | |
| 128 | 128 | // Since the moderator group has no explicit members, no link is needed. |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | 'value' => $txt['membergroups_icons'], |
| 153 | 153 | ), |
| 154 | 154 | 'data' => array( |
| 155 | - 'function' => function ($rowData) { |
|
| 155 | + 'function' => function($rowData) { |
|
| 156 | 156 | global $settings; |
| 157 | 157 | |
| 158 | 158 | if (!empty($rowData['icons'][0]) && !empty($rowData['icons'][1])) |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | 'value' => $txt['moderators'], |
| 172 | 172 | ), |
| 173 | 173 | 'data' => array( |
| 174 | - 'function' => function ($group) { |
|
| 174 | + 'function' => function($group) { |
|
| 175 | 175 | global $txt; |
| 176 | 176 | |
| 177 | 177 | return empty($group['moderators']) ? '<em>' . $txt['membergroups_new_copy_none'] . '</em>' : implode(', ', $group['moderators']); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | 'value' => $txt['membergroups_members_top'], |
| 184 | 184 | ), |
| 185 | 185 | 'data' => array( |
| 186 | - 'function' => function ($rowData) { |
|
| 186 | + 'function' => function($rowData) { |
|
| 187 | 187 | global $txt; |
| 188 | 188 | |
| 189 | 189 | // No explicit members for the moderator group. |
@@ -91,9 +91,11 @@ discard block |
||
| 91 | 91 | $context['page_title'] = $txt['viewing_groups']; |
| 92 | 92 | $current_area = isset($context['admin_menu_name']) ? $context['admin_menu_name'] : (isset($context['moderation_menu_name']) ? $context['moderation_menu_name'] : ''); |
| 93 | 93 | if (!empty($current_area)) |
| 94 | - $context[$current_area]['tab_data'] = array( |
|
| 94 | + { |
|
| 95 | + $context[$current_area]['tab_data'] = array( |
|
| 95 | 96 | 'title' => $txt['mc_group_requests'], |
| 96 | 97 | ); |
| 98 | + } |
|
| 97 | 99 | |
| 98 | 100 | $base_url = $scripturl . (isset($context['admin_menu_name']) ? '?action=admin;area=membergroups;sa=members' : (isset($context['moderation_menu_name']) ? '?action=moderate;area=viewgroups;sa=members' : '?action=groups;sa=members')); |
| 99 | 101 | |
@@ -123,7 +125,9 @@ discard block |
||
| 123 | 125 | |
| 124 | 126 | // Since the moderator group has no explicit members, no link is needed. |
| 125 | 127 | if ($rowData['id_group'] == 3) |
| 126 | - $group_name = $rowData['group_name']; |
|
| 128 | + { |
|
| 129 | + $group_name = $rowData['group_name']; |
|
| 130 | + } |
|
| 127 | 131 | else |
| 128 | 132 | { |
| 129 | 133 | $group_name = sprintf('<a href="%1$s;group=%2$d">%3$s</a>', '' . $base_url . '', $rowData['id_group'], $rowData['group_name_color']); |
@@ -131,9 +135,13 @@ discard block |
||
| 131 | 135 | |
| 132 | 136 | // Add a help option for moderator and administrator. |
| 133 | 137 | if ($rowData['id_group'] == 1) |
| 134 | - $group_name .= sprintf(' (<a href="%1$s?action=quickhelp;help=membergroup_administrator" onclick="return reqOverlayDiv(this.href);" class="helpicon i-help"></a>)', $scripturl); |
|
| 138 | + { |
|
| 139 | + $group_name .= sprintf(' (<a href="%1$s?action=quickhelp;help=membergroup_administrator" onclick="return reqOverlayDiv(this.href);" class="helpicon i-help"></a>)', $scripturl); |
|
| 140 | + } |
|
| 135 | 141 | elseif ($rowData['id_group'] == 3) |
| 136 | - $group_name .= sprintf(' (<a href="%1$s?action=quickhelp;help=membergroup_moderator" onclick="return reqOverlayDiv(this.href);" class="helpicon i-help"></a>)', $scripturl); |
|
| 142 | + { |
|
| 143 | + $group_name .= sprintf(' (<a href="%1$s?action=quickhelp;help=membergroup_moderator" onclick="return reqOverlayDiv(this.href);" class="helpicon i-help"></a>)', $scripturl); |
|
| 144 | + } |
|
| 137 | 145 | |
| 138 | 146 | return $group_name; |
| 139 | 147 | }, |
@@ -152,9 +160,12 @@ discard block |
||
| 152 | 160 | global $settings; |
| 153 | 161 | |
| 154 | 162 | if (!empty($rowData['icons'][0]) && !empty($rowData['icons'][1])) |
| 155 | - return str_repeat('<img src="' . $settings['images_url'] . '/group_icons/' . $rowData['icons'][1] . '" alt="*" />', $rowData['icons'][0]); |
|
| 156 | - else |
|
| 157 | - return ''; |
|
| 163 | + { |
|
| 164 | + return str_repeat('<img src="' . $settings['images_url'] . '/group_icons/' . $rowData['icons'][1] . '" alt="*" />', $rowData['icons'][0]); |
|
| 165 | + } |
|
| 166 | + else { |
|
| 167 | + return ''; |
|
| 168 | + } |
|
| 158 | 169 | }, |
| 159 | 170 | ), |
| 160 | 171 | 'sort' => array( |
@@ -232,7 +243,9 @@ discard block |
||
| 232 | 243 | |
| 233 | 244 | // No browsing of guests, membergroup 0 or moderators or non-existing groups. |
| 234 | 245 | if ($context['group'] === false || in_array($current_group, array(-1, 0, 3))) |
| 235 | - throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 246 | + { |
|
| 247 | + throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 248 | + } |
|
| 236 | 249 | |
| 237 | 250 | $context['group']['id'] = $context['group']['id_group']; |
| 238 | 251 | $context['group']['name'] = $context['group']['group_name']; |
@@ -265,19 +278,27 @@ discard block |
||
| 265 | 278 | ); |
| 266 | 279 | |
| 267 | 280 | if ($user_info['id'] == $id_member && $context['group']['group_type'] != 1) |
| 268 | - $context['group']['can_moderate'] = true; |
|
| 281 | + { |
|
| 282 | + $context['group']['can_moderate'] = true; |
|
| 283 | + } |
|
| 269 | 284 | } |
| 270 | 285 | |
| 271 | 286 | // If this group is hidden then it can only "exist" if the user can moderate it! |
| 272 | 287 | if ($context['group']['hidden'] && !$context['group']['can_moderate']) |
| 273 | - throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 288 | + { |
|
| 289 | + throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 290 | + } |
|
| 274 | 291 | |
| 275 | 292 | // You can only assign membership if you are the moderator and/or can manage groups! |
| 276 | 293 | if (!$context['group']['can_moderate']) |
| 277 | - $context['group']['assignable'] = 0; |
|
| 294 | + { |
|
| 295 | + $context['group']['assignable'] = 0; |
|
| 296 | + } |
|
| 278 | 297 | // Non-admins cannot assign admins. |
| 279 | 298 | elseif ($context['group']['id'] == 1 && !allowedTo('admin_forum')) |
| 280 | - $context['group']['assignable'] = 0; |
|
| 299 | + { |
|
| 300 | + $context['group']['assignable'] = 0; |
|
| 301 | + } |
|
| 281 | 302 | |
| 282 | 303 | // Removing member from group? |
| 283 | 304 | if (isset($this->_req->post->remove) |
@@ -314,7 +335,9 @@ discard block |
||
| 314 | 335 | $member_names[$index] = trim(Util::strtolower($member_names[$index])); |
| 315 | 336 | |
| 316 | 337 | if (strlen($member_names[$index]) == 0) |
| 317 | - unset($member_names[$index]); |
|
| 338 | + { |
|
| 339 | + unset($member_names[$index]); |
|
| 340 | + } |
|
| 318 | 341 | } |
| 319 | 342 | |
| 320 | 343 | // Any members passed by ID? |
@@ -324,7 +347,9 @@ discard block |
||
| 324 | 347 | foreach ($this->_req->post->member_add as $id) |
| 325 | 348 | { |
| 326 | 349 | if ($id > 0) |
| 327 | - $member_ids[] = (int) $id; |
|
| 350 | + { |
|
| 351 | + $member_ids[] = (int) $id; |
|
| 352 | + } |
|
| 328 | 353 | } |
| 329 | 354 | } |
| 330 | 355 | |
@@ -347,7 +372,9 @@ discard block |
||
| 347 | 372 | |
| 348 | 373 | // Do the updates... |
| 349 | 374 | if (!empty($members)) |
| 350 | - addMembersToGroup($members, $current_group, $context['group']['hidden'] ? 'only_additional' : 'auto', true); |
|
| 375 | + { |
|
| 376 | + addMembersToGroup($members, $current_group, $context['group']['hidden'] ? 'only_additional' : 'auto', true); |
|
| 377 | + } |
|
| 351 | 378 | } |
| 352 | 379 | |
| 353 | 380 | // Sort out the sorting! |
@@ -374,9 +401,12 @@ discard block |
||
| 374 | 401 | |
| 375 | 402 | // The where on the query is interesting. Non-moderators should only see people who are in this group as primary. |
| 376 | 403 | if ($context['group']['can_moderate']) |
| 377 | - $where = $context['group']['is_post_group'] ? 'in_post_group' : 'in_group'; |
|
| 378 | - else |
|
| 379 | - $where = $context['group']['is_post_group'] ? 'in_post_group' : 'in_group_no_add'; |
|
| 404 | + { |
|
| 405 | + $where = $context['group']['is_post_group'] ? 'in_post_group' : 'in_group'; |
|
| 406 | + } |
|
| 407 | + else { |
|
| 408 | + $where = $context['group']['is_post_group'] ? 'in_post_group' : 'in_group_no_add'; |
|
| 409 | + } |
|
| 380 | 410 | |
| 381 | 411 | // Count members of the group. |
| 382 | 412 | $context['total_members'] = countMembersBy($where, array($where => $current_group)); |
@@ -393,7 +423,9 @@ discard block |
||
| 393 | 423 | |
| 394 | 424 | // Italicize the online note if they aren't activated. |
| 395 | 425 | if ($row['is_activated'] % 10 != 1) |
| 396 | - $last_online = '<em title="' . $txt['not_activated'] . '">' . $last_online . '</em>'; |
|
| 426 | + { |
|
| 427 | + $last_online = '<em title="' . $txt['not_activated'] . '">' . $last_online . '</em>'; |
|
| 428 | + } |
|
| 397 | 429 | |
| 398 | 430 | $context['members'][$id] = array( |
| 399 | 431 | 'id' => $row['id_member'], |
@@ -409,7 +441,9 @@ discard block |
||
| 409 | 441 | } |
| 410 | 442 | |
| 411 | 443 | if (!empty($context['group']['assignable'])) |
| 412 | - loadJavascriptFile('suggest.js', array('defer' => true)); |
|
| 444 | + { |
|
| 445 | + loadJavascriptFile('suggest.js', array('defer' => true)); |
|
| 446 | + } |
|
| 413 | 447 | |
| 414 | 448 | // Select the template. |
| 415 | 449 | $context['sub_template'] = 'group_members'; |
@@ -433,7 +467,9 @@ discard block |
||
| 433 | 467 | |
| 434 | 468 | // Verify we can be here. |
| 435 | 469 | if ($user_info['mod_cache']['gq'] == '0=1') |
| 436 | - isAllowedTo('manage_membergroups'); |
|
| 470 | + { |
|
| 471 | + isAllowedTo('manage_membergroups'); |
|
| 472 | + } |
|
| 437 | 473 | |
| 438 | 474 | // Normally, we act normally... |
| 439 | 475 | $where = $user_info['mod_cache']['gq'] == '1=1' || $user_info['mod_cache']['gq'] == '0=1' ? $user_info['mod_cache']['gq'] : 'lgr.' . $user_info['mod_cache']['gq']; |
@@ -493,8 +529,10 @@ discard block |
||
| 493 | 529 | { |
| 494 | 530 | // Sanity check! |
| 495 | 531 | foreach ($groups['add'] as $key => $value) |
| 496 | - if ($value == 0 || trim($value) == '') |
|
| 532 | + { |
|
| 533 | + if ($value == 0 || trim($value) == '') |
|
| 497 | 534 | unset($groups['add'][$key]); |
| 535 | + } |
|
| 498 | 536 | |
| 499 | 537 | assignGroupsToMember($id, $groups['primary'], $groups['add']); |
| 500 | 538 | } |
@@ -525,7 +563,9 @@ discard block |
||
| 525 | 563 | ); |
| 526 | 564 | |
| 527 | 565 | if (!empty($custom_reason)) |
| 528 | - $replacements['REASON'] = $custom_reason; |
|
| 566 | + { |
|
| 567 | + $replacements['REASON'] = $custom_reason; |
|
| 568 | + } |
|
| 529 | 569 | |
| 530 | 570 | $emaildata = loadEmailTemplate(empty($custom_reason) ? 'mc_group_reject' : 'mc_group_reject_reason', $replacements, $email['language']); |
| 531 | 571 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | 'value' => $txt['admin_edit_news'], |
| 196 | 196 | ), |
| 197 | 197 | 'data' => array( |
| 198 | - 'function' => function ($news) { |
|
| 198 | + 'function' => function($news) { |
|
| 199 | 199 | return '<textarea class="" id="data_' . $news['id'] . '" rows="3" name="news[]">' . $news['unparsed'] . '</textarea> |
| 200 | 200 | <br /> |
| 201 | 201 | <div id="preview_' . $news['id'] . '"></div>'; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | 'value' => $txt['preview'], |
| 209 | 209 | ), |
| 210 | 210 | 'data' => array( |
| 211 | - 'function' => function ($news) { |
|
| 211 | + 'function' => function($news) { |
|
| 212 | 212 | return '<div id="box_preview_' . $news['id'] . '">' . $news['parsed'] . '</div>'; |
| 213 | 213 | }, |
| 214 | 214 | 'class' => 'newspreview', |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | 'class' => 'centertext', |
| 221 | 221 | ), |
| 222 | 222 | 'data' => array( |
| 223 | - 'function' => function ($news) { |
|
| 223 | + 'function' => function($news) { |
|
| 224 | 224 | if (is_numeric($news['id'])) |
| 225 | 225 | return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '" class="input_check" />'; |
| 226 | 226 | else |
@@ -106,7 +106,9 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // Force the right area... |
| 108 | 108 | if (substr($subAction, 0, 7) === 'mailing') |
| 109 | - $context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers'; |
|
| 109 | + { |
|
| 110 | + $context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers'; |
|
| 111 | + } |
|
| 110 | 112 | |
| 111 | 113 | // Call the right function for this sub-action. |
| 112 | 114 | $action->dispatch($subAction); |
@@ -141,8 +143,10 @@ discard block |
||
| 141 | 143 | |
| 142 | 144 | // Remove the items that were selected. |
| 143 | 145 | foreach ($temp_news as $i => $news) |
| 144 | - if (in_array($i, $this->_req->post->remove)) |
|
| 146 | + { |
|
| 147 | + if (in_array($i, $this->_req->post->remove)) |
|
| 145 | 148 | unset($temp_news[$i]); |
| 149 | + } |
|
| 146 | 150 | |
| 147 | 151 | // Update the database. |
| 148 | 152 | updateSettings(array('news' => implode("\n", $temp_news))); |
@@ -157,7 +161,9 @@ discard block |
||
| 157 | 161 | foreach ($this->_req->post->news as $i => $news) |
| 158 | 162 | { |
| 159 | 163 | if (trim($news) == '') |
| 160 | - unset($this->_req->post->news[$i]); |
|
| 164 | + { |
|
| 165 | + unset($this->_req->post->news[$i]); |
|
| 166 | + } |
|
| 161 | 167 | else |
| 162 | 168 | { |
| 163 | 169 | $this->_req->post->news[$i] = Util::htmlspecialchars($this->_req->post->news[$i], ENT_QUOTES); |
@@ -216,9 +222,12 @@ discard block |
||
| 216 | 222 | 'data' => array( |
| 217 | 223 | 'function' => function ($news) { |
| 218 | 224 | if (is_numeric($news['id'])) |
| 219 | - return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '" class="input_check" />'; |
|
| 220 | - else |
|
| 221 | - return ''; |
|
| 225 | + { |
|
| 226 | + return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '" class="input_check" />'; |
|
| 227 | + } |
|
| 228 | + else { |
|
| 229 | + return ''; |
|
| 230 | + } |
|
| 222 | 231 | }, |
| 223 | 232 | 'class' => 'centertext', |
| 224 | 233 | ), |
@@ -297,20 +306,27 @@ discard block |
||
| 297 | 306 | // All of the members in post based and member based groups |
| 298 | 307 | $pg = array(); |
| 299 | 308 | foreach ($allgroups['postgroups'] as $postgroup) |
| 300 | - $pg[] = $postgroup['id']; |
|
| 309 | + { |
|
| 310 | + $pg[] = $postgroup['id']; |
|
| 311 | + } |
|
| 301 | 312 | |
| 302 | 313 | $mg = array(); |
| 303 | 314 | foreach ($allgroups['membergroups'] as $membergroup) |
| 304 | - $mg[] = $membergroup['id']; |
|
| 315 | + { |
|
| 316 | + $mg[] = $membergroup['id']; |
|
| 317 | + } |
|
| 305 | 318 | |
| 306 | 319 | // How many are in each group |
| 307 | 320 | $mem_groups = membersInGroups($pg, $mg, true, true); |
| 308 | 321 | foreach ($mem_groups as $id_group => $member_count) |
| 309 | 322 | { |
| 310 | 323 | if (isset($groups[$id_group]['member_count'])) |
| 311 | - $groups[$id_group]['member_count'] += $member_count; |
|
| 312 | - else |
|
| 313 | - $groups[$id_group]['member_count'] = $member_count; |
|
| 324 | + { |
|
| 325 | + $groups[$id_group]['member_count'] += $member_count; |
|
| 326 | + } |
|
| 327 | + else { |
|
| 328 | + $groups[$id_group]['member_count'] = $member_count; |
|
| 329 | + } |
|
| 314 | 330 | } |
| 315 | 331 | |
| 316 | 332 | // Generate the include and exclude group select lists for the template |
@@ -326,7 +342,9 @@ discard block |
||
| 326 | 342 | ); |
| 327 | 343 | |
| 328 | 344 | foreach ($groups as $group) |
| 329 | - $groups[$group['id']]['status'] = 'off'; |
|
| 345 | + { |
|
| 346 | + $groups[$group['id']]['status'] = 'off'; |
|
| 347 | + } |
|
| 330 | 348 | |
| 331 | 349 | $context['exclude_groups'] = array( |
| 332 | 350 | 'select_group' => $txt['admin_newsletters_exclude_groups'], |
@@ -417,9 +435,12 @@ discard block |
||
| 417 | 435 | foreach ($mods as $row) |
| 418 | 436 | { |
| 419 | 437 | if (in_array(3, $context['recipients'])) |
| 420 | - $context['recipients']['exclude_members'][] = $row; |
|
| 421 | - else |
|
| 422 | - $context['recipients']['members'][] = $row; |
|
| 438 | + { |
|
| 439 | + $context['recipients']['exclude_members'][] = $row; |
|
| 440 | + } |
|
| 441 | + else { |
|
| 442 | + $context['recipients']['members'][] = $row; |
|
| 443 | + } |
|
| 423 | 444 | } |
| 424 | 445 | } |
| 425 | 446 | |
@@ -449,7 +470,9 @@ discard block |
||
| 449 | 470 | { |
| 450 | 471 | $members = array(); |
| 451 | 472 | foreach ($this->_req->post->member_list as $member_id) |
| 452 | - $members[] = (int) $member_id; |
|
| 473 | + { |
|
| 474 | + $members[] = (int) $member_id; |
|
| 475 | + } |
|
| 453 | 476 | |
| 454 | 477 | $this->_members = array_unique(array_merge($this->_members, $members)); |
| 455 | 478 | } |
@@ -459,7 +482,9 @@ discard block |
||
| 459 | 482 | { |
| 460 | 483 | $members = array(); |
| 461 | 484 | foreach ($this->_req->post->exclude_member_list as $member_id) |
| 462 | - $members[] = (int) $member_id; |
|
| 485 | + { |
|
| 486 | + $members[] = (int) $member_id; |
|
| 487 | + } |
|
| 463 | 488 | |
| 464 | 489 | $this->_exclude_members = array_unique(array_merge($this->_exclude_members, $members)); |
| 465 | 490 | } |
@@ -473,10 +498,14 @@ discard block |
||
| 473 | 498 | { |
| 474 | 499 | $toClean = array(); |
| 475 | 500 | if (!empty($this->_req->post->members)) |
| 476 | - $toClean['_members'] = 'members'; |
|
| 501 | + { |
|
| 502 | + $toClean['_members'] = 'members'; |
|
| 503 | + } |
|
| 477 | 504 | |
| 478 | 505 | if (!empty($this->_req->post->exclude_members)) |
| 479 | - $toClean['_exclude_members'] = 'exclude_members'; |
|
| 506 | + { |
|
| 507 | + $toClean['_exclude_members'] = 'exclude_members'; |
|
| 508 | + } |
|
| 480 | 509 | |
| 481 | 510 | // Manual entries found? |
| 482 | 511 | if (!empty($toClean)) |
@@ -495,9 +524,12 @@ discard block |
||
| 495 | 524 | foreach ($temp as $index => $member) |
| 496 | 525 | { |
| 497 | 526 | if (strlen(trim($member)) > 0) |
| 498 | - $temp[$index] = Util::htmlspecialchars(Util::strtolower(trim($member))); |
|
| 499 | - else |
|
| 500 | - unset($temp[$index]); |
|
| 527 | + { |
|
| 528 | + $temp[$index] = Util::htmlspecialchars(Util::strtolower(trim($member))); |
|
| 529 | + } |
|
| 530 | + else { |
|
| 531 | + unset($temp[$index]); |
|
| 532 | + } |
|
| 501 | 533 | } |
| 502 | 534 | |
| 503 | 535 | // Find the members |
@@ -545,7 +577,9 @@ discard block |
||
| 545 | 577 | |
| 546 | 578 | // If by PM's I suggest we half the above number. |
| 547 | 579 | if (!empty($this->_req->post->send_pm)) |
| 548 | - $num_at_once /= 2; |
|
| 580 | + { |
|
| 581 | + $num_at_once /= 2; |
|
| 582 | + } |
|
| 549 | 583 | |
| 550 | 584 | checkSession(); |
| 551 | 585 | |
@@ -574,7 +608,9 @@ discard block |
||
| 574 | 608 | foreach ($members as $member) |
| 575 | 609 | { |
| 576 | 610 | if ($member >= $context['start']) |
| 577 | - $context['recipients']['exclude_members'][] = (int) $member; |
|
| 611 | + { |
|
| 612 | + $context['recipients']['exclude_members'][] = (int) $member; |
|
| 613 | + } |
|
| 578 | 614 | } |
| 579 | 615 | } |
| 580 | 616 | |
@@ -585,7 +621,9 @@ discard block |
||
| 585 | 621 | foreach ($members as $member) |
| 586 | 622 | { |
| 587 | 623 | if ($member >= $context['start']) |
| 588 | - $context['recipients']['members'][] = (int) $member; |
|
| 624 | + { |
|
| 625 | + $context['recipients']['members'][] = (int) $member; |
|
| 626 | + } |
|
| 589 | 627 | } |
| 590 | 628 | } |
| 591 | 629 | |
@@ -595,13 +633,17 @@ discard block |
||
| 595 | 633 | if (is_array($this->_req->post->groups)) |
| 596 | 634 | { |
| 597 | 635 | foreach ($this->_req->post->groups as $group => $dummy) |
| 598 | - $context['recipients']['groups'][] = (int) $group; |
|
| 636 | + { |
|
| 637 | + $context['recipients']['groups'][] = (int) $group; |
|
| 638 | + } |
|
| 599 | 639 | } |
| 600 | 640 | elseif (trim($this->_req->post->groups) != '') |
| 601 | 641 | { |
| 602 | 642 | $groups = explode(',', $this->_req->post->groups); |
| 603 | 643 | foreach ($groups as $group) |
| 604 | - $context['recipients']['groups'][] = (int) $group; |
|
| 644 | + { |
|
| 645 | + $context['recipients']['groups'][] = (int) $group; |
|
| 646 | + } |
|
| 605 | 647 | } |
| 606 | 648 | } |
| 607 | 649 | |
@@ -611,13 +653,17 @@ discard block |
||
| 611 | 653 | if (is_array($this->_req->post->exclude_groups)) |
| 612 | 654 | { |
| 613 | 655 | foreach ($this->_req->post->exclude_groups as $group => $dummy) |
| 614 | - $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 656 | + { |
|
| 657 | + $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 658 | + } |
|
| 615 | 659 | } |
| 616 | 660 | elseif (trim($this->_req->post->exclude_groups) != '') |
| 617 | 661 | { |
| 618 | 662 | $groups = explode(',', $this->_req->post->exclude_groups); |
| 619 | 663 | foreach ($groups as $group) |
| 620 | - $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 664 | + { |
|
| 665 | + $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 666 | + } |
|
| 621 | 667 | } |
| 622 | 668 | } |
| 623 | 669 | |
@@ -629,18 +675,24 @@ discard block |
||
| 629 | 675 | { |
| 630 | 676 | $curmem = trim($curmem); |
| 631 | 677 | if ($curmem != '') |
| 632 | - $context['recipients']['emails'][$curmem] = $curmem; |
|
| 678 | + { |
|
| 679 | + $context['recipients']['emails'][$curmem] = $curmem; |
|
| 680 | + } |
|
| 633 | 681 | } |
| 634 | 682 | } |
| 635 | 683 | |
| 636 | 684 | // If we're only cleaning drop out here. |
| 637 | 685 | if ($clean_only) |
| 638 | - return null; |
|
| 686 | + { |
|
| 687 | + return null; |
|
| 688 | + } |
|
| 639 | 689 | |
| 640 | 690 | // Some functions we will need |
| 641 | 691 | require_once(SUBSDIR . '/Mail.subs.php'); |
| 642 | 692 | if ($context['send_pm']) |
| 643 | - require_once(SUBSDIR . '/PersonalMessage.subs.php'); |
|
| 693 | + { |
|
| 694 | + require_once(SUBSDIR . '/PersonalMessage.subs.php'); |
|
| 695 | + } |
|
| 644 | 696 | |
| 645 | 697 | // We are relying too much on writing to superglobals... |
| 646 | 698 | $base_subject = $this->_req->getPost('subject', 'strval', ''); |
@@ -655,15 +707,20 @@ discard block |
||
| 655 | 707 | { |
| 656 | 708 | // Prepare the message for HTML. |
| 657 | 709 | if (!empty($context['parse_html'])) |
| 658 | - $base_message = str_replace(array("\n", ' '), array('<br />' . "\n", ' '), $base_message); |
|
| 710 | + { |
|
| 711 | + $base_message = str_replace(array("\n", ' '), array('<br />' . "\n", ' '), $base_message); |
|
| 712 | + } |
|
| 659 | 713 | |
| 660 | 714 | // This is here to prevent spam filters from tagging this as spam. |
| 661 | 715 | if (preg_match('~\<html~i', $base_message) == 0) |
| 662 | 716 | { |
| 663 | 717 | if (preg_match('~\<body~i', $base_message) == 0) |
| 664 | - $base_message = '<html><head><title>' . $base_subject . '</title></head>' . "\n" . '<body>' . $base_message . '</body></html>'; |
|
| 665 | - else |
|
| 666 | - $base_message = '<html>' . $base_message . '</html>'; |
|
| 718 | + { |
|
| 719 | + $base_message = '<html><head><title>' . $base_subject . '</title></head>' . "\n" . '<body>' . $base_message . '</body></html>'; |
|
| 720 | + } |
|
| 721 | + else { |
|
| 722 | + $base_message = '<html>' . $base_message . '</html>'; |
|
| 723 | + } |
|
| 667 | 724 | } |
| 668 | 725 | } |
| 669 | 726 | |
@@ -719,14 +776,18 @@ discard block |
||
| 719 | 776 | { |
| 720 | 777 | // Done as many as we can? |
| 721 | 778 | if ($i >= $num_at_once) |
| 722 | - break; |
|
| 779 | + { |
|
| 780 | + break; |
|
| 781 | + } |
|
| 723 | 782 | |
| 724 | 783 | // Don't sent it twice! |
| 725 | 784 | unset($context['recipients']['emails'][$k]); |
| 726 | 785 | |
| 727 | 786 | // Dammit - can't PM emails! |
| 728 | 787 | if ($context['send_pm']) |
| 729 | - continue; |
|
| 788 | + { |
|
| 789 | + continue; |
|
| 790 | + } |
|
| 730 | 791 | |
| 731 | 792 | $to_member = array( |
| 732 | 793 | $email, |
@@ -764,7 +825,9 @@ discard block |
||
| 764 | 825 | } |
| 765 | 826 | |
| 766 | 827 | if (!empty($queryBuild)) |
| 767 | - $sendQuery .= implode(' OR ', $queryBuild); |
|
| 828 | + { |
|
| 829 | + $sendQuery .= implode(' OR ', $queryBuild); |
|
| 830 | + } |
|
| 768 | 831 | } |
| 769 | 832 | |
| 770 | 833 | if (!empty($context['recipients']['members'])) |
@@ -777,11 +840,15 @@ discard block |
||
| 777 | 840 | |
| 778 | 841 | // If we've not got a query then we must be done! |
| 779 | 842 | if ($sendQuery === '()') |
| 780 | - redirectexit('action=admin'); |
|
| 843 | + { |
|
| 844 | + redirectexit('action=admin'); |
|
| 845 | + } |
|
| 781 | 846 | |
| 782 | 847 | // Anything to exclude? |
| 783 | 848 | if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) |
| 784 | - $sendQuery .= ' AND mem.id_group != {int:regular_group}'; |
|
| 849 | + { |
|
| 850 | + $sendQuery .= ' AND mem.id_group != {int:regular_group}'; |
|
| 851 | + } |
|
| 785 | 852 | |
| 786 | 853 | if (!empty($context['recipients']['exclude_members'])) |
| 787 | 854 | { |
@@ -791,7 +858,9 @@ discard block |
||
| 791 | 858 | |
| 792 | 859 | // Force them to have it? |
| 793 | 860 | if (empty($context['email_force'])) |
| 794 | - $sendQuery .= ' AND mem.notify_announcements = {int:notify_announcements}'; |
|
| 861 | + { |
|
| 862 | + $sendQuery .= ' AND mem.notify_announcements = {int:notify_announcements}'; |
|
| 863 | + } |
|
| 795 | 864 | |
| 796 | 865 | require_once(SUBSDIR . '/News.subs.php'); |
| 797 | 866 | |
@@ -804,16 +873,21 @@ discard block |
||
| 804 | 873 | |
| 805 | 874 | // What groups are we looking at here? |
| 806 | 875 | if (empty($row['additional_groups'])) |
| 807 | - $groups = array($row['id_group'], $row['id_post_group']); |
|
| 808 | - else |
|
| 809 | - $groups = array_merge( |
|
| 876 | + { |
|
| 877 | + $groups = array($row['id_group'], $row['id_post_group']); |
|
| 878 | + } |
|
| 879 | + else { |
|
| 880 | + $groups = array_merge( |
|
| 810 | 881 | array($row['id_group'], $row['id_post_group']), |
| 811 | 882 | explode(',', $row['additional_groups']) |
| 812 | 883 | ); |
| 884 | + } |
|
| 813 | 885 | |
| 814 | 886 | // Excluded groups? |
| 815 | 887 | if (array_intersect($groups, $context['recipients']['exclude_groups'])) |
| 816 | - continue; |
|
| 888 | + { |
|
| 889 | + continue; |
|
| 890 | + } |
|
| 817 | 891 | |
| 818 | 892 | // We might need this |
| 819 | 893 | $cleanMemberName = empty($context['send_html']) || $context['send_pm'] ? un_htmlspecialchars($row['real_name']) : $row['real_name']; |
@@ -837,18 +911,25 @@ discard block |
||
| 837 | 911 | |
| 838 | 912 | // Send the actual email - or a PM! |
| 839 | 913 | if (!$context['send_pm']) |
| 840 | - sendmail($row['email_address'], $subject, $message, null, null, !empty($context['send_html']), 5); |
|
| 841 | - else |
|
| 842 | - sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message); |
|
| 914 | + { |
|
| 915 | + sendmail($row['email_address'], $subject, $message, null, null, !empty($context['send_html']), 5); |
|
| 916 | + } |
|
| 917 | + else { |
|
| 918 | + sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message); |
|
| 919 | + } |
|
| 843 | 920 | } |
| 844 | 921 | } |
| 845 | 922 | |
| 846 | 923 | // If used our batch assume we still have a member. |
| 847 | 924 | if ($i >= $num_at_once) |
| 848 | - $last_id_member = $context['start']; |
|
| 925 | + { |
|
| 926 | + $last_id_member = $context['start']; |
|
| 927 | + } |
|
| 849 | 928 | // Or we didn't have one in range? |
| 850 | 929 | elseif (empty($last_id_member) && $context['start'] + $num_at_once < $context['max_id_member']) |
| 851 | - $last_id_member = $context['start'] + $num_at_once; |
|
| 930 | + { |
|
| 931 | + $last_id_member = $context['start'] + $num_at_once; |
|
| 932 | + } |
|
| 852 | 933 | // If we have no id_member then we're done. |
| 853 | 934 | elseif (empty($last_id_member) && empty($context['recipients']['emails'])) |
| 854 | 935 | { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | 'value' => $txt['ban_added'], |
| 200 | 200 | ), |
| 201 | 201 | 'data' => array( |
| 202 | - 'function' => function ($rowData) { |
|
| 202 | + 'function' => function($rowData) { |
|
| 203 | 203 | global $context; |
| 204 | 204 | return standardTime($rowData['ban_time'], empty($context['ban_time_format']) ? true : $context['ban_time_format']); |
| 205 | 205 | }, |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | 'value' => $txt['ban_expires'], |
| 215 | 215 | ), |
| 216 | 216 | 'data' => array( |
| 217 | - 'function' => function ($rowData) { |
|
| 217 | + 'function' => function($rowData) { |
|
| 218 | 218 | global $txt; |
| 219 | 219 | |
| 220 | 220 | // This ban never expires...whahaha. |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | 'style' => 'width: 60%;', |
| 362 | 362 | ), |
| 363 | 363 | 'data' => array( |
| 364 | - 'function' => function ($ban_item) { |
|
| 364 | + 'function' => function($ban_item) { |
|
| 365 | 365 | global $txt; |
| 366 | 366 | |
| 367 | 367 | if (in_array($ban_item['type'], array('ip', 'hostname', 'email'))) |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | 'style' => 'width: 15%;', |
| 390 | 390 | ), |
| 391 | 391 | 'data' => array( |
| 392 | - 'function' => function ($ban_item) { |
|
| 392 | + 'function' => function($ban_item) { |
|
| 393 | 393 | global $txt, $context, $scripturl; |
| 394 | 394 | |
| 395 | 395 | return '<a href="' . $scripturl . '?action=admin;area=ban;sa=edittrigger;bg=' . $context['ban']['id'] . ';bi=' . $ban_item['id'] . '">' . $txt['ban_edit_trigger'] . '</a>'; |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | 'value' => $txt['ban_log_date'], |
| 604 | 604 | ), |
| 605 | 605 | 'data' => array( |
| 606 | - 'function' => function ($rowData) { |
|
| 606 | + 'function' => function($rowData) { |
|
| 607 | 607 | return standardTime($rowData['log_time']); |
| 608 | 608 | }, |
| 609 | 609 | ), |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | if ($context['selected_entity'] === 'ip') |
| 1024 | 1024 | { |
| 1025 | 1025 | $listOptions['columns']['banned_entity']['data'] = array( |
| 1026 | - 'function' => function ($rowData) { |
|
| 1026 | + 'function' => function($rowData) { |
|
| 1027 | 1027 | return range2ip(array( |
| 1028 | 1028 | $rowData['ip_low1'], |
| 1029 | 1029 | $rowData['ip_low2'], |
@@ -1053,7 +1053,7 @@ discard block |
||
| 1053 | 1053 | elseif ($context['selected_entity'] === 'hostname') |
| 1054 | 1054 | { |
| 1055 | 1055 | $listOptions['columns']['banned_entity']['data'] = array( |
| 1056 | - 'function' => function ($rowData) { |
|
| 1056 | + 'function' => function($rowData) { |
|
| 1057 | 1057 | return strtr(Util::htmlspecialchars($rowData['hostname']), array('%' => '*')); |
| 1058 | 1058 | }, |
| 1059 | 1059 | ); |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | elseif ($context['selected_entity'] === 'email') |
| 1066 | 1066 | { |
| 1067 | 1067 | $listOptions['columns']['banned_entity']['data'] = array( |
| 1068 | - 'function' => function ($rowData) { |
|
| 1068 | + 'function' => function($rowData) { |
|
| 1069 | 1069 | return strtr(Util::htmlspecialchars($rowData['email_address']), array('%' => '*')); |
| 1070 | 1070 | }, |
| 1071 | 1071 | ); |
@@ -138,9 +138,12 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | // Create a date string so we don't overload them with date info. |
| 140 | 140 | if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
| 141 | - $context['ban_time_format'] = $user_info['time_format']; |
|
| 142 | - else |
|
| 143 | - $context['ban_time_format'] = $matches[0]; |
|
| 141 | + { |
|
| 142 | + $context['ban_time_format'] = $user_info['time_format']; |
|
| 143 | + } |
|
| 144 | + else { |
|
| 145 | + $context['ban_time_format'] = $matches[0]; |
|
| 146 | + } |
|
| 144 | 147 | |
| 145 | 148 | // Lets build a nice create list to show them the bans |
| 146 | 149 | $listOptions = array( |
@@ -221,15 +224,20 @@ discard block |
||
| 221 | 224 | |
| 222 | 225 | // This ban never expires...whahaha. |
| 223 | 226 | if ($rowData['expire_time'] === null) |
| 224 | - return $txt['never']; |
|
| 227 | + { |
|
| 228 | + return $txt['never']; |
|
| 229 | + } |
|
| 225 | 230 | |
| 226 | 231 | // This ban has already expired. |
| 227 | 232 | elseif ($rowData['expire_time'] < time()) |
| 228 | - return sprintf('<span class="error">%1$s</span>', $txt['ban_expired']); |
|
| 233 | + { |
|
| 234 | + return sprintf('<span class="error">%1$s</span>', $txt['ban_expired']); |
|
| 235 | + } |
|
| 229 | 236 | |
| 230 | 237 | // Still need to wait a few days for this ban to expire. |
| 231 | - else |
|
| 232 | - return sprintf('%1$d %2$s', ceil(($rowData['expire_time'] - time()) / (60 * 60 * 24)), $txt['ban_days']); |
|
| 238 | + else { |
|
| 239 | + return sprintf('%1$d %2$s', ceil(($rowData['expire_time'] - time()) / (60 * 60 * 24)), $txt['ban_days']); |
|
| 240 | + } |
|
| 233 | 241 | }, |
| 234 | 242 | ), |
| 235 | 243 | 'sort' => array( |
@@ -317,7 +325,9 @@ discard block |
||
| 317 | 325 | |
| 318 | 326 | // Saving a new or edited ban? |
| 319 | 327 | if ((isset($this->_req->post->add_ban) || isset($this->_req->post->modify_ban) || isset($this->_req->post->remove_selection)) && !$ban_errors->hasErrors()) |
| 320 | - $this->action_edit2(); |
|
| 328 | + { |
|
| 329 | + $this->action_edit2(); |
|
| 330 | + } |
|
| 321 | 331 | |
| 322 | 332 | $ban_group_id = isset($context['ban']['id']) ? $context['ban']['id'] : $this->_req->getQuery('bg', 'intval', 0); |
| 323 | 333 | |
@@ -369,11 +379,16 @@ discard block |
||
| 369 | 379 | global $txt; |
| 370 | 380 | |
| 371 | 381 | if (in_array($ban_item['type'], array('ip', 'hostname', 'email'))) |
| 372 | - return '<strong>' . $txt[$ban_item['type']] . ':</strong> ' . $ban_item[$ban_item['type']]; |
|
| 382 | + { |
|
| 383 | + return '<strong>' . $txt[$ban_item['type']] . ':</strong> ' . $ban_item[$ban_item['type']]; |
|
| 384 | + } |
|
| 373 | 385 | elseif ($ban_item['type'] == 'user') |
| 374 | - return '<strong>' . $txt['username'] . ':</strong> ' . $ban_item['user']['link']; |
|
| 375 | - else |
|
| 376 | - return '<strong>' . $txt['unknown'] . ':</strong> ' . $ban_item['no_bantype_selected']; |
|
| 386 | + { |
|
| 387 | + return '<strong>' . $txt['username'] . ':</strong> ' . $ban_item['user']['link']; |
|
| 388 | + } |
|
| 389 | + else { |
|
| 390 | + return '<strong>' . $txt['unknown'] . ':</strong> ' . $ban_item['no_bantype_selected']; |
|
| 391 | + } |
|
| 377 | 392 | }, |
| 378 | 393 | ), |
| 379 | 394 | ), |
@@ -482,7 +497,9 @@ discard block |
||
| 482 | 497 | |
| 483 | 498 | // Would be nice if we could also ban the hostname. |
| 484 | 499 | if ((preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $context['ban_suggestions']['main_ip']) == 1 || isValidIPv6($context['ban_suggestions']['main_ip'])) && empty($modSettings['disableHostnameLookup'])) |
| 485 | - $context['ban_suggestions']['hostname'] = host_from_ip($context['ban_suggestions']['main_ip']); |
|
| 500 | + { |
|
| 501 | + $context['ban_suggestions']['hostname'] = host_from_ip($context['ban_suggestions']['main_ip']); |
|
| 502 | + } |
|
| 486 | 503 | |
| 487 | 504 | $context['ban_suggestions']['other_ips'] = banLoadAdditionalIPs($context['ban_suggestions']['member']['id']); |
| 488 | 505 | } |
@@ -532,7 +549,9 @@ discard block |
||
| 532 | 549 | |
| 533 | 550 | // 'Delete all entries' button was pressed. |
| 534 | 551 | if (!empty($this->_req->post->removeAll)) |
| 535 | - removeBanLogs(); |
|
| 552 | + { |
|
| 553 | + removeBanLogs(); |
|
| 554 | + } |
|
| 536 | 555 | // 'Delete selection' button was pressed. |
| 537 | 556 | else |
| 538 | 557 | { |
@@ -703,10 +722,13 @@ discard block |
||
| 703 | 722 | |
| 704 | 723 | // Adding a new ban group |
| 705 | 724 | if (empty($ban_info['id'])) |
| 706 | - $ban_group_id = insertBanGroup($ban_info); |
|
| 725 | + { |
|
| 726 | + $ban_group_id = insertBanGroup($ban_info); |
|
| 727 | + } |
|
| 707 | 728 | // Editing an existing ban group |
| 708 | - else |
|
| 709 | - $ban_group_id = updateBanGroup($ban_info); |
|
| 729 | + else { |
|
| 730 | + $ban_group_id = updateBanGroup($ban_info); |
|
| 731 | + } |
|
| 710 | 732 | |
| 711 | 733 | if ($ban_group_id !== false) |
| 712 | 734 | { |
@@ -732,7 +754,9 @@ discard block |
||
| 732 | 754 | |
| 733 | 755 | // They may have entered a name not using the member select box |
| 734 | 756 | if (isset($this->_req->query->u)) |
| 735 | - $context['ban_suggestions'] = array_merge($context['ban_suggestions'], getMemberData((int) $this->_req->query->u)); |
|
| 757 | + { |
|
| 758 | + $context['ban_suggestions'] = array_merge($context['ban_suggestions'], getMemberData((int) $this->_req->query->u)); |
|
| 759 | + } |
|
| 736 | 760 | elseif (isset($this->_req->query->user)) |
| 737 | 761 | { |
| 738 | 762 | $context['ban']['from_user'] = false; |
@@ -742,7 +766,9 @@ discard block |
||
| 742 | 766 | |
| 743 | 767 | // Not strictly necessary, but it's nice |
| 744 | 768 | if (!empty($context['ban_suggestions']['member']['id'])) |
| 745 | - $context['ban_suggestions']['other_ips'] = banLoadAdditionalIPs($context['ban_suggestions']['member']['id']); |
|
| 769 | + { |
|
| 770 | + $context['ban_suggestions']['other_ips'] = banLoadAdditionalIPs($context['ban_suggestions']['member']['id']); |
|
| 771 | + } |
|
| 746 | 772 | |
| 747 | 773 | return $this->action_edit(); |
| 748 | 774 | } |
@@ -789,7 +815,9 @@ discard block |
||
| 789 | 815 | $ban_id = $this->_req->get('bi', 'intval', 0); |
| 790 | 816 | |
| 791 | 817 | if (empty($ban_group)) |
| 792 | - throw new Elk_Exception('ban_not_found', false); |
|
| 818 | + { |
|
| 819 | + throw new Elk_Exception('ban_not_found', false); |
|
| 820 | + } |
|
| 793 | 821 | |
| 794 | 822 | // Adding a new trigger |
| 795 | 823 | if (isset($this->_req->post->add_new_trigger) && !empty($this->_req->post->ban_suggestions)) |
@@ -806,7 +834,9 @@ discard block |
||
| 806 | 834 | $dummy['ban_suggestions'] = (array) array_shift($this->_req->post->ban_suggestions); |
| 807 | 835 | saveTriggers($dummy, $ban_group, 0, $ban_id); |
| 808 | 836 | if (!empty($this->_req->post->ban_suggestions)) |
| 809 | - saveTriggers((array) $this->_req->post, $ban_group); |
|
| 837 | + { |
|
| 838 | + saveTriggers((array) $this->_req->post, $ban_group); |
|
| 839 | + } |
|
| 810 | 840 | |
| 811 | 841 | redirectexit('action=admin;area=ban;sa=edit' . (!empty($ban_group) ? ';bg=' . $ban_group : '')); |
| 812 | 842 | } |
@@ -847,7 +877,9 @@ discard block |
||
| 847 | 877 | { |
| 848 | 878 | $ban_row = banDetails($ban_id, $ban_group); |
| 849 | 879 | if (empty($ban_row)) |
| 850 | - throw new Elk_Exception('ban_not_found', false); |
|
| 880 | + { |
|
| 881 | + throw new Elk_Exception('ban_not_found', false); |
|
| 882 | + } |
|
| 851 | 883 | $row = $ban_row[$ban_id]; |
| 852 | 884 | |
| 853 | 885 | // Load it up for the template |
@@ -911,7 +943,9 @@ discard block |
||
| 911 | 943 | |
| 912 | 944 | // Rehabilitate some members. |
| 913 | 945 | if ($this->_req->query->entity == 'member') |
| 914 | - updateBanMembers(); |
|
| 946 | + { |
|
| 947 | + updateBanMembers(); |
|
| 948 | + } |
|
| 915 | 949 | |
| 916 | 950 | // Make sure the ban cache is refreshed. |
| 917 | 951 | updateSettings(array('banLastUpdated' => time())); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | 'value' => $txt['membergroups_name'], |
| 144 | 144 | ), |
| 145 | 145 | 'data' => array( |
| 146 | - 'function' => function ($rowData) { |
|
| 146 | + 'function' => function($rowData) { |
|
| 147 | 147 | global $scripturl; |
| 148 | 148 | |
| 149 | 149 | // Since the moderator group has no explicit members, no link is needed. |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | 'value' => $txt['membergroups_icons'], |
| 174 | 174 | ), |
| 175 | 175 | 'data' => array( |
| 176 | - 'function' => function ($rowData) { |
|
| 176 | + 'function' => function($rowData) { |
|
| 177 | 177 | global $settings; |
| 178 | 178 | |
| 179 | 179 | if (!empty($rowData['icons'][0]) && !empty($rowData['icons'][1])) |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | 'value' => $txt['membergroups_members_top'], |
| 193 | 193 | ), |
| 194 | 194 | 'data' => array( |
| 195 | - 'function' => function ($rowData) { |
|
| 195 | + 'function' => function($rowData) { |
|
| 196 | 196 | global $txt; |
| 197 | 197 | |
| 198 | 198 | // No explicit members for the moderator group. |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | 'value' => $txt['membergroups_name'], |
| 256 | 256 | ), |
| 257 | 257 | 'data' => array( |
| 258 | - 'function' => function ($rowData) { |
|
| 258 | + 'function' => function($rowData) { |
|
| 259 | 259 | global $scripturl; |
| 260 | 260 | |
| 261 | 261 | return sprintf('<a href="%1$s?action=admin;area=membergroups;sa=members;group=%2$d">%3$s</a>', $scripturl, $rowData['id_group'], $rowData['group_name_color']); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | 'value' => $txt['membergroups_icons'], |
| 272 | 272 | ), |
| 273 | 273 | 'data' => array( |
| 274 | - 'function' => function ($rowData) { |
|
| 274 | + 'function' => function($rowData) { |
|
| 275 | 275 | global $settings; |
| 276 | 276 | |
| 277 | 277 | if (!empty($rowData['icons'][0]) && !empty($rowData['icons'][1])) |
@@ -142,7 +142,9 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | // Since the moderator group has no explicit members, no link is needed. |
| 144 | 144 | if ($rowData['id_group'] == 3) |
| 145 | - $group_name = $rowData['group_name']; |
|
| 145 | + { |
|
| 146 | + $group_name = $rowData['group_name']; |
|
| 147 | + } |
|
| 146 | 148 | else |
| 147 | 149 | { |
| 148 | 150 | $group_name = sprintf('<a href="%1$s?action=admin;area=membergroups;sa=members;group=%2$d">%3$s</a>', $scripturl, $rowData['id_group'], $rowData['group_name_color']); |
@@ -150,9 +152,13 @@ discard block |
||
| 150 | 152 | |
| 151 | 153 | // Add a help option for moderator and administrator. |
| 152 | 154 | if ($rowData['id_group'] == 1) |
| 153 | - $group_name .= sprintf(' (<a href="%1$s?action=quickhelp;help=membergroup_administrator" onclick="return reqOverlayDiv(this.href);" class="helpicon i-help"></a>)', $scripturl); |
|
| 155 | + { |
|
| 156 | + $group_name .= sprintf(' (<a href="%1$s?action=quickhelp;help=membergroup_administrator" onclick="return reqOverlayDiv(this.href);" class="helpicon i-help"></a>)', $scripturl); |
|
| 157 | + } |
|
| 154 | 158 | elseif ($rowData['id_group'] == 3) |
| 155 | - $group_name .= sprintf(' (<a href="%1$s?action=quickhelp;help=membergroup_moderator" onclick="return reqOverlayDiv(this.href);" class="helpicon i-help"></a>)', $scripturl); |
|
| 159 | + { |
|
| 160 | + $group_name .= sprintf(' (<a href="%1$s?action=quickhelp;help=membergroup_moderator" onclick="return reqOverlayDiv(this.href);" class="helpicon i-help"></a>)', $scripturl); |
|
| 161 | + } |
|
| 156 | 162 | |
| 157 | 163 | return $group_name; |
| 158 | 164 | }, |
@@ -171,9 +177,12 @@ discard block |
||
| 171 | 177 | global $settings; |
| 172 | 178 | |
| 173 | 179 | if (!empty($rowData['icons'][0]) && !empty($rowData['icons'][1])) |
| 174 | - return str_repeat('<img src="' . $settings['images_url'] . '/group_icons/' . $rowData['icons'][1] . '" alt="*" />', $rowData['icons'][0]); |
|
| 175 | - else |
|
| 176 | - return ''; |
|
| 180 | + { |
|
| 181 | + return str_repeat('<img src="' . $settings['images_url'] . '/group_icons/' . $rowData['icons'][1] . '" alt="*" />', $rowData['icons'][0]); |
|
| 182 | + } |
|
| 183 | + else { |
|
| 184 | + return ''; |
|
| 185 | + } |
|
| 177 | 186 | }, |
| 178 | 187 | ), |
| 179 | 188 | 'sort' => array( |
@@ -269,9 +278,12 @@ discard block |
||
| 269 | 278 | global $settings; |
| 270 | 279 | |
| 271 | 280 | if (!empty($rowData['icons'][0]) && !empty($rowData['icons'][1])) |
| 272 | - return str_repeat('<img src="' . $settings['images_url'] . '/group_icons/' . $rowData['icons'][1] . '" alt="*" />', $rowData['icons'][0]); |
|
| 273 | - else |
|
| 274 | - return ''; |
|
| 281 | + { |
|
| 282 | + return str_repeat('<img src="' . $settings['images_url'] . '/group_icons/' . $rowData['icons'][1] . '" alt="*" />', $rowData['icons'][0]); |
|
| 283 | + } |
|
| 284 | + else { |
|
| 285 | + return ''; |
|
| 286 | + } |
|
| 275 | 287 | }, |
| 276 | 288 | ), |
| 277 | 289 | 'sort' => array( |
@@ -377,7 +389,9 @@ discard block |
||
| 377 | 389 | |
| 378 | 390 | // You cannot set permissions for post groups if they are disabled. |
| 379 | 391 | if ($postCountBasedGroup && empty($modSettings['permission_enable_postgroups'])) |
| 380 | - $this->_req->post->perm_type = ''; |
|
| 392 | + { |
|
| 393 | + $this->_req->post->perm_type = ''; |
|
| 394 | + } |
|
| 381 | 395 | |
| 382 | 396 | if ($this->_req->post->perm_type == 'predefined') |
| 383 | 397 | { |
@@ -397,7 +411,9 @@ discard block |
||
| 397 | 411 | |
| 398 | 412 | // Keep protected groups ... well, protected! |
| 399 | 413 | if ($copy_type['group_type'] == 1) |
| 400 | - throw new Elk_Exception('membergroup_does_not_exist'); |
|
| 414 | + { |
|
| 415 | + throw new Elk_Exception('membergroup_does_not_exist'); |
|
| 416 | + } |
|
| 401 | 417 | } |
| 402 | 418 | |
| 403 | 419 | // Don't allow copying of a real privileged person! |
@@ -406,11 +422,15 @@ discard block |
||
| 406 | 422 | |
| 407 | 423 | // Also get some membergroup information if we're copying and not copying from guests... |
| 408 | 424 | if ($copy_id > 0 && $this->_req->post->perm_type == 'copy') |
| 409 | - updateCopiedGroup($id_group, $copy_id); |
|
| 425 | + { |
|
| 426 | + updateCopiedGroup($id_group, $copy_id); |
|
| 427 | + } |
|
| 410 | 428 | |
| 411 | 429 | // If inheriting say so... |
| 412 | 430 | elseif ($this->_req->post->perm_type == 'inherit') |
| 413 | - updateInheritedGroup($id_group, $copy_id); |
|
| 431 | + { |
|
| 432 | + updateInheritedGroup($id_group, $copy_id); |
|
| 433 | + } |
|
| 414 | 434 | } |
| 415 | 435 | |
| 416 | 436 | // Make sure all boards selected are stored in a proper array. |
@@ -420,18 +440,24 @@ discard block |
||
| 420 | 440 | $changed_boards['deny'] = array(); |
| 421 | 441 | $changed_boards['ignore'] = array(); |
| 422 | 442 | foreach ($accesses as $group_id => $action) |
| 423 | - $changed_boards[$action][] = (int) $group_id; |
|
| 443 | + { |
|
| 444 | + $changed_boards[$action][] = (int) $group_id; |
|
| 445 | + } |
|
| 424 | 446 | |
| 425 | 447 | foreach (array('allow', 'deny') as $board_action) |
| 426 | 448 | { |
| 427 | 449 | // Only do this if they have special access requirements. |
| 428 | 450 | if (!empty($changed_boards[$board_action])) |
| 429 | - assignGroupToBoards($id_group, $changed_boards, $board_action); |
|
| 451 | + { |
|
| 452 | + assignGroupToBoards($id_group, $changed_boards, $board_action); |
|
| 453 | + } |
|
| 430 | 454 | } |
| 431 | 455 | |
| 432 | 456 | // If this is joinable then set it to show group membership in people's profiles. |
| 433 | 457 | if (empty($modSettings['show_group_membership']) && $group_type > 1) |
| 434 | - updateSettings(array('show_group_membership' => 1)); |
|
| 458 | + { |
|
| 459 | + updateSettings(array('show_group_membership' => 1)); |
|
| 460 | + } |
|
| 435 | 461 | |
| 436 | 462 | // Rebuild the group cache. |
| 437 | 463 | updateSettings(array( |
@@ -453,7 +479,9 @@ discard block |
||
| 453 | 479 | $context['allow_protected'] = allowedTo('admin_forum'); |
| 454 | 480 | |
| 455 | 481 | if (!empty($modSettings['deny_boards_access'])) |
| 456 | - loadLanguage('ManagePermissions'); |
|
| 482 | + { |
|
| 483 | + loadLanguage('ManagePermissions'); |
|
| 484 | + } |
|
| 457 | 485 | |
| 458 | 486 | $context['groups'] = getBasicMembergroupData(array('globalmod'), array(), 'min_posts, id_group != {int:global_mod_group}, group_name'); |
| 459 | 487 | |
@@ -462,7 +490,9 @@ discard block |
||
| 462 | 490 | |
| 463 | 491 | // Include a list of boards per category for easy toggling. |
| 464 | 492 | foreach ($context['categories'] as $category) |
| 465 | - $context['categories'][$category['id']]['child_ids'] = array_keys($category['boards']); |
|
| 493 | + { |
|
| 494 | + $context['categories'][$category['id']]['child_ids'] = array_keys($category['boards']); |
|
| 495 | + } |
|
| 466 | 496 | |
| 467 | 497 | createToken('admin-mmg'); |
| 468 | 498 | } |
@@ -512,17 +542,23 @@ discard block |
||
| 512 | 542 | $current_group = array(); |
| 513 | 543 | |
| 514 | 544 | if (!empty($modSettings['deny_boards_access'])) |
| 515 | - loadLanguage('ManagePermissions'); |
|
| 545 | + { |
|
| 546 | + loadLanguage('ManagePermissions'); |
|
| 547 | + } |
|
| 516 | 548 | |
| 517 | 549 | require_once(SUBSDIR . '/Membergroups.subs.php'); |
| 518 | 550 | |
| 519 | 551 | // Make sure this group is editable. |
| 520 | 552 | if (!empty($current_group_id)) |
| 521 | - $current_group = membergroupById($current_group_id); |
|
| 553 | + { |
|
| 554 | + $current_group = membergroupById($current_group_id); |
|
| 555 | + } |
|
| 522 | 556 | |
| 523 | 557 | // Now, do we have a valid id? |
| 524 | 558 | if (!allowedTo('admin_forum') && !empty($current_group_id) && $current_group['group_type'] == 1) |
| 525 | - throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 559 | + { |
|
| 560 | + throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 561 | + } |
|
| 526 | 562 | |
| 527 | 563 | // The delete this membergroup button was pressed. |
| 528 | 564 | if (isset($this->_req->post->delete)) |
@@ -531,7 +567,9 @@ discard block |
||
| 531 | 567 | validateToken('admin-mmg'); |
| 532 | 568 | |
| 533 | 569 | if (empty($current_group_id)) |
| 534 | - throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 570 | + { |
|
| 571 | + throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 572 | + } |
|
| 535 | 573 | |
| 536 | 574 | // Let's delete the group |
| 537 | 575 | deleteMembergroups($current_group['id_group']); |
@@ -546,7 +584,9 @@ discard block |
||
| 546 | 584 | validateToken('admin-mmg'); |
| 547 | 585 | |
| 548 | 586 | if (empty($current_group_id)) |
| 549 | - throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 587 | + { |
|
| 588 | + throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 589 | + } |
|
| 550 | 590 | |
| 551 | 591 | // Empty values will be replaced by validator values where they exist |
| 552 | 592 | $empty_post = array('max_messages' => null, 'min_posts' => null, 'group_type' => null, 'group_desc' => '', |
@@ -632,18 +672,24 @@ discard block |
||
| 632 | 672 | |
| 633 | 673 | // Add the membergroup to all boards that hadn't been set yet. |
| 634 | 674 | if (!empty($changed_boards[$board_action])) |
| 635 | - assignGroupToBoards($current_group['id_group'], $changed_boards, $board_action); |
|
| 675 | + { |
|
| 676 | + assignGroupToBoards($current_group['id_group'], $changed_boards, $board_action); |
|
| 677 | + } |
|
| 636 | 678 | } |
| 637 | 679 | } |
| 638 | 680 | |
| 639 | 681 | // Remove everyone from this group! |
| 640 | 682 | if ($min_posts != -1) |
| 641 | - detachDeletedGroupFromMembers($current_group['id_group']); |
|
| 683 | + { |
|
| 684 | + detachDeletedGroupFromMembers($current_group['id_group']); |
|
| 685 | + } |
|
| 642 | 686 | elseif ($current_group['id_group'] != 3) |
| 643 | 687 | { |
| 644 | 688 | // Making it a hidden group? If so remove everyone with it as primary group (Actually, just make them additional). |
| 645 | 689 | if ($our_post['group_hidden'] == 2) |
| 646 | - setGroupToHidden($current_group['id_group']); |
|
| 690 | + { |
|
| 691 | + setGroupToHidden($current_group['id_group']); |
|
| 692 | + } |
|
| 647 | 693 | |
| 648 | 694 | // Either way, let's check our "show group membership" setting is correct. |
| 649 | 695 | validateShowGroupMembership(); |
@@ -673,18 +719,24 @@ discard block |
||
| 673 | 719 | $moderators[$k] = trim($moderators[$k]); |
| 674 | 720 | |
| 675 | 721 | if (strlen($moderators[$k]) == 0) |
| 676 | - unset($moderators[$k]); |
|
| 722 | + { |
|
| 723 | + unset($moderators[$k]); |
|
| 724 | + } |
|
| 677 | 725 | } |
| 678 | 726 | |
| 679 | 727 | // Find all the id_member's for the member_name's in the list. |
| 680 | 728 | if (!empty($moderators)) |
| 681 | - $group_moderators = getIDMemberFromGroupModerators($moderators); |
|
| 729 | + { |
|
| 730 | + $group_moderators = getIDMemberFromGroupModerators($moderators); |
|
| 731 | + } |
|
| 682 | 732 | } |
| 683 | 733 | else |
| 684 | 734 | { |
| 685 | 735 | $moderators = array(); |
| 686 | 736 | foreach ($this->_req->post->moderator_list as $moderator) |
| 687 | - $moderators[] = (int) $moderator; |
|
| 737 | + { |
|
| 738 | + $moderators[] = (int) $moderator; |
|
| 739 | + } |
|
| 688 | 740 | |
| 689 | 741 | $group_moderators = array(); |
| 690 | 742 | if (!empty($moderators)) |
@@ -692,13 +744,17 @@ discard block |
||
| 692 | 744 | require_once(SUBSDIR . '/Members.subs.php'); |
| 693 | 745 | $members = getBasicMemberData($moderators); |
| 694 | 746 | foreach ($members as $member) |
| 695 | - $group_moderators[] = $member['id_member']; |
|
| 747 | + { |
|
| 748 | + $group_moderators[] = $member['id_member']; |
|
| 749 | + } |
|
| 696 | 750 | } |
| 697 | 751 | } |
| 698 | 752 | |
| 699 | 753 | // Found some? |
| 700 | 754 | if (!empty($group_moderators)) |
| 701 | - assignGroupModerators($current_group['id_group'], $group_moderators); |
|
| 755 | + { |
|
| 756 | + assignGroupModerators($current_group['id_group'], $group_moderators); |
|
| 757 | + } |
|
| 702 | 758 | } |
| 703 | 759 | |
| 704 | 760 | // There might have been some post group changes. |
@@ -720,7 +776,9 @@ discard block |
||
| 720 | 776 | $row = membergroupById($current_group['id_group'], true); |
| 721 | 777 | |
| 722 | 778 | if (empty($row) || (!allowedTo('admin_forum') && $row['group_type'] == 1)) |
| 723 | - throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 779 | + { |
|
| 780 | + throw new Elk_Exception('membergroup_does_not_exist', false); |
|
| 781 | + } |
|
| 724 | 782 | |
| 725 | 783 | $row['icons'] = explode('#', $row['icons']); |
| 726 | 784 | |
@@ -748,7 +806,9 @@ discard block |
||
| 748 | 806 | $context['group']['moderator_list'] = empty($context['group']['moderators']) ? '' : '"' . implode('", "', $context['group']['moderators']) . '"'; |
| 749 | 807 | |
| 750 | 808 | if (!empty($context['group']['moderators'])) |
| 751 | - list ($context['group']['last_moderator_id']) = array_slice(array_keys($context['group']['moderators']), -1); |
|
| 809 | + { |
|
| 810 | + list ($context['group']['last_moderator_id']) = array_slice(array_keys($context['group']['moderators']), -1); |
|
| 811 | + } |
|
| 752 | 812 | |
| 753 | 813 | // Get a list of boards this membergroup is allowed to see. |
| 754 | 814 | $context['boards'] = array(); |
@@ -759,7 +819,9 @@ discard block |
||
| 759 | 819 | |
| 760 | 820 | // Include a list of boards per category for easy toggling. |
| 761 | 821 | foreach ($context['categories'] as $category) |
| 762 | - $context['categories'][$category['id']]['child_ids'] = array_keys($category['boards']); |
|
| 822 | + { |
|
| 823 | + $context['categories'][$category['id']]['child_ids'] = array_keys($category['boards']); |
|
| 824 | + } |
|
| 763 | 825 | } |
| 764 | 826 | |
| 765 | 827 | // Finally, get all the groups this could be inherited off. |
@@ -772,7 +834,9 @@ discard block |
||
| 772 | 834 | |
| 773 | 835 | // Use the autosuggest script when needed |
| 774 | 836 | if ($context['group']['id'] != 3 && $context['group']['id'] != 4) |
| 775 | - loadJavascriptFile('suggest.js', array('defer' => true)); |
|
| 837 | + { |
|
| 838 | + loadJavascriptFile('suggest.js', array('defer' => true)); |
|
| 839 | + } |
|
| 776 | 840 | |
| 777 | 841 | createToken('admin-mmg'); |
| 778 | 842 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | 'value' => $txt['spider_name'], |
| 261 | 261 | ), |
| 262 | 262 | 'data' => array( |
| 263 | - 'function' => function ($rowData) { |
|
| 263 | + 'function' => function($rowData) { |
|
| 264 | 264 | global $scripturl; |
| 265 | 265 | |
| 266 | 266 | return sprintf('<a href="%1$s?action=admin;area=sengines;sa=editspiders;sid=%2$d">%3$s</a>', $scripturl, $rowData['id_spider'], htmlspecialchars($rowData['spider_name'], ENT_COMPAT, 'UTF-8')); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | 'value' => $txt['spider_last_seen'], |
| 277 | 277 | ), |
| 278 | 278 | 'data' => array( |
| 279 | - 'function' => function ($rowData) { |
|
| 279 | + 'function' => function($rowData) { |
|
| 280 | 280 | global $context, $txt; |
| 281 | 281 | |
| 282 | 282 | return isset($context['spider_last_seen'][$rowData['id_spider']]) ? standardTime($context['spider_last_seen'][$rowData['id_spider']]) : $txt['spider_last_never']; |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | 'value' => $txt['spider_time'], |
| 462 | 462 | ), |
| 463 | 463 | 'data' => array( |
| 464 | - 'function' => function ($rowData) { |
|
| 464 | + 'function' => function($rowData) { |
|
| 465 | 465 | return standardTime($rowData['log_time']); |
| 466 | 466 | }, |
| 467 | 467 | ), |
@@ -85,7 +85,9 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // Make sure it's valid - note that regular members are given id_group = 1 which is reversed in Load.php - no admins here! |
| 87 | 87 | if (isset($this->_req->post->spider_group) && !isset($config_vars['spider_group'][2][$this->_req->post->spider_group])) |
| 88 | - $this->_req->post->spider_group = 0; |
|
| 88 | + { |
|
| 89 | + $this->_req->post->spider_group = 0; |
|
| 90 | + } |
|
| 89 | 91 | |
| 90 | 92 | // Setup the template. |
| 91 | 93 | $context['page_title'] = $txt['settings']; |
@@ -124,9 +126,11 @@ discard block |
||
| 124 | 126 | foreach ($config_vars as $variable) |
| 125 | 127 | { |
| 126 | 128 | if ($variable[1] != 'spider_mode') |
| 127 | - $javascript_function .= ' |
|
| 129 | + { |
|
| 130 | + $javascript_function .= ' |
|
| 128 | 131 | if (document.getElementById(\'' . $variable[1] . '\')) |
| 129 | 132 | document.getElementById(\'' . $variable[1] . '\').disabled = disabledState;'; |
| 133 | + } |
|
| 130 | 134 | } |
| 131 | 135 | |
| 132 | 136 | $javascript_function .= ' |
@@ -162,9 +166,12 @@ discard block |
||
| 162 | 166 | { |
| 163 | 167 | // Unfortunately, regular members have to be 1 because 0 is for disabled. |
| 164 | 168 | if ($row['id'] == 0) |
| 165 | - $config_vars['spider_group'][2][1] = $row['name']; |
|
| 166 | - else |
|
| 167 | - $config_vars['spider_group'][2][$row['id']] = $row['name']; |
|
| 169 | + { |
|
| 170 | + $config_vars['spider_group'][2][1] = $row['name']; |
|
| 171 | + } |
|
| 172 | + else { |
|
| 173 | + $config_vars['spider_group'][2][$row['id']] = $row['name']; |
|
| 174 | + } |
|
| 168 | 175 | } |
| 169 | 176 | |
| 170 | 177 | // Notify the integration that we're preparing to mess up with search engine settings... |
@@ -201,7 +208,9 @@ discard block |
||
| 201 | 208 | |
| 202 | 209 | // Are we adding a new one? |
| 203 | 210 | if (!empty($this->_req->post->addSpider)) |
| 204 | - return $this->action_editspiders(); |
|
| 211 | + { |
|
| 212 | + return $this->action_editspiders(); |
|
| 213 | + } |
|
| 205 | 214 | // User pressed the 'remove selection button'. |
| 206 | 215 | elseif (!empty($this->_req->post->removeSpiders) && !empty($this->_req->post->remove) && is_array($this->_req->post->remove)) |
| 207 | 216 | { |
@@ -357,7 +366,9 @@ discard block |
||
| 357 | 366 | { |
| 358 | 367 | $test = ip2range(trim($set)); |
| 359 | 368 | if (!empty($test)) |
| 360 | - $ips[] = $set; |
|
| 369 | + { |
|
| 370 | + $ips[] = $set; |
|
| 371 | + } |
|
| 361 | 372 | } |
| 362 | 373 | $ips = implode(',', $ips); |
| 363 | 374 | |
@@ -383,7 +394,9 @@ discard block |
||
| 383 | 394 | |
| 384 | 395 | // An edit? |
| 385 | 396 | if ($context['id_spider']) |
| 386 | - $context['spider'] = getSpiderDetails($context['id_spider']); |
|
| 397 | + { |
|
| 398 | + $context['spider'] = getSpiderDetails($context['id_spider']); |
|
| 399 | + } |
|
| 387 | 400 | |
| 388 | 401 | createToken('admin-ses'); |
| 389 | 402 | } |
@@ -495,16 +508,21 @@ discard block |
||
| 495 | 508 | { |
| 496 | 509 | // Feature disabled? |
| 497 | 510 | if (empty($row['data']['viewing']['value']) && isset($modSettings['spider_mode']) && $modSettings['spider_mode'] < 3) |
| 498 | - $context['spider_logs']['rows'][$k]['data']['viewing']['value'] = '<em>' . $txt['spider_disabled'] . '</em>'; |
|
| 499 | - else |
|
| 500 | - $urls[$k] = array($row['data']['viewing']['value'], -1); |
|
| 511 | + { |
|
| 512 | + $context['spider_logs']['rows'][$k]['data']['viewing']['value'] = '<em>' . $txt['spider_disabled'] . '</em>'; |
|
| 513 | + } |
|
| 514 | + else { |
|
| 515 | + $urls[$k] = array($row['data']['viewing']['value'], -1); |
|
| 516 | + } |
|
| 501 | 517 | } |
| 502 | 518 | |
| 503 | 519 | // Now stick in the new URLs. |
| 504 | 520 | require_once(SUBSDIR . '/Who.subs.php'); |
| 505 | 521 | $urls = determineActions($urls, 'whospider_'); |
| 506 | 522 | foreach ($urls as $k => $new_url) |
| 507 | - $context['spider_logs']['rows'][$k]['data']['viewing']['value'] = $new_url; |
|
| 523 | + { |
|
| 524 | + $context['spider_logs']['rows'][$k]['data']['viewing']['value'] = $new_url; |
|
| 525 | + } |
|
| 508 | 526 | } |
| 509 | 527 | |
| 510 | 528 | $context['page_title'] = $txt['spider_logs']; |
@@ -556,12 +574,15 @@ discard block |
||
| 556 | 574 | <select name="new_date" onchange="document.spider_stat_list.submit();">'; |
| 557 | 575 | |
| 558 | 576 | if (empty($date_choices)) |
| 559 | - $date_select .= ' |
|
| 577 | + { |
|
| 578 | + $date_select .= ' |
|
| 560 | 579 | <option></option>'; |
| 561 | - else |
|
| 562 | - foreach ($date_choices as $id => $text) |
|
| 580 | + } |
|
| 581 | + else { |
|
| 582 | + foreach ($date_choices as $id => $text) |
|
| 563 | 583 | $date_select .= ' |
| 564 | 584 | <option value="' . $id . '"' . ($current_date == $id ? ' selected="selected"' : '') . '>' . $text . '</option>'; |
| 585 | + } |
|
| 565 | 586 | |
| 566 | 587 | $date_select .= ' |
| 567 | 588 | </select> |
@@ -255,7 +255,7 @@ |
||
| 255 | 255 | 'class' => 'centertext', |
| 256 | 256 | ), |
| 257 | 257 | 'data' => array( |
| 258 | - 'function' => function ($entry) { |
|
| 258 | + 'function' => function($entry) { |
|
| 259 | 259 | return '<input type="checkbox" name="delete[]" value="' . $entry['id'] . '"' . ($entry['editable'] ? '' : ' disabled="disabled"') . ' />'; |
| 260 | 260 | }, |
| 261 | 261 | 'class' => 'centertext', |
@@ -53,13 +53,18 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | // Trying to view the admin log, lets check you can. |
| 55 | 55 | if ($context['log_type'] == 3) |
| 56 | - isAllowedTo('admin_forum'); |
|
| 56 | + { |
|
| 57 | + isAllowedTo('admin_forum'); |
|
| 58 | + } |
|
| 57 | 59 | |
| 58 | 60 | // These change dependant on whether we are viewing the moderation or admin log. |
| 59 | 61 | if ($context['log_type'] == 3 || $this->_req->query->action === 'admin') |
| 60 | - $context['url_start'] = '?action=admin;area=logs;sa=' . ($context['log_type'] == 3 ? 'adminlog' : 'modlog') . ';type=' . $context['log_type']; |
|
| 61 | - else |
|
| 62 | - $context['url_start'] = '?action=moderate;area=modlog;type=' . $context['log_type']; |
|
| 62 | + { |
|
| 63 | + $context['url_start'] = '?action=admin;area=logs;sa=' . ($context['log_type'] == 3 ? 'adminlog' : 'modlog') . ';type=' . $context['log_type']; |
|
| 64 | + } |
|
| 65 | + else { |
|
| 66 | + $context['url_start'] = '?action=moderate;area=modlog;type=' . $context['log_type']; |
|
| 67 | + } |
|
| 63 | 68 | |
| 64 | 69 | $context['can_delete'] = allowedTo('admin_forum'); |
| 65 | 70 | |
@@ -106,14 +111,20 @@ discard block |
||
| 106 | 111 | $context['order'] = isset($this->_req->query->sort) && isset($searchTypes[$this->_req->query->sort]) ? $this->_req->query->sort : 'member'; |
| 107 | 112 | |
| 108 | 113 | if (!isset($search_params['string']) || (!empty($this->_req->post->search) && $search_params['string'] != $this->_req->post->search)) |
| 109 | - $search_params_string = $this->_req->getPost('search', 'trim', ''); |
|
| 110 | - else |
|
| 111 | - $search_params_string = $search_params['string']; |
|
| 114 | + { |
|
| 115 | + $search_params_string = $this->_req->getPost('search', 'trim', ''); |
|
| 116 | + } |
|
| 117 | + else { |
|
| 118 | + $search_params_string = $search_params['string']; |
|
| 119 | + } |
|
| 112 | 120 | |
| 113 | 121 | if (isset($this->_req->post->search_type) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']])) |
| 114 | - $search_params_type = isset($this->_req->post->search_type) && isset($searchTypes[$this->_req->post->search_type]) ? $this->_req->query->search_type : $context['order']; |
|
| 115 | - else |
|
| 116 | - $search_params_type = $search_params['type']; |
|
| 122 | + { |
|
| 123 | + $search_params_type = isset($this->_req->post->search_type) && isset($searchTypes[$this->_req->post->search_type]) ? $this->_req->query->search_type : $context['order']; |
|
| 124 | + } |
|
| 125 | + else { |
|
| 126 | + $search_params_type = $search_params['type']; |
|
| 127 | + } |
|
| 117 | 128 | |
| 118 | 129 | $search_params_column = $searchTypes[$search_params_type]['sql']; |
| 119 | 130 | $search_params = array( |
@@ -136,7 +147,9 @@ discard block |
||
| 136 | 147 | $regex = ''; |
| 137 | 148 | $search = explode(' ', $search_params['string']); |
| 138 | 149 | foreach ($search as $word) |
| 139 | - $regex .= '(?=[\w\s]*' . $word . ')'; |
|
| 150 | + { |
|
| 151 | + $regex .= '(?=[\w\s]*' . $word . ')'; |
|
| 152 | + } |
|
| 140 | 153 | |
| 141 | 154 | // For the moment they can only search for ONE action! |
| 142 | 155 | foreach ($txt as $key => $text) |