@@ -303,6 +303,10 @@ discard block |
||
| 303 | 303 | return 'R ' . floor($result[0]) . ' H ' . floor($result[1]); |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | + /** |
|
| 307 | + * @param integer $bw |
|
| 308 | + * @param integer $lw |
|
| 309 | + */ |
|
| 306 | 310 | public function wgs2pot($bw, $lw) |
| 307 | 311 | { |
| 308 | 312 | /* Copyright (c) 2006, HELMUT H. HEIMEIER |
@@ -602,6 +606,9 @@ discard block |
||
| 602 | 606 | ]; |
| 603 | 607 | } |
| 604 | 608 | |
| 609 | + /** |
|
| 610 | + * @param string $name |
|
| 611 | + */ |
|
| 605 | 612 | public static function parseRequestLat($name) |
| 606 | 613 | { |
| 607 | 614 | if (!isset($_REQUEST[$name . 'NS']) || !isset($_REQUEST[$name . 'Lat']) || !isset($_REQUEST[$name . 'LatMin'])) { |
@@ -620,6 +627,9 @@ discard block |
||
| 620 | 627 | return $lat; |
| 621 | 628 | } |
| 622 | 629 | |
| 630 | + /** |
|
| 631 | + * @param string $name |
|
| 632 | + */ |
|
| 623 | 633 | public static function parseRequestLon($name) |
| 624 | 634 | { |
| 625 | 635 | if (!isset($_REQUEST[$name . 'EW']) || !isset($_REQUEST[$name . 'Lon']) || !isset($_REQUEST[$name . 'LonMin'])) { |
@@ -31,15 +31,15 @@ discard block |
||
| 31 | 31 | public function getDecimal() |
| 32 | 32 | { |
| 33 | 33 | if ($this->nLat < 0) { |
| 34 | - $sLat = 'S ' . sprintf('%08.5f', - $this->nLat) . '°'; |
|
| 34 | + $sLat = 'S '.sprintf('%08.5f', - $this->nLat).'°'; |
|
| 35 | 35 | } else { |
| 36 | - $sLat = 'N ' . sprintf('%08.5f', $this->nLat) . '°'; |
|
| 36 | + $sLat = 'N '.sprintf('%08.5f', $this->nLat).'°'; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | if ($this->nLon < 0) { |
| 40 | - $sLon = 'W ' . sprintf('%09.5f', - $this->nLon) . '°'; |
|
| 40 | + $sLon = 'W '.sprintf('%09.5f', - $this->nLon).'°'; |
|
| 41 | 41 | } else { |
| 42 | - $sLon = 'E ' . sprintf('%09.5f', $this->nLon) . '°'; |
|
| 42 | + $sLon = 'E '.sprintf('%09.5f', $this->nLon).'°'; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | return [ |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | $nLatDeg = floor($nLat); |
| 63 | 63 | $nLatMin = ($nLat - $nLatDeg) * 60; |
| 64 | 64 | if ($bLatN) { |
| 65 | - $sLat = 'N ' . sprintf("%02d", $nLatDeg) . '° ' . sprintf($minute_format, $nLatMin) . '\''; |
|
| 65 | + $sLat = 'N '.sprintf("%02d", $nLatDeg).'° '.sprintf($minute_format, $nLatMin).'\''; |
|
| 66 | 66 | } else { |
| 67 | - $sLat = 'S ' . sprintf("%02d", $nLatDeg) . '° ' . sprintf($minute_format, $nLatMin) . '\''; |
|
| 67 | + $sLat = 'S '.sprintf("%02d", $nLatDeg).'° '.sprintf($minute_format, $nLatMin).'\''; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Ocprop: ([E|W].*?)' |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | $nLonDeg = floor($nLon); |
| 77 | 77 | $nLonMin = ($nLon - $nLonDeg) * 60; |
| 78 | 78 | if ($bLonE) { |
| 79 | - $sLon = 'E ' . sprintf("%03d", $nLonDeg) . '° ' . sprintf($minute_format, $nLonMin) . '\''; |
|
| 79 | + $sLon = 'E '.sprintf("%03d", $nLonDeg).'° '.sprintf($minute_format, $nLonMin).'\''; |
|
| 80 | 80 | } else { |
| 81 | - $sLon = 'W ' . sprintf("%03d", $nLonDeg) . '° ' . sprintf($minute_format, $nLonMin) . '\''; |
|
| 81 | + $sLon = 'W '.sprintf("%03d", $nLonDeg).'° '.sprintf($minute_format, $nLonMin).'\''; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | return [ |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | return [ |
| 145 | 145 | 'zone' => "", |
| 146 | 146 | 'letter' => "", |
| 147 | - 'north' => 'N ' . 0, |
|
| 148 | - 'east' => 'E ' . 0 |
|
| 147 | + 'north' => 'N '.0, |
|
| 148 | + 'east' => 'E '.0 |
|
| 149 | 149 | ]; |
| 150 | 150 | } |
| 151 | 151 | if ($this->nLon <= - 180 || $this->nLon > 180 || $this->nLat <= - 80 || $this->nLat >= 84) { |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | 0 |
| 158 | 158 | ]; |
| 159 | 159 | } |
| 160 | - $lw = (float) $this->nLon; |
|
| 161 | - $bw = (float) $this->nLat; |
|
| 160 | + $lw = (float)$this->nLon; |
|
| 161 | + $bw = (float)$this->nLat; |
|
| 162 | 162 | |
| 163 | 163 | //WGS84 Datum |
| 164 | 164 | //Große Halbachse a und Abplattung f |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | //Koeffizienten zur Berechnung der Meridianbogenlänge |
| 179 | 179 | $e0 = $c * (pi() / 180) * (1 - 3 * $ex2 / 4 + 45 * $ex4 / 64 - 175 * $ex6 / 256 + 11025 * $ex8 / 16384); |
| 180 | - $e2 = $c * (- 3 * $ex2 / 8 + 15 * $ex4 / 32 - 525 * $ex6 / 1024 + 2205 * $ex8 / 4096); |
|
| 180 | + $e2 = $c * (-3 * $ex2 / 8 + 15 * $ex4 / 32 - 525 * $ex6 / 1024 + 2205 * $ex8 / 4096); |
|
| 181 | 181 | $e4 = $c * (15 * $ex4 / 256 - 105 * $ex6 / 1024 + 2205 * $ex8 / 16384); |
| 182 | - $e6 = $c * (- 35 * $ex6 / 3072 + 315 * $ex8 / 12288); |
|
| 182 | + $e6 = $c * (-35 * $ex6 / 3072 + 315 * $ex8 / 12288); |
|
| 183 | 183 | |
| 184 | 184 | //Längenzone lz und Breitenzone (Band) bz |
| 185 | 185 | $lzn = intval(($lw + 180) / 6) + 1; |
@@ -203,9 +203,9 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | $lz = "$lzn"; |
| 205 | 205 | if ($lzn < 10) { |
| 206 | - $lz = "0" . $lzn; |
|
| 206 | + $lz = "0".$lzn; |
|
| 207 | 207 | } |
| 208 | - $bd = (int) (1 + ($bw + 80) / 8); |
|
| 208 | + $bd = (int)(1 + ($bw + 80) / 8); |
|
| 209 | 209 | $bz = substr($b_sel, $bd - 1, 1); |
| 210 | 210 | |
| 211 | 211 | //Geographische Breite in Radianten br |
@@ -250,29 +250,29 @@ discard block |
||
| 250 | 250 | $ew = 0.9996 * ($nd * $cos1 * $dl + $nd * $cos3 * (1 - $tan2 + $etasq) * $dl3 / 6 + |
| 251 | 251 | $nd * $cos5 * (5 - 18 * $tan2 + $tan4) * $dl5 / 120) + 500000; |
| 252 | 252 | |
| 253 | - $nk = $nw - (int) $nw; |
|
| 253 | + $nk = $nw - (int)$nw; |
|
| 254 | 254 | if ($nk < 0.5) { |
| 255 | - $nw = '' . (int) $nw; |
|
| 255 | + $nw = ''.(int)$nw; |
|
| 256 | 256 | } else { |
| 257 | - $nw = '' . ((int) $nw + 1); |
|
| 257 | + $nw = ''.((int)$nw + 1); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | while (strlen($nw) < 7) { |
| 261 | - $nw = '0' . $nw; |
|
| 261 | + $nw = '0'.$nw; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - $nk = $ew - (int) $ew; |
|
| 264 | + $nk = $ew - (int)$ew; |
|
| 265 | 265 | if ($nk < 0.5) { |
| 266 | - $ew = '0' . (int) $ew; |
|
| 266 | + $ew = '0'.(int)$ew; |
|
| 267 | 267 | } else { |
| 268 | - $ew = '0' . intval($ew + 1); |
|
| 268 | + $ew = '0'.intval($ew + 1); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | return [ |
| 272 | 272 | 'zone' => $lz, |
| 273 | 273 | 'letter' => $bz, |
| 274 | - 'north' => 'N ' . floor($nw), |
|
| 275 | - 'east' => 'E ' . floor($ew) |
|
| 274 | + 'north' => 'N '.floor($nw), |
|
| 275 | + 'east' => 'E '.floor($ew) |
|
| 276 | 276 | ]; |
| 277 | 277 | } |
| 278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $pdResult = $this->wgs2pot($this->nLat, $this->nLon); |
| 283 | 283 | $result = $this->geo2gk($pdResult[1], $pdResult[0]); |
| 284 | 284 | |
| 285 | - return 'R ' . floor($result[0]) . ' H ' . floor($result[1]); |
|
| 285 | + return 'R '.floor($result[0]).' H '.floor($result[1]); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | public function wgs2pot($bw, $lw) |
@@ -313,8 +313,8 @@ discard block |
||
| 313 | 313 | 0 |
| 314 | 314 | ]; |
| 315 | 315 | } |
| 316 | - $lw = (float) $lw; |
|
| 317 | - $bw = (float) $bw; |
|
| 316 | + $lw = (float)$lw; |
|
| 317 | + $bw = (float)$bw; |
|
| 318 | 318 | |
| 319 | 319 | // Quellsystem WGS 84 Datum |
| 320 | 320 | // Große Halbachse a und Abplattung fq |
@@ -392,8 +392,8 @@ discard block |
||
| 392 | 392 | 0 |
| 393 | 393 | ]; |
| 394 | 394 | } |
| 395 | - $lp = (float) $lp; |
|
| 396 | - $bp = (float) $bp; |
|
| 395 | + $lp = (float)$lp; |
|
| 396 | + $bp = (float)$bp; |
|
| 397 | 397 | |
| 398 | 398 | // Potsdam Datum |
| 399 | 399 | // Große Halbachse a und Abplattung f |
@@ -411,9 +411,9 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | // Koeffizienten zur Berechnung der Meridianbogenlänge |
| 413 | 413 | $e0 = $c * (pi() / 180) * (1 - 3 * $ex2 / 4 + 45 * $ex4 / 64 - 175 * $ex6 / 256 + 11025 * $ex8 / 16384); |
| 414 | - $e2 = $c * (- 3 * $ex2 / 8 + 15 * $ex4 / 32 - 525 * $ex6 / 1024 + 2205 * $ex8 / 4096); |
|
| 414 | + $e2 = $c * (-3 * $ex2 / 8 + 15 * $ex4 / 32 - 525 * $ex6 / 1024 + 2205 * $ex8 / 4096); |
|
| 415 | 415 | $e4 = $c * (15 * $ex4 / 256 - 105 * $ex6 / 1024 + 2205 * $ex8 / 16384); |
| 416 | - $e6 = $c * (- 35 * $ex6 / 3072 + 315 * $ex8 / 12288); |
|
| 416 | + $e6 = $c * (-35 * $ex6 / 3072 + 315 * $ex8 / 12288); |
|
| 417 | 417 | |
| 418 | 418 | // Breite in Radianten |
| 419 | 419 | $br = $bp * pi() / 180; |
@@ -451,18 +451,18 @@ discard block |
||
| 451 | 451 | $rw = ($nd * $cos1 * $dl + $nd * $cos3 * (1 - $tan2 + $etasq) * $dl3 / 6 + |
| 452 | 452 | $nd * $cos5 * (5 - 18 * $tan2 + $tan4) * $dl5 / 120 + $kz * 1e6 + 500000); |
| 453 | 453 | |
| 454 | - $nk = $hw - (int) $hw; |
|
| 454 | + $nk = $hw - (int)$hw; |
|
| 455 | 455 | if ($nk < 0.5) { |
| 456 | - $hw = (int) $hw; |
|
| 456 | + $hw = (int)$hw; |
|
| 457 | 457 | } else { |
| 458 | - $hw = ((int) $hw) + 1; |
|
| 458 | + $hw = ((int)$hw) + 1; |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - $nk = $rw - (int) $rw; |
|
| 461 | + $nk = $rw - (int)$rw; |
|
| 462 | 462 | if ($nk < 0.5) { |
| 463 | - $rw = (int) $rw; |
|
| 463 | + $rw = (int)$rw; |
|
| 464 | 464 | } else { |
| 465 | - $rw = (int) ($rw + 1); |
|
| 465 | + $rw = (int)($rw + 1); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | return [ |
@@ -481,8 +481,8 @@ discard block |
||
| 481 | 481 | $lat_base = 52.15517440; |
| 482 | 482 | $lon_base = 5.38720621; |
| 483 | 483 | |
| 484 | - for ($i = 0; $i <= 6; $i ++) { |
|
| 485 | - for ($j = 0; $j <= 5; $j ++) { |
|
| 484 | + for ($i = 0; $i <= 6; $i++) { |
|
| 485 | + for ($j = 0; $j <= 5; $j++) { |
|
| 486 | 486 | $rpq[$i][$j] = 0; |
| 487 | 487 | $spq[$i][$j] = 0; |
| 488 | 488 | } |
@@ -517,8 +517,8 @@ discard block |
||
| 517 | 517 | $xOrigin = 0; |
| 518 | 518 | $yOrigin = 0; |
| 519 | 519 | |
| 520 | - for ($q = 0; $q <= 5; $q ++) { |
|
| 521 | - for ($p = 0; $p <= 6; $p ++) { |
|
| 520 | + for ($q = 0; $q <= 5; $q++) { |
|
| 521 | + for ($p = 0; $p <= 6; $p++) { |
|
| 522 | 522 | $xOrigin = $xOrigin + ($rpq[$p][$q] * ((pow($dlat, $p)) * (pow($dlon, $q)))); |
| 523 | 523 | $yOrigin = $yOrigin + ($spq[$p][$q] * ((pow($dlat, $p)) * (pow($dlon, $q)))); |
| 524 | 524 | } |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $xOrigin = $xOrigin + $rdx_base; |
| 527 | 527 | $yOrigin = $yOrigin + $rdy_base; |
| 528 | 528 | |
| 529 | - return 'X ' . floor($xOrigin) . ' Y ' . floor($yOrigin); |
|
| 529 | + return 'X '.floor($xOrigin).' Y '.floor($yOrigin); |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | // returns string |
@@ -586,13 +586,13 @@ discard block |
||
| 586 | 586 | |
| 587 | 587 | public static function parseRequestLat($name) |
| 588 | 588 | { |
| 589 | - if (!isset($_REQUEST[$name . 'NS']) || !isset($_REQUEST[$name . 'Lat']) || !isset($_REQUEST[$name . 'LatMin'])) { |
|
| 589 | + if (!isset($_REQUEST[$name.'NS']) || !isset($_REQUEST[$name.'Lat']) || !isset($_REQUEST[$name.'LatMin'])) { |
|
| 590 | 590 | return false; |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | - $coordNS = $_REQUEST[$name . 'NS']; |
|
| 594 | - $coordLat = $_REQUEST[$name . 'Lat'] + 0; |
|
| 595 | - $coordLatMin = str_replace(',', '.', $_REQUEST[$name . 'LatMin']) + 0; |
|
| 593 | + $coordNS = $_REQUEST[$name.'NS']; |
|
| 594 | + $coordLat = $_REQUEST[$name.'Lat'] + 0; |
|
| 595 | + $coordLatMin = str_replace(',', '.', $_REQUEST[$name.'LatMin']) + 0; |
|
| 596 | 596 | |
| 597 | 597 | $lat = $coordLat + $coordLatMin / 60; |
| 598 | 598 | if ($coordNS == 'S') { |
@@ -604,13 +604,13 @@ discard block |
||
| 604 | 604 | |
| 605 | 605 | public static function parseRequestLon($name) |
| 606 | 606 | { |
| 607 | - if (!isset($_REQUEST[$name . 'EW']) || !isset($_REQUEST[$name . 'Lon']) || !isset($_REQUEST[$name . 'LonMin'])) { |
|
| 607 | + if (!isset($_REQUEST[$name.'EW']) || !isset($_REQUEST[$name.'Lon']) || !isset($_REQUEST[$name.'LonMin'])) { |
|
| 608 | 608 | return false; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - $coordEW = $_REQUEST[$name . 'EW']; |
|
| 612 | - $coordLon = $_REQUEST[$name . 'Lon'] + 0; |
|
| 613 | - $coordLonMin = str_replace(',', '.', $_REQUEST[$name . 'LonMin']) + 0; |
|
| 611 | + $coordEW = $_REQUEST[$name.'EW']; |
|
| 612 | + $coordLon = $_REQUEST[$name.'Lon'] + 0; |
|
| 613 | + $coordLonMin = str_replace(',', '.', $_REQUEST[$name.'LonMin']) + 0; |
|
| 614 | 614 | |
| 615 | 615 | $lon = $coordLon + $coordLonMin / 60; |
| 616 | 616 | if ($coordEW == 'W') { |
@@ -638,8 +638,8 @@ discard block |
||
| 638 | 638 | [ |
| 639 | 639 | 'http' => [ |
| 640 | 640 | 'method' => 'POST', |
| 641 | - 'header' => "Content-Type: application/x-www-form-urlencoded\r\n" . |
|
| 642 | - "Content-Length: " . strlen($params_str) . "\r\n", |
|
| 641 | + 'header' => "Content-Type: application/x-www-form-urlencoded\r\n". |
|
| 642 | + "Content-Length: ".strlen($params_str)."\r\n", |
|
| 643 | 643 | 'content' => $params_str, |
| 644 | 644 | ], |
| 645 | 645 | ] |
@@ -50,6 +50,11 @@ |
||
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | + /** |
|
| 54 | + * @param integer $parShortText |
|
| 55 | + * |
|
| 56 | + * @return string |
|
| 57 | + */ |
|
| 53 | 58 | public static function Bearing2Text($parBearing, $parShortText, $language) |
| 54 | 59 | { |
| 55 | 60 | global $opt, $translate; |
@@ -179,12 +179,12 @@ |
||
| 179 | 179 | $b1_rad = (90 - $latFrom) * 3.14159 / 180; |
| 180 | 180 | $l1_deg = $lonFrom; |
| 181 | 181 | |
| 182 | - $lonField = '`' . sql_escape_backtick($tableName) . '`.`' . sql_escape_backtick($lonField) . '`'; |
|
| 183 | - $latField = '`' . sql_escape_backtick($tableName) . '`.`' . sql_escape_backtick($latField) . '`'; |
|
| 182 | + $lonField = '`'.sql_escape_backtick($tableName).'`.`'.sql_escape_backtick($lonField).'`'; |
|
| 183 | + $latField = '`'.sql_escape_backtick($tableName).'`.`'.sql_escape_backtick($latField).'`'; |
|
| 184 | 184 | |
| 185 | 185 | $r = 6370 * $distanceMultiplier; |
| 186 | 186 | |
| 187 | - $retval = 'acos(cos(' . $b1_rad . ') * cos((90-' . $latField . ') * 3.14159 / 180) + sin(' . $b1_rad . ') * sin((90-' . $latField . ') * 3.14159 / 180) * cos((' . $l1_deg . '-' . $lonField . ') * 3.14159 / 180)) * ' . $r; |
|
| 187 | + $retval = 'acos(cos('.$b1_rad.') * cos((90-'.$latField.') * 3.14159 / 180) + sin('.$b1_rad.') * sin((90-'.$latField.') * 3.14159 / 180) * cos(('.$l1_deg.'-'.$lonField.') * 3.14159 / 180)) * '.$r; |
|
| 188 | 188 | |
| 189 | 189 | return $retval; |
| 190 | 190 | } |
@@ -135,6 +135,11 @@ discard block |
||
| 135 | 135 | fclose($fp); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | + /** |
|
| 139 | + * @param string $sResp |
|
| 140 | + * |
|
| 141 | + * @return string |
|
| 142 | + */ |
|
| 138 | 143 | public function extract_return_code($sResp) |
| 139 | 144 | { |
| 140 | 145 | $nPos1 = strpos($sResp, ' '); |
@@ -157,6 +162,9 @@ discard block |
||
| 157 | 162 | return substr($sResp, 0, $nPos); |
| 158 | 163 | } |
| 159 | 164 | |
| 165 | + /** |
|
| 166 | + * @param string $out |
|
| 167 | + */ |
|
| 160 | 168 | public function send_command($fp, $out) |
| 161 | 169 | { |
| 162 | 170 | fwrite($fp, $out . "\r\n"); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public $sFrom = '[email protected]'; |
| 23 | 23 | |
| 24 | 24 | public $nConnectTimeout = 15; // (sec) |
| 25 | - public $nReadTimeout = 25; // (sec) |
|
| 25 | + public $nReadTimeout = 25; // (sec) |
|
| 26 | 26 | |
| 27 | 27 | /* check if the mailserver of $sAddress |
| 28 | 28 | * explicit says that the user does not exist |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | // sort MX records |
| 52 | 52 | $mxs = []; |
| 53 | - for ($i = 0; $i < count($mx_records); $i ++) { |
|
| 53 | + for ($i = 0; $i < count($mx_records); $i++) { |
|
| 54 | 54 | $mxs[$i] = [ |
| 55 | 55 | 'mx' => $mx_records[$i], |
| 56 | 56 | 'prio' => $mx_weight[$i] |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | reset($mxs); |
| 61 | 61 | |
| 62 | 62 | // check address with each MX until one mailserver can be connected |
| 63 | - for ($i = 0; $i < count($mxs); $i ++) { |
|
| 63 | + for ($i = 0; $i < count($mxs); $i++) { |
|
| 64 | 64 | $retval = $this->pCheckAddress($sAddress, $mxs[$i]['mx']); |
| 65 | 65 | if ($retval != CA_ERROR_CONNECT) { |
| 66 | 66 | return $retval; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | return CA_ERROR_CONNECT; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $sResp = $this->send_command($fp, "HELO " . $this->sHostname); |
|
| 95 | + $sResp = $this->send_command($fp, "HELO ".$this->sHostname); |
|
| 96 | 96 | $sCode = $this->extract_return_code($sResp); |
| 97 | 97 | if ($sCode != '220') { |
| 98 | 98 | $this->close($fp); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | return CA_ERROR_UNKOWN; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $sResp = $this->send_command($fp, "MAIL FROM: <" . $this->sFrom . ">"); |
|
| 103 | + $sResp = $this->send_command($fp, "MAIL FROM: <".$this->sFrom.">"); |
|
| 104 | 104 | $sCode = $this->extract_return_code($sResp); |
| 105 | 105 | if ($sCode != '250') { |
| 106 | 106 | $this->close($fp); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | return CA_ERROR_UNKOWN; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - $sResp = $this->send_command($fp, "RCPT TO: <" . $sAddress . ">"); |
|
| 111 | + $sResp = $this->send_command($fp, "RCPT TO: <".$sAddress.">"); |
|
| 112 | 112 | $sCode = $this->extract_return_code($sResp); |
| 113 | 113 | if (strlen($sCode) == 3 && substr($sCode, 0, 1) == '4') { |
| 114 | 114 | $this->close($fp); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | public function send_command($fp, $out) |
| 161 | 161 | { |
| 162 | - fwrite($fp, $out . "\r\n"); |
|
| 162 | + fwrite($fp, $out."\r\n"); |
|
| 163 | 163 | |
| 164 | 164 | return $this->get_data($fp); |
| 165 | 165 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $s = ""; |
| 170 | 170 | stream_set_timeout($fp, $this->nReadTimeout); |
| 171 | 171 | |
| 172 | - for ($i = 0; $i < 2; $i ++) { |
|
| 172 | + for ($i = 0; $i < 2; $i++) { |
|
| 173 | 173 | $s .= fgets($fp, 1024); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -183,5 +183,5 @@ discard block |
||
| 183 | 183 | return 0; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - return (($a['prio'] + 0) < ($b['prio'] + 0)) ? - 1 : 1; |
|
| 186 | + return (($a['prio'] + 0) < ($b['prio'] + 0)) ? -1 : 1; |
|
| 187 | 187 | } |
@@ -102,6 +102,9 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | + /** |
|
| 106 | + * @param string $sFilename |
|
| 107 | + */ |
|
| 105 | 108 | public function setFilenames($sFilename) |
| 106 | 109 | { |
| 107 | 110 | global $opt; |
@@ -129,6 +132,9 @@ discard block |
||
| 129 | 132 | return $this->nPictureId; |
| 130 | 133 | } |
| 131 | 134 | |
| 135 | + /** |
|
| 136 | + * @param boolean $bRestoring |
|
| 137 | + */ |
|
| 132 | 138 | private function setArchiveFlag($bRestoring, $original_id = 0) |
| 133 | 139 | { |
| 134 | 140 | global $login; |
@@ -175,11 +181,17 @@ discard block |
||
| 175 | 181 | sql_slave("SET @original_picid=0"); |
| 176 | 182 | } |
| 177 | 183 | |
| 184 | + /** |
|
| 185 | + * @return string |
|
| 186 | + */ |
|
| 178 | 187 | public function getUrl() |
| 179 | 188 | { |
| 180 | 189 | return $this->rePicture->getValue('url'); |
| 181 | 190 | } |
| 182 | 191 | |
| 192 | + /** |
|
| 193 | + * @param string $value |
|
| 194 | + */ |
|
| 183 | 195 | public function setUrl($value) |
| 184 | 196 | { |
| 185 | 197 | return $this->rePicture->setValue('url', $value); |
@@ -224,6 +236,9 @@ discard block |
||
| 224 | 236 | return $this->rePicture->getValue('local') != 0; |
| 225 | 237 | } |
| 226 | 238 | |
| 239 | + /** |
|
| 240 | + * @param integer $value |
|
| 241 | + */ |
|
| 227 | 242 | public function setLocal($value) |
| 228 | 243 | { |
| 229 | 244 | return $this->rePicture->setValue('local', $value ? 1 : 0); |
@@ -292,6 +307,9 @@ discard block |
||
| 292 | 307 | return $opt['logic']['pictures']['thumb_dir'] . $dir1 . '/' . $dir2 . '/' . $filename; |
| 293 | 308 | } |
| 294 | 309 | |
| 310 | + /** |
|
| 311 | + * @return string |
|
| 312 | + */ |
|
| 295 | 313 | public function getLogId() |
| 296 | 314 | { |
| 297 | 315 | if ($this->getObjectType() == OBJECT_CACHELOG) { |
@@ -328,6 +346,9 @@ discard block |
||
| 328 | 346 | return $firstlogs; |
| 329 | 347 | } |
| 330 | 348 | |
| 349 | + /** |
|
| 350 | + * @return string |
|
| 351 | + */ |
|
| 331 | 352 | public function getCacheId() |
| 332 | 353 | { |
| 333 | 354 | if ($this->getObjectType() == OBJECT_CACHELOG) { |
@@ -491,6 +512,9 @@ discard block |
||
| 491 | 512 | return true; |
| 492 | 513 | } |
| 493 | 514 | |
| 515 | + /** |
|
| 516 | + * @param string $filename |
|
| 517 | + */ |
|
| 494 | 518 | private function deleted_filename($filename) |
| 495 | 519 | { |
| 496 | 520 | $fna = mb_split('\\/', $filename); |
@@ -648,6 +672,9 @@ discard block |
||
| 648 | 672 | return move_uploaded_file($tmpFile, $this->getFilename()); |
| 649 | 673 | } |
| 650 | 674 | |
| 675 | + /** |
|
| 676 | + * @param Imagick $image |
|
| 677 | + */ |
|
| 651 | 678 | public function imagick_rotate(&$image) |
| 652 | 679 | { |
| 653 | 680 | $exif = $image->getImageProperties(); |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * add/remove etc. is executed instantly |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | -require_once __DIR__ . '/const.inc.php'; |
|
| 11 | +require_once __DIR__.'/const.inc.php'; |
|
| 12 | 12 | |
| 13 | 13 | class picture |
| 14 | 14 | { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $sExtension = mb_strtolower(substr($sFilename, strrpos($sFilename, '.') + 1)); |
| 97 | 97 | |
| 98 | - if (strpos(';' . $opt['logic']['pictures']['extensions'] . ';', ';' . $sExtension . ';') !== false) { |
|
| 98 | + if (strpos(';'.$opt['logic']['pictures']['extensions'].';', ';'.$sExtension.';') !== false) { |
|
| 99 | 99 | return true; |
| 100 | 100 | } else { |
| 101 | 101 | return false; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $sUUID = $this->getUUID(); |
| 120 | 120 | |
| 121 | - $this->setUrl($opt['logic']['pictures']['url'] . $sUUID . '.' . $sExtension); |
|
| 121 | + $this->setUrl($opt['logic']['pictures']['url'].$sUUID.'.'.$sExtension); |
|
| 122 | 122 | //$this->setThumbUrl($opt['logic']['pictures']['thumb_url'] . substr($sUUID, 0, 1) . '/' . substr($sUUID, 1, 1) . '/' . $sUUID . '.' . $sExtension); |
| 123 | 123 | |
| 124 | 124 | $this->bFilenamesSet = true; |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | $archive = true; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - sql("SET @archive_picop=" . ($archive ? "TRUE" : "FALSE")); |
|
| 162 | - sql_slave("SET @archive_picop=" . ($archive ? "TRUE" : "FALSE")); |
|
| 161 | + sql("SET @archive_picop=".($archive ? "TRUE" : "FALSE")); |
|
| 162 | + sql_slave("SET @archive_picop=".($archive ? "TRUE" : "FALSE")); |
|
| 163 | 163 | |
| 164 | 164 | sql("SET @original_picid='&1'", $original_id); |
| 165 | 165 | sql_slave("SET @original_picid='&1'", $original_id); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $url = $this->getUrl(); |
| 272 | 272 | $fna = mb_split('\\/', $url); |
| 273 | 273 | |
| 274 | - return $opt['logic']['pictures']['dir'] . end($fna); |
|
| 274 | + return $opt['logic']['pictures']['dir'].end($fna); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | public function getThumbFilename() |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $dir1 = mb_strtoupper(mb_substr($filename, 0, 1)); |
| 290 | 290 | $dir2 = mb_strtoupper(mb_substr($filename, 1, 1)); |
| 291 | 291 | |
| 292 | - return $opt['logic']['pictures']['thumb_dir'] . $dir1 . '/' . $dir2 . '/' . $filename; |
|
| 292 | + return $opt['logic']['pictures']['thumb_dir'].$dir1.'/'.$dir2.'/'.$filename; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | public function getLogId() |
@@ -435,9 +435,9 @@ discard block |
||
| 435 | 435 | return false; |
| 436 | 436 | } else { |
| 437 | 437 | // restore picture file |
| 438 | - $this->setUrl($original_url); // set the url, so that we can |
|
| 439 | - $filename = $this->getFilename(); // .. retreive the file path+name |
|
| 440 | - $this->setFilenames($filename); // now set url(s) from the new uuid |
|
| 438 | + $this->setUrl($original_url); // set the url, so that we can |
|
| 439 | + $filename = $this->getFilename(); // .. retreive the file path+name |
|
| 440 | + $this->setFilenames($filename); // now set url(s) from the new uuid |
|
| 441 | 441 | try { |
| 442 | 442 | rename($this->deleted_filename($filename), $this->getFilename()); |
| 443 | 443 | } catch (Exception $e) { |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | $fna[count($fna) - 2] = 'deleted'; |
| 515 | 515 | $dp = ""; |
| 516 | 516 | foreach ($fna as $fp) { |
| 517 | - $dp .= "/" . $fp; |
|
| 517 | + $dp .= "/".$fp; |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | return substr($dp, 1); |
@@ -538,13 +538,13 @@ discard block |
||
| 538 | 538 | public function getPageLink() |
| 539 | 539 | { |
| 540 | 540 | if ($this->getObjectType() == OBJECT_CACHELOG) { |
| 541 | - $pl = 'viewcache.php?cacheid=' . urlencode($this->getCacheId()); |
|
| 541 | + $pl = 'viewcache.php?cacheid='.urlencode($this->getCacheId()); |
|
| 542 | 542 | if (!$this->isVisibleOnCachePage()) { |
| 543 | 543 | $pl .= "&log=A"; |
| 544 | 544 | } |
| 545 | - $pl .= "#log" . urlencode($this->getLogId()); |
|
| 545 | + $pl .= "#log".urlencode($this->getLogId()); |
|
| 546 | 546 | } elseif ($this->getObjectType() == OBJECT_CACHE) { |
| 547 | - $pl = 'editcache.php?cacheid=' . urlencode($this->getCacheId()) . '#pictures'; |
|
| 547 | + $pl = 'editcache.php?cacheid='.urlencode($this->getCacheId()).'#pictures'; |
|
| 548 | 548 | } else { |
| 549 | 549 | $pl = false; |
| 550 | 550 | } |
@@ -46,6 +46,11 @@ discard block |
||
| 46 | 46 | /* sChaneFreq = {always, hourly, daily, weekly, monthly, yearly, never} |
| 47 | 47 | * nPriority = {0.0 to 1.0} |
| 48 | 48 | */ |
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @param string $sFile |
|
| 52 | + * @param integer $dLastMod |
|
| 53 | + */ |
|
| 49 | 54 | public function write($sFile, $dLastMod, $sChangeFreq = false, $nPriority = 0.5) |
| 50 | 55 | { |
| 51 | 56 | if ($sChangeFreq == false) { |
@@ -62,6 +67,9 @@ discard block |
||
| 62 | 67 | $this->writeInternal($sXML); |
| 63 | 68 | } |
| 64 | 69 | |
| 70 | + /** |
|
| 71 | + * @param string $str |
|
| 72 | + */ |
|
| 65 | 73 | public function writeInternal($str) |
| 66 | 74 | { |
| 67 | 75 | global $opt; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | public $sDefaultChangeFreq = 'monthly'; |
| 14 | 14 | public $nMaxFileSize = 9961472; // max file size, 10MB by specification |
| 15 | - public $nMaxUrlCount = 50000; // max number of URLs per file, 50000 by specification |
|
| 15 | + public $nMaxUrlCount = 50000; // max number of URLs per file, 50000 by specification |
|
| 16 | 16 | |
| 17 | 17 | public $sPath = ''; |
| 18 | 18 | public $sDomain = ''; |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | $this->sPath = $sPath; |
| 35 | 35 | $this->sDomain = $sDomain; |
| 36 | 36 | |
| 37 | - $this->oIndexFile = fopen($sPath . 'sitemap.xml', 'w'); |
|
| 37 | + $this->oIndexFile = fopen($sPath.'sitemap.xml', 'w'); |
|
| 38 | 38 | if ($this->oIndexFile === false) { |
| 39 | 39 | return false; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - fwrite($this->oIndexFile, '<?xml version="1.0" encoding="UTF-8"?>' . "\n"); |
|
| 42 | + fwrite($this->oIndexFile, '<?xml version="1.0" encoding="UTF-8"?>'."\n"); |
|
| 43 | 43 | fwrite($this->oIndexFile, '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $sXML = '<url>'; |
| 56 | - $sXML .= '<loc>' . xmlentities($this->sDomain . $sFile) . '</loc>'; |
|
| 57 | - $sXML .= '<lastmod>' . xmlentities(date('c', $dLastMod)) . '</lastmod>'; |
|
| 58 | - $sXML .= '<changefreq>' . xmlentities($sChangeFreq) . '</changefreq>'; |
|
| 59 | - $sXML .= '<priority>' . xmlentities($nPriority) . '</priority>'; |
|
| 56 | + $sXML .= '<loc>'.xmlentities($this->sDomain.$sFile).'</loc>'; |
|
| 57 | + $sXML .= '<lastmod>'.xmlentities(date('c', $dLastMod)).'</lastmod>'; |
|
| 58 | + $sXML .= '<changefreq>'.xmlentities($sChangeFreq).'</changefreq>'; |
|
| 59 | + $sXML .= '<priority>'.xmlentities($nPriority).'</priority>'; |
|
| 60 | 60 | $sXML .= '</url>'; |
| 61 | 61 | |
| 62 | 62 | $this->writeInternal($sXML); |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | // open new XML file? |
| 77 | 77 | if ($this->oSitemapFile === false) { |
| 78 | - $this->nSitemapIndex ++; |
|
| 79 | - $sFilename = 'sitemap-' . $this->nSitemapIndex . '.xml.gz'; |
|
| 80 | - $this->oSitemapFile = gzopen($this->sPath . $sFilename, 'wb'); |
|
| 78 | + $this->nSitemapIndex++; |
|
| 79 | + $sFilename = 'sitemap-'.$this->nSitemapIndex.'.xml.gz'; |
|
| 80 | + $this->oSitemapFile = gzopen($this->sPath.$sFilename, 'wb'); |
|
| 81 | 81 | |
| 82 | - fwrite($this->oIndexFile, '<sitemap><loc>' . xmlentities($this->sDomain . $sFilename) . '</loc><lastmod>' . xmlentities(date('c')) . '</lastmod></sitemap>'); |
|
| 82 | + fwrite($this->oIndexFile, '<sitemap><loc>'.xmlentities($this->sDomain.$sFilename).'</loc><lastmod>'.xmlentities(date('c')).'</lastmod></sitemap>'); |
|
| 83 | 83 | |
| 84 | - gzwrite($this->oSitemapFile, '<?xml version="1.0" encoding="UTF-8"?>' . "\n"); |
|
| 84 | + gzwrite($this->oSitemapFile, '<?xml version="1.0" encoding="UTF-8"?>'."\n"); |
|
| 85 | 85 | gzwrite($this->oSitemapFile, '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); |
| 86 | 86 | // includes end of xml-tag |
| 87 | 87 | $this->nWrittenSize = 108; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | // write string to XML |
| 92 | 92 | gzwrite($this->oSitemapFile, $str); |
| 93 | 93 | $this->nWrittenSize += strlen($str); |
| 94 | - $this->nWrittenCount ++; |
|
| 94 | + $this->nWrittenCount++; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | public function close() |
@@ -143,6 +143,9 @@ discard block |
||
| 143 | 143 | return $this->reUser->getValue('username'); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | + /** |
|
| 147 | + * @param string $value |
|
| 148 | + */ |
|
| 146 | 149 | public function setUsername($value) |
| 147 | 150 | { |
| 148 | 151 | if (!mb_ereg_match(REGEX_USERNAME, $value)) { |
@@ -210,6 +213,9 @@ discard block |
||
| 210 | 213 | return $this->reUser->getValue('first_name'); |
| 211 | 214 | } |
| 212 | 215 | |
| 216 | + /** |
|
| 217 | + * @param string $value |
|
| 218 | + */ |
|
| 213 | 219 | public function setFirstName($value) |
| 214 | 220 | { |
| 215 | 221 | if ($value != '') { |
@@ -226,6 +232,9 @@ discard block |
||
| 226 | 232 | return $this->reUser->getValue('last_name'); |
| 227 | 233 | } |
| 228 | 234 | |
| 235 | + /** |
|
| 236 | + * @param string $value |
|
| 237 | + */ |
|
| 229 | 238 | public function setLastName($value) |
| 230 | 239 | { |
| 231 | 240 | if ($value != '') { |
@@ -275,6 +284,9 @@ discard block |
||
| 275 | 284 | return $this->reUser->getValue('latitude'); |
| 276 | 285 | } |
| 277 | 286 | |
| 287 | + /** |
|
| 288 | + * @param double $value |
|
| 289 | + */ |
|
| 278 | 290 | public function setLatitude($value) |
| 279 | 291 | { |
| 280 | 292 | if (($value + 0) > 90 || ($value + 0) < - 90) { |
@@ -289,6 +301,9 @@ discard block |
||
| 289 | 301 | return $this->reUser->getValue('longitude'); |
| 290 | 302 | } |
| 291 | 303 | |
| 304 | + /** |
|
| 305 | + * @param double $value |
|
| 306 | + */ |
|
| 292 | 307 | public function setLongitude($value) |
| 293 | 308 | { |
| 294 | 309 | if (($value + 0) > 180 || ($value + 0) < - 180) { |
@@ -303,6 +318,9 @@ discard block |
||
| 303 | 318 | return $this->reUser->getValue('notify_radius'); |
| 304 | 319 | } |
| 305 | 320 | |
| 321 | + /** |
|
| 322 | + * @param integer $value |
|
| 323 | + */ |
|
| 306 | 324 | public function setNotifyRadius($value) |
| 307 | 325 | { |
| 308 | 326 | if (($value + 0) < 0 || ($value + 0) > 150) { |
@@ -317,6 +335,9 @@ discard block |
||
| 317 | 335 | return $this->reUser->getValue('notify_oconly') != 0; |
| 318 | 336 | } |
| 319 | 337 | |
| 338 | + /** |
|
| 339 | + * @param boolean $value |
|
| 340 | + */ |
|
| 320 | 341 | public function setNotifyOconly($value) |
| 321 | 342 | { |
| 322 | 343 | return $this->reUser->setValue('notify_oconly', $value ? 1 : 0); |
@@ -397,6 +418,9 @@ discard block |
||
| 397 | 418 | return $this->reUser->getValue('new_pw_code'); |
| 398 | 419 | } |
| 399 | 420 | |
| 421 | + /** |
|
| 422 | + * @param string|null $value |
|
| 423 | + */ |
|
| 400 | 424 | public function setNewPWCode($value) |
| 401 | 425 | { |
| 402 | 426 | return $this->reUser->setValue('new_pw_code', $value); |
@@ -407,6 +431,9 @@ discard block |
||
| 407 | 431 | return $this->reUser->getValue('new_pw_date'); |
| 408 | 432 | } |
| 409 | 433 | |
| 434 | + /** |
|
| 435 | + * @param integer|null $value |
|
| 436 | + */ |
|
| 410 | 437 | public function setNewPWDate($value) |
| 411 | 438 | { |
| 412 | 439 | return $this->reUser->setValue('new_pw_date', $value); |
@@ -417,6 +444,9 @@ discard block |
||
| 417 | 444 | return $this->reUser->getValue('new_email_code'); |
| 418 | 445 | } |
| 419 | 446 | |
| 447 | + /** |
|
| 448 | + * @param string|null $value |
|
| 449 | + */ |
|
| 420 | 450 | public function setNewEMailCode($value) |
| 421 | 451 | { |
| 422 | 452 | return $this->reUser->setValue('new_email_code', $value); |
@@ -427,6 +457,9 @@ discard block |
||
| 427 | 457 | return $this->reUser->getValue('new_email_date'); |
| 428 | 458 | } |
| 429 | 459 | |
| 460 | + /** |
|
| 461 | + * @param integer|null $value |
|
| 462 | + */ |
|
| 430 | 463 | public function setNewEMailDate($value) |
| 431 | 464 | { |
| 432 | 465 | return $this->reUser->setValue('new_email_date', $value); |
@@ -493,6 +526,9 @@ discard block |
||
| 493 | 526 | return $this->reUser->getValue('watchmail_nextmail'); |
| 494 | 527 | } |
| 495 | 528 | |
| 529 | + /** |
|
| 530 | + * @param string $value |
|
| 531 | + */ |
|
| 496 | 532 | public function setWatchmailNext($value) |
| 497 | 533 | { |
| 498 | 534 | return $this->reUser->setValue('watchmail_nextmail', $value); |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | * add/remove etc. is executed instantly |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | -require_once __DIR__ . '/cracklib.inc.php'; |
|
| 12 | -require_once __DIR__ . '/../translate.class.php'; |
|
| 11 | +require_once __DIR__.'/cracklib.inc.php'; |
|
| 12 | +require_once __DIR__.'/../translate.class.php'; |
|
| 13 | 13 | |
| 14 | 14 | class user |
| 15 | 15 | { |
@@ -760,8 +760,8 @@ discard block |
||
| 760 | 760 | $mail->to = $this->getEMail(); |
| 761 | 761 | $mail->subject = $translate->t('Registration confirmation', '', basename(__FILE__), __LINE__); |
| 762 | 762 | $mail->assign('domain', $opt['page']['domain']); |
| 763 | - $mail->assign('activation_page', $opt['page']['absolute_url'] . 'activation.php'); |
|
| 764 | - $mail->assign('short_activation_page', $opt['page']['absolute_url'] . 'a.php'); |
|
| 763 | + $mail->assign('activation_page', $opt['page']['absolute_url'].'activation.php'); |
|
| 764 | + $mail->assign('short_activation_page', $opt['page']['absolute_url'].'a.php'); |
|
| 765 | 765 | $mail->assign('username', $this->getUsername()); |
| 766 | 766 | $mail->assign('userid', $this->getUserId()); |
| 767 | 767 | $mail->assign('last_name', $this->getLastName()); |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | $mail->returnPath = $fromUser->getEMail(); |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - $mail->subject = $translate->t('E-Mail from', '', basename(__FILE__), __LINE__, '', 1, $language) . ' ' . $fromUser->getUsername() . ': ' . $sSubject; |
|
| 837 | + $mail->subject = $translate->t('E-Mail from', '', basename(__FILE__), __LINE__, '', 1, $language).' '.$fromUser->getUsername().': '.$sSubject; |
|
| 838 | 838 | $mail->assign('usersubject', $sSubject); |
| 839 | 839 | $mail->assign('text', $sText); |
| 840 | 840 | $mail->assign('username', $this->getUsername()); |
@@ -906,7 +906,7 @@ discard block |
||
| 906 | 906 | $login->userid, |
| 907 | 907 | $this->nUserId, |
| 908 | 908 | 0, |
| 909 | - 'User ' . sql_escape($this->getUsername()) . ' disabled', |
|
| 909 | + 'User '.sql_escape($this->getUsername()).' disabled', |
|
| 910 | 910 | serialize($backup) |
| 911 | 911 | ); |
| 912 | 912 | |
@@ -1026,9 +1026,9 @@ discard block |
||
| 1026 | 1026 | if ($num_caches > 0) { |
| 1027 | 1027 | $cache_descs = array(); |
| 1028 | 1028 | $rs = sql( |
| 1029 | - "SELECT `id`, `language`, `desc`, `hint` " . |
|
| 1030 | - "FROM `cache_desc`,`caches` " . |
|
| 1031 | - "WHERE `caches`.`cache_id`=`cache_desc`.`cache_id` " . |
|
| 1029 | + "SELECT `id`, `language`, `desc`, `hint` ". |
|
| 1030 | + "FROM `cache_desc`,`caches` ". |
|
| 1031 | + "WHERE `caches`.`cache_id`=`cache_desc`.`cache_id` ". |
|
| 1032 | 1032 | "AND `caches`.`user_id`='&1'", |
| 1033 | 1033 | $this->getUserId() |
| 1034 | 1034 | ); |
@@ -1073,10 +1073,10 @@ discard block |
||
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | sql( |
| 1076 | - "UPDATE `cache_desc` " . |
|
| 1077 | - "SET `desc`='&1',`hint`='&2' " . |
|
| 1076 | + "UPDATE `cache_desc` ". |
|
| 1077 | + "SET `desc`='&1',`hint`='&2' ". |
|
| 1078 | 1078 | "WHERE `id`='&3'", |
| 1079 | - "<em>" . $descmsg . "</em>", |
|
| 1079 | + "<em>".$descmsg."</em>", |
|
| 1080 | 1080 | '', |
| 1081 | 1081 | $desc['id'] |
| 1082 | 1082 | ); |
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | global $opt; |
| 1176 | 1176 | |
| 1177 | 1177 | // load bmp-support |
| 1178 | - require_once $opt['rootpath'] . 'lib2/imagebmp.inc.php'; |
|
| 1178 | + require_once $opt['rootpath'].'lib2/imagebmp.inc.php'; |
|
| 1179 | 1179 | |
| 1180 | 1180 | // paths cleared by trailing '/' |
| 1181 | 1181 | if (substr($opt['logic']['pictures']['dir'], - 1) != '/') { |
@@ -1221,18 +1221,18 @@ discard block |
||
| 1221 | 1221 | */ |
| 1222 | 1222 | if ($object_type == OBJECT_CACHE) {// get filenames of the pictures of $this' caches |
| 1223 | 1223 | $rs = sql( |
| 1224 | - "SELECT `pictures`.`url` " . |
|
| 1225 | - "FROM `pictures`,`caches` " . |
|
| 1226 | - "WHERE `caches`.`cache_id`=`pictures`.`object_id`" . |
|
| 1224 | + "SELECT `pictures`.`url` ". |
|
| 1225 | + "FROM `pictures`,`caches` ". |
|
| 1226 | + "WHERE `caches`.`cache_id`=`pictures`.`object_id`". |
|
| 1227 | 1227 | " AND `pictures`.`object_type`='&1' AND `caches`.`user_id`='&2'", |
| 1228 | 1228 | OBJECT_CACHE, |
| 1229 | 1229 | $this->getUserId() |
| 1230 | 1230 | ); |
| 1231 | 1231 | } elseif ($object_type == OBJECT_CACHELOG) {// get filenames of the pictures of $this' logs |
| 1232 | 1232 | $rs = sql( |
| 1233 | - "SELECT `pictures`.`url` " . |
|
| 1234 | - "FROM `pictures`,`cache_logs` " . |
|
| 1235 | - "WHERE `cache_logs`.`id`=`pictures`.`object_id`" . |
|
| 1233 | + "SELECT `pictures`.`url` ". |
|
| 1234 | + "FROM `pictures`,`cache_logs` ". |
|
| 1235 | + "WHERE `cache_logs`.`id`=`pictures`.`object_id`". |
|
| 1236 | 1236 | " AND `pictures`.`object_type`='&1' AND `cache_logs`.`user_id`='&2'", |
| 1237 | 1237 | OBJECT_CACHELOG, |
| 1238 | 1238 | $this->getUserId() |
@@ -1284,7 +1284,7 @@ discard block |
||
| 1284 | 1284 | |
| 1285 | 1285 | // check for replacement-image |
| 1286 | 1286 | if ($pdummy && isset($opt['logic']['pictures']['dummy']['replacepic']) |
| 1287 | - && $opt['logic']['pictures']['dummy']['replacepic'] != $opt['rootpath'] . 'images/' |
|
| 1287 | + && $opt['logic']['pictures']['dummy']['replacepic'] != $opt['rootpath'].'images/' |
|
| 1288 | 1288 | && file_exists($opt['logic']['pictures']['dummy']['replacepic']) |
| 1289 | 1289 | ) { |
| 1290 | 1290 | |
@@ -1460,7 +1460,7 @@ discard block |
||
| 1460 | 1460 | $login->userid, |
| 1461 | 1461 | $this->nUserId, |
| 1462 | 1462 | 0, |
| 1463 | - 'User ' . sql_escape($this->getUsername()) . ' deleted', |
|
| 1463 | + 'User '.sql_escape($this->getUsername()).' deleted', |
|
| 1464 | 1464 | serialize($backup) |
| 1465 | 1465 | ); |
| 1466 | 1466 | |
@@ -1219,7 +1219,8 @@ discard block |
||
| 1219 | 1219 | /* |
| 1220 | 1220 | * check log or cache |
| 1221 | 1221 | */ |
| 1222 | - if ($object_type == OBJECT_CACHE) {// get filenames of the pictures of $this' caches |
|
| 1222 | + if ($object_type == OBJECT_CACHE) { |
|
| 1223 | +// get filenames of the pictures of $this' caches |
|
| 1223 | 1224 | $rs = sql( |
| 1224 | 1225 | "SELECT `pictures`.`url` " . |
| 1225 | 1226 | "FROM `pictures`,`caches` " . |
@@ -1228,7 +1229,8 @@ discard block |
||
| 1228 | 1229 | OBJECT_CACHE, |
| 1229 | 1230 | $this->getUserId() |
| 1230 | 1231 | ); |
| 1231 | - } elseif ($object_type == OBJECT_CACHELOG) {// get filenames of the pictures of $this' logs |
|
| 1232 | + } elseif ($object_type == OBJECT_CACHELOG) { |
|
| 1233 | +// get filenames of the pictures of $this' logs |
|
| 1232 | 1234 | $rs = sql( |
| 1233 | 1235 | "SELECT `pictures`.`url` " . |
| 1234 | 1236 | "FROM `pictures`,`cache_logs` " . |
@@ -130,6 +130,9 @@ discard block |
||
| 130 | 130 | return mb_send_mail($this->to, $opt['mail']['subject'] . $this->subject, $body, $mailheaders); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | + /** |
|
| 134 | + * @param string $domain |
|
| 135 | + */ |
|
| 133 | 136 | public static function is_existent_maildomain($domain) |
| 134 | 137 | { |
| 135 | 138 | if ($domain == "localhost") { |
@@ -154,6 +157,9 @@ discard block |
||
| 154 | 157 | return false; |
| 155 | 158 | } |
| 156 | 159 | |
| 160 | + /** |
|
| 161 | + * @param string $mail |
|
| 162 | + */ |
|
| 157 | 163 | public static function getToMailDomain($mail) |
| 158 | 164 | { |
| 159 | 165 | if ($mail == '') { |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * Unicode Reminder メモ |
| 6 | 6 | ***************************************************************************/ |
| 7 | 7 | |
| 8 | -require_once __DIR__. '/../vendor/autoload.php'; |
|
| 8 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 9 | 9 | |
| 10 | 10 | class mail extends Smarty |
| 11 | 11 | { |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | global $opt; |
| 31 | 31 | |
| 32 | - $this->template_dir = $opt['rootpath'] . 'templates2/mail/'; |
|
| 33 | - $this->compile_dir = $opt['rootpath'] . 'cache2/smarty/compiled/'; |
|
| 32 | + $this->template_dir = $opt['rootpath'].'templates2/mail/'; |
|
| 33 | + $this->compile_dir = $opt['rootpath'].'cache2/smarty/compiled/'; |
|
| 34 | 34 | $this->plugins_dir = [ |
| 35 | 35 | 'plugins', |
| 36 | - __DIR__ . '/../src/Oc/SmartyPlugins' |
|
| 36 | + __DIR__.'/../src/Oc/SmartyPlugins' |
|
| 37 | 37 | ]; |
| 38 | 38 | |
| 39 | 39 | // disable caching ... |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | global $opt; |
| 56 | 56 | |
| 57 | - return 'mail|' . $opt['template']['locale'] . '|' . $this->compile_id; |
|
| 57 | + return 'mail|'.$opt['template']['locale'].'|'.$this->compile_id; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public function assign_rs($name, $rs) |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | global $tpl, $opt; |
| 72 | 72 | |
| 73 | - if (!$this->template_exists($this->name . '.tpl')) { |
|
| 73 | + if (!$this->template_exists($this->name.'.tpl')) { |
|
| 74 | 74 | $tpl->error(ERROR_MAIL_TEMPLATE_NOT_FOUND); |
| 75 | 75 | } |
| 76 | 76 | $this->assign('template', $this->name); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | set_php_locale(); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $body = $this->fetch($this->main_template . '.tpl', '', $this->get_compile_id()); |
|
| 103 | + $body = $this->fetch($this->main_template.'.tpl', '', $this->get_compile_id()); |
|
| 104 | 104 | |
| 105 | 105 | if ($this->recipient_locale != $sender_locale) { |
| 106 | 106 | $opt['template']['locale'] = $sender_locale; |
@@ -115,19 +115,19 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $aAddHeaders = array(); |
| 118 | - $aAddHeaders[] = 'From: "' . $this->from . '" <' . $this->from . '>'; |
|
| 118 | + $aAddHeaders[] = 'From: "'.$this->from.'" <'.$this->from.'>'; |
|
| 119 | 119 | |
| 120 | 120 | if ($this->replyTo !== null) { |
| 121 | - $aAddHeaders[] = 'Reply-To: ' . $this->replyTo; |
|
| 121 | + $aAddHeaders[] = 'Reply-To: '.$this->replyTo; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if ($this->returnPath !== null) { |
| 125 | - $aAddHeaders[] = 'Return-Path: ' . $this->returnPath; |
|
| 125 | + $aAddHeaders[] = 'Return-Path: '.$this->returnPath; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | $mailheaders = implode("\n", array_merge($aAddHeaders, $this->headers)); |
| 129 | 129 | |
| 130 | - return mb_send_mail($this->to, $opt['mail']['subject'] . $this->subject, $body, $mailheaders); |
|
| 130 | + return mb_send_mail($this->to, $opt['mail']['subject'].$this->subject, $body, $mailheaders); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public static function is_existent_maildomain($domain) |
@@ -245,6 +245,9 @@ |
||
| 245 | 245 | return $retval; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | + /** |
|
| 249 | + * @param integer|null $menuid |
|
| 250 | + */ |
|
| 248 | 251 | public function pAppendSubMenu($menuid, $ids, &$items) |
| 249 | 252 | { |
| 250 | 253 | global $menuitem, $login; |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * Unicode Reminder メモ |
| 6 | 6 | ***************************************************************************/ |
| 7 | 7 | |
| 8 | -require_once $opt['rootpath'] . 'lib2/translate.class.php'; |
|
| 8 | +require_once $opt['rootpath'].'lib2/translate.class.php'; |
|
| 9 | 9 | |
| 10 | 10 | define('AUTH_LEVEL_ALL', 0); |
| 11 | 11 | define('AUTH_LEVEL_ADMIN', '2'); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | global $opt, $login, $build_map_towns_menu; |
| 24 | 24 | |
| 25 | - $this->sMenuFilename = $opt['rootpath'] . 'cache2/menu-' . $opt['template']['locale'] . '.inc.php'; |
|
| 25 | + $this->sMenuFilename = $opt['rootpath'].'cache2/menu-'.$opt['template']['locale'].'.inc.php'; |
|
| 26 | 26 | |
| 27 | 27 | if (!file_exists($this->sMenuFilename)) { |
| 28 | 28 | $this->CreateCacheFile(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | // add country-dependent town list for small map |
| 35 | 35 | $country = $login->getUserCountry(); |
| 36 | 36 | if ($opt['map']['towns']['enable'] && |
| 37 | - isset($build_map_towns_menu) && $build_map_towns_menu && // optimization |
|
| 37 | + isset($build_map_towns_menu) && $build_map_towns_menu && // optimization |
|
| 38 | 38 | isset($opt['map']['towns'][$country]['enable']) && $opt['map']['towns'][$country]['enable'] |
| 39 | 39 | ) { |
| 40 | 40 | $rsTowns = sqlf( |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | 'title' => $rTown['name'], |
| 68 | 68 | 'menustring' => $rTown['name'], |
| 69 | 69 | 'authlevel' => 0, |
| 70 | - 'href' => 'map2.php?mode=normalscreen&lat=' . $rTown['coord_lat'] . '&lon=' . $rTown['coord_long'] . '&zoom=' . $zoom, |
|
| 70 | + 'href' => 'map2.php?mode=normalscreen&lat='.$rTown['coord_lat'].'&lon='.$rTown['coord_long'].'&zoom='.$zoom, |
|
| 71 | 71 | 'visible' => 1, |
| 72 | 72 | 'sublevel' => 1, |
| 73 | 73 | 'parent' => MNU_MAP |
| 74 | 74 | ]; |
| 75 | 75 | $menuitem[MNU_MAP]['subitems'][] = $menu_map; |
| 76 | - ++ $menu_map; |
|
| 76 | + ++$menu_map; |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | $f = fopen($this->sMenuFilename, 'w'); |
| 87 | 87 | fwrite($f, "<?php\n"); |
| 88 | - fwrite($f, 'global $menuitem;' . "\n"); |
|
| 88 | + fwrite($f, 'global $menuitem;'."\n"); |
|
| 89 | 89 | fwrite($f, "\n"); |
| 90 | 90 | |
| 91 | 91 | $rsDefines = sqlf("SELECT `id`, `id_string` FROM `sys_menu`"); |
| 92 | 92 | while ($rDefine = sql_fetch_assoc($rsDefines)) { |
| 93 | - fwrite($f, 'if (!defined(\'' . addslashes($rDefine['id_string']) . '\')) define(\'' . addslashes($rDefine['id_string']) . '\', ' . $rDefine['id'] . ");\n"); |
|
| 93 | + fwrite($f, 'if (!defined(\''.addslashes($rDefine['id_string']).'\')) define(\''.addslashes($rDefine['id_string']).'\', '.$rDefine['id'].");\n"); |
|
| 94 | 94 | } |
| 95 | 95 | sql_free_result($rsDefines); |
| 96 | 96 | fwrite($f, "\n"); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $rsSubmenu = sqlf("SELECT `id` FROM `sys_menu` WHERE `parent`=0 ORDER BY `parent` ASC, `position` ASC"); |
| 101 | 101 | while ($rSubmenu = sql_fetch_assoc($rsSubmenu)) { |
| 102 | 102 | $aMenu[MNU_ROOT]['subitems'][$nPos] = $rSubmenu['id']; |
| 103 | - $nPos ++; |
|
| 103 | + $nPos++; |
|
| 104 | 104 | } |
| 105 | 105 | sql_free_result($rsSubmenu); |
| 106 | 106 | fwrite($f, "\n"); |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | ); |
| 138 | 138 | while ($rSubmenu = sql_fetch_assoc($rsSubmenu)) { |
| 139 | 139 | $aMenu[$r['id']]['subitems'][$nPos] = $rSubmenu['id']; |
| 140 | - $nPos ++; |
|
| 140 | + $nPos++; |
|
| 141 | 141 | } |
| 142 | 142 | sql_free_result($rsSubmenu); |
| 143 | 143 | } |
| 144 | 144 | sql_free_result($rs); |
| 145 | 145 | |
| 146 | - fwrite($f, '$menuitem = unserialize("' . str_replace('"', '\\"', serialize($aMenu)) . '");' . "\n"); |
|
| 146 | + fwrite($f, '$menuitem = unserialize("'.str_replace('"', '\\"', serialize($aMenu)).'");'."\n"); |
|
| 147 | 147 | |
| 148 | 148 | fwrite($f, "?>"); |
| 149 | 149 | fclose($f); |
@@ -153,12 +153,12 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | global $opt; |
| 155 | 155 | |
| 156 | - $dir = $opt['rootpath'] . 'cache2/'; |
|
| 156 | + $dir = $opt['rootpath'].'cache2/'; |
|
| 157 | 157 | if ($dh = opendir($dir)) { |
| 158 | 158 | while (($file = readdir($dh)) !== false) { |
| 159 | - if (filetype($dir . $file) == 'file') { |
|
| 159 | + if (filetype($dir.$file) == 'file') { |
|
| 160 | 160 | if (preg_match('/^menu-[a-z]{2,2}.inc.php/', $file)) { |
| 161 | - unlink($dir . $file); |
|
| 161 | + unlink($dir.$file); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -2760,7 +2760,7 @@ discard block |
||
| 2760 | 2760 | * |
| 2761 | 2761 | * @param int $d One digit to encode |
| 2762 | 2762 | * |
| 2763 | - * @return char Encoded digit |
|
| 2763 | + * @return string Encoded digit |
|
| 2764 | 2764 | * @access private |
| 2765 | 2765 | */ |
| 2766 | 2766 | private function _encodeDigit($d) |
@@ -2771,7 +2771,7 @@ discard block |
||
| 2771 | 2771 | /** |
| 2772 | 2772 | * Decode a certain digit. |
| 2773 | 2773 | * |
| 2774 | - * @param char $cp One digit (character) to decode |
|
| 2774 | + * @param string $cp One digit (character) to decode |
|
| 2775 | 2775 | * |
| 2776 | 2776 | * @return int Decoded digit |
| 2777 | 2777 | * @access private |
@@ -2785,7 +2785,7 @@ discard block |
||
| 2785 | 2785 | /** |
| 2786 | 2786 | * Do Nameprep according to RFC3491 and RFC3454. |
| 2787 | 2787 | * |
| 2788 | - * @param array $input Unicode Characters |
|
| 2788 | + * @param string $input Unicode Characters |
|
| 2789 | 2789 | * |
| 2790 | 2790 | * @return string Unicode Characters, Nameprep'd |
| 2791 | 2791 | * @throws Exception |
@@ -2885,7 +2885,7 @@ discard block |
||
| 2885 | 2885 | * |
| 2886 | 2886 | * @param integer $char 32bit UCS4 code point |
| 2887 | 2887 | * |
| 2888 | - * @return array Either Hangul Syllable decomposed or original 32bit |
|
| 2888 | + * @return integer[] Either Hangul Syllable decomposed or original 32bit |
|
| 2889 | 2889 | * value as one value array |
| 2890 | 2890 | * @access private |
| 2891 | 2891 | */ |
@@ -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 | |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | // |
| 24 | 24 | |
| 25 | 25 | // }}} |
| 26 | -require_once __DIR__ . '/IDNA2/Exception.php'; |
|
| 27 | -require_once __DIR__ . '/IDNA2/Exception/Nameprep.php'; |
|
| 26 | +require_once __DIR__.'/IDNA2/Exception.php'; |
|
| 27 | +require_once __DIR__.'/IDNA2/Exception/Nameprep.php'; |
|
| 28 | 28 | // adjusted paths for OC distribution |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -272,16 +272,16 @@ discard block |
||
| 272 | 272 | * @access private |
| 273 | 273 | */ |
| 274 | 274 | private static $_np_prohibit_ranges = array( |
| 275 | - array(0x80, 0x9F ), |
|
| 276 | - array(0x2060, 0x206F ), |
|
| 277 | - array(0x1D173, 0x1D17A ), |
|
| 278 | - array(0xE000, 0xF8FF ), |
|
| 279 | - array(0xF0000, 0xFFFFD ), |
|
| 275 | + array(0x80, 0x9F), |
|
| 276 | + array(0x2060, 0x206F), |
|
| 277 | + array(0x1D173, 0x1D17A), |
|
| 278 | + array(0xE000, 0xF8FF), |
|
| 279 | + array(0xF0000, 0xFFFFD), |
|
| 280 | 280 | array(0x100000, 0x10FFFD), |
| 281 | - array(0xFDD0, 0xFDEF ), |
|
| 282 | - array(0xD800, 0xDFFF ), |
|
| 283 | - array(0x2FF0, 0x2FFB ), |
|
| 284 | - array(0xE0020, 0xE007F ) |
|
| 281 | + array(0xFDD0, 0xFDEF), |
|
| 282 | + array(0xD800, 0xDFFF), |
|
| 283 | + array(0x2FF0, 0x2FFB), |
|
| 284 | + array(0xE0020, 0xE007F) |
|
| 285 | 285 | ); |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -2328,8 +2328,7 @@ 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); |
|
| 2331 | + case 'utf8' : $decoded = $this->_utf8_to_ucs4($decoded); |
|
| 2333 | 2332 | break; |
| 2334 | 2333 | case 'ucs4_string': |
| 2335 | 2334 | $decoded = $this->_ucs4_string_to_ucs4($decoded); |
@@ -2349,7 +2348,7 @@ discard block |
||
| 2349 | 2348 | |
| 2350 | 2349 | foreach ($decoded as $k => $v) { |
| 2351 | 2350 | // Make sure to use just the plain dot |
| 2352 | - switch($v) { |
|
| 2351 | + switch ($v) { |
|
| 2353 | 2352 | case 0x3002: |
| 2354 | 2353 | case 0xFF0E: |
| 2355 | 2354 | case 0xFF61: |
@@ -2370,11 +2369,11 @@ discard block |
||
| 2370 | 2369 | // Skip first char |
| 2371 | 2370 | if ($k) { |
| 2372 | 2371 | $encoded = ''; |
| 2373 | - $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
| 2372 | + $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k) - $last_begin))); |
|
| 2374 | 2373 | if ($encoded) { |
| 2375 | 2374 | $output .= $encoded; |
| 2376 | 2375 | } else { |
| 2377 | - $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
| 2376 | + $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k) - $last_begin))); |
|
| 2378 | 2377 | } |
| 2379 | 2378 | $output .= chr($decoded[$k]); |
| 2380 | 2379 | } |
@@ -2385,11 +2384,11 @@ discard block |
||
| 2385 | 2384 | if ($last_begin) { |
| 2386 | 2385 | $inp_len = sizeof($decoded); |
| 2387 | 2386 | $encoded = ''; |
| 2388 | - $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len)-$last_begin))); |
|
| 2387 | + $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len) - $last_begin))); |
|
| 2389 | 2388 | if ($encoded) { |
| 2390 | 2389 | $output .= $encoded; |
| 2391 | 2390 | } else { |
| 2392 | - $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len)-$last_begin))); |
|
| 2391 | + $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len) - $last_begin))); |
|
| 2393 | 2392 | } |
| 2394 | 2393 | return $output; |
| 2395 | 2394 | } |
@@ -2440,7 +2439,7 @@ discard block |
||
| 2440 | 2439 | $conv = $this->_decode($v); |
| 2441 | 2440 | if ($conv) $arr[$k] = $conv; |
| 2442 | 2441 | } |
| 2443 | - $return = $email_pref . '@' . join('.', $arr); |
|
| 2442 | + $return = $email_pref.'@'.join('.', $arr); |
|
| 2444 | 2443 | } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters) |
| 2445 | 2444 | // No no in strict mode |
| 2446 | 2445 | if ($this->_strict_mode) { |
@@ -2473,8 +2472,7 @@ discard block |
||
| 2473 | 2472 | // The output is UTF-8 by default, other output formats need conversion here |
| 2474 | 2473 | // If one time encoding is given, use this, else the objects property |
| 2475 | 2474 | switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) { |
| 2476 | - case 'utf8': |
|
| 2477 | - return $return; |
|
| 2475 | + case 'utf8' : return $return; |
|
| 2478 | 2476 | break; |
| 2479 | 2477 | case 'ucs4_string': |
| 2480 | 2478 | return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); |
@@ -2507,20 +2505,20 @@ discard block |
||
| 2507 | 2505 | if (!empty($parts_arr['user'])) { |
| 2508 | 2506 | $ret_url .= $parts_arr['user']; |
| 2509 | 2507 | if (!empty($parts_arr['pass'])) { |
| 2510 | - $ret_url .= ':' . $parts_arr['pass']; |
|
| 2508 | + $ret_url .= ':'.$parts_arr['pass']; |
|
| 2511 | 2509 | } |
| 2512 | 2510 | $ret_url .= '@'; |
| 2513 | 2511 | } |
| 2514 | 2512 | $ret_url .= $parts_arr['host']; |
| 2515 | 2513 | if (!empty($parts_arr['port'])) { |
| 2516 | - $ret_url .= ':' . $parts_arr['port']; |
|
| 2514 | + $ret_url .= ':'.$parts_arr['port']; |
|
| 2517 | 2515 | } |
| 2518 | 2516 | $ret_url .= $parts_arr['path']; |
| 2519 | 2517 | if (!empty($parts_arr['query'])) { |
| 2520 | - $ret_url .= '?' . $parts_arr['query']; |
|
| 2518 | + $ret_url .= '?'.$parts_arr['query']; |
|
| 2521 | 2519 | } |
| 2522 | 2520 | if (!empty($parts_arr['fragment'])) { |
| 2523 | - $ret_url .= '#' . $parts_arr['fragment']; |
|
| 2521 | + $ret_url .= '#'.$parts_arr['fragment']; |
|
| 2524 | 2522 | } |
| 2525 | 2523 | return $ret_url; |
| 2526 | 2524 | } |
@@ -2598,7 +2596,7 @@ discard block |
||
| 2598 | 2596 | } |
| 2599 | 2597 | |
| 2600 | 2598 | // Start with the prefix; copy it to output |
| 2601 | - $encoded = $this->_punycode_prefix . $encoded; |
|
| 2599 | + $encoded = $this->_punycode_prefix.$encoded; |
|
| 2602 | 2600 | |
| 2603 | 2601 | // If we have basic code points in output, add an hyphen to the end |
| 2604 | 2602 | if ($codecount) { |
@@ -2629,9 +2627,8 @@ discard block |
||
| 2629 | 2627 | $delta++; |
| 2630 | 2628 | } else if ($decoded[$i] == $cur_code) { |
| 2631 | 2629 | for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) { |
| 2632 | - $t = ($k <= $bias)? |
|
| 2633 | - $this->_tmin : |
|
| 2634 | - (($k >= $bias + $this->_tmax)? $this->_tmax : $k - $bias); |
|
| 2630 | + $t = ($k <= $bias) ? |
|
| 2631 | + $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); |
|
| 2635 | 2632 | |
| 2636 | 2633 | if ($q < $t) { |
| 2637 | 2634 | break; |
@@ -2668,11 +2665,11 @@ discard block |
||
| 2668 | 2665 | private function _decode($encoded) |
| 2669 | 2666 | { |
| 2670 | 2667 | // We do need to find the Punycode prefix |
| 2671 | - if (!preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $encoded)) { |
|
| 2668 | + if (!preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $encoded)) { |
|
| 2672 | 2669 | return false; |
| 2673 | 2670 | } |
| 2674 | 2671 | |
| 2675 | - $encode_test = preg_replace('!^' . preg_quote($this->_punycode_prefix, '!') . '!', '', $encoded); |
|
| 2672 | + $encode_test = preg_replace('!^'.preg_quote($this->_punycode_prefix, '!').'!', '', $encoded); |
|
| 2676 | 2673 | |
| 2677 | 2674 | // If nothing left after removing the prefix, it is hopeless |
| 2678 | 2675 | if (!$encode_test) { |
@@ -2699,14 +2696,13 @@ discard block |
||
| 2699 | 2696 | $idx = 0; |
| 2700 | 2697 | $char = $this->_initial_n; |
| 2701 | 2698 | |
| 2702 | - for ($enco_idx = ($delim_pos)? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) { |
|
| 2703 | - for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_base) { |
|
| 2699 | + for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) { |
|
| 2700 | + for ($old_idx = $idx, $w = 1, $k = $this->_base; 1; $k += $this->_base) { |
|
| 2704 | 2701 | $digit = $this->_decodeDigit($encoded{$enco_idx++}); |
| 2705 | 2702 | $idx += $digit * $w; |
| 2706 | 2703 | |
| 2707 | 2704 | $t = ($k <= $bias) ? |
| 2708 | - $this->_tmin : |
|
| 2709 | - (($k >= $bias + $this->_tmax)? $this->_tmax : ($k - $bias)); |
|
| 2705 | + $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); |
|
| 2710 | 2706 | |
| 2711 | 2707 | if ($digit < $t) { |
| 2712 | 2708 | break; |
@@ -2717,7 +2713,7 @@ discard block |
||
| 2717 | 2713 | |
| 2718 | 2714 | $bias = $this->_adapt($idx - $old_idx, $deco_len + 1, $is_first); |
| 2719 | 2715 | $is_first = false; |
| 2720 | - $char += (int) ($idx / ($deco_len + 1)); |
|
| 2716 | + $char += (int)($idx / ($deco_len + 1)); |
|
| 2721 | 2717 | $idx %= ($deco_len + 1); |
| 2722 | 2718 | |
| 2723 | 2719 | if ($deco_len > 0) { |
@@ -2745,14 +2741,14 @@ discard block |
||
| 2745 | 2741 | */ |
| 2746 | 2742 | private function _adapt($delta, $npoints, $is_first) |
| 2747 | 2743 | { |
| 2748 | - $delta = (int) ($is_first ? ($delta / $this->_damp) : ($delta / 2)); |
|
| 2749 | - $delta += (int) ($delta / $npoints); |
|
| 2744 | + $delta = (int)($is_first ? ($delta / $this->_damp) : ($delta / 2)); |
|
| 2745 | + $delta += (int)($delta / $npoints); |
|
| 2750 | 2746 | |
| 2751 | 2747 | for ($k = 0; $delta > (($this->_base - $this->_tmin) * $this->_tmax) / 2; $k += $this->_base) { |
| 2752 | - $delta = (int) ($delta / ($this->_base - $this->_tmin)); |
|
| 2748 | + $delta = (int)($delta / ($this->_base - $this->_tmin)); |
|
| 2753 | 2749 | } |
| 2754 | 2750 | |
| 2755 | - return (int) ($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew)); |
|
| 2751 | + return (int)($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew)); |
|
| 2756 | 2752 | } |
| 2757 | 2753 | |
| 2758 | 2754 | /** |
@@ -2779,7 +2775,7 @@ discard block |
||
| 2779 | 2775 | private function _decodeDigit($cp) |
| 2780 | 2776 | { |
| 2781 | 2777 | $cp = ord($cp); |
| 2782 | - return ($cp - 48 < 10)? $cp - 22 : (($cp - 65 < 26)? $cp - 65 : (($cp - 97 < 26)? $cp - 97 : $this->_base)); |
|
| 2778 | + return ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $this->_base)); |
|
| 2783 | 2779 | } |
| 2784 | 2780 | |
| 2785 | 2781 | /** |
@@ -2807,12 +2803,12 @@ discard block |
||
| 2807 | 2803 | |
| 2808 | 2804 | // Try to find prohibited input |
| 2809 | 2805 | if (in_array($v, self::$_np_prohibit) || in_array($v, self::$_general_prohibited)) { |
| 2810 | - throw new Net_IDNA2_Exception_Nameprep('Prohibited input U+' . sprintf('%08X', $v)); |
|
| 2806 | + throw new Net_IDNA2_Exception_Nameprep('Prohibited input U+'.sprintf('%08X', $v)); |
|
| 2811 | 2807 | } |
| 2812 | 2808 | |
| 2813 | 2809 | foreach (self::$_np_prohibit_ranges as $range) { |
| 2814 | 2810 | if ($range[0] <= $v && $v <= $range[1]) { |
| 2815 | - throw new Net_IDNA2_Exception_Nameprep('Prohibited input U+' . sprintf('%08X', $v)); |
|
| 2811 | + throw new Net_IDNA2_Exception_Nameprep('Prohibited input U+'.sprintf('%08X', $v)); |
|
| 2816 | 2812 | } |
| 2817 | 2813 | } |
| 2818 | 2814 | |
@@ -2862,7 +2858,7 @@ discard block |
||
| 2862 | 2858 | // Rewind the for loop by one, since there can be more possible compositions |
| 2863 | 2859 | $i--; |
| 2864 | 2860 | $out_len--; |
| 2865 | - $last_class = ($i == $last_starter)? 0 : $this->_getCombiningClass($output[$i - 1]); |
|
| 2861 | + $last_class = ($i == $last_starter) ? 0 : $this->_getCombiningClass($output[$i - 1]); |
|
| 2866 | 2862 | |
| 2867 | 2863 | continue; |
| 2868 | 2864 | } |
@@ -2899,7 +2895,7 @@ discard block |
||
| 2899 | 2895 | |
| 2900 | 2896 | $result = array(); |
| 2901 | 2897 | $T = $this->_tbase + $sindex % $this->_tcount; |
| 2902 | - $result[] = (int)($this->_lbase + $sindex / $this->_ncount); |
|
| 2898 | + $result[] = (int)($this->_lbase + $sindex / $this->_ncount); |
|
| 2903 | 2899 | $result[] = (int)($this->_vbase + ($sindex % $this->_ncount) / $this->_tcount); |
| 2904 | 2900 | |
| 2905 | 2901 | if ($T != $this->_tbase) { |
@@ -2985,7 +2981,7 @@ discard block |
||
| 2985 | 2981 | */ |
| 2986 | 2982 | private function _getCombiningClass($char) |
| 2987 | 2983 | { |
| 2988 | - return isset(self::$_np_norm_combcls[$char])? self::$_np_norm_combcls[$char] : 0; |
|
| 2984 | + return isset(self::$_np_norm_combcls[$char]) ? self::$_np_norm_combcls[$char] : 0; |
|
| 2989 | 2985 | } |
| 2990 | 2986 | |
| 2991 | 2987 | /** |
@@ -3146,7 +3142,7 @@ discard block |
||
| 3146 | 3142 | throw new UnexpectedValueException('This might be UTF-8, but I don\'t understand it at byte '.$k); |
| 3147 | 3143 | } |
| 3148 | 3144 | if ('add' == $mode) { |
| 3149 | - $output[$out_len] = (int) $v; |
|
| 3145 | + $output[$out_len] = (int)$v; |
|
| 3150 | 3146 | ++$out_len; |
| 3151 | 3147 | continue; |
| 3152 | 3148 | } |
@@ -3205,14 +3201,14 @@ discard block |
||
| 3205 | 3201 | // 4 bytes |
| 3206 | 3202 | $output .= chr(240 + ($v >> 18)) |
| 3207 | 3203 | . chr(128 + (($v >> 12) & 63)) |
| 3208 | - . chr(128 + (($v >> 6) & 63)) |
|
| 3204 | + . chr(128 + (($v >> 6) & 63)) |
|
| 3209 | 3205 | . chr(128 + ($v & 63)); |
| 3210 | 3206 | } else if ($v < 1 << 26) { |
| 3211 | 3207 | // 5 bytes |
| 3212 | 3208 | $output .= chr(248 + ($v >> 24)) |
| 3213 | 3209 | . chr(128 + (($v >> 18) & 63)) |
| 3214 | 3210 | . chr(128 + (($v >> 12) & 63)) |
| 3215 | - . chr(128 + (($v >> 6) & 63)) |
|
| 3211 | + . chr(128 + (($v >> 6) & 63)) |
|
| 3216 | 3212 | . chr(128 + ($v & 63)); |
| 3217 | 3213 | } else if ($v < 1 << 31) { |
| 3218 | 3214 | // 6 bytes |
@@ -3220,7 +3216,7 @@ discard block |
||
| 3220 | 3216 | . chr(128 + (($v >> 24) & 63)) |
| 3221 | 3217 | . chr(128 + (($v >> 18) & 63)) |
| 3222 | 3218 | . chr(128 + (($v >> 12) & 63)) |
| 3223 | - . chr(128 + (($v >> 6) & 63)) |
|
| 3219 | + . chr(128 + (($v >> 6) & 63)) |
|
| 3224 | 3220 | . chr(128 + ($v & 63)); |
| 3225 | 3221 | } else { |
| 3226 | 3222 | throw new UnexpectedValueException('Conversion from UCS-4 to UTF-8 failed: malformed input'); |
@@ -3245,7 +3241,7 @@ discard block |
||
| 3245 | 3241 | // Take array values and split output to 4 bytes per value |
| 3246 | 3242 | // The bit mask is 255, which reads &11111111 |
| 3247 | 3243 | foreach ($input as $v) { |
| 3248 | - $output .= ($v & (255 << 24) >> 24) . ($v & (255 << 16) >> 16) . ($v & (255 << 8) >> 8) . ($v & 255); |
|
| 3244 | + $output .= ($v & (255 << 24) >> 24).($v & (255 << 16) >> 16).($v & (255 << 8) >> 8).($v & 255); |
|
| 3249 | 3245 | } |
| 3250 | 3246 | return $output; |
| 3251 | 3247 | } |
@@ -3280,7 +3276,7 @@ discard block |
||
| 3280 | 3276 | $out_len++; |
| 3281 | 3277 | $output[$out_len] = 0; |
| 3282 | 3278 | } |
| 3283 | - $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); |
|
| 3279 | + $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4))); |
|
| 3284 | 3280 | } |
| 3285 | 3281 | return $output; |
| 3286 | 3282 | } |
@@ -3331,7 +3327,7 @@ discard block |
||
| 3331 | 3327 | $return = ''; |
| 3332 | 3328 | |
| 3333 | 3329 | for ($i = $w; $i > -1; $i--) { |
| 3334 | - $return .= ($octet & (1 << $i))? '1' : '0'; |
|
| 3330 | + $return .= ($octet & (1 << $i)) ? '1' : '0'; |
|
| 3335 | 3331 | } |
| 3336 | 3332 | |
| 3337 | 3333 | return $return; |
@@ -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; |