@@ -86,69 +86,69 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | switch ($action) { |
| 89 | - case 'selectlang': |
|
| 90 | - break; |
|
| 89 | + case 'selectlang': |
|
| 90 | + break; |
|
| 91 | 91 | |
| 92 | - case 'verify': |
|
| 93 | - verify(); |
|
| 94 | - break; |
|
| 92 | + case 'verify': |
|
| 93 | + verify(); |
|
| 94 | + break; |
|
| 95 | 95 | |
| 96 | - case 'resetids': |
|
| 97 | - resetIds(); |
|
| 98 | - break; |
|
| 96 | + case 'resetids': |
|
| 97 | + resetIds(); |
|
| 98 | + break; |
|
| 99 | 99 | |
| 100 | - case 'clearcache': |
|
| 101 | - clearCache(); |
|
| 102 | - break; |
|
| 100 | + case 'clearcache': |
|
| 101 | + clearCache(); |
|
| 102 | + break; |
|
| 103 | 103 | |
| 104 | - case 'export': |
|
| 105 | - export(); |
|
| 106 | - break; |
|
| 104 | + case 'export': |
|
| 105 | + export(); |
|
| 106 | + break; |
|
| 107 | 107 | |
| 108 | - case 'xmlexport': |
|
| 109 | - xmlexport(); |
|
| 110 | - break; |
|
| 108 | + case 'xmlexport': |
|
| 109 | + xmlexport(); |
|
| 110 | + break; |
|
| 111 | 111 | |
| 112 | - case 'xmlimport': |
|
| 113 | - break; |
|
| 112 | + case 'xmlimport': |
|
| 113 | + break; |
|
| 114 | 114 | |
| 115 | - case 'xmlimport2': |
|
| 116 | - xmlimport2(); |
|
| 117 | - break; |
|
| 115 | + case 'xmlimport2': |
|
| 116 | + xmlimport2(); |
|
| 117 | + break; |
|
| 118 | 118 | |
| 119 | - case 'xmlimport3': |
|
| 120 | - xmlimport3(); |
|
| 121 | - break; |
|
| 119 | + case 'xmlimport3': |
|
| 120 | + xmlimport3(); |
|
| 121 | + break; |
|
| 122 | 122 | |
| 123 | - case 'textexportnew': |
|
| 124 | - textexport($translang, false); |
|
| 125 | - break; |
|
| 123 | + case 'textexportnew': |
|
| 124 | + textexport($translang, false); |
|
| 125 | + break; |
|
| 126 | 126 | |
| 127 | - case 'textexportall': |
|
| 128 | - textexport($translang, true); |
|
| 129 | - break; |
|
| 127 | + case 'textexportall': |
|
| 128 | + textexport($translang, true); |
|
| 129 | + break; |
|
| 130 | 130 | |
| 131 | - case 'textimport': |
|
| 132 | - break; |
|
| 131 | + case 'textimport': |
|
| 132 | + break; |
|
| 133 | 133 | |
| 134 | - case 'textimport2': |
|
| 135 | - textimport($translang); |
|
| 136 | - break; |
|
| 134 | + case 'textimport2': |
|
| 135 | + textimport($translang); |
|
| 136 | + break; |
|
| 137 | 137 | |
| 138 | - case 'edit': |
|
| 139 | - if (!$access->mayTranslate($translang)) { |
|
| 140 | - $tpl->error(ERROR_NO_ACCESS); |
|
| 141 | - } |
|
| 142 | - edit(); |
|
| 143 | - break; |
|
| 138 | + case 'edit': |
|
| 139 | + if (!$access->mayTranslate($translang)) { |
|
| 140 | + $tpl->error(ERROR_NO_ACCESS); |
|
| 141 | + } |
|
| 142 | + edit(); |
|
| 143 | + break; |
|
| 144 | 144 | |
| 145 | - case 'copy_en': |
|
| 146 | - copy_english_texts(); |
|
| 147 | - break; |
|
| 145 | + case 'copy_en': |
|
| 146 | + copy_english_texts(); |
|
| 147 | + break; |
|
| 148 | 148 | |
| 149 | - case 'listfaults': |
|
| 150 | - $trans = sql( |
|
| 151 | - "SELECT |
|
| 149 | + case 'listfaults': |
|
| 150 | + $trans = sql( |
|
| 151 | + "SELECT |
|
| 152 | 152 | `sys_trans`.`id`, |
| 153 | 153 | `sys_trans`.`text` |
| 154 | 154 | FROM `sys_trans` |
@@ -156,14 +156,14 @@ discard block |
||
| 156 | 156 | ON `sys_trans`.`id`=`sys_trans_ref`.`trans_id` |
| 157 | 157 | WHERE ISNULL(`sys_trans_ref`.`trans_id`) |
| 158 | 158 | ORDER BY `sys_trans`.`id` DESC" |
| 159 | - ); |
|
| 160 | - $tpl->assign_rs('trans', $trans); |
|
| 161 | - sql_free_result($trans); |
|
| 162 | - break; |
|
| 159 | + ); |
|
| 160 | + $tpl->assign_rs('trans', $trans); |
|
| 161 | + sql_free_result($trans); |
|
| 162 | + break; |
|
| 163 | 163 | |
| 164 | - case 'listall': |
|
| 165 | - $trans = sql( |
|
| 166 | - "SELECT |
|
| 164 | + case 'listall': |
|
| 165 | + $trans = sql( |
|
| 166 | + "SELECT |
|
| 167 | 167 | `sys_trans`.`id`, |
| 168 | 168 | `sys_trans`.`text`, |
| 169 | 169 | `sys_trans_text`.`text` AS `trans` |
@@ -172,48 +172,48 @@ discard block |
||
| 172 | 172 | ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` |
| 173 | 173 | AND `sys_trans_text`.`lang`='&1' |
| 174 | 174 | ORDER BY `sys_trans`.`id` DESC", |
| 175 | - $translang |
|
| 176 | - ); |
|
| 177 | - $tpl->assign_rs('trans', $trans); |
|
| 178 | - sql_free_result($trans); |
|
| 179 | - break; |
|
| 175 | + $translang |
|
| 176 | + ); |
|
| 177 | + $tpl->assign_rs('trans', $trans); |
|
| 178 | + sql_free_result($trans); |
|
| 179 | + break; |
|
| 180 | 180 | |
| 181 | - case 'remove': |
|
| 182 | - if (!$access->mayTranslate($translang)) { |
|
| 183 | - $tpl->error(ERROR_NO_ACCESS); |
|
| 184 | - } |
|
| 185 | - remove(); |
|
| 186 | - break; |
|
| 187 | - |
|
| 188 | - case 'scan': |
|
| 189 | - scan(); |
|
| 190 | - break; |
|
| 191 | - |
|
| 192 | - case 'scanstart': |
|
| 193 | - scanStart(); |
|
| 194 | - break; |
|
| 195 | - |
|
| 196 | - case 'scanfile': |
|
| 197 | - $filename = isset($_REQUEST['filename']) ? $_REQUEST['filename'] : ''; |
|
| 198 | - scanFile($filename); |
|
| 199 | - exit; |
|
| 200 | - |
|
| 201 | - case 'quicknone': |
|
| 202 | - $cookie->un_set('translate_mode'); |
|
| 203 | - break; |
|
| 204 | - |
|
| 205 | - case 'quicknew': |
|
| 206 | - $cookie->set('translate_mode', 'new'); |
|
| 207 | - break; |
|
| 208 | - |
|
| 209 | - case 'quickall': |
|
| 210 | - $cookie->set('translate_mode', 'all'); |
|
| 211 | - break; |
|
| 212 | - |
|
| 213 | - default: |
|
| 214 | - $action = 'listnew'; |
|
| 215 | - $trans = sql( |
|
| 216 | - "SELECT DISTINCT |
|
| 181 | + case 'remove': |
|
| 182 | + if (!$access->mayTranslate($translang)) { |
|
| 183 | + $tpl->error(ERROR_NO_ACCESS); |
|
| 184 | + } |
|
| 185 | + remove(); |
|
| 186 | + break; |
|
| 187 | + |
|
| 188 | + case 'scan': |
|
| 189 | + scan(); |
|
| 190 | + break; |
|
| 191 | + |
|
| 192 | + case 'scanstart': |
|
| 193 | + scanStart(); |
|
| 194 | + break; |
|
| 195 | + |
|
| 196 | + case 'scanfile': |
|
| 197 | + $filename = isset($_REQUEST['filename']) ? $_REQUEST['filename'] : ''; |
|
| 198 | + scanFile($filename); |
|
| 199 | + exit; |
|
| 200 | + |
|
| 201 | + case 'quicknone': |
|
| 202 | + $cookie->un_set('translate_mode'); |
|
| 203 | + break; |
|
| 204 | + |
|
| 205 | + case 'quicknew': |
|
| 206 | + $cookie->set('translate_mode', 'new'); |
|
| 207 | + break; |
|
| 208 | + |
|
| 209 | + case 'quickall': |
|
| 210 | + $cookie->set('translate_mode', 'all'); |
|
| 211 | + break; |
|
| 212 | + |
|
| 213 | + default: |
|
| 214 | + $action = 'listnew'; |
|
| 215 | + $trans = sql( |
|
| 216 | + "SELECT DISTINCT |
|
| 217 | 217 | `sys_trans`.`id`, |
| 218 | 218 | `sys_trans`.`text` |
| 219 | 219 | FROM `sys_trans` |
@@ -224,10 +224,10 @@ discard block |
||
| 224 | 224 | ON `sys_trans`.`id`=`sys_trans_ref`.`trans_id` |
| 225 | 225 | WHERE ISNULL(`sys_trans_text`.`trans_id`) OR `sys_trans_text`.`text`='' |
| 226 | 226 | ORDER BY `sys_trans`.`id` DESC", |
| 227 | - $translang |
|
| 228 | - ); |
|
| 229 | - $tpl->assign_rs('trans', $trans); |
|
| 230 | - sql_free_result($trans); |
|
| 227 | + $translang |
|
| 228 | + ); |
|
| 229 | + $tpl->assign_rs('trans', $trans); |
|
| 230 | + sql_free_result($trans); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | $languages = []; |
@@ -2273,38 +2273,38 @@ discard block |
||
| 2273 | 2273 | |
| 2274 | 2274 | foreach ($option as $k => $v) { |
| 2275 | 2275 | switch ($k) { |
| 2276 | - case 'encoding': |
|
| 2277 | - switch ($v) { |
|
| 2278 | - case 'utf8': |
|
| 2279 | - case 'ucs4_string': |
|
| 2280 | - case 'ucs4_array': |
|
| 2281 | - $this->_api_encoding = $v; |
|
| 2282 | - break; |
|
| 2276 | + case 'encoding': |
|
| 2277 | + switch ($v) { |
|
| 2278 | + case 'utf8': |
|
| 2279 | + case 'ucs4_string': |
|
| 2280 | + case 'ucs4_array': |
|
| 2281 | + $this->_api_encoding = $v; |
|
| 2282 | + break; |
|
| 2283 | 2283 | |
| 2284 | - default: |
|
| 2285 | - throw new InvalidArgumentException('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
| 2286 | - } |
|
| 2284 | + default: |
|
| 2285 | + throw new InvalidArgumentException('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
| 2286 | + } |
|
| 2287 | 2287 | |
| 2288 | 2288 | break; |
| 2289 | 2289 | |
| 2290 | - case 'overlong': |
|
| 2291 | - $this->_allow_overlong = ($v) ? true : false; |
|
| 2292 | - break; |
|
| 2290 | + case 'overlong': |
|
| 2291 | + $this->_allow_overlong = ($v) ? true : false; |
|
| 2292 | + break; |
|
| 2293 | 2293 | |
| 2294 | - case 'strict': |
|
| 2295 | - $this->_strict_mode = ($v) ? true : false; |
|
| 2296 | - break; |
|
| 2294 | + case 'strict': |
|
| 2295 | + $this->_strict_mode = ($v) ? true : false; |
|
| 2296 | + break; |
|
| 2297 | 2297 | |
| 2298 | - case 'version': |
|
| 2299 | - if (in_array($v, array('2003', '2008'))) { |
|
| 2300 | - $this->_version = $v; |
|
| 2301 | - } else { |
|
| 2302 | - throw new InvalidArgumentException('Set Parameter: Invalid parameter '.$v.' for option '.$k); |
|
| 2303 | - } |
|
| 2304 | - break; |
|
| 2298 | + case 'version': |
|
| 2299 | + if (in_array($v, array('2003', '2008'))) { |
|
| 2300 | + $this->_version = $v; |
|
| 2301 | + } else { |
|
| 2302 | + throw new InvalidArgumentException('Set Parameter: Invalid parameter '.$v.' for option '.$k); |
|
| 2303 | + } |
|
| 2304 | + break; |
|
| 2305 | 2305 | |
| 2306 | - default: |
|
| 2307 | - return false; |
|
| 2306 | + default: |
|
| 2307 | + return false; |
|
| 2308 | 2308 | } |
| 2309 | 2309 | } |
| 2310 | 2310 | |
@@ -2328,15 +2328,15 @@ discard block |
||
| 2328 | 2328 | // Forcing conversion of input to UCS4 array |
| 2329 | 2329 | // If one time encoding is given, use this, else the objects property |
| 2330 | 2330 | switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) { |
| 2331 | - case 'utf8': |
|
| 2332 | - $decoded = $this->_utf8_to_ucs4($decoded); |
|
| 2333 | - break; |
|
| 2334 | - case 'ucs4_string': |
|
| 2335 | - $decoded = $this->_ucs4_string_to_ucs4($decoded); |
|
| 2336 | - case 'ucs4_array': // No break; before this line. Catch case, but do nothing |
|
| 2337 | - break; |
|
| 2338 | - default: |
|
| 2339 | - throw new InvalidArgumentException('Unsupported input format'); |
|
| 2331 | + case 'utf8': |
|
| 2332 | + $decoded = $this->_utf8_to_ucs4($decoded); |
|
| 2333 | + break; |
|
| 2334 | + case 'ucs4_string': |
|
| 2335 | + $decoded = $this->_ucs4_string_to_ucs4($decoded); |
|
| 2336 | + case 'ucs4_array': // No break; before this line. Catch case, but do nothing |
|
| 2337 | + break; |
|
| 2338 | + default: |
|
| 2339 | + throw new InvalidArgumentException('Unsupported input format'); |
|
| 2340 | 2340 | } |
| 2341 | 2341 | |
| 2342 | 2342 | // No input, no output, what else did you expect? |
@@ -2350,35 +2350,35 @@ discard block |
||
| 2350 | 2350 | foreach ($decoded as $k => $v) { |
| 2351 | 2351 | // Make sure to use just the plain dot |
| 2352 | 2352 | switch($v) { |
| 2353 | - case 0x3002: |
|
| 2354 | - case 0xFF0E: |
|
| 2355 | - case 0xFF61: |
|
| 2356 | - $decoded[$k] = 0x2E; |
|
| 2357 | - // It's right, no break here |
|
| 2358 | - // The codepoints above have to be converted to dots anyway |
|
| 2359 | - |
|
| 2360 | - // Stumbling across an anchoring character |
|
| 2361 | - case 0x2E: |
|
| 2362 | - case 0x2F: |
|
| 2363 | - case 0x3A: |
|
| 2364 | - case 0x3F: |
|
| 2365 | - case 0x40: |
|
| 2366 | - // Neither email addresses nor URLs allowed in strict mode |
|
| 2367 | - if ($this->_strict_mode) { |
|
| 2368 | - throw new InvalidArgumentException('Neither email addresses nor URLs are allowed in strict mode.'); |
|
| 2369 | - } |
|
| 2370 | - // Skip first char |
|
| 2371 | - if ($k) { |
|
| 2372 | - $encoded = ''; |
|
| 2373 | - $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
| 2374 | - if ($encoded) { |
|
| 2375 | - $output .= $encoded; |
|
| 2376 | - } else { |
|
| 2377 | - $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
| 2353 | + case 0x3002: |
|
| 2354 | + case 0xFF0E: |
|
| 2355 | + case 0xFF61: |
|
| 2356 | + $decoded[$k] = 0x2E; |
|
| 2357 | + // It's right, no break here |
|
| 2358 | + // The codepoints above have to be converted to dots anyway |
|
| 2359 | + |
|
| 2360 | + // Stumbling across an anchoring character |
|
| 2361 | + case 0x2E: |
|
| 2362 | + case 0x2F: |
|
| 2363 | + case 0x3A: |
|
| 2364 | + case 0x3F: |
|
| 2365 | + case 0x40: |
|
| 2366 | + // Neither email addresses nor URLs allowed in strict mode |
|
| 2367 | + if ($this->_strict_mode) { |
|
| 2368 | + throw new InvalidArgumentException('Neither email addresses nor URLs are allowed in strict mode.'); |
|
| 2378 | 2369 | } |
| 2379 | - $output .= chr($decoded[$k]); |
|
| 2380 | - } |
|
| 2381 | - $last_begin = $k + 1; |
|
| 2370 | + // Skip first char |
|
| 2371 | + if ($k) { |
|
| 2372 | + $encoded = ''; |
|
| 2373 | + $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
| 2374 | + if ($encoded) { |
|
| 2375 | + $output .= $encoded; |
|
| 2376 | + } else { |
|
| 2377 | + $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
| 2378 | + } |
|
| 2379 | + $output .= chr($decoded[$k]); |
|
| 2380 | + } |
|
| 2381 | + $last_begin = $k + 1; |
|
| 2382 | 2382 | } |
| 2383 | 2383 | } |
| 2384 | 2384 | // Catch the rest of the string |
@@ -2416,12 +2416,12 @@ discard block |
||
| 2416 | 2416 | // Optionally set |
| 2417 | 2417 | if ($one_time_encoding) { |
| 2418 | 2418 | switch ($one_time_encoding) { |
| 2419 | - case 'utf8': |
|
| 2420 | - case 'ucs4_string': |
|
| 2421 | - case 'ucs4_array': |
|
| 2422 | - break; |
|
| 2423 | - default: |
|
| 2424 | - throw new InvalidArgumentException('Unknown encoding '.$one_time_encoding); |
|
| 2419 | + case 'utf8': |
|
| 2420 | + case 'ucs4_string': |
|
| 2421 | + case 'ucs4_array': |
|
| 2422 | + break; |
|
| 2423 | + default: |
|
| 2424 | + throw new InvalidArgumentException('Unknown encoding '.$one_time_encoding); |
|
| 2425 | 2425 | } |
| 2426 | 2426 | } |
| 2427 | 2427 | // Make sure to drop any newline characters around |
@@ -2473,17 +2473,17 @@ discard block |
||
| 2473 | 2473 | // The output is UTF-8 by default, other output formats need conversion here |
| 2474 | 2474 | // If one time encoding is given, use this, else the objects property |
| 2475 | 2475 | switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) { |
| 2476 | - case 'utf8': |
|
| 2477 | - return $return; |
|
| 2478 | - break; |
|
| 2479 | - case 'ucs4_string': |
|
| 2480 | - return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); |
|
| 2481 | - break; |
|
| 2482 | - case 'ucs4_array': |
|
| 2483 | - return $this->_utf8_to_ucs4($return); |
|
| 2484 | - break; |
|
| 2485 | - default: |
|
| 2486 | - throw new InvalidArgumentException('Unsupported output format'); |
|
| 2476 | + case 'utf8': |
|
| 2477 | + return $return; |
|
| 2478 | + break; |
|
| 2479 | + case 'ucs4_string': |
|
| 2480 | + return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); |
|
| 2481 | + break; |
|
| 2482 | + case 'ucs4_array': |
|
| 2483 | + return $this->_utf8_to_ucs4($return); |
|
| 2484 | + break; |
|
| 2485 | + default: |
|
| 2486 | + throw new InvalidArgumentException('Unsupported output format'); |
|
| 2487 | 2487 | } |
| 2488 | 2488 | } |
| 2489 | 2489 | |
@@ -2340,7 +2340,9 @@ discard block |
||
| 2340 | 2340 | } |
| 2341 | 2341 | |
| 2342 | 2342 | // No input, no output, what else did you expect? |
| 2343 | - if (empty($decoded)) return ''; |
|
| 2343 | + if (empty($decoded)) { |
|
| 2344 | + return ''; |
|
| 2345 | + } |
|
| 2344 | 2346 | |
| 2345 | 2347 | // Anchors for iteration |
| 2346 | 2348 | $last_begin = 0; |
@@ -2429,7 +2431,8 @@ discard block |
||
| 2429 | 2431 | |
| 2430 | 2432 | // Negotiate input and try to determine, wether it is a plain string, |
| 2431 | 2433 | // an email address or something like a complete URL |
| 2432 | - if (strpos($input, '@')) { // Maybe it is an email address |
|
| 2434 | + if (strpos($input, '@')) { |
|
| 2435 | +// Maybe it is an email address |
|
| 2433 | 2436 | // No no in strict mode |
| 2434 | 2437 | if ($this->_strict_mode) { |
| 2435 | 2438 | throw new InvalidArgumentException('Only simple domain name parts can be handled in strict mode'); |
@@ -2438,10 +2441,13 @@ discard block |
||
| 2438 | 2441 | $arr = explode('.', $input); |
| 2439 | 2442 | foreach ($arr as $k => $v) { |
| 2440 | 2443 | $conv = $this->_decode($v); |
| 2441 | - if ($conv) $arr[$k] = $conv; |
|
| 2444 | + if ($conv) { |
|
| 2445 | + $arr[$k] = $conv; |
|
| 2446 | + } |
|
| 2442 | 2447 | } |
| 2443 | 2448 | $return = $email_pref . '@' . join('.', $arr); |
| 2444 | - } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters) |
|
| 2449 | + } elseif (preg_match('![:\./]!', $input)) { |
|
| 2450 | +// Or a complete domain name (with or without paths / parameters) |
|
| 2445 | 2451 | // No no in strict mode |
| 2446 | 2452 | if ($this->_strict_mode) { |
| 2447 | 2453 | throw new InvalidArgumentException('Only simple domain name parts can be handled in strict mode'); |
@@ -2452,22 +2458,28 @@ discard block |
||
| 2452 | 2458 | $arr = explode('.', $parsed['host']); |
| 2453 | 2459 | foreach ($arr as $k => $v) { |
| 2454 | 2460 | $conv = $this->_decode($v); |
| 2455 | - if ($conv) $arr[$k] = $conv; |
|
| 2461 | + if ($conv) { |
|
| 2462 | + $arr[$k] = $conv; |
|
| 2463 | + } |
|
| 2456 | 2464 | } |
| 2457 | 2465 | $parsed['host'] = join('.', $arr); |
| 2458 | 2466 | if (isset($parsed['scheme'])) { |
| 2459 | 2467 | $parsed['scheme'] .= (strtolower($parsed['scheme']) == 'mailto') ? ':' : '://'; |
| 2460 | 2468 | } |
| 2461 | 2469 | $return = $this->_unparse_url($parsed); |
| 2462 | - } else { // parse_url seems to have failed, try without it |
|
| 2470 | + } else { |
|
| 2471 | +// parse_url seems to have failed, try without it |
|
| 2463 | 2472 | $arr = explode('.', $input); |
| 2464 | 2473 | foreach ($arr as $k => $v) { |
| 2465 | 2474 | $conv = $this->_decode($v); |
| 2466 | - if ($conv) $arr[$k] = $conv; |
|
| 2475 | + if ($conv) { |
|
| 2476 | + $arr[$k] = $conv; |
|
| 2477 | + } |
|
| 2467 | 2478 | } |
| 2468 | 2479 | $return = join('.', $arr); |
| 2469 | 2480 | } |
| 2470 | - } else { // Otherwise we consider it being a pure domain name string |
|
| 2481 | + } else { |
|
| 2482 | +// Otherwise we consider it being a pure domain name string |
|
| 2471 | 2483 | $return = $this->_decode($input); |
| 2472 | 2484 | } |
| 2473 | 2485 | // The output is UTF-8 by default, other output formats need conversion here |
@@ -3115,7 +3127,8 @@ discard block |
||
| 3115 | 3127 | for ($k = 0; $k < $inp_len; ++$k) { |
| 3116 | 3128 | $v = ord($input{$k}); // Extract byte from input string |
| 3117 | 3129 | |
| 3118 | - if ($v < 128) { // We found an ASCII char - put into stirng as is |
|
| 3130 | + if ($v < 128) { |
|
| 3131 | +// We found an ASCII char - put into stirng as is |
|
| 3119 | 3132 | $output[$out_len] = $v; |
| 3120 | 3133 | ++$out_len; |
| 3121 | 3134 | if ('add' == $mode) { |
@@ -3123,23 +3136,29 @@ discard block |
||
| 3123 | 3136 | } |
| 3124 | 3137 | continue; |
| 3125 | 3138 | } |
| 3126 | - if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char |
|
| 3139 | + if ('next' == $mode) { |
|
| 3140 | +// Try to find the next start byte; determine the width of the Unicode char |
|
| 3127 | 3141 | $start_byte = $v; |
| 3128 | 3142 | $mode = 'add'; |
| 3129 | 3143 | $test = 'range'; |
| 3130 | - if ($v >> 5 == 6) { // &110xxxxx 10xxxxx |
|
| 3144 | + if ($v >> 5 == 6) { |
|
| 3145 | +// &110xxxxx 10xxxxx |
|
| 3131 | 3146 | $next_byte = 0; // Tells, how many times subsequent bitmasks must rotate 6bits to the left |
| 3132 | 3147 | $v = ($v - 192) << 6; |
| 3133 | - } elseif ($v >> 4 == 14) { // &1110xxxx 10xxxxxx 10xxxxxx |
|
| 3148 | + } elseif ($v >> 4 == 14) { |
|
| 3149 | +// &1110xxxx 10xxxxxx 10xxxxxx |
|
| 3134 | 3150 | $next_byte = 1; |
| 3135 | 3151 | $v = ($v - 224) << 12; |
| 3136 | - } elseif ($v >> 3 == 30) { // &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx |
|
| 3152 | + } elseif ($v >> 3 == 30) { |
|
| 3153 | +// &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx |
|
| 3137 | 3154 | $next_byte = 2; |
| 3138 | 3155 | $v = ($v - 240) << 18; |
| 3139 | - } elseif ($v >> 2 == 62) { // &111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx |
|
| 3156 | + } elseif ($v >> 2 == 62) { |
|
| 3157 | +// &111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx |
|
| 3140 | 3158 | $next_byte = 3; |
| 3141 | 3159 | $v = ($v - 248) << 24; |
| 3142 | - } elseif ($v >> 1 == 126) { // &1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx |
|
| 3160 | + } elseif ($v >> 1 == 126) { |
|
| 3161 | +// &1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx |
|
| 3143 | 3162 | $next_byte = 4; |
| 3144 | 3163 | $v = ($v - 252) << 30; |
| 3145 | 3164 | } else { |
@@ -3158,7 +3177,8 @@ discard block |
||
| 3158 | 3177 | throw new OutOfRangeException('Bogus UTF-8 character detected (out of legal range) at byte '.$k); |
| 3159 | 3178 | } |
| 3160 | 3179 | } |
| 3161 | - if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx |
|
| 3180 | + if ($v >> 6 == 2) { |
|
| 3181 | +// Bit mask must be 10xxxxxx |
|
| 3162 | 3182 | $v = ($v - 128) << ($next_byte * 6); |
| 3163 | 3183 | $output[($out_len - 1)] += $v; |
| 3164 | 3184 | --$next_byte; |
@@ -29,12 +29,12 @@ |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | switch ($action) { |
| 32 | - case 'addignore': |
|
| 33 | - sql("INSERT IGNORE INTO `cache_ignore` (`cache_id`, `user_id`) VALUES ('&1', '&2')", $cache_id, $login->userid); |
|
| 34 | - break; |
|
| 35 | - case 'removeignore': |
|
| 36 | - sql("DELETE FROM `cache_ignore` WHERE `cache_id`='&1' AND `user_id`='&2'", $cache_id, $login->userid); |
|
| 37 | - break; |
|
| 32 | + case 'addignore': |
|
| 33 | + sql("INSERT IGNORE INTO `cache_ignore` (`cache_id`, `user_id`) VALUES ('&1', '&2')", $cache_id, $login->userid); |
|
| 34 | + break; |
|
| 35 | + case 'removeignore': |
|
| 36 | + sql("DELETE FROM `cache_ignore` WHERE `cache_id`='&1' AND `user_id`='&2'", $cache_id, $login->userid); |
|
| 37 | + break; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // clear cached map result, so that the change directly appears on the map |
@@ -84,7 +84,8 @@ discard block |
||
| 84 | 84 | $called_by_search = isset($_REQUEST['calledbysearch']) ? $_REQUEST['calledbysearch'] <> 0 : true; |
| 85 | 85 | $called_by_profile_query = false; |
| 86 | 86 | |
| 87 | -if (isset($_REQUEST['queryid']) || isset($_REQUEST['showresult'])) { // Ocprop: showresult, queryid |
|
| 87 | +if (isset($_REQUEST['queryid']) || isset($_REQUEST['showresult'])) { |
|
| 88 | +// Ocprop: showresult, queryid |
|
| 88 | 89 | $bCookieQueryid = false; |
| 89 | 90 | $queryid = isset($_REQUEST['queryid']) ? $_REQUEST['queryid'] : 0; |
| 90 | 91 | if ($queryid && |
@@ -208,7 +209,8 @@ discard block |
||
| 208 | 209 | sql_free_result($rs_name); |
| 209 | 210 | } |
| 210 | 211 | } |
| 211 | -} else { // $queryid == 0 |
|
| 212 | +} else { |
|
| 213 | +// $queryid == 0 |
|
| 212 | 214 | // build search options from GET/POST parameters or default values |
| 213 | 215 | |
| 214 | 216 | // hack |
@@ -287,12 +289,14 @@ discard block |
||
| 287 | 289 | if (!isset($_REQUEST['utf8'])) { |
| 288 | 290 | $options['cachename'] = iconv("ISO-8859-1", "UTF-8", $options['cachename']); |
| 289 | 291 | } |
| 290 | - } elseif (isset($_REQUEST['searchbyowner'])) { // Ocprop |
|
| 292 | + } elseif (isset($_REQUEST['searchbyowner'])) { |
|
| 293 | +// Ocprop |
|
| 291 | 294 | $options['searchtype'] = 'byowner'; |
| 292 | 295 | |
| 293 | 296 | $options['ownerid'] = isset($_REQUEST['ownerid']) ? $_REQUEST['ownerid'] : 0; |
| 294 | 297 | $options['owner'] = isset($_REQUEST['owner']) ? stripslashes($_REQUEST['owner']) : ''; |
| 295 | - } elseif (isset($_REQUEST['searchbyfinder'])) { // Ocprop |
|
| 298 | + } elseif (isset($_REQUEST['searchbyfinder'])) { |
|
| 299 | +// Ocprop |
|
| 296 | 300 | $options['searchtype'] = 'byfinder'; |
| 297 | 301 | |
| 298 | 302 | $options['finderid'] = isset($_REQUEST['finderid']) ? $_REQUEST['finderid'] : 0; |
@@ -437,7 +441,8 @@ discard block |
||
| 437 | 441 | $bRememberQuery = isset($_REQUEST['skipqueryid']) ? !$_REQUEST['skipqueryid'] : true; |
| 438 | 442 | // This is used by the map, which implements its own query-caching. |
| 439 | 443 | if ($bRememberQuery) { |
| 440 | - if ($queryid == 0 && $options['showresult'] != 0) { // 'showresult' = "execute query" |
|
| 444 | + if ($queryid == 0 && $options['showresult'] != 0) { |
|
| 445 | +// 'showresult' = "execute query" |
|
| 441 | 446 | sql( |
| 442 | 447 | "INSERT INTO `queries` (`user_id`, `options`, `last_queried`) VALUES (0, '&1', NOW())", |
| 443 | 448 | serialize($options) |
@@ -854,7 +859,8 @@ discard block |
||
| 854 | 859 | outputSearchForm($options); |
| 855 | 860 | exit; |
| 856 | 861 | } |
| 857 | - } elseif ($options['searchtype'] == 'bydistance') { // Ocprop |
|
| 862 | + } elseif ($options['searchtype'] == 'bydistance') { |
|
| 863 | +// Ocprop |
|
| 858 | 864 | //check the entered data |
| 859 | 865 | if (isset($options['lat']) && isset($options['lon'])) { |
| 860 | 866 | $lat = $options['lat'] + 0; |
@@ -924,7 +930,8 @@ discard block |
||
| 924 | 930 | $sql_innerjoin[] = '`cache_logs` ON `caches`.`cache_id`=`cache_logs`.`cache_id`'; |
| 925 | 931 | $sql_where[] = '`cache_logs`.`user_id`=\'' . sql_escape($finder_id) . '\''; |
| 926 | 932 | |
| 927 | - if ($options['logtype'] != '0') { // 0 = all types |
|
| 933 | + if ($options['logtype'] != '0') { |
|
| 934 | +// 0 = all types |
|
| 928 | 935 | $ids = explode(',', $options['logtype']); |
| 929 | 936 | $idNumbers = '0'; |
| 930 | 937 | foreach ($ids as $id) { |
@@ -1405,7 +1412,8 @@ discard block |
||
| 1405 | 1412 | } |
| 1406 | 1413 | |
| 1407 | 1414 | $count = $caches_per_page; |
| 1408 | - if (isset($_REQUEST['count'])) { // Ocprop |
|
| 1415 | + if (isset($_REQUEST['count'])) { |
|
| 1416 | +// Ocprop |
|
| 1409 | 1417 | $count = floor($_REQUEST['count'] + 0); |
| 1410 | 1418 | } |
| 1411 | 1419 | if ($count == 'max') { |
@@ -1525,7 +1533,8 @@ discard block |
||
| 1525 | 1533 | } else { |
| 1526 | 1534 | exit; |
| 1527 | 1535 | } |
| 1528 | -} else { // $options['showresult'] == 0 |
|
| 1536 | +} else { |
|
| 1537 | +// $options['showresult'] == 0 |
|
| 1529 | 1538 | //============================================================= |
| 1530 | 1539 | // F5. present search options form to the user |
| 1531 | 1540 | //============================================================= |
@@ -1597,7 +1606,8 @@ discard block |
||
| 1597 | 1606 | |
| 1598 | 1607 | if (isset($options['sort'])) { |
| 1599 | 1608 | $bBynameChecked = ($options['sort'] == 'byname'); |
| 1600 | - } else { // Ocprop |
|
| 1609 | + } else { |
|
| 1610 | +// Ocprop |
|
| 1601 | 1611 | $bBynameChecked = (!$login->logged_in()); |
| 1602 | 1612 | } |
| 1603 | 1613 | $tpl->assign('byname_checked', $bBynameChecked); |
@@ -1759,7 +1769,8 @@ discard block |
||
| 1759 | 1769 | } |
| 1760 | 1770 | if ($options['searchtype'] == 'bydistance') { |
| 1761 | 1771 | $dByDistanceChecked = ($options['searchtype'] == 'bydistance'); |
| 1762 | - } else { // Ocprop |
|
| 1772 | + } else { |
|
| 1773 | +// Ocprop |
|
| 1763 | 1774 | $dByDistanceChecked = false; |
| 1764 | 1775 | } |
| 1765 | 1776 | $tpl->assign('dbydistance_checked', $dByDistanceChecked); |
@@ -1800,7 +1811,8 @@ discard block |
||
| 1800 | 1811 | ); |
| 1801 | 1812 | if ($options['searchtype'] == 'bywaypoint') { |
| 1802 | 1813 | $dByWaypointChecked = ($options['searchtype'] == 'bywaypoint'); |
| 1803 | - } else { // Ocprop |
|
| 1814 | + } else { |
|
| 1815 | +// Ocprop |
|
| 1804 | 1816 | $dByWaypointChecked = false; |
| 1805 | 1817 | } |
| 1806 | 1818 | $tpl->assign('dbywaypoint_checked', $dByWaypointChecked); |
@@ -24,7 +24,8 @@ discard block |
||
| 24 | 24 | if ($error == false) { |
| 25 | 25 | //logid |
| 26 | 26 | $log_id = 0; |
| 27 | - if (isset($_REQUEST['logid'])) { // Ocprop |
|
| 27 | + if (isset($_REQUEST['logid'])) { |
|
| 28 | +// Ocprop |
|
| 28 | 29 | $log_id = $_REQUEST['logid']; |
| 29 | 30 | } |
| 30 | 31 | |
@@ -273,7 +274,8 @@ discard block |
||
| 273 | 274 | } |
| 274 | 275 | |
| 275 | 276 | //store? |
| 276 | - if ($date_ok && $logtype_ok && $pw_ok && isset($_POST['submitform'])) { // Ocprop |
|
| 277 | + if ($date_ok && $logtype_ok && $pw_ok && isset($_POST['submitform'])) { |
|
| 278 | +// Ocprop |
|
| 277 | 279 | // 00:00:01 = "00:00 was logged" |
| 278 | 280 | // 00:00:00 = "no time was logged" |
| 279 | 281 | if ("$log_time_hour$log_time_minute" != "" && |
@@ -423,7 +423,8 @@ |
||
| 423 | 423 | { |
| 424 | 424 | global $menu; |
| 425 | 425 | |
| 426 | - if ($mainmenuindex >= 0) { // is -1 e.g. when calling newcache.php as logged-off-user (-> login.tpl.php) |
|
| 426 | + if ($mainmenuindex >= 0) { |
|
| 427 | +// is -1 e.g. when calling newcache.php as logged-off-user (-> login.tpl.php) |
|
| 427 | 428 | echo htmlspecialchars(t($menu[$mainmenuindex]['menustring']), ENT_COMPAT, 'UTF-8'); |
| 428 | 429 | |
| 429 | 430 | if (isset($menu[$mainmenuindex]['submenu']) && ($menu[$mainmenuindex]['siteid'] != $pageid)) { |
@@ -34,10 +34,12 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $uuid = isset($_REQUEST['uuid']) ? $_REQUEST['uuid'] : 0; |
| 36 | 36 | |
| 37 | -if ($action == 'add') { // Ocprop |
|
| 37 | +if ($action == 'add') { |
|
| 38 | +// Ocprop |
|
| 38 | 39 | $picture = new picture(); |
| 39 | 40 | |
| 40 | - if (isset($_REQUEST['cacheuuid'])) { // Ocprop |
|
| 41 | + if (isset($_REQUEST['cacheuuid'])) { |
|
| 42 | +// Ocprop |
|
| 41 | 43 | $cache = cache::fromUUID($_REQUEST['cacheuuid']); |
| 42 | 44 | if ($cache === null) { |
| 43 | 45 | $tpl->error(ERROR_CACHE_NOT_EXISTS); |
@@ -51,7 +53,8 @@ discard block |
||
| 51 | 53 | $picture->setObjectType(OBJECT_CACHE); |
| 52 | 54 | |
| 53 | 55 | $cache = null; |
| 54 | - } elseif (isset($_REQUEST['loguuid'])) {// Ocprop |
|
| 56 | + } elseif (isset($_REQUEST['loguuid'])) { |
|
| 57 | +// Ocprop |
|
| 55 | 58 | $cachelog = cachelog::fromUUID($_REQUEST['loguuid']); |
| 56 | 59 | if ($cachelog === null) { |
| 57 | 60 | $tpl->error(ERROR_CACHELOG_NOT_EXISTS); |
@@ -72,7 +75,8 @@ discard block |
||
| 72 | 75 | } |
| 73 | 76 | |
| 74 | 77 | // uploaded file ok? |
| 75 | - if (isset($_REQUEST['ok'])) { // Ocprop |
|
| 78 | + if (isset($_REQUEST['ok'])) { |
|
| 79 | +// Ocprop |
|
| 76 | 80 | $bError = false; |
| 77 | 81 | |
| 78 | 82 | $picture->setSpoiler(isset($_REQUEST['spoiler']) && $_REQUEST['spoiler'] == '1'); // Ocprop |
@@ -92,7 +96,8 @@ discard block |
||
| 92 | 96 | $tpl->redirect($picture->getPageLink()); |
| 93 | 97 | } |
| 94 | 98 | |
| 95 | - if (!isset($_FILES['file'])) { // Ocprop |
|
| 99 | + if (!isset($_FILES['file'])) { |
|
| 100 | +// Ocprop |
|
| 96 | 101 | $tpl->assign('errorfile', ERROR_UPLOAD_ERR_NO_FILE); |
| 97 | 102 | $bError = true; |
| 98 | 103 | } elseif ($_FILES['file']['error'] == UPLOAD_ERR_NO_FILE) { |
@@ -757,7 +757,8 @@ discard block |
||
| 757 | 757 | $cacheid, |
| 758 | 758 | $rdate |
| 759 | 759 | ); |
| 760 | - if ($r = sql_fetch_assoc($rs)) { // should always be true ... |
|
| 760 | + if ($r = sql_fetch_assoc($rs)) { |
|
| 761 | +// should always be true ... |
|
| 761 | 762 | if (!$simulate) { |
| 762 | 763 | sql( |
| 763 | 764 | "UPDATE `caches` SET `latitude`='&1', `longitude`='&2' WHERE `cache_id`='&3'", |
@@ -790,7 +791,8 @@ discard block |
||
| 790 | 791 | $cacheid, |
| 791 | 792 | $rdate |
| 792 | 793 | ); |
| 793 | - if ($r = sql_fetch_assoc($rs)) { // should always be true ... |
|
| 794 | + if ($r = sql_fetch_assoc($rs)) { |
|
| 795 | +// should always be true ... |
|
| 794 | 796 | if (!$simulate) { |
| 795 | 797 | sql( |
| 796 | 798 | "UPDATE `caches` SET `country`='&1' WHERE `cache_id`='&2'", |
@@ -827,7 +829,8 @@ discard block |
||
| 827 | 829 | 'wp_nc' => 'waypoints' |
| 828 | 830 | ]; |
| 829 | 831 | |
| 830 | - if ($r = sql_fetch_assoc($rs)) {// can be false |
|
| 832 | + if ($r = sql_fetch_assoc($rs)) { |
|
| 833 | +// can be false |
|
| 831 | 834 | $setfields = ""; |
| 832 | 835 | foreach ($fields as $field => $ropt) { |
| 833 | 836 | if (in_array($ropt, $roptions) && $r[$field] != $cache[$field]) { |
@@ -896,13 +899,15 @@ discard block |
||
| 896 | 899 | |
| 897 | 900 | while ($r = sql_fetch_assoc($rs)) { |
| 898 | 901 | if (!$simulate) { |
| 899 | - if ($r['desc'] === null) { // was newly created -> delete |
|
| 902 | + if ($r['desc'] === null) { |
|
| 903 | +// was newly created -> delete |
|
| 900 | 904 | sql( |
| 901 | 905 | "DELETE FROM `cache_desc` WHERE `cache_id`='&1' AND `language`='&2'", |
| 902 | 906 | $cacheid, |
| 903 | 907 | $r['language'] |
| 904 | 908 | ); |
| 905 | - } else {// id, uuid, date_created and last_modified are set automatically |
|
| 909 | + } else { |
|
| 910 | +// id, uuid, date_created and last_modified are set automatically |
|
| 906 | 911 | sql( |
| 907 | 912 | "INSERT INTO `cache_desc` |
| 908 | 913 | (`node`, `cache_id`, `language`, `desc`, `desc_html`, `desc_htmledit`, `hint`, `short_desc`) |
@@ -44,7 +44,8 @@ |
||
| 44 | 44 | $file = fopen($filename, "r"); |
| 45 | 45 | $cnt = 0; |
| 46 | 46 | while ($line = fgets($file, 4096)) { |
| 47 | - if ($cnt ++ == 0) {// skip first line |
|
| 47 | + if ($cnt ++ == 0) { |
|
| 48 | +// skip first line |
|
| 48 | 49 | continue; |
| 49 | 50 | } |
| 50 | 51 | |