@@ -44,8 +44,9 @@ discard block |
||
44 | 44 | public function __call($eventName, $params) |
45 | 45 | { |
46 | 46 | if (0 === strpos($eventName, 'on')) { |
47 | - if (!isset($this->listeners[$eventName]) || !is_array($this->listeners[$eventName])) |
|
48 | - $this->listeners[$eventName] = array(); |
|
47 | + if (!isset($this->listeners[$eventName]) || !is_array($this->listeners[$eventName])) { |
|
48 | + $this->listeners[$eventName] = array(); |
|
49 | + } |
|
49 | 50 | $this->listeners[$eventName][] = $params[0]; |
50 | 51 | } |
51 | 52 | return $this; |
@@ -89,9 +90,10 @@ discard block |
||
89 | 90 | $this->events[] = $eventName; |
90 | 91 | $params = func_get_args(); |
91 | 92 | $eventName = 'on'.ucfirst(array_shift($params)); |
92 | - if (isset($this->listeners[$eventName])) |
|
93 | - foreach ($this->listeners[$eventName] as $callback) |
|
93 | + if (isset($this->listeners[$eventName])) { |
|
94 | + foreach ($this->listeners[$eventName] as $callback) |
|
94 | 95 | call_user_func_array($callback, $params); |
96 | + } |
|
95 | 97 | } |
96 | 98 | |
97 | 99 | } |
@@ -85,8 +85,7 @@ discard block |
||
85 | 85 | . 'requested-attributes' |
86 | 86 | . self::_giveMeStringLength($attributes[0]) |
87 | 87 | . $attributes[0]; |
88 | - } |
|
89 | - else |
|
88 | + } else |
|
90 | 89 | { |
91 | 90 | $this->meta->attributes .= chr(0x44) // Keyword |
92 | 91 | . chr(0x0).chr(0x0) // zero-length name |
@@ -141,15 +140,13 @@ discard block |
||
141 | 140 | if ($this->serveroutput->status == "successfull-ok") |
142 | 141 | { |
143 | 142 | self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
144 | - } |
|
145 | - else |
|
143 | + } else |
|
146 | 144 | { |
147 | 145 | self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
148 | 146 | } |
149 | 147 | |
150 | 148 | return $this->serveroutput->status; |
151 | - } |
|
152 | - else |
|
149 | + } else |
|
153 | 150 | { |
154 | 151 | $this->status = array_merge($this->status,array("OPERATION FAILED")); |
155 | 152 | self::_errorLog("getting defaults : OPERATION FAILED",1); |
@@ -215,15 +212,13 @@ discard block |
||
215 | 212 | if ($this->serveroutput->status == "successfull-ok") |
216 | 213 | { |
217 | 214 | self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
218 | - } |
|
219 | - else |
|
215 | + } else |
|
220 | 216 | { |
221 | 217 | self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
222 | 218 | } |
223 | 219 | |
224 | 220 | return $this->serveroutput->status; |
225 | - } |
|
226 | - else |
|
221 | + } else |
|
227 | 222 | { |
228 | 223 | $this->status = array_merge($this->status,array("OPERATION FAILED")); |
229 | 224 | self::_errorLog("getting defaults : OPERATION FAILED",1); |
@@ -301,15 +296,13 @@ discard block |
||
301 | 296 | if ($this->serveroutput->status == "successfull-ok") |
302 | 297 | { |
303 | 298 | self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
304 | - } |
|
305 | - else |
|
299 | + } else |
|
306 | 300 | { |
307 | 301 | self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
308 | 302 | } |
309 | 303 | |
310 | 304 | return $this->serveroutput->status; |
311 | - } |
|
312 | - else |
|
305 | + } else |
|
313 | 306 | { |
314 | 307 | $this->status = array_merge($this->status,array("OPERATION FAILED")); |
315 | 308 | self::_errorLog("getting defaults : OPERATION FAILED",1); |
@@ -371,8 +364,7 @@ discard block |
||
371 | 364 | . 'requested-attributes' |
372 | 365 | . self::_giveMeStringLength($attributes[0]) |
373 | 366 | . $attributes[0]; |
374 | - } |
|
375 | - else |
|
367 | + } else |
|
376 | 368 | { |
377 | 369 | $this->meta->attributes .= chr(0x44) // Keyword |
378 | 370 | . chr(0x0).chr(0x0) // zero-length name |
@@ -411,14 +403,12 @@ discard block |
||
411 | 403 | if ($this->serveroutput->status == "successfull-ok") |
412 | 404 | { |
413 | 405 | self::_errorLog("getting printers: ".$this->serveroutput->status,3); |
414 | - } |
|
415 | - else |
|
406 | + } else |
|
416 | 407 | { |
417 | 408 | self::_errorLog("getting printers: ".$this->serveroutput->status,1); |
418 | 409 | } |
419 | 410 | return $this->serveroutput->status; |
420 | - } |
|
421 | - else |
|
411 | + } else |
|
422 | 412 | { |
423 | 413 | $this->status = array_merge($this->status,array("OPERATION FAILED")); |
424 | 414 | self::_errorLog("getting printers : OPERATION FAILED",1); |
@@ -544,8 +534,9 @@ discard block |
||
544 | 534 | } |
545 | 535 | |
546 | 536 | $prepend = ''; |
547 | - while ((strlen($value_built) + strlen($prepend)) < 4) |
|
548 | - $prepend .= chr(0); |
|
537 | + while ((strlen($value_built) + strlen($prepend)) < 4) { |
|
538 | + $prepend .= chr(0); |
|
539 | + } |
|
549 | 540 | return $prepend.$value_built; |
550 | 541 | } |
551 | 542 |
@@ -478,8 +478,9 @@ |
||
478 | 478 | } |
479 | 479 | $nc = sprintf('%x', $this->nc); |
480 | 480 | $prepend = ""; |
481 | - while ((strlen($nc) + strlen($prepend)) < 8) |
|
482 | - $prependi .= "0"; |
|
481 | + while ((strlen($nc) + strlen($prepend)) < 8) { |
|
482 | + $prependi .= "0"; |
|
483 | + } |
|
483 | 484 | $nc = $prepend.$nc; |
484 | 485 | $cnonce = "printipp"; |
485 | 486 | $username = $this->user; |
@@ -78,8 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $post_values = array_merge($post_values,array("Filetype"=>"TEXT")); |
80 | 80 | } |
81 | - } |
|
82 | - else |
|
81 | + } else |
|
83 | 82 | { |
84 | 83 | self::_putDebug( _("Printing DATA\n"),3); |
85 | 84 | |
@@ -99,8 +98,7 @@ discard block |
||
99 | 98 | $this->_getJobId(); |
100 | 99 | $this->_getJobUri(); |
101 | 100 | $this->_parseJobAttributes(); |
102 | - } |
|
103 | - else |
|
101 | + } else |
|
104 | 102 | { |
105 | 103 | $this->jobs = array_merge($this->jobs,array('')); |
106 | 104 | $this->jobs_uri = array_merge($this->jobs_uri,array('')); |
@@ -114,8 +112,7 @@ discard block |
||
114 | 112 | if ($this->serveroutput->status == "successfull-ok") |
115 | 113 | { |
116 | 114 | self::_errorLog(sprintf("printing job %s: ",$this->last_job) .$this->serveroutput->status,3); |
117 | - } |
|
118 | - else |
|
115 | + } else |
|
119 | 116 | { |
120 | 117 | $this->jobs = array_merge($this->jobs,array("")); |
121 | 118 | $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
@@ -168,8 +165,7 @@ discard block |
||
168 | 165 | if ($this->serveroutput->status == "successfull-ok") |
169 | 166 | { |
170 | 167 | self::_errorLog("cancelling job $job_uri: ".$this->serveroutput->status,3); |
171 | - } |
|
172 | - else |
|
168 | + } else |
|
173 | 169 | { |
174 | 170 | self::_errorLog("cancelling job $job_uri: ".$this->serveroutput->status,1); |
175 | 171 | } |
@@ -212,8 +208,7 @@ discard block |
||
212 | 208 | if (array_key_exists(0,$this->available_printers)) |
213 | 209 | { |
214 | 210 | self::setPrinterURI($this->available_printers[0]); |
215 | - } |
|
216 | - else |
|
211 | + } else |
|
217 | 212 | { |
218 | 213 | trigger_error(_("_stringJob: Printer URI is not set: die"),E_USER_WARNING); |
219 | 214 | self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
@@ -252,8 +247,7 @@ discard block |
||
252 | 247 | if (is_readable($this->data)) |
253 | 248 | { |
254 | 249 | self::setJobName(basename($this->data),true); |
255 | - } |
|
256 | - else |
|
250 | + } else |
|
257 | 251 | { |
258 | 252 | self::setJobName(); |
259 | 253 | } |
@@ -334,8 +328,7 @@ discard block |
||
334 | 328 | if ($this->serveroutput->status == "successfull-ok") |
335 | 329 | { |
336 | 330 | self::_errorLog("validate job: ".$this->serveroutput->status,3); |
337 | - } |
|
338 | - else |
|
331 | + } else |
|
339 | 332 | { |
340 | 333 | self::_errorLog("validate job: ".$this->serveroutput->status,1); |
341 | 334 | } |
@@ -370,8 +363,7 @@ discard block |
||
370 | 363 | if (array_key_exists(0,$this->available_printers)) |
371 | 364 | { |
372 | 365 | self::setPrinterURI($this->available_printers[0]); |
373 | - } |
|
374 | - else |
|
366 | + } else |
|
375 | 367 | { |
376 | 368 | trigger_error(_("_stringJob: Printer URI is not set: die"),E_USER_WARNING); |
377 | 369 | self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
@@ -433,8 +425,7 @@ discard block |
||
433 | 425 | { |
434 | 426 | self::_errorLog(sprintf(_("getting printer attributes of %s: %s"),$this->printer_uri, |
435 | 427 | $this->serveroutput->status),3); |
436 | - } |
|
437 | - else |
|
428 | + } else |
|
438 | 429 | { |
439 | 430 | self::_errorLog(sprintf(_("getting printer attributes of %s: %s"),$this->printer_uri, |
440 | 431 | $this->serveroutput->status),1); |
@@ -471,8 +462,7 @@ discard block |
||
471 | 462 | if (array_key_exists(0,$this->available_printers)) |
472 | 463 | { |
473 | 464 | self::setPrinterURI($this->available_printers[0]); |
474 | - } |
|
475 | - else |
|
465 | + } else |
|
476 | 466 | { |
477 | 467 | trigger_error(_("getJobs: Printer URI is not set: die"),E_USER_WARNING); |
478 | 468 | self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
@@ -504,8 +494,7 @@ discard block |
||
504 | 494 | . 'limit' |
505 | 495 | . self::_giveMeStringLength($limit) |
506 | 496 | . $limit; |
507 | - } |
|
508 | - else |
|
497 | + } else |
|
509 | 498 | { |
510 | 499 | $this->meta->limit = ''; |
511 | 500 | } |
@@ -517,8 +506,7 @@ discard block |
||
517 | 506 | . 'which-jobs' |
518 | 507 | . self::_giveMeStringLength($which_jobs) |
519 | 508 | . $which_jobs; |
520 | - } |
|
521 | - else |
|
509 | + } else |
|
522 | 510 | { |
523 | 511 | $this->meta->which_jobs = ""; |
524 | 512 | } |
@@ -530,8 +518,7 @@ discard block |
||
530 | 518 | . 'my-jobs' |
531 | 519 | . self::_giveMeStringLength(chr(0x01)) |
532 | 520 | . chr(0x01); |
533 | - } |
|
534 | - else |
|
521 | + } else |
|
535 | 522 | { |
536 | 523 | $this->meta->my_jobs = ''; |
537 | 524 | } |
@@ -570,8 +557,7 @@ discard block |
||
570 | 557 | . '' |
571 | 558 | . self::_giveMeStringLength('job-state-reason') |
572 | 559 | . 'job-state-reason'; |
573 | - } |
|
574 | - else |
|
560 | + } else |
|
575 | 561 | { # cups 1.4.4 doesn't return much of anything without this |
576 | 562 | $this->stringjob .= |
577 | 563 | chr(0x44) // keyword |
@@ -609,8 +595,7 @@ discard block |
||
609 | 595 | { |
610 | 596 | self::_errorLog(sprintf(_("getting jobs of printer %s: "),$this->printer_uri) |
611 | 597 | .$this->serveroutput->status,3); |
612 | - } |
|
613 | - else |
|
598 | + } else |
|
614 | 599 | { |
615 | 600 | self::_errorLog(sprintf(_("getting jobs of printer %s: "),$this->printer_uri) |
616 | 601 | .$this->serveroutput->status,1); |
@@ -654,8 +639,7 @@ discard block |
||
654 | 639 | if (array_key_exists(0,$this->available_printers)) |
655 | 640 | { |
656 | 641 | self::setPrinterURI($this->available_printers[0]); |
657 | - } |
|
658 | - else |
|
642 | + } else |
|
659 | 643 | { |
660 | 644 | trigger_error(_("getJobs: Printer URI is not set: die"),E_USER_WARNING); |
661 | 645 | self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
@@ -716,8 +700,7 @@ discard block |
||
716 | 700 | . '' |
717 | 701 | . self::_giveMeStringLength('job-state-reason') |
718 | 702 | . 'job-state-reason'; |
719 | - } |
|
720 | - elseif($attributes_group) |
|
703 | + } elseif($attributes_group) |
|
721 | 704 | { |
722 | 705 | switch($attributes_group) |
723 | 706 | { |
@@ -768,8 +751,7 @@ discard block |
||
768 | 751 | { |
769 | 752 | self::_errorLog(sprintf(_("getting job attributes for %s: "),$job_uri) |
770 | 753 | .$this->serveroutput->status,3); |
771 | - } |
|
772 | - else |
|
754 | + } else |
|
773 | 755 | { |
774 | 756 | self::_errorLog(sprintf(_("getting job attributes for %s: "),$job_uri) |
775 | 757 | .$this->serveroutput->status,1); |
@@ -871,8 +853,7 @@ discard block |
||
871 | 853 | $this->parsed[$k]['name'] = $this->serveroutput->response[$i][$j]['name']; |
872 | 854 | $this->parsed[$k]['type'] = $this->serveroutput->response[$i][$j]['type']; |
873 | 855 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
874 | - } |
|
875 | - else |
|
856 | + } else |
|
876 | 857 | { |
877 | 858 | $l ++; |
878 | 859 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
@@ -926,8 +907,7 @@ discard block |
||
926 | 907 | $this->parsed[$job][$k]['name'] = $this->serveroutput->response[$i][$j]['name']; |
927 | 908 | $this->parsed[$job][$k]['type'] = $this->serveroutput->response[$i][$j]['type']; |
928 | 909 | $this->parsed[$job][$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
929 | - } |
|
930 | - else |
|
910 | + } else |
|
931 | 911 | { |
932 | 912 | $l ++; |
933 | 913 | $this->parsed[$job][$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
@@ -991,8 +971,7 @@ discard block |
||
991 | 971 | $this->collection_depth ++; |
992 | 972 | $this->index --; |
993 | 973 | $this->collection_nbr[$this->collection_depth] ++; |
994 | - } |
|
995 | - else |
|
974 | + } else |
|
996 | 975 | { |
997 | 976 | $this->collection_depth ++; |
998 | 977 | if ($this->collection_depth == 0) |
@@ -1002,8 +981,7 @@ discard block |
||
1002 | 981 | if (array_key_exists($this->collection_depth,$this->collection_nbr)) |
1003 | 982 | { |
1004 | 983 | $this->collection_nbr[$this->collection_depth] ++; |
1005 | - } |
|
1006 | - else |
|
984 | + } else |
|
1007 | 985 | { |
1008 | 986 | $this->collection_nbr[$this->collection_depth] = 0; |
1009 | 987 | } |
@@ -1037,8 +1015,7 @@ discard block |
||
1037 | 1015 | if (!$attribute_name) |
1038 | 1016 | { |
1039 | 1017 | $attribute_name = $this->attribute_name; |
1040 | - } |
|
1041 | - else |
|
1018 | + } else |
|
1042 | 1019 | { |
1043 | 1020 | $this->attribute_name = $attribute_name; |
1044 | 1021 | } |
@@ -1151,24 +1128,19 @@ discard block |
||
1151 | 1128 | if ($tag >= 0x14 && $tag < 0x15 && $tag > 0x17 && $tag <= 0x1f) |
1152 | 1129 | { |
1153 | 1130 | $tag = "out-of-band"; |
1154 | - } |
|
1155 | - elseif (0x24 <= $tag && $tag <= 0x2f) |
|
1131 | + } elseif (0x24 <= $tag && $tag <= 0x2f) |
|
1156 | 1132 | { |
1157 | 1133 | $tag = "new integer type"; |
1158 | - } |
|
1159 | - elseif (0x38 <= $tag && $tag <= 0x3F) |
|
1134 | + } elseif (0x38 <= $tag && $tag <= 0x3F) |
|
1160 | 1135 | { |
1161 | 1136 | $tag = "new octet-stream type"; |
1162 | - } |
|
1163 | - elseif (0x4B <= $tag && $tag <= 0x5F) |
|
1137 | + } elseif (0x4B <= $tag && $tag <= 0x5F) |
|
1164 | 1138 | { |
1165 | 1139 | $tag = "new character string type"; |
1166 | - } |
|
1167 | - elseif ((0x60 <= $tag && $tag < 0x7f) || $tag >= 0x80 ) |
|
1140 | + } elseif ((0x60 <= $tag && $tag < 0x7f) || $tag >= 0x80 ) |
|
1168 | 1141 | { |
1169 | 1142 | $tag = "IETF reserved for future"; |
1170 | - } |
|
1171 | - else |
|
1143 | + } else |
|
1172 | 1144 | { |
1173 | 1145 | $tag = sprintf("UNKNOWN: 0x%x (%u)",$tag,$tag); |
1174 | 1146 | } |
@@ -1222,8 +1194,7 @@ discard block |
||
1222 | 1194 | { |
1223 | 1195 | $attribute_name = $this->last_attribute_name; |
1224 | 1196 | $this->collection_key[$this->collection_depth] ++; |
1225 | - } |
|
1226 | - else |
|
1197 | + } else |
|
1227 | 1198 | { |
1228 | 1199 | $this->collection_key[$this->collection_depth] = 0; |
1229 | 1200 | } |
@@ -1382,8 +1353,7 @@ discard block |
||
1382 | 1353 | $this->parsed[$k]['name'] = $this->serveroutput->response[$i][$j]['name']; |
1383 | 1354 | $this->parsed[$k]['type'] = $this->serveroutput->response[$i][$j]['type']; |
1384 | 1355 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
1385 | - } |
|
1386 | - else |
|
1356 | + } else |
|
1387 | 1357 | { |
1388 | 1358 | $l ++; |
1389 | 1359 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
@@ -1430,8 +1400,7 @@ discard block |
||
1430 | 1400 | $this->parsed[$k]['name'] = $this->serveroutput->response[$i][$j]['name']; |
1431 | 1401 | $this->parsed[$k]['type'] = $this->serveroutput->response[$i][$j]['type']; |
1432 | 1402 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
1433 | - } |
|
1434 | - else |
|
1403 | + } else |
|
1435 | 1404 | { |
1436 | 1405 | $l ++; |
1437 | 1406 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
@@ -1477,8 +1446,7 @@ discard block |
||
1477 | 1446 | if ($value == 0x00) |
1478 | 1447 | { |
1479 | 1448 | $value = 'false'; |
1480 | - } |
|
1481 | - else |
|
1449 | + } else |
|
1482 | 1450 | { |
1483 | 1451 | $value = 'true'; |
1484 | 1452 | } |
@@ -1749,19 +1717,16 @@ discard block |
||
1749 | 1717 | if ($value_parsed > 0x002B && $value_parsed <= 0x3FFF) |
1750 | 1718 | { |
1751 | 1719 | $value = sprintf('Unknown(IETF standards track operations reserved): 0x%x',$value_parsed); |
1752 | - } |
|
1753 | - elseif ($value_parsed >= 0x4000 && $value_parsed <= 0x8FFF) |
|
1720 | + } elseif ($value_parsed >= 0x4000 && $value_parsed <= 0x8FFF) |
|
1754 | 1721 | { |
1755 | 1722 | if (method_exists($this,'_getEnumVendorExtensions')) |
1756 | 1723 | { |
1757 | 1724 | $value = $this->_getEnumVendorExtensions($value_parsed); |
1758 | - } |
|
1759 | - else |
|
1725 | + } else |
|
1760 | 1726 | { |
1761 | 1727 | $value = sprintf('Unknown(Vendor extension for operations): 0x%x',$value_parsed); |
1762 | 1728 | } |
1763 | - } |
|
1764 | - elseif ($value_parsed > 0x8FFF) |
|
1729 | + } elseif ($value_parsed > 0x8FFF) |
|
1765 | 1730 | { |
1766 | 1731 | $value = sprintf('Unknown operation (should not exists): 0x%x',$value_parsed); |
1767 | 1732 | } |
@@ -183,7 +183,9 @@ discard block |
||
183 | 183 | { |
184 | 184 | $length = strlen($uri); |
185 | 185 | $length = chr($length); |
186 | - while (strlen($length) < 2) $length = chr(0x00) . $length; |
|
186 | + while (strlen($length) < 2) { |
|
187 | + $length = chr(0x00) . $length; |
|
188 | + } |
|
187 | 189 | $this->meta->printer_uri = chr(0x45) // uri type | value-tag |
188 | 190 | . chr(0x00) . chr(0x0B) // name-length |
189 | 191 | . "printer-uri" // printer-uri | name |
@@ -209,9 +211,10 @@ discard block |
||
209 | 211 | { |
210 | 212 | //It's a filename. Open and stream. |
211 | 213 | $data = fopen($this->data, "rb"); |
212 | - while (!feof($data)) $output = fread($data, 8192); |
|
213 | - } |
|
214 | - else |
|
214 | + while (!feof($data)) { |
|
215 | + $output = fread($data, 8192); |
|
216 | + } |
|
217 | + } else |
|
215 | 218 | { |
216 | 219 | $output = $this->data; |
217 | 220 | } |
@@ -278,7 +281,9 @@ discard block |
||
278 | 281 | { |
279 | 282 | self::setBinary(); |
280 | 283 | $length = chr(strlen($mime_media_type)); |
281 | - while (strlen($length) < 2) $length = chr(0x00) . $length; |
|
284 | + while (strlen($length) < 2) { |
|
285 | + $length = chr(0x00) . $length; |
|
286 | + } |
|
282 | 287 | self::_putDebug(sprintf(_("mime type: %s") , $mime_media_type) , 2); |
283 | 288 | $this->meta->mime_media_type = chr(0x49) // document-format tag |
284 | 289 | . self::_giveMeStringLength('document-format') . 'document-format' // |
@@ -320,7 +325,9 @@ discard block |
||
320 | 325 | $document_name = substr($document_name, 0, 1023); |
321 | 326 | $length = strlen($document_name); |
322 | 327 | $length = chr($length); |
323 | - while (strlen($length) < 2) $length = chr(0x00) . $length; |
|
328 | + while (strlen($length) < 2) { |
|
329 | + $length = chr(0x00) . $length; |
|
330 | + } |
|
324 | 331 | self::_putDebug(sprintf(_("document name: %s") , $document_name) , 2); |
325 | 332 | $this->meta->document_name = chr(0x41) // textWithoutLanguage tag |
326 | 333 | . chr(0x00) . chr(0x0d) // name-length |
@@ -493,8 +500,7 @@ discard block |
||
493 | 500 | . 'page-ranges' |
494 | 501 | . self::_giveMeStringLength($value) |
495 | 502 | . $value; |
496 | - } |
|
497 | - else |
|
503 | + } else |
|
498 | 504 | { |
499 | 505 | $this->meta->page_ranges .= |
500 | 506 | $this->tags_types['rangeOfInteger']['tag'] |
@@ -517,44 +523,38 @@ discard block |
||
517 | 523 | if (!is_array($values)) |
518 | 524 | { |
519 | 525 | self::_setOperationAttribute($attribute, $values); |
520 | - } |
|
521 | - else |
|
526 | + } else |
|
522 | 527 | { |
523 | 528 | foreach($values as $value) |
524 | 529 | { |
525 | 530 | self::_setOperationAttribute($attribute, $value); |
526 | 531 | } |
527 | 532 | } |
528 | - } |
|
529 | - elseif (in_array($attribute, $job_attributes_tags)) |
|
533 | + } elseif (in_array($attribute, $job_attributes_tags)) |
|
530 | 534 | { |
531 | 535 | if (!is_array($values)) |
532 | 536 | { |
533 | 537 | self::_setJobAttribute($attribute, $values); |
534 | - } |
|
535 | - else |
|
538 | + } else |
|
536 | 539 | { |
537 | 540 | foreach($values as $value) |
538 | 541 | { |
539 | 542 | self::_setJobAttribute($attribute, $value); |
540 | 543 | } |
541 | 544 | } |
542 | - } |
|
543 | - elseif (in_array($attribute, $printer_attributes_tags)) |
|
545 | + } elseif (in_array($attribute, $printer_attributes_tags)) |
|
544 | 546 | { |
545 | 547 | if (!is_array($values)) |
546 | 548 | { |
547 | 549 | self::_setPrinterAttribute($attribute, $values); |
548 | - } |
|
549 | - else |
|
550 | + } else |
|
550 | 551 | { |
551 | 552 | foreach($values as $value) |
552 | 553 | { |
553 | 554 | self::_setPrinterAttribute($attribute, $value); |
554 | 555 | } |
555 | 556 | } |
556 | - } |
|
557 | - else |
|
557 | + } else |
|
558 | 558 | { |
559 | 559 | trigger_error( |
560 | 560 | sprintf(_('SetAttribute: Tag "%s" is not a printer or a job attribute'), |
@@ -580,22 +580,19 @@ discard block |
||
580 | 580 | $this->operation_tags[$attribute]['value'], |
581 | 581 | $this->operation_tags[$attribute]['systag'] |
582 | 582 | ); |
583 | - } |
|
584 | - elseif (in_array($attribute, $job_attributes_tags)) |
|
583 | + } elseif (in_array($attribute, $job_attributes_tags)) |
|
585 | 584 | { |
586 | 585 | unset( |
587 | 586 | $this->job_tags[$attribute]['value'], |
588 | 587 | $this->job_tags[$attribute]['systag'] |
589 | 588 | ); |
590 | - } |
|
591 | - elseif (in_array($attribute, $printer_attributes_tags)) |
|
589 | + } elseif (in_array($attribute, $printer_attributes_tags)) |
|
592 | 590 | { |
593 | 591 | unset( |
594 | 592 | $this->printer_tags[$attribute]['value'], |
595 | 593 | $this->printer_tags[$attribute]['systag'] |
596 | 594 | ); |
597 | - } |
|
598 | - else |
|
595 | + } else |
|
599 | 596 | { |
600 | 597 | trigger_error( |
601 | 598 | sprintf(_('unsetAttribute: Tag "%s" is not a printer or a job attribute'), |
@@ -714,8 +711,7 @@ discard block |
||
714 | 711 | ) |
715 | 712 | ); |
716 | 713 | } |
717 | - } |
|
718 | - else |
|
714 | + } else |
|
719 | 715 | { |
720 | 716 | self::_putDebug(_("Printing DATA")); |
721 | 717 | $this->output = |
@@ -743,8 +739,7 @@ discard block |
||
743 | 739 | sprintf("printing job %s: ", $this->last_job) |
744 | 740 | . $this->serveroutput->status, |
745 | 741 | 3); |
746 | - } |
|
747 | - else |
|
742 | + } else |
|
748 | 743 | { |
749 | 744 | self::_errorLog( |
750 | 745 | sprintf("printing job: ", $this->last_job) |
@@ -781,10 +776,11 @@ discard block |
||
781 | 776 | $http = new http_class; |
782 | 777 | if (!$this->unix) { |
783 | 778 | // DOL_LDR_CHANGE |
784 | - if (empty($this->host)) $this->host='127.0.0.1'; |
|
779 | + if (empty($this->host)) { |
|
780 | + $this->host='127.0.0.1'; |
|
781 | + } |
|
785 | 782 | $http->host = $this->host; |
786 | - } |
|
787 | - else { |
|
783 | + } else { |
|
788 | 784 | $http->host = "localhost"; |
789 | 785 | } |
790 | 786 | $http->with_exceptions = $this->with_exceptions; |
@@ -792,8 +788,7 @@ discard block |
||
792 | 788 | { |
793 | 789 | $http->debug = 1; |
794 | 790 | $http->html_debug = 0; |
795 | - } |
|
796 | - else |
|
791 | + } else |
|
797 | 792 | { |
798 | 793 | $http->debug = 0; |
799 | 794 | $http->html_debug = 0; |
@@ -838,15 +833,13 @@ discard block |
||
838 | 833 | try |
839 | 834 | { |
840 | 835 | $success = $http->Open($arguments); |
841 | - } |
|
842 | - catch(httpException $e) |
|
836 | + } catch(httpException $e) |
|
843 | 837 | { |
844 | 838 | throw new ippException( |
845 | 839 | sprintf("http error: %s", $e->getMessage()), |
846 | 840 | $e->getErrno()); |
847 | 841 | } |
848 | - } |
|
849 | - else |
|
842 | + } else |
|
850 | 843 | { |
851 | 844 | $success = $http->Open($arguments); |
852 | 845 | } |
@@ -866,8 +859,7 @@ discard block |
||
866 | 859 | { |
867 | 860 | self::_putDebug($header_name . ": " . $http->request_headers[$header_name][$header_value]); |
868 | 861 | } |
869 | - } |
|
870 | - else |
|
862 | + } else |
|
871 | 863 | { |
872 | 864 | self::_putDebug($header_name . ": " . $http->request_headers[$header_name]); |
873 | 865 | } |
@@ -896,8 +888,7 @@ discard block |
||
896 | 888 | . $headers[$header_name][$header_value]; |
897 | 889 | $i++; |
898 | 890 | } |
899 | - } |
|
900 | - else |
|
891 | + } else |
|
901 | 892 | { |
902 | 893 | self::_putDebug($header_name . ": " . $headers[$header_name]); |
903 | 894 | $this->serveroutput->headers[$i] = |
@@ -1245,20 +1236,16 @@ discard block |
||
1245 | 1236 | if ($status_code < 0x00FF) |
1246 | 1237 | { |
1247 | 1238 | $this->serveroutput->status = "successfull"; |
1248 | - } |
|
1249 | - elseif ($status_code < 0x01FF) |
|
1239 | + } elseif ($status_code < 0x01FF) |
|
1250 | 1240 | { |
1251 | 1241 | $this->serveroutput->status = "informational"; |
1252 | - } |
|
1253 | - elseif ($status_code < 0x02FF) |
|
1242 | + } elseif ($status_code < 0x02FF) |
|
1254 | 1243 | { |
1255 | 1244 | $this->serveroutput->status = "redirection"; |
1256 | - } |
|
1257 | - elseif ($status_code < 0x04FF) |
|
1245 | + } elseif ($status_code < 0x04FF) |
|
1258 | 1246 | { |
1259 | 1247 | $this->serveroutput->status = "client-error"; |
1260 | - } |
|
1261 | - elseif ($status_code < 0x05FF) |
|
1248 | + } elseif ($status_code < 0x05FF) |
|
1262 | 1249 | { |
1263 | 1250 | $this->serveroutput->status = "server-error"; |
1264 | 1251 | } |
@@ -1464,8 +1451,7 @@ discard block |
||
1464 | 1451 | if (array_key_exists(0, $this->available_printers)) |
1465 | 1452 | { |
1466 | 1453 | self::setPrinterURI($this->available_printers[0]); |
1467 | - } |
|
1468 | - else |
|
1454 | + } else |
|
1469 | 1455 | { |
1470 | 1456 | trigger_error( |
1471 | 1457 | _("_stringJob: Printer URI is not set: die"), |
@@ -1560,8 +1546,7 @@ discard block |
||
1560 | 1546 | . $key |
1561 | 1547 | . self::_giveMeStringLength($item_value) |
1562 | 1548 | . $item_value; |
1563 | - } |
|
1564 | - else |
|
1549 | + } else |
|
1565 | 1550 | { |
1566 | 1551 | $operationattributes .= |
1567 | 1552 | $values['systag'] |
@@ -1589,8 +1574,7 @@ discard block |
||
1589 | 1574 | . $key |
1590 | 1575 | . self::_giveMeStringLength($item_value) |
1591 | 1576 | . $item_value; |
1592 | - } |
|
1593 | - else |
|
1577 | + } else |
|
1594 | 1578 | { |
1595 | 1579 | $jobattributes .= |
1596 | 1580 | $values['systag'] |
@@ -1618,8 +1602,7 @@ discard block |
||
1618 | 1602 | . $key |
1619 | 1603 | . self::_giveMeStringLength($item_value) |
1620 | 1604 | . $item_value; |
1621 | - } |
|
1622 | - else |
|
1605 | + } else |
|
1623 | 1606 | { |
1624 | 1607 | $printerattributes .= |
1625 | 1608 | $values['systag'] |
@@ -1649,8 +1632,7 @@ discard block |
||
1649 | 1632 | if ($this->with_exceptions) |
1650 | 1633 | { |
1651 | 1634 | throw new ippException($errmsg); |
1652 | - } |
|
1653 | - else |
|
1635 | + } else |
|
1654 | 1636 | { |
1655 | 1637 | trigger_error ($errmsg, E_USER_ERROR); |
1656 | 1638 | } |
@@ -1814,8 +1796,7 @@ discard block |
||
1814 | 1796 | $int4 = $value & 0xFF; //64bits |
1815 | 1797 | if ($initial_value < 0) { |
1816 | 1798 | $int4 = chr($int4) | chr(0x80); |
1817 | - } |
|
1818 | - else { |
|
1799 | + } else { |
|
1819 | 1800 | $int4 = chr($int4); |
1820 | 1801 | } |
1821 | 1802 | $value = $int4 . chr($int3) . chr($int2) . chr($int1); |
@@ -93,8 +93,7 @@ discard block |
||
93 | 93 | { |
94 | 94 | self::_errorLog(sprintf("printing uri %s, job %s: ",$uri,$this->last_job) |
95 | 95 | .$this->serveroutput->status,3); |
96 | - } |
|
97 | - else |
|
96 | + } else |
|
98 | 97 | { |
99 | 98 | $this->jobs = array_merge($this->jobs,array("")); |
100 | 99 | $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
@@ -130,8 +129,7 @@ discard block |
||
130 | 129 | if (array_key_exists(0,$this->available_printers)) |
131 | 130 | { |
132 | 131 | self::setPrinterURI($this->available_printers[0]); |
133 | - } |
|
134 | - else |
|
132 | + } else |
|
135 | 133 | { |
136 | 134 | trigger_error(_("purgeJobs: Printer URI is not set: die"),E_USER_WARNING); |
137 | 135 | self::_putDebug( _("purgeJobs: Printer URI is not set: die\n")); |
@@ -193,8 +191,7 @@ discard block |
||
193 | 191 | { |
194 | 192 | self::_errorLog(sprintf(_("purging jobs of %s: "),$this->printer_uri) |
195 | 193 | .$this->serveroutput->status,3); |
196 | - } |
|
197 | - else |
|
194 | + } else |
|
198 | 195 | { |
199 | 196 | self::_errorLog(sprintf(_("purging jobs of %s: "),$this->printer_uri) |
200 | 197 | .$this->serveroutput->status,1); |
@@ -228,8 +225,7 @@ discard block |
||
228 | 225 | if (array_key_exists(0,$this->available_printers)) |
229 | 226 | { |
230 | 227 | self::setPrinterURI($this->available_printers[0]); |
231 | - } |
|
232 | - else |
|
228 | + } else |
|
233 | 229 | { |
234 | 230 | trigger_error(_("createJob: Printer URI is not set: die"),E_USER_WARNING); |
235 | 231 | self::_putDebug( _("createJob: Printer URI is not set: die\n")); |
@@ -278,8 +274,7 @@ discard block |
||
278 | 274 | if (is_readable($this->data)) |
279 | 275 | { |
280 | 276 | self::setJobName(basename($this->data),true); |
281 | - } |
|
282 | - else |
|
277 | + } else |
|
283 | 278 | { |
284 | 279 | self::setJobName(); |
285 | 280 | } |
@@ -341,8 +336,7 @@ discard block |
||
341 | 336 | $this->_getJobId(); |
342 | 337 | $this->_getJobUri(); |
343 | 338 | $this->_parseJobAttributes(); |
344 | - } |
|
345 | - else |
|
339 | + } else |
|
346 | 340 | { |
347 | 341 | $this->jobs = array_merge($this->jobs,array('')); |
348 | 342 | $this->jobs_uri = array_merge($this->jobs_uri,array('')); |
@@ -357,8 +351,7 @@ discard block |
||
357 | 351 | { |
358 | 352 | self::_errorLog(sprintf(_("Create job: job %s"),$this->last_job) |
359 | 353 | .$this->serveroutput->status,3); |
360 | - } |
|
361 | - else |
|
354 | + } else |
|
362 | 355 | { |
363 | 356 | |
364 | 357 | $this->jobs = array_merge($this->jobs,array("")); |
@@ -407,8 +400,7 @@ discard block |
||
407 | 400 | { |
408 | 401 | $post_values = array_merge($post_values,array("Filetype"=>"TEXT")); |
409 | 402 | } |
410 | - } |
|
411 | - else |
|
403 | + } else |
|
412 | 404 | { |
413 | 405 | self::_putDebug( _("sending DATA as document\n")); |
414 | 406 | |
@@ -430,8 +422,7 @@ discard block |
||
430 | 422 | //$this->_getPrinterUri(); |
431 | 423 | $this->_getJobUri(); |
432 | 424 | $this->_parseJobAttributes(); |
433 | - } |
|
434 | - else |
|
425 | + } else |
|
435 | 426 | { |
436 | 427 | $this->jobs = array_merge($this->jobs,array($job)); |
437 | 428 | $this->jobs_uri = array_merge($this->jobs_uri,array($job)); |
@@ -445,8 +436,7 @@ discard block |
||
445 | 436 | if ($this->serveroutput->status == "successfull-ok") |
446 | 437 | { |
447 | 438 | self::_errorLog(sprintf("sending document, job %s: %s",$job,$this->serveroutput->status),3); |
448 | - } |
|
449 | - else |
|
439 | + } else |
|
450 | 440 | { |
451 | 441 | $this->jobs = array_merge($this->jobs,array("")); |
452 | 442 | $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
@@ -488,8 +478,7 @@ discard block |
||
488 | 478 | //$this->_getPrinterUri(); |
489 | 479 | $this->_getJobUri(); |
490 | 480 | $this->_parseJobAttributes(); |
491 | - } |
|
492 | - else |
|
481 | + } else |
|
493 | 482 | { |
494 | 483 | $this->jobs = array_merge($this->jobs,array($job)); |
495 | 484 | $this->jobs_uri = array_merge($this->jobs_uri,array($job)); |
@@ -505,8 +494,7 @@ discard block |
||
505 | 494 | if ($this->serveroutput->status == "successfull-ok") |
506 | 495 | { |
507 | 496 | self::_errorLog(sprintf("sending uri %s, job %s: %s",$uri,$job,$this->serveroutput->status),3); |
508 | - } |
|
509 | - else |
|
497 | + } else |
|
510 | 498 | { |
511 | 499 | $this->jobs = array_merge($this->jobs,array("")); |
512 | 500 | $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
@@ -543,8 +531,7 @@ discard block |
||
543 | 531 | if (array_key_exists(0,$this->available_printers)) |
544 | 532 | { |
545 | 533 | self::setPrinterURI($this->available_printers[0]); |
546 | - } |
|
547 | - else |
|
534 | + } else |
|
548 | 535 | { |
549 | 536 | trigger_error(_("pausePrinter: Printer URI is not set: die"),E_USER_WARNING); |
550 | 537 | self::_putDebug( _("pausePrinter: Printer URI is not set: die\n")); |
@@ -606,8 +593,7 @@ discard block |
||
606 | 593 | { |
607 | 594 | self::_errorLog(sprintf(_("Pause printer %s: "),$this->printer_uri) |
608 | 595 | .$this->serveroutput->status,3); |
609 | - } |
|
610 | - else |
|
596 | + } else |
|
611 | 597 | { |
612 | 598 | self::_errorLog(sprintf(_("pause printer %s: "),$this->printer_uri) |
613 | 599 | .$this->serveroutput->status,1); |
@@ -645,8 +631,7 @@ discard block |
||
645 | 631 | if (array_key_exists(0,$this->available_printers)) |
646 | 632 | { |
647 | 633 | self::setPrinterURI($this->available_printers[0]); |
648 | - } |
|
649 | - else |
|
634 | + } else |
|
650 | 635 | { |
651 | 636 | trigger_error(_("resumePrinter: Printer URI is not set: die"),E_USER_WARNING); |
652 | 637 | self::_putDebug( _("resumePrinter: Printer URI is not set: die\n")); |
@@ -703,8 +688,7 @@ discard block |
||
703 | 688 | { |
704 | 689 | self::_errorLog(sprintf(_("resume printer %s: "),$this->printer_uri) |
705 | 690 | .$this->serveroutput->status,3); |
706 | - } |
|
707 | - else |
|
691 | + } else |
|
708 | 692 | { |
709 | 693 | self::_errorLog(sprintf(_("resume printer %s: "),$this->printer_uri) |
710 | 694 | .$this->serveroutput->status,1); |
@@ -758,8 +742,7 @@ discard block |
||
758 | 742 | if (in_array($until,$until_strings)) |
759 | 743 | { |
760 | 744 | true; |
761 | - } |
|
762 | - else |
|
745 | + } else |
|
763 | 746 | { |
764 | 747 | $until = 'indefinite'; |
765 | 748 | } |
@@ -805,8 +788,7 @@ discard block |
||
805 | 788 | { |
806 | 789 | self::_errorLog(sprintf(_("hold job %s until %s: "),$job_uri,$until) |
807 | 790 | .$this->serveroutput->status,3); |
808 | - } |
|
809 | - else |
|
791 | + } else |
|
810 | 792 | { |
811 | 793 | self::_errorLog(sprintf(_("hold job %s until %s: "),$job_uri,$until) |
812 | 794 | .$this->serveroutput->status,1); |
@@ -889,8 +871,7 @@ discard block |
||
889 | 871 | { |
890 | 872 | self::_errorLog(sprintf(_("release job %s: "),$job_uri) |
891 | 873 | .$this->serveroutput->status,3); |
892 | - } |
|
893 | - else |
|
874 | + } else |
|
894 | 875 | { |
895 | 876 | self::_errorLog(sprintf(_("release job %s: "),$job_uri) |
896 | 877 | .$this->serveroutput->status,1); |
@@ -980,8 +961,7 @@ discard block |
||
980 | 961 | { |
981 | 962 | self::_errorLog(sprintf(_("release job %s: "),$job_uri) |
982 | 963 | .$this->serveroutput->status,3); |
983 | - } |
|
984 | - else |
|
964 | + } else |
|
985 | 965 | { |
986 | 966 | self::_errorLog(sprintf(_("release job %s: "),$job_uri) |
987 | 967 | .$this->serveroutput->status,1); |
@@ -1099,8 +1079,7 @@ discard block |
||
1099 | 1079 | { |
1100 | 1080 | self::_errorLog(sprintf(_("set job attributes for job %s: "),$job_uri) |
1101 | 1081 | .$this->serveroutput->status,3); |
1102 | - } |
|
1103 | - else |
|
1082 | + } else |
|
1104 | 1083 | { |
1105 | 1084 | self::_errorLog(sprintf(_("set job attributes for job %s: "),$job_uri) |
1106 | 1085 | .$this->serveroutput->status,1); |
@@ -1245,8 +1224,7 @@ discard block |
||
1245 | 1224 | { |
1246 | 1225 | self::_errorLog(sprintf(_("set printer attributes for printer %s: "),$this->printer_uri) |
1247 | 1226 | .$this->serveroutput->status,3); |
1248 | - } |
|
1249 | - else |
|
1227 | + } else |
|
1250 | 1228 | { |
1251 | 1229 | self::_errorLog(sprintf(_("set printer attributes for printer %s: "),$this->printer_uri) |
1252 | 1230 | .$this->serveroutput->status,1); |
@@ -1301,8 +1279,7 @@ discard block |
||
1301 | 1279 | if (array_key_exists(0,$this->available_printers)) |
1302 | 1280 | { |
1303 | 1281 | self::setPrinterURI($this->available_printers[0]); |
1304 | - } |
|
1305 | - else |
|
1282 | + } else |
|
1306 | 1283 | { |
1307 | 1284 | trigger_error(_("_stringUri: Printer URI is not set: die"),E_USER_WARNING); |
1308 | 1285 | self::_putDebug( _("_stringUri: Printer URI is not set: die\n")); |
@@ -1347,8 +1324,7 @@ discard block |
||
1347 | 1324 | if (is_readable($this->data)) |
1348 | 1325 | { |
1349 | 1326 | self::setJobName(basename($this->data),true); |
1350 | - } |
|
1351 | - else |
|
1327 | + } else |
|
1352 | 1328 | { |
1353 | 1329 | self::setJobName(); |
1354 | 1330 | } |
@@ -1423,8 +1399,7 @@ discard block |
||
1423 | 1399 | if ($is_last == false) |
1424 | 1400 | { |
1425 | 1401 | $is_last = chr(0x00); |
1426 | - } |
|
1427 | - else |
|
1402 | + } else |
|
1428 | 1403 | { |
1429 | 1404 | $is_last = chr(0x01); |
1430 | 1405 | } |
@@ -1448,8 +1423,7 @@ discard block |
||
1448 | 1423 | if (array_key_exists(0,$this->available_printers)) |
1449 | 1424 | { |
1450 | 1425 | self::setPrinterURI($this->available_printers[0]); |
1451 | - } |
|
1452 | - else |
|
1426 | + } else |
|
1453 | 1427 | { |
1454 | 1428 | trigger_error(_("_stringJob: Printer URI is not set: die"),E_USER_WARNING); |
1455 | 1429 | self::_putDebug( _("_stringJob: Printer URI is not set: die\n")); |
@@ -1549,8 +1523,7 @@ discard block |
||
1549 | 1523 | if ($is_last == false) |
1550 | 1524 | { |
1551 | 1525 | $is_last = chr(0x00); |
1552 | - } |
|
1553 | - else |
|
1526 | + } else |
|
1554 | 1527 | { |
1555 | 1528 | $is_last = chr(0x01); |
1556 | 1529 | } |
@@ -1574,8 +1547,7 @@ discard block |
||
1574 | 1547 | if (array_key_exists(0,$this->available_printers)) |
1575 | 1548 | { |
1576 | 1549 | self::setPrinterURI($this->available_printers[0]); |
1577 | - } |
|
1578 | - else |
|
1550 | + } else |
|
1579 | 1551 | { |
1580 | 1552 | trigger_error(_("_stringJob: Printer URI is not set: die"),E_USER_WARNING); |
1581 | 1553 | self::_putDebug( _("_stringJob: Printer URI is not set: die\n")); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $value = $this->default_account_config[$key]; |
208 | 208 | if(isset($config[$key])) { |
209 | 209 | $value = $config[$key]; |
210 | - }elseif(isset($default_config[$key])) { |
|
210 | + } elseif(isset($default_config[$key])) { |
|
211 | 211 | $value = $default_config[$key]; |
212 | 212 | } |
213 | 213 | $this->$key = $value; |
@@ -239,39 +239,39 @@ discard block |
||
239 | 239 | if(isset($config['masks']['message'])) { |
240 | 240 | if(class_exists($config['masks']['message'])) { |
241 | 241 | $this->default_message_mask = $config['masks']['message']; |
242 | - }else{ |
|
242 | + } else{ |
|
243 | 243 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
244 | 244 | } |
245 | - }else{ |
|
245 | + } else{ |
|
246 | 246 | if(class_exists($default_config['message'])) { |
247 | 247 | $this->default_message_mask = $default_config['message']; |
248 | - }else{ |
|
248 | + } else{ |
|
249 | 249 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
250 | 250 | } |
251 | 251 | } |
252 | 252 | if(isset($config['masks']['attachment'])) { |
253 | 253 | if(class_exists($config['masks']['attachment'])) { |
254 | 254 | $this->default_attachment_mask = $config['masks']['attachment']; |
255 | - }else{ |
|
255 | + } else{ |
|
256 | 256 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
257 | 257 | } |
258 | - }else{ |
|
258 | + } else{ |
|
259 | 259 | if(class_exists($default_config['attachment'])) { |
260 | 260 | $this->default_attachment_mask = $default_config['attachment']; |
261 | - }else{ |
|
261 | + } else{ |
|
262 | 262 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
263 | 263 | } |
264 | 264 | } |
265 | - }else{ |
|
265 | + } else{ |
|
266 | 266 | if(class_exists($default_config['message'])) { |
267 | 267 | $this->default_message_mask = $default_config['message']; |
268 | - }else{ |
|
268 | + } else{ |
|
269 | 269 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
270 | 270 | } |
271 | 271 | |
272 | 272 | if(class_exists($default_config['attachment'])) { |
273 | 273 | $this->default_attachment_mask = $default_config['attachment']; |
274 | - }else{ |
|
274 | + } else{ |
|
275 | 275 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
276 | 276 | } |
277 | 277 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $this->connection = new ImapProtocol($this->validate_cert, $this->encryption); |
336 | 336 | $this->connection->setConnectionTimeout($this->timeout); |
337 | 337 | $this->connection->setProxy($this->proxy); |
338 | - }else{ |
|
338 | + } else{ |
|
339 | 339 | if (extension_loaded('imap') === false) { |
340 | 340 | throw new ConnectionFailedException("connection setup failed - no imap function", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
341 | 341 | } |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | } |
477 | 477 | |
478 | 478 | return $folders; |
479 | - }else{ |
|
479 | + } else{ |
|
480 | 480 | throw new FolderFetchingException("failed to fetch any folders"); |
481 | 481 | } |
482 | 482 | } |
@@ -514,7 +514,9 @@ discard block |
||
514 | 514 | $this->checkConnection(); |
515 | 515 | $status = $this->connection->createFolder($folder); |
516 | 516 | |
517 | - if($expunge) $this->expunge(); |
|
517 | + if($expunge) { |
|
518 | + $this->expunge(); |
|
519 | + } |
|
518 | 520 | |
519 | 521 | $folder = $this->getFolder($folder); |
520 | 522 | if($status && $folder) { |
@@ -232,7 +232,9 @@ discard block |
||
232 | 232 | public function move($new_name, $expunge = true) { |
233 | 233 | $this->client->checkConnection(); |
234 | 234 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
235 | - if($expunge) $this->client->expunge(); |
|
235 | + if($expunge) { |
|
236 | + $this->client->expunge(); |
|
237 | + } |
|
236 | 238 | |
237 | 239 | $folder = $this->client->getFolder($new_name); |
238 | 240 | $event = $this->getEvent("folder", "moved"); |
@@ -310,7 +312,9 @@ discard block |
||
310 | 312 | */ |
311 | 313 | public function delete($expunge = true) { |
312 | 314 | $status = $this->client->getConnection()->deleteFolder($this->path); |
313 | - if($expunge) $this->client->expunge(); |
|
315 | + if($expunge) { |
|
316 | + $this->client->expunge(); |
|
317 | + } |
|
314 | 318 | |
315 | 319 | $event = $this->getEvent("folder", "deleted"); |
316 | 320 | $event::dispatch($this); |
@@ -384,7 +388,7 @@ discard block |
||
384 | 388 | |
385 | 389 | $connection->idle(); |
386 | 390 | } |
387 | - }catch (Exceptions\RuntimeException $e) { |
|
391 | + } catch (Exceptions\RuntimeException $e) { |
|
388 | 392 | if(strpos($e->getMessage(), "connection closed") === false) { |
389 | 393 | throw $e; |
390 | 394 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $name = $this->decodeFolderName($item->name); |
324 | 324 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
325 | 325 | } |
326 | - }else{ |
|
326 | + } else{ |
|
327 | 327 | throw new RuntimeException(\imap_last_error()); |
328 | 328 | } |
329 | 329 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | if ($mode == "+"){ |
349 | 349 | $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
350 | - }else{ |
|
350 | + } else{ |
|
351 | 351 | $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
352 | 352 | } |
353 | 353 |