@@ -25,9 +25,11 @@ |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | - public function do() |
|
28 | + public function do { |
|
29 | + () |
|
29 | 30 | { |
30 | 31 | global $globalaaa, $globalbbb; |
32 | + } |
|
31 | 33 | echo 'dobbb'."\n"; |
32 | 34 | $globalaaa.='+bbb'; |
33 | 35 | $globalbbb.='+bbb'; |
@@ -27,8 +27,10 @@ |
||
27 | 27 | * |
28 | 28 | * @return void |
29 | 29 | */ |
30 | - public function do() |
|
30 | + public function do { |
|
31 | + () |
|
31 | 32 | { |
32 | 33 | echo 'doaaa'."\n"; |
33 | 34 | } |
35 | + } |
|
34 | 36 | } |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // File generated to link to the master file - DO NOT MODIFY - It is just an include |
3 | 3 | if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { |
4 | - if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); |
|
4 | + if (! defined('USEEXTERNALSERVER')) { |
|
5 | + define('USEEXTERNALSERVER', 1); |
|
6 | + } |
|
5 | 7 | require_once '/var/www/html/dolibarr_dev/htdocs/master.inc.php'; |
6 | 8 | } |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | // File generated to link to the master file - DO NOT MODIFY - It is just an include |
3 | 3 | if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { |
4 | - if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); |
|
4 | + if (! defined('USEEXTERNALSERVER')) { |
|
5 | + define('USEEXTERNALSERVER', 1); |
|
6 | + } |
|
5 | 7 | require_once '/home/ldestailleur/git/dolibarr_dev/htdocs/master.inc.php'; |
6 | 8 | } |
7 | 9 | ?> |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // File generated to link to the master file - DO NOT MODIFY - It is just an include |
3 | 3 | if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { |
4 | - if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); |
|
4 | + if (! defined('USEEXTERNALSERVER')) { |
|
5 | + define('USEEXTERNALSERVER', 1); |
|
6 | + } |
|
5 | 7 | require_once '/home/ldestailleur/git/dolibarr_dev/htdocs/master.inc.php'; |
6 | 8 | } |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of file website/samples/wrapper.php |
3 | 3 | $websitekey = basename(__DIR__); |
4 | -if (strpos($_SERVER["PHP_SELF"], 'website/samples/wrapper.php')) die("Sample file for website module. Can be called directly."); |
|
4 | +if (strpos($_SERVER["PHP_SELF"], 'website/samples/wrapper.php')) { |
|
5 | + die("Sample file for website module. Can be called directly."); |
|
6 | +} |
|
5 | 7 | if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded |
6 | 8 | include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
7 | 9 | |
@@ -17,7 +19,9 @@ discard block |
||
17 | 19 | |
18 | 20 | // Parameters for RSS |
19 | 21 | $rss = GETPOST('rss', 'aZ09'); |
20 | -if ($rss) $original_file = 'blog.rss'; |
|
22 | +if ($rss) { |
|
23 | + $original_file = 'blog.rss'; |
|
24 | +} |
|
21 | 25 | |
22 | 26 | // If we have a hash public (hashp), we guess the original_file. |
23 | 27 | if (!empty($hashp)) { |
@@ -52,14 +56,23 @@ discard block |
||
52 | 56 | |
53 | 57 | // Define attachment (attachment=true to force choice popup 'open'/'save as') |
54 | 58 | $attachment = true; |
55 | -if (preg_match('/\.(html|htm)$/i', $original_file)) $attachment = false; |
|
56 | -if (isset($_GET["attachment"])) $attachment = (GETPOST("attachment", 'alphanohtml') ? true : false); |
|
57 | -if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS_WEBSITE)) $attachment = false; |
|
59 | +if (preg_match('/\.(html|htm)$/i', $original_file)) { |
|
60 | + $attachment = false; |
|
61 | +} |
|
62 | +if (isset($_GET["attachment"])) { |
|
63 | + $attachment = (GETPOST("attachment", 'alphanohtml') ? true : false); |
|
64 | +} |
|
65 | +if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS_WEBSITE)) { |
|
66 | + $attachment = false; |
|
67 | +} |
|
58 | 68 | |
59 | 69 | // Define mime type |
60 | 70 | $type = 'application/octet-stream'; |
61 | -if (GETPOSTISSET('type')) $type = GETPOST('type', 'alpha'); |
|
62 | -else $type = dol_mimetype($original_file); |
|
71 | +if (GETPOSTISSET('type')) { |
|
72 | + $type = GETPOST('type', 'alpha'); |
|
73 | +} else { |
|
74 | + $type = dol_mimetype($original_file); |
|
75 | +} |
|
63 | 76 | |
64 | 77 | // Security: Delete string ../ into $original_file |
65 | 78 | $original_file = str_replace("../", "/", $original_file); |
@@ -90,7 +103,9 @@ discard block |
||
90 | 103 | $website->fetch('', $websitekey); |
91 | 104 | |
92 | 105 | $filters = array('type_container'=>'blogpost'); |
93 | - if ($l) $filters['lang'] = $l; |
|
106 | + if ($l) { |
|
107 | + $filters['lang'] = $l; |
|
108 | + } |
|
94 | 109 | |
95 | 110 | $MAXNEWS = ($limit ? $limit : 20); |
96 | 111 | $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); |
@@ -143,8 +158,9 @@ discard block |
||
143 | 158 | $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l); |
144 | 159 | |
145 | 160 | if ($result >= 0) { |
146 | - if (dol_move($outputfiletmp, $outputfile, 0, 1, 0, 0)) $result = 1; |
|
147 | - else { |
|
161 | + if (dol_move($outputfiletmp, $outputfile, 0, 1, 0, 0)) { |
|
162 | + $result = 1; |
|
163 | + } else { |
|
148 | 164 | $error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile; |
149 | 165 | dol_syslog("build_exportfile ".$error, LOG_ERR); |
150 | 166 | dol_delete_file($outputfiletmp, 0, 1); |
@@ -162,26 +178,39 @@ discard block |
||
162 | 178 | |
163 | 179 | if ($result >= 0) { |
164 | 180 | $attachment = false; |
165 | - if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; |
|
181 | + if (isset($_GET["attachment"])) { |
|
182 | + $attachment = $_GET["attachment"]; |
|
183 | + } |
|
166 | 184 | //$attachment = false; |
167 | 185 | $contenttype = 'application/rss+xml'; |
168 | - if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; |
|
186 | + if (isset($_GET["contenttype"])) { |
|
187 | + $contenttype = $_GET["contenttype"]; |
|
188 | + } |
|
169 | 189 | //$contenttype='text/plain'; |
170 | 190 | $outputencoding = 'UTF-8'; |
171 | 191 | |
172 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); |
|
173 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
192 | + if ($contenttype) { |
|
193 | + header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); |
|
194 | + } |
|
195 | + if ($attachment) { |
|
196 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
197 | + } |
|
174 | 198 | |
175 | 199 | // Ajout directives pour resoudre bug IE |
176 | 200 | //header('Cache-Control: Public, must-revalidate'); |
177 | 201 | //header('Pragma: public'); |
178 | - if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
179 | - else header('Cache-Control: private, must-revalidate'); |
|
202 | + if ($cachedelay) { |
|
203 | + header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
204 | + } else { |
|
205 | + header('Cache-Control: private, must-revalidate'); |
|
206 | + } |
|
180 | 207 | |
181 | 208 | // Clean parameters |
182 | 209 | $outputfile = $dir_temp.'/'.$filename; |
183 | 210 | $result = readfile($outputfile); |
184 | - if (!$result) print 'File '.$outputfile.' was empty.'; |
|
211 | + if (!$result) { |
|
212 | + print 'File '.$outputfile.' was empty.'; |
|
213 | + } |
|
185 | 214 | |
186 | 215 | // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
187 | 216 | exit; |
@@ -227,13 +256,20 @@ discard block |
||
227 | 256 | //top_httphead($type); |
228 | 257 | header('Content-Type: '.$type); |
229 | 258 | header('Content-Description: File Transfer'); |
230 | - if ($encoding) header('Content-Encoding: '.$encoding); |
|
259 | + if ($encoding) { |
|
260 | + header('Content-Encoding: '.$encoding); |
|
261 | + } |
|
231 | 262 | // Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open) |
232 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
233 | - else header('Content-Disposition: inline; filename="'.$filename.'"'); |
|
263 | + if ($attachment) { |
|
264 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
265 | + } else { |
|
266 | + header('Content-Disposition: inline; filename="'.$filename.'"'); |
|
267 | + } |
|
234 | 268 | header('Content-Length: '.dol_filesize($fullpath_original_file)); |
235 | 269 | |
236 | 270 | readfile($fullpath_original_file_osencoded); |
237 | 271 | } |
238 | -if (is_object($db)) $db->close(); |
|
272 | +if (is_object($db)) { |
|
273 | + $db->close(); |
|
274 | +} |
|
239 | 275 | // END PHP |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! defined('ODTPHP_PATHTOPCLZIP')) define('ODTPHP_PATHTOPCLZIP','pclzip/'); |
|
2 | +if (! defined('ODTPHP_PATHTOPCLZIP')) { |
|
3 | + define('ODTPHP_PATHTOPCLZIP','pclzip/'); |
|
4 | +} |
|
3 | 5 | require_once ODTPHP_PATHTOPCLZIP.'pclzip.lib.php'; |
4 | 6 | require_once 'ZipInterface.php'; |
5 | 7 | class PclZipProxyException extends Exception |
@@ -32,7 +34,10 @@ discard block |
||
32 | 34 | throw new PclZipProxyException('PclZip class not loaded - PclZip library |
33 | 35 | is required for using PclZipProxy'); ; |
34 | 36 | } |
35 | - if ($forcedir) $this->tmpdir=preg_replace('|[//\/]$|','',$forcedir); // $this->tmpdir must not contains / at the end |
|
37 | + if ($forcedir) { |
|
38 | + $this->tmpdir=preg_replace('|[//\/]$|','',$forcedir); |
|
39 | + } |
|
40 | + // $this->tmpdir must not contains / at the end |
|
36 | 41 | } |
37 | 42 | |
38 | 43 | /** |
@@ -88,10 +88,16 @@ discard block |
||
88 | 88 | { |
89 | 89 | // To provide debug information on line number processed |
90 | 90 | global $count; |
91 | - if (empty($count)) $count=1; |
|
92 | - else $count++; |
|
91 | + if (empty($count)) { |
|
92 | + $count=1; |
|
93 | + } else { |
|
94 | + $count++; |
|
95 | + } |
|
93 | 96 | |
94 | - if (empty($this->savxml)) $this->savxml = $this->xml; // Sav content of line at first line merged, so we will reuse original for next steps |
|
97 | + if (empty($this->savxml)) { |
|
98 | + $this->savxml = $this->xml; |
|
99 | + } |
|
100 | + // Sav content of line at first line merged, so we will reuse original for next steps |
|
95 | 101 | $this->xml = $this->savxml; |
96 | 102 | $tmpvars = $this->vars; // Store into $tmpvars so we won't modify this->vars when completing data with empty values |
97 | 103 | |
@@ -123,7 +129,9 @@ discard block |
||
123 | 129 | $reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
124 | 130 | preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER); |
125 | 131 | 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 |
126 | - if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml); |
|
132 | + if (!empty($match[3])) { |
|
133 | + $this->xml = str_replace($match[0], $match[3], $this->xml); |
|
134 | + } |
|
127 | 135 | } |
128 | 136 | // Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether) |
129 | 137 | $this->xml = preg_replace($reg, '', $this->xml); |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public static function contains($haystack, $needle, $caseSensitive = true) |
27 | 27 | { |
28 | - if (empty($needle)) |
|
29 | - return true; |
|
28 | + if (empty($needle)) { |
|
29 | + return true; |
|
30 | + } |
|
30 | 31 | return $caseSensitive |
31 | 32 | ? strpos($haystack, $needle) !== false |
32 | 33 | : stripos($haystack, $needle) !== false; |
@@ -62,7 +63,9 @@ discard block |
||
62 | 63 | } |
63 | 64 | |
64 | 65 | // @CHANGE LDR |
65 | - if (!is_string($haystack)) return false; |
|
66 | + if (!is_string($haystack)) { |
|
67 | + return false; |
|
68 | + } |
|
66 | 69 | |
67 | 70 | return (substr($haystack, -$length) === $needle); |
68 | 71 | } |