@@ -444,7 +444,9 @@ |
||
| 444 | 444 | { |
| 445 | 445 | $paymentsalary = array(); |
| 446 | 446 | $fields = Salaries::$FIELDSPAYMENT; |
| 447 | - if (isModEnabled("bank")) array_push($fields, "accountid"); |
|
| 447 | + if (isModEnabled("bank")) { |
|
| 448 | + array_push($fields, "accountid"); |
|
| 449 | + } |
|
| 448 | 450 | foreach ($fields as $field) { |
| 449 | 451 | if (!isset($data[$field])) { |
| 450 | 452 | throw new RestException(400, "$field field missing"); |
@@ -48,7 +48,9 @@ |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // Not sure this is required |
| 51 | -if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
| 51 | +if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) { |
|
| 52 | + unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
| 53 | +} |
|
| 52 | 54 | |
| 53 | 55 | if (GETPOST('noredirect')) { |
| 54 | 56 | return; |
@@ -78,7 +78,10 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $md5uniqid = md5(uniqid()); |
| 81 | - if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or / |
|
| 81 | + if ($this->config['PATH_TO_TMP']) { |
|
| 82 | + $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); |
|
| 83 | + } |
|
| 84 | + // Remove last \ or / |
|
| 82 | 85 | $this->tmpdir .= ($this->tmpdir?'/':'').$md5uniqid; |
| 83 | 86 | $this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug. |
| 84 | 87 | |
@@ -94,7 +97,9 @@ discard block |
||
| 94 | 97 | |
| 95 | 98 | // Load zip proxy |
| 96 | 99 | $zipHandler = $this->config['ZIP_PROXY']; |
| 97 | - if (!defined('PCLZIP_TEMPORARY_DIR')) define('PCLZIP_TEMPORARY_DIR', $this->tmpdir); |
|
| 100 | + if (!defined('PCLZIP_TEMPORARY_DIR')) { |
|
| 101 | + define('PCLZIP_TEMPORARY_DIR', $this->tmpdir); |
|
| 102 | + } |
|
| 98 | 103 | include_once 'zip/'.$zipHandler.'.php'; |
| 99 | 104 | if (! class_exists($this->config['ZIP_PROXY'])) { |
| 100 | 105 | throw new OdfException($this->config['ZIP_PROXY'] . ' class not found - check your php settings'); |
@@ -236,8 +241,12 @@ discard block |
||
| 236 | 241 | */ |
| 237 | 242 | private function _replaceHtmlWithOdtTag($tags, &$customStyles, &$fontDeclarations, $encode = false, $charset = '') |
| 238 | 243 | { |
| 239 | - if ($customStyles == null) $customStyles = array(); |
|
| 240 | - if ($fontDeclarations == null) $fontDeclarations = array(); |
|
| 244 | + if ($customStyles == null) { |
|
| 245 | + $customStyles = array(); |
|
| 246 | + } |
|
| 247 | + if ($fontDeclarations == null) { |
|
| 248 | + $fontDeclarations = array(); |
|
| 249 | + } |
|
| 241 | 250 | |
| 242 | 251 | $odtResult = ''; |
| 243 | 252 | |
@@ -556,10 +565,15 @@ discard block |
||
| 556 | 565 | */ |
| 557 | 566 | private function _parse($type = 'content') |
| 558 | 567 | { |
| 559 | - if ($type == 'content') $xml = &$this->contentXml; |
|
| 560 | - elseif ($type == 'styles') $xml = &$this->stylesXml; |
|
| 561 | - elseif ($type == 'meta') $xml = &$this->metaXml; |
|
| 562 | - else return; |
|
| 568 | + if ($type == 'content') { |
|
| 569 | + $xml = &$this->contentXml; |
|
| 570 | + } elseif ($type == 'styles') { |
|
| 571 | + $xml = &$this->stylesXml; |
|
| 572 | + } elseif ($type == 'meta') { |
|
| 573 | + $xml = &$this->metaXml; |
|
| 574 | + } else { |
|
| 575 | + return; |
|
| 576 | + } |
|
| 563 | 577 | |
| 564 | 578 | // Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined |
| 565 | 579 | $reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
@@ -600,7 +614,9 @@ discard block |
||
| 600 | 614 | $reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
| 601 | 615 | preg_match_all($reg, $xml, $matches, PREG_SET_ORDER); |
| 602 | 616 | foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause |
| 603 | - if (!empty($match[3])) $xml = str_replace($match[0], $match[3], $xml); |
|
| 617 | + if (!empty($match[3])) { |
|
| 618 | + $xml = str_replace($match[0], $match[3], $xml); |
|
| 619 | + } |
|
| 604 | 620 | } |
| 605 | 621 | // Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether) |
| 606 | 622 | $xml = preg_replace($reg, '', $xml); |
@@ -754,7 +770,9 @@ discard block |
||
| 754 | 770 | */ |
| 755 | 771 | public function setMetaData() |
| 756 | 772 | { |
| 757 | - if (empty($this->creator)) $this->creator=''; |
|
| 773 | + if (empty($this->creator)) { |
|
| 774 | + $this->creator=''; |
|
| 775 | + } |
|
| 758 | 776 | |
| 759 | 777 | $this->metaXml = preg_replace('/<dc:date>.*<\/dc:date>/', '<dc:date>'.gmdate("Y-m-d\TH:i:s").'</dc:date>', $this->metaXml); |
| 760 | 778 | $this->metaXml = preg_replace('/<dc:creator>.*<\/dc:creator>/', '<dc:creator>'.htmlspecialchars($this->creator).'</dc:creator>', $this->metaXml); |
@@ -822,7 +840,9 @@ discard block |
||
| 822 | 840 | { |
| 823 | 841 | global $conf; |
| 824 | 842 | |
| 825 | - if ( $name == "" ) $name = "temp".md5(uniqid()); |
|
| 843 | + if ( $name == "" ) { |
|
| 844 | + $name = "temp".md5(uniqid()); |
|
| 845 | + } |
|
| 826 | 846 | |
| 827 | 847 | dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG); |
| 828 | 848 | $this->saveToDisk($name); |