@@ -793,6 +793,9 @@ discard block |
||
| 793 | 793 | |
| 794 | 794 | // from getid3.lib.php |
| 795 | 795 | |
| 796 | + /** |
|
| 797 | + * @param double $floatnumber |
|
| 798 | + */ |
|
| 796 | 799 | public function trunc($floatnumber) { |
| 797 | 800 | // truncates a floating-point number at the decimal point |
| 798 | 801 | // returns int (if possible, otherwise float) |
@@ -809,6 +812,9 @@ discard block |
||
| 809 | 812 | return $truncatednumber; |
| 810 | 813 | } |
| 811 | 814 | |
| 815 | + /** |
|
| 816 | + * @param string $byteword |
|
| 817 | + */ |
|
| 812 | 818 | public function LittleEndian2Int($byteword) { |
| 813 | 819 | $intvalue = 0; |
| 814 | 820 | $byteword = strrev($byteword); |
@@ -832,11 +838,17 @@ discard block |
||
| 832 | 838 | return $binvalue; |
| 833 | 839 | } |
| 834 | 840 | |
| 841 | + /** |
|
| 842 | + * @param string $rawdata |
|
| 843 | + */ |
|
| 835 | 844 | public function FixedPoint2_30($rawdata) { |
| 836 | 845 | $binarystring = $this->BigEndian2Bin($rawdata); |
| 837 | 846 | return $this->Bin2Dec(substr($binarystring, 0, 2)) + (float) ($this->Bin2Dec(substr($binarystring, 2, 30)) / 1073741824); |
| 838 | 847 | } |
| 839 | 848 | |
| 849 | + /** |
|
| 850 | + * @param string $binstring |
|
| 851 | + */ |
|
| 840 | 852 | public function Bin2Dec($binstring, $signed=false) { |
| 841 | 853 | $signmult = 1; |
| 842 | 854 | if ($signed) { |
@@ -345,6 +345,12 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | // public: |
| 348 | + |
|
| 349 | + /** |
|
| 350 | + * @param string $param |
|
| 351 | + * |
|
| 352 | + * @return integer |
|
| 353 | + */ |
|
| 348 | 354 | public function getParameter($param) { |
| 349 | 355 | //if (property_exists('phpThumb', $param)) { |
| 350 | 356 | return $this->$param; |
@@ -1119,6 +1125,10 @@ discard block |
||
| 1119 | 1125 | |
| 1120 | 1126 | /* True if the provided path points inside one of open_basedirs (or if open_basedirs are disabled) */ |
| 1121 | 1127 | // http://support.silisoftware.com/phpBB3/viewtopic.php?t=961 |
| 1128 | + |
|
| 1129 | + /** |
|
| 1130 | + * @param string $path |
|
| 1131 | + */ |
|
| 1122 | 1132 | public function isInOpenBasedir($path) { |
| 1123 | 1133 | static $open_basedirs = null; |
| 1124 | 1134 | if (null === $open_basedirs) { |
@@ -1136,6 +1146,10 @@ discard block |
||
| 1136 | 1146 | |
| 1137 | 1147 | /* Resolves all symlinks in $path, checking that each continuous part ends in an allowed zone. Returns null, if any component leads outside of allowed zone. */ |
| 1138 | 1148 | // http://support.silisoftware.com/phpBB3/viewtopic.php?t=961 |
| 1149 | + |
|
| 1150 | + /** |
|
| 1151 | + * @return string |
|
| 1152 | + */ |
|
| 1139 | 1153 | public function resolvePath($path, $allowed_dirs) { |
| 1140 | 1154 | $this->DebugMessage('resolvePath: '.$path.' (allowed_dirs: '.print_r($allowed_dirs, true).')', __FILE__, __LINE__); |
| 1141 | 1155 | |
@@ -1393,6 +1407,9 @@ discard block |
||
| 1393 | 1407 | } |
| 1394 | 1408 | |
| 1395 | 1409 | |
| 1410 | + /** |
|
| 1411 | + * @return string |
|
| 1412 | + */ |
|
| 1396 | 1413 | public function ImageMagickCommandlineBase() { |
| 1397 | 1414 | static $commandline = null; |
| 1398 | 1415 | if (null === $commandline) { |
@@ -4130,6 +4147,9 @@ discard block |
||
| 4130 | 4147 | return $this->ErrorImage(implode("\n", $DebugOutput), 700, 500, true); |
| 4131 | 4148 | } |
| 4132 | 4149 | |
| 4150 | + /** |
|
| 4151 | + * @param string $text |
|
| 4152 | + */ |
|
| 4133 | 4153 | public function FatalError($text) { |
| 4134 | 4154 | if (null === $this->fatalerror) { |
| 4135 | 4155 | $this->fatalerror = $text; |
@@ -4137,6 +4157,9 @@ discard block |
||
| 4137 | 4157 | return true; |
| 4138 | 4158 | } |
| 4139 | 4159 | |
| 4160 | + /** |
|
| 4161 | + * @param string $text |
|
| 4162 | + */ |
|
| 4140 | 4163 | public function ErrorImage($text, $width=0, $height=0, $forcedisplay=false) { |
| 4141 | 4164 | $width = ($width ? $width : $this->config_error_image_width); |
| 4142 | 4165 | $height = ($height ? $height : $this->config_error_image_height); |
@@ -4382,6 +4405,9 @@ discard block |
||
| 4382 | 4405 | return true; |
| 4383 | 4406 | } |
| 4384 | 4407 | |
| 4408 | + /** |
|
| 4409 | + * @param string $message |
|
| 4410 | + */ |
|
| 4385 | 4411 | public function DebugTimingMessage($message, $file='', $line='', $timestamp=0) { |
| 4386 | 4412 | if (!$timestamp) { |
| 4387 | 4413 | $timestamp = array_sum(explode(' ', microtime())); |
@@ -18,6 +18,9 @@ discard block |
||
| 18 | 18 | public $phpThumbObject = null; |
| 19 | 19 | |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $message |
|
| 23 | + */ |
|
| 21 | 24 | public function DebugMessage($message, $file='', $line='') { |
| 22 | 25 | if (is_object($this->phpThumbObject)) { |
| 23 | 26 | return $this->phpThumbObject->DebugMessage($message, $file, $line); |
@@ -752,6 +755,9 @@ discard block |
||
| 752 | 755 | } |
| 753 | 756 | |
| 754 | 757 | |
| 758 | + /** |
|
| 759 | + * @param phpthumb $phpThumbObject |
|
| 760 | + */ |
|
| 755 | 761 | public static function ImprovedImageRotate(&$gdimg_source, $rotate_angle=0, $config_background_hexcolor='FFFFFF', $bg=null, &$phpThumbObject) { |
| 756 | 762 | while ($rotate_angle < 0) { |
| 757 | 763 | $rotate_angle += 360; |
@@ -1049,6 +1055,10 @@ discard block |
||
| 1049 | 1055 | } |
| 1050 | 1056 | |
| 1051 | 1057 | |
| 1058 | + /** |
|
| 1059 | + * @param boolean $dither |
|
| 1060 | + * @param integer $ncolors |
|
| 1061 | + */ |
|
| 1052 | 1062 | public function ImageTrueColorToPalette2(&$image, $dither, $ncolors) { |
| 1053 | 1063 | // http://www.php.net/manual/en/function.imagetruecolortopalette.php |
| 1054 | 1064 | // zmorris at zsculpt dot com (17-Aug-2004 06:58) |
@@ -23,6 +23,9 @@ discard block |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
| 26 | + /** |
|
| 27 | + * @param string $functionname |
|
| 28 | + */ |
|
| 26 | 29 | public static function builtin_function_exists($functionname) { |
| 27 | 30 | if (function_exists('get_defined_functions')) { |
| 28 | 31 | static $get_defined_functions = array(); |
@@ -35,6 +38,10 @@ discard block |
||
| 35 | 38 | } |
| 36 | 39 | |
| 37 | 40 | |
| 41 | + /** |
|
| 42 | + * @param string $version1 |
|
| 43 | + * @param string $version2 |
|
| 44 | + */ |
|
| 38 | 45 | public static function version_compare_replacement_sub($version1, $version2, $operator='') { |
| 39 | 46 | // If you specify the third optional operator argument, you can test for a particular relationship. |
| 40 | 47 | // The possible operators are: <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne respectively. |
@@ -95,6 +102,9 @@ discard block |
||
| 95 | 102 | } |
| 96 | 103 | |
| 97 | 104 | |
| 105 | + /** |
|
| 106 | + * @param string $version2 |
|
| 107 | + */ |
|
| 98 | 108 | public static function version_compare_replacement($version1, $version2, $operator='') { |
| 99 | 109 | if (function_exists('version_compare')) { |
| 100 | 110 | // built into PHP v4.1.0+ |
@@ -212,6 +222,9 @@ discard block |
||
| 212 | 222 | return array($newwidth, $newheight); |
| 213 | 223 | } |
| 214 | 224 | |
| 225 | + /** |
|
| 226 | + * @param string $string |
|
| 227 | + */ |
|
| 215 | 228 | public static function HexCharDisplay($string) { |
| 216 | 229 | $len = strlen($string); |
| 217 | 230 | $output = ''; |
@@ -292,6 +305,10 @@ discard block |
||
| 292 | 305 | } |
| 293 | 306 | |
| 294 | 307 | |
| 308 | + /** |
|
| 309 | + * @param integer $width |
|
| 310 | + * @param integer $height |
|
| 311 | + */ |
|
| 295 | 312 | public static function ScaleToFitInBox($width, $height, $maxwidth=null, $maxheight=null, $allow_enlarge=true, $allow_reduce=true) { |
| 296 | 313 | $maxwidth = (null === $maxwidth ? $width : $maxwidth); |
| 297 | 314 | $maxheight = (null === $maxheight ? $height : $maxheight); |
@@ -380,6 +397,12 @@ discard block |
||
| 380 | 397 | } |
| 381 | 398 | |
| 382 | 399 | |
| 400 | + /** |
|
| 401 | + * @param integer $src_x |
|
| 402 | + * @param integer $src_y |
|
| 403 | + * @param integer $src_w |
|
| 404 | + * @param integer $src_h |
|
| 405 | + */ |
|
| 383 | 406 | public static function ImageCopyRespectAlpha(&$dst_im, &$src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $opacity_pct=100) { |
| 384 | 407 | $opacipct = $opacity_pct / 100; |
| 385 | 408 | for ($x = $src_x; $x < $src_w; $x++) { |
@@ -404,6 +427,10 @@ discard block |
||
| 404 | 427 | } |
| 405 | 428 | |
| 406 | 429 | |
| 430 | + /** |
|
| 431 | + * @param integer $old_width |
|
| 432 | + * @param integer $old_height |
|
| 433 | + */ |
|
| 407 | 434 | public static function ProportionalResize($old_width, $old_height, $new_width=false, $new_height=false) { |
| 408 | 435 | $old_aspect_ratio = $old_width / $old_height; |
| 409 | 436 | if (($new_width === false) && ($new_height === false)) { |
@@ -430,6 +457,9 @@ discard block |
||
| 430 | 457 | } |
| 431 | 458 | |
| 432 | 459 | |
| 460 | + /** |
|
| 461 | + * @param string $function |
|
| 462 | + */ |
|
| 433 | 463 | public static function FunctionIsDisabled($function) { |
| 434 | 464 | static $DisabledFunctions = null; |
| 435 | 465 | if (null === $DisabledFunctions) { |
@@ -450,6 +480,11 @@ discard block |
||
| 450 | 480 | } |
| 451 | 481 | |
| 452 | 482 | |
| 483 | + /** |
|
| 484 | + * @param string $command |
|
| 485 | + * |
|
| 486 | + * @return string |
|
| 487 | + */ |
|
| 453 | 488 | public static function SafeExec($command) { |
| 454 | 489 | static $AllowedExecFunctions = array(); |
| 455 | 490 | if (empty($AllowedExecFunctions)) { |
@@ -626,6 +661,10 @@ discard block |
||
| 626 | 661 | return false; |
| 627 | 662 | } |
| 628 | 663 | |
| 664 | + /** |
|
| 665 | + * @param string $needle |
|
| 666 | + * @param string[] $haystack |
|
| 667 | + */ |
|
| 629 | 668 | public static function CaseInsensitiveInArray($needle, $haystack) { |
| 630 | 669 | $needle = strtolower($needle); |
| 631 | 670 | foreach ($haystack as $key => $value) { |
@@ -638,6 +677,9 @@ discard block |
||
| 638 | 677 | return false; |
| 639 | 678 | } |
| 640 | 679 | |
| 680 | + /** |
|
| 681 | + * @param string $file |
|
| 682 | + */ |
|
| 641 | 683 | public static function URLreadFsock($host, $file, &$errstr, $successonly=true, $port=80, $timeout=10) { |
| 642 | 684 | if (!function_exists('fsockopen') || self::FunctionIsDisabled('fsockopen')) { |
| 643 | 685 | $errstr = 'fsockopen() unavailable'; |
@@ -64,6 +64,9 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
| 66 | 66 | |
| 67 | +/** |
|
| 68 | + * @param string $lpszFileName |
|
| 69 | + */ |
|
| 67 | 70 | function gif_outputAsBmp($gif, $lpszFileName, $bgColor = -1) |
| 68 | 71 | { |
| 69 | 72 | if (!isset($gif) || (@get_class($gif) <> 'cgif') || !$gif->loaded() || ($lpszFileName == '')) { |
@@ -186,6 +189,10 @@ discard block |
||
| 186 | 189 | |
| 187 | 190 | /////////////////////////////////////////////////////////////////////////// |
| 188 | 191 | |
| 192 | + /** |
|
| 193 | + * @param string $data |
|
| 194 | + * @param integer $datLen |
|
| 195 | + */ |
|
| 189 | 196 | public function deCompress($data, &$datLen) |
| 190 | 197 | { |
| 191 | 198 | $stLen = strlen($data); |
@@ -210,6 +217,11 @@ discard block |
||
| 210 | 217 | |
| 211 | 218 | /////////////////////////////////////////////////////////////////////////// |
| 212 | 219 | |
| 220 | + /** |
|
| 221 | + * @param boolean $bInit |
|
| 222 | + * |
|
| 223 | + * @return integer |
|
| 224 | + */ |
|
| 213 | 225 | public function LZWCommand(&$data, $bInit) |
| 214 | 226 | { |
| 215 | 227 | if ($bInit) { |
@@ -392,6 +404,10 @@ discard block |
||
| 392 | 404 | |
| 393 | 405 | /////////////////////////////////////////////////////////////////////////// |
| 394 | 406 | |
| 407 | + /** |
|
| 408 | + * @param string $lpData |
|
| 409 | + * @param integer $num |
|
| 410 | + */ |
|
| 395 | 411 | public function load($lpData, $num) |
| 396 | 412 | { |
| 397 | 413 | $this->m_nColors = 0; |
@@ -504,6 +520,9 @@ discard block |
||
| 504 | 520 | |
| 505 | 521 | /////////////////////////////////////////////////////////////////////////// |
| 506 | 522 | |
| 523 | + /** |
|
| 524 | + * @param integer $hdrLen |
|
| 525 | + */ |
|
| 507 | 526 | public function load($lpData, &$hdrLen) |
| 508 | 527 | { |
| 509 | 528 | $hdrLen = 0; |
@@ -541,6 +560,9 @@ discard block |
||
| 541 | 560 | |
| 542 | 561 | /////////////////////////////////////////////////////////////////////////// |
| 543 | 562 | |
| 563 | + /** |
|
| 564 | + * @param string $str |
|
| 565 | + */ |
|
| 544 | 566 | public function w2i($str) |
| 545 | 567 | { |
| 546 | 568 | return ord($str[ 0 ]) + (ord($str[ 1 ]) << 8); |
@@ -579,6 +601,10 @@ discard block |
||
| 579 | 601 | |
| 580 | 602 | /////////////////////////////////////////////////////////////////////////// |
| 581 | 603 | |
| 604 | + /** |
|
| 605 | + * @param string $lpData |
|
| 606 | + * @param integer $hdrLen |
|
| 607 | + */ |
|
| 582 | 608 | public function load($lpData, &$hdrLen) |
| 583 | 609 | { |
| 584 | 610 | $hdrLen = 0; |
@@ -612,6 +638,9 @@ discard block |
||
| 612 | 638 | |
| 613 | 639 | /////////////////////////////////////////////////////////////////////////// |
| 614 | 640 | |
| 641 | + /** |
|
| 642 | + * @param string $str |
|
| 643 | + */ |
|
| 615 | 644 | public function w2i($str) |
| 616 | 645 | { |
| 617 | 646 | return ord($str[ 0 ]) + (ord($str[ 1 ]) << 8); |
@@ -649,6 +678,10 @@ discard block |
||
| 649 | 678 | |
| 650 | 679 | /////////////////////////////////////////////////////////////////////////// |
| 651 | 680 | |
| 681 | + /** |
|
| 682 | + * @param string $data |
|
| 683 | + * @param integer $datLen |
|
| 684 | + */ |
|
| 652 | 685 | public function load($data, &$datLen) |
| 653 | 686 | { |
| 654 | 687 | $datLen = 0; |
@@ -696,6 +729,10 @@ discard block |
||
| 696 | 729 | |
| 697 | 730 | /////////////////////////////////////////////////////////////////////////// |
| 698 | 731 | |
| 732 | + /** |
|
| 733 | + * @param string $data |
|
| 734 | + * @param integer $extLen |
|
| 735 | + */ |
|
| 699 | 736 | public function skipExt(&$data, &$extLen) |
| 700 | 737 | { |
| 701 | 738 | $extLen = 0; |
@@ -741,6 +778,9 @@ discard block |
||
| 741 | 778 | |
| 742 | 779 | /////////////////////////////////////////////////////////////////////////// |
| 743 | 780 | |
| 781 | + /** |
|
| 782 | + * @param string $str |
|
| 783 | + */ |
|
| 744 | 784 | public function w2i($str) |
| 745 | 785 | { |
| 746 | 786 | return ord($str[ 0 ]) + (ord($str[ 1 ]) << 8); |
@@ -814,6 +854,9 @@ discard block |
||
| 814 | 854 | |
| 815 | 855 | /////////////////////////////////////////////////////////////////////////// |
| 816 | 856 | |
| 857 | + /** |
|
| 858 | + * @param integer $iIndex |
|
| 859 | + */ |
|
| 817 | 860 | public function loadFile($lpszFileName, $iIndex) |
| 818 | 861 | { |
| 819 | 862 | if ($iIndex < 0) { |
@@ -967,6 +1010,9 @@ discard block |
||
| 967 | 1010 | |
| 968 | 1011 | /////////////////////////////////////////////////////////////////////////// |
| 969 | 1012 | |
| 1013 | + /** |
|
| 1014 | + * @param integer $bgColor |
|
| 1015 | + */ |
|
| 970 | 1016 | public function getPng($bgColor) |
| 971 | 1017 | { |
| 972 | 1018 | $out = ''; |