@@ -40,6 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Sets library name |
43 | + * @param string $name |
|
43 | 44 | */ |
44 | 45 | public function setLibraryName($name) |
45 | 46 | { |
@@ -56,6 +57,7 @@ discard block |
||
56 | 57 | |
57 | 58 | /** |
58 | 59 | * Sets the template id |
60 | + * @param integer $id |
|
59 | 61 | */ |
60 | 62 | public function setTemplateId($id) |
61 | 63 | { |
@@ -72,6 +74,7 @@ discard block |
||
72 | 74 | |
73 | 75 | /** |
74 | 76 | * Sets the record id |
77 | + * @param integer $id |
|
75 | 78 | */ |
76 | 79 | public function setRecordId($id) |
77 | 80 | { |
@@ -88,6 +91,7 @@ discard block |
||
88 | 91 | |
89 | 92 | /** |
90 | 93 | * Sets module name |
94 | + * @param string $name |
|
91 | 95 | */ |
92 | 96 | public function setModuleName($name) |
93 | 97 | { |
@@ -248,6 +252,7 @@ discard block |
||
248 | 252 | |
249 | 253 | /** |
250 | 254 | * Set header content |
255 | + * @param string $name |
|
251 | 256 | */ |
252 | 257 | public function setHeader($name, $header) |
253 | 258 | { |
@@ -257,6 +262,7 @@ discard block |
||
257 | 262 | |
258 | 263 | /** |
259 | 264 | * Set footer content |
265 | + * @param string $name |
|
260 | 266 | */ |
261 | 267 | public function setFooter($name, $footer) |
262 | 268 | { |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Function to get the Display Value, for the current field type with given DB Insert Value |
25 | - * @param <Object> $value |
|
25 | + * @param <Object> $values |
|
26 | 26 | * @return <Object> |
27 | 27 | */ |
28 | 28 | public function getDisplayValue($values, $record = false, $recordInstance = false, $rawText = false) |
@@ -27,8 +27,9 @@ |
||
27 | 27 | */ |
28 | 28 | public function getDisplayValue($values, $record = false, $recordInstance = false, $rawText = false) |
29 | 29 | { |
30 | - if ($values === null && !is_array($values)) |
|
31 | - return; |
|
30 | + if ($values === null && !is_array($values)) { |
|
31 | + return; |
|
32 | + } |
|
32 | 33 | foreach ($values as $value) { |
33 | 34 | if (self::getOwnerType($value) === 'User') { |
34 | 35 | $userModel = Users_Record_Model::getCleanInstance('Users'); |
@@ -25,7 +25,6 @@ discard block |
||
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Function to get the Display Value, for the current field type with given DB Insert Value |
28 | - * @param <Object> $value |
|
29 | 28 | * @return <Object> |
30 | 29 | */ |
31 | 30 | public function getDisplayValue($tree, $record = false, $recordInstance = false, $rawText = false) |
@@ -77,7 +76,6 @@ discard block |
||
77 | 76 | |
78 | 77 | /** |
79 | 78 | * Function to get the all Values |
80 | - * @param <Object> $value |
|
81 | 79 | * @return <Object> |
82 | 80 | */ |
83 | 81 | public function getAllValue() |
@@ -9,6 +9,9 @@ |
||
9 | 9 | * *********************************************************************************** */ |
10 | 10 | require_once 'modules/WSAPP/SyncServer.php'; |
11 | 11 | |
12 | +/** |
|
13 | + * @param string $type |
|
14 | + */ |
|
12 | 15 | function wsapp_register($type, $syncType, $user) |
13 | 16 | { |
14 | 17 | $instance = new SyncServer(); |
@@ -56,6 +56,9 @@ |
||
56 | 56 | return $this->syncController; |
57 | 57 | } |
58 | 58 | |
59 | + /** |
|
60 | + * @param WSAPP_SynchronizeController $syncController |
|
61 | + */ |
|
59 | 62 | public function setSynchronizeController($syncController) |
60 | 63 | { |
61 | 64 | $this->syncController = $syncController; |
@@ -63,6 +63,9 @@ |
||
63 | 63 | return new WSAPP_VtigerModel($data); |
64 | 64 | } |
65 | 65 | |
66 | + /** |
|
67 | + * @return WSAPP_SyncStateModel |
|
68 | + */ |
|
66 | 69 | public function getSyncStateModel($connector) |
67 | 70 | { |
68 | 71 | return $connector->getSyncState($this->getSourceType())->setType($this->getSourceType()); |
@@ -150,15 +150,19 @@ |
||
150 | 150 | { |
151 | 151 | $records = array(); |
152 | 152 | if ($pullTargetFirst) { |
153 | - if ($push) |
|
154 | - $records['push'] = $this->synchronizePush(); |
|
155 | - if ($pull) |
|
156 | - $records['pull'] = $this->synchronizePull(); |
|
153 | + if ($push) { |
|
154 | + $records['push'] = $this->synchronizePush(); |
|
155 | + } |
|
156 | + if ($pull) { |
|
157 | + $records['pull'] = $this->synchronizePull(); |
|
158 | + } |
|
157 | 159 | } else { |
158 | - if ($pull) |
|
159 | - $records['pull'] = $this->synchronizePull(); |
|
160 | - if ($push) |
|
161 | - $records['push'] = $this->synchronizePush(); |
|
160 | + if ($pull) { |
|
161 | + $records['pull'] = $this->synchronizePull(); |
|
162 | + } |
|
163 | + if ($push) { |
|
164 | + $records['push'] = $this->synchronizePush(); |
|
165 | + } |
|
162 | 166 | } |
163 | 167 | return $records; |
164 | 168 | } |
@@ -29,12 +29,18 @@ |
||
29 | 29 | return $this; |
30 | 30 | } |
31 | 31 | |
32 | + /** |
|
33 | + * @param string $key |
|
34 | + */ |
|
32 | 35 | public function set($key, $value) |
33 | 36 | { |
34 | 37 | $this->data[$key] = $value; |
35 | 38 | return $this; |
36 | 39 | } |
37 | 40 | |
41 | + /** |
|
42 | + * @param string $key |
|
43 | + */ |
|
38 | 44 | public function get($key) |
39 | 45 | { |
40 | 46 | return $this->data[$key]; |
@@ -280,6 +280,10 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | // Private (you should NOT call these methods): |
283 | + |
|
284 | + /** |
|
285 | + * @param string $content |
|
286 | + */ |
|
283 | 287 | public function uncompress($content, $mode, $uncompressedSize, $targetFileName = false) |
284 | 288 | { |
285 | 289 | switch ($mode) { |
@@ -328,6 +332,9 @@ discard block |
||
328 | 332 | } |
329 | 333 | } |
330 | 334 | |
335 | + /** |
|
336 | + * @param integer $level |
|
337 | + */ |
|
331 | 338 | public function debugMsg($level, $string) |
332 | 339 | { |
333 | 340 | if ($this->debug) |
@@ -128,16 +128,18 @@ discard block |
||
128 | 128 | foreach ($this->compressedList as $fileName => $item) { |
129 | 129 | if (!$kkk && $kkk = 1) { |
130 | 130 | echo "<tr style='background: #ADA'>"; |
131 | - foreach ($item as $fieldName => $value) |
|
132 | - echo "<td>$fieldName</td>"; |
|
131 | + foreach ($item as $fieldName => $value) { |
|
132 | + echo "<td>$fieldName</td>"; |
|
133 | + } |
|
133 | 134 | echo '</tr>'; |
134 | 135 | } |
135 | 136 | echo "<tr style='background: #CFC'>"; |
136 | 137 | foreach ($item as $fieldName => $value) { |
137 | - if ($fieldName == 'lastmod_datetime') |
|
138 | - echo "<td title='$fieldName' nowrap='nowrap'>" . date("d/m/Y H:i:s", $value) . "</td>"; |
|
139 | - else |
|
140 | - echo "<td title='$fieldName' nowrap='nowrap'>$value</td>"; |
|
138 | + if ($fieldName == 'lastmod_datetime') { |
|
139 | + echo "<td title='$fieldName' nowrap='nowrap'>" . date("d/m/Y H:i:s", $value) . "</td>"; |
|
140 | + } else { |
|
141 | + echo "<td title='$fieldName' nowrap='nowrap'>$value</td>"; |
|
142 | + } |
|
141 | 143 | } |
142 | 144 | echo "</tr>"; |
143 | 145 | } |
@@ -150,16 +152,18 @@ discard block |
||
150 | 152 | foreach ($this->centralDirList as $fileName => $item) { |
151 | 153 | if (!$kkk && $kkk = 1) { |
152 | 154 | echo "<tr style='background: #AAD'>"; |
153 | - foreach ($item as $fieldName => $value) |
|
154 | - echo "<td>$fieldName</td>"; |
|
155 | + foreach ($item as $fieldName => $value) { |
|
156 | + echo "<td>$fieldName</td>"; |
|
157 | + } |
|
155 | 158 | echo '</tr>'; |
156 | 159 | } |
157 | 160 | echo "<tr style='background: #CCF'>"; |
158 | 161 | foreach ($item as $fieldName => $value) { |
159 | - if ($fieldName == 'lastmod_datetime') |
|
160 | - echo "<td title='$fieldName' nowrap='nowrap'>" . date("d/m/Y H:i:s", $value) . "</td>"; |
|
161 | - else |
|
162 | - echo "<td title='$fieldName' nowrap='nowrap'>$value</td>"; |
|
162 | + if ($fieldName == 'lastmod_datetime') { |
|
163 | + echo "<td title='$fieldName' nowrap='nowrap'>" . date("d/m/Y H:i:s", $value) . "</td>"; |
|
164 | + } else { |
|
165 | + echo "<td title='$fieldName' nowrap='nowrap'>$value</td>"; |
|
166 | + } |
|
163 | 167 | } |
164 | 168 | echo "</tr>"; |
165 | 169 | } |
@@ -226,25 +230,29 @@ discard block |
||
226 | 230 | $ret = $this->uncompress( |
227 | 231 | fread($this->fh, $fdetails['compressed_size']), $fdetails['compression_method'], $fdetails['uncompressed_size'], $targetFileName |
228 | 232 | ); |
229 | - if ($applyChmod && $targetFileName) |
|
230 | - @chmod($targetFileName, $applyChmod == 0755 ? 0644 : $applyChmod); |
|
233 | + if ($applyChmod && $targetFileName) { |
|
234 | + @chmod($targetFileName, $applyChmod == 0755 ? 0644 : $applyChmod); |
|
235 | + } |
|
231 | 236 | |
232 | 237 | return $ret; |
233 | 238 | } |
234 | 239 | |
235 | 240 | public function unzipAll($targetDir = false, $baseDir = "", $maintainStructure = true, $applyChmod = 0755) |
236 | 241 | { |
237 | - if ($targetDir === false) |
|
238 | - $targetDir = dirname(__FILE__) . "/"; |
|
242 | + if ($targetDir === false) { |
|
243 | + $targetDir = dirname(__FILE__) . "/"; |
|
244 | + } |
|
239 | 245 | |
240 | 246 | $lista = $this->getList(); |
241 | - if (sizeof($lista)) |
|
242 | - foreach ($lista as $fileName => $trash) { |
|
247 | + if (sizeof($lista)) { |
|
248 | + foreach ($lista as $fileName => $trash) { |
|
243 | 249 | $dirname = dirname($fileName); |
250 | + } |
|
244 | 251 | $outDN = "$targetDir/$dirname"; |
245 | 252 | |
246 | - if (substr($dirname, 0, strlen($baseDir)) != $baseDir) |
|
247 | - continue; |
|
253 | + if (substr($dirname, 0, strlen($baseDir)) != $baseDir) { |
|
254 | + continue; |
|
255 | + } |
|
248 | 256 | |
249 | 257 | if (!is_dir($outDN) && $maintainStructure) { |
250 | 258 | $str = ""; |
@@ -254,13 +262,15 @@ discard block |
||
254 | 262 | if (!is_dir("$targetDir/$str")) { |
255 | 263 | $this->debugMsg(1, "Creating folder: $targetDir/$str"); |
256 | 264 | mkdir("$targetDir/$str"); |
257 | - if ($applyChmod) |
|
258 | - chmod("$targetDir/$str", $applyChmod); |
|
265 | + if ($applyChmod) { |
|
266 | + chmod("$targetDir/$str", $applyChmod); |
|
267 | + } |
|
259 | 268 | } |
260 | 269 | } |
261 | 270 | } |
262 | - if (substr($fileName, -1, 1) == "/") |
|
263 | - continue; |
|
271 | + if (substr($fileName, -1, 1) == "/") { |
|
272 | + continue; |
|
273 | + } |
|
264 | 274 | |
265 | 275 | $maintainStructure ? |
266 | 276 | $this->unzip($fileName, "$targetDir/$fileName", $applyChmod) : |
@@ -270,8 +280,9 @@ discard block |
||
270 | 280 | |
271 | 281 | public function close() |
272 | 282 | { // Free the file resource |
273 | - if ($this->fh) |
|
274 | - fclose($this->fh); |
|
283 | + if ($this->fh) { |
|
284 | + fclose($this->fh); |
|
285 | + } |
|
275 | 286 | } |
276 | 287 | |
277 | 288 | public function __destroy() |
@@ -330,11 +341,13 @@ discard block |
||
330 | 341 | |
331 | 342 | public function debugMsg($level, $string) |
332 | 343 | { |
333 | - if ($this->debug) |
|
334 | - if ($level == 1) |
|
344 | + if ($this->debug) { |
|
345 | + if ($level == 1) |
|
335 | 346 | echo "<b style='color: #777'>dUnzip2:</b> $string<br>"; |
336 | - if ($level == 2) |
|
337 | - echo "<b style='color: #F00'>dUnzip2:</b> $string<br>"; |
|
347 | + } |
|
348 | + if ($level == 2) { |
|
349 | + echo "<b style='color: #F00'>dUnzip2:</b> $string<br>"; |
|
350 | + } |
|
338 | 351 | } |
339 | 352 | |
340 | 353 | public function _loadFileListByEOF(&$fh, $stopOnFile = false) |
@@ -427,9 +440,10 @@ discard block |
||
427 | 440 | } |
428 | 441 | |
429 | 442 | // If loaded centralDirs, then try to identify the offsetPosition of the compressed data. |
430 | - if ($this->centralDirList) |
|
431 | - foreach ($this->centralDirList as $filename => $details) { |
|
443 | + if ($this->centralDirList) { |
|
444 | + foreach ($this->centralDirList as $filename => $details) { |
|
432 | 445 | $i = $this->_getFileHeaderInformation($fh, $details['relative_offset']); |
446 | + } |
|
433 | 447 | $this->compressedList[$filename]['file_name'] = $filename; |
434 | 448 | $this->compressedList[$filename]['compression_method'] = $details['compression_method']; |
435 | 449 | $this->compressedList[$filename]['version_needed'] = $details['version_needed']; |
@@ -440,8 +454,9 @@ discard block |
||
440 | 454 | $this->compressedList[$filename]['lastmod_datetime'] = $details['lastmod_datetime']; |
441 | 455 | $this->compressedList[$filename]['extra_field'] = $i['extra_field']; |
442 | 456 | $this->compressedList[$filename]['contents-startOffset'] = $i['contents-startOffset']; |
443 | - if (strtolower($stopOnFile) == strtolower($filename)) |
|
444 | - break; |
|
457 | + if (strtolower($stopOnFile) == strtolower($filename)) { |
|
458 | + break; |
|
459 | + } |
|
445 | 460 | } |
446 | 461 | return true; |
447 | 462 | } |
@@ -468,8 +483,9 @@ discard block |
||
468 | 483 | $filename = $details['file_name']; |
469 | 484 | $this->compressedList[$filename] = $details; |
470 | 485 | $return = true; |
471 | - if (strtolower($stopOnFile) == strtolower($filename)) |
|
472 | - break; |
|
486 | + if (strtolower($stopOnFile) == strtolower($filename)) { |
|
487 | + break; |
|
488 | + } |
|
473 | 489 | } |
474 | 490 | |
475 | 491 | return $return; |
@@ -477,8 +493,9 @@ discard block |
||
477 | 493 | |
478 | 494 | public function _getFileHeaderInformation(&$fh, $startOffset = false) |
479 | 495 | { |
480 | - if ($startOffset !== false) |
|
481 | - fseek($fh, $startOffset); |
|
496 | + if ($startOffset !== false) { |
|
497 | + fseek($fh, $startOffset); |
|
498 | + } |
|
482 | 499 | |
483 | 500 | $signature = fread($fh, 4); |
484 | 501 | if ($signature == $this->zipSignature) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public $fileName; |
81 | 81 | public $compressedList; // You will problably use only this one! |
82 | 82 | public $centralDirList; // Central dir list... It's a kind of 'extra attributes' for a set of files |
83 | - public $endOfCentral; // End of central dir, contains ZIP Comments |
|
83 | + public $endOfCentral; // End of central dir, contains ZIP Comments |
|
84 | 84 | public $debug; |
85 | 85 | // Private |
86 | 86 | public $fh; |
@@ -188,15 +188,13 @@ discard block |
||
188 | 188 | { |
189 | 189 | return |
190 | 190 | isset($this->centralDirList[$compressedFileName]) ? |
191 | - $this->centralDirList[$compressedFileName] : |
|
192 | - false; |
|
191 | + $this->centralDirList[$compressedFileName] : false; |
|
193 | 192 | } |
194 | 193 | |
195 | 194 | public function getZipInfo($detail = false) |
196 | 195 | { |
197 | 196 | return $detail ? |
198 | - $this->endOfCentral[$detail] : |
|
199 | - $this->endOfCentral; |
|
197 | + $this->endOfCentral[$detail] : $this->endOfCentral; |
|
200 | 198 | } |
201 | 199 | |
202 | 200 | public function unzip($compressedFileName, $targetFileName = false, $applyChmod = 0644) |
@@ -218,8 +216,7 @@ discard block |
||
218 | 216 | if (!$fdetails['uncompressed_size']) { |
219 | 217 | $this->debugMsg(1, "File '<b>$compressedFileName</b>' is empty."); |
220 | 218 | return $targetFileName ? |
221 | - file_put_contents($targetFileName, "") : |
|
222 | - ""; |
|
219 | + file_put_contents($targetFileName, "") : ""; |
|
223 | 220 | } |
224 | 221 | |
225 | 222 | fseek($this->fh, $fdetails['contents-startOffset']); |
@@ -263,8 +260,7 @@ discard block |
||
263 | 260 | continue; |
264 | 261 | |
265 | 262 | $maintainStructure ? |
266 | - $this->unzip($fileName, "$targetDir/$fileName", $applyChmod) : |
|
267 | - $this->unzip($fileName, "$targetDir/" . basename($fileName), $applyChmod); |
|
263 | + $this->unzip($fileName, "$targetDir/$fileName", $applyChmod) : $this->unzip($fileName, "$targetDir/" . basename($fileName), $applyChmod); |
|
268 | 264 | } |
269 | 265 | } |
270 | 266 | |
@@ -286,8 +282,7 @@ discard block |
||
286 | 282 | case 0: |
287 | 283 | // Not compressed |
288 | 284 | return $targetFileName ? |
289 | - file_put_contents($targetFileName, $content) : |
|
290 | - $content; |
|
285 | + file_put_contents($targetFileName, $content) : $content; |
|
291 | 286 | case 1: |
292 | 287 | $this->debugMsg(2, "Shrunk mode is not supported... yet?"); |
293 | 288 | return false; |
@@ -306,8 +301,7 @@ discard block |
||
306 | 301 | case 8: |
307 | 302 | // Deflate |
308 | 303 | return $targetFileName ? |
309 | - file_put_contents($targetFileName, gzinflate($content, $uncompressedSize)) : |
|
310 | - gzinflate($content, $uncompressedSize); |
|
304 | + file_put_contents($targetFileName, gzinflate($content, $uncompressedSize)) : gzinflate($content, $uncompressedSize); |
|
311 | 305 | case 9: |
312 | 306 | $this->debugMsg(2, "Enhanced Deflating is not supported... yet?"); |
313 | 307 | return false; |
@@ -317,8 +311,7 @@ discard block |
||
317 | 311 | case 12: |
318 | 312 | // Bzip2 |
319 | 313 | return $targetFileName ? |
320 | - file_put_contents($targetFileName, bzdecompress($content)) : |
|
321 | - bzdecompress($content); |
|
314 | + file_put_contents($targetFileName, bzdecompress($content)) : bzdecompress($content); |
|
322 | 315 | case 18: |
323 | 316 | $this->debugMsg(2, "IBM TERSE is not supported... yet?"); |
324 | 317 | return false; |
@@ -378,7 +371,7 @@ discard block |
||
378 | 371 | $dir['compression_method'] = unpack("v", fread($fh, 2)); // compression method |
379 | 372 | $dir['lastmod_time'] = unpack("v", fread($fh, 2)); // last mod file time |
380 | 373 | $dir['lastmod_date'] = unpack("v", fread($fh, 2)); // last mod file date |
381 | - $dir['crc-32'] = fread($fh, 4); // crc-32 |
|
374 | + $dir['crc-32'] = fread($fh, 4); // crc-32 |
|
382 | 375 | $dir['compressed_size'] = unpack("V", fread($fh, 4)); // compressed size |
383 | 376 | $dir['uncompressed_size'] = unpack("V", fread($fh, 4)); // uncompressed size |
384 | 377 | $fileNameLength = unpack("v", fread($fh, 2)); // filename length |
@@ -389,7 +382,7 @@ discard block |
||
389 | 382 | $dir['external_attributes1'] = unpack("v", fread($fh, 2)); // external file attributes-byte2 |
390 | 383 | $dir['external_attributes2'] = unpack("v", fread($fh, 2)); // external file attributes |
391 | 384 | $dir['relative_offset'] = unpack("V", fread($fh, 4)); // relative offset of local header |
392 | - $dir['file_name'] = fread($fh, $fileNameLength[1]); // filename |
|
385 | + $dir['file_name'] = fread($fh, $fileNameLength[1]); // filename |
|
393 | 386 | $dir['extra_field'] = $extraFieldLength[1] ? fread($fh, $extraFieldLength[1]) : ''; // extra field |
394 | 387 | $dir['file_comment'] = $fileCommentLength[1] ? fread($fh, $fileCommentLength[1]) : ''; // file comment |
395 | 388 | // Convert the date and time, from MS-DOS format to UNIX Timestamp |
@@ -489,7 +482,7 @@ discard block |
||
489 | 482 | $file['compression_method'] = unpack("v", fread($fh, 2)); // compression method |
490 | 483 | $file['lastmod_time'] = unpack("v", fread($fh, 2)); // last mod file time |
491 | 484 | $file['lastmod_date'] = unpack("v", fread($fh, 2)); // last mod file date |
492 | - $file['crc-32'] = fread($fh, 4); // crc-32 |
|
485 | + $file['crc-32'] = fread($fh, 4); // crc-32 |
|
493 | 486 | $file['compressed_size'] = unpack("V", fread($fh, 4)); // compressed size |
494 | 487 | $file['uncompressed_size'] = unpack("V", fread($fh, 4)); // uncompressed size |
495 | 488 | $fileNameLength = unpack("v", fread($fh, 2)); // filename length |
@@ -1,2 +1,2 @@ |
||
1 | 1 | <?php |
2 | -$map=[]; |
|
3 | 2 | \ No newline at end of file |
3 | +$map = []; |
|
4 | 4 | \ No newline at end of file |