@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | <meta charset="', $context['character_set'], '"> |
| 25 | 25 | <meta name="robots" content="noindex"> |
| 26 | 26 | <title>', $context['page_title'], '</title> |
| 27 | - <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'] ,'"> |
|
| 28 | - <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'] ,'"></script> |
|
| 27 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'], '"> |
|
| 28 | + <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'], '"></script> |
|
| 29 | 29 | </head> |
| 30 | 30 | <body id="help_popup"> |
| 31 | 31 | <div class="windowbg description"> |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | <title>', $txt['find_members'], '</title> |
| 51 | 51 | <meta charset="', $context['character_set'], '"> |
| 52 | 52 | <meta name="robots" content="noindex"> |
| 53 | - <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'] ,'"> |
|
| 54 | - <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'] ,'"></script> |
|
| 53 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'], '"> |
|
| 54 | + <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'], '"></script> |
|
| 55 | 55 | <script> |
| 56 | 56 | var membersAdded = []; |
| 57 | 57 | function addMember(name) |
@@ -86,9 +86,10 @@ discard block |
||
| 86 | 86 | <span class="smalltext"><em>', $txt['find_wildcards'], '</em></span><br>'; |
| 87 | 87 | |
| 88 | 88 | // Only offer to search for buddies if we have some! |
| 89 | - if (!empty($context['show_buddies'])) |
|
| 90 | - echo ' |
|
| 89 | + if (!empty($context['show_buddies'])) { |
|
| 90 | + echo ' |
|
| 91 | 91 | <span class="smalltext"><label for="buddies"><input type="checkbox" name="buddies" id="buddies"', !empty($context['buddy_search']) ? ' checked' : '', '> ', $txt['find_buddies'], '</label></span><br>'; |
| 92 | + } |
|
| 92 | 93 | |
| 93 | 94 | echo ' |
| 94 | 95 | <div class="padding righttext"> |
@@ -103,10 +104,10 @@ discard block |
||
| 103 | 104 | <h3 class="catbg">', $txt['find_results'], '</h3> |
| 104 | 105 | </div>'; |
| 105 | 106 | |
| 106 | - if (empty($context['results'])) |
|
| 107 | - echo ' |
|
| 107 | + if (empty($context['results'])) { |
|
| 108 | + echo ' |
|
| 108 | 109 | <p class="error">', $txt['find_no_results'], '</p>'; |
| 109 | - else |
|
| 110 | + } else |
|
| 110 | 111 | { |
| 111 | 112 | echo ' |
| 112 | 113 | <ul class="padding">'; |
@@ -135,11 +136,12 @@ discard block |
||
| 135 | 136 | <input type="hidden" name="quote" value="', $context['quote_results'] ? '1' : '0', '"> |
| 136 | 137 | </form>'; |
| 137 | 138 | |
| 138 | - if (empty($context['results'])) |
|
| 139 | - echo ' |
|
| 139 | + if (empty($context['results'])) { |
|
| 140 | + echo ' |
|
| 140 | 141 | <script> |
| 141 | 142 | document.getElementById("search").focus(); |
| 142 | 143 | </script>'; |
| 144 | + } |
|
| 143 | 145 | |
| 144 | 146 | echo ' |
| 145 | 147 | </body> |
@@ -183,8 +185,8 @@ discard block |
||
| 183 | 185 | { |
| 184 | 186 | global $txt, $context, $modSettings; |
| 185 | 187 | |
| 186 | - if (!empty($modSettings['requireAgreement'])) |
|
| 187 | - echo ' |
|
| 188 | + if (!empty($modSettings['requireAgreement'])) { |
|
| 189 | + echo ' |
|
| 188 | 190 | <div class="cat_bar"> |
| 189 | 191 | <h3 class="catbg"> |
| 190 | 192 | ', $txt['terms_and_rules'], ' - ', $context['forum_name_html_safe'], ' |
@@ -193,11 +195,12 @@ discard block |
||
| 193 | 195 | <div class="roundframe"> |
| 194 | 196 | ', $context['agreement'], ' |
| 195 | 197 | </div>'; |
| 196 | - else |
|
| 197 | - echo ' |
|
| 198 | + } else { |
|
| 199 | + echo ' |
|
| 198 | 200 | <div class="noticebox"> |
| 199 | 201 | ', $txt['agreement_disabled'], ' |
| 200 | 202 | </div>'; |
| 201 | -} |
|
| 203 | + } |
|
| 204 | + } |
|
| 202 | 205 | |
| 203 | 206 | ?> |
| 204 | 207 | \ No newline at end of file |
@@ -31,9 +31,10 @@ discard block |
||
| 31 | 31 | <div class="selectbox floatright" id="upper_show">', $txt['who_show1'], ' |
| 32 | 32 | <select name="show_top" onchange="document.forms.whoFilter.show.value = this.value; document.forms.whoFilter.submit();">'; |
| 33 | 33 | |
| 34 | - foreach ($context['show_methods'] as $value => $label) |
|
| 35 | - echo ' |
|
| 34 | + foreach ($context['show_methods'] as $value => $label) { |
|
| 35 | + echo ' |
|
| 36 | 36 | <option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>'; |
| 37 | + } |
|
| 37 | 38 | echo ' |
| 38 | 39 | </select> |
| 39 | 40 | <noscript> |
@@ -71,9 +72,10 @@ discard block |
||
| 71 | 72 | ', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', ' |
| 72 | 73 | </span>'; |
| 73 | 74 | |
| 74 | - if (!empty($member['ip'])) |
|
| 75 | - echo ' |
|
| 75 | + if (!empty($member['ip'])) { |
|
| 76 | + echo ' |
|
| 76 | 77 | (<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>)'; |
| 78 | + } |
|
| 77 | 79 | |
| 78 | 80 | echo ' |
| 79 | 81 | </td> |
@@ -103,9 +105,10 @@ discard block |
||
| 103 | 105 | <div class="selectbox floatright">', $txt['who_show1'], ' |
| 104 | 106 | <select name="show" onchange="document.forms.whoFilter.submit();">'; |
| 105 | 107 | |
| 106 | - foreach ($context['show_methods'] as $value => $label) |
|
| 107 | - echo ' |
|
| 108 | + foreach ($context['show_methods'] as $value => $label) { |
|
| 109 | + echo ' |
|
| 108 | 110 | <option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>'; |
| 111 | + } |
|
| 109 | 112 | echo ' |
| 110 | 113 | </select> |
| 111 | 114 | <noscript> |
@@ -134,17 +137,19 @@ discard block |
||
| 134 | 137 | |
| 135 | 138 | foreach ($context['credits'] as $section) |
| 136 | 139 | { |
| 137 | - if (isset($section['pretext'])) |
|
| 138 | - echo ' |
|
| 140 | + if (isset($section['pretext'])) { |
|
| 141 | + echo ' |
|
| 139 | 142 | <div class="windowbg noup"> |
| 140 | 143 | <p>', $section['pretext'], '</p> |
| 141 | 144 | </div>'; |
| 145 | + } |
|
| 142 | 146 | |
| 143 | - if (isset($section['title'])) |
|
| 144 | - echo ' |
|
| 147 | + if (isset($section['title'])) { |
|
| 148 | + echo ' |
|
| 145 | 149 | <div class="cat_bar"> |
| 146 | 150 | <h3 class="catbg">', $section['title'], '</h3> |
| 147 | 151 | </div>'; |
| 152 | + } |
|
| 148 | 153 | |
| 149 | 154 | echo ' |
| 150 | 155 | <div class="windowbg2 noup"> |
@@ -152,17 +157,18 @@ discard block |
||
| 152 | 157 | |
| 153 | 158 | foreach ($section['groups'] as $group) |
| 154 | 159 | { |
| 155 | - if (isset($group['title'])) |
|
| 156 | - echo ' |
|
| 160 | + if (isset($group['title'])) { |
|
| 161 | + echo ' |
|
| 157 | 162 | <dt> |
| 158 | 163 | <strong>', $group['title'], '</strong> |
| 159 | 164 | </dt> |
| 160 | 165 | <dd>'; |
| 166 | + } |
|
| 161 | 167 | |
| 162 | 168 | // Try to make this read nicely. |
| 163 | - if (count($group['members']) <= 2) |
|
| 164 | - echo implode(' ' . $txt['credits_and'] . ' ', $group['members']); |
|
| 165 | - else |
|
| 169 | + if (count($group['members']) <= 2) { |
|
| 170 | + echo implode(' ' . $txt['credits_and'] . ' ', $group['members']); |
|
| 171 | + } else |
|
| 166 | 172 | { |
| 167 | 173 | $last_peep = array_pop($group['members']); |
| 168 | 174 | echo implode(', ', $group['members']), ' ', $txt['credits_and'], ' ', $last_peep; |
@@ -175,9 +181,10 @@ discard block |
||
| 175 | 181 | echo ' |
| 176 | 182 | </dl>'; |
| 177 | 183 | |
| 178 | - if (isset($section['posttext'])) |
|
| 179 | - echo ' |
|
| 184 | + if (isset($section['posttext'])) { |
|
| 185 | + echo ' |
|
| 180 | 186 | <p class="posttext">', $section['posttext'], '</p>'; |
| 187 | + } |
|
| 181 | 188 | |
| 182 | 189 | echo ' |
| 183 | 190 | </div>'; |
@@ -192,26 +199,29 @@ discard block |
||
| 192 | 199 | </div> |
| 193 | 200 | <div class="windowbg noup">'; |
| 194 | 201 | |
| 195 | - if (!empty($context['credits_software_graphics']['graphics'])) |
|
| 196 | - echo ' |
|
| 202 | + if (!empty($context['credits_software_graphics']['graphics'])) { |
|
| 203 | + echo ' |
|
| 197 | 204 | <dl> |
| 198 | 205 | <dt><strong>', $txt['credits_graphics'], '</strong></dt> |
| 199 | 206 | <dd>', implode('</dd><dd>', $context['credits_software_graphics']['graphics']), '</dd> |
| 200 | 207 | </dl>'; |
| 208 | + } |
|
| 201 | 209 | |
| 202 | - if (!empty($context['credits_software_graphics']['software'])) |
|
| 203 | - echo ' |
|
| 210 | + if (!empty($context['credits_software_graphics']['software'])) { |
|
| 211 | + echo ' |
|
| 204 | 212 | <dl> |
| 205 | 213 | <dt><strong>', $txt['credits_software'], '</strong></dt> |
| 206 | 214 | <dd>', implode('</dd><dd>', $context['credits_software_graphics']['software']), '</dd> |
| 207 | 215 | </dl>'; |
| 216 | + } |
|
| 208 | 217 | |
| 209 | - if (!empty($context['credits_software_graphics']['fonts'])) |
|
| 210 | - echo ' |
|
| 218 | + if (!empty($context['credits_software_graphics']['fonts'])) { |
|
| 219 | + echo ' |
|
| 211 | 220 | <dl> |
| 212 | 221 | <dt><strong>', $txt['credits_fonts'], '</strong></dt> |
| 213 | 222 | <dd>', implode('</dd><dd>', $context['credits_software_graphics']['fonts']), '</dd> |
| 214 | 223 | </dl>'; |
| 224 | + } |
|
| 215 | 225 | echo ' |
| 216 | 226 | </div>'; |
| 217 | 227 | } |
@@ -226,16 +236,18 @@ discard block |
||
| 226 | 236 | <div class="windowbg noup">'; |
| 227 | 237 | |
| 228 | 238 | // Display the credits. |
| 229 | - if (!empty($context['credits_modifications'])) |
|
| 230 | - echo ' |
|
| 239 | + if (!empty($context['credits_modifications'])) { |
|
| 240 | + echo ' |
|
| 231 | 241 | ', implode(' |
| 232 | 242 | <br>', $context['credits_modifications']); |
| 243 | + } |
|
| 233 | 244 | |
| 234 | 245 | // Legacy. |
| 235 | - if (!empty($context['copyrights']['mods'])) |
|
| 236 | - echo (empty($context['credits_modifications']) ? '<br>' : ''), |
|
| 246 | + if (!empty($context['copyrights']['mods'])) { |
|
| 247 | + echo (empty($context['credits_modifications']) ? '<br>' : ''), |
|
| 237 | 248 | implode(' |
| 238 | 249 | <br>', $context['copyrights']['mods']); |
| 250 | + } |
|
| 239 | 251 | |
| 240 | 252 | echo ' |
| 241 | 253 | </div>'; |
@@ -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'])) |
@@ -220,7 +220,7 @@ |
||
| 220 | 220 | ), |
| 221 | 221 | ), |
| 222 | 222 | ); |
| 223 | - */ |
|
| 223 | + */ |
|
| 224 | 224 | |
| 225 | 225 | // Are we using right-to-left orientation? |
| 226 | 226 | $first = $context['right_to_left'] ? 'last' : 'first'; |
@@ -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%;"> |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | |
| 40 | 40 | foreach ($category['boards'] as $board) |
| 41 | 41 | echo ' |
| 42 | - <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level']-1) . '=> ' : '', $board['name'], '</option>'; |
|
| 42 | + <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=> ' : '', $board['name'], '</option>'; |
|
| 43 | 43 | echo ' |
| 44 | 44 | </optgroup>'; |
| 45 | 45 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | // Stick our "create a redirection topic" template in here... |
| 64 | 64 | template_redirect_options('move'); |
| 65 | 65 | |
| 66 | - echo ' |
|
| 66 | + echo ' |
|
| 67 | 67 | <input type="submit" value="', $txt['move_topic'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button"> |
| 68 | 68 | </div> |
| 69 | 69 | </div>'; |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function template_redirect_options($type) |
| 88 | 88 | { |
| 89 | - global $txt, $context, $modSettings; |
|
| 89 | + global $txt, $context, $modSettings; |
|
| 90 | 90 | |
| 91 | - echo ' |
|
| 91 | + echo ' |
|
| 92 | 92 | <label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect"', $context['is_approved'] ? ' checked' : '', ' onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt[$type . '_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';"> ', $txt['post_redirection'], '.</label> |
| 93 | 93 | <fieldset id="reasonArea" style="margin-top: 1ex;', $context['is_approved'] ? '' : 'display: none;', '"> |
| 94 | 94 | <dl class="settings"> |
@@ -37,9 +37,10 @@ discard block |
||
| 37 | 37 | echo ' |
| 38 | 38 | <optgroup label="', $category['name'], '">'; |
| 39 | 39 | |
| 40 | - foreach ($category['boards'] as $board) |
|
| 41 | - echo ' |
|
| 40 | + foreach ($category['boards'] as $board) { |
|
| 41 | + echo ' |
|
| 42 | 42 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level']-1) . '=> ' : '', $board['name'], '</option>'; |
| 43 | + } |
|
| 43 | 44 | echo ' |
| 44 | 45 | </optgroup>'; |
| 45 | 46 | } |
@@ -68,9 +69,10 @@ discard block |
||
| 68 | 69 | </div> |
| 69 | 70 | </div>'; |
| 70 | 71 | |
| 71 | - if ($context['back_to_topic']) |
|
| 72 | - echo ' |
|
| 72 | + if ($context['back_to_topic']) { |
|
| 73 | + echo ' |
|
| 73 | 74 | <input type="hidden" name="goback" value="1">'; |
| 75 | + } |
|
| 74 | 76 | |
| 75 | 77 | echo ' |
| 76 | 78 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -120,8 +122,7 @@ discard block |
||
| 120 | 122 | <option value="86400">', $txt['two_months'], '</option> |
| 121 | 123 | </select> |
| 122 | 124 | </dd>'; |
| 123 | - } |
|
| 124 | - else |
|
| 125 | + } else |
|
| 125 | 126 | { |
| 126 | 127 | echo ' |
| 127 | 128 | <input type="hidden" name="redirect_expires" value="0">'; |
@@ -217,9 +218,9 @@ discard block |
||
| 217 | 218 | <input type="submit" value="', $txt['go'], '" class="button"> |
| 218 | 219 | </form>'; |
| 219 | 220 | |
| 221 | + } else { |
|
| 222 | + echo $txt['target_below']; |
|
| 220 | 223 | } |
| 221 | - else |
|
| 222 | - echo $txt['target_below']; |
|
| 223 | 224 | |
| 224 | 225 | echo ' </h4> |
| 225 | 226 | </div>'; |
@@ -237,12 +238,13 @@ discard block |
||
| 237 | 238 | |
| 238 | 239 | $merge_button = create_button('merge', 'merge', ''); |
| 239 | 240 | |
| 240 | - foreach ($context['topics'] as $topic) |
|
| 241 | - echo ' |
|
| 241 | + foreach ($context['topics'] as $topic) { |
|
| 242 | + echo ' |
|
| 242 | 243 | <li> |
| 243 | 244 | <a href="', $scripturl, '?action=mergetopics;sa=options;board=', $context['current_board'], '.0;from=', $context['origin_topic'], ';to=', $topic['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $merge_button, '</a> |
| 244 | 245 | <a href="', $scripturl, '?topic=', $topic['id'], '.0" target="_blank">', $topic['subject'], '</a> ', $txt['started_by'], ' ', $topic['poster']['link'], ' |
| 245 | 246 | </li>'; |
| 247 | + } |
|
| 246 | 248 | |
| 247 | 249 | echo ' |
| 248 | 250 | </ul> |
@@ -251,8 +253,7 @@ discard block |
||
| 251 | 253 | <div class="pagesection"> |
| 252 | 254 | ', $context['page_index'], ' |
| 253 | 255 | </div>'; |
| 254 | - } |
|
| 255 | - else |
|
| 256 | + } else |
|
| 256 | 257 | { |
| 257 | 258 | // Just a nice "There aren't any topics" message |
| 258 | 259 | echo ' |
@@ -306,8 +307,8 @@ discard block |
||
| 306 | 307 | </tr> |
| 307 | 308 | </thead> |
| 308 | 309 | <tbody>'; |
| 309 | - foreach ($context['topics'] as $topic) |
|
| 310 | - echo ' |
|
| 310 | + foreach ($context['topics'] as $topic) { |
|
| 311 | + echo ' |
|
| 311 | 312 | <tr class="windowbg"> |
| 312 | 313 | <td> |
| 313 | 314 | <input type="checkbox" name="topics[]" value="' . $topic['id'] . '" checked> |
@@ -327,6 +328,7 @@ discard block |
||
| 327 | 328 | <input type="checkbox" name="notifications[]" value="' . $topic['id'] . '" checked> |
| 328 | 329 | </td> |
| 329 | 330 | </tr>'; |
| 331 | + } |
|
| 330 | 332 | echo ' |
| 331 | 333 | </tbody> |
| 332 | 334 | </table> |
@@ -337,9 +339,10 @@ discard block |
||
| 337 | 339 | <fieldset id="merge_subject" class="merge_options"> |
| 338 | 340 | <legend>', $txt['merge_select_subject'], '</legend> |
| 339 | 341 | <select name="subject" onchange="this.form.custom_subject.style.display = (this.options[this.selectedIndex].value != 0) ? \'none\': \'\' ;">'; |
| 340 | - foreach ($context['topics'] as $topic) |
|
| 341 | - echo ' |
|
| 342 | + foreach ($context['topics'] as $topic) { |
|
| 343 | + echo ' |
|
| 342 | 344 | <option value="', $topic['id'], '"' . ($topic['selected'] ? ' selected' : '') . '>', $topic['subject'], '</option>'; |
| 345 | + } |
|
| 343 | 346 | echo ' |
| 344 | 347 | <option value="0">', $txt['merge_custom_subject'], ':</option> |
| 345 | 348 | </select> |
@@ -357,11 +360,12 @@ discard block |
||
| 357 | 360 | <fieldset id="merge_board" class="merge_options"> |
| 358 | 361 | <legend>', $txt['merge_select_target_board'], '</legend> |
| 359 | 362 | <ul>'; |
| 360 | - foreach ($context['boards'] as $board) |
|
| 361 | - echo ' |
|
| 363 | + foreach ($context['boards'] as $board) { |
|
| 364 | + echo ' |
|
| 362 | 365 | <li> |
| 363 | 366 | <input type="radio" name="board" value="' . $board['id'] . '"' . ($board['selected'] ? ' checked' : '') . '> ' . $board['name'] . ' |
| 364 | 367 | </li>'; |
| 368 | + } |
|
| 365 | 369 | echo ' |
| 366 | 370 | </ul> |
| 367 | 371 | </fieldset>'; |
@@ -372,11 +376,12 @@ discard block |
||
| 372 | 376 | <fieldset id="merge_poll" class="merge_options"> |
| 373 | 377 | <legend>' . $txt['merge_select_poll'] . '</legend> |
| 374 | 378 | <ul>'; |
| 375 | - foreach ($context['polls'] as $poll) |
|
| 376 | - echo ' |
|
| 379 | + foreach ($context['polls'] as $poll) { |
|
| 380 | + echo ' |
|
| 377 | 381 | <li> |
| 378 | 382 | <input type="radio" name="poll" value="' . $poll['id'] . '"' . ($poll['selected'] ? ' checked' : '') . '> ' . $poll['question'] . ' (' . $txt['topic'] . ': <a href="' . $scripturl . '?topic=' . $poll['topic']['id'] . '.0" target="_blank">' . $poll['topic']['subject'] . '</a>) |
| 379 | 383 | </li>'; |
| 384 | + } |
|
| 380 | 385 | echo ' |
| 381 | 386 | <li> |
| 382 | 387 | <input type="radio" name="poll" value="-1"> (' . $txt['merge_no_poll'] . ') |
@@ -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); |
@@ -180,7 +180,7 @@ |
||
| 180 | 180 | * |
| 181 | 181 | * @access public |
| 182 | 182 | * @param string $dir A valid path |
| 183 | - * @return boolean If this was successful or not. |
|
| 183 | + * @return boolean|null If this was successful or not. |
|
| 184 | 184 | */ |
| 185 | 185 | public function setCachedir($dir = null) |
| 186 | 186 | { |
@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | * @version 2.1 Beta 4 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if (!defined('SMF')) |
|
| 14 | +if (!defined('SMF')) { |
|
| 15 | 15 | die('Hacking attempt...'); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * Our Cache API class |
@@ -43,8 +44,9 @@ discard block |
||
| 43 | 44 | { |
| 44 | 45 | $supported = is_writable($this->cachedir); |
| 45 | 46 | |
| 46 | - if ($test) |
|
| 47 | - return $supported; |
|
| 47 | + if ($test) { |
|
| 48 | + return $supported; |
|
| 49 | + } |
|
| 48 | 50 | return parent::isSupported() && $supported; |
| 49 | 51 | } |
| 50 | 52 | |
@@ -61,11 +63,13 @@ discard block |
||
| 61 | 63 | { |
| 62 | 64 | // Work around Zend's opcode caching (PHP 5.5+), they would cache older files for a couple of seconds |
| 63 | 65 | // causing newer files to take effect a while later. |
| 64 | - if (function_exists('opcache_invalidate')) |
|
| 65 | - opcache_invalidate($cachedir . '/data_' . $key . '.php', true); |
|
| 66 | + if (function_exists('opcache_invalidate')) { |
|
| 67 | + opcache_invalidate($cachedir . '/data_' . $key . '.php', true); |
|
| 68 | + } |
|
| 66 | 69 | |
| 67 | - if (function_exists('apc_delete_file')) |
|
| 68 | - @apc_delete_file($cachedir . '/data_' . $key . '.php'); |
|
| 70 | + if (function_exists('apc_delete_file')) { |
|
| 71 | + @apc_delete_file($cachedir . '/data_' . $key . '.php'); |
|
| 72 | + } |
|
| 69 | 73 | |
| 70 | 74 | // php will cache file_exists et all, we can't 100% depend on its results so proceed with caution |
| 71 | 75 | @include($cachedir . '/data_' . $key . '.php'); |
@@ -89,16 +93,18 @@ discard block |
||
| 89 | 93 | |
| 90 | 94 | // Work around Zend's opcode caching (PHP 5.5+), they would cache older files for a couple of seconds |
| 91 | 95 | // causing newer files to take effect a while later. |
| 92 | - if (function_exists('opcache_invalidate')) |
|
| 93 | - opcache_invalidate($cachedir . '/data_' . $key . '.php', true); |
|
| 96 | + if (function_exists('opcache_invalidate')) { |
|
| 97 | + opcache_invalidate($cachedir . '/data_' . $key . '.php', true); |
|
| 98 | + } |
|
| 94 | 99 | |
| 95 | - if (function_exists('apc_delete_file')) |
|
| 96 | - @apc_delete_file($cachedir . '/data_' . $key . '.php'); |
|
| 100 | + if (function_exists('apc_delete_file')) { |
|
| 101 | + @apc_delete_file($cachedir . '/data_' . $key . '.php'); |
|
| 102 | + } |
|
| 97 | 103 | |
| 98 | 104 | // Otherwise custom cache? |
| 99 | - if ($value === null) |
|
| 100 | - @unlink($cachedir . '/data_' . $key . '.php'); |
|
| 101 | - else |
|
| 105 | + if ($value === null) { |
|
| 106 | + @unlink($cachedir . '/data_' . $key . '.php'); |
|
| 107 | + } else |
|
| 102 | 108 | { |
| 103 | 109 | $cache_data = '<' . '?' . 'php if (!defined(\'SMF\')) die; if (' . (time() + $ttl) . ' < time()) $expired = true; else{$expired = false; $value = \'' . addcslashes($value, '\\\'') . '\';}' . '?' . '>'; |
| 104 | 110 | |
@@ -109,9 +115,9 @@ discard block |
||
| 109 | 115 | { |
| 110 | 116 | @unlink($cachedir . '/data_' . $key . '.php'); |
| 111 | 117 | return false; |
| 118 | + } else { |
|
| 119 | + return true; |
|
| 112 | 120 | } |
| 113 | - else |
|
| 114 | - return true; |
|
| 115 | 121 | } |
| 116 | 122 | } |
| 117 | 123 | |
@@ -123,15 +129,17 @@ discard block |
||
| 123 | 129 | $cachedir = $this->cachedir; |
| 124 | 130 | |
| 125 | 131 | // No directory = no game. |
| 126 | - if (!is_dir($cachedir)) |
|
| 127 | - return; |
|
| 132 | + if (!is_dir($cachedir)) { |
|
| 133 | + return; |
|
| 134 | + } |
|
| 128 | 135 | |
| 129 | 136 | // Remove the files in SMF's own disk cache, if any |
| 130 | 137 | $dh = opendir($cachedir); |
| 131 | 138 | while ($file = readdir($dh)) |
| 132 | 139 | { |
| 133 | - if ($file != '.' && $file != '..' && $file != 'index.php' && $file != '.htaccess' && (!$type || substr($file, 0, strlen($type)) == $type)) |
|
| 134 | - @unlink($cachedir . '/' . $file); |
|
| 140 | + if ($file != '.' && $file != '..' && $file != 'index.php' && $file != '.htaccess' && (!$type || substr($file, 0, strlen($type)) == $type)) { |
|
| 141 | + @unlink($cachedir . '/' . $file); |
|
| 142 | + } |
|
| 135 | 143 | } |
| 136 | 144 | closedir($dh); |
| 137 | 145 | |
@@ -165,8 +173,9 @@ discard block |
||
| 165 | 173 | $config_vars[] = $txt['cache_smf_settings']; |
| 166 | 174 | $config_vars[] = array('cachedir', $txt['cachedir'], 'file', 'text', 36, 'cache_cachedir'); |
| 167 | 175 | |
| 168 | - if (!isset($context['settings_post_javascript'])) |
|
| 169 | - $context['settings_post_javascript'] = ''; |
|
| 176 | + if (!isset($context['settings_post_javascript'])) { |
|
| 177 | + $context['settings_post_javascript'] = ''; |
|
| 178 | + } |
|
| 170 | 179 | |
| 171 | 180 | $context['settings_post_javascript'] .= ' |
| 172 | 181 | $("#cache_accelerator").change(function (e) { |
@@ -187,10 +196,11 @@ discard block |
||
| 187 | 196 | global $cachedir; |
| 188 | 197 | |
| 189 | 198 | // If its invalid, use SMF's. |
| 190 | - if (is_null($dir) || !is_writable($dir)) |
|
| 191 | - $this->cachedir = $cachedir; |
|
| 192 | - else |
|
| 193 | - $this->cachedir = $dir; |
|
| 199 | + if (is_null($dir) || !is_writable($dir)) { |
|
| 200 | + $this->cachedir = $cachedir; |
|
| 201 | + } else { |
|
| 202 | + $this->cachedir = $dir; |
|
| 203 | + } |
|
| 194 | 204 | } |
| 195 | 205 | |
| 196 | 206 | /** |