@@ -48,35 +48,51 @@ discard block |
||
48 | 48 | */ |
49 | 49 | |
50 | 50 | // include class for decoding filters |
51 | -if (defined('TCPDF_PATH')) require_once(constant('TCPDF_PATH').'/include/tcpdf_filters.php'); |
|
52 | -else require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); |
|
51 | +if (defined('TCPDF_PATH')) { |
|
52 | + require_once(constant('TCPDF_PATH').'/include/tcpdf_filters.php'); |
|
53 | +} else { |
|
54 | + require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); |
|
55 | +} |
|
53 | 56 | |
54 | -if (!defined ('PDF_TYPE_NULL')) |
|
57 | +if (!defined ('PDF_TYPE_NULL')) { |
|
55 | 58 | define ('PDF_TYPE_NULL', 0); |
56 | -if (!defined ('PDF_TYPE_NUMERIC')) |
|
59 | +} |
|
60 | +if (!defined ('PDF_TYPE_NUMERIC')) { |
|
57 | 61 | define ('PDF_TYPE_NUMERIC', 1); |
58 | -if (!defined ('PDF_TYPE_TOKEN')) |
|
62 | +} |
|
63 | +if (!defined ('PDF_TYPE_TOKEN')) { |
|
59 | 64 | define ('PDF_TYPE_TOKEN', 2); |
60 | -if (!defined ('PDF_TYPE_HEX')) |
|
65 | +} |
|
66 | +if (!defined ('PDF_TYPE_HEX')) { |
|
61 | 67 | define ('PDF_TYPE_HEX', 3); |
62 | -if (!defined ('PDF_TYPE_STRING')) |
|
68 | +} |
|
69 | +if (!defined ('PDF_TYPE_STRING')) { |
|
63 | 70 | define ('PDF_TYPE_STRING', 4); |
64 | -if (!defined ('PDF_TYPE_DICTIONARY')) |
|
71 | +} |
|
72 | +if (!defined ('PDF_TYPE_DICTIONARY')) { |
|
65 | 73 | define ('PDF_TYPE_DICTIONARY', 5); |
66 | -if (!defined ('PDF_TYPE_ARRAY')) |
|
74 | +} |
|
75 | +if (!defined ('PDF_TYPE_ARRAY')) { |
|
67 | 76 | define ('PDF_TYPE_ARRAY', 6); |
68 | -if (!defined ('PDF_TYPE_OBJDEC')) |
|
77 | +} |
|
78 | +if (!defined ('PDF_TYPE_OBJDEC')) { |
|
69 | 79 | define ('PDF_TYPE_OBJDEC', 7); |
70 | -if (!defined ('PDF_TYPE_OBJREF')) |
|
80 | +} |
|
81 | +if (!defined ('PDF_TYPE_OBJREF')) { |
|
71 | 82 | define ('PDF_TYPE_OBJREF', 8); |
72 | -if (!defined ('PDF_TYPE_OBJECT')) |
|
83 | +} |
|
84 | +if (!defined ('PDF_TYPE_OBJECT')) { |
|
73 | 85 | define ('PDF_TYPE_OBJECT', 9); |
74 | -if (!defined ('PDF_TYPE_STREAM')) |
|
86 | +} |
|
87 | +if (!defined ('PDF_TYPE_STREAM')) { |
|
75 | 88 | define ('PDF_TYPE_STREAM', 10); |
76 | -if (!defined ('PDF_TYPE_BOOLEAN')) |
|
89 | +} |
|
90 | +if (!defined ('PDF_TYPE_BOOLEAN')) { |
|
77 | 91 | define ('PDF_TYPE_BOOLEAN', 11); |
78 | -if (!defined ('PDF_TYPE_REAL')) |
|
92 | +} |
|
93 | +if (!defined ('PDF_TYPE_REAL')) { |
|
79 | 94 | define ('PDF_TYPE_REAL', 12); |
95 | +} |
|
80 | 96 | |
81 | 97 | /** |
82 | 98 | * @class tcpdi_parser |
@@ -245,8 +261,9 @@ discard block |
||
245 | 261 | */ |
246 | 262 | public function getPDFVersion() { |
247 | 263 | preg_match('/\d\.\d/', substr($this->pdfdata, 0, 16), $m); |
248 | - if (isset($m[0])) |
|
249 | - $this->pdfVersion = $m[0]; |
|
264 | + if (isset($m[0])) { |
|
265 | + $this->pdfVersion = $m[0]; |
|
266 | + } |
|
250 | 267 | return $this->pdfVersion; |
251 | 268 | } |
252 | 269 | |
@@ -1186,16 +1203,18 @@ discard block |
||
1186 | 1203 | // parent object. |
1187 | 1204 | if (isset ($obj[1][1]['/Resources'])) { |
1188 | 1205 | $res = $obj[1][1]['/Resources']; |
1189 | - if ($res[0] == PDF_TYPE_OBJECT) |
|
1190 | - return $res[1]; |
|
1206 | + if ($res[0] == PDF_TYPE_OBJECT) { |
|
1207 | + return $res[1]; |
|
1208 | + } |
|
1191 | 1209 | return $res; |
1192 | 1210 | } else { |
1193 | 1211 | if (!isset ($obj[1][1]['/Parent'])) { |
1194 | 1212 | return false; |
1195 | 1213 | } else { |
1196 | 1214 | $res = $this->_getPageResources($obj[1][1]['/Parent']); |
1197 | - if ($res[0] == PDF_TYPE_OBJECT) |
|
1198 | - return $res[1]; |
|
1215 | + if ($res[0] == PDF_TYPE_OBJECT) { |
|
1216 | + return $res[1]; |
|
1217 | + } |
|
1199 | 1218 | return $res; |
1200 | 1219 | } |
1201 | 1220 | } |
@@ -1295,8 +1314,9 @@ discard block |
||
1295 | 1314 | public function getPageBox($page, $box_index, $k) { |
1296 | 1315 | $page = $this->getObjectVal($page); |
1297 | 1316 | $box = null; |
1298 | - if (isset($page[1][1][$box_index])) |
|
1299 | - $box =& $page[1][1][$box_index]; |
|
1317 | + if (isset($page[1][1][$box_index])) { |
|
1318 | + $box =& $page[1][1][$box_index]; |
|
1319 | + } |
|
1300 | 1320 | |
1301 | 1321 | if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { |
1302 | 1322 | $tmp_box = $this->getObjectVal($box); |
@@ -1364,16 +1384,18 @@ discard block |
||
1364 | 1384 | $obj = $this->getObjectVal($obj); |
1365 | 1385 | if (isset ($obj[1][1]['/Rotate'])) { |
1366 | 1386 | $res = $this->getObjectVal($obj[1][1]['/Rotate']); |
1367 | - if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) |
|
1368 | - return $res[1]; |
|
1387 | + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) { |
|
1388 | + return $res[1]; |
|
1389 | + } |
|
1369 | 1390 | return $res; |
1370 | 1391 | } else { |
1371 | 1392 | if (!isset ($obj[1][1]['/Parent'])) { |
1372 | 1393 | return false; |
1373 | 1394 | } else { |
1374 | 1395 | $res = $this->_getPageRotation($obj[1][1]['/Parent']); |
1375 | - if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) |
|
1376 | - return $res[1]; |
|
1396 | + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) { |
|
1397 | + return $res[1]; |
|
1398 | + } |
|
1377 | 1399 | return $res; |
1378 | 1400 | } |
1379 | 1401 | } |
@@ -79,17 +79,22 @@ discard block |
||
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - if ($this->page <= 0) |
|
83 | - $this->error("You have to add a page to fpdf first!"); |
|
82 | + if ($this->page <= 0) { |
|
83 | + $this->error("You have to add a page to fpdf first!"); |
|
84 | + } |
|
84 | 85 | |
85 | - if ($x == null) |
|
86 | - $x = 0; |
|
87 | - if ($y == null) |
|
88 | - $y = 0; |
|
89 | - if ($w == null) |
|
90 | - $w = $this->w; |
|
91 | - if ($h == null) |
|
92 | - $h = $this->h; |
|
86 | + if ($x == null) { |
|
87 | + $x = 0; |
|
88 | + } |
|
89 | + if ($y == null) { |
|
90 | + $y = 0; |
|
91 | + } |
|
92 | + if ($w == null) { |
|
93 | + $w = $this->w; |
|
94 | + } |
|
95 | + if ($h == null) { |
|
96 | + $h = $this->h; |
|
97 | + } |
|
93 | 98 | |
94 | 99 | // Save settings |
95 | 100 | $this->tpl++; |
@@ -165,8 +170,9 @@ discard block |
||
165 | 170 | $this->FontSize = $tpl['o_FontSize']; |
166 | 171 | |
167 | 172 | $fontkey = $this->FontFamily . $this->FontStyle; |
168 | - if ($fontkey) |
|
169 | - $this->CurrentFont =& $this->fonts[$fontkey]; |
|
173 | + if ($fontkey) { |
|
174 | + $this->CurrentFont =& $this->fonts[$fontkey]; |
|
175 | + } |
|
170 | 176 | |
171 | 177 | return $this->tpl; |
172 | 178 | } else { |
@@ -192,11 +198,13 @@ discard block |
||
192 | 198 | * @retrun array The height and width of the template |
193 | 199 | */ |
194 | 200 | function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) { |
195 | - if ($this->page <= 0) |
|
196 | - $this->error('You have to add a page first!'); |
|
201 | + if ($this->page <= 0) { |
|
202 | + $this->error('You have to add a page first!'); |
|
203 | + } |
|
197 | 204 | |
198 | - if (!isset($this->tpls[$tplidx])) |
|
199 | - $this->error('Template does not exist!'); |
|
205 | + if (!isset($this->tpls[$tplidx])) { |
|
206 | + $this->error('Template does not exist!'); |
|
207 | + } |
|
200 | 208 | |
201 | 209 | if ($this->_intpl) { |
202 | 210 | $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; |
@@ -206,10 +214,12 @@ discard block |
||
206 | 214 | $w = $tpl['w']; |
207 | 215 | $h = $tpl['h']; |
208 | 216 | |
209 | - if ($_x == null) |
|
210 | - $_x = 0; |
|
211 | - if ($_y == null) |
|
212 | - $_y = 0; |
|
217 | + if ($_x == null) { |
|
218 | + $_x = 0; |
|
219 | + } |
|
220 | + if ($_y == null) { |
|
221 | + $_y = 0; |
|
222 | + } |
|
213 | 223 | |
214 | 224 | $_x += $tpl['x']; |
215 | 225 | $_y += $tpl['y']; |
@@ -249,8 +259,9 @@ discard block |
||
249 | 259 | * @return array The height and width of the template |
250 | 260 | */ |
251 | 261 | function getTemplateSize($tplidx, $_w = 0, $_h = 0) { |
252 | - if (!isset($this->tpls[$tplidx])) |
|
253 | - return false; |
|
262 | + if (!isset($this->tpls[$tplidx])) { |
|
263 | + return false; |
|
264 | + } |
|
254 | 265 | |
255 | 266 | $tpl =& $this->tpls[$tplidx]; |
256 | 267 | $w = $tpl['w']; |
@@ -261,10 +272,12 @@ discard block |
||
261 | 272 | $_h = $h; |
262 | 273 | } |
263 | 274 | |
264 | - if($_w == 0) |
|
265 | - $_w = $_h * $w / $h; |
|
266 | - if($_h == 0) |
|
267 | - $_h = $_w * $h / $w; |
|
275 | + if($_w == 0) { |
|
276 | + $_w = $_h * $w / $h; |
|
277 | + } |
|
278 | + if($_h == 0) { |
|
279 | + $_h = $_w * $h / $w; |
|
280 | + } |
|
268 | 281 | |
269 | 282 | return array("w" => $_w, "h" => $_h); |
270 | 283 | } |
@@ -323,8 +336,9 @@ discard block |
||
323 | 336 | return call_user_func_array(array($this, 'TCPDF::AddPage'), $args); |
324 | 337 | } |
325 | 338 | |
326 | - if ($this->_intpl) |
|
327 | - $this->Error('Adding pages in templates isn\'t possible!'); |
|
339 | + if ($this->_intpl) { |
|
340 | + $this->Error('Adding pages in templates isn\'t possible!'); |
|
341 | + } |
|
328 | 342 | |
329 | 343 | parent::AddPage($orientation, $format); |
330 | 344 | } |
@@ -338,8 +352,9 @@ discard block |
||
338 | 352 | return call_user_func_array(array($this, 'TCPDF::Link'), $args); |
339 | 353 | } |
340 | 354 | |
341 | - if ($this->_intpl) |
|
342 | - $this->Error('Using links in templates aren\'t possible!'); |
|
355 | + if ($this->_intpl) { |
|
356 | + $this->Error('Using links in templates aren\'t possible!'); |
|
357 | + } |
|
343 | 358 | |
344 | 359 | parent::Link($x, $y, $w, $h, $link); |
345 | 360 | } |
@@ -350,8 +365,9 @@ discard block |
||
350 | 365 | return call_user_func_array(array($this, 'TCPDF::AddLink'), $args); |
351 | 366 | } |
352 | 367 | |
353 | - if ($this->_intpl) |
|
354 | - $this->Error('Adding links in templates aren\'t possible!'); |
|
368 | + if ($this->_intpl) { |
|
369 | + $this->Error('Adding links in templates aren\'t possible!'); |
|
370 | + } |
|
355 | 371 | return parent::AddLink(); |
356 | 372 | } |
357 | 373 | |
@@ -361,8 +377,9 @@ discard block |
||
361 | 377 | return call_user_func_array(array($this, 'TCPDF::SetLink'), $args); |
362 | 378 | } |
363 | 379 | |
364 | - if ($this->_intpl) |
|
365 | - $this->Error('Setting links in templates aren\'t possible!'); |
|
380 | + if ($this->_intpl) { |
|
381 | + $this->Error('Setting links in templates aren\'t possible!'); |
|
382 | + } |
|
366 | 383 | parent::SetLink($link, $y, $page); |
367 | 384 | } |
368 | 385 | |
@@ -402,8 +419,9 @@ discard block |
||
402 | 419 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
403 | 420 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
404 | 421 | $this->_out('/Font <<'); |
405 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
406 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
422 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
423 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
424 | + } |
|
407 | 425 | $this->_out('>>'); |
408 | 426 | } |
409 | 427 | if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
@@ -411,12 +429,14 @@ discard block |
||
411 | 429 | { |
412 | 430 | $this->_out('/XObject <<'); |
413 | 431 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
414 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
415 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
432 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
433 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
434 | + } |
|
416 | 435 | } |
417 | 436 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
418 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
419 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
437 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
438 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
439 | + } |
|
420 | 440 | } |
421 | 441 | $this->_out('>>'); |
422 | 442 | } |
@@ -84,8 +84,9 @@ discard block |
||
84 | 84 | function setSourceFile($filename) { |
85 | 85 | $this->current_filename = $filename; |
86 | 86 | |
87 | - if (!isset($this->parsers[$filename])) |
|
88 | - $this->parsers[$filename] = $this->_getPdfParser($filename); |
|
87 | + if (!isset($this->parsers[$filename])) { |
|
88 | + $this->parsers[$filename] = $this->_getPdfParser($filename); |
|
89 | + } |
|
89 | 90 | $this->current_parser =& $this->parsers[$filename]; |
90 | 91 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
91 | 92 | |
@@ -102,8 +103,9 @@ discard block |
||
102 | 103 | $filename = uniqid('tcpdi-'); |
103 | 104 | $this->current_filename = $filename; |
104 | 105 | |
105 | - if (!isset($this->parsers[$filename])) |
|
106 | - $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
|
106 | + if (!isset($this->parsers[$filename])) { |
|
107 | + $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
|
108 | + } |
|
107 | 109 | $this->current_parser =& $this->parsers[$filename]; |
108 | 110 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
109 | 111 | |
@@ -154,14 +156,16 @@ discard block |
||
154 | 156 | |
155 | 157 | // check if page already imported |
156 | 158 | $pageKey = $fn . '-' . ((int)$pageno) . $boxName; |
157 | - if (isset($this->_importedPages[$pageKey])) |
|
158 | - return $this->_importedPages[$pageKey]; |
|
159 | + if (isset($this->_importedPages[$pageKey])) { |
|
160 | + return $this->_importedPages[$pageKey]; |
|
161 | + } |
|
159 | 162 | |
160 | 163 | $parser =& $this->parsers[$fn]; |
161 | 164 | $parser->setPageno($pageno); |
162 | 165 | |
163 | - if (!in_array($boxName, $parser->availableBoxes)) |
|
164 | - return $this->Error(sprintf('Unknown box: %s', $boxName)); |
|
166 | + if (!in_array($boxName, $parser->availableBoxes)) { |
|
167 | + return $this->Error(sprintf('Unknown box: %s', $boxName)); |
|
168 | + } |
|
165 | 169 | |
166 | 170 | $pageboxes = $parser->getPageBoxes($pageno, $this->k); |
167 | 171 | |
@@ -172,13 +176,16 @@ discard block |
||
172 | 176 | * TrimBox: Default -> CropBox |
173 | 177 | * ArtBox: Default -> CropBox |
174 | 178 | */ |
175 | - if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) |
|
176 | - $boxName = '/CropBox'; |
|
177 | - if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') |
|
178 | - $boxName = '/MediaBox'; |
|
179 | + if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) { |
|
180 | + $boxName = '/CropBox'; |
|
181 | + } |
|
182 | + if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') { |
|
183 | + $boxName = '/MediaBox'; |
|
184 | + } |
|
179 | 185 | |
180 | - if (!isset($pageboxes[$boxName])) |
|
181 | - return false; |
|
186 | + if (!isset($pageboxes[$boxName])) { |
|
187 | + return false; |
|
188 | + } |
|
182 | 189 | |
183 | 190 | $this->lastUsedPageBox = $boxName; |
184 | 191 | |
@@ -210,8 +217,9 @@ discard block |
||
210 | 217 | $tpl['w'] = $steps % 2 == 0 ? $_w : $_h; |
211 | 218 | $tpl['h'] = $steps % 2 == 0 ? $_h : $_w; |
212 | 219 | |
213 | - if ($angle < 0) |
|
214 | - $angle += 360; |
|
220 | + if ($angle < 0) { |
|
221 | + $angle += 360; |
|
222 | + } |
|
215 | 223 | |
216 | 224 | $tpl['_rotationAngle'] = $angle * -1; |
217 | 225 | } |
@@ -356,8 +364,9 @@ discard block |
||
356 | 364 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
357 | 365 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
358 | 366 | $this->_out('/Font <<'); |
359 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
360 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
367 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
368 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
369 | + } |
|
361 | 370 | $this->_out('>>'); |
362 | 371 | } |
363 | 372 | if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
@@ -365,12 +374,14 @@ discard block |
||
365 | 374 | { |
366 | 375 | $this->_out('/XObject <<'); |
367 | 376 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
368 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
369 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
377 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
378 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
379 | + } |
|
370 | 380 | } |
371 | 381 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
372 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
373 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
382 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
383 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
384 | + } |
|
374 | 385 | } |
375 | 386 | $this->_out('>>'); |
376 | 387 | } |
@@ -648,8 +659,9 @@ discard block |
||
648 | 659 | $out .= chr(0x0A); |
649 | 660 | break; |
650 | 661 | case "\r": |
651 | - if ($count != $n-1 && $s[$count+1] == "\n") |
|
652 | - $count++; |
|
662 | + if ($count != $n-1 && $s[$count+1] == "\n") { |
|
663 | + $count++; |
|
664 | + } |
|
653 | 665 | break; |
654 | 666 | case "\n": |
655 | 667 | break; |
@@ -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,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 | ?> |
@@ -6508,15 +6508,13 @@ discard block |
||
6508 | 6508 | $xml .= $this->serializeType ($eName, |
6509 | 6509 | isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], |
6510 | 6510 | $v, $use, $encodingStyle, $unqualified); |
6511 | - } |
|
6512 | - elseif (isset($attrs['type']) || isset($attrs['ref'])) |
|
6511 | + } elseif (isset($attrs['type']) || isset($attrs['ref'])) |
|
6513 | 6512 | { |
6514 | 6513 | // serialize schema-defined type |
6515 | 6514 | $xml .= $this->serializeType ($eName, |
6516 | 6515 | isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], |
6517 | 6516 | $v, $use, $encodingStyle, $unqualified); |
6518 | - } |
|
6519 | - else |
|
6517 | + } else |
|
6520 | 6518 | { |
6521 | 6519 | // serialize generic type (can this ever really happen?) |
6522 | 6520 | $this->debug ("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
@@ -7018,8 +7016,7 @@ discard block |
||
7018 | 7016 | if (isset($this->namespaces[$value_prefix])) |
7019 | 7017 | { |
7020 | 7018 | $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; |
7021 | - } |
|
7022 | - elseif (isset($attrs['xmlns:' . $value_prefix])) |
|
7019 | + } elseif (isset($attrs['xmlns:' . $value_prefix])) |
|
7023 | 7020 | { |
7024 | 7021 | $this->message[$pos]['type_namespace'] = $attrs['xmlns:' . $value_prefix]; |
7025 | 7022 | } |
@@ -327,10 +327,16 @@ |
||
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
330 | - if (empty($idorcode)) $idorcode = 'all'; |
|
330 | + if (empty($idorcode)) { |
|
331 | + $idorcode = 'all'; |
|
332 | + } |
|
331 | 333 | $TType = $TSystem[$idorcode]; |
332 | - if (! empty($TSystemAuto[$idorcode])) $TType = array_merge($TSystem[$idorcode], $TSystemAuto[$idorcode]); |
|
333 | - if (! empty($TModule[$idorcode])) $TType = array_merge($TSystem[$idorcode], $TModule[$idorcode]); |
|
334 | + if (! empty($TSystemAuto[$idorcode])) { |
|
335 | + $TType = array_merge($TSystem[$idorcode], $TSystemAuto[$idorcode]); |
|
336 | + } |
|
337 | + if (! empty($TModule[$idorcode])) { |
|
338 | + $TType = array_merge($TSystem[$idorcode], $TModule[$idorcode]); |
|
339 | + } |
|
334 | 340 | $this->liste_array = $TType; |
335 | 341 | |
336 | 342 |
@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | |
22 | 22 | // Parameters for RSS |
23 | 23 | $rss = GETPOST('rss', 'aZ09'); |
24 | -if ($rss) $original_file = 'blog.rss'; |
|
24 | +if ($rss) { |
|
25 | + $original_file = 'blog.rss'; |
|
26 | +} |
|
25 | 27 | |
26 | 28 | // If we have a hash public (hashp), we guess the original_file. |
27 | 29 | if (!empty($hashp)) { |
@@ -56,14 +58,23 @@ discard block |
||
56 | 58 | |
57 | 59 | // Define attachment (attachment=true to force choice popup 'open'/'save as') |
58 | 60 | $attachment = true; |
59 | -if (preg_match('/\.(html|htm)$/i', $original_file)) $attachment = false; |
|
60 | -if (isset($_GET["attachment"])) $attachment = (GETPOST("attachment", 'alphanohtml') ? true : false); |
|
61 | -if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS_WEBSITE)) $attachment = false; |
|
61 | +if (preg_match('/\.(html|htm)$/i', $original_file)) { |
|
62 | + $attachment = false; |
|
63 | +} |
|
64 | +if (isset($_GET["attachment"])) { |
|
65 | + $attachment = (GETPOST("attachment", 'alphanohtml') ? true : false); |
|
66 | +} |
|
67 | +if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS_WEBSITE)) { |
|
68 | + $attachment = false; |
|
69 | +} |
|
62 | 70 | |
63 | 71 | // Define mime type |
64 | 72 | $type = 'application/octet-stream'; |
65 | -if (GETPOSTISSET('type')) $type = GETPOST('type', 'alpha'); |
|
66 | -else $type = dol_mimetype($original_file); |
|
73 | +if (GETPOSTISSET('type')) { |
|
74 | + $type = GETPOST('type', 'alpha'); |
|
75 | +} else { |
|
76 | + $type = dol_mimetype($original_file); |
|
77 | +} |
|
67 | 78 | |
68 | 79 | // Security: Delete string ../ into $original_file |
69 | 80 | $original_file = str_replace("../", "/", $original_file); |
@@ -94,7 +105,9 @@ discard block |
||
94 | 105 | $website->fetch('', $websitekey); |
95 | 106 | |
96 | 107 | $filters = array('type_container'=>'blogpost'); |
97 | - if ($l) $filters['lang'] = $l; |
|
108 | + if ($l) { |
|
109 | + $filters['lang'] = $l; |
|
110 | + } |
|
98 | 111 | |
99 | 112 | $MAXNEWS = ($limit ? $limit : 20); |
100 | 113 | $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); |
@@ -147,8 +160,9 @@ discard block |
||
147 | 160 | $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l); |
148 | 161 | |
149 | 162 | if ($result >= 0) { |
150 | - if (dol_move($outputfiletmp, $outputfile, 0, 1, 0, 0)) $result = 1; |
|
151 | - else { |
|
163 | + if (dol_move($outputfiletmp, $outputfile, 0, 1, 0, 0)) { |
|
164 | + $result = 1; |
|
165 | + } else { |
|
152 | 166 | $error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile; |
153 | 167 | dol_syslog("build_exportfile ".$error, LOG_ERR); |
154 | 168 | dol_delete_file($outputfiletmp, 0, 1); |
@@ -166,26 +180,39 @@ discard block |
||
166 | 180 | |
167 | 181 | if ($result >= 0) { |
168 | 182 | $attachment = false; |
169 | - if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; |
|
183 | + if (isset($_GET["attachment"])) { |
|
184 | + $attachment = $_GET["attachment"]; |
|
185 | + } |
|
170 | 186 | //$attachment = false; |
171 | 187 | $contenttype = 'application/rss+xml'; |
172 | - if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; |
|
188 | + if (isset($_GET["contenttype"])) { |
|
189 | + $contenttype = $_GET["contenttype"]; |
|
190 | + } |
|
173 | 191 | //$contenttype='text/plain'; |
174 | 192 | $outputencoding = 'UTF-8'; |
175 | 193 | |
176 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); |
|
177 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
194 | + if ($contenttype) { |
|
195 | + header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); |
|
196 | + } |
|
197 | + if ($attachment) { |
|
198 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
199 | + } |
|
178 | 200 | |
179 | 201 | // Ajout directives pour resoudre bug IE |
180 | 202 | //header('Cache-Control: Public, must-revalidate'); |
181 | 203 | //header('Pragma: public'); |
182 | - if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
183 | - else header('Cache-Control: private, must-revalidate'); |
|
204 | + if ($cachedelay) { |
|
205 | + header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
206 | + } else { |
|
207 | + header('Cache-Control: private, must-revalidate'); |
|
208 | + } |
|
184 | 209 | |
185 | 210 | // Clean parameters |
186 | 211 | $outputfile = $dir_temp.'/'.$filename; |
187 | 212 | $result = readfile($outputfile); |
188 | - if (!$result) print 'File '.$outputfile.' was empty.'; |
|
213 | + if (!$result) { |
|
214 | + print 'File '.$outputfile.' was empty.'; |
|
215 | + } |
|
189 | 216 | |
190 | 217 | // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
191 | 218 | exit; |
@@ -230,13 +257,20 @@ discard block |
||
230 | 257 | //top_httphead($type); |
231 | 258 | header('Content-Type: '.$type); |
232 | 259 | header('Content-Description: File Transfer'); |
233 | - if ($encoding) header('Content-Encoding: '.$encoding); |
|
260 | + if ($encoding) { |
|
261 | + header('Content-Encoding: '.$encoding); |
|
262 | + } |
|
234 | 263 | // Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open) |
235 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
236 | - else header('Content-Disposition: inline; filename="'.$filename.'"'); |
|
264 | + if ($attachment) { |
|
265 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
266 | + } else { |
|
267 | + header('Content-Disposition: inline; filename="'.$filename.'"'); |
|
268 | + } |
|
237 | 269 | header('Content-Length: '.dol_filesize($fullpath_original_file)); |
238 | 270 | |
239 | 271 | readfile($fullpath_original_file_osencoded); |
240 | 272 | } |
241 | -if (is_object($db)) $db->close(); |
|
273 | +if (is_object($db)) { |
|
274 | + $db->close(); |
|
275 | +} |
|
242 | 276 | // END PHP |