@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | /** |
9 | 9 | * Code |
10 | 10 | */ |
11 | -include_once dirname(__FILE__) . '/../../../global.inc.php'; |
|
12 | -require_once dirname(__FILE__) . '/search_processor.class.php'; |
|
13 | -require_once dirname(__FILE__) . '/../IndexableChunk.class.php'; |
|
11 | +include_once dirname(__FILE__).'/../../../global.inc.php'; |
|
12 | +require_once dirname(__FILE__).'/search_processor.class.php'; |
|
13 | +require_once dirname(__FILE__).'/../IndexableChunk.class.php'; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Process learning paths before pass it to search listing scripts |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_LEARNPATH, $lp_id); |
53 | 53 | if ($visibility) { |
54 | 54 | list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $lp_id, $lp['has_document_id']); |
55 | - $url = api_get_path(WEB_PATH) . 'main/newscorm/lp_controller.php?cidReq=%s&action=view&lp_id=%s'; |
|
55 | + $url = api_get_path(WEB_PATH).'main/newscorm/lp_controller.php?cidReq=%s&action=view&lp_id=%s'; |
|
56 | 56 | $url = sprintf($url, $courseid, $lp_id); |
57 | 57 | $result = array( |
58 | 58 | 'toolid' => TOOL_LEARNPATH, |
@@ -128,16 +128,16 @@ discard block |
||
128 | 128 | $name = ''; |
129 | 129 | if ($row = Database::fetch_array($dk_result)) { |
130 | 130 | // Get the image path |
131 | - $img_location = api_get_path(WEB_COURSE_PATH) . $course_path . "/document/"; |
|
131 | + $img_location = api_get_path(WEB_COURSE_PATH).$course_path."/document/"; |
|
132 | 132 | $thumbnail_path = str_replace('.png.html', '_thumb.png', $row['path']); |
133 | 133 | $big_img_path = str_replace('.png.html', '.png', $row['path']); |
134 | 134 | $thumbnail = ''; |
135 | 135 | if (!empty($thumbnail_path)) { |
136 | - $thumbnail = $img_location . $thumbnail_path; |
|
136 | + $thumbnail = $img_location.$thumbnail_path; |
|
137 | 137 | } |
138 | 138 | $image = ''; |
139 | 139 | if (!empty($big_img_path)) { |
140 | - $image = $img_location . $big_img_path; |
|
140 | + $image = $img_location.$big_img_path; |
|
141 | 141 | } |
142 | 142 | $name = $row['name']; |
143 | 143 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | foreach (array_keys($this->_chunks[$type]) as $typekey) { |
52 | 52 | list($key, $data) = explode("\0", $this->_chunks[$type][$typekey]); |
53 | 53 | if (strcmp($key, $check) == 0) { |
54 | - echo 'Key "' . $check . '" already exists in "' . $type . '" chunk.'; |
|
54 | + echo 'Key "'.$check.'" already exists in "'.$type.'" chunk.'; |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 | } |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function addChunk($chunkType, $key, $value) { |
72 | 72 | |
73 | - $chunkData = $key . "\0" . $value; |
|
74 | - $crc = pack("N", crc32($chunkType . $chunkData)); |
|
73 | + $chunkData = $key."\0".$value; |
|
74 | + $crc = pack("N", crc32($chunkType.$chunkData)); |
|
75 | 75 | $len = pack("N", strlen($chunkData)); |
76 | 76 | |
77 | - $newChunk = $len . $chunkType . $chunkData . $crc; |
|
77 | + $newChunk = $len.$chunkType.$chunkData.$crc; |
|
78 | 78 | $result = substr($this->_contents, 0, $this->_size - 12) |
79 | 79 | . $newChunk |
80 | 80 | . substr($this->_contents, $this->_size - 12, 12); |
@@ -92,30 +92,30 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function removeChunks($chunkType, $key, $png) { |
94 | 94 | // Read the magic bytes and verify |
95 | - $retval = substr($png,0,8); |
|
95 | + $retval = substr($png, 0, 8); |
|
96 | 96 | $ipos = 8; |
97 | 97 | if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") |
98 | 98 | throw new Exception('Is not a valid PNG image'); |
99 | 99 | // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type |
100 | - $chunkHeader = substr($png,$ipos,8); |
|
100 | + $chunkHeader = substr($png, $ipos, 8); |
|
101 | 101 | $ipos = $ipos + 8; |
102 | 102 | while ($chunkHeader) { |
103 | 103 | // Extract length and type from binary data |
104 | 104 | $chunk = @unpack('Nsize/a4type', $chunkHeader); |
105 | 105 | $skip = false; |
106 | - if ( $chunk['type'] == $chunkType ) { |
|
107 | - $data = substr($png,$ipos,$chunk['size']); |
|
106 | + if ($chunk['type'] == $chunkType) { |
|
107 | + $data = substr($png, $ipos, $chunk['size']); |
|
108 | 108 | $sections = explode("\0", $data); |
109 | 109 | print_r($sections); |
110 | - if ( $sections[0] == $key ) $skip = true; |
|
110 | + if ($sections[0] == $key) $skip = true; |
|
111 | 111 | } |
112 | 112 | // Extract the data and the CRC |
113 | - $data = substr($png,$ipos,$chunk['size']+4); |
|
113 | + $data = substr($png, $ipos, $chunk['size'] + 4); |
|
114 | 114 | $ipos = $ipos + $chunk['size'] + 4; |
115 | 115 | // Add in the header, data, and CRC |
116 | - if ( ! $skip ) $retval = $retval . $chunkHeader . $data; |
|
116 | + if (!$skip) $retval = $retval.$chunkHeader.$data; |
|
117 | 117 | // Read next chunk header |
118 | - $chunkHeader = substr($png,$ipos,8); |
|
118 | + $chunkHeader = substr($png, $ipos, 8); |
|
119 | 119 | $ipos = $ipos + 8; |
120 | 120 | } |
121 | 121 | return $retval; |
@@ -131,34 +131,34 @@ discard block |
||
131 | 131 | * If there is PNG information that matches the key an array is returned |
132 | 132 | * |
133 | 133 | */ |
134 | - public function extractBadgeInfo($png, $key='openbadges') { |
|
134 | + public function extractBadgeInfo($png, $key = 'openbadges') { |
|
135 | 135 | // Read the magic bytes and verify |
136 | - $retval = substr($png,0,8); |
|
136 | + $retval = substr($png, 0, 8); |
|
137 | 137 | $ipos = 8; |
138 | 138 | if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") { |
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type |
143 | - $chunkHeader = substr($png,$ipos,8); |
|
143 | + $chunkHeader = substr($png, $ipos, 8); |
|
144 | 144 | $ipos = $ipos + 8; |
145 | 145 | while ($chunkHeader) { |
146 | 146 | // Extract length and type from binary data |
147 | 147 | $chunk = @unpack('Nsize/a4type', $chunkHeader); |
148 | 148 | $skip = false; |
149 | 149 | if ($chunk['type'] == 'tEXt') { |
150 | - $data = substr($png,$ipos,$chunk['size']); |
|
150 | + $data = substr($png, $ipos, $chunk['size']); |
|
151 | 151 | $sections = explode("\0", $data); |
152 | 152 | if ($sections[0] == $key) { |
153 | 153 | return $sections; |
154 | 154 | } |
155 | 155 | } |
156 | 156 | // Extract the data and the CRC |
157 | - $data = substr($png,$ipos,$chunk['size']+4); |
|
157 | + $data = substr($png, $ipos, $chunk['size'] + 4); |
|
158 | 158 | $ipos = $ipos + $chunk['size'] + 4; |
159 | 159 | |
160 | 160 | // Read next chunk header |
161 | - $chunkHeader = substr($png,$ipos,8); |
|
161 | + $chunkHeader = substr($png, $ipos, 8); |
|
162 | 162 | $ipos = $ipos + 8; |
163 | 163 | } |
164 | 164 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | // ----- Constants |
49 | 49 | if (!defined('PCLZIP_READ_BLOCK_SIZE')) { |
50 | - define( 'PCLZIP_READ_BLOCK_SIZE', 2048 ); |
|
50 | + define('PCLZIP_READ_BLOCK_SIZE', 2048); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // ----- File list separator |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //define( 'PCLZIP_SEPARATOR', ' ' ); |
62 | 62 | // Recommanded values for smart separation of filenames. |
63 | 63 | if (!defined('PCLZIP_SEPARATOR')) { |
64 | - define( 'PCLZIP_SEPARATOR', '|' ); |
|
64 | + define('PCLZIP_SEPARATOR', '|'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // ----- Error configuration |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | // you must ensure that you have included PclError library. |
71 | 71 | // [2,...] : reserved for futur use |
72 | 72 | if (!defined('PCLZIP_ERROR_EXTERNAL')) { |
73 | - define( 'PCLZIP_ERROR_EXTERNAL', 0 ); |
|
73 | + define('PCLZIP_ERROR_EXTERNAL', 0); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // ----- Optional static temporary directory |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' ); |
84 | 84 | // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' ); |
85 | 85 | if (!defined('PCLZIP_TEMPORARY_DIR')) { |
86 | - define( 'PCLZIP_TEMPORARY_DIR', '' ); |
|
86 | + define('PCLZIP_TEMPORARY_DIR', ''); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // ----- Optional threshold ratio for use of temporary files |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // Samples : |
96 | 96 | // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 ); |
97 | 97 | if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) { |
98 | - define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 ); |
|
98 | + define('PCLZIP_TEMPORARY_FILE_RATIO', 0.47); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // -------------------------------------------------------------------------------- |
@@ -120,72 +120,72 @@ discard block |
||
120 | 120 | // -12 : Unable to rename file (rename) |
121 | 121 | // -13 : Invalid header checksum |
122 | 122 | // -14 : Invalid archive size |
123 | - define( 'PCLZIP_ERR_USER_ABORTED', 2 ); |
|
124 | - define( 'PCLZIP_ERR_NO_ERROR', 0 ); |
|
125 | - define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 ); |
|
126 | - define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 ); |
|
127 | - define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 ); |
|
128 | - define( 'PCLZIP_ERR_MISSING_FILE', -4 ); |
|
129 | - define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 ); |
|
130 | - define( 'PCLZIP_ERR_INVALID_ZIP', -6 ); |
|
131 | - define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 ); |
|
132 | - define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 ); |
|
133 | - define( 'PCLZIP_ERR_BAD_EXTENSION', -9 ); |
|
134 | - define( 'PCLZIP_ERR_BAD_FORMAT', -10 ); |
|
135 | - define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 ); |
|
136 | - define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 ); |
|
137 | - define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 ); |
|
138 | - define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 ); |
|
139 | - define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 ); |
|
140 | - define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 ); |
|
141 | - define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 ); |
|
142 | - define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 ); |
|
143 | - define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 ); |
|
144 | - define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 ); |
|
145 | - define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 ); |
|
123 | + define('PCLZIP_ERR_USER_ABORTED', 2); |
|
124 | + define('PCLZIP_ERR_NO_ERROR', 0); |
|
125 | + define('PCLZIP_ERR_WRITE_OPEN_FAIL', -1); |
|
126 | + define('PCLZIP_ERR_READ_OPEN_FAIL', -2); |
|
127 | + define('PCLZIP_ERR_INVALID_PARAMETER', -3); |
|
128 | + define('PCLZIP_ERR_MISSING_FILE', -4); |
|
129 | + define('PCLZIP_ERR_FILENAME_TOO_LONG', -5); |
|
130 | + define('PCLZIP_ERR_INVALID_ZIP', -6); |
|
131 | + define('PCLZIP_ERR_BAD_EXTRACTED_FILE', -7); |
|
132 | + define('PCLZIP_ERR_DIR_CREATE_FAIL', -8); |
|
133 | + define('PCLZIP_ERR_BAD_EXTENSION', -9); |
|
134 | + define('PCLZIP_ERR_BAD_FORMAT', -10); |
|
135 | + define('PCLZIP_ERR_DELETE_FILE_FAIL', -11); |
|
136 | + define('PCLZIP_ERR_RENAME_FILE_FAIL', -12); |
|
137 | + define('PCLZIP_ERR_BAD_CHECKSUM', -13); |
|
138 | + define('PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14); |
|
139 | + define('PCLZIP_ERR_MISSING_OPTION_VALUE', -15); |
|
140 | + define('PCLZIP_ERR_INVALID_OPTION_VALUE', -16); |
|
141 | + define('PCLZIP_ERR_ALREADY_A_DIRECTORY', -17); |
|
142 | + define('PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18); |
|
143 | + define('PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19); |
|
144 | + define('PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20); |
|
145 | + define('PCLZIP_ERR_DIRECTORY_RESTRICTION', -21); |
|
146 | 146 | |
147 | 147 | // ----- Options values |
148 | - define( 'PCLZIP_OPT_PATH', 77001 ); |
|
149 | - define( 'PCLZIP_OPT_ADD_PATH', 77002 ); |
|
150 | - define( 'PCLZIP_OPT_REMOVE_PATH', 77003 ); |
|
151 | - define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 ); |
|
152 | - define( 'PCLZIP_OPT_SET_CHMOD', 77005 ); |
|
153 | - define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 ); |
|
154 | - define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 ); |
|
155 | - define( 'PCLZIP_OPT_BY_NAME', 77008 ); |
|
156 | - define( 'PCLZIP_OPT_BY_INDEX', 77009 ); |
|
157 | - define( 'PCLZIP_OPT_BY_EREG', 77010 ); |
|
158 | - define( 'PCLZIP_OPT_BY_PREG', 77011 ); |
|
159 | - define( 'PCLZIP_OPT_COMMENT', 77012 ); |
|
160 | - define( 'PCLZIP_OPT_ADD_COMMENT', 77013 ); |
|
161 | - define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 ); |
|
162 | - define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 ); |
|
163 | - define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 ); |
|
164 | - define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 ); |
|
148 | + define('PCLZIP_OPT_PATH', 77001); |
|
149 | + define('PCLZIP_OPT_ADD_PATH', 77002); |
|
150 | + define('PCLZIP_OPT_REMOVE_PATH', 77003); |
|
151 | + define('PCLZIP_OPT_REMOVE_ALL_PATH', 77004); |
|
152 | + define('PCLZIP_OPT_SET_CHMOD', 77005); |
|
153 | + define('PCLZIP_OPT_EXTRACT_AS_STRING', 77006); |
|
154 | + define('PCLZIP_OPT_NO_COMPRESSION', 77007); |
|
155 | + define('PCLZIP_OPT_BY_NAME', 77008); |
|
156 | + define('PCLZIP_OPT_BY_INDEX', 77009); |
|
157 | + define('PCLZIP_OPT_BY_EREG', 77010); |
|
158 | + define('PCLZIP_OPT_BY_PREG', 77011); |
|
159 | + define('PCLZIP_OPT_COMMENT', 77012); |
|
160 | + define('PCLZIP_OPT_ADD_COMMENT', 77013); |
|
161 | + define('PCLZIP_OPT_PREPEND_COMMENT', 77014); |
|
162 | + define('PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015); |
|
163 | + define('PCLZIP_OPT_REPLACE_NEWER', 77016); |
|
164 | + define('PCLZIP_OPT_STOP_ON_ERROR', 77017); |
|
165 | 165 | // Having big trouble with crypt. Need to multiply 2 long int |
166 | 166 | // which is not correctly supported by PHP ... |
167 | 167 | //define( 'PCLZIP_OPT_CRYPT', 77018 ); |
168 | - define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 ); |
|
169 | - define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 ); |
|
170 | - define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias |
|
171 | - define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 ); |
|
172 | - define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias |
|
173 | - define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 ); |
|
174 | - define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias |
|
168 | + define('PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019); |
|
169 | + define('PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020); |
|
170 | + define('PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020); // alias |
|
171 | + define('PCLZIP_OPT_TEMP_FILE_ON', 77021); |
|
172 | + define('PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021); // alias |
|
173 | + define('PCLZIP_OPT_TEMP_FILE_OFF', 77022); |
|
174 | + define('PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022); // alias |
|
175 | 175 | |
176 | 176 | // ----- File description attributes |
177 | - define( 'PCLZIP_ATT_FILE_NAME', 79001 ); |
|
178 | - define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 ); |
|
179 | - define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 ); |
|
180 | - define( 'PCLZIP_ATT_FILE_MTIME', 79004 ); |
|
181 | - define( 'PCLZIP_ATT_FILE_CONTENT', 79005 ); |
|
182 | - define( 'PCLZIP_ATT_FILE_COMMENT', 79006 ); |
|
177 | + define('PCLZIP_ATT_FILE_NAME', 79001); |
|
178 | + define('PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002); |
|
179 | + define('PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003); |
|
180 | + define('PCLZIP_ATT_FILE_MTIME', 79004); |
|
181 | + define('PCLZIP_ATT_FILE_CONTENT', 79005); |
|
182 | + define('PCLZIP_ATT_FILE_COMMENT', 79006); |
|
183 | 183 | |
184 | 184 | // ----- Call backs values |
185 | - define( 'PCLZIP_CB_PRE_EXTRACT', 78001 ); |
|
186 | - define( 'PCLZIP_CB_POST_EXTRACT', 78002 ); |
|
187 | - define( 'PCLZIP_CB_PRE_ADD', 78003 ); |
|
188 | - define( 'PCLZIP_CB_POST_ADD', 78004 ); |
|
185 | + define('PCLZIP_CB_PRE_EXTRACT', 78001); |
|
186 | + define('PCLZIP_CB_POST_EXTRACT', 78002); |
|
187 | + define('PCLZIP_CB_PRE_ADD', 78003); |
|
188 | + define('PCLZIP_CB_POST_ADD', 78004); |
|
189 | 189 | /* For futur use |
190 | 190 | define( 'PCLZIP_CB_PRE_LIST', 78005 ); |
191 | 191 | define( 'PCLZIP_CB_POST_LIST', 78006 ); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | // -------------------------------------------------------------------------------- |
291 | 291 | function create($p_filelist) |
292 | 292 | { |
293 | - $v_result=1; |
|
293 | + $v_result = 1; |
|
294 | 294 | |
295 | 295 | // ----- Reset the error handler |
296 | 296 | $this->privErrorReset(); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | |
317 | 317 | // ----- Parse the options |
318 | 318 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, |
319 | - array (PCLZIP_OPT_REMOVE_PATH => 'optional', |
|
319 | + array(PCLZIP_OPT_REMOVE_PATH => 'optional', |
|
320 | 320 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
321 | 321 | PCLZIP_OPT_ADD_PATH => 'optional', |
322 | 322 | PCLZIP_CB_PRE_ADD => 'optional', |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | |
403 | 403 | // ----- For each file in the list check the attributes |
404 | 404 | $v_supported_attributes |
405 | - = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' |
|
405 | + = array(PCLZIP_ATT_FILE_NAME => 'mandatory' |
|
406 | 406 | ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' |
407 | 407 | ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' |
408 | 408 | ,PCLZIP_ATT_FILE_MTIME => 'optional' |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | // -------------------------------------------------------------------------------- |
474 | 474 | function add($p_filelist) |
475 | 475 | { |
476 | - $v_result=1; |
|
476 | + $v_result = 1; |
|
477 | 477 | |
478 | 478 | // ----- Reset the error handler |
479 | 479 | $this->privErrorReset(); |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | |
500 | 500 | // ----- Parse the options |
501 | 501 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, |
502 | - array (PCLZIP_OPT_REMOVE_PATH => 'optional', |
|
502 | + array(PCLZIP_OPT_REMOVE_PATH => 'optional', |
|
503 | 503 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
504 | 504 | PCLZIP_OPT_ADD_PATH => 'optional', |
505 | 505 | PCLZIP_CB_PRE_ADD => 'optional', |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | |
586 | 586 | // ----- For each file in the list check the attributes |
587 | 587 | $v_supported_attributes |
588 | - = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' |
|
588 | + = array(PCLZIP_ATT_FILE_NAME => 'mandatory' |
|
589 | 589 | ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' |
590 | 590 | ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' |
591 | 591 | ,PCLZIP_ATT_FILE_MTIME => 'optional' |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | // -------------------------------------------------------------------------------- |
663 | 663 | function listContent() |
664 | 664 | { |
665 | - $v_result=1; |
|
665 | + $v_result = 1; |
|
666 | 666 | |
667 | 667 | // ----- Reset the error handler |
668 | 668 | $this->privErrorReset(); |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | // -------------------------------------------------------------------------------- |
720 | 720 | function extract() |
721 | 721 | { |
722 | - $v_result=1; |
|
722 | + $v_result = 1; |
|
723 | 723 | |
724 | 724 | // ----- Reset the error handler |
725 | 725 | $this->privErrorReset(); |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | |
753 | 753 | // ----- Parse the options |
754 | 754 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, |
755 | - array (PCLZIP_OPT_PATH => 'optional', |
|
755 | + array(PCLZIP_OPT_PATH => 'optional', |
|
756 | 756 | PCLZIP_OPT_REMOVE_PATH => 'optional', |
757 | 757 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
758 | 758 | PCLZIP_OPT_ADD_PATH => 'optional', |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | //function extractByIndex($p_index, options...) |
877 | 877 | function extractByIndex($p_index) |
878 | 878 | { |
879 | - $v_result=1; |
|
879 | + $v_result = 1; |
|
880 | 880 | |
881 | 881 | // ----- Reset the error handler |
882 | 882 | $this->privErrorReset(); |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | |
914 | 914 | // ----- Parse the options |
915 | 915 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, |
916 | - array (PCLZIP_OPT_PATH => 'optional', |
|
916 | + array(PCLZIP_OPT_PATH => 'optional', |
|
917 | 917 | PCLZIP_OPT_REMOVE_PATH => 'optional', |
918 | 918 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
919 | 919 | PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', |
@@ -983,10 +983,10 @@ discard block |
||
983 | 983 | // ----- Trick |
984 | 984 | // Here I want to reuse extractByRule(), so I need to parse the $p_index |
985 | 985 | // with privParseOptions() |
986 | - $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index); |
|
986 | + $v_arg_trick = array(PCLZIP_OPT_BY_INDEX, $p_index); |
|
987 | 987 | $v_options_trick = array(); |
988 | 988 | $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, |
989 | - array (PCLZIP_OPT_BY_INDEX => 'optional' )); |
|
989 | + array(PCLZIP_OPT_BY_INDEX => 'optional')); |
|
990 | 990 | if ($v_result != 1) { |
991 | 991 | return 0; |
992 | 992 | } |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | // -------------------------------------------------------------------------------- |
1026 | 1026 | function delete() |
1027 | 1027 | { |
1028 | - $v_result=1; |
|
1028 | + $v_result = 1; |
|
1029 | 1029 | |
1030 | 1030 | // ----- Reset the error handler |
1031 | 1031 | $this->privErrorReset(); |
@@ -1048,10 +1048,10 @@ discard block |
||
1048 | 1048 | |
1049 | 1049 | // ----- Parse the options |
1050 | 1050 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, |
1051 | - array (PCLZIP_OPT_BY_NAME => 'optional', |
|
1051 | + array(PCLZIP_OPT_BY_NAME => 'optional', |
|
1052 | 1052 | PCLZIP_OPT_BY_EREG => 'optional', |
1053 | 1053 | PCLZIP_OPT_BY_PREG => 'optional', |
1054 | - PCLZIP_OPT_BY_INDEX => 'optional' )); |
|
1054 | + PCLZIP_OPT_BY_INDEX => 'optional')); |
|
1055 | 1055 | if ($v_result != 1) { |
1056 | 1056 | return 0; |
1057 | 1057 | } |
@@ -1305,9 +1305,9 @@ discard block |
||
1305 | 1305 | // Description : |
1306 | 1306 | // Parameters : |
1307 | 1307 | // -------------------------------------------------------------------------------- |
1308 | - function errorName($p_with_code=false) |
|
1308 | + function errorName($p_with_code = false) |
|
1309 | 1309 | { |
1310 | - $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', |
|
1310 | + $v_name = array(PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', |
|
1311 | 1311 | PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL', |
1312 | 1312 | PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL', |
1313 | 1313 | PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER', |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | // Description : |
1352 | 1352 | // Parameters : |
1353 | 1353 | // -------------------------------------------------------------------------------- |
1354 | - function errorInfo($p_full=false) |
|
1354 | + function errorInfo($p_full = false) |
|
1355 | 1355 | { |
1356 | 1356 | if (PCLZIP_ERROR_EXTERNAL == 1) { |
1357 | 1357 | return(PclErrorString()); |
@@ -1390,7 +1390,7 @@ discard block |
||
1390 | 1390 | // true on success, |
1391 | 1391 | // false on error, the error code is set. |
1392 | 1392 | // -------------------------------------------------------------------------------- |
1393 | - function privCheckFormat($p_level=0) |
|
1393 | + function privCheckFormat($p_level = 0) |
|
1394 | 1394 | { |
1395 | 1395 | $v_result = true; |
1396 | 1396 | |
@@ -1443,13 +1443,13 @@ discard block |
||
1443 | 1443 | // 1 on success. |
1444 | 1444 | // 0 on failure. |
1445 | 1445 | // -------------------------------------------------------------------------------- |
1446 | - function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false) |
|
1446 | + function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false) |
|
1447 | 1447 | { |
1448 | - $v_result=1; |
|
1448 | + $v_result = 1; |
|
1449 | 1449 | |
1450 | 1450 | // ----- Read the options |
1451 | - $i=0; |
|
1452 | - while ($i<$p_size) { |
|
1451 | + $i = 0; |
|
1452 | + while ($i < $p_size) { |
|
1453 | 1453 | |
1454 | 1454 | // ----- Check if the option is supported |
1455 | 1455 | if (!isset($v_requested_options[$p_options_list[$i]])) { |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | case PCLZIP_OPT_REMOVE_PATH : |
1468 | 1468 | case PCLZIP_OPT_ADD_PATH : |
1469 | 1469 | // ----- Check the number of parameters |
1470 | - if (($i+1) >= $p_size) { |
|
1470 | + if (($i + 1) >= $p_size) { |
|
1471 | 1471 | // ----- Error log |
1472 | 1472 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
1473 | 1473 | |
@@ -1476,13 +1476,13 @@ discard block |
||
1476 | 1476 | } |
1477 | 1477 | |
1478 | 1478 | // ----- Get the value |
1479 | - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); |
|
1479 | + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], FALSE); |
|
1480 | 1480 | $i++; |
1481 | 1481 | break; |
1482 | 1482 | |
1483 | 1483 | case PCLZIP_OPT_TEMP_FILE_THRESHOLD : |
1484 | 1484 | // ----- Check the number of parameters |
1485 | - if (($i+1) >= $p_size) { |
|
1485 | + if (($i + 1) >= $p_size) { |
|
1486 | 1486 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
1487 | 1487 | return PclZip::errorCode(); |
1488 | 1488 | } |
@@ -1494,14 +1494,14 @@ discard block |
||
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | // ----- Check the value |
1497 | - $v_value = $p_options_list[$i+1]; |
|
1498 | - if ((!is_integer($v_value)) || ($v_value<0)) { |
|
1497 | + $v_value = $p_options_list[$i + 1]; |
|
1498 | + if ((!is_integer($v_value)) || ($v_value < 0)) { |
|
1499 | 1499 | PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
1500 | 1500 | return PclZip::errorCode(); |
1501 | 1501 | } |
1502 | 1502 | |
1503 | 1503 | // ----- Get the value (and convert it in bytes) |
1504 | - $v_result_list[$p_options_list[$i]] = $v_value*1048576; |
|
1504 | + $v_result_list[$p_options_list[$i]] = $v_value * 1048576; |
|
1505 | 1505 | $i++; |
1506 | 1506 | break; |
1507 | 1507 | |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : |
1534 | 1534 | // ----- Check the number of parameters |
1535 | - if (($i+1) >= $p_size) { |
|
1535 | + if (($i + 1) >= $p_size) { |
|
1536 | 1536 | // ----- Error log |
1537 | 1537 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
1538 | 1538 | |
@@ -1541,9 +1541,9 @@ discard block |
||
1541 | 1541 | } |
1542 | 1542 | |
1543 | 1543 | // ----- Get the value |
1544 | - if ( is_string($p_options_list[$i+1]) |
|
1545 | - && ($p_options_list[$i+1] != '')) { |
|
1546 | - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); |
|
1544 | + if (is_string($p_options_list[$i + 1]) |
|
1545 | + && ($p_options_list[$i + 1] != '')) { |
|
1546 | + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], FALSE); |
|
1547 | 1547 | $i++; |
1548 | 1548 | } |
1549 | 1549 | else { |
@@ -1553,7 +1553,7 @@ discard block |
||
1553 | 1553 | // ----- Look for options that request an array of string for value |
1554 | 1554 | case PCLZIP_OPT_BY_NAME : |
1555 | 1555 | // ----- Check the number of parameters |
1556 | - if (($i+1) >= $p_size) { |
|
1556 | + if (($i + 1) >= $p_size) { |
|
1557 | 1557 | // ----- Error log |
1558 | 1558 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
1559 | 1559 | |
@@ -1562,11 +1562,11 @@ discard block |
||
1562 | 1562 | } |
1563 | 1563 | |
1564 | 1564 | // ----- Get the value |
1565 | - if (is_string($p_options_list[$i+1])) { |
|
1566 | - $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1]; |
|
1565 | + if (is_string($p_options_list[$i + 1])) { |
|
1566 | + $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i + 1]; |
|
1567 | 1567 | } |
1568 | - else if (is_array($p_options_list[$i+1])) { |
|
1569 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
1568 | + else if (is_array($p_options_list[$i + 1])) { |
|
1569 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
1570 | 1570 | } |
1571 | 1571 | else { |
1572 | 1572 | // ----- Error log |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | case PCLZIP_OPT_BY_PREG : |
1587 | 1587 | //case PCLZIP_OPT_CRYPT : |
1588 | 1588 | // ----- Check the number of parameters |
1589 | - if (($i+1) >= $p_size) { |
|
1589 | + if (($i + 1) >= $p_size) { |
|
1590 | 1590 | // ----- Error log |
1591 | 1591 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
1592 | 1592 | |
@@ -1595,8 +1595,8 @@ discard block |
||
1595 | 1595 | } |
1596 | 1596 | |
1597 | 1597 | // ----- Get the value |
1598 | - if (is_string($p_options_list[$i+1])) { |
|
1599 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
1598 | + if (is_string($p_options_list[$i + 1])) { |
|
1599 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
1600 | 1600 | } |
1601 | 1601 | else { |
1602 | 1602 | // ----- Error log |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | case PCLZIP_OPT_ADD_COMMENT : |
1614 | 1614 | case PCLZIP_OPT_PREPEND_COMMENT : |
1615 | 1615 | // ----- Check the number of parameters |
1616 | - if (($i+1) >= $p_size) { |
|
1616 | + if (($i + 1) >= $p_size) { |
|
1617 | 1617 | // ----- Error log |
1618 | 1618 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, |
1619 | 1619 | "Missing parameter value for option '" |
@@ -1625,8 +1625,8 @@ discard block |
||
1625 | 1625 | } |
1626 | 1626 | |
1627 | 1627 | // ----- Get the value |
1628 | - if (is_string($p_options_list[$i+1])) { |
|
1629 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
1628 | + if (is_string($p_options_list[$i + 1])) { |
|
1629 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
1630 | 1630 | } |
1631 | 1631 | else { |
1632 | 1632 | // ----- Error log |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | // ----- Look for options that request an array of index |
1645 | 1645 | case PCLZIP_OPT_BY_INDEX : |
1646 | 1646 | // ----- Check the number of parameters |
1647 | - if (($i+1) >= $p_size) { |
|
1647 | + if (($i + 1) >= $p_size) { |
|
1648 | 1648 | // ----- Error log |
1649 | 1649 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
1650 | 1650 | |
@@ -1654,19 +1654,19 @@ discard block |
||
1654 | 1654 | |
1655 | 1655 | // ----- Get the value |
1656 | 1656 | $v_work_list = array(); |
1657 | - if (is_string($p_options_list[$i+1])) { |
|
1657 | + if (is_string($p_options_list[$i + 1])) { |
|
1658 | 1658 | |
1659 | 1659 | // ----- Remove spaces |
1660 | - $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', ''); |
|
1660 | + $p_options_list[$i + 1] = strtr($p_options_list[$i + 1], ' ', ''); |
|
1661 | 1661 | |
1662 | 1662 | // ----- Parse items |
1663 | - $v_work_list = explode(",", $p_options_list[$i+1]); |
|
1663 | + $v_work_list = explode(",", $p_options_list[$i + 1]); |
|
1664 | 1664 | } |
1665 | - else if (is_integer($p_options_list[$i+1])) { |
|
1666 | - $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1]; |
|
1665 | + else if (is_integer($p_options_list[$i + 1])) { |
|
1666 | + $v_work_list[0] = $p_options_list[$i + 1].'-'.$p_options_list[$i + 1]; |
|
1667 | 1667 | } |
1668 | - else if (is_array($p_options_list[$i+1])) { |
|
1669 | - $v_work_list = $p_options_list[$i+1]; |
|
1668 | + else if (is_array($p_options_list[$i + 1])) { |
|
1669 | + $v_work_list = $p_options_list[$i + 1]; |
|
1670 | 1670 | } |
1671 | 1671 | else { |
1672 | 1672 | // ----- Error log |
@@ -1680,9 +1680,9 @@ discard block |
||
1680 | 1680 | // each index item in the list must be a couple with a start and |
1681 | 1681 | // an end value : [0,3], [5-5], [8-10], ... |
1682 | 1682 | // ----- Check the format of each item |
1683 | - $v_sort_flag=false; |
|
1684 | - $v_sort_value=0; |
|
1685 | - for ($j=0; $j<sizeof($v_work_list); $j++) { |
|
1683 | + $v_sort_flag = false; |
|
1684 | + $v_sort_value = 0; |
|
1685 | + for ($j = 0; $j < sizeof($v_work_list); $j++) { |
|
1686 | 1686 | // ----- Explode the item |
1687 | 1687 | $v_item_list = explode("-", $v_work_list[$j]); |
1688 | 1688 | $v_size_item_list = sizeof($v_item_list); |
@@ -1712,7 +1712,7 @@ discard block |
||
1712 | 1712 | |
1713 | 1713 | // ----- Look for list sort |
1714 | 1714 | if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) { |
1715 | - $v_sort_flag=true; |
|
1715 | + $v_sort_flag = true; |
|
1716 | 1716 | |
1717 | 1717 | // ----- TBC : An automatic sort should be writen ... |
1718 | 1718 | // ----- Error log |
@@ -1746,7 +1746,7 @@ discard block |
||
1746 | 1746 | // ----- Look for options that request an octal value |
1747 | 1747 | case PCLZIP_OPT_SET_CHMOD : |
1748 | 1748 | // ----- Check the number of parameters |
1749 | - if (($i+1) >= $p_size) { |
|
1749 | + if (($i + 1) >= $p_size) { |
|
1750 | 1750 | // ----- Error log |
1751 | 1751 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
1752 | 1752 | |
@@ -1755,7 +1755,7 @@ discard block |
||
1755 | 1755 | } |
1756 | 1756 | |
1757 | 1757 | // ----- Get the value |
1758 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
1758 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
1759 | 1759 | $i++; |
1760 | 1760 | break; |
1761 | 1761 | |
@@ -1771,7 +1771,7 @@ discard block |
||
1771 | 1771 | case PCLZIP_CB_POST_LIST : |
1772 | 1772 | */ |
1773 | 1773 | // ----- Check the number of parameters |
1774 | - if (($i+1) >= $p_size) { |
|
1774 | + if (($i + 1) >= $p_size) { |
|
1775 | 1775 | // ----- Error log |
1776 | 1776 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
1777 | 1777 | |
@@ -1780,7 +1780,7 @@ discard block |
||
1780 | 1780 | } |
1781 | 1781 | |
1782 | 1782 | // ----- Get the value |
1783 | - $v_function_name = $p_options_list[$i+1]; |
|
1783 | + $v_function_name = $p_options_list[$i + 1]; |
|
1784 | 1784 | |
1785 | 1785 | // ----- Check that the value is a valid existing function |
1786 | 1786 | if (!function_exists($v_function_name)) { |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | |
1813 | 1813 | // ----- Look for mandatory options |
1814 | 1814 | if ($v_requested_options !== false) { |
1815 | - for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { |
|
1815 | + for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { |
|
1816 | 1816 | // ----- Look for mandatory option |
1817 | 1817 | if ($v_requested_options[$key] == 'mandatory') { |
1818 | 1818 | // ----- Look if present |
@@ -1845,7 +1845,7 @@ discard block |
||
1845 | 1845 | // -------------------------------------------------------------------------------- |
1846 | 1846 | function privOptionDefaultThreshold(&$p_options) |
1847 | 1847 | { |
1848 | - $v_result=1; |
|
1848 | + $v_result = 1; |
|
1849 | 1849 | |
1850 | 1850 | if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) |
1851 | 1851 | || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { |
@@ -1857,16 +1857,16 @@ discard block |
||
1857 | 1857 | $v_memory_limit = trim($v_memory_limit); |
1858 | 1858 | $last = strtolower(substr($v_memory_limit, -1)); |
1859 | 1859 | |
1860 | - if($last == 'g') |
|
1860 | + if ($last == 'g') |
|
1861 | 1861 | //$v_memory_limit = $v_memory_limit*1024*1024*1024; |
1862 | - $v_memory_limit = $v_memory_limit*1073741824; |
|
1863 | - if($last == 'm') |
|
1862 | + $v_memory_limit = $v_memory_limit * 1073741824; |
|
1863 | + if ($last == 'm') |
|
1864 | 1864 | //$v_memory_limit = $v_memory_limit*1024*1024; |
1865 | - $v_memory_limit = $v_memory_limit*1048576; |
|
1866 | - if($last == 'k') |
|
1867 | - $v_memory_limit = $v_memory_limit*1024; |
|
1865 | + $v_memory_limit = $v_memory_limit * 1048576; |
|
1866 | + if ($last == 'k') |
|
1867 | + $v_memory_limit = $v_memory_limit * 1024; |
|
1868 | 1868 | |
1869 | - $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO); |
|
1869 | + $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit * PCLZIP_TEMPORARY_FILE_RATIO); |
|
1870 | 1870 | |
1871 | 1871 | |
1872 | 1872 | // ----- Sanity check : No threshold if value lower than 1M |
@@ -1887,9 +1887,9 @@ discard block |
||
1887 | 1887 | // 1 on success. |
1888 | 1888 | // 0 on failure. |
1889 | 1889 | // -------------------------------------------------------------------------------- |
1890 | - function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false) |
|
1890 | + function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options = false) |
|
1891 | 1891 | { |
1892 | - $v_result=1; |
|
1892 | + $v_result = 1; |
|
1893 | 1893 | |
1894 | 1894 | // ----- For each file in the list check the attributes |
1895 | 1895 | foreach ($p_file_list as $v_key => $v_value) { |
@@ -1982,7 +1982,7 @@ discard block |
||
1982 | 1982 | |
1983 | 1983 | // ----- Look for mandatory options |
1984 | 1984 | if ($v_requested_options !== false) { |
1985 | - for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { |
|
1985 | + for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { |
|
1986 | 1986 | // ----- Look for mandatory option |
1987 | 1987 | if ($v_requested_options[$key] == 'mandatory') { |
1988 | 1988 | // ----- Look if present |
@@ -2018,13 +2018,13 @@ discard block |
||
2018 | 2018 | // -------------------------------------------------------------------------------- |
2019 | 2019 | function privFileDescrExpand(&$p_filedescr_list, &$p_options) |
2020 | 2020 | { |
2021 | - $v_result=1; |
|
2021 | + $v_result = 1; |
|
2022 | 2022 | |
2023 | 2023 | // ----- Create a result list |
2024 | 2024 | $v_result_list = array(); |
2025 | 2025 | |
2026 | 2026 | // ----- Look each entry |
2027 | - for ($i=0; $i<sizeof($p_filedescr_list); $i++) { |
|
2027 | + for ($i = 0; $i < sizeof($p_filedescr_list); $i++) { |
|
2028 | 2028 | |
2029 | 2029 | // ----- Get filedescr |
2030 | 2030 | $v_descr = $p_filedescr_list[$i]; |
@@ -2143,7 +2143,7 @@ discard block |
||
2143 | 2143 | // -------------------------------------------------------------------------------- |
2144 | 2144 | function privCreate($p_filedescr_list, &$p_result_list, &$p_options) |
2145 | 2145 | { |
2146 | - $v_result=1; |
|
2146 | + $v_result = 1; |
|
2147 | 2147 | $v_list_detail = array(); |
2148 | 2148 | |
2149 | 2149 | // ----- Magic quotes trick |
@@ -2178,7 +2178,7 @@ discard block |
||
2178 | 2178 | // -------------------------------------------------------------------------------- |
2179 | 2179 | function privAdd($p_filedescr_list, &$p_result_list, &$p_options) |
2180 | 2180 | { |
2181 | - $v_result=1; |
|
2181 | + $v_result = 1; |
|
2182 | 2182 | $v_list_detail = array(); |
2183 | 2183 | |
2184 | 2184 | // ----- Look if the archive exists or is empty |
@@ -2195,7 +2195,7 @@ discard block |
||
2195 | 2195 | $this->privDisableMagicQuotes(); |
2196 | 2196 | |
2197 | 2197 | // ----- Open the zip file |
2198 | - if (($v_result=$this->privOpenFd('rb')) != 1) |
|
2198 | + if (($v_result = $this->privOpenFd('rb')) != 1) |
|
2199 | 2199 | { |
2200 | 2200 | // ----- Magic quotes trick |
2201 | 2201 | $this->privSwapBackMagicQuotes(); |
@@ -2276,7 +2276,7 @@ discard block |
||
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | // ----- Create the Central Dir files header |
2279 | - for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++) |
|
2279 | + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) |
|
2280 | 2280 | { |
2281 | 2281 | // ----- Create the file header |
2282 | 2282 | if ($v_header_list[$i]['status'] == 'ok') { |
@@ -2309,10 +2309,10 @@ discard block |
||
2309 | 2309 | } |
2310 | 2310 | |
2311 | 2311 | // ----- Calculate the size of the central header |
2312 | - $v_size = @ftell($this->zip_fd)-$v_offset; |
|
2312 | + $v_size = @ftell($this->zip_fd) - $v_offset; |
|
2313 | 2313 | |
2314 | 2314 | // ----- Create the central dir footer |
2315 | - if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) |
|
2315 | + if (($v_result = $this->privWriteCentralHeader($v_count + $v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) |
|
2316 | 2316 | { |
2317 | 2317 | // ----- Reset the file list |
2318 | 2318 | unset($v_header_list); |
@@ -2357,7 +2357,7 @@ discard block |
||
2357 | 2357 | // -------------------------------------------------------------------------------- |
2358 | 2358 | function privOpenFd($p_mode) |
2359 | 2359 | { |
2360 | - $v_result=1; |
|
2360 | + $v_result = 1; |
|
2361 | 2361 | |
2362 | 2362 | // ----- Look if already open |
2363 | 2363 | if ($this->zip_fd != 0) |
@@ -2391,7 +2391,7 @@ discard block |
||
2391 | 2391 | // -------------------------------------------------------------------------------- |
2392 | 2392 | function privCloseFd() |
2393 | 2393 | { |
2394 | - $v_result=1; |
|
2394 | + $v_result = 1; |
|
2395 | 2395 | |
2396 | 2396 | if ($this->zip_fd != 0) |
2397 | 2397 | @fclose($this->zip_fd); |
@@ -2418,7 +2418,7 @@ discard block |
||
2418 | 2418 | // function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) |
2419 | 2419 | function privAddList($p_filedescr_list, &$p_result_list, &$p_options) |
2420 | 2420 | { |
2421 | - $v_result=1; |
|
2421 | + $v_result = 1; |
|
2422 | 2422 | |
2423 | 2423 | // ----- Add the files |
2424 | 2424 | $v_header_list = array(); |
@@ -2432,7 +2432,7 @@ discard block |
||
2432 | 2432 | $v_offset = @ftell($this->zip_fd); |
2433 | 2433 | |
2434 | 2434 | // ----- Create the Central Dir files header |
2435 | - for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++) |
|
2435 | + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) |
|
2436 | 2436 | { |
2437 | 2437 | // ----- Create the file header |
2438 | 2438 | if ($v_header_list[$i]['status'] == 'ok') { |
@@ -2454,7 +2454,7 @@ discard block |
||
2454 | 2454 | } |
2455 | 2455 | |
2456 | 2456 | // ----- Calculate the size of the central header |
2457 | - $v_size = @ftell($this->zip_fd)-$v_offset; |
|
2457 | + $v_size = @ftell($this->zip_fd) - $v_offset; |
|
2458 | 2458 | |
2459 | 2459 | // ----- Create the central dir footer |
2460 | 2460 | if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) |
@@ -2482,14 +2482,14 @@ discard block |
||
2482 | 2482 | // -------------------------------------------------------------------------------- |
2483 | 2483 | function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) |
2484 | 2484 | { |
2485 | - $v_result=1; |
|
2485 | + $v_result = 1; |
|
2486 | 2486 | $v_header = array(); |
2487 | 2487 | |
2488 | 2488 | // ----- Recuperate the current number of elt in list |
2489 | 2489 | $v_nb = sizeof($p_result_list); |
2490 | 2490 | |
2491 | 2491 | // ----- Loop on the files |
2492 | - for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) { |
|
2492 | + for ($j = 0; ($j < sizeof($p_filedescr_list)) && ($v_result == 1); $j++) { |
|
2493 | 2493 | // ----- Format the filename |
2494 | 2494 | $p_filedescr_list[$j]['filename'] |
2495 | 2495 | = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); |
@@ -2502,7 +2502,7 @@ discard block |
||
2502 | 2502 | } |
2503 | 2503 | |
2504 | 2504 | // ----- Check the filename |
2505 | - if ( ($p_filedescr_list[$j]['type'] != 'virtual_file') |
|
2505 | + if (($p_filedescr_list[$j]['type'] != 'virtual_file') |
|
2506 | 2506 | && (!file_exists($p_filedescr_list[$j]['filename']))) { |
2507 | 2507 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist"); |
2508 | 2508 | return PclZip::errorCode(); |
@@ -2512,10 +2512,10 @@ discard block |
||
2512 | 2512 | // or a dir with all its path removed |
2513 | 2513 | // if ( (is_file($p_filedescr_list[$j]['filename'])) |
2514 | 2514 | // || ( is_dir($p_filedescr_list[$j]['filename']) |
2515 | - if ( ($p_filedescr_list[$j]['type'] == 'file') |
|
2515 | + if (($p_filedescr_list[$j]['type'] == 'file') |
|
2516 | 2516 | || ($p_filedescr_list[$j]['type'] == 'virtual_file') |
2517 | - || ( ($p_filedescr_list[$j]['type'] == 'folder') |
|
2518 | - && ( !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) |
|
2517 | + || (($p_filedescr_list[$j]['type'] == 'folder') |
|
2518 | + && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) |
|
2519 | 2519 | || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) |
2520 | 2520 | ) { |
2521 | 2521 | |
@@ -2544,7 +2544,7 @@ discard block |
||
2544 | 2544 | // -------------------------------------------------------------------------------- |
2545 | 2545 | function privAddFile($p_filedescr, &$p_header, &$p_options) |
2546 | 2546 | { |
2547 | - $v_result=1; |
|
2547 | + $v_result = 1; |
|
2548 | 2548 | |
2549 | 2549 | // ----- Working variable |
2550 | 2550 | $p_filename = $p_filedescr['filename']; |
@@ -2589,13 +2589,13 @@ discard block |
||
2589 | 2589 | $p_header['index'] = -1; |
2590 | 2590 | |
2591 | 2591 | // ----- Look for regular file |
2592 | - if ($p_filedescr['type']=='file') { |
|
2592 | + if ($p_filedescr['type'] == 'file') { |
|
2593 | 2593 | $p_header['external'] = 0x00000000; |
2594 | 2594 | $p_header['size'] = filesize($p_filename); |
2595 | 2595 | } |
2596 | 2596 | |
2597 | 2597 | // ----- Look for regular folder |
2598 | - else if ($p_filedescr['type']=='folder') { |
|
2598 | + else if ($p_filedescr['type'] == 'folder') { |
|
2599 | 2599 | $p_header['external'] = 0x00000010; |
2600 | 2600 | $p_header['mtime'] = filemtime($p_filename); |
2601 | 2601 | $p_header['size'] = filesize($p_filename); |
@@ -2670,10 +2670,10 @@ discard block |
||
2670 | 2670 | // ----- Look for a file |
2671 | 2671 | if ($p_filedescr['type'] == 'file') { |
2672 | 2672 | // ----- Look for using temporary file to zip |
2673 | - if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) |
|
2673 | + if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) |
|
2674 | 2674 | && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) |
2675 | 2675 | || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) |
2676 | - && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) { |
|
2676 | + && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])))) { |
|
2677 | 2677 | $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options); |
2678 | 2678 | if ($v_result < PCLZIP_ERR_NO_ERROR) { |
2679 | 2679 | return $v_result; |
@@ -2773,7 +2773,7 @@ discard block |
||
2773 | 2773 | // ----- Set the file properties |
2774 | 2774 | $p_header['size'] = 0; |
2775 | 2775 | //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked |
2776 | - $p_header['external'] = 0x00000010; // Value for a folder : to be checked |
|
2776 | + $p_header['external'] = 0x00000010; // Value for a folder : to be checked |
|
2777 | 2777 | |
2778 | 2778 | // ----- Call the header generation |
2779 | 2779 | if (($v_result = $this->privWriteFileHeader($p_header)) != 1) |
@@ -2817,7 +2817,7 @@ discard block |
||
2817 | 2817 | // -------------------------------------------------------------------------------- |
2818 | 2818 | function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) |
2819 | 2819 | { |
2820 | - $v_result=PCLZIP_ERR_NO_ERROR; |
|
2820 | + $v_result = PCLZIP_ERR_NO_ERROR; |
|
2821 | 2821 | |
2822 | 2822 | // ----- Working variable |
2823 | 2823 | $p_filename = $p_filedescr['filename']; |
@@ -2871,7 +2871,7 @@ discard block |
||
2871 | 2871 | $v_data_header['os'] = bin2hex($v_data_header['os']); |
2872 | 2872 | |
2873 | 2873 | // ----- Read the gzip file footer |
2874 | - @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8); |
|
2874 | + @fseek($v_file_compressed, filesize($v_gzip_temp_name) - 8); |
|
2875 | 2875 | $v_binary_data = @fread($v_file_compressed, 8); |
2876 | 2876 | $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); |
2877 | 2877 | |
@@ -2879,7 +2879,7 @@ discard block |
||
2879 | 2879 | $p_header['compression'] = ord($v_data_header['cm']); |
2880 | 2880 | //$p_header['mtime'] = $v_data_header['mtime']; |
2881 | 2881 | $p_header['crc'] = $v_data_footer['crc']; |
2882 | - $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18; |
|
2882 | + $p_header['compressed_size'] = filesize($v_gzip_temp_name) - 18; |
|
2883 | 2883 | |
2884 | 2884 | // ----- Close the file |
2885 | 2885 | @fclose($v_file_compressed); |
@@ -2929,7 +2929,7 @@ discard block |
||
2929 | 2929 | // -------------------------------------------------------------------------------- |
2930 | 2930 | function privCalculateStoredFilename(&$p_filedescr, &$p_options) |
2931 | 2931 | { |
2932 | - $v_result=1; |
|
2932 | + $v_result = 1; |
|
2933 | 2933 | |
2934 | 2934 | // ----- Working variables |
2935 | 2935 | $p_filename = $p_filedescr['filename']; |
@@ -2986,14 +2986,14 @@ discard block |
||
2986 | 2986 | if (substr($p_remove_dir, -1) != '/') |
2987 | 2987 | $p_remove_dir .= "/"; |
2988 | 2988 | |
2989 | - if ( (substr($p_filename, 0, 2) == "./") |
|
2989 | + if ((substr($p_filename, 0, 2) == "./") |
|
2990 | 2990 | || (substr($p_remove_dir, 0, 2) == "./")) { |
2991 | 2991 | |
2992 | - if ( (substr($p_filename, 0, 2) == "./") |
|
2992 | + if ((substr($p_filename, 0, 2) == "./") |
|
2993 | 2993 | && (substr($p_remove_dir, 0, 2) != "./")) { |
2994 | 2994 | $p_remove_dir = "./".$p_remove_dir; |
2995 | 2995 | } |
2996 | - if ( (substr($p_filename, 0, 2) != "./") |
|
2996 | + if ((substr($p_filename, 0, 2) != "./") |
|
2997 | 2997 | && (substr($p_remove_dir, 0, 2) == "./")) { |
2998 | 2998 | $p_remove_dir = substr($p_remove_dir, 2); |
2999 | 2999 | } |
@@ -3041,15 +3041,15 @@ discard block |
||
3041 | 3041 | // -------------------------------------------------------------------------------- |
3042 | 3042 | function privWriteFileHeader(&$p_header) |
3043 | 3043 | { |
3044 | - $v_result=1; |
|
3044 | + $v_result = 1; |
|
3045 | 3045 | |
3046 | 3046 | // ----- Store the offset position of the file |
3047 | 3047 | $p_header['offset'] = ftell($this->zip_fd); |
3048 | 3048 | |
3049 | 3049 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
3050 | 3050 | $v_date = getdate($p_header['mtime']); |
3051 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
3052 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
3051 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
3052 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
3053 | 3053 | |
3054 | 3054 | // ----- Packed data |
3055 | 3055 | $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, |
@@ -3086,7 +3086,7 @@ discard block |
||
3086 | 3086 | // -------------------------------------------------------------------------------- |
3087 | 3087 | function privWriteCentralFileHeader(&$p_header) |
3088 | 3088 | { |
3089 | - $v_result=1; |
|
3089 | + $v_result = 1; |
|
3090 | 3090 | |
3091 | 3091 | // TBC |
3092 | 3092 | //for(reset($p_header); $key = key($p_header); next($p_header)) { |
@@ -3094,8 +3094,8 @@ discard block |
||
3094 | 3094 | |
3095 | 3095 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
3096 | 3096 | $v_date = getdate($p_header['mtime']); |
3097 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
3098 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
3097 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
3098 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
3099 | 3099 | |
3100 | 3100 | |
3101 | 3101 | // ----- Packed data |
@@ -3139,7 +3139,7 @@ discard block |
||
3139 | 3139 | // -------------------------------------------------------------------------------- |
3140 | 3140 | function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) |
3141 | 3141 | { |
3142 | - $v_result=1; |
|
3142 | + $v_result = 1; |
|
3143 | 3143 | |
3144 | 3144 | // ----- Packed data |
3145 | 3145 | $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, |
@@ -3168,7 +3168,7 @@ discard block |
||
3168 | 3168 | // -------------------------------------------------------------------------------- |
3169 | 3169 | function privList(&$p_list) |
3170 | 3170 | { |
3171 | - $v_result=1; |
|
3171 | + $v_result = 1; |
|
3172 | 3172 | |
3173 | 3173 | // ----- Magic quotes trick |
3174 | 3174 | $this->privDisableMagicQuotes(); |
@@ -3208,7 +3208,7 @@ discard block |
||
3208 | 3208 | } |
3209 | 3209 | |
3210 | 3210 | // ----- Read each entry |
3211 | - for ($i=0; $i<$v_central_dir['entries']; $i++) |
|
3211 | + for ($i = 0; $i < $v_central_dir['entries']; $i++) |
|
3212 | 3212 | { |
3213 | 3213 | // ----- Read the file header |
3214 | 3214 | if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) |
@@ -3255,7 +3255,7 @@ discard block |
||
3255 | 3255 | // -------------------------------------------------------------------------------- |
3256 | 3256 | function privConvertHeader2FileInfo($p_header, &$p_info) |
3257 | 3257 | { |
3258 | - $v_result=1; |
|
3258 | + $v_result = 1; |
|
3259 | 3259 | |
3260 | 3260 | // ----- Get the interesting attributes |
3261 | 3261 | $v_temp_path = PclZipUtilPathReduction($p_header['filename']); |
@@ -3266,7 +3266,7 @@ discard block |
||
3266 | 3266 | $p_info['compressed_size'] = $p_header['compressed_size']; |
3267 | 3267 | $p_info['mtime'] = $p_header['mtime']; |
3268 | 3268 | $p_info['comment'] = $p_header['comment']; |
3269 | - $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); |
|
3269 | + $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010); |
|
3270 | 3270 | $p_info['index'] = $p_header['index']; |
3271 | 3271 | $p_info['status'] = $p_header['status']; |
3272 | 3272 | $p_info['crc'] = $p_header['crc']; |
@@ -3294,16 +3294,16 @@ discard block |
||
3294 | 3294 | // -------------------------------------------------------------------------------- |
3295 | 3295 | function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) |
3296 | 3296 | { |
3297 | - $v_result=1; |
|
3297 | + $v_result = 1; |
|
3298 | 3298 | |
3299 | 3299 | // ----- Magic quotes trick |
3300 | 3300 | $this->privDisableMagicQuotes(); |
3301 | 3301 | |
3302 | 3302 | // ----- Check the path |
3303 | - if ( ($p_path == "") |
|
3304 | - || ( (substr($p_path, 0, 1) != "/") |
|
3303 | + if (($p_path == "") |
|
3304 | + || ((substr($p_path, 0, 1) != "/") |
|
3305 | 3305 | && (substr($p_path, 0, 3) != "../") |
3306 | - && (substr($p_path,1,2)!=":/"))) |
|
3306 | + && (substr($p_path, 1, 2) != ":/"))) |
|
3307 | 3307 | $p_path = "./".$p_path; |
3308 | 3308 | |
3309 | 3309 | // ----- Reduce the path last (and duplicated) '/' |
@@ -3312,7 +3312,7 @@ discard block |
||
3312 | 3312 | // ----- Look for the path end '/' |
3313 | 3313 | while (substr($p_path, -1) == "/") |
3314 | 3314 | { |
3315 | - $p_path = substr($p_path, 0, strlen($p_path)-1); |
|
3315 | + $p_path = substr($p_path, 0, strlen($p_path) - 1); |
|
3316 | 3316 | } |
3317 | 3317 | } |
3318 | 3318 | |
@@ -3346,7 +3346,7 @@ discard block |
||
3346 | 3346 | |
3347 | 3347 | // ----- Read each entry |
3348 | 3348 | $j_start = 0; |
3349 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) |
|
3349 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) |
|
3350 | 3350 | { |
3351 | 3351 | |
3352 | 3352 | // ----- Read next Central dir entry |
@@ -3385,17 +3385,17 @@ discard block |
||
3385 | 3385 | $v_extract = false; |
3386 | 3386 | |
3387 | 3387 | // ----- Look for extract by name rule |
3388 | - if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) |
|
3388 | + if ((isset($p_options[PCLZIP_OPT_BY_NAME])) |
|
3389 | 3389 | && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { |
3390 | 3390 | |
3391 | 3391 | // ----- Look if the filename is in the list |
3392 | - for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) { |
|
3392 | + for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) { |
|
3393 | 3393 | |
3394 | 3394 | // ----- Look for a directory |
3395 | 3395 | if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { |
3396 | 3396 | |
3397 | 3397 | // ----- Look if the directory is in the filename path |
3398 | - if ( (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) |
|
3398 | + if ((strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) |
|
3399 | 3399 | && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { |
3400 | 3400 | $v_extract = true; |
3401 | 3401 | } |
@@ -3420,7 +3420,7 @@ discard block |
||
3420 | 3420 | */ |
3421 | 3421 | |
3422 | 3422 | // ----- Look for extract by preg rule |
3423 | - else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) |
|
3423 | + else if ((isset($p_options[PCLZIP_OPT_BY_PREG])) |
|
3424 | 3424 | && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { |
3425 | 3425 | |
3426 | 3426 | if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { |
@@ -3429,20 +3429,20 @@ discard block |
||
3429 | 3429 | } |
3430 | 3430 | |
3431 | 3431 | // ----- Look for extract by index rule |
3432 | - else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) |
|
3432 | + else if ((isset($p_options[PCLZIP_OPT_BY_INDEX])) |
|
3433 | 3433 | && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { |
3434 | 3434 | |
3435 | 3435 | // ----- Look if the index is in the list |
3436 | - for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { |
|
3436 | + for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { |
|
3437 | 3437 | |
3438 | - if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
3438 | + if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
3439 | 3439 | $v_extract = true; |
3440 | 3440 | } |
3441 | - if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
3442 | - $j_start = $j+1; |
|
3441 | + if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
3442 | + $j_start = $j + 1; |
|
3443 | 3443 | } |
3444 | 3444 | |
3445 | - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { |
|
3445 | + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { |
|
3446 | 3446 | break; |
3447 | 3447 | } |
3448 | 3448 | } |
@@ -3454,14 +3454,14 @@ discard block |
||
3454 | 3454 | } |
3455 | 3455 | |
3456 | 3456 | // ----- Check compression method |
3457 | - if ( ($v_extract) |
|
3458 | - && ( ($v_header['compression'] != 8) |
|
3457 | + if (($v_extract) |
|
3458 | + && (($v_header['compression'] != 8) |
|
3459 | 3459 | && ($v_header['compression'] != 0))) { |
3460 | 3460 | $v_header['status'] = 'unsupported_compression'; |
3461 | 3461 | |
3462 | 3462 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
3463 | - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
3464 | - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
3463 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
3464 | + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
3465 | 3465 | |
3466 | 3466 | $this->privSwapBackMagicQuotes(); |
3467 | 3467 | |
@@ -3479,8 +3479,8 @@ discard block |
||
3479 | 3479 | $v_header['status'] = 'unsupported_encryption'; |
3480 | 3480 | |
3481 | 3481 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
3482 | - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
3483 | - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
3482 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
3483 | + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
3484 | 3484 | |
3485 | 3485 | $this->privSwapBackMagicQuotes(); |
3486 | 3486 | |
@@ -3561,7 +3561,7 @@ discard block |
||
3561 | 3561 | } |
3562 | 3562 | } |
3563 | 3563 | // ----- Look for extraction in standard output |
3564 | - elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) |
|
3564 | + elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) |
|
3565 | 3565 | && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { |
3566 | 3566 | // ----- Extracting the file in standard output |
3567 | 3567 | $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); |
@@ -3634,7 +3634,7 @@ discard block |
||
3634 | 3634 | // -------------------------------------------------------------------------------- |
3635 | 3635 | function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) |
3636 | 3636 | { |
3637 | - $v_result=1; |
|
3637 | + $v_result = 1; |
|
3638 | 3638 | |
3639 | 3639 | // ----- Read the file header |
3640 | 3640 | if (($v_result = $this->privReadFileHeader($v_header)) != 1) |
@@ -3652,7 +3652,7 @@ discard block |
||
3652 | 3652 | // ----- Look for all path to remove |
3653 | 3653 | if ($p_remove_all_path == true) { |
3654 | 3654 | // ----- Look for folder entry that not need to be extracted |
3655 | - if (($p_entry['external']&0x00000010)==0x00000010) { |
|
3655 | + if (($p_entry['external'] & 0x00000010) == 0x00000010) { |
|
3656 | 3656 | |
3657 | 3657 | $p_entry['status'] = "filtered"; |
3658 | 3658 | |
@@ -3754,8 +3754,8 @@ discard block |
||
3754 | 3754 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
3755 | 3755 | // For historical reason first PclZip implementation does not stop |
3756 | 3756 | // when this kind of error occurs. |
3757 | - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
3758 | - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
3757 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
3758 | + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
3759 | 3759 | |
3760 | 3760 | PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, |
3761 | 3761 | "Filename '".$p_entry['filename']."' is " |
@@ -3774,8 +3774,8 @@ discard block |
||
3774 | 3774 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
3775 | 3775 | // For historical reason first PclZip implementation does not stop |
3776 | 3776 | // when this kind of error occurs. |
3777 | - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
3778 | - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
3777 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
3778 | + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
3779 | 3779 | |
3780 | 3780 | PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, |
3781 | 3781 | "Filename '".$p_entry['filename']."' exists " |
@@ -3789,8 +3789,8 @@ discard block |
||
3789 | 3789 | else if (filemtime($p_entry['filename']) > $p_entry['mtime']) |
3790 | 3790 | { |
3791 | 3791 | // ----- Change the file status |
3792 | - if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) |
|
3793 | - && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) { |
|
3792 | + if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) |
|
3793 | + && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) { |
|
3794 | 3794 | } |
3795 | 3795 | else { |
3796 | 3796 | $p_entry['status'] = "newer_exist"; |
@@ -3798,8 +3798,8 @@ discard block |
||
3798 | 3798 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
3799 | 3799 | // For historical reason first PclZip implementation does not stop |
3800 | 3800 | // when this kind of error occurs. |
3801 | - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
3802 | - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
3801 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
3802 | + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
3803 | 3803 | |
3804 | 3804 | PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, |
3805 | 3805 | "Newer version of '".$p_entry['filename']."' exists " |
@@ -3815,14 +3815,14 @@ discard block |
||
3815 | 3815 | |
3816 | 3816 | // ----- Check the directory availability and create it if necessary |
3817 | 3817 | else { |
3818 | - if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) |
|
3818 | + if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) |
|
3819 | 3819 | $v_dir_to_check = $p_entry['filename']; |
3820 | 3820 | else if (!strstr($p_entry['filename'], "/")) |
3821 | 3821 | $v_dir_to_check = ""; |
3822 | 3822 | else |
3823 | 3823 | $v_dir_to_check = dirname($p_entry['filename']); |
3824 | 3824 | |
3825 | - if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { |
|
3825 | + if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external'] & 0x00000010) == 0x00000010))) != 1) { |
|
3826 | 3826 | |
3827 | 3827 | // ----- Change the file status |
3828 | 3828 | $p_entry['status'] = "path_creation_fail"; |
@@ -3838,7 +3838,7 @@ discard block |
||
3838 | 3838 | if ($p_entry['status'] == 'ok') { |
3839 | 3839 | |
3840 | 3840 | // ----- Do the extraction (if not a folder) |
3841 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) |
|
3841 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) |
|
3842 | 3842 | { |
3843 | 3843 | // ----- Look for not compressed file |
3844 | 3844 | if ($p_entry['compression'] == 0) { |
@@ -3887,10 +3887,10 @@ discard block |
||
3887 | 3887 | |
3888 | 3888 | |
3889 | 3889 | // ----- Look for using temporary file to unzip |
3890 | - if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) |
|
3890 | + if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) |
|
3891 | 3891 | && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) |
3892 | 3892 | || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) |
3893 | - && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) { |
|
3893 | + && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])))) { |
|
3894 | 3894 | $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options); |
3895 | 3895 | if ($v_result < PCLZIP_ERR_NO_ERROR) { |
3896 | 3896 | return $v_result; |
@@ -3985,7 +3985,7 @@ discard block |
||
3985 | 3985 | // -------------------------------------------------------------------------------- |
3986 | 3986 | function privExtractFileUsingTempFile(&$p_entry, &$p_options) |
3987 | 3987 | { |
3988 | - $v_result=1; |
|
3988 | + $v_result = 1; |
|
3989 | 3989 | |
3990 | 3990 | // ----- Creates a temporary file |
3991 | 3991 | $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; |
@@ -4061,7 +4061,7 @@ discard block |
||
4061 | 4061 | // -------------------------------------------------------------------------------- |
4062 | 4062 | function privExtractFileInOutput(&$p_entry, &$p_options) |
4063 | 4063 | { |
4064 | - $v_result=1; |
|
4064 | + $v_result = 1; |
|
4065 | 4065 | |
4066 | 4066 | // ----- Read the file header |
4067 | 4067 | if (($v_result = $this->privReadFileHeader($v_header)) != 1) { |
@@ -4110,7 +4110,7 @@ discard block |
||
4110 | 4110 | if ($p_entry['status'] == 'ok') { |
4111 | 4111 | |
4112 | 4112 | // ----- Do the extraction (if not a folder) |
4113 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
4113 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
4114 | 4114 | // ----- Look for not compressed file |
4115 | 4115 | if ($p_entry['compressed_size'] == $p_entry['size']) { |
4116 | 4116 | |
@@ -4173,7 +4173,7 @@ discard block |
||
4173 | 4173 | // -------------------------------------------------------------------------------- |
4174 | 4174 | function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) |
4175 | 4175 | { |
4176 | - $v_result=1; |
|
4176 | + $v_result = 1; |
|
4177 | 4177 | |
4178 | 4178 | // ----- Read the file header |
4179 | 4179 | $v_header = array(); |
@@ -4224,7 +4224,7 @@ discard block |
||
4224 | 4224 | if ($p_entry['status'] == 'ok') { |
4225 | 4225 | |
4226 | 4226 | // ----- Do the extraction (if not a folder) |
4227 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
4227 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
4228 | 4228 | // ----- Look for not compressed file |
4229 | 4229 | // if ($p_entry['compressed_size'] == $p_entry['size']) |
4230 | 4230 | if ($p_entry['compression'] == 0) { |
@@ -4296,7 +4296,7 @@ discard block |
||
4296 | 4296 | // -------------------------------------------------------------------------------- |
4297 | 4297 | function privReadFileHeader(&$p_header) |
4298 | 4298 | { |
4299 | - $v_result=1; |
|
4299 | + $v_result = 1; |
|
4300 | 4300 | |
4301 | 4301 | // ----- Read the 4 bytes signature |
4302 | 4302 | $v_binary_data = @fread($this->zip_fd, 4); |
@@ -4360,7 +4360,7 @@ discard block |
||
4360 | 4360 | // ----- Extract time |
4361 | 4361 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
4362 | 4362 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
4363 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
4363 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
4364 | 4364 | |
4365 | 4365 | // ----- Extract date |
4366 | 4366 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -4399,7 +4399,7 @@ discard block |
||
4399 | 4399 | // -------------------------------------------------------------------------------- |
4400 | 4400 | function privReadCentralFileHeader(&$p_header) |
4401 | 4401 | { |
4402 | - $v_result=1; |
|
4402 | + $v_result = 1; |
|
4403 | 4403 | |
4404 | 4404 | // ----- Read the 4 bytes signature |
4405 | 4405 | $v_binary_data = @fread($this->zip_fd, 4); |
@@ -4470,7 +4470,7 @@ discard block |
||
4470 | 4470 | // ----- Extract time |
4471 | 4471 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
4472 | 4472 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
4473 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
4473 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
4474 | 4474 | |
4475 | 4475 | // ----- Extract date |
4476 | 4476 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -4514,7 +4514,7 @@ discard block |
||
4514 | 4514 | // -------------------------------------------------------------------------------- |
4515 | 4515 | function privCheckFileHeaders(&$p_local_header, &$p_central_header) |
4516 | 4516 | { |
4517 | - $v_result=1; |
|
4517 | + $v_result = 1; |
|
4518 | 4518 | |
4519 | 4519 | // ----- Check the static values |
4520 | 4520 | // TBC |
@@ -4551,7 +4551,7 @@ discard block |
||
4551 | 4551 | // -------------------------------------------------------------------------------- |
4552 | 4552 | function privReadEndCentralDir(&$p_central_dir) |
4553 | 4553 | { |
4554 | - $v_result=1; |
|
4554 | + $v_result = 1; |
|
4555 | 4555 | |
4556 | 4556 | // ----- Go to the end of the zip file |
4557 | 4557 | $v_size = filesize($this->zipname); |
@@ -4569,8 +4569,8 @@ discard block |
||
4569 | 4569 | // in this case the end of central dir is at 22 bytes of the file end |
4570 | 4570 | $v_found = 0; |
4571 | 4571 | if ($v_size > 26) { |
4572 | - @fseek($this->zip_fd, $v_size-22); |
|
4573 | - if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22)) |
|
4572 | + @fseek($this->zip_fd, $v_size - 22); |
|
4573 | + if (($v_pos = @ftell($this->zip_fd)) != ($v_size - 22)) |
|
4574 | 4574 | { |
4575 | 4575 | // ----- Error log |
4576 | 4576 | PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); |
@@ -4596,8 +4596,8 @@ discard block |
||
4596 | 4596 | $v_maximum_size = 65557; // 0xFFFF + 22; |
4597 | 4597 | if ($v_maximum_size > $v_size) |
4598 | 4598 | $v_maximum_size = $v_size; |
4599 | - @fseek($this->zip_fd, $v_size-$v_maximum_size); |
|
4600 | - if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) |
|
4599 | + @fseek($this->zip_fd, $v_size - $v_maximum_size); |
|
4600 | + if (@ftell($this->zip_fd) != ($v_size - $v_maximum_size)) |
|
4601 | 4601 | { |
4602 | 4602 | // ----- Error log |
4603 | 4603 | PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); |
@@ -4618,7 +4618,7 @@ discard block |
||
4618 | 4618 | //$v_bytes = ($v_bytes << 8) | Ord($v_byte); |
4619 | 4619 | // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number |
4620 | 4620 | // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. |
4621 | - $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); |
|
4621 | + $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); |
|
4622 | 4622 | |
4623 | 4623 | // ----- Compare the bytes |
4624 | 4624 | if ($v_bytes == 0x504b0506) |
@@ -4708,11 +4708,11 @@ discard block |
||
4708 | 4708 | // -------------------------------------------------------------------------------- |
4709 | 4709 | function privDeleteByRule(&$p_result_list, &$p_options) |
4710 | 4710 | { |
4711 | - $v_result=1; |
|
4711 | + $v_result = 1; |
|
4712 | 4712 | $v_list_detail = array(); |
4713 | 4713 | |
4714 | 4714 | // ----- Open the zip file |
4715 | - if (($v_result=$this->privOpenFd('rb')) != 1) |
|
4715 | + if (($v_result = $this->privOpenFd('rb')) != 1) |
|
4716 | 4716 | { |
4717 | 4717 | // ----- Return |
4718 | 4718 | return $v_result; |
@@ -4748,7 +4748,7 @@ discard block |
||
4748 | 4748 | // ----- Read each entry |
4749 | 4749 | $v_header_list = array(); |
4750 | 4750 | $j_start = 0; |
4751 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) |
|
4751 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) |
|
4752 | 4752 | { |
4753 | 4753 | |
4754 | 4754 | // ----- Read the file header |
@@ -4769,21 +4769,21 @@ discard block |
||
4769 | 4769 | $v_found = false; |
4770 | 4770 | |
4771 | 4771 | // ----- Look for extract by name rule |
4772 | - if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) |
|
4772 | + if ((isset($p_options[PCLZIP_OPT_BY_NAME])) |
|
4773 | 4773 | && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { |
4774 | 4774 | |
4775 | 4775 | // ----- Look if the filename is in the list |
4776 | - for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) { |
|
4776 | + for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) { |
|
4777 | 4777 | |
4778 | 4778 | // ----- Look for a directory |
4779 | 4779 | if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { |
4780 | 4780 | |
4781 | 4781 | // ----- Look if the directory is in the filename path |
4782 | - if ( (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) |
|
4782 | + if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) |
|
4783 | 4783 | && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { |
4784 | 4784 | $v_found = true; |
4785 | 4785 | } |
4786 | - elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ |
|
4786 | + elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */ |
|
4787 | 4787 | && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { |
4788 | 4788 | $v_found = true; |
4789 | 4789 | } |
@@ -4808,7 +4808,7 @@ discard block |
||
4808 | 4808 | */ |
4809 | 4809 | |
4810 | 4810 | // ----- Look for extract by preg rule |
4811 | - else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) |
|
4811 | + else if ((isset($p_options[PCLZIP_OPT_BY_PREG])) |
|
4812 | 4812 | && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { |
4813 | 4813 | |
4814 | 4814 | if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { |
@@ -4817,20 +4817,20 @@ discard block |
||
4817 | 4817 | } |
4818 | 4818 | |
4819 | 4819 | // ----- Look for extract by index rule |
4820 | - else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) |
|
4820 | + else if ((isset($p_options[PCLZIP_OPT_BY_INDEX])) |
|
4821 | 4821 | && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { |
4822 | 4822 | |
4823 | 4823 | // ----- Look if the index is in the list |
4824 | - for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { |
|
4824 | + for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { |
|
4825 | 4825 | |
4826 | - if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
4826 | + if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
4827 | 4827 | $v_found = true; |
4828 | 4828 | } |
4829 | - if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
4830 | - $j_start = $j+1; |
|
4829 | + if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
4830 | + $j_start = $j + 1; |
|
4831 | 4831 | } |
4832 | 4832 | |
4833 | - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { |
|
4833 | + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { |
|
4834 | 4834 | break; |
4835 | 4835 | } |
4836 | 4836 | } |
@@ -4868,11 +4868,11 @@ discard block |
||
4868 | 4868 | } |
4869 | 4869 | |
4870 | 4870 | // ----- Look which file need to be kept |
4871 | - for ($i=0; $i<sizeof($v_header_list); $i++) { |
|
4871 | + for ($i = 0; $i < sizeof($v_header_list); $i++) { |
|
4872 | 4872 | |
4873 | 4873 | // ----- Calculate the position of the header |
4874 | 4874 | @rewind($this->zip_fd); |
4875 | - if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { |
|
4875 | + if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { |
|
4876 | 4876 | // ----- Close the zip file |
4877 | 4877 | $this->privCloseFd(); |
4878 | 4878 | $v_temp_zip->privCloseFd(); |
@@ -4931,7 +4931,7 @@ discard block |
||
4931 | 4931 | $v_offset = @ftell($v_temp_zip->zip_fd); |
4932 | 4932 | |
4933 | 4933 | // ----- Re-Create the Central Dir files header |
4934 | - for ($i=0; $i<sizeof($v_header_list); $i++) { |
|
4934 | + for ($i = 0; $i < sizeof($v_header_list); $i++) { |
|
4935 | 4935 | // ----- Create the file header |
4936 | 4936 | if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) { |
4937 | 4937 | $v_temp_zip->privCloseFd(); |
@@ -4954,7 +4954,7 @@ discard block |
||
4954 | 4954 | } |
4955 | 4955 | |
4956 | 4956 | // ----- Calculate the size of the central header |
4957 | - $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset; |
|
4957 | + $v_size = @ftell($v_temp_zip->zip_fd) - $v_offset; |
|
4958 | 4958 | |
4959 | 4959 | // ----- Create the central dir footer |
4960 | 4960 | if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { |
@@ -5016,15 +5016,15 @@ discard block |
||
5016 | 5016 | // 1 : OK |
5017 | 5017 | // -1 : Unable to create directory |
5018 | 5018 | // -------------------------------------------------------------------------------- |
5019 | - function privDirCheck($p_dir, $p_is_dir=false) |
|
5019 | + function privDirCheck($p_dir, $p_is_dir = false) |
|
5020 | 5020 | { |
5021 | 5021 | $v_result = 1; |
5022 | 5022 | |
5023 | 5023 | |
5024 | 5024 | // ----- Remove the final '/' |
5025 | - if (($p_is_dir) && (substr($p_dir, -1)=='/')) |
|
5025 | + if (($p_is_dir) && (substr($p_dir, -1) == '/')) |
|
5026 | 5026 | { |
5027 | - $p_dir = substr($p_dir, 0, strlen($p_dir)-1); |
|
5027 | + $p_dir = substr($p_dir, 0, strlen($p_dir) - 1); |
|
5028 | 5028 | } |
5029 | 5029 | |
5030 | 5030 | // ----- Check the directory availability |
@@ -5073,7 +5073,7 @@ discard block |
||
5073 | 5073 | // -------------------------------------------------------------------------------- |
5074 | 5074 | function privMerge(&$p_archive_to_add) |
5075 | 5075 | { |
5076 | - $v_result=1; |
|
5076 | + $v_result = 1; |
|
5077 | 5077 | |
5078 | 5078 | // ----- Look if the archive_to_add exists |
5079 | 5079 | if (!is_file($p_archive_to_add->zipname)) |
@@ -5098,7 +5098,7 @@ discard block |
||
5098 | 5098 | } |
5099 | 5099 | |
5100 | 5100 | // ----- Open the zip file |
5101 | - if (($v_result=$this->privOpenFd('rb')) != 1) |
|
5101 | + if (($v_result = $this->privOpenFd('rb')) != 1) |
|
5102 | 5102 | { |
5103 | 5103 | // ----- Return |
5104 | 5104 | return $v_result; |
@@ -5116,7 +5116,7 @@ discard block |
||
5116 | 5116 | @rewind($this->zip_fd); |
5117 | 5117 | |
5118 | 5118 | // ----- Open the archive_to_add file |
5119 | - if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1) |
|
5119 | + if (($v_result = $p_archive_to_add->privOpenFd('rb')) != 1) |
|
5120 | 5120 | { |
5121 | 5121 | $this->privCloseFd(); |
5122 | 5122 | |
@@ -5200,7 +5200,7 @@ discard block |
||
5200 | 5200 | $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment']; |
5201 | 5201 | |
5202 | 5202 | // ----- Calculate the size of the (new) central header |
5203 | - $v_size = @ftell($v_zip_temp_fd)-$v_offset; |
|
5203 | + $v_size = @ftell($v_zip_temp_fd) - $v_offset; |
|
5204 | 5204 | |
5205 | 5205 | // ----- Swap the file descriptor |
5206 | 5206 | // Here is a trick : I swap the temporary fd with the zip fd, in order to use |
@@ -5210,7 +5210,7 @@ discard block |
||
5210 | 5210 | $v_zip_temp_fd = $v_swap; |
5211 | 5211 | |
5212 | 5212 | // ----- Create the central dir footer |
5213 | - if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) |
|
5213 | + if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries'] + $v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) |
|
5214 | 5214 | { |
5215 | 5215 | $this->privCloseFd(); |
5216 | 5216 | $p_archive_to_add->privCloseFd(); |
@@ -5258,7 +5258,7 @@ discard block |
||
5258 | 5258 | // -------------------------------------------------------------------------------- |
5259 | 5259 | function privDuplicate($p_archive_filename) |
5260 | 5260 | { |
5261 | - $v_result=1; |
|
5261 | + $v_result = 1; |
|
5262 | 5262 | |
5263 | 5263 | // ----- Look if the $p_archive_filename exists |
5264 | 5264 | if (!is_file($p_archive_filename)) |
@@ -5272,7 +5272,7 @@ discard block |
||
5272 | 5272 | } |
5273 | 5273 | |
5274 | 5274 | // ----- Open the zip file |
5275 | - if (($v_result=$this->privOpenFd('wb')) != 1) |
|
5275 | + if (($v_result = $this->privOpenFd('wb')) != 1) |
|
5276 | 5276 | { |
5277 | 5277 | // ----- Return |
5278 | 5278 | return $v_result; |
@@ -5316,7 +5316,7 @@ discard block |
||
5316 | 5316 | // Description : |
5317 | 5317 | // Parameters : |
5318 | 5318 | // -------------------------------------------------------------------------------- |
5319 | - function privErrorLog($p_error_code=0, $p_error_string='') |
|
5319 | + function privErrorLog($p_error_code = 0, $p_error_string = '') |
|
5320 | 5320 | { |
5321 | 5321 | if (PCLZIP_ERROR_EXTERNAL == 1) { |
5322 | 5322 | PclError($p_error_code, $p_error_string); |
@@ -5353,10 +5353,10 @@ discard block |
||
5353 | 5353 | // -------------------------------------------------------------------------------- |
5354 | 5354 | function privDisableMagicQuotes() |
5355 | 5355 | { |
5356 | - $v_result=1; |
|
5356 | + $v_result = 1; |
|
5357 | 5357 | |
5358 | 5358 | // ----- Look if function exists |
5359 | - if ( (!function_exists("get_magic_quotes_runtime")) |
|
5359 | + if ((!function_exists("get_magic_quotes_runtime")) |
|
5360 | 5360 | || (!function_exists("set_magic_quotes_runtime"))) { |
5361 | 5361 | return $v_result; |
5362 | 5362 | } |
@@ -5387,10 +5387,10 @@ discard block |
||
5387 | 5387 | // -------------------------------------------------------------------------------- |
5388 | 5388 | function privSwapBackMagicQuotes() |
5389 | 5389 | { |
5390 | - $v_result=1; |
|
5390 | + $v_result = 1; |
|
5391 | 5391 | |
5392 | 5392 | // ----- Look if function exists |
5393 | - if ( (!function_exists("get_magic_quotes_runtime")) |
|
5393 | + if ((!function_exists("get_magic_quotes_runtime")) |
|
5394 | 5394 | || (!function_exists("set_magic_quotes_runtime"))) { |
5395 | 5395 | return $v_result; |
5396 | 5396 | } |
@@ -5431,7 +5431,7 @@ discard block |
||
5431 | 5431 | |
5432 | 5432 | // ----- Study directories from last to first |
5433 | 5433 | $v_skip = 0; |
5434 | - for ($i=sizeof($v_list)-1; $i>=0; $i--) { |
|
5434 | + for ($i = sizeof($v_list) - 1; $i >= 0; $i--) { |
|
5435 | 5435 | // ----- Look for current path |
5436 | 5436 | if ($v_list[$i] == ".") { |
5437 | 5437 | // ----- Ignore this directory |
@@ -5452,7 +5452,7 @@ discard block |
||
5452 | 5452 | } |
5453 | 5453 | } |
5454 | 5454 | // ----- Last '/' i.e. indicates a directory |
5455 | - else if ($i == (sizeof($v_list)-1)) { |
|
5455 | + else if ($i == (sizeof($v_list) - 1)) { |
|
5456 | 5456 | $v_result = $v_list[$i]; |
5457 | 5457 | } |
5458 | 5458 | // ----- Double '/' inside the path |
@@ -5467,7 +5467,7 @@ discard block |
||
5467 | 5467 | $v_skip--; |
5468 | 5468 | } |
5469 | 5469 | else { |
5470 | - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); |
|
5470 | + $v_result = $v_list[$i].($i != (sizeof($v_list) - 1) ? "/".$v_result : ""); |
|
5471 | 5471 | } |
5472 | 5472 | } |
5473 | 5473 | } |
@@ -5506,12 +5506,12 @@ discard block |
||
5506 | 5506 | $v_result = 1; |
5507 | 5507 | |
5508 | 5508 | // ----- Look for path beginning by ./ |
5509 | - if ( ($p_dir == '.') |
|
5510 | - || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { |
|
5509 | + if (($p_dir == '.') |
|
5510 | + || ((strlen($p_dir) >= 2) && (substr($p_dir, 0, 2) == './'))) { |
|
5511 | 5511 | $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1); |
5512 | 5512 | } |
5513 | - if ( ($p_path == '.') |
|
5514 | - || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) { |
|
5513 | + if (($p_path == '.') |
|
5514 | + || ((strlen($p_path) >= 2) && (substr($p_path, 0, 2) == './'))) { |
|
5515 | 5515 | $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1); |
5516 | 5516 | } |
5517 | 5517 | |
@@ -5537,7 +5537,7 @@ discard block |
||
5537 | 5537 | } |
5538 | 5538 | |
5539 | 5539 | // ----- Compare the items |
5540 | - if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) { |
|
5540 | + if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ($v_list_path[$j] != '')) { |
|
5541 | 5541 | $v_result = 0; |
5542 | 5542 | } |
5543 | 5543 | |
@@ -5578,11 +5578,11 @@ discard block |
||
5578 | 5578 | // 3 : src & dest gzip |
5579 | 5579 | // Return Values : |
5580 | 5580 | // -------------------------------------------------------------------------------- |
5581 | - function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0) |
|
5581 | + function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) |
|
5582 | 5582 | { |
5583 | 5583 | $v_result = 1; |
5584 | 5584 | |
5585 | - if ($p_mode==0) |
|
5585 | + if ($p_mode == 0) |
|
5586 | 5586 | { |
5587 | 5587 | while ($p_size != 0) |
5588 | 5588 | { |
@@ -5592,7 +5592,7 @@ discard block |
||
5592 | 5592 | $p_size -= $v_read_size; |
5593 | 5593 | } |
5594 | 5594 | } |
5595 | - else if ($p_mode==1) |
|
5595 | + else if ($p_mode == 1) |
|
5596 | 5596 | { |
5597 | 5597 | while ($p_size != 0) |
5598 | 5598 | { |
@@ -5602,7 +5602,7 @@ discard block |
||
5602 | 5602 | $p_size -= $v_read_size; |
5603 | 5603 | } |
5604 | 5604 | } |
5605 | - else if ($p_mode==2) |
|
5605 | + else if ($p_mode == 2) |
|
5606 | 5606 | { |
5607 | 5607 | while ($p_size != 0) |
5608 | 5608 | { |
@@ -5612,7 +5612,7 @@ discard block |
||
5612 | 5612 | $p_size -= $v_read_size; |
5613 | 5613 | } |
5614 | 5614 | } |
5615 | - else if ($p_mode==3) |
|
5615 | + else if ($p_mode == 3) |
|
5616 | 5616 | { |
5617 | 5617 | while ($p_size != 0) |
5618 | 5618 | { |
@@ -5676,7 +5676,7 @@ discard block |
||
5676 | 5676 | $v_list = get_defined_constants(); |
5677 | 5677 | for (reset($v_list); $v_key = key($v_list); next($v_list)) { |
5678 | 5678 | $v_prefix = substr($v_key, 0, 10); |
5679 | - if (( ($v_prefix == 'PCLZIP_OPT') |
|
5679 | + if ((($v_prefix == 'PCLZIP_OPT') |
|
5680 | 5680 | || ($v_prefix == 'PCLZIP_CB_') |
5681 | 5681 | || ($v_prefix == 'PCLZIP_ATT')) |
5682 | 5682 | && ($v_list[$v_key] == $p_option)) { |
@@ -5701,15 +5701,15 @@ discard block |
||
5701 | 5701 | // Return Values : |
5702 | 5702 | // The path translated. |
5703 | 5703 | // -------------------------------------------------------------------------------- |
5704 | - function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true) |
|
5704 | + function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true) |
|
5705 | 5705 | { |
5706 | 5706 | if (stristr(php_uname(), 'windows')) { |
5707 | 5707 | // ----- Look for potential disk letter |
5708 | 5708 | if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { |
5709 | - $p_path = substr($p_path, $v_position+1); |
|
5709 | + $p_path = substr($p_path, $v_position + 1); |
|
5710 | 5710 | } |
5711 | 5711 | // ----- Change potential windows directory separator |
5712 | - if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { |
|
5712 | + if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) { |
|
5713 | 5713 | $p_path = strtr($p_path, '\\', '/'); |
5714 | 5714 | } |
5715 | 5715 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | /* More info @ http://mpdf1.com/manual/index.php?tid=184&searchstring=mPDF |
32 | 32 | * mPDF ([ string $mode [, mixed $format [, float $default_font_size [, string $default_font [, float $margin_left , float $margin_right , float $margin_top , float $margin_bottom , float $margin_header , float $margin_footer [, string $orientation ]]]]]]) |
33 | 33 | */ |
34 | - if (!in_array($orientation, array('P','L'))) { |
|
34 | + if (!in_array($orientation, array('P', 'L'))) { |
|
35 | 35 | $orientation = 'P'; |
36 | 36 | } |
37 | 37 | //$this->pdf = $pdf = new mPDF('UTF-8', $pageFormat, '', '', 30, 20, 27, 25, 16, 13, $orientation); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $visualTheme = api_get_visual_theme(); |
112 | 112 | $img = api_get_path(SYS_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png'; |
113 | 113 | if (file_exists($img)) { |
114 | - $img = api_get_path(WEB_CSS_PATH) . 'themes/' . $visualTheme . '/images/pdf_logo_header.png'; |
|
114 | + $img = api_get_path(WEB_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png'; |
|
115 | 115 | $organization = "<img src='$img'>"; |
116 | 116 | } |
117 | 117 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | // Clean styles and javascript document |
232 | - $clean_search = array ( |
|
232 | + $clean_search = array( |
|
233 | 233 | '@<script[^>]*?>.*?</script>@si', |
234 | 234 | '@<style[^>]*?>.*?</style>@si' |
235 | 235 | ); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | // then print the title in the PDF |
251 | 251 | if (is_array($file) && isset($file['title'])) { |
252 | 252 | $html_title = $file['title']; |
253 | - $file = $file['path']; |
|
253 | + $file = $file['path']; |
|
254 | 254 | } else { |
255 | 255 | //we suppose we've only been sent a file path |
256 | 256 | $html_title = basename($file); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | //it's not a chapter but the file exists, print its title |
283 | 283 | if ($print_title) { |
284 | 284 | $this->pdf->WriteHTML( |
285 | - '<html><body><h3>' . $html_title . '</h3></body></html>', |
|
285 | + '<html><body><h3>'.$html_title.'</h3></body></html>', |
|
286 | 286 | 2 |
287 | 287 | ); |
288 | 288 | } |
@@ -292,12 +292,12 @@ discard block |
||
292 | 292 | |
293 | 293 | if (in_array($extension, array('html', 'htm'))) { |
294 | 294 | $filename = $file_info['basename']; |
295 | - $filename = str_replace('_',' ',$filename); |
|
295 | + $filename = str_replace('_', ' ', $filename); |
|
296 | 296 | |
297 | 297 | if ($extension == 'html') { |
298 | - $filename = basename($filename,'.html'); |
|
299 | - } elseif($extension == 'htm'){ |
|
300 | - $filename = basename($filename,'.htm'); |
|
298 | + $filename = basename($filename, '.html'); |
|
299 | + } elseif ($extension == 'htm') { |
|
300 | + $filename = basename($filename, '.htm'); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | $document_html = @file_get_contents($file); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $document_html = str_replace('href="./css/frames.css"', $absolute_css_path, $document_html); |
309 | 309 | |
310 | 310 | if (!empty($course_data['path'])) { |
311 | - $document_html= str_replace('../','', $document_html); |
|
311 | + $document_html = str_replace('../', '', $document_html); |
|
312 | 312 | $document_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/'; |
313 | 313 | |
314 | 314 | $doc = new DOMDocument(); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $new_path = $old_src; |
341 | 341 | } |
342 | 342 | |
343 | - $document_html= str_replace($old_src, $new_path, $document_html); |
|
343 | + $document_html = str_replace($old_src, $new_path, $document_html); |
|
344 | 344 | } |
345 | 345 | } else { |
346 | 346 | //Check if this is a complete URL |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | if (!empty($document_html)) { |
369 | 369 | $this->pdf->WriteHTML($document_html.$page_break, 2); |
370 | 370 | } |
371 | - } elseif (in_array($extension, array('jpg','jpeg','png','gif'))) { |
|
371 | + } elseif (in_array($extension, array('jpg', 'jpeg', 'png', 'gif'))) { |
|
372 | 372 | //Images |
373 | 373 | $image = Display::img($file); |
374 | 374 | $this->pdf->WriteHTML('<html><body>'.$image.'</body></html>'.$page_break, 2); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | } |
418 | 418 | |
419 | 419 | //clean styles and javascript document |
420 | - $clean_search = array ( |
|
420 | + $clean_search = array( |
|
421 | 421 | '@<script[^>]*?>.*?</script>@si', |
422 | 422 | '@<style[^>]*?>.*?</style>@siU' |
423 | 423 | ); |
@@ -431,11 +431,11 @@ discard block |
||
431 | 431 | |
432 | 432 | //absolute path for frames.css //TODO: necessary? |
433 | 433 | $absolute_css_path = api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/frames.css'; |
434 | - $document_html = str_replace('href="./css/frames.css"','href="'.$absolute_css_path.'"', $document_html); |
|
434 | + $document_html = str_replace('href="./css/frames.css"', 'href="'.$absolute_css_path.'"', $document_html); |
|
435 | 435 | |
436 | - $document_html= str_replace('../../','',$document_html); |
|
437 | - $document_html= str_replace('../','',$document_html); |
|
438 | - $document_html= str_replace((empty($_configuration['url_append'])?'':$_configuration['url_append'].'/').'courses/'.$course_code.'/document/','',$document_html); |
|
436 | + $document_html = str_replace('../../', '', $document_html); |
|
437 | + $document_html = str_replace('../', '', $document_html); |
|
438 | + $document_html = str_replace((empty($_configuration['url_append']) ? '' : $_configuration['url_append'].'/').'courses/'.$course_code.'/document/', '', $document_html); |
|
439 | 439 | |
440 | 440 | if (!empty($course_data['path'])) { |
441 | 441 | $document_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/'; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $old_src_fixed = str_replace('/courses/'.$course_data['path'].'/document/', '', $old_src); |
457 | 457 | $old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src_fixed); |
458 | 458 | $new_path = $document_path.$old_src_fixed; |
459 | - $document_html= str_replace($old_src, $new_path, $document_html); |
|
459 | + $document_html = str_replace($old_src, $new_path, $document_html); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | } |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | //$document_html= str_replace('temp_template_path', 'src="/main/default_course_document/', $document_html);// restore src templates |
476 | 476 | |
477 | 477 | api_set_encoding_html($document_html, 'UTF-8'); // The library mPDF expects UTF-8 encoded input data. |
478 | - $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through |
|
478 | + $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through |
|
479 | 479 | // $_GET[] too, as it is done with file name. |
480 | 480 | // At the moment the title is retrieved from the html document itself. |
481 | 481 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | //$this->pdf->Output($output_file, $outputMode); // F to save the pdf in a file |
498 | 498 | |
499 | 499 | if ($outputMode == 'F') { |
500 | - $output_file = api_get_path(SYS_ARCHIVE_PATH) . $output_file; |
|
500 | + $output_file = api_get_path(SYS_ARCHIVE_PATH).$output_file; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | if ($saveInFile) { |
@@ -530,14 +530,14 @@ discard block |
||
530 | 530 | $web_path = false; |
531 | 531 | if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') { |
532 | 532 | $course_info = api_get_course_info($course_code); |
533 | - $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
533 | + $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
534 | 534 | if (file_exists($store_path)) { |
535 | - $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
535 | + $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
536 | 536 | } |
537 | 537 | } else { |
538 | - $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
538 | + $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
539 | 539 | if (file_exists($store_path)) |
540 | - $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
540 | + $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
541 | 541 | } |
542 | 542 | return $web_path; |
543 | 543 | } |
@@ -576,10 +576,10 @@ discard block |
||
576 | 576 | { |
577 | 577 | if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') { |
578 | 578 | $course_info = api_get_course_info($course_code); |
579 | - $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path |
|
579 | + $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path |
|
580 | 580 | $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/pdf_watermark.png'; |
581 | 581 | } else { |
582 | - $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path |
|
582 | + $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path |
|
583 | 583 | $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
584 | 584 | } |
585 | 585 | $course_image = $store_path.'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
@@ -614,9 +614,9 @@ discard block |
||
614 | 614 | */ |
615 | 615 | public function set_footer() |
616 | 616 | { |
617 | - $this->pdf->defaultfooterfontsize = 12; // in pts |
|
618 | - $this->pdf->defaultfooterfontstyle = B; // blank, B, I, or BI |
|
619 | - $this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer |
|
617 | + $this->pdf->defaultfooterfontsize = 12; // in pts |
|
618 | + $this->pdf->defaultfooterfontstyle = B; // blank, B, I, or BI |
|
619 | + $this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer |
|
620 | 620 | $platform_name = api_get_setting('Institution'); |
621 | 621 | $left_content = $platform_name; |
622 | 622 | $center_content = ''; |
@@ -682,9 +682,9 @@ discard block |
||
682 | 682 | */ |
683 | 683 | public function set_header($course_data) |
684 | 684 | { |
685 | - $this->pdf->defaultheaderfontsize = 10; // in pts |
|
686 | - $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI |
|
687 | - $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer |
|
685 | + $this->pdf->defaultheaderfontsize = 10; // in pts |
|
686 | + $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI |
|
687 | + $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer |
|
688 | 688 | |
689 | 689 | if (!empty($course_data['code'])) { |
690 | 690 | $teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']); |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | if (!empty($teacher_list)) { |
694 | 694 | |
695 | 695 | foreach ($teacher_list as $teacher) { |
696 | - $teachers[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
696 | + $teachers[] = $teacher['firstname'].' '.$teacher['lastname']; |
|
697 | 697 | } |
698 | 698 | if (count($teachers) > 1) { |
699 | 699 | $teachers = get_lang('Teachers').': '.implode(', ', $teachers); |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | 'line' => 1, |
761 | 761 | ), |
762 | 762 | ); |
763 | - $this->pdf->SetHeader($header);// ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title); |
|
763 | + $this->pdf->SetHeader($header); // ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title); |
|
764 | 764 | } |
765 | 765 | } |
766 | 766 | |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | $this->pdf->directionality = api_get_text_direction(); |
806 | 806 | $this->pdf->useOnlyCoreFonts = true; |
807 | 807 | // Use different Odd/Even headers and footers and mirror margins |
808 | - $this->pdf->mirrorMargins = 1; |
|
808 | + $this->pdf->mirrorMargins = 1; |
|
809 | 809 | |
810 | 810 | // Add decoration only if not stated otherwise |
811 | 811 | if ($complete) { |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | $watermark_text = api_get_setting('pdf_export_watermark_text'); |
834 | 834 | } |
835 | 835 | if (!empty($watermark_text)) { |
836 | - $this->pdf->SetWatermarkText(strcode2utf($watermark_text),0.1); |
|
836 | + $this->pdf->SetWatermarkText(strcode2utf($watermark_text), 0.1); |
|
837 | 837 | $this->pdf->showWatermarkText = true; |
838 | 838 | } |
839 | 839 | } |
@@ -841,8 +841,8 @@ discard block |
||
841 | 841 | if (empty($this->custom_header)) { |
842 | 842 | self::set_header($course_data); |
843 | 843 | } else { |
844 | - $this->pdf->SetHTMLHeader($this->custom_header,'E'); |
|
845 | - $this->pdf->SetHTMLHeader($this->custom_header,'O'); |
|
844 | + $this->pdf->SetHTMLHeader($this->custom_header, 'E'); |
|
845 | + $this->pdf->SetHTMLHeader($this->custom_header, 'O'); |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | if (empty($this->custom_footer)) { |
@@ -41,9 +41,9 @@ |
||
41 | 41 | */ |
42 | 42 | function _createElements() |
43 | 43 | { |
44 | - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); |
|
44 | + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); |
|
45 | 45 | $this->_elements[0]->setChecked(true); |
46 | - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')')); |
|
46 | + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array('onclick' => 'javascript:receivers_show(\'receivers_to\')')); |
|
47 | 47 | $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); |
48 | 48 | $this->_elements[2]->setSelected($this->receivers_selected); |
49 | 49 | } |
@@ -88,7 +88,7 @@ |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | $timePicker = 'true'; |
91 | - $timePickerValue = $this->getAttribute('timePicker'); |
|
91 | + $timePickerValue = $this->getAttribute('timePicker'); |
|
92 | 92 | if (!empty($timePickerValue)) { |
93 | 93 | $timePicker = $timePickerValue; |
94 | 94 | } |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | $value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H); |
45 | 45 | } |
46 | 46 | |
47 | - return $this->getElementJS() . ' |
|
47 | + return $this->getElementJS().' |
|
48 | 48 | <div class="input-group"> |
49 | 49 | <span class="input-group-addon"> |
50 | - <input ' . $this->_getAttrString($this->_attributes) . '> |
|
50 | + <input ' . $this->_getAttrString($this->_attributes).'> |
|
51 | 51 | </span> |
52 | - <input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '"> |
|
52 | + <input class="form-control" type="text" readonly id="' . $id.'_alt" value="'.$value.'"> |
|
53 | 53 | </div> |
54 | 54 | '; |
55 | 55 | } |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | $js .= "<script> |
80 | 80 | $(function() { |
81 | 81 | $('#$id').hide().datepicker({ |
82 | - defaultDate: '" . $this->getValue() . "', |
|
82 | + defaultDate: '".$this->getValue()."', |
|
83 | 83 | dateFormat: 'yy-mm-dd', |
84 | 84 | altField: '#{$id}_alt', |
85 | - altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\", |
|
85 | + altFormat: \"".get_lang('DateFormatLongNoDayJS')."\", |
|
86 | 86 | showOn: 'both', |
87 | - buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "', |
|
87 | + buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."', |
|
88 | 88 | buttonImageOnly: true, |
89 | - buttonText: '" . get_lang('SelectDate') . "', |
|
89 | + buttonText: '" . get_lang('SelectDate')."', |
|
90 | 90 | changeMonth: true, |
91 | 91 | changeYear: true, |
92 | 92 | yearRange: 'c-60y:c+5y' |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $iso = api_get_language_isocode(api_get_interface_language()); |
26 | 26 | $languageCondition = ''; |
27 | 27 | |
28 | - if (file_exists(api_get_path(SYS_PATH) . "web/assets/select2/dist/js/i18n/$iso.js")) { |
|
28 | + if (file_exists(api_get_path(SYS_PATH)."web/assets/select2/dist/js/i18n/$iso.js")) { |
|
29 | 29 | $html .= api_get_asset("select2/dist/js/i18n/$iso.js"); |
30 | 30 | $languageCondition = "language: '$iso',"; |
31 | 31 | } |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | //Get the minimumInputLength for select2 |
52 | 52 | $minimumInputLength = $this->getAttribute('minimumInputLength') > 3 ? |
53 | - $this->getAttribute('minimumInputLength') : |
|
54 | - 3 |
|
53 | + $this->getAttribute('minimumInputLength') : 3 |
|
55 | 54 | ; |
56 | 55 | |
57 | 56 | $plHolder = $this->getAttribute('placeholder'); |
@@ -113,6 +112,6 @@ discard block |
||
113 | 112 | $this->removeAttribute('url_function'); |
114 | 113 | $this->setAttribute('style', 'width: 100%;'); |
115 | 114 | |
116 | - return parent::toHtml() . $html; |
|
115 | + return parent::toHtml().$html; |
|
117 | 116 | } |
118 | 117 | } |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | $value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H); |
39 | 39 | } |
40 | 40 | |
41 | - return $this->getElementJS() . ' |
|
41 | + return $this->getElementJS().' |
|
42 | 42 | <div class="input-group"> |
43 | 43 | <span class="input-group-addon"> |
44 | - <input ' . $this->_getAttrString($this->_attributes) . '> |
|
44 | + <input ' . $this->_getAttrString($this->_attributes).'> |
|
45 | 45 | </span> |
46 | - <input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '"> |
|
46 | + <input class="form-control" type="text" readonly id="' . $id.'_alt" value="'.$value.'"> |
|
47 | 47 | </div> |
48 | 48 | '; |
49 | 49 | } |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | $js .= "<script> |
74 | 74 | $(function() { |
75 | 75 | $('#$id').hide().datetimepicker({ |
76 | - defaultDate: '" . $this->getValue() . "', |
|
76 | + defaultDate: '".$this->getValue()."', |
|
77 | 77 | dateFormat: 'yy-mm-dd', |
78 | 78 | timeFormat: 'HH:mm', |
79 | 79 | altField: '#{$id}_alt', |
80 | - altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\", |
|
81 | - altTimeFormat: \"" . get_lang('TimeFormatNoSecJS') . "\", |
|
82 | - altSeparator: \" " . get_lang('AtTime') . " \", |
|
80 | + altFormat: \"".get_lang('DateFormatLongNoDayJS')."\", |
|
81 | + altTimeFormat: \"" . get_lang('TimeFormatNoSecJS')."\", |
|
82 | + altSeparator: \" " . get_lang('AtTime')." \", |
|
83 | 83 | altFieldTimeOnly: false, |
84 | 84 | showOn: 'both', |
85 | - buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "', |
|
85 | + buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."', |
|
86 | 86 | buttonImageOnly: true, |
87 | - buttonText: '" . get_lang('SelectDate') . "', |
|
87 | + buttonText: '" . get_lang('SelectDate')."', |
|
88 | 88 | changeMonth: true, |
89 | 89 | changeYear: true |
90 | 90 | }); |