[TASK] Fix CGL violations against DoubleQuoteUsage
authorLudwig Rafelsberger <ludwig.rafelsberger@gmx.at>
Thu, 21 Jun 2012 18:22:07 +0000 (20:22 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Thu, 21 Jun 2012 20:01:54 +0000 (22:01 +0200)
Resolves: #38264

Releases: 6.0

Change-Id: Id0b0e234ecb76c470322739a78945b49b7e4956f
Reviewed-on: http://review.typo3.org/12258
Reviewed-by: Oliver Klee
Tested-by: Steffen Ritter
Reviewed-by: Steffen Ritter
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/em/classes/tools/class.tx_em_tools_unzip.php

index d6a749f..ce700c8 100644 (file)
@@ -121,9 +121,8 @@ class tx_em_Tools_Unzip {
                // Check the zlib
                if (!extension_loaded('zlib')) {
                        throw new RuntimeException(
-                               'TYPO3 Fatal Error: ' . "The extension 'zlib' couldn't be found.\n" .
-                                               "Please make sure your version of PHP was built " .
-                                               "with 'zlib' support.\n",
+                               'TYPO3 Fatal Error: The extension "zlib" could not be found.' . LF .
+                                       'Please make sure your version of PHP was built with zlib support.' . LF,
                                1270853984
                        );
                }
@@ -243,9 +242,9 @@ class tx_em_Tools_Unzip {
         */
        function errorInfo($p_full = FALSE) {
                if ($p_full) {
-                       return ($this->errorName(TRUE) . " : " . $this->_error_string);
+                       return ($this->errorName(TRUE) . ' : ' . $this->_error_string);
                } else {
-                       return ($this->_error_string . " [code " . $this->_error_code . "]");
+                       return ($this->_error_string . ' [code ' . $this->_error_code . ']');
                }
        }
 
@@ -267,7 +266,7 @@ class tx_em_Tools_Unzip {
                if (!is_file($this->_zipname)) {
                        // Error log
                        $this->_errorLog(ARCHIVE_ZIP_ERR_MISSING_FILE,
-                                       "Missing archive file '" . $this->_zipname . "'");
+                                       'Missing archive file \'' . $this->_zipname . '\'');
                        return (FALSE);
                }
 
@@ -275,7 +274,7 @@ class tx_em_Tools_Unzip {
                if (!is_readable($this->_zipname)) {
                        // Error log
                        $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
-                                       "Unable to read archive '" . $this->_zipname . "'");
+                                       'Unable to read archive \'' . $this->_zipname . '\'');
                        return (FALSE);
                }
 
@@ -394,16 +393,16 @@ class tx_em_Tools_Unzip {
                $p_remove_all_path = $p_params['remove_all_path'];
 
                // Check the path
-               if (($p_path == "")
-                               || ((substr($p_path, 0, 1) != "/")
-                                               && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2) != ":/"))) {
-                       $p_path = "./" . $p_path;
+               if (($p_path == '')
+                               || ((substr($p_path, 0, 1) != '/')
+                                               && (substr($p_path, 0, 3) != '../') && (substr($p_path, 1, 2) != ':/'))) {
+                       $p_path = './' . $p_path;
                }
 
                // Reduce the path last (and duplicated) '/'
-               if (($p_path != "./") && ($p_path != "/")) {
+               if (($p_path != './') && ($p_path != '/')) {
                        // Look for the path end '/'
-                       while (substr($p_path, -1) == "/") {
+                       while (substr($p_path, -1) == '/') {
                                $p_path = substr($p_path, 0, strlen($p_path) - 1);
                        }
                }
@@ -519,11 +518,11 @@ class tx_em_Tools_Unzip {
 
                        // Look for path to remove
                else {
-                       if ($p_remove_path != "") {
+                       if ($p_remove_path != '') {
                                if ($this->_tool_PathInclusion($p_remove_path, $p_entry['filename']) == 2) {
 
                                        // Change the file status
-                                       $p_entry['status'] = "filtered";
+                                       $p_entry['status'] = 'filtered';
 
                                        // Return
                                        return $v_result;
@@ -546,7 +545,7 @@ class tx_em_Tools_Unzip {
 
                // Add the path
                if ($p_path != '') {
-                       $p_entry['filename'] = $p_path . "/" . $p_entry['filename'];
+                       $p_entry['filename'] = $p_path . '/' . $p_entry['filename'];
                }
 
                // Look for pre-extract callback
@@ -563,7 +562,7 @@ class tx_em_Tools_Unzip {
                        eval('$v_result = ' . $p_params[ARCHIVE_ZIP_PARAM_PRE_EXTRACT] . '(ARCHIVE_ZIP_PARAM_PRE_EXTRACT, $v_local_header);');
                        if ($v_result == 0) {
                                // Change the file status
-                               $p_entry['status'] = "skipped";
+                               $p_entry['status'] = 'skipped';
                                $v_result = 1;
                        }
 
@@ -582,20 +581,20 @@ class tx_em_Tools_Unzip {
                                // Look if file is a directory
                                if (is_dir($p_entry['filename'])) {
                                        // Change the file status
-                                       $p_entry['status'] = "already_a_directory";
+                                       $p_entry['status'] = 'already_a_directory';
                                }
                                        // Look if file is write protected
                                else {
                                        if (!is_writeable($p_entry['filename'])) {
                                                // Change the file status
-                                               $p_entry['status'] = "write_protected";
+                                               $p_entry['status'] = 'write_protected';
                                        }
 
                                                // Look if the extracted file is older
                                        else {
                                                if (filemtime($p_entry['filename']) > $p_entry['mtime']) {
                                                        // Change the file status
-                                                       $p_entry['status'] = "newer_exist";
+                                                       $p_entry['status'] = 'newer_exist';
                                                }
                                        }
                                }
@@ -607,8 +606,8 @@ class tx_em_Tools_Unzip {
                                        $v_dir_to_check = $p_entry['filename'];
                                }
                                else {
-                                       if (!strstr($p_entry['filename'], "/")) {
-                                               $v_dir_to_check = "";
+                                       if (!strstr($p_entry['filename'], '/')) {
+                                               $v_dir_to_check = '';
                                        }
                                        else
                                        {
@@ -618,7 +617,7 @@ class tx_em_Tools_Unzip {
 
                                if (($v_result = $this->_dirCheck($v_dir_to_check, (($p_entry['external'] & 0x00000010) == 0x00000010))) != 1) {
                                        // Change the file status
-                                       $p_entry['status'] = "path_creation_fail";
+                                       $p_entry['status'] = 'path_creation_fail';
 
                                        // Return
                                        $v_result = 1;
@@ -635,7 +634,7 @@ class tx_em_Tools_Unzip {
                                        // Opening destination file
                                        if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
                                                // Change the file status
-                                               $p_entry['status'] = "write_error";
+                                               $p_entry['status'] = 'write_error';
 
                                                // Return
                                                return $v_result;
@@ -664,7 +663,7 @@ class tx_em_Tools_Unzip {
                                        if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
 
                                                // Change the file status
-                                               $p_entry['status'] = "write_error";
+                                               $p_entry['status'] = 'write_error';
 
                                                return $v_result;
                                        }
@@ -745,11 +744,11 @@ class tx_em_Tools_Unzip {
 
                // Look for invalid block size
                if (strlen($v_binary_data) != 26) {
-                       $p_header['filename'] = "";
-                       $p_header['status'] = "invalid_header";
+                       $p_header['filename'] = '';
+                       $p_header['status'] = 'invalid_header';
 
                        // Error log
-                       $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, "Invalid block size : " . strlen($v_binary_data));
+                       $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data));
 
                        // Return
                        return self::errorCode();
@@ -803,7 +802,7 @@ class tx_em_Tools_Unzip {
                $p_header['stored_filename'] = $p_header['filename'];
 
                // Set the status field
-               $p_header['status'] = "ok";
+               $p_header['status'] = 'ok';
 
                // Return
                return $v_result;
@@ -837,11 +836,11 @@ class tx_em_Tools_Unzip {
 
                // Look for invalid block size
                if (strlen($v_binary_data) != 42) {
-                       $p_header['filename'] = "";
-                       $p_header['status'] = "invalid_header";
+                       $p_header['filename'] = '';
+                       $p_header['status'] = 'invalid_header';
 
                        // Error log
-                       $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, "Invalid block size : " . strlen($v_binary_data));
+                       $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data));
 
                        // Return
                        return self::errorCode();
@@ -994,7 +993,7 @@ class tx_em_Tools_Unzip {
                        // Look if not found end of central dir
                        if ($v_pos == $v_size) {
                                $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
-                                       "Unable to find End of Central Dir Record signature");
+                                       'Unable to find End of Central Dir Record signature');
                                return self::errorCode();
                        }
                }
@@ -1005,7 +1004,7 @@ class tx_em_Tools_Unzip {
                // Look for invalid block size
                if (strlen($v_binary_data) != 18) {
                        $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
-                                       "Invalid End of Central Dir Record size : "
+                                       'Invalid End of Central Dir Record size : '
                                                        . strlen($v_binary_data));
                        return self::errorCode();
                }
@@ -1016,7 +1015,7 @@ class tx_em_Tools_Unzip {
                // Check the global size
                if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
                        $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
-                               "Fail to find the right signature");
+                               'Fail to find the right signature');
                        return self::errorCode();
                }
 
@@ -1056,7 +1055,7 @@ class tx_em_Tools_Unzip {
                }
 
                // Check the directory availability
-               if ((is_dir($p_dir)) || ($p_dir == "")) {
+               if ((is_dir($p_dir)) || ($p_dir == '')) {
                        return 1;
                }
 
@@ -1066,7 +1065,7 @@ class tx_em_Tools_Unzip {
                // Just a check
                if ($p_parent_dir != $p_dir) {
                        // Look for parent directory
-                       if ($p_parent_dir != "") {
+                       if ($p_parent_dir != '') {
                                if (($v_result = $this->_dirCheck($p_parent_dir)) != 1) {
                                        return $v_result;
                                }
@@ -1126,9 +1125,9 @@ class tx_em_Tools_Unzip {
                        if ((isset($p_params[$v_key])) && ($p_params[$v_key] != '')) {
                                if (!function_exists($p_params[$v_key])) {
                                        $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE,
-                                                       "Callback '" . $p_params[$v_key]
-                                                                       . "()' is not an existing function for "
-                                                                       . "parameter '" . $v_key . "'");
+                                                       'Callback \'' . $p_params[$v_key]
+                                                                       . '()\' is not an existing function for '
+                                                                       . 'parameter \'' . $v_key . '\'');
                                        return self::errorCode();
                                }
                        }
@@ -1168,29 +1167,29 @@ class tx_em_Tools_Unzip {
         *
         */
        function _tool_PathReduction($p_dir) {
-               $v_result = "";
+               $v_result = '';
 
                // Look for not empty path
-               if ($p_dir != "") {
+               if ($p_dir != '') {
                        // Explode path by directory names
-                       $v_list = explode("/", $p_dir);
+                       $v_list = explode('/', $p_dir);
 
                        // Study directories from last to first
                        for ($i = sizeof($v_list) - 1; $i >= 0; $i--) {
                                // Look for current path
-                               if ($v_list[$i] == ".") {
+                               if ($v_list[$i] == '.') {
                                        // Ignore this directory
                                        // Should be the first $i=0, but no check is done
                                } else {
-                                       if ($v_list[$i] == "..") {
+                                       if ($v_list[$i] == '..') {
                                                // Ignore it and ignore the $i-1
                                                $i--;
                                        } else {
-                                               if (($v_list[$i] == "") && ($i != (sizeof($v_list) - 1)) && ($i != 0)) {
+                                               if (($v_list[$i] == '') && ($i != (sizeof($v_list) - 1)) && ($i != 0)) {
                                                        // Ignore only the double '//' in path,
                                                        // but not the first and last '/'
                                                } else {
-                                                       $v_result = $v_list[$i] . ($i != (sizeof($v_list) - 1) ? "/" . $v_result : "");
+                                                       $v_result = $v_list[$i] . ($i != (sizeof($v_list) - 1) ? '/' . $v_result : '');
                                                }
                                        }
                                }
@@ -1211,9 +1210,9 @@ class tx_em_Tools_Unzip {
                $v_result = 1;
 
                // Explode dir and path by directory separator
-               $v_list_dir = explode("/", $p_dir);
+               $v_list_dir = explode('/', $p_dir);
                $v_list_dir_size = sizeof($v_list_dir);
-               $v_list_path = explode("/", $p_path);
+               $v_list_path = explode('/', $p_path);
                $v_list_path_size = sizeof($v_list_path);
 
                // Study directories paths