@@ -42,8 +42,10 @@ discard block |
||
42 | 42 | |
43 | 43 | // Show a list of all the years we allow... |
44 | 44 | for ($year = $context['cal_minyear']; $year <= $context['cal_maxyear']; $year++) |
45 | - echo ' |
|
45 | + { |
|
46 | + echo ' |
|
46 | 47 | <option value="', $year, '"', $year == $context['holiday']['year'] ? ' selected="selected"' : '', '>', $year, '</option>'; |
48 | + } |
|
47 | 49 | |
48 | 50 | echo ' |
49 | 51 | </select> |
@@ -52,8 +54,10 @@ discard block |
||
52 | 54 | |
53 | 55 | // There are 12 months per year - ensure that they all get listed. |
54 | 56 | for ($month = 1; $month <= 12; $month++) |
55 | - echo ' |
|
57 | + { |
|
58 | + echo ' |
|
56 | 59 | <option value="', $month, '"', $month == $context['holiday']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '</option>'; |
60 | + } |
|
57 | 61 | |
58 | 62 | echo ' |
59 | 63 | </select> |
@@ -62,8 +66,10 @@ discard block |
||
62 | 66 | |
63 | 67 | // This prints out all the days in the current month - this changes dynamically as we switch months. |
64 | 68 | for ($day = 1; $day <= $context['holiday']['last_day']; $day++) |
65 | - echo ' |
|
69 | + { |
|
70 | + echo ' |
|
66 | 71 | <option value="', $day, '"', $day == $context['holiday']['day'] ? ' selected="selected"' : '', '>', $day, '</option>'; |
72 | + } |
|
67 | 73 | |
68 | 74 | echo ' |
69 | 75 | </select> |
@@ -73,13 +79,16 @@ discard block |
||
73 | 79 | <div class="submitbutton">'; |
74 | 80 | |
75 | 81 | if ($context['is_new']) |
76 | - echo ' |
|
82 | + { |
|
83 | + echo ' |
|
77 | 84 | <input type="submit" value="', $txt['holidays_button_add'], '" />'; |
78 | - else |
|
79 | - echo ' |
|
85 | + } |
|
86 | + else { |
|
87 | + echo ' |
|
80 | 88 | <input type="submit" name="edit" value="', $txt['holidays_button_edit'], '" /> |
81 | 89 | <input type="submit" name="delete" value="', $txt['holidays_button_remove'], '" /> |
82 | 90 | <input type="hidden" name="holiday" value="', $context['holiday']['id'], '" />'; |
91 | + } |
|
83 | 92 | |
84 | 93 | echo ' |
85 | 94 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
@@ -28,8 +28,10 @@ discard block |
||
28 | 28 | </h2>'; |
29 | 29 | |
30 | 30 | if ($context['ban']['is_new']) |
31 | - echo ' |
|
31 | + { |
|
32 | + echo ' |
|
32 | 33 | <div class="information">', $txt['ban_add_notes'], '</div>'; |
34 | + } |
|
33 | 35 | |
34 | 36 | // If there were errors creating the ban, show them. |
35 | 37 | template_show_error('ban_errors'); |
@@ -45,7 +47,8 @@ discard block |
||
45 | 47 | </dd>'; |
46 | 48 | |
47 | 49 | if (isset($context['ban']['reason'])) |
48 | - echo ' |
|
50 | + { |
|
51 | + echo ' |
|
49 | 52 | <dt> |
50 | 53 | <label for="reason">', $txt['ban_reason'], ':</label><br /> |
51 | 54 | <span class="smalltext">', $txt['ban_reason_desc'], '</span> |
@@ -53,9 +56,11 @@ discard block |
||
53 | 56 | <dd> |
54 | 57 | <textarea name="reason" id="reason" cols="40" rows="3" class="ban_text">', $context['ban']['reason'], '</textarea> |
55 | 58 | </dd>'; |
59 | + } |
|
56 | 60 | |
57 | 61 | if (isset($context['ban']['notes'])) |
58 | - echo ' |
|
62 | + { |
|
63 | + echo ' |
|
59 | 64 | <dt> |
60 | 65 | <label for="ban_notes">', $txt['ban_notes'], ':</label><br /> |
61 | 66 | <span class="smalltext">', $txt['ban_notes_desc'], '</span> |
@@ -63,6 +68,7 @@ discard block |
||
63 | 68 | <dd> |
64 | 69 | <textarea name="notes" id="ban_notes" cols="40" rows="3" class="ban_text">', $context['ban']['notes'], '</textarea> |
65 | 70 | </dd>'; |
71 | + } |
|
66 | 72 | |
67 | 73 | echo ' |
68 | 74 | </dl> |
@@ -102,7 +108,8 @@ discard block |
||
102 | 108 | </dd>'; |
103 | 109 | |
104 | 110 | if (empty($modSettings['disableHostnameLookup'])) |
105 | - echo ' |
|
111 | + { |
|
112 | + echo ' |
|
106 | 113 | <dt> |
107 | 114 | <input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname" ', !empty($context['ban_suggestions']['hostname']) ? 'checked="checked" ' : '', '/> |
108 | 115 | <label for="hostname_check">', $txt['ban_on_hostname'], '</label> |
@@ -110,6 +117,7 @@ discard block |
||
110 | 117 | <dd> |
111 | 118 | <input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;" class="input_text" /> |
112 | 119 | </dd>'; |
120 | + } |
|
113 | 121 | |
114 | 122 | echo ' |
115 | 123 | <dt> |
@@ -140,13 +148,15 @@ discard block |
||
140 | 148 | |
141 | 149 | $count = 0; |
142 | 150 | foreach ($ban_ips as $ip) |
143 | - echo ' |
|
151 | + { |
|
152 | + echo ' |
|
144 | 153 | <dt> |
145 | 154 | <input type="checkbox" id="suggestions_', $key, '_', $count, '" name="ban_suggestions[', $key, '][]" ', !empty($context['ban_suggestions']['saved_triggers'][$key]) && in_array($ip, $context['ban_suggestions']['saved_triggers'][$key]) ? 'checked="checked" ' : '', 'value="', $ip, '" /> |
146 | 155 | </dt> |
147 | 156 | <dd> |
148 | 157 | <label for="suggestions_', $key, '_', ($count++), '">', $ip, '</label> |
149 | 158 | </dd>'; |
159 | + } |
|
150 | 160 | |
151 | 161 | echo ' |
152 | 162 | </dl>'; |
@@ -183,7 +193,8 @@ discard block |
||
183 | 193 | |
184 | 194 | // Auto suggest only needed for adding new bans, not editing |
185 | 195 | if (!empty($context['use_autosuggest'])) |
186 | - echo ' |
|
196 | + { |
|
197 | + echo ' |
|
187 | 198 | <script> |
188 | 199 | var oAddMemberSuggest = new smc_AutoSuggest({ |
189 | 200 | sSelf: \'oAddMemberSuggest\', |
@@ -198,7 +209,8 @@ discard block |
||
198 | 209 | |
199 | 210 | oAddMemberSuggest.registerCallback(\'onBeforeUpdate\', \'onUpdateName\'); |
200 | 211 | </script>'; |
201 | -} |
|
212 | + } |
|
213 | + } |
|
202 | 214 | |
203 | 215 | /** |
204 | 216 | * Template to edit ban triggers |
@@ -228,7 +240,8 @@ discard block |
||
228 | 240 | </dd>'; |
229 | 241 | |
230 | 242 | if (empty($modSettings['disableHostnameLookup'])) |
231 | - echo ' |
|
243 | + { |
|
244 | + echo ' |
|
232 | 245 | <dt> |
233 | 246 | <input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname" ', $context['ban_trigger']['hostname']['selected'] ? 'checked="checked" ' : '', '/> |
234 | 247 | <label for="hostname_check">', $txt['ban_on_hostname'], '</label> |
@@ -236,6 +249,7 @@ discard block |
||
236 | 249 | <dd> |
237 | 250 | <input type="text" name="hostname" value="', $context['ban_trigger']['hostname']['value'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;" class="input_text" /> |
238 | 251 | </dd>'; |
252 | + } |
|
239 | 253 | |
240 | 254 | echo ' |
241 | 255 | <dt> |
@@ -116,7 +116,8 @@ discard block |
||
116 | 116 | |
117 | 117 | // Can the user see the persons email? |
118 | 118 | if ($context['can_view_recipient_email']) |
119 | - echo ' |
|
119 | + { |
|
120 | + echo ' |
|
120 | 121 | <dt> |
121 | 122 | <strong>', $txt['sendtopic_receiver_email'], ':</strong> |
122 | 123 | </dt> |
@@ -126,10 +127,12 @@ discard block |
||
126 | 127 | </dl> |
127 | 128 | <hr /> |
128 | 129 | <dl class="settings send_mail">'; |
130 | + } |
|
129 | 131 | |
130 | 132 | // If it's a guest we need their details. |
131 | 133 | if ($context['user']['is_guest']) |
132 | - echo ' |
|
134 | + { |
|
135 | + echo ' |
|
133 | 136 | <dt> |
134 | 137 | <label for="y_name">', $txt['sendtopic_sender_name'], ':</label> |
135 | 138 | </dt> |
@@ -143,9 +146,10 @@ discard block |
||
143 | 146 | <dd> |
144 | 147 | <input type="text" id="y_mail" name="y_email" size="24" maxlength="50" value="', $context['user']['email'], '" class="input_text" /> |
145 | 148 | </dt>'; |
149 | + } |
|
146 | 150 | // Otherwise show the user that we know their email. |
147 | - else |
|
148 | - echo ' |
|
151 | + else { |
|
152 | + echo ' |
|
149 | 153 | <dt> |
150 | 154 | <strong>', $txt['sendtopic_sender_email'], ':</strong><br /> |
151 | 155 | <span class="smalltext">', $txt['send_email_disclosed'], '</span> |
@@ -153,6 +157,7 @@ discard block |
||
153 | 157 | <dd> |
154 | 158 | <em>', $context['user']['email'], '</em> |
155 | 159 | </dd>'; |
160 | + } |
|
156 | 161 | |
157 | 162 | echo ' |
158 | 163 | <dt> |
@@ -174,8 +179,10 @@ discard block |
||
174 | 179 | |
175 | 180 | |
176 | 181 | foreach ($context['form_hidden_vars'] as $key => $value) |
177 | - echo ' |
|
182 | + { |
|
183 | + echo ' |
|
178 | 184 | <input type="hidden" name="', $key, '" value="', $value, '" />'; |
185 | + } |
|
179 | 186 | |
180 | 187 | echo ' |
181 | 188 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
@@ -168,7 +168,9 @@ discard block |
||
168 | 168 | |
169 | 169 | // Nothing to do, then we are done |
170 | 170 | if (count($this->_combine_files) === 0) |
171 | - return true; |
|
171 | + { |
|
172 | + return true; |
|
173 | + } |
|
172 | 174 | |
173 | 175 | // Create the archive name |
174 | 176 | $this->_buildName('.js'); |
@@ -226,7 +228,9 @@ discard block |
||
226 | 228 | |
227 | 229 | // Nothing to do so return |
228 | 230 | if (count($this->_combine_files) === 0) |
229 | - return true; |
|
231 | + { |
|
232 | + return true; |
|
233 | + } |
|
230 | 234 | |
231 | 235 | // Create the css archive name |
232 | 236 | $this->_buildName('.css'); |
@@ -373,7 +377,9 @@ discard block |
||
373 | 377 | foreach ($this->_combine_files as $file) |
374 | 378 | { |
375 | 379 | if ($file['filemtime'] > $filemtime) |
376 | - return true; |
|
380 | + { |
|
381 | + return true; |
|
382 | + } |
|
377 | 383 | } |
378 | 384 | |
379 | 385 | return false; |
@@ -390,7 +396,9 @@ discard block |
||
390 | 396 | |
391 | 397 | // Create this groups archive name |
392 | 398 | foreach ($this->_combine_files as $file) |
393 | - $this->_archive_filenames .= $file['basename'] . ' '; |
|
399 | + { |
|
400 | + $this->_archive_filenames .= $file['basename'] . ' '; |
|
401 | + } |
|
394 | 402 | |
395 | 403 | // Add in the actual theme url to make the sha1 unique to this hive |
396 | 404 | $this->_archive_filenames = $settings['actual_theme_url'] . '/' . trim($this->_archive_filenames); |
@@ -400,7 +408,9 @@ discard block |
||
400 | 408 | |
401 | 409 | // Create a unique cache stale for this hive ?x12345 |
402 | 410 | if (!empty($this->_stales)) |
403 | - $this->_archive_stale = '?x' . hash('crc32b', implode(' ', $this->_stales)); |
|
411 | + { |
|
412 | + $this->_archive_stale = '?x' . hash('crc32b', implode(' ', $this->_stales)); |
|
413 | + } |
|
404 | 414 | } |
405 | 415 | |
406 | 416 | /** |
@@ -445,9 +455,12 @@ discard block |
||
445 | 455 | |
446 | 456 | // Add the file to the correct array for processing |
447 | 457 | if ($file['minimized'] === false) |
448 | - $_cache[] = $tempfile; |
|
449 | - else |
|
450 | - $_min_cache[] = $tempfile; |
|
458 | + { |
|
459 | + $_cache[] = $tempfile; |
|
460 | + } |
|
461 | + else { |
|
462 | + $_min_cache[] = $tempfile; |
|
463 | + } |
|
451 | 464 | } |
452 | 465 | |
453 | 466 | // Build out our combined file strings |
@@ -463,7 +476,9 @@ discard block |
||
463 | 476 | { |
464 | 477 | // Add in the file header if available |
465 | 478 | if (!empty($this->_archive_header)) |
466 | - $this->_minified_cache = $this->_archive_header . $this->_minified_cache; |
|
479 | + { |
|
480 | + $this->_minified_cache = $this->_archive_header . $this->_minified_cache; |
|
481 | + } |
|
467 | 482 | |
468 | 483 | // First the plain text version |
469 | 484 | file_put_contents($this->_archive_dir . '/' . $this->_archive_name, $this->_minified_cache, LOCK_EX); |
@@ -500,7 +515,9 @@ discard block |
||
500 | 515 | // To prevent a stack overflow segmentation fault, which silently kills Apache, we need to limit |
501 | 516 | // recursion on windows. This may cause JSqueeze to fail, but at least its then catchable. |
502 | 517 | if (detectServer()->is('windows')) |
503 | - @ini_set('pcre.recursion_limit', '524'); |
|
518 | + { |
|
519 | + @ini_set('pcre.recursion_limit', '524'); |
|
520 | + } |
|
504 | 521 | |
505 | 522 | require_once(EXTDIR . '/JSqueeze.php'); |
506 | 523 | $jsqueeze = new Patchwork\JSqueeze; |
@@ -509,7 +526,9 @@ discard block |
||
509 | 526 | |
510 | 527 | // If we still have no data, then try the post js_code method to the closure compiler |
511 | 528 | if ($fetch_data === false || trim($fetch_data) == '') |
512 | - $fetch_data = $this->_closure_js_code(); |
|
529 | + { |
|
530 | + $fetch_data = $this->_closure_js_code(); |
|
531 | + } |
|
513 | 532 | |
514 | 533 | // If we have nothing to return, use the original data |
515 | 534 | $fetch_data = ($fetch_data === false || trim($fetch_data) == '') ? $this->_cache : $fetch_data; |
@@ -534,7 +553,9 @@ discard block |
||
534 | 553 | foreach ($this->_combine_files as $file) |
535 | 554 | { |
536 | 555 | if ($file['minimized'] === false) |
537 | - $post_data .= '&code_url=' . urlencode($file['url'] . '/scripts/' . $file['basename'] . $this->_archive_stale); |
|
556 | + { |
|
557 | + $post_data .= '&code_url=' . urlencode($file['url'] . '/scripts/' . $file['basename'] . $this->_archive_stale); |
|
558 | + } |
|
538 | 559 | } |
539 | 560 | |
540 | 561 | return fetch_web_data($this->_url, $this->_post_header . $post_data); |
@@ -558,8 +579,9 @@ discard block |
||
558 | 579 | $fetch_data = fetch_web_data($this->_url, $this->_post_header . $post_data); |
559 | 580 | } |
560 | 581 | // Simply to much data for a single post so break it down in to as few as possible |
561 | - else |
|
562 | - $fetch_data = $this->_closure_js_code_chunks(); |
|
582 | + else { |
|
583 | + $fetch_data = $this->_closure_js_code_chunks(); |
|
584 | + } |
|
563 | 585 | |
564 | 586 | return $fetch_data; |
565 | 587 | } |
@@ -97,7 +97,9 @@ discard block |
||
97 | 97 | $cache = Cache::instance(); |
98 | 98 | |
99 | 99 | if (empty($changeArray) || !is_array($changeArray)) |
100 | - return; |
|
100 | + { |
|
101 | + return; |
|
102 | + } |
|
101 | 103 | |
102 | 104 | // In some cases, this may be better and faster, but for large sets we don't want so many UPDATEs. |
103 | 105 | if ($update) |
@@ -128,10 +130,14 @@ discard block |
||
128 | 130 | { |
129 | 131 | // Don't bother if it's already like that ;). |
130 | 132 | if (isset($modSettings[$variable]) && $modSettings[$variable] == $value) |
131 | - continue; |
|
133 | + { |
|
134 | + continue; |
|
135 | + } |
|
132 | 136 | // If the variable isn't set, but would only be set to nothing'ness, then don't bother setting it. |
133 | 137 | elseif (!isset($modSettings[$variable]) && empty($value)) |
134 | - continue; |
|
138 | + { |
|
139 | + continue; |
|
140 | + } |
|
135 | 141 | |
136 | 142 | $replaceArray[] = array($variable, $value); |
137 | 143 | |
@@ -139,7 +145,9 @@ discard block |
||
139 | 145 | } |
140 | 146 | |
141 | 147 | if (empty($replaceArray)) |
142 | - return; |
|
148 | + { |
|
149 | + return; |
|
150 | + } |
|
143 | 151 | |
144 | 152 | $db->insert('replace', |
145 | 153 | '{db_prefix}settings', |
@@ -164,10 +172,14 @@ discard block |
||
164 | 172 | $db = database(); |
165 | 173 | |
166 | 174 | if (empty($toRemove)) |
167 | - return; |
|
175 | + { |
|
176 | + return; |
|
177 | + } |
|
168 | 178 | |
169 | 179 | if (!is_array($toRemove)) |
170 | - $toRemove = array($toRemove); |
|
180 | + { |
|
181 | + $toRemove = array($toRemove); |
|
182 | + } |
|
171 | 183 | |
172 | 184 | // Remove the setting from the db |
173 | 185 | $db->query('', ' |
@@ -180,8 +192,10 @@ discard block |
||
180 | 192 | |
181 | 193 | // Remove it from $modSettings now so it does not persist |
182 | 194 | foreach ($toRemove as $setting) |
183 | - if (isset($modSettings[$setting])) |
|
195 | + { |
|
196 | + if (isset($modSettings[$setting])) |
|
184 | 197 | unset($modSettings[$setting]); |
198 | + } |
|
185 | 199 | |
186 | 200 | // Kill the cache - it needs redoing now, but we won't bother ourselves with that here. |
187 | 201 | Cache::instance()->remove('modSettings'); |
@@ -228,13 +242,18 @@ discard block |
||
228 | 242 | |
229 | 243 | // Make sure $start is a proper variable - not less than 0. |
230 | 244 | if ($start_invalid) |
231 | - $start = 0; |
|
245 | + { |
|
246 | + $start = 0; |
|
247 | + } |
|
232 | 248 | // Not greater than the upper bound. |
233 | 249 | elseif ($start >= $max_value) |
234 | - $start = max(0, (int) $max_value - (((int) $max_value % (int) $num_per_page) == 0 ? $num_per_page : ((int) $max_value % (int) $num_per_page))); |
|
250 | + { |
|
251 | + $start = max(0, (int) $max_value - (((int) $max_value % (int) $num_per_page) == 0 ? $num_per_page : ((int) $max_value % (int) $num_per_page))); |
|
252 | + } |
|
235 | 253 | // And it has to be a multiple of $num_per_page! |
236 | - else |
|
237 | - $start = max(0, (int) $start - ((int) $start % (int) $num_per_page)); |
|
254 | + else { |
|
255 | + $start = max(0, (int) $start - ((int) $start % (int) $num_per_page)); |
|
256 | + } |
|
238 | 257 | |
239 | 258 | $context['current_page'] = $start / $num_per_page; |
240 | 259 | |
@@ -249,12 +268,16 @@ discard block |
||
249 | 268 | // Show all the pages. |
250 | 269 | $display_page = 1; |
251 | 270 | for ($counter = 0; $counter < $max_value; $counter += $num_per_page) |
252 | - $pageindex .= $start == $counter && !$start_invalid && empty($show['all_selected']) ? sprintf($settings['page_index_template']['current_page'], $display_page++) : sprintf($base_link, $counter, $display_page++); |
|
271 | + { |
|
272 | + $pageindex .= $start == $counter && !$start_invalid && empty($show['all_selected']) ? sprintf($settings['page_index_template']['current_page'], $display_page++) : sprintf($base_link, $counter, $display_page++); |
|
273 | + } |
|
253 | 274 | |
254 | 275 | // Show the right arrow. |
255 | 276 | $display_page = ($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page); |
256 | 277 | if ($start != $counter - $max_value && !$start_invalid && $show['prev_next'] && empty($show['all_selected'])) |
257 | - $pageindex .= $display_page > $counter - $num_per_page ? ' ' : sprintf($base_link, $display_page, str_replace('{next_txt}', $txt['next'], $settings['page_index_template']['next_page'])); |
|
278 | + { |
|
279 | + $pageindex .= $display_page > $counter - $num_per_page ? ' ' : sprintf($base_link, $display_page, str_replace('{next_txt}', $txt['next'], $settings['page_index_template']['next_page'])); |
|
280 | + } |
|
258 | 281 | } |
259 | 282 | else |
260 | 283 | { |
@@ -263,61 +286,84 @@ discard block |
||
263 | 286 | |
264 | 287 | // Show the "prev page" link. (>prev page< 1 ... 6 7 [8] 9 10 ... 15 next page) |
265 | 288 | if (!empty($start) && $show['prev_next']) |
266 | - $pageindex = sprintf($base_link, $start - $num_per_page, str_replace('{prev_txt}', $txt['prev'], $settings['page_index_template']['previous_page'])); |
|
267 | - else |
|
268 | - $pageindex = ''; |
|
289 | + { |
|
290 | + $pageindex = sprintf($base_link, $start - $num_per_page, str_replace('{prev_txt}', $txt['prev'], $settings['page_index_template']['previous_page'])); |
|
291 | + } |
|
292 | + else { |
|
293 | + $pageindex = ''; |
|
294 | + } |
|
269 | 295 | |
270 | 296 | // Show the first page. (prev page >1< ... 6 7 [8] 9 10 ... 15) |
271 | 297 | if ($start > $num_per_page * $PageContiguous) |
272 | - $pageindex .= sprintf($base_link, 0, '1'); |
|
298 | + { |
|
299 | + $pageindex .= sprintf($base_link, 0, '1'); |
|
300 | + } |
|
273 | 301 | |
274 | 302 | // Show the ... after the first page. (prev page 1 >...< 6 7 [8] 9 10 ... 15 next page) |
275 | 303 | if ($start > $num_per_page * ($PageContiguous + 1)) |
276 | - $pageindex .= str_replace('{custom}', 'data-baseurl="' . htmlspecialchars(JavaScriptEscape(($flexible_start ? $base_url : strtr($base_url, array('%' => '%%')) . ';start=%1$d')), ENT_COMPAT, 'UTF-8') . '" data-perpage="' . $num_per_page . '" data-firstpage="' . $num_per_page . '" data-lastpage="' . ($start - $num_per_page * $PageContiguous) . '"', $settings['page_index_template']['expand_pages']); |
|
304 | + { |
|
305 | + $pageindex .= str_replace('{custom}', 'data-baseurl="' . htmlspecialchars(JavaScriptEscape(($flexible_start ? $base_url : strtr($base_url, array('%' => '%%')) . ';start=%1$d')), ENT_COMPAT, 'UTF-8') . '" data-perpage="' . $num_per_page . '" data-firstpage="' . $num_per_page . '" data-lastpage="' . ($start - $num_per_page * $PageContiguous) . '"', $settings['page_index_template']['expand_pages']); |
|
306 | + } |
|
277 | 307 | |
278 | 308 | // Show the pages before the current one. (prev page 1 ... >6 7< [8] 9 10 ... 15 next page) |
279 | 309 | for ($nCont = $PageContiguous; $nCont >= 1; $nCont--) |
280 | - if ($start >= $num_per_page * $nCont) |
|
310 | + { |
|
311 | + if ($start >= $num_per_page * $nCont) |
|
281 | 312 | { |
282 | 313 | $tmpStart = $start - $num_per_page * $nCont; |
314 | + } |
|
283 | 315 | $pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1); |
284 | 316 | } |
285 | 317 | |
286 | 318 | // Show the current page. (prev page 1 ... 6 7 >[8]< 9 10 ... 15 next page) |
287 | 319 | if (!$start_invalid && empty($show['all_selected'])) |
288 | - $pageindex .= sprintf($settings['page_index_template']['current_page'], ($start / $num_per_page + 1)); |
|
289 | - else |
|
290 | - $pageindex .= sprintf($base_link, $start, $start / $num_per_page + 1); |
|
320 | + { |
|
321 | + $pageindex .= sprintf($settings['page_index_template']['current_page'], ($start / $num_per_page + 1)); |
|
322 | + } |
|
323 | + else { |
|
324 | + $pageindex .= sprintf($base_link, $start, $start / $num_per_page + 1); |
|
325 | + } |
|
291 | 326 | |
292 | 327 | // Show the pages after the current one... (prev page 1 ... 6 7 [8] >9 10< ... 15 next page) |
293 | 328 | $tmpMaxPages = (int) (($max_value - 1) / $num_per_page) * $num_per_page; |
294 | 329 | for ($nCont = 1; $nCont <= $PageContiguous; $nCont++) |
295 | - if ($start + $num_per_page * $nCont <= $tmpMaxPages) |
|
330 | + { |
|
331 | + if ($start + $num_per_page * $nCont <= $tmpMaxPages) |
|
296 | 332 | { |
297 | 333 | $tmpStart = $start + $num_per_page * $nCont; |
334 | + } |
|
298 | 335 | $pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1); |
299 | 336 | } |
300 | 337 | |
301 | 338 | // Show the '...' part near the end. (prev page 1 ... 6 7 [8] 9 10 >...< 15 next page) |
302 | 339 | if ($start + $num_per_page * ($PageContiguous + 1) < $tmpMaxPages) |
303 | - $pageindex .= str_replace('{custom}', 'data-baseurl="' . htmlspecialchars(JavaScriptEscape(($flexible_start ? $base_url : strtr($base_url, array('%' => '%%')) . ';start=%1$d')), ENT_COMPAT, 'UTF-8') . '" data-perpage="' . $num_per_page . '" data-firstpage="' . ($start + $num_per_page * ($PageContiguous + 1)) . '" data-lastpage="' . $tmpMaxPages . '"', $settings['page_index_template']['expand_pages']); |
|
340 | + { |
|
341 | + $pageindex .= str_replace('{custom}', 'data-baseurl="' . htmlspecialchars(JavaScriptEscape(($flexible_start ? $base_url : strtr($base_url, array('%' => '%%')) . ';start=%1$d')), ENT_COMPAT, 'UTF-8') . '" data-perpage="' . $num_per_page . '" data-firstpage="' . ($start + $num_per_page * ($PageContiguous + 1)) . '" data-lastpage="' . $tmpMaxPages . '"', $settings['page_index_template']['expand_pages']); |
|
342 | + } |
|
304 | 343 | |
305 | 344 | // Show the last number in the list. (prev page 1 ... 6 7 [8] 9 10 ... >15< next page) |
306 | 345 | if ($start + $num_per_page * $PageContiguous < $tmpMaxPages) |
307 | - $pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1); |
|
346 | + { |
|
347 | + $pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1); |
|
348 | + } |
|
308 | 349 | |
309 | 350 | // Show the "next page" link. (prev page 1 ... 6 7 [8] 9 10 ... 15 >next page<) |
310 | 351 | if ($start != $tmpMaxPages && $show['prev_next'] && empty($show['all_selected'])) |
311 | - $pageindex .= sprintf($base_link, $start + $num_per_page, str_replace('{next_txt}', $txt['next'], $settings['page_index_template']['next_page'])); |
|
352 | + { |
|
353 | + $pageindex .= sprintf($base_link, $start + $num_per_page, str_replace('{next_txt}', $txt['next'], $settings['page_index_template']['next_page'])); |
|
354 | + } |
|
312 | 355 | } |
313 | 356 | |
314 | 357 | // The "all" button |
315 | 358 | if ($show['all']) |
316 | 359 | { |
317 | 360 | if (!empty($show['all_selected'])) |
318 | - $pageindex .= sprintf($settings['page_index_template']['current_page'], $txt['all']); |
|
319 | - else |
|
320 | - $pageindex .= sprintf(str_replace('%1$d', '%1$s', $base_link), '0;all', str_replace('{all_txt}', $txt['all'], $settings['page_index_template']['all'])); |
|
361 | + { |
|
362 | + $pageindex .= sprintf($settings['page_index_template']['current_page'], $txt['all']); |
|
363 | + } |
|
364 | + else { |
|
365 | + $pageindex .= sprintf(str_replace('%1$d', '%1$s', $base_link), '0;all', str_replace('{all_txt}', $txt['all'], $settings['page_index_template']['all'])); |
|
366 | + } |
|
321 | 367 | } |
322 | 368 | |
323 | 369 | return $pageindex; |
@@ -347,7 +393,9 @@ discard block |
||
347 | 393 | { |
348 | 394 | // Not set for whatever reason? |
349 | 395 | if (empty($txt['number_format']) || preg_match('~^1([^\d]*)?234([^\d]*)(0*?)$~', $txt['number_format'], $matches) != 1) |
350 | - return $number; |
|
396 | + { |
|
397 | + return $number; |
|
398 | + } |
|
351 | 399 | |
352 | 400 | // Cache these each load... |
353 | 401 | $thousands_separator = $matches[1]; |
@@ -436,16 +484,23 @@ discard block |
||
436 | 484 | |
437 | 485 | // Offset the time. |
438 | 486 | if (!$offset_type) |
439 | - $time = $log_time + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600; |
|
487 | + { |
|
488 | + $time = $log_time + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600; |
|
489 | + } |
|
440 | 490 | // Just the forum offset? |
441 | 491 | elseif ($offset_type === 'forum') |
442 | - $time = $log_time + $modSettings['time_offset'] * 3600; |
|
443 | - else |
|
444 | - $time = $log_time; |
|
492 | + { |
|
493 | + $time = $log_time + $modSettings['time_offset'] * 3600; |
|
494 | + } |
|
495 | + else { |
|
496 | + $time = $log_time; |
|
497 | + } |
|
445 | 498 | |
446 | 499 | // We can't have a negative date (on Windows, at least.) |
447 | 500 | if ($log_time < 0) |
448 | - $log_time = 0; |
|
501 | + { |
|
502 | + $log_time = 0; |
|
503 | + } |
|
449 | 504 | |
450 | 505 | // Today and Yesterday? |
451 | 506 | if ($modSettings['todayMod'] >= 1 && $show_today === true) |
@@ -463,16 +518,21 @@ discard block |
||
463 | 518 | $h = strpos($user_info['time_format'], '%l') === false ? '%I' : '%l'; |
464 | 519 | $today_fmt = $h . ':%M' . $s . ' %p'; |
465 | 520 | } |
466 | - else |
|
467 | - $today_fmt = '%H:%M' . $s; |
|
521 | + else { |
|
522 | + $today_fmt = '%H:%M' . $s; |
|
523 | + } |
|
468 | 524 | |
469 | 525 | // Same day of the year, same year.... Today! |
470 | 526 | if ($then['yday'] == $now['yday'] && $then['year'] == $now['year']) |
471 | - return sprintf($txt['today'], standardTime($log_time, $today_fmt, $offset_type)); |
|
527 | + { |
|
528 | + return sprintf($txt['today'], standardTime($log_time, $today_fmt, $offset_type)); |
|
529 | + } |
|
472 | 530 | |
473 | 531 | // Day-of-year is one less and same year, or it's the first of the year and that's the last of the year... |
474 | 532 | if ($modSettings['todayMod'] == '2' && (($then['yday'] == $now['yday'] - 1 && $then['year'] == $now['year']) || ($now['yday'] == 0 && $then['year'] == $now['year'] - 1) && $then['mon'] == 12 && $then['mday'] == 31)) |
475 | - return sprintf($txt['yesterday'], standardTime($log_time, $today_fmt, $offset_type)); |
|
533 | + { |
|
534 | + return sprintf($txt['yesterday'], standardTime($log_time, $today_fmt, $offset_type)); |
|
535 | + } |
|
476 | 536 | } |
477 | 537 | |
478 | 538 | $str = !is_bool($show_today) ? $show_today : $user_info['time_format']; |
@@ -480,28 +540,40 @@ discard block |
||
480 | 540 | if (setlocale(LC_TIME, $txt['lang_locale'])) |
481 | 541 | { |
482 | 542 | if (!isset($non_twelve_hour)) |
483 | - $non_twelve_hour = trim(Util::strftime('%p')) === ''; |
|
543 | + { |
|
544 | + $non_twelve_hour = trim(Util::strftime('%p')) === ''; |
|
545 | + } |
|
484 | 546 | if ($non_twelve_hour && strpos($str, '%p') !== false) |
485 | - $str = str_replace('%p', (Util::strftime('%H', $time) < 12 ? $txt['time_am'] : $txt['time_pm']), $str); |
|
547 | + { |
|
548 | + $str = str_replace('%p', (Util::strftime('%H', $time) < 12 ? $txt['time_am'] : $txt['time_pm']), $str); |
|
549 | + } |
|
486 | 550 | |
487 | 551 | foreach (array('%a', '%A', '%b', '%B') as $token) |
488 | - if (strpos($str, $token) !== false) |
|
552 | + { |
|
553 | + if (strpos($str, $token) !== false) |
|
489 | 554 | $str = str_replace($token, !empty($txt['lang_capitalize_dates']) ? Util::ucwords(Util::strftime($token, $time)) : Util::strftime($token, $time), $str); |
555 | + } |
|
490 | 556 | } |
491 | 557 | else |
492 | 558 | { |
493 | 559 | // Do-it-yourself time localization. Fun. |
494 | 560 | foreach (array('%a' => 'days_short', '%A' => 'days', '%b' => 'months_short', '%B' => 'months') as $token => $text_label) |
495 | - if (strpos($str, $token) !== false) |
|
561 | + { |
|
562 | + if (strpos($str, $token) !== false) |
|
496 | 563 | $str = str_replace($token, $txt[$text_label][(int) Util::strftime($token === '%a' || $token === '%A' ? '%w' : '%m', $time)], $str); |
564 | + } |
|
497 | 565 | |
498 | 566 | if (strpos($str, '%p') !== false) |
499 | - $str = str_replace('%p', (Util::strftime('%H', $time) < 12 ? $txt['time_am'] : $txt['time_pm']), $str); |
|
567 | + { |
|
568 | + $str = str_replace('%p', (Util::strftime('%H', $time) < 12 ? $txt['time_am'] : $txt['time_pm']), $str); |
|
569 | + } |
|
500 | 570 | } |
501 | 571 | |
502 | 572 | // Windows doesn't support %e; on some versions, Util::strftime fails altogether if used, so let's prevent that. |
503 | 573 | if ($support_e && strpos($str, '%e') !== false) |
504 | - $str = str_replace('%e', ltrim(Util::strftime('%d', $time), '0'), $str); |
|
574 | + { |
|
575 | + $str = str_replace('%e', ltrim(Util::strftime('%d', $time), '0'), $str); |
|
576 | + } |
|
505 | 577 | |
506 | 578 | // Format any other characters.. |
507 | 579 | return Util::strftime($str, $time); |
@@ -519,7 +591,9 @@ discard block |
||
519 | 591 | global $txt, $context; |
520 | 592 | |
521 | 593 | if (empty($timestamp)) |
522 | - return ''; |
|
594 | + { |
|
595 | + return ''; |
|
596 | + } |
|
523 | 597 | |
524 | 598 | $forumtime = forum_time(false, $timestamp); |
525 | 599 | $timestamp = forum_time(true, $timestamp); |
@@ -547,9 +621,13 @@ discard block |
||
547 | 621 | global $user_info, $modSettings; |
548 | 622 | |
549 | 623 | if ($timestamp === null) |
550 | - $timestamp = time(); |
|
624 | + { |
|
625 | + $timestamp = time(); |
|
626 | + } |
|
551 | 627 | elseif ($timestamp == 0) |
552 | - return 0; |
|
628 | + { |
|
629 | + return 0; |
|
630 | + } |
|
553 | 631 | |
554 | 632 | return $timestamp + ($modSettings['time_offset'] + ($use_user_offset ? $user_info['time_offset'] : 0)) * 3600; |
555 | 633 | } |
@@ -568,7 +646,9 @@ discard block |
||
568 | 646 | function un_htmlspecialchars($string) |
569 | 647 | { |
570 | 648 | if (empty($string)) |
571 | - return $string; |
|
649 | + { |
|
650 | + return $string; |
|
651 | + } |
|
572 | 652 | |
573 | 653 | $string = htmlspecialchars_decode($string, ENT_QUOTES); |
574 | 654 | $string = str_replace(' ', ' ', $string); |
@@ -609,7 +689,9 @@ discard block |
||
609 | 689 | $array[$j] = $temp; |
610 | 690 | |
611 | 691 | for ($i = 1; $p[$i] == 0; $i++) |
612 | - $p[$i] = $i; |
|
692 | + { |
|
693 | + $p[$i] = $i; |
|
694 | + } |
|
613 | 695 | |
614 | 696 | $orders[] = $array; |
615 | 697 | } |
@@ -691,7 +773,9 @@ discard block |
||
691 | 773 | { |
692 | 774 | // Don't waste cycles |
693 | 775 | if ($message === '') |
694 | - return ''; |
|
776 | + { |
|
777 | + return ''; |
|
778 | + } |
|
695 | 779 | |
696 | 780 | $parser = \BBC\ParserWrapper::instance(); |
697 | 781 | |
@@ -779,29 +863,40 @@ discard block |
||
779 | 863 | |
780 | 864 | // In case we have mail to send, better do that - as obExit doesn't always quite make it... |
781 | 865 | if (!empty($context['flush_mail'])) |
782 | - // @todo this relies on 'flush_mail' being only set in AddMailQueue itself... :\ |
|
866 | + { |
|
867 | + // @todo this relies on 'flush_mail' being only set in AddMailQueue itself... :\ |
|
783 | 868 | AddMailQueue(true); |
869 | + } |
|
784 | 870 | |
785 | 871 | Notifications::instance()->send(); |
786 | 872 | |
787 | 873 | $add = preg_match('~^(ftp|http)[s]?://~', $setLocation) == 0 && substr($setLocation, 0, 6) != 'about:'; |
788 | 874 | |
789 | 875 | if ($add) |
790 | - $setLocation = $scripturl . ($setLocation != '' ? '?' . $setLocation : ''); |
|
876 | + { |
|
877 | + $setLocation = $scripturl . ($setLocation != '' ? '?' . $setLocation : ''); |
|
878 | + } |
|
791 | 879 | |
792 | 880 | // Put the session ID in. |
793 | 881 | if (empty($_COOKIE) && defined('SID') && SID != '') |
794 | - $setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '(?!\?' . preg_quote(SID, '/') . ')\\??/', $scripturl . '?' . SID . ';', $setLocation); |
|
882 | + { |
|
883 | + $setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '(?!\?' . preg_quote(SID, '/') . ')\\??/', $scripturl . '?' . SID . ';', $setLocation); |
|
884 | + } |
|
795 | 885 | // Keep that debug in their for template debugging! |
796 | 886 | elseif (isset($_GET['debug'])) |
797 | - $setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\\??/', $scripturl . '?debug;', $setLocation); |
|
887 | + { |
|
888 | + $setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\\??/', $scripturl . '?debug;', $setLocation); |
|
889 | + } |
|
798 | 890 | |
799 | 891 | if (!empty($modSettings['queryless_urls']) && detectServer()->supportRewrite()) |
800 | 892 | { |
801 | 893 | if (defined('SID') && SID != '') |
802 | - $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', 'redirectexit_callback', $setLocation); |
|
803 | - else |
|
804 | - $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', 'redirectexit_callback', $setLocation); |
|
894 | + { |
|
895 | + $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', 'redirectexit_callback', $setLocation); |
|
896 | + } |
|
897 | + else { |
|
898 | + $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', 'redirectexit_callback', $setLocation); |
|
899 | + } |
|
805 | 900 | } |
806 | 901 | |
807 | 902 | // Maybe integrations want to change where we are heading? |
@@ -809,9 +904,12 @@ discard block |
||
809 | 904 | |
810 | 905 | // We send a Refresh header only in special cases because Location looks better. (and is quicker...) |
811 | 906 | if ($refresh) |
812 | - header('Refresh: 0; URL=' . strtr($setLocation, array(' ' => '%20'))); |
|
813 | - else |
|
814 | - header('Location: ' . str_replace(' ', '%20', $setLocation)); |
|
907 | + { |
|
908 | + header('Refresh: 0; URL=' . strtr($setLocation, array(' ' => '%20'))); |
|
909 | + } |
|
910 | + else { |
|
911 | + header('Location: ' . str_replace(' ', '%20', $setLocation)); |
|
912 | + } |
|
815 | 913 | |
816 | 914 | // Debugging. |
817 | 915 | if ($db_show_debug === true) |
@@ -837,10 +935,13 @@ discard block |
||
837 | 935 | global $scripturl; |
838 | 936 | |
839 | 937 | if (defined('SID') && SID != '') |
840 | - return $scripturl . '/' . strtr($matches[1], '&;=', '//,') . '.html?' . SID . (isset($matches[2]) ? $matches[2] : ''); |
|
841 | - else |
|
842 | - return $scripturl . '/' . strtr($matches[1], '&;=', '//,') . '.html' . (isset($matches[2]) ? $matches[2] : ''); |
|
843 | -} |
|
938 | + { |
|
939 | + return $scripturl . '/' . strtr($matches[1], '&;=', '//,') . '.html?' . SID . (isset($matches[2]) ? $matches[2] : ''); |
|
940 | + } |
|
941 | + else { |
|
942 | + return $scripturl . '/' . strtr($matches[1], '&;=', '//,') . '.html' . (isset($matches[2]) ? $matches[2] : ''); |
|
943 | + } |
|
944 | + } |
|
844 | 945 | |
845 | 946 | /** |
846 | 947 | * Ends execution. |
@@ -868,10 +969,14 @@ discard block |
||
868 | 969 | // Attempt to prevent a recursive loop. |
869 | 970 | ++$level; |
870 | 971 | if ($level > 1 && !$from_fatal_error && !$has_fatal_error) |
871 | - exit; |
|
972 | + { |
|
973 | + exit; |
|
974 | + } |
|
872 | 975 | |
873 | 976 | if ($from_fatal_error) |
874 | - $has_fatal_error = true; |
|
977 | + { |
|
978 | + $has_fatal_error = true; |
|
979 | + } |
|
875 | 980 | |
876 | 981 | // Clear out the stat cache. |
877 | 982 | trackStats(); |
@@ -880,19 +985,25 @@ discard block |
||
880 | 985 | |
881 | 986 | // If we have mail to send, send it. |
882 | 987 | if (!empty($context['flush_mail'])) |
883 | - // @todo this relies on 'flush_mail' being only set in AddMailQueue itself... :\ |
|
988 | + { |
|
989 | + // @todo this relies on 'flush_mail' being only set in AddMailQueue itself... :\ |
|
884 | 990 | AddMailQueue(true); |
991 | + } |
|
885 | 992 | |
886 | 993 | $do_header = $header === null ? !$header_done : $header; |
887 | 994 | if ($do_footer === null) |
888 | - $do_footer = $do_header; |
|
995 | + { |
|
996 | + $do_footer = $do_header; |
|
997 | + } |
|
889 | 998 | |
890 | 999 | // Has the template/header been done yet? |
891 | 1000 | if ($do_header) |
892 | 1001 | { |
893 | 1002 | // Was the page title set last minute? Also update the HTML safe one. |
894 | 1003 | if (!empty($context['page_title']) && empty($context['page_title_html_safe'])) |
895 | - $context['page_title_html_safe'] = Util::htmlspecialchars(un_htmlspecialchars($context['page_title'])) . (!empty($context['current_page']) ? ' - ' . $txt['page'] . ' ' . ($context['current_page'] + 1) : ''); |
|
1004 | + { |
|
1005 | + $context['page_title_html_safe'] = Util::htmlspecialchars(un_htmlspecialchars($context['page_title'])) . (!empty($context['current_page']) ? ' - ' . $txt['page'] . ' ' . ($context['current_page'] + 1) : ''); |
|
1006 | + } |
|
896 | 1007 | |
897 | 1008 | // Start up the session URL fixer. |
898 | 1009 | ob_start('ob_sessrewrite'); |
@@ -940,8 +1051,10 @@ discard block |
||
940 | 1051 | |
941 | 1052 | // Don't exit if we're coming from index.php; that will pass through normally. |
942 | 1053 | if (!$from_index) |
943 | - exit; |
|
944 | -} |
|
1054 | + { |
|
1055 | + exit; |
|
1056 | + } |
|
1057 | + } |
|
945 | 1058 | |
946 | 1059 | function setOldUrl($index = 'old_url') |
947 | 1060 | { |
@@ -978,19 +1091,28 @@ discard block |
||
978 | 1091 | { |
979 | 1092 | // Set topic class depending on locked status and number of replies. |
980 | 1093 | if ($topic_context['is_very_hot']) |
981 | - $topic_context['class'] = 'veryhot'; |
|
1094 | + { |
|
1095 | + $topic_context['class'] = 'veryhot'; |
|
1096 | + } |
|
982 | 1097 | elseif ($topic_context['is_hot']) |
983 | - $topic_context['class'] = 'hot'; |
|
984 | - else |
|
985 | - $topic_context['class'] = 'normal'; |
|
1098 | + { |
|
1099 | + $topic_context['class'] = 'hot'; |
|
1100 | + } |
|
1101 | + else { |
|
1102 | + $topic_context['class'] = 'normal'; |
|
1103 | + } |
|
986 | 1104 | |
987 | 1105 | $topic_context['class'] .= !empty($topic_context['is_poll']) ? '_poll' : '_post'; |
988 | 1106 | |
989 | 1107 | if ($topic_context['is_locked']) |
990 | - $topic_context['class'] .= '_locked'; |
|
1108 | + { |
|
1109 | + $topic_context['class'] .= '_locked'; |
|
1110 | + } |
|
991 | 1111 | |
992 | 1112 | if ($topic_context['is_sticky']) |
993 | - $topic_context['class'] .= '_sticky'; |
|
1113 | + { |
|
1114 | + $topic_context['class'] .= '_sticky'; |
|
1115 | + } |
|
994 | 1116 | |
995 | 1117 | // This is so old themes will still work. |
996 | 1118 | // @deprecated since 1.0 do not rely on it |
@@ -1180,16 +1302,24 @@ discard block |
||
1180 | 1302 | $ip_array = array(); |
1181 | 1303 | |
1182 | 1304 | if (count($ip_parts) != 8) |
1183 | - return array(); |
|
1305 | + { |
|
1306 | + return array(); |
|
1307 | + } |
|
1184 | 1308 | |
1185 | 1309 | for ($i = 0; $i < 8; $i++) |
1186 | 1310 | { |
1187 | 1311 | if ($ip_parts[$i] == '*') |
1188 | - $ip_array[$i] = array('low' => '0', 'high' => hexdec('ffff')); |
|
1312 | + { |
|
1313 | + $ip_array[$i] = array('low' => '0', 'high' => hexdec('ffff')); |
|
1314 | + } |
|
1189 | 1315 | elseif (preg_match('/^([0-9A-Fa-f]{1,4})\-([0-9A-Fa-f]{1,4})$/', $ip_parts[$i], $range) == 1) |
1190 | - $ip_array[$i] = array('low' => hexdec($range[1]), 'high' => hexdec($range[2])); |
|
1316 | + { |
|
1317 | + $ip_array[$i] = array('low' => hexdec($range[1]), 'high' => hexdec($range[2])); |
|
1318 | + } |
|
1191 | 1319 | elseif (is_numeric(hexdec($ip_parts[$i]))) |
1192 | - $ip_array[$i] = array('low' => hexdec($ip_parts[$i]), 'high' => hexdec($ip_parts[$i])); |
|
1320 | + { |
|
1321 | + $ip_array[$i] = array('low' => hexdec($ip_parts[$i]), 'high' => hexdec($ip_parts[$i])); |
|
1322 | + } |
|
1193 | 1323 | } |
1194 | 1324 | |
1195 | 1325 | return $ip_array; |
@@ -1197,22 +1327,32 @@ discard block |
||
1197 | 1327 | |
1198 | 1328 | // Pretend that 'unknown' is 255.255.255.255. (since that can't be an IP anyway.) |
1199 | 1329 | if ($fullip == 'unknown') |
1200 | - $fullip = '255.255.255.255'; |
|
1330 | + { |
|
1331 | + $fullip = '255.255.255.255'; |
|
1332 | + } |
|
1201 | 1333 | |
1202 | 1334 | $ip_parts = explode('.', $fullip); |
1203 | 1335 | $ip_array = array(); |
1204 | 1336 | |
1205 | 1337 | if (count($ip_parts) != 4) |
1206 | - return array(); |
|
1338 | + { |
|
1339 | + return array(); |
|
1340 | + } |
|
1207 | 1341 | |
1208 | 1342 | for ($i = 0; $i < 4; $i++) |
1209 | 1343 | { |
1210 | 1344 | if ($ip_parts[$i] == '*') |
1211 | - $ip_array[$i] = array('low' => '0', 'high' => '255'); |
|
1345 | + { |
|
1346 | + $ip_array[$i] = array('low' => '0', 'high' => '255'); |
|
1347 | + } |
|
1212 | 1348 | elseif (preg_match('/^(\d{1,3})\-(\d{1,3})$/', $ip_parts[$i], $range) == 1) |
1213 | - $ip_array[$i] = array('low' => $range[1], 'high' => $range[2]); |
|
1349 | + { |
|
1350 | + $ip_array[$i] = array('low' => $range[1], 'high' => $range[2]); |
|
1351 | + } |
|
1214 | 1352 | elseif (is_numeric($ip_parts[$i])) |
1215 | - $ip_array[$i] = array('low' => $ip_parts[$i], 'high' => $ip_parts[$i]); |
|
1353 | + { |
|
1354 | + $ip_array[$i] = array('low' => $ip_parts[$i], 'high' => $ip_parts[$i]); |
|
1355 | + } |
|
1216 | 1356 | } |
1217 | 1357 | |
1218 | 1358 | // Makes it simpler to work with. |
@@ -1239,7 +1379,9 @@ discard block |
||
1239 | 1379 | |
1240 | 1380 | $host = ''; |
1241 | 1381 | if ($cache->getVar($host, 'hostlookup-' . $ip, 600) || empty($ip)) |
1242 | - return $host; |
|
1382 | + { |
|
1383 | + return $host; |
|
1384 | + } |
|
1243 | 1385 | |
1244 | 1386 | $t = microtime(true); |
1245 | 1387 | |
@@ -1294,11 +1436,15 @@ discard block |
||
1294 | 1436 | |
1295 | 1437 | // This is the last try :/. |
1296 | 1438 | if (!isset($host) || $host === false) |
1297 | - $host = @gethostbyaddr($ip); |
|
1439 | + { |
|
1440 | + $host = @gethostbyaddr($ip); |
|
1441 | + } |
|
1298 | 1442 | |
1299 | 1443 | // It took a long time, so let's cache it! |
1300 | 1444 | if (microtime(true) - $t > 0.5) |
1301 | - $cache->put('hostlookup-' . $ip, $host, 600); |
|
1445 | + { |
|
1446 | + $cache->put('hostlookup-' . $ip, $host, 600); |
|
1447 | + } |
|
1302 | 1448 | |
1303 | 1449 | return $host; |
1304 | 1450 | } |
@@ -1338,7 +1484,9 @@ discard block |
||
1338 | 1484 | |
1339 | 1485 | // Create an integer representation |
1340 | 1486 | for ($i = 0; $i < $max_chars; $i++) |
1341 | - $total += $possible_chars[ord($encrypted[$i])] * pow(63, $i); |
|
1487 | + { |
|
1488 | + $total += $possible_chars[ord($encrypted[$i])] * pow(63, $i); |
|
1489 | + } |
|
1342 | 1490 | |
1343 | 1491 | // Return the value |
1344 | 1492 | $returned_ints[] = $max_chars == 4 ? min($total, 16777215) : $total; |
@@ -1351,8 +1499,10 @@ discard block |
||
1351 | 1499 | // Trim characters before and after and add slashes for database insertion. |
1352 | 1500 | $returned_words = array(); |
1353 | 1501 | foreach ($words as $word) |
1354 | - if (($word = trim($word, '-_\'')) !== '') |
|
1502 | + { |
|
1503 | + if (($word = trim($word, '-_\'')) !== '') |
|
1355 | 1504 | $returned_words[] = $max_chars === null ? $word : substr($word, 0, $max_chars); |
1505 | + } |
|
1356 | 1506 | |
1357 | 1507 | // Filter out all words that occur more than once. |
1358 | 1508 | return array_unique($returned_words); |
@@ -1378,15 +1528,22 @@ discard block |
||
1378 | 1528 | |
1379 | 1529 | // Does the current loaded theme have this and we are not forcing the usage of this function? |
1380 | 1530 | if (function_exists('template_create_button') && !$force_use) |
1381 | - return template_create_button($name, $alt, $label = '', $custom = ''); |
|
1531 | + { |
|
1532 | + return template_create_button($name, $alt, $label = '', $custom = ''); |
|
1533 | + } |
|
1382 | 1534 | |
1383 | 1535 | if (!$settings['use_image_buttons']) |
1384 | - return $txt[$alt]; |
|
1536 | + { |
|
1537 | + return $txt[$alt]; |
|
1538 | + } |
|
1385 | 1539 | elseif (!empty($settings['use_buttons'])) |
1386 | - return '<img src="' . $settings['images_url'] . '/buttons/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . ' />' . ($label != '' ? ' <strong>' . $txt[$label] . '</strong>' : ''); |
|
1387 | - else |
|
1388 | - return '<img src="' . $settings['lang_images_url'] . '/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . ' />'; |
|
1389 | -} |
|
1540 | + { |
|
1541 | + return '<img src="' . $settings['images_url'] . '/buttons/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . ' />' . ($label != '' ? ' <strong>' . $txt[$label] . '</strong>' : ''); |
|
1542 | + } |
|
1543 | + else { |
|
1544 | + return '<img src="' . $settings['lang_images_url'] . '/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . ' />'; |
|
1545 | + } |
|
1546 | + } |
|
1390 | 1547 | |
1391 | 1548 | /** |
1392 | 1549 | * Sets up all of the top menu buttons |
@@ -1413,8 +1570,10 @@ discard block |
||
1413 | 1570 | |
1414 | 1571 | // Change the seed. |
1415 | 1572 | if (mt_rand(1, 250) == 69 || empty($modSettings['rand_seed'])) |
1416 | - updateSettings(array('rand_seed' => mt_rand())); |
|
1417 | -} |
|
1573 | + { |
|
1574 | + updateSettings(array('rand_seed' => mt_rand())); |
|
1575 | + } |
|
1576 | + } |
|
1418 | 1577 | |
1419 | 1578 | /** |
1420 | 1579 | * Process functions of an integration hook. |
@@ -1500,35 +1659,50 @@ discard block |
||
1500 | 1659 | function replaceEntities__callback($matches) |
1501 | 1660 | { |
1502 | 1661 | if (!isset($matches[2])) |
1503 | - return ''; |
|
1662 | + { |
|
1663 | + return ''; |
|
1664 | + } |
|
1504 | 1665 | |
1505 | 1666 | $num = $matches[2][0] === 'x' ? hexdec(substr($matches[2], 1)) : (int) $matches[2]; |
1506 | 1667 | |
1507 | 1668 | // remove left to right / right to left overrides |
1508 | 1669 | if ($num === 0x202D || $num === 0x202E) |
1509 | - return ''; |
|
1670 | + { |
|
1671 | + return ''; |
|
1672 | + } |
|
1510 | 1673 | |
1511 | 1674 | // Quote, Ampersand, Apostrophe, Less/Greater Than get html replaced |
1512 | 1675 | if (in_array($num, array(0x22, 0x26, 0x27, 0x3C, 0x3E))) |
1513 | - return '&#' . $num . ';'; |
|
1676 | + { |
|
1677 | + return '&#' . $num . ';'; |
|
1678 | + } |
|
1514 | 1679 | |
1515 | 1680 | // <0x20 are control characters, 0x20 is a space, > 0x10FFFF is past the end of the utf8 character set |
1516 | 1681 | // 0xD800 >= $num <= 0xDFFF are surrogate markers (not valid for utf8 text) |
1517 | 1682 | if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF)) |
1518 | - return ''; |
|
1683 | + { |
|
1684 | + return ''; |
|
1685 | + } |
|
1519 | 1686 | // <0x80 (or less than 128) are standard ascii characters a-z A-Z 0-9 and punctuation |
1520 | 1687 | elseif ($num < 0x80) |
1521 | - return chr($num); |
|
1688 | + { |
|
1689 | + return chr($num); |
|
1690 | + } |
|
1522 | 1691 | // <0x800 (2048) |
1523 | 1692 | elseif ($num < 0x800) |
1524 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
1693 | + { |
|
1694 | + return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
1695 | + } |
|
1525 | 1696 | // < 0x10000 (65536) |
1526 | 1697 | elseif ($num < 0x10000) |
1527 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1698 | + { |
|
1699 | + return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1700 | + } |
|
1528 | 1701 | // <= 0x10FFFF (1114111) |
1529 | - else |
|
1530 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1531 | -} |
|
1702 | + else { |
|
1703 | + return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1704 | + } |
|
1705 | + } |
|
1532 | 1706 | |
1533 | 1707 | /** |
1534 | 1708 | * Converts html entities to utf8 equivalents |
@@ -1546,27 +1720,38 @@ discard block |
||
1546 | 1720 | function fixchar__callback($matches) |
1547 | 1721 | { |
1548 | 1722 | if (!isset($matches[1])) |
1549 | - return ''; |
|
1723 | + { |
|
1724 | + return ''; |
|
1725 | + } |
|
1550 | 1726 | |
1551 | 1727 | $num = $matches[1][0] === 'x' ? hexdec(substr($matches[1], 1)) : (int) $matches[1]; |
1552 | 1728 | |
1553 | 1729 | // <0x20 are control characters, > 0x10FFFF is past the end of the utf8 character set |
1554 | 1730 | // 0xD800 >= $num <= 0xDFFF are surrogate markers (not valid for utf8 text), 0x202D-E are left to right overrides |
1555 | 1731 | if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num === 0x202D || $num === 0x202E) |
1556 | - return ''; |
|
1732 | + { |
|
1733 | + return ''; |
|
1734 | + } |
|
1557 | 1735 | // <0x80 (or less than 128) are standard ascii characters a-z A-Z 0-9 and punctuation |
1558 | 1736 | elseif ($num < 0x80) |
1559 | - return chr($num); |
|
1737 | + { |
|
1738 | + return chr($num); |
|
1739 | + } |
|
1560 | 1740 | // <0x800 (2048) |
1561 | 1741 | elseif ($num < 0x800) |
1562 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
1742 | + { |
|
1743 | + return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
1744 | + } |
|
1563 | 1745 | // < 0x10000 (65536) |
1564 | 1746 | elseif ($num < 0x10000) |
1565 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1747 | + { |
|
1748 | + return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1749 | + } |
|
1566 | 1750 | // <= 0x10FFFF (1114111) |
1567 | - else |
|
1568 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1569 | -} |
|
1751 | + else { |
|
1752 | + return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1753 | + } |
|
1754 | + } |
|
1570 | 1755 | |
1571 | 1756 | /** |
1572 | 1757 | * Strips out invalid html entities, replaces others with html style { codes |
@@ -1583,16 +1768,21 @@ discard block |
||
1583 | 1768 | function entity_fix__callback($matches) |
1584 | 1769 | { |
1585 | 1770 | if (!isset($matches[2])) |
1586 | - return ''; |
|
1771 | + { |
|
1772 | + return ''; |
|
1773 | + } |
|
1587 | 1774 | |
1588 | 1775 | $num = $matches[2][0] === 'x' ? hexdec(substr($matches[2], 1)) : (int) $matches[2]; |
1589 | 1776 | |
1590 | 1777 | // We don't allow control characters, characters out of range, byte markers, etc |
1591 | 1778 | if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num == 0x202D || $num == 0x202E) |
1592 | - return ''; |
|
1593 | - else |
|
1594 | - return '&#' . $num . ';'; |
|
1595 | -} |
|
1779 | + { |
|
1780 | + return ''; |
|
1781 | + } |
|
1782 | + else { |
|
1783 | + return '&#' . $num . ';'; |
|
1784 | + } |
|
1785 | + } |
|
1596 | 1786 | |
1597 | 1787 | /** |
1598 | 1788 | * Retrieve additional search engines, if there are any, as an array. |
@@ -1608,7 +1798,9 @@ discard block |
||
1608 | 1798 | { |
1609 | 1799 | $search_engines = Util::unserialize($modSettings['additional_search_engines']); |
1610 | 1800 | foreach ($search_engines as $engine) |
1611 | - $engines[strtolower(preg_replace('~[^A-Za-z0-9 ]~', '', $engine['name']))] = $engine; |
|
1801 | + { |
|
1802 | + $engines[strtolower(preg_replace('~[^A-Za-z0-9 ]~', '', $engine['name']))] = $engine; |
|
1803 | + } |
|
1612 | 1804 | } |
1613 | 1805 | |
1614 | 1806 | return $engines; |
@@ -1634,11 +1826,15 @@ discard block |
||
1634 | 1826 | |
1635 | 1827 | // Start from the beginning... |
1636 | 1828 | if ($reset) |
1637 | - return $db->data_seek($messages_request, 0); |
|
1829 | + { |
|
1830 | + return $db->data_seek($messages_request, 0); |
|
1831 | + } |
|
1638 | 1832 | |
1639 | 1833 | // If the query has already returned false, get out of here |
1640 | 1834 | if (empty($messages_request)) |
1641 | - return false; |
|
1835 | + { |
|
1836 | + return false; |
|
1837 | + } |
|
1642 | 1838 | |
1643 | 1839 | // Attempt to get the next message. |
1644 | 1840 | $message = $db->fetch_assoc($messages_request); |
@@ -1671,22 +1867,32 @@ discard block |
||
1671 | 1867 | { |
1672 | 1868 | // Search for key names or values |
1673 | 1869 | if ($assoc) |
1674 | - $position = array_search($key, array_keys($input), $strict); |
|
1675 | - else |
|
1676 | - $position = array_search($key, $input, $strict); |
|
1870 | + { |
|
1871 | + $position = array_search($key, array_keys($input), $strict); |
|
1872 | + } |
|
1873 | + else { |
|
1874 | + $position = array_search($key, $input, $strict); |
|
1875 | + } |
|
1677 | 1876 | |
1678 | 1877 | // If the key is not found, just insert it at the end |
1679 | 1878 | if ($position === false) |
1680 | - return array_merge($input, $insert); |
|
1879 | + { |
|
1880 | + return array_merge($input, $insert); |
|
1881 | + } |
|
1681 | 1882 | |
1682 | 1883 | if ($where === 'after') |
1683 | - $position++; |
|
1884 | + { |
|
1885 | + $position++; |
|
1886 | + } |
|
1684 | 1887 | |
1685 | 1888 | // Insert as first |
1686 | 1889 | if ($position === 0) |
1687 | - $input = array_merge($insert, $input); |
|
1688 | - else |
|
1689 | - $input = array_merge(array_slice($input, 0, $position), $insert, array_slice($input, $position)); |
|
1890 | + { |
|
1891 | + $input = array_merge($insert, $input); |
|
1892 | + } |
|
1893 | + else { |
|
1894 | + $input = array_merge(array_slice($input, 0, $position), $insert, array_slice($input, $position)); |
|
1895 | + } |
|
1690 | 1896 | |
1691 | 1897 | return $input; |
1692 | 1898 | } |
@@ -1706,9 +1912,12 @@ discard block |
||
1706 | 1912 | global $modSettings; |
1707 | 1913 | |
1708 | 1914 | if (!isset($modSettings['scheduleTaskImmediate'])) |
1709 | - $scheduleTaskImmediate = array(); |
|
1710 | - else |
|
1711 | - $scheduleTaskImmediate = Util::unserialize($modSettings['scheduleTaskImmediate']); |
|
1915 | + { |
|
1916 | + $scheduleTaskImmediate = array(); |
|
1917 | + } |
|
1918 | + else { |
|
1919 | + $scheduleTaskImmediate = Util::unserialize($modSettings['scheduleTaskImmediate']); |
|
1920 | + } |
|
1712 | 1921 | |
1713 | 1922 | // If it has not been scheduled, the do so now |
1714 | 1923 | if (!isset($scheduleTaskImmediate[$task])) |
@@ -1739,9 +1948,12 @@ discard block |
||
1739 | 1948 | |
1740 | 1949 | // Not on, bail |
1741 | 1950 | if (!isset($modSettings['scheduleTaskImmediate'])) |
1742 | - return; |
|
1743 | - else |
|
1744 | - $scheduleTaskImmediate = Util::unserialize($modSettings['scheduleTaskImmediate']); |
|
1951 | + { |
|
1952 | + return; |
|
1953 | + } |
|
1954 | + else { |
|
1955 | + $scheduleTaskImmediate = Util::unserialize($modSettings['scheduleTaskImmediate']); |
|
1956 | + } |
|
1745 | 1957 | |
1746 | 1958 | // Clear / remove the task if it was set |
1747 | 1959 | if (isset($scheduleTaskImmediate[$task])) |
@@ -1845,10 +2057,13 @@ discard block |
||
1845 | 2057 | $time = trim(file_get_contents(BOARDDIR . '/db_last_error.txt')); |
1846 | 2058 | |
1847 | 2059 | if (preg_match('~^\d{10}$~', $time) === 1) |
1848 | - return $time; |
|
1849 | - else |
|
1850 | - return 0; |
|
1851 | -} |
|
2060 | + { |
|
2061 | + return $time; |
|
2062 | + } |
|
2063 | + else { |
|
2064 | + return 0; |
|
2065 | + } |
|
2066 | + } |
|
1852 | 2067 | |
1853 | 2068 | /** |
1854 | 2069 | * This function has the only task to retrieve the correct prefix to be used |
@@ -1867,7 +2082,9 @@ discard block |
||
1867 | 2082 | if ($response_prefix === null && (!$cache->getVar($response_prefix, 'response_prefix') || !$response_prefix)) |
1868 | 2083 | { |
1869 | 2084 | if ($language === $user_info['language']) |
1870 | - $response_prefix = $txt['response_prefix']; |
|
2085 | + { |
|
2086 | + $response_prefix = $txt['response_prefix']; |
|
2087 | + } |
|
1871 | 2088 | else |
1872 | 2089 | { |
1873 | 2090 | loadLanguage('index', $language, false); |
@@ -1895,10 +2112,13 @@ discard block |
||
1895 | 2112 | { |
1896 | 2113 | $value = trim($value); |
1897 | 2114 | if (filter_var($value, FILTER_VALIDATE_EMAIL) && Util::strlen($value) < 255) |
1898 | - return $value; |
|
1899 | - else |
|
1900 | - return false; |
|
1901 | -} |
|
2115 | + { |
|
2116 | + return $value; |
|
2117 | + } |
|
2118 | + else { |
|
2119 | + return false; |
|
2120 | + } |
|
2121 | + } |
|
1902 | 2122 | |
1903 | 2123 | /** |
1904 | 2124 | * Adds a protocol (http/s, ftp/mailto) to the beginning of an url if missing |
@@ -2042,7 +2262,9 @@ discard block |
||
2042 | 2262 | |
2043 | 2263 | // Don't know any browser! |
2044 | 2264 | if (empty($context['browser'])) |
2045 | - detectBrowser(); |
|
2265 | + { |
|
2266 | + detectBrowser(); |
|
2267 | + } |
|
2046 | 2268 | |
2047 | 2269 | return !empty($context['browser'][$browser]) || !empty($context['browser']['is_' . $browser]) ? true : false; |
2048 | 2270 | } |
@@ -2114,7 +2336,9 @@ discard block |
||
2114 | 2336 | foreach ($button_strip as $key => $value) |
2115 | 2337 | { |
2116 | 2338 | if (!isset($value['test']) || !empty($context[$value['test']])) |
2117 | - return true; |
|
2339 | + { |
|
2340 | + return true; |
|
2341 | + } |
|
2118 | 2342 | } |
2119 | 2343 | |
2120 | 2344 | return false; |
@@ -1918,7 +1918,7 @@ |
||
1918 | 1918 | } |
1919 | 1919 | else |
1920 | 1920 | { |
1921 | - $pattern = '~^(' . implode('|', array_map(function ($val) {return preg_quote($val, '~');}, $protocols)) . ')~i'; |
|
1921 | + $pattern = '~^(' . implode('|', array_map(function($val) {return preg_quote($val, '~'); }, $protocols)) . ')~i'; |
|
1922 | 1922 | } |
1923 | 1923 | |
1924 | 1924 | $found = false; |
@@ -25,7 +25,8 @@ discard block |
||
25 | 25 | # requirements (there can be none), but merely suggestions. |
26 | 26 | # |
27 | 27 | |
28 | -class PasswordHash { |
|
28 | +class PasswordHash |
|
29 | +{ |
|
29 | 30 | var $itoa64; |
30 | 31 | var $iteration_count_log2; |
31 | 32 | var $portable_hashes; |
@@ -36,7 +37,9 @@ discard block |
||
36 | 37 | $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; |
37 | 38 | |
38 | 39 | if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31) |
39 | - $iteration_count_log2 = 8; |
|
40 | + { |
|
41 | + $iteration_count_log2 = 8; |
|
42 | + } |
|
40 | 43 | $this->iteration_count_log2 = $iteration_count_log2; |
41 | 44 | |
42 | 45 | $this->portable_hashes = $portable_hashes; |
@@ -49,25 +52,30 @@ discard block |
||
49 | 52 | $output = ''; |
50 | 53 | |
51 | 54 | // PHP >= 7 |
52 | - if (is_callable('random_bytes')) { |
|
55 | + if (is_callable('random_bytes')) |
|
56 | + { |
|
53 | 57 | $output = random_bytes($count); |
54 | 58 | } |
55 | 59 | // *nix |
56 | 60 | elseif (@is_readable('/dev/urandom') && |
57 | - ($fh = @fopen('/dev/urandom', 'rb'))) { |
|
61 | + ($fh = @fopen('/dev/urandom', 'rb'))) |
|
62 | + { |
|
58 | 63 | $output = fread($fh, $count); |
59 | 64 | fclose($fh); |
60 | 65 | } |
61 | 66 | // This is much to slow on windows php < 5.3.4 |
62 | 67 | elseif (function_exists('openssl_random_pseudo_bytes') && |
63 | - (substr(PHP_OS, 0, 3) !== 'WIN' || version_compare(PHP_VERSION, '5.3.4', '>='))) { |
|
68 | + (substr(PHP_OS, 0, 3) !== 'WIN' || version_compare(PHP_VERSION, '5.3.4', '>='))) |
|
69 | + { |
|
64 | 70 | $output = openssl_random_pseudo_bytes($count); |
65 | 71 | } |
66 | 72 | |
67 | 73 | // Do it ourselves then |
68 | - if (strlen($output) < $count) { |
|
74 | + if (strlen($output) < $count) |
|
75 | + { |
|
69 | 76 | $output = ''; |
70 | - for ($i = 0; $i < $count; $i += 16) { |
|
77 | + for ($i = 0; $i < $count; $i += 16) |
|
78 | + { |
|
71 | 79 | $this->random_state = |
72 | 80 | md5(microtime() . $this->random_state); |
73 | 81 | $output .= |
@@ -83,19 +91,28 @@ discard block |
||
83 | 91 | { |
84 | 92 | $output = ''; |
85 | 93 | $i = 0; |
86 | - do { |
|
94 | + do |
|
95 | + { |
|
87 | 96 | $value = ord($input[$i++]); |
88 | 97 | $output .= $this->itoa64[$value & 0x3f]; |
89 | 98 | if ($i < $count) |
90 | - $value |= ord($input[$i]) << 8; |
|
99 | + { |
|
100 | + $value |= ord($input[$i]) << 8; |
|
101 | + } |
|
91 | 102 | $output .= $this->itoa64[($value >> 6) & 0x3f]; |
92 | 103 | if ($i++ >= $count) |
93 | - break; |
|
104 | + { |
|
105 | + break; |
|
106 | + } |
|
94 | 107 | if ($i < $count) |
95 | - $value |= ord($input[$i]) << 16; |
|
108 | + { |
|
109 | + $value |= ord($input[$i]) << 16; |
|
110 | + } |
|
96 | 111 | $output .= $this->itoa64[($value >> 12) & 0x3f]; |
97 | 112 | if ($i++ >= $count) |
98 | - break; |
|
113 | + { |
|
114 | + break; |
|
115 | + } |
|
99 | 116 | $output .= $this->itoa64[($value >> 18) & 0x3f]; |
100 | 117 | } while ($i < $count); |
101 | 118 | |
@@ -116,22 +133,30 @@ discard block |
||
116 | 133 | { |
117 | 134 | $output = '*0'; |
118 | 135 | if (substr($setting, 0, 2) == $output) |
119 | - $output = '*1'; |
|
136 | + { |
|
137 | + $output = '*1'; |
|
138 | + } |
|
120 | 139 | |
121 | 140 | $id = substr($setting, 0, 3); |
122 | 141 | # We use "$P$", phpBB3 uses "$H$" for the same thing |
123 | 142 | if ($id != '$P$' && $id != '$H$') |
124 | - return $output; |
|
143 | + { |
|
144 | + return $output; |
|
145 | + } |
|
125 | 146 | |
126 | 147 | $count_log2 = strpos($this->itoa64, $setting[3]); |
127 | 148 | if ($count_log2 < 7 || $count_log2 > 30) |
128 | - return $output; |
|
149 | + { |
|
150 | + return $output; |
|
151 | + } |
|
129 | 152 | |
130 | 153 | $count = 1 << $count_log2; |
131 | 154 | |
132 | 155 | $salt = substr($setting, 4, 8); |
133 | 156 | if (strlen($salt) != 8) |
134 | - return $output; |
|
157 | + { |
|
158 | + return $output; |
|
159 | + } |
|
135 | 160 | |
136 | 161 | # We're kind of forced to use MD5 here since it's the only |
137 | 162 | # cryptographic primitive available in all versions of PHP |
@@ -139,14 +164,19 @@ discard block |
||
139 | 164 | # in PHP would result in much worse performance and |
140 | 165 | # consequently in lower iteration counts and hashes that are |
141 | 166 | # quicker to crack (by non-PHP code). |
142 | - if (PHP_VERSION >= '5') { |
|
167 | + if (PHP_VERSION >= '5') |
|
168 | + { |
|
143 | 169 | $hash = md5($salt . $password, TRUE); |
144 | - do { |
|
170 | + do |
|
171 | + { |
|
145 | 172 | $hash = md5($hash . $password, TRUE); |
146 | 173 | } while (--$count); |
147 | - } else { |
|
174 | + } |
|
175 | + else |
|
176 | + { |
|
148 | 177 | $hash = pack('H*', md5($salt . $password)); |
149 | - do { |
|
178 | + do |
|
179 | + { |
|
150 | 180 | $hash = pack('H*', md5($hash . $password)); |
151 | 181 | } while (--$count); |
152 | 182 | } |
@@ -193,11 +223,13 @@ discard block |
||
193 | 223 | $output .= '$'; |
194 | 224 | |
195 | 225 | $i = 0; |
196 | - do { |
|
226 | + do |
|
227 | + { |
|
197 | 228 | $c1 = ord($input[$i++]); |
198 | 229 | $output .= $itoa64[$c1 >> 2]; |
199 | 230 | $c1 = ($c1 & 0x03) << 4; |
200 | - if ($i >= 16) { |
|
231 | + if ($i >= 16) |
|
232 | + { |
|
201 | 233 | $output .= $itoa64[$c1]; |
202 | 234 | break; |
203 | 235 | } |
@@ -219,34 +251,48 @@ discard block |
||
219 | 251 | public function HashPassword($password) |
220 | 252 | { |
221 | 253 | if ( strlen( $password ) > 4096 ) |
222 | - return '*'; |
|
254 | + { |
|
255 | + return '*'; |
|
256 | + } |
|
223 | 257 | |
224 | 258 | $random = ''; |
225 | 259 | |
226 | - if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) { |
|
260 | + if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) |
|
261 | + { |
|
227 | 262 | $random = $this->get_random_bytes(16); |
228 | 263 | $hash = |
229 | 264 | crypt($password, $this->gensalt_blowfish($random)); |
230 | 265 | if (strlen($hash) == 60) |
231 | - return $hash; |
|
266 | + { |
|
267 | + return $hash; |
|
268 | + } |
|
232 | 269 | } |
233 | 270 | |
234 | - if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) { |
|
271 | + if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) |
|
272 | + { |
|
235 | 273 | if (strlen($random) < 3) |
236 | - $random = $this->get_random_bytes(3); |
|
274 | + { |
|
275 | + $random = $this->get_random_bytes(3); |
|
276 | + } |
|
237 | 277 | $hash = |
238 | 278 | crypt($password, $this->gensalt_extended($random)); |
239 | 279 | if (strlen($hash) == 20) |
240 | - return $hash; |
|
280 | + { |
|
281 | + return $hash; |
|
282 | + } |
|
241 | 283 | } |
242 | 284 | |
243 | 285 | if (strlen($random) < 6) |
244 | - $random = $this->get_random_bytes(6); |
|
286 | + { |
|
287 | + $random = $this->get_random_bytes(6); |
|
288 | + } |
|
245 | 289 | $hash = |
246 | 290 | $this->crypt_private($password, |
247 | 291 | $this->gensalt_private($random)); |
248 | 292 | if (strlen($hash) == 34) |
249 | - return $hash; |
|
293 | + { |
|
294 | + return $hash; |
|
295 | + } |
|
250 | 296 | |
251 | 297 | # Returning '*' on error is safe here, but would _not_ be safe |
252 | 298 | # in a crypt(3)-like function used _both_ for generating new |
@@ -257,11 +303,15 @@ discard block |
||
257 | 303 | public function CheckPassword($password, $stored_hash) |
258 | 304 | { |
259 | 305 | if ( strlen( $password ) > 4096 ) |
260 | - return false; |
|
306 | + { |
|
307 | + return false; |
|
308 | + } |
|
261 | 309 | |
262 | 310 | $hash = $this->crypt_private($password, $stored_hash); |
263 | 311 | if ($hash[0] == '*') |
264 | - $hash = crypt($password, $stored_hash); |
|
312 | + { |
|
313 | + $hash = crypt($password, $stored_hash); |
|
314 | + } |
|
265 | 315 | |
266 | 316 | return $this->_hash_equals($hash, $stored_hash); |
267 | 317 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | $this->portable_hashes = $portable_hashes; |
43 | 43 | |
44 | - $this->random_state = microtime() . uniqid(rand(), TRUE); |
|
44 | + $this->random_state = microtime() . uniqid(rand(), true); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | private function get_random_bytes($count) |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | # consequently in lower iteration counts and hashes that are |
141 | 141 | # quicker to crack (by non-PHP code). |
142 | 142 | if (PHP_VERSION >= '5') { |
143 | - $hash = md5($salt . $password, TRUE); |
|
143 | + $hash = md5($salt . $password, true); |
|
144 | 144 | do { |
145 | - $hash = md5($hash . $password, TRUE); |
|
145 | + $hash = md5($hash . $password, true); |
|
146 | 146 | } while (--$count); |
147 | 147 | } else { |
148 | 148 | $hash = pack('H*', md5($salt . $password)); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | var $portable_hashes; |
32 | 32 | var $random_state; |
33 | 33 | |
34 | - public function __construct( $iteration_count_log2, $portable_hashes ) |
|
34 | + public function __construct($iteration_count_log2, $portable_hashes) |
|
35 | 35 | { |
36 | 36 | $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; |
37 | 37 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | public function HashPassword($password) |
220 | 220 | { |
221 | - if ( strlen( $password ) > 4096 ) |
|
221 | + if (strlen($password) > 4096) |
|
222 | 222 | return '*'; |
223 | 223 | |
224 | 224 | $random = ''; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | public function CheckPassword($password, $stored_hash) |
258 | 258 | { |
259 | - if ( strlen( $password ) > 4096 ) |
|
259 | + if (strlen($password) > 4096) |
|
260 | 260 | return false; |
261 | 261 | |
262 | 262 | $hash = $this->crypt_private($password, $stored_hash); |
@@ -92,27 +92,42 @@ discard block |
||
92 | 92 | if (strpos($query, 'DATE_SUB') !== false) |
93 | 93 | { |
94 | 94 | if (!empty($modSettings['badbehavior_logging'])) |
95 | - $query = 'DELETE FROM {db_prefix}log_badbehavior WHERE date < ' . (bb2_db_date() - 7 * 86400); |
|
96 | - else |
|
97 | - return true; |
|
95 | + { |
|
96 | + $query = 'DELETE FROM {db_prefix}log_badbehavior WHERE date < ' . (bb2_db_date() - 7 * 86400); |
|
97 | + } |
|
98 | + else { |
|
99 | + return true; |
|
100 | + } |
|
98 | 101 | } |
99 | 102 | |
100 | 103 | if (strpos($query, 'OPTIMIZE TABLE') !== false) |
101 | - return true; |
|
104 | + { |
|
105 | + return true; |
|
106 | + } |
|
102 | 107 | elseif (strpos($query, '@@session.wait_timeout') !== false) |
103 | - return true; |
|
108 | + { |
|
109 | + return true; |
|
110 | + } |
|
104 | 111 | elseif (empty($query)) |
105 | - return true; |
|
112 | + { |
|
113 | + return true; |
|
114 | + } |
|
106 | 115 | |
107 | 116 | // Run the query, return success, failure or the actual results |
108 | 117 | $result = $db->query('', $query, array()); |
109 | 118 | |
110 | 119 | if (!$result) |
111 | - return false; |
|
120 | + { |
|
121 | + return false; |
|
122 | + } |
|
112 | 123 | elseif ($result === true) |
113 | - return (bb2_db_affected_rows() !== 0); |
|
124 | + { |
|
125 | + return (bb2_db_affected_rows() !== 0); |
|
126 | + } |
|
114 | 127 | elseif (bb2_db_num_rows($result) === 0) |
115 | - return false; |
|
128 | + { |
|
129 | + return false; |
|
130 | + } |
|
116 | 131 | |
117 | 132 | return bb2_db_rows($result); |
118 | 133 | } |
@@ -131,7 +146,9 @@ discard block |
||
131 | 146 | |
132 | 147 | $temp = array(); |
133 | 148 | while ($row = $db->fetch_assoc($result)) |
134 | - $temp[] = $row; |
|
149 | + { |
|
150 | + $temp[] = $row; |
|
151 | + } |
|
135 | 152 | $db->free_result($result); |
136 | 153 | |
137 | 154 | return $temp; |
@@ -164,7 +181,9 @@ discard block |
||
164 | 181 | |
165 | 182 | // Logging not enabled |
166 | 183 | if (!$settings['logging']) |
167 | - return ''; |
|
184 | + { |
|
185 | + return ''; |
|
186 | + } |
|
168 | 187 | |
169 | 188 | // Clean the data that bb sent us |
170 | 189 | $ip = bb2_db_escape($package['ip']); |
@@ -203,7 +222,9 @@ discard block |
||
203 | 222 | foreach ($package['request_entity'] as $h => $v) |
204 | 223 | { |
205 | 224 | if (is_array($v)) |
206 | - $v = bb2_multi_implode($v, ' | '); |
|
225 | + { |
|
226 | + $v = bb2_multi_implode($v, ' | '); |
|
227 | + } |
|
207 | 228 | |
208 | 229 | $request_entity .= bb2_db_escape("$h: $v\n"); |
209 | 230 | } |
@@ -214,7 +235,9 @@ discard block |
||
214 | 235 | |
215 | 236 | // Make it safe for the db |
216 | 237 | while (preg_match('~[\'\\\\]$~', substr($request_entity, -1)) === 1) |
217 | - $request_entity = substr($request_entity, 0, -1); |
|
238 | + { |
|
239 | + $request_entity = substr($request_entity, 0, -1); |
|
240 | + } |
|
218 | 241 | } |
219 | 242 | |
220 | 243 | // Add it |
@@ -238,16 +261,22 @@ discard block |
||
238 | 261 | function bb2_multi_implode($array, $glue = ',', $trim_all = false) |
239 | 262 | { |
240 | 263 | if (!is_array($array)) |
241 | - $array = array($array); |
|
264 | + { |
|
265 | + $array = array($array); |
|
266 | + } |
|
242 | 267 | |
243 | 268 | foreach ($array as $key => $value) |
244 | 269 | { |
245 | 270 | if (is_array($value)) |
246 | - $array[$key] = bb2_multi_implode($value, $glue, $trim_all); |
|
271 | + { |
|
272 | + $array[$key] = bb2_multi_implode($value, $glue, $trim_all); |
|
273 | + } |
|
247 | 274 | } |
248 | 275 | |
249 | 276 | if ($trim_all) |
250 | - $array = array_map('trim', $array); |
|
277 | + { |
|
278 | + $array = array_map('trim', $array); |
|
279 | + } |
|
251 | 280 | |
252 | 281 | return implode($glue, $array); |
253 | 282 | } |
@@ -276,7 +305,9 @@ discard block |
||
276 | 305 | |
277 | 306 | // Nothing in the whitelist |
278 | 307 | if (empty($whitelist['badbehavior_ip_wl']) && empty($whitelist['badbehavior_useragent_wl']) && empty($whitelist['badbehavior_url_wl'])) |
279 | - return false; |
|
308 | + { |
|
309 | + return false; |
|
310 | + } |
|
280 | 311 | |
281 | 312 | // Build up the whitelist array so badbehavior can use it |
282 | 313 | return array_merge( |
@@ -300,7 +331,9 @@ discard block |
||
300 | 331 | |
301 | 332 | // Make sure that the proxy addresses are split into an array, and if it's empty - make sure reverse proxy is disabled |
302 | 333 | if (!empty($modSettings['badbehavior_reverse_proxy_addresses'])) |
303 | - $badbehavior_reverse_proxy_addresses = explode('|', trim($modSettings['badbehavior_reverse_proxy_addresses'])); |
|
334 | + { |
|
335 | + $badbehavior_reverse_proxy_addresses = explode('|', trim($modSettings['badbehavior_reverse_proxy_addresses'])); |
|
336 | + } |
|
304 | 337 | else |
305 | 338 | { |
306 | 339 | $badbehavior_reverse_proxy_addresses = array(); |
@@ -368,7 +401,9 @@ discard block |
||
368 | 401 | } |
369 | 402 | |
370 | 403 | if ($bb2_blocked !== false) |
371 | - return sprintf($txt['badbehavior_blocked'], $bb2_blocked[0]['COUNT(*)']); |
|
404 | + { |
|
405 | + return sprintf($txt['badbehavior_blocked'], $bb2_blocked[0]['COUNT(*)']); |
|
406 | + } |
|
372 | 407 | } |
373 | 408 | } |
374 | 409 |
@@ -191,7 +191,7 @@ |
||
191 | 191 | $check = $length + Util::strlen($h) + Util::strlen($v) + 2; |
192 | 192 | if ($check < 255) |
193 | 193 | { |
194 | - $headers .= bb2_db_escape($h . ': ' . $v . "\n"); |
|
194 | + $headers .= bb2_db_escape($h . ': ' . $v . "\n"); |
|
195 | 195 | $length = $check; |
196 | 196 | } |
197 | 197 | } |
@@ -1,4 +1,7 @@ discard block |
||
1 | -<?php if (!defined('BB2_CORE')) die("I said no cheating!"); |
|
1 | +<?php if (!defined('BB2_CORE')) |
|
2 | +{ |
|
3 | + die("I said no cheating!"); |
|
4 | +} |
|
2 | 5 | |
3 | 6 | # Round trip DNS verification |
4 | 7 | |
@@ -9,12 +12,21 @@ discard block |
||
9 | 12 | # between no records and error condition |
10 | 13 | function bb2_roundtripdns($ip,$domain) |
11 | 14 | { |
12 | - if (@is_ipv6($ip)) return $ip; |
|
15 | + if (@is_ipv6($ip)) |
|
16 | + { |
|
17 | + return $ip; |
|
18 | + } |
|
13 | 19 | |
14 | 20 | $host = gethostbyaddr($ip); |
15 | 21 | $host_result = strpos(strrev($host), strrev($domain)); |
16 | - if ($host_result === false || $host_result > 0) return false; |
|
22 | + if ($host_result === false || $host_result > 0) |
|
23 | + { |
|
24 | + return false; |
|
25 | + } |
|
17 | 26 | $addrs = gethostbynamel($host); |
18 | - if (in_array($ip, $addrs)) return true; |
|
27 | + if (in_array($ip, $addrs)) |
|
28 | + { |
|
29 | + return true; |
|
30 | + } |
|
19 | 31 | return false; |
20 | 32 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | # TODO: Not IPv6 safe |
8 | 8 | # FIXME: Returns false on DNS server failure; PHP provides no distinction |
9 | 9 | # between no records and error condition |
10 | -function bb2_roundtripdns($ip,$domain) |
|
10 | +function bb2_roundtripdns($ip, $domain) |
|
11 | 11 | { |
12 | 12 | if (@is_ipv6($ip)) return $ip; |
13 | 13 |
@@ -1,33 +1,57 @@ |
||
1 | -<?php if (!defined('BB2_CORE')) die('I said no cheating!'); |
|
1 | +<?php if (!defined('BB2_CORE')) |
|
2 | +{ |
|
3 | + die('I said no cheating!'); |
|
4 | +} |
|
2 | 5 | |
3 | 6 | function bb2_run_whitelist($package) |
4 | 7 | { |
5 | 8 | # FIXME: Transitional, until port maintainters implement bb2_read_whitelist |
6 | - if (function_exists('bb2_read_whitelist')) { |
|
9 | + if (function_exists('bb2_read_whitelist')) |
|
10 | + { |
|
7 | 11 | $whitelists = bb2_read_whitelist(); |
8 | - } else { |
|
12 | + } |
|
13 | + else |
|
14 | + { |
|
9 | 15 | $whitelists = @parse_ini_file(dirname(BB2_CORE) . "/whitelist.ini"); |
10 | 16 | } |
11 | 17 | |
12 | - if (@!empty($whitelists['ip'])) { |
|
13 | - foreach (array_filter($whitelists['ip']) as $range) { |
|
14 | - if (match_cidr($package['ip'], $range)) return true; |
|
18 | + if (@!empty($whitelists['ip'])) |
|
19 | + { |
|
20 | + foreach (array_filter($whitelists['ip']) as $range) |
|
21 | + { |
|
22 | + if (match_cidr($package['ip'], $range)) |
|
23 | + { |
|
24 | + return true; |
|
25 | + } |
|
15 | 26 | } |
16 | 27 | } |
17 | - if (@!empty($whitelists['useragent'])) { |
|
18 | - foreach (array_filter($whitelists['useragent']) as $user_agent) { |
|
19 | - if (!strcmp($package['headers_mixed']['User-Agent'], $user_agent)) return true; |
|
28 | + if (@!empty($whitelists['useragent'])) |
|
29 | + { |
|
30 | + foreach (array_filter($whitelists['useragent']) as $user_agent) |
|
31 | + { |
|
32 | + if (!strcmp($package['headers_mixed']['User-Agent'], $user_agent)) |
|
33 | + { |
|
34 | + return true; |
|
35 | + } |
|
20 | 36 | } |
21 | 37 | } |
22 | - if (@!empty($whitelists['url'])) { |
|
23 | - if (strpos($package['request_uri'], "?") === FALSE) { |
|
38 | + if (@!empty($whitelists['url'])) |
|
39 | + { |
|
40 | + if (strpos($package['request_uri'], "?") === FALSE) |
|
41 | + { |
|
24 | 42 | $request_uri = $package['request_uri']; |
25 | - } else { |
|
43 | + } |
|
44 | + else |
|
45 | + { |
|
26 | 46 | $request_uri = substr($package['request_uri'], 0, strpos($package['request_uri'], "?")); |
27 | 47 | } |
28 | - foreach (array_filter($whitelists['url']) as $url) { |
|
48 | + foreach (array_filter($whitelists['url']) as $url) |
|
49 | + { |
|
29 | 50 | $pos = strpos($request_uri, $url); |
30 | - if ($pos !== false && $pos == 0) return true; |
|
51 | + if ($pos !== false && $pos == 0) |
|
52 | + { |
|
53 | + return true; |
|
54 | + } |
|
31 | 55 | } |
32 | 56 | } |
33 | 57 | return false; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | } |
21 | 21 | } |
22 | 22 | if (@!empty($whitelists['url'])) { |
23 | - if (strpos($package['request_uri'], "?") === FALSE) { |
|
23 | + if (strpos($package['request_uri'], "?") === false) { |
|
24 | 24 | $request_uri = $package['request_uri']; |
25 | 25 | } else { |
26 | 26 | $request_uri = substr($package['request_uri'], 0, strpos($package['request_uri'], "?")); |