[SPIP] v3.2.1-->v3.2.3
[lhc/web/www.git] / www / plugins-dist / medias / lib / getid3 / module.archive.gzip.php
index 112a1e6..5d730be 100644 (file)
@@ -1,11 +1,11 @@
 <?php
+
 /////////////////////////////////////////////////////////////////
 /// getID3() by James Heinrich <info@getid3.org>               //
-//  available at http://getid3.sourceforge.net                 //
-//            or http://www.getid3.org                         //
-//          also https://github.com/JamesHeinrich/getID3       //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details                             //
+//  available at https://github.com/JamesHeinrich/getID3       //
+//            or https://www.getid3.org                        //
+//            or http://getid3.sourceforge.net                 //
+//  see readme.txt for more details                            //
 /////////////////////////////////////////////////////////////////
 //                                                             //
 // module.archive.gzip.php                                     //
 /////////////////////////////////////////////////////////////////
 
 
-class getid3_gzip extends getid3_handler {
-
-       // public: Optional file list - disable for speed.
-       public $option_gzip_parse_contents = false; // decode gzipped files, if possible, and parse recursively (.tar.gz for example)
+class getid3_gzip extends getid3_handler
+{
+       /**
+        * Optional file list - disable for speed.
+        *
+        * Decode gzipped files, if possible, and parse recursively (.tar.gz for example).
+        *
+        * @var bool
+        */
+       public $option_gzip_parse_contents = false;
 
+       /**
+        * @return bool
+        */
        public function Analyze() {
                $info = &$this->getid3->info;
 
@@ -44,6 +53,7 @@ class getid3_gzip extends getid3_handler {
                $buffer = $this->fread($info['filesize']);
 
                $arr_members = explode("\x1F\x8B\x08", $buffer);
+               $num_members = 0;
                while (true) {
                        $is_wrong_members = false;
                        $num_members = intval(count($arr_members));
@@ -199,7 +209,7 @@ class getid3_gzip extends getid3_handler {
                                        $inflated = gzinflate($cdata);
 
                                        // Calculate CRC32 for inflated content
-                                       $thisInfo['crc32_valid'] = (bool) (sprintf('%u', crc32($inflated)) == $thisInfo['crc32']);
+                                       $thisInfo['crc32_valid'] = sprintf('%u', crc32($inflated)) == $thisInfo['crc32'];
 
                                        // determine format
                                        $formattest = substr($inflated, 0, 32774);
@@ -240,13 +250,21 @@ class getid3_gzip extends getid3_handler {
                                                        // unknown or unhandled format
                                                        break;
                                        }
+                               } else {
+                                       $this->warning('PHP is not compiled with gzinflate() support. Please enable PHP Zlib extension or recompile with the --with-zlib switch');
                                }
                        }
                }
                return true;
        }
 
-       // Converts the OS type
+       /**
+        * Converts the OS type.
+        *
+        * @param string $key
+        *
+        * @return string
+        */
        public function get_os_type($key) {
                static $os_type = array(
                        '0'   => 'FAT filesystem (MS-DOS, OS/2, NT/Win32)',
@@ -268,7 +286,13 @@ class getid3_gzip extends getid3_handler {
                return (isset($os_type[$key]) ? $os_type[$key] : '');
        }
 
-       // Converts the eXtra FLags
+       /**
+        * Converts the eXtra FLags.
+        *
+        * @param string $key
+        *
+        * @return string
+        */
        public function get_xflag_type($key) {
                static $xflag_type = array(
                        '0' => 'unknown',