@@ -36,11 +36,12 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // An error? |
| 39 | - if (!empty($context['error_message'])) |
|
| 40 | - echo ' |
|
| 39 | + if (!empty($context['error_message'])) { |
|
| 40 | + echo ' |
|
| 41 | 41 | <div class="errorbox"> |
| 42 | 42 | ', $context['error_message'], ' |
| 43 | 43 | </div>'; |
| 44 | + } |
|
| 44 | 45 | |
| 45 | 46 | // Provide something of an introduction... |
| 46 | 47 | echo ' |
@@ -67,11 +68,12 @@ discard block |
||
| 67 | 68 | // If the files are not writable, we might! |
| 68 | 69 | if (!empty($context['still_not_writable'])) |
| 69 | 70 | { |
| 70 | - if (!empty($context['package_ftp']['error'])) |
|
| 71 | - echo ' |
|
| 71 | + if (!empty($context['package_ftp']['error'])) { |
|
| 72 | + echo ' |
|
| 72 | 73 | <div class="errorbox"> |
| 73 | 74 | ', $context['package_ftp']['error'], ' |
| 74 | 75 | </div>'; |
| 76 | + } |
|
| 75 | 77 | |
| 76 | 78 | echo ' |
| 77 | 79 | <div class="cat_bar"> |
@@ -243,11 +245,12 @@ discard block |
||
| 243 | 245 | |
| 244 | 246 | // Is it not writable? |
| 245 | 247 | // Show an error. |
| 246 | - if (!empty($context['entries_not_writable_message'])) |
|
| 247 | - echo ' |
|
| 248 | + if (!empty($context['entries_not_writable_message'])) { |
|
| 249 | + echo ' |
|
| 248 | 250 | <div class="errorbox"> |
| 249 | 251 | ', $context['entries_not_writable_message'], ' |
| 250 | 252 | </div>'; |
| 253 | + } |
|
| 251 | 254 | |
| 252 | 255 | // Already have some file entries? |
| 253 | 256 | if (!empty($context['file_entries'])) |
@@ -21,26 +21,30 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | // Get a shortcut to the current list. |
| 23 | 23 | $list_id = $list_id === null ? (!empty($context['default_list']) ? $context['default_list'] : '') : $list_id; |
| 24 | - if (empty($list_id) || empty($context[$list_id])) |
|
| 25 | - return; |
|
| 24 | + if (empty($list_id) || empty($context[$list_id])) { |
|
| 25 | + return; |
|
| 26 | + } |
|
| 26 | 27 | $cur_list = &$context[$list_id]; |
| 27 | 28 | |
| 28 | 29 | // These are the main tabs that is used all around the template. |
| 29 | - if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'top')) |
|
| 30 | - template_create_list_menu($cur_list['list_menu'], 'top'); |
|
| 30 | + if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'top')) { |
|
| 31 | + template_create_list_menu($cur_list['list_menu'], 'top'); |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | - if (isset($cur_list['form'])) |
|
| 33 | - echo ' |
|
| 34 | + if (isset($cur_list['form'])) { |
|
| 35 | + echo ' |
|
| 34 | 36 | <form action="', $cur_list['form']['href'], '" method="post"', empty($cur_list['form']['name']) ? '' : ' name="' . $cur_list['form']['name'] . '" id="' . $cur_list['form']['name'] . '"', ' accept-charset="', $context['character_set'], '">'; |
| 37 | + } |
|
| 35 | 38 | |
| 36 | 39 | // Show the title of the table (if any). |
| 37 | - if (!empty($cur_list['title'])) |
|
| 38 | - echo ' |
|
| 40 | + if (!empty($cur_list['title'])) { |
|
| 41 | + echo ' |
|
| 39 | 42 | <div class="cat_bar"> |
| 40 | 43 | <h3 class="catbg"> |
| 41 | 44 | ', $cur_list['title'], ' |
| 42 | 45 | </h3> |
| 43 | 46 | </div>'; |
| 47 | + } |
|
| 44 | 48 | |
| 45 | 49 | if (isset($cur_list['additional_rows']['after_title'])) |
| 46 | 50 | { |
@@ -51,20 +55,23 @@ discard block |
||
| 51 | 55 | </div>'; |
| 52 | 56 | } |
| 53 | 57 | |
| 54 | - if (isset($cur_list['additional_rows']['top_of_list'])) |
|
| 55 | - template_additional_rows('top_of_list', $cur_list); |
|
| 58 | + if (isset($cur_list['additional_rows']['top_of_list'])) { |
|
| 59 | + template_additional_rows('top_of_list', $cur_list); |
|
| 60 | + } |
|
| 56 | 61 | |
| 57 | 62 | if ((!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) || isset($cur_list['additional_rows']['above_column_headers'])) |
| 58 | 63 | { |
| 59 | 64 | // Show the page index (if this list doesn't intend to show all items). |
| 60 | - if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) |
|
| 61 | - echo ' |
|
| 65 | + if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) { |
|
| 66 | + echo ' |
|
| 62 | 67 | <div class="floatleft"> |
| 63 | 68 | <div class="pagesection">', $cur_list['page_index'], '</div> |
| 64 | 69 | </div>'; |
| 70 | + } |
|
| 65 | 71 | |
| 66 | - if (isset($cur_list['additional_rows']['above_column_headers'])) |
|
| 67 | - template_additional_rows('above_column_headers', $cur_list); |
|
| 72 | + if (isset($cur_list['additional_rows']['above_column_headers'])) { |
|
| 73 | + template_additional_rows('above_column_headers', $cur_list); |
|
| 74 | + } |
|
| 68 | 75 | } |
| 69 | 76 | |
| 70 | 77 | echo ' |
@@ -94,11 +101,12 @@ discard block |
||
| 94 | 101 | <tbody>'; |
| 95 | 102 | |
| 96 | 103 | // Show a nice message informing there are no items in this list. |
| 97 | - if (empty($cur_list['rows']) && !empty($cur_list['no_items_label'])) |
|
| 98 | - echo ' |
|
| 104 | + if (empty($cur_list['rows']) && !empty($cur_list['no_items_label'])) { |
|
| 105 | + echo ' |
|
| 99 | 106 | <tr class="windowbg"> |
| 100 | 107 | <td colspan="', $cur_list['num_columns'], '" class="', !empty($cur_list['no_items_align']) ? $cur_list['no_items_align'] : 'centertext', '">', $cur_list['no_items_label'], '</td> |
| 101 | 108 | </tr>'; |
| 109 | + } |
|
| 102 | 110 | |
| 103 | 111 | // Show the list rows. |
| 104 | 112 | elseif (!empty($cur_list['rows'])) |
@@ -108,10 +116,11 @@ discard block |
||
| 108 | 116 | echo ' |
| 109 | 117 | <tr class="windowbg', empty($row['class']) ? '' : ' ' . $row['class'], '"', empty($row['style']) ? '' : ' style="' . $row['style'] . '"', ' id="list_', $list_id, '_', $id, '">'; |
| 110 | 118 | |
| 111 | - if (!empty($row['data'])) |
|
| 112 | - foreach ($row['data'] as $row_data) |
|
| 119 | + if (!empty($row['data'])) { |
|
| 120 | + foreach ($row['data'] as $row_data) |
|
| 113 | 121 | echo ' |
| 114 | 122 | <td', empty($row_data['class']) ? '' : ' class="' . $row_data['class'] . '"', empty($row_data['style']) ? '' : ' style="' . $row_data['style'] . '"', '>', $row_data['value'], '</td>'; |
| 123 | + } |
|
| 115 | 124 | |
| 116 | 125 | echo ' |
| 117 | 126 | </tr>'; |
@@ -128,46 +137,53 @@ discard block |
||
| 128 | 137 | <div class="flow_auto">'; |
| 129 | 138 | |
| 130 | 139 | // Show the page index (if this list doesn't intend to show all items). |
| 131 | - if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) |
|
| 132 | - echo ' |
|
| 140 | + if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) { |
|
| 141 | + echo ' |
|
| 133 | 142 | <div class="floatleft"> |
| 134 | 143 | <div class="pagesection">', $cur_list['page_index'], '</div> |
| 135 | 144 | </div>'; |
| 145 | + } |
|
| 136 | 146 | |
| 137 | - if (isset($cur_list['additional_rows']['below_table_data'])) |
|
| 138 | - template_additional_rows('below_table_data', $cur_list); |
|
| 147 | + if (isset($cur_list['additional_rows']['below_table_data'])) { |
|
| 148 | + template_additional_rows('below_table_data', $cur_list); |
|
| 149 | + } |
|
| 139 | 150 | |
| 140 | 151 | echo ' |
| 141 | 152 | </div>'; |
| 142 | 153 | } |
| 143 | 154 | |
| 144 | - if (isset($cur_list['additional_rows']['bottom_of_list'])) |
|
| 145 | - template_additional_rows('bottom_of_list', $cur_list); |
|
| 155 | + if (isset($cur_list['additional_rows']['bottom_of_list'])) { |
|
| 156 | + template_additional_rows('bottom_of_list', $cur_list); |
|
| 157 | + } |
|
| 146 | 158 | |
| 147 | 159 | if (isset($cur_list['form'])) |
| 148 | 160 | { |
| 149 | - foreach ($cur_list['form']['hidden_fields'] as $name => $value) |
|
| 150 | - echo ' |
|
| 161 | + foreach ($cur_list['form']['hidden_fields'] as $name => $value) { |
|
| 162 | + echo ' |
|
| 151 | 163 | <input type="hidden" name="', $name, '" value="', $value, '">'; |
| 164 | + } |
|
| 152 | 165 | |
| 153 | - if (isset($cur_list['form']['token'])) |
|
| 154 | - echo ' |
|
| 166 | + if (isset($cur_list['form']['token'])) { |
|
| 167 | + echo ' |
|
| 155 | 168 | <input type="hidden" name="', $context[$cur_list['form']['token'] . '_token_var'], '" value="', $context[$cur_list['form']['token'] . '_token'], '">'; |
| 169 | + } |
|
| 156 | 170 | |
| 157 | 171 | echo ' |
| 158 | 172 | </form>'; |
| 159 | 173 | } |
| 160 | 174 | |
| 161 | 175 | // Tabs at the bottom. Usually bottom aligned. |
| 162 | - if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'bottom')) |
|
| 163 | - template_create_list_menu($cur_list['list_menu'], 'bottom'); |
|
| 176 | + if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'bottom')) { |
|
| 177 | + template_create_list_menu($cur_list['list_menu'], 'bottom'); |
|
| 178 | + } |
|
| 164 | 179 | |
| 165 | - if (isset($cur_list['javascript'])) |
|
| 166 | - echo ' |
|
| 180 | + if (isset($cur_list['javascript'])) { |
|
| 181 | + echo ' |
|
| 167 | 182 | <script> |
| 168 | 183 | ', $cur_list['javascript'], ' |
| 169 | 184 | </script>'; |
| 170 | -} |
|
| 185 | + } |
|
| 186 | + } |
|
| 171 | 187 | |
| 172 | 188 | /** |
| 173 | 189 | * This template displays additional rows above or below the list. |
@@ -177,10 +193,11 @@ discard block |
||
| 177 | 193 | */ |
| 178 | 194 | function template_additional_rows($row_position, $cur_list) |
| 179 | 195 | { |
| 180 | - foreach ($cur_list['additional_rows'][$row_position] as $row) |
|
| 181 | - echo ' |
|
| 196 | + foreach ($cur_list['additional_rows'][$row_position] as $row) { |
|
| 197 | + echo ' |
|
| 182 | 198 | <div class="additional_row', empty($row['class']) ? '' : ' ' . $row['class'], '"', empty($row['style']) ? '' : ' style="' . $row['style'] . '"', '>', $row['value'], '</div>'; |
| 183 | -} |
|
| 199 | + } |
|
| 200 | + } |
|
| 184 | 201 | |
| 185 | 202 | /** |
| 186 | 203 | * This function creates a menu |
@@ -239,18 +256,19 @@ discard block |
||
| 239 | 256 | |
| 240 | 257 | foreach ($list_menu['links'] as $link) |
| 241 | 258 | { |
| 242 | - if ($link['is_selected']) |
|
| 243 | - echo ' |
|
| 259 | + if ($link['is_selected']) { |
|
| 260 | + echo ' |
|
| 244 | 261 | <td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_active_', $first, '"> </td> |
| 245 | 262 | <td class="', $direction == 'top' ? 'mirrortab' : 'maintab', '_active_back"> |
| 246 | 263 | <a href="', $link['href'], '">', $link['label'], '</a> |
| 247 | 264 | </td> |
| 248 | 265 | <td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_active_', $last, '"> </td>'; |
| 249 | - else |
|
| 250 | - echo ' |
|
| 266 | + } else { |
|
| 267 | + echo ' |
|
| 251 | 268 | <td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_back"> |
| 252 | 269 | <a href="', $link['href'], '">', $link['label'], '</a> |
| 253 | 270 | </td>'; |
| 271 | + } |
|
| 254 | 272 | } |
| 255 | 273 | |
| 256 | 274 | echo ' |
@@ -261,12 +279,12 @@ discard block |
||
| 261 | 279 | <td> </td>' : '', ' |
| 262 | 280 | </tr> |
| 263 | 281 | </table>'; |
| 264 | - } |
|
| 265 | - elseif (isset($list_menu['style']) && $list_menu['style'] == 'buttons') |
|
| 282 | + } elseif (isset($list_menu['style']) && $list_menu['style'] == 'buttons') |
|
| 266 | 283 | { |
| 267 | 284 | $links = array(); |
| 268 | - foreach ($list_menu['links'] as $link) |
|
| 269 | - $links[] = '<a href="' . $link['href'] . '">' . $link['label'] . '</a>'; |
|
| 285 | + foreach ($list_menu['links'] as $link) { |
|
| 286 | + $links[] = '<a href="' . $link['href'] . '">' . $link['label'] . '</a>'; |
|
| 287 | + } |
|
| 270 | 288 | |
| 271 | 289 | echo ' |
| 272 | 290 | <table style="margin-', $list_menu['position'], ': 10px; width: 100%;"> |
@@ -583,8 +583,7 @@ discard block |
||
| 583 | 583 | { |
| 584 | 584 | $header = '<?php require("' . ($user_info['is_admin'] ? addslashes(realpath($boarddir . '/SSI.php')) : 'SSI.php') . '"); ?>' . "\n" . $header; |
| 585 | 585 | return $header . template_homepage_sample1_html() . $footer; |
| 586 | - } |
|
| 587 | - else |
|
| 586 | + } else |
|
| 588 | 587 | { |
| 589 | 588 | echo $header; |
| 590 | 589 | template_homepage_sample1_php(); |
@@ -599,9 +598,10 @@ discard block |
||
| 599 | 598 | |
| 600 | 599 | $topics = ssi_recentTopics(8, null, null, 'array'); |
| 601 | 600 | |
| 602 | - foreach ($topics as $topic) |
|
| 603 | - echo ' |
|
| 601 | + foreach ($topics as $topic) { |
|
| 602 | + echo ' |
|
| 604 | 603 | <li><a href="', $topic['href'], '">', $topic['subject'], '</a> ', $txt['by'], ' ', $topic['poster']['link'], '</li>'; |
| 604 | + } |
|
| 605 | 605 | |
| 606 | 606 | unset($topics); |
| 607 | 607 | |
@@ -186,8 +186,9 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | ########## Error-Catching ########## |
| 188 | 188 | # Note: You shouldn't touch these settings. |
| 189 | -if (file_exists(dirname(__FILE__) . '/db_last_error.php')) |
|
| 189 | +if (file_exists(dirname(__FILE__) . '/db_last_error.php')) { |
|
| 190 | 190 | include(dirname(__FILE__) . '/db_last_error.php'); |
| 191 | +} |
|
| 191 | 192 | |
| 192 | 193 | if (!isset($db_last_error)) |
| 193 | 194 | { |
@@ -202,11 +203,14 @@ discard block |
||
| 202 | 203 | } |
| 203 | 204 | |
| 204 | 205 | # Make sure the paths are correct... at least try to fix them. |
| 205 | -if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt')) |
|
| 206 | +if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt')) { |
|
| 206 | 207 | $boarddir = dirname(__FILE__); |
| 207 | -if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources')) |
|
| 208 | +} |
|
| 209 | +if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources')) { |
|
| 208 | 210 | $sourcedir = $boarddir . '/Sources'; |
| 209 | -if (!file_exists($cachedir) && file_exists($boarddir . '/cache')) |
|
| 211 | +} |
|
| 212 | +if (!file_exists($cachedir) && file_exists($boarddir . '/cache')) { |
|
| 210 | 213 | $cachedir = $boarddir . '/cache'; |
| 214 | +} |
|
| 211 | 215 | |
| 212 | 216 | ?> |
| 213 | 217 | \ No newline at end of file |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | ) |
| 51 | 51 | ); |
| 52 | 52 | $members = array(); |
| 53 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 54 | - $members[$row['id_member']] = array( |
|
| 53 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 54 | + $members[$row['id_member']] = array( |
|
| 55 | 55 | 'id' => $row['id_member'], |
| 56 | 56 | 'real_name' => $row['real_name'], |
| 57 | 57 | 'email_address' => $row['email_address'], |
@@ -62,6 +62,7 @@ discard block |
||
| 62 | 62 | ), |
| 63 | 63 | 'lngfile' => $row['lngfile'], |
| 64 | 64 | ); |
| 65 | + } |
|
| 65 | 66 | $smcFunc['db_free_result']($request); |
| 66 | 67 | |
| 67 | 68 | return $members; |
@@ -83,13 +84,14 @@ discard block |
||
| 83 | 84 | |
| 84 | 85 | call_integration_hook('mention_insert_' . $content_type, array($content_id, &$members)); |
| 85 | 86 | |
| 86 | - foreach ($members as $member) |
|
| 87 | - $smcFunc['db_insert']('ignore', |
|
| 87 | + foreach ($members as $member) { |
|
| 88 | + $smcFunc['db_insert']('ignore', |
|
| 88 | 89 | '{db_prefix}mentions', |
| 89 | 90 | array('content_id' => 'int', 'content_type' => 'string', 'id_member' => 'int', 'id_mentioned' => 'int', 'time' => 'int'), |
| 90 | 91 | array((int) $content_id, $content_type, $id_member, $member['id'], time()), |
| 91 | 92 | array('content_id', 'content_type', 'id_mentioned') |
| 92 | 93 | ); |
| 94 | + } |
|
| 93 | 95 | } |
| 94 | 96 | |
| 95 | 97 | /** |
@@ -103,8 +105,9 @@ discard block |
||
| 103 | 105 | */ |
| 104 | 106 | public static function getBody($body, array $members) |
| 105 | 107 | { |
| 106 | - foreach ($members as $member) |
|
| 107 | - $body = str_ireplace(static::$char . $member['real_name'], '[member=' . $member['id'] . ']' . $member['real_name'] . '[/member]', $body); |
|
| 108 | + foreach ($members as $member) { |
|
| 109 | + $body = str_ireplace(static::$char . $member['real_name'], '[member=' . $member['id'] . ']' . $member['real_name'] . '[/member]', $body); |
|
| 110 | + } |
|
| 108 | 111 | |
| 109 | 112 | return $body; |
| 110 | 113 | } |
@@ -123,8 +126,9 @@ discard block |
||
| 123 | 126 | |
| 124 | 127 | $possible_names = self::getPossibleMentions($body); |
| 125 | 128 | |
| 126 | - if (empty($possible_names) || !allowedTo('mention')) |
|
| 127 | - return array(); |
|
| 129 | + if (empty($possible_names) || !allowedTo('mention')) { |
|
| 130 | + return array(); |
|
| 131 | + } |
|
| 128 | 132 | |
| 129 | 133 | $request = $smcFunc['db_query']('', ' |
| 130 | 134 | SELECT id_member, real_name |
@@ -140,8 +144,9 @@ discard block |
||
| 140 | 144 | $members = array(); |
| 141 | 145 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 142 | 146 | { |
| 143 | - if (stripos($body, static::$char . $row['real_name']) === false) |
|
| 144 | - continue; |
|
| 147 | + if (stripos($body, static::$char . $row['real_name']) === false) { |
|
| 148 | + continue; |
|
| 149 | + } |
|
| 145 | 150 | |
| 146 | 151 | $members[$row['id_member']] = array( |
| 147 | 152 | 'id' => $row['id_member'], |
@@ -185,8 +190,9 @@ discard block |
||
| 185 | 190 | $body = htmlspecialchars_decode(preg_replace('~<br\s*/?\>~', "\n", str_replace(' ', ' ', $body)), ENT_QUOTES); |
| 186 | 191 | |
| 187 | 192 | // Remove quotes, we don't want to get double mentions. |
| 188 | - while (preg_match('~\[quote[^\]]*\](.+?)\[\/quote\]~s', $body)) |
|
| 189 | - $body = preg_replace('~\[quote[^\]]*\](.+?)\[\/quote\]~s', '', $body); |
|
| 193 | + while (preg_match('~\[quote[^\]]*\](.+?)\[\/quote\]~s', $body)) { |
|
| 194 | + $body = preg_replace('~\[quote[^\]]*\](.+?)\[\/quote\]~s', '', $body); |
|
| 195 | + } |
|
| 190 | 196 | |
| 191 | 197 | $matches = array(); |
| 192 | 198 | $string = str_split($body); |
@@ -197,9 +203,9 @@ discard block |
||
| 197 | 203 | { |
| 198 | 204 | $depth++; |
| 199 | 205 | $matches[] = array(); |
| 206 | + } elseif ($char == "\n") { |
|
| 207 | + $depth = 0; |
|
| 200 | 208 | } |
| 201 | - elseif ($char == "\n") |
|
| 202 | - $depth = 0; |
|
| 203 | 209 | |
| 204 | 210 | for ($i = $depth; $i > 0; $i--) |
| 205 | 211 | { |
@@ -212,8 +218,9 @@ discard block |
||
| 212 | 218 | } |
| 213 | 219 | } |
| 214 | 220 | |
| 215 | - foreach ($matches as $k => $match) |
|
| 216 | - $matches[$k] = substr(implode('', $match), 1); |
|
| 221 | + foreach ($matches as $k => $match) { |
|
| 222 | + $matches[$k] = substr(implode('', $match), 1); |
|
| 223 | + } |
|
| 217 | 224 | |
| 218 | 225 | // Names can have spaces, other breaks, or they can't...we try to match every possible |
| 219 | 226 | // combination. |
@@ -223,8 +230,9 @@ discard block |
||
| 223 | 230 | $match = preg_split('/([^\w])/', $match, -1, PREG_SPLIT_DELIM_CAPTURE); |
| 224 | 231 | $count = count($match); |
| 225 | 232 | |
| 226 | - for ($i = 1; $i <= $count; $i++) |
|
| 227 | - $names[] = $smcFunc['htmlspecialchars']($smcFunc['htmltrim'](implode('', array_slice($match, 0, $i)))); |
|
| 233 | + for ($i = 1; $i <= $count; $i++) { |
|
| 234 | + $names[] = $smcFunc['htmlspecialchars']($smcFunc['htmltrim'](implode('', array_slice($match, 0, $i)))); |
|
| 235 | + } |
|
| 228 | 236 | } |
| 229 | 237 | |
| 230 | 238 | $names = array_unique($names); |
@@ -89,8 +89,9 @@ discard block |
||
| 89 | 89 | foreach ($section['areas'] as $i => $area) |
| 90 | 90 | { |
| 91 | 91 | // Not supposed to be printed? |
| 92 | - if (empty($area['label'])) |
|
| 93 | - continue; |
|
| 92 | + if (empty($area['label'])) { |
|
| 93 | + continue; |
|
| 94 | + } |
|
| 94 | 95 | |
| 95 | 96 | echo ' |
| 96 | 97 | <li', !empty($area['subsections']) ? ' class="subsections"' : '', '>'; |
@@ -99,8 +100,9 @@ discard block |
||
| 99 | 100 | <a class="', $area['icon_class'], !empty($area['selected']) ? ' chosen ' : '', '" href="', (isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $i), $menu_context['extra_parameters'], '">', $area['icon'], $area['label'], '</a>'; |
| 100 | 101 | |
| 101 | 102 | // Is this the current area, or just some area? |
| 102 | - if (!empty($area['selected']) && empty($context['tabs'])) |
|
| 103 | - $context['tabs'] = isset($area['subsections']) ? $area['subsections'] : array(); |
|
| 103 | + if (!empty($area['selected']) && empty($context['tabs'])) { |
|
| 104 | + $context['tabs'] = isset($area['subsections']) ? $area['subsections'] : array(); |
|
| 105 | + } |
|
| 104 | 106 | |
| 105 | 107 | // Are there any subsections? |
| 106 | 108 | if (!empty($area['subsections'])) |
@@ -110,8 +112,9 @@ discard block |
||
| 110 | 112 | |
| 111 | 113 | foreach ($area['subsections'] as $sa => $sub) |
| 112 | 114 | { |
| 113 | - if (!empty($sub['disabled'])) |
|
| 114 | - continue; |
|
| 115 | + if (!empty($sub['disabled'])) { |
|
| 116 | + continue; |
|
| 117 | + } |
|
| 115 | 118 | |
| 116 | 119 | $url = isset($sub['url']) ? $sub['url'] : (isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $i) . ';sa=' . $sa; |
| 117 | 120 | |
@@ -158,8 +161,9 @@ discard block |
||
| 158 | 161 | <h3 class="catbg">'; |
| 159 | 162 | |
| 160 | 163 | // The function is in Admin.template.php, but since this template is used elsewhere too better check if the function is available |
| 161 | - if (function_exists('template_admin_quick_search')) |
|
| 162 | - template_admin_quick_search(); |
|
| 164 | + if (function_exists('template_admin_quick_search')) { |
|
| 165 | + template_admin_quick_search(); |
|
| 166 | + } |
|
| 163 | 167 | |
| 164 | 168 | // Exactly how many tabs do we have? |
| 165 | 169 | if (!empty($context['tabs'])) |
@@ -174,30 +178,36 @@ discard block |
||
| 174 | 178 | } |
| 175 | 179 | |
| 176 | 180 | // Did this not even exist - or do we not have a label? |
| 177 | - if (!isset($tab_context['tabs'][$id])) |
|
| 178 | - $tab_context['tabs'][$id] = array('label' => $tab['label']); |
|
| 179 | - elseif (!isset($tab_context['tabs'][$id]['label'])) |
|
| 180 | - $tab_context['tabs'][$id]['label'] = $tab['label']; |
|
| 181 | + if (!isset($tab_context['tabs'][$id])) { |
|
| 182 | + $tab_context['tabs'][$id] = array('label' => $tab['label']); |
|
| 183 | + } elseif (!isset($tab_context['tabs'][$id]['label'])) { |
|
| 184 | + $tab_context['tabs'][$id]['label'] = $tab['label']; |
|
| 185 | + } |
|
| 181 | 186 | |
| 182 | 187 | // Has a custom URL defined in the main admin structure? |
| 183 | - if (isset($tab['url']) && !isset($tab_context['tabs'][$id]['url'])) |
|
| 184 | - $tab_context['tabs'][$id]['url'] = $tab['url']; |
|
| 188 | + if (isset($tab['url']) && !isset($tab_context['tabs'][$id]['url'])) { |
|
| 189 | + $tab_context['tabs'][$id]['url'] = $tab['url']; |
|
| 190 | + } |
|
| 185 | 191 | |
| 186 | 192 | // Any additional paramaters for the url? |
| 187 | - if (isset($tab['add_params']) && !isset($tab_context['tabs'][$id]['add_params'])) |
|
| 188 | - $tab_context['tabs'][$id]['add_params'] = $tab['add_params']; |
|
| 193 | + if (isset($tab['add_params']) && !isset($tab_context['tabs'][$id]['add_params'])) { |
|
| 194 | + $tab_context['tabs'][$id]['add_params'] = $tab['add_params']; |
|
| 195 | + } |
|
| 189 | 196 | |
| 190 | 197 | // Has it been deemed selected? |
| 191 | - if (!empty($tab['is_selected'])) |
|
| 192 | - $tab_context['tabs'][$id]['is_selected'] = true; |
|
| 198 | + if (!empty($tab['is_selected'])) { |
|
| 199 | + $tab_context['tabs'][$id]['is_selected'] = true; |
|
| 200 | + } |
|
| 193 | 201 | |
| 194 | 202 | // Does it have its own help? |
| 195 | - if (!empty($tab['help'])) |
|
| 196 | - $tab_context['tabs'][$id]['help'] = $tab['help']; |
|
| 203 | + if (!empty($tab['help'])) { |
|
| 204 | + $tab_context['tabs'][$id]['help'] = $tab['help']; |
|
| 205 | + } |
|
| 197 | 206 | |
| 198 | 207 | // Is this the last one? |
| 199 | - if (!empty($tab['is_last']) && !isset($tab_context['override_last'])) |
|
| 200 | - $tab_context['tabs'][$id]['is_last'] = true; |
|
| 208 | + if (!empty($tab['is_last']) && !isset($tab_context['override_last'])) { |
|
| 209 | + $tab_context['tabs'][$id]['is_last'] = true; |
|
| 210 | + } |
|
| 201 | 211 | } |
| 202 | 212 | |
| 203 | 213 | // Find the selected tab |
@@ -214,17 +224,18 @@ discard block |
||
| 214 | 224 | // Show an icon and/or a help item? |
| 215 | 225 | if (!empty($selected_tab['icon_class']) || !empty($tab_context['icon_class']) || !empty($selected_tab['icon']) || !empty($tab_context['icon']) || !empty($selected_tab['help']) || !empty($tab_context['help'])) |
| 216 | 226 | { |
| 217 | - if (!empty($selected_tab['icon_class']) || !empty($tab_context['icon_class'])) |
|
| 218 | - echo '<span class="', !empty($selected_tab['icon_class']) ? $selected_tab['icon_class'] : $tab_context['icon_class'], ' icon"></span>'; |
|
| 219 | - elseif (!empty($selected_tab['icon']) || !empty($tab_context['icon'])) |
|
| 220 | - echo '<img src="', $settings['images_url'], '/icons/', !empty($selected_tab['icon']) ? $selected_tab['icon'] : $tab_context['icon'], '" alt="" class="icon">'; |
|
| 227 | + if (!empty($selected_tab['icon_class']) || !empty($tab_context['icon_class'])) { |
|
| 228 | + echo '<span class="', !empty($selected_tab['icon_class']) ? $selected_tab['icon_class'] : $tab_context['icon_class'], ' icon"></span>'; |
|
| 229 | + } elseif (!empty($selected_tab['icon']) || !empty($tab_context['icon'])) { |
|
| 230 | + echo '<img src="', $settings['images_url'], '/icons/', !empty($selected_tab['icon']) ? $selected_tab['icon'] : $tab_context['icon'], '" alt="" class="icon">'; |
|
| 231 | + } |
|
| 221 | 232 | |
| 222 | - if (!empty($selected_tab['help']) || !empty($tab_context['help'])) |
|
| 223 | - echo '<a href="', $scripturl, '?action=helpadmin;help=', !empty($selected_tab['help']) ? $selected_tab['help'] : $tab_context['help'], '" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a>'; |
|
| 233 | + if (!empty($selected_tab['help']) || !empty($tab_context['help'])) { |
|
| 234 | + echo '<a href="', $scripturl, '?action=helpadmin;help=', !empty($selected_tab['help']) ? $selected_tab['help'] : $tab_context['help'], '" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a>'; |
|
| 235 | + } |
|
| 224 | 236 | |
| 225 | 237 | echo $tab_context['title']; |
| 226 | - } |
|
| 227 | - else |
|
| 238 | + } else |
|
| 228 | 239 | { |
| 229 | 240 | echo ' |
| 230 | 241 | ', $tab_context['title']; |
@@ -237,11 +248,12 @@ discard block |
||
| 237 | 248 | } |
| 238 | 249 | |
| 239 | 250 | // Shall we use the tabs? Yes, it's the only known way! |
| 240 | - if (!empty($selected_tab['description']) || !empty($tab_context['description'])) |
|
| 241 | - echo ' |
|
| 251 | + if (!empty($selected_tab['description']) || !empty($tab_context['description'])) { |
|
| 252 | + echo ' |
|
| 242 | 253 | <p class="information"> |
| 243 | 254 | ', !empty($selected_tab['description']) ? $selected_tab['description'] : $tab_context['description'], ' |
| 244 | 255 | </p>'; |
| 256 | + } |
|
| 245 | 257 | |
| 246 | 258 | // Print out all the items in this tab (if any). |
| 247 | 259 | if (!empty($context['tabs'])) |
@@ -253,8 +265,9 @@ discard block |
||
| 253 | 265 | |
| 254 | 266 | foreach ($tab_context['tabs'] as $sa => $tab) |
| 255 | 267 | { |
| 256 | - if (!empty($tab['disabled'])) |
|
| 257 | - continue; |
|
| 268 | + if (!empty($tab['disabled'])) { |
|
| 269 | + continue; |
|
| 270 | + } |
|
| 258 | 271 | |
| 259 | 272 | if (!empty($tab['is_selected'])) |
| 260 | 273 | { |
@@ -262,12 +275,12 @@ discard block |
||
| 262 | 275 | <li> |
| 263 | 276 | <a class="active" href="', isset($tab['url']) ? $tab['url'] : $menu_context['base_url'] . ';area=' . $menu_context['current_area'] . ';sa=' . $sa, $menu_context['extra_parameters'], isset($tab['add_params']) ? $tab['add_params'] : '', '">', $tab['label'], '</a> |
| 264 | 277 | </li>'; |
| 265 | - } |
|
| 266 | - else |
|
| 267 | - echo ' |
|
| 278 | + } else { |
|
| 279 | + echo ' |
|
| 268 | 280 | <li> |
| 269 | 281 | <a href="', isset($tab['url']) ? $tab['url'] : $menu_context['base_url'] . ';area=' . $menu_context['current_area'] . ';sa=' . $sa, $menu_context['extra_parameters'], isset($tab['add_params']) ? $tab['add_params'] : '', '">', $tab['label'], '</a> |
| 270 | 282 | </li>'; |
| 283 | + } |
|
| 271 | 284 | } |
| 272 | 285 | |
| 273 | 286 | // the end of tabs |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |