@@ -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 |
@@ -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; |