@@ -2,6 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | // File generated to link to the master file - DO NOT MODIFY - It is just an include |
| 4 | 4 | if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { |
| 5 | - if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); |
|
| 5 | + if (! defined('USEEXTERNALSERVER')) { |
|
| 6 | + define('USEEXTERNALSERVER', 1); |
|
| 7 | + } |
|
| 6 | 8 | require_once '/var/www/html/dolibarr_dev/htdocs/master.inc.php'; |
| 7 | 9 | } |
@@ -2,6 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | // File generated to link to the master file - DO NOT MODIFY - It is just an include |
| 4 | 4 | if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { |
| 5 | - if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); |
|
| 5 | + if (! defined('USEEXTERNALSERVER')) { |
|
| 6 | + define('USEEXTERNALSERVER', 1); |
|
| 7 | + } |
|
| 6 | 8 | require_once '/home/ldestailleur/git/dolibarr_dev/htdocs/master.inc.php'; |
| 7 | 9 | } |
@@ -22,7 +22,9 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | // Parameters for RSS |
| 24 | 24 | $rss = GETPOST('rss', 'aZ09'); |
| 25 | -if ($rss) $original_file = 'blog.rss'; |
|
| 25 | +if ($rss) { |
|
| 26 | + $original_file = 'blog.rss'; |
|
| 27 | +} |
|
| 26 | 28 | |
| 27 | 29 | // If we have a hash public (hashp), we guess the original_file. |
| 28 | 30 | if (!empty($hashp)) { |
@@ -57,14 +59,23 @@ discard block |
||
| 57 | 59 | |
| 58 | 60 | // Define attachment (attachment=true to force choice popup 'open'/'save as') |
| 59 | 61 | $attachment = true; |
| 60 | -if (preg_match('/\.(html|htm)$/i', $original_file)) $attachment = false; |
|
| 61 | -if (isset($_GET["attachment"])) $attachment = (GETPOST("attachment", 'alphanohtml') ? true : false); |
|
| 62 | -if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS_WEBSITE)) $attachment = false; |
|
| 62 | +if (preg_match('/\.(html|htm)$/i', $original_file)) { |
|
| 63 | + $attachment = false; |
|
| 64 | +} |
|
| 65 | +if (isset($_GET["attachment"])) { |
|
| 66 | + $attachment = (GETPOST("attachment", 'alphanohtml') ? true : false); |
|
| 67 | +} |
|
| 68 | +if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS_WEBSITE)) { |
|
| 69 | + $attachment = false; |
|
| 70 | +} |
|
| 63 | 71 | |
| 64 | 72 | // Define mime type |
| 65 | 73 | $type = 'application/octet-stream'; |
| 66 | -if (GETPOSTISSET('type')) $type = GETPOST('type', 'alpha'); |
|
| 67 | -else $type = dol_mimetype($original_file); |
|
| 74 | +if (GETPOSTISSET('type')) { |
|
| 75 | + $type = GETPOST('type', 'alpha'); |
|
| 76 | +} else { |
|
| 77 | + $type = dol_mimetype($original_file); |
|
| 78 | +} |
|
| 68 | 79 | |
| 69 | 80 | // Security: Delete string ../ into $original_file |
| 70 | 81 | $original_file = str_replace("../", "/", $original_file); |
@@ -95,7 +106,9 @@ discard block |
||
| 95 | 106 | $website->fetch('', $websitekey); |
| 96 | 107 | |
| 97 | 108 | $filters = array('type_container' => 'blogpost'); |
| 98 | - if ($l) $filters['lang'] = $l; |
|
| 109 | + if ($l) { |
|
| 110 | + $filters['lang'] = $l; |
|
| 111 | + } |
|
| 99 | 112 | |
| 100 | 113 | $MAXNEWS = ($limit ? $limit : 20); |
| 101 | 114 | $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); |
@@ -148,8 +161,9 @@ discard block |
||
| 148 | 161 | $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost . '/wrapper.php?rss=1' . ($l ? '&l=' . $l : ''), $l); |
| 149 | 162 | |
| 150 | 163 | if ($result >= 0) { |
| 151 | - if (dol_move($outputfiletmp, $outputfile, 0, 1, 0, 0)) $result = 1; |
|
| 152 | - else { |
|
| 164 | + if (dol_move($outputfiletmp, $outputfile, 0, 1, 0, 0)) { |
|
| 165 | + $result = 1; |
|
| 166 | + } else { |
|
| 153 | 167 | $error = 'Failed to rename ' . $outputfiletmp . ' into ' . $outputfile; |
| 154 | 168 | dol_syslog("build_exportfile " . $error, LOG_ERR); |
| 155 | 169 | dol_delete_file($outputfiletmp, 0, 1); |
@@ -167,26 +181,39 @@ discard block |
||
| 167 | 181 | |
| 168 | 182 | if ($result >= 0) { |
| 169 | 183 | $attachment = false; |
| 170 | - if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; |
|
| 184 | + if (isset($_GET["attachment"])) { |
|
| 185 | + $attachment = $_GET["attachment"]; |
|
| 186 | + } |
|
| 171 | 187 | //$attachment = false; |
| 172 | 188 | $contenttype = 'application/rss+xml'; |
| 173 | - if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; |
|
| 189 | + if (isset($_GET["contenttype"])) { |
|
| 190 | + $contenttype = $_GET["contenttype"]; |
|
| 191 | + } |
|
| 174 | 192 | //$contenttype='text/plain'; |
| 175 | 193 | $outputencoding = 'UTF-8'; |
| 176 | 194 | |
| 177 | - if ($contenttype) header('Content-Type: ' . $contenttype . ($outputencoding ? '; charset=' . $outputencoding : '')); |
|
| 178 | - if ($attachment) header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
| 195 | + if ($contenttype) { |
|
| 196 | + header('Content-Type: ' . $contenttype . ($outputencoding ? '; charset=' . $outputencoding : '')); |
|
| 197 | + } |
|
| 198 | + if ($attachment) { |
|
| 199 | + header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
| 200 | + } |
|
| 179 | 201 | |
| 180 | 202 | // Ajout directives pour resoudre bug IE |
| 181 | 203 | //header('Cache-Control: Public, must-revalidate'); |
| 182 | 204 | //header('Pragma: public'); |
| 183 | - if ($cachedelay) header('Cache-Control: max-age=' . $cachedelay . ', private, must-revalidate'); |
|
| 184 | - else header('Cache-Control: private, must-revalidate'); |
|
| 205 | + if ($cachedelay) { |
|
| 206 | + header('Cache-Control: max-age=' . $cachedelay . ', private, must-revalidate'); |
|
| 207 | + } else { |
|
| 208 | + header('Cache-Control: private, must-revalidate'); |
|
| 209 | + } |
|
| 185 | 210 | |
| 186 | 211 | // Clean parameters |
| 187 | 212 | $outputfile = $dir_temp . '/' . $filename; |
| 188 | 213 | $result = readfile($outputfile); |
| 189 | - if (!$result) print 'File ' . $outputfile . ' was empty.'; |
|
| 214 | + if (!$result) { |
|
| 215 | + print 'File ' . $outputfile . ' was empty.'; |
|
| 216 | + } |
|
| 190 | 217 | |
| 191 | 218 | // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 192 | 219 | exit; |
@@ -231,13 +258,20 @@ discard block |
||
| 231 | 258 | //top_httphead($type); |
| 232 | 259 | header('Content-Type: ' . $type); |
| 233 | 260 | header('Content-Description: File Transfer'); |
| 234 | - if ($encoding) header('Content-Encoding: ' . $encoding); |
|
| 261 | + if ($encoding) { |
|
| 262 | + header('Content-Encoding: ' . $encoding); |
|
| 263 | + } |
|
| 235 | 264 | // Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open) |
| 236 | - if ($attachment) header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
| 237 | - else header('Content-Disposition: inline; filename="' . $filename . '"'); |
|
| 265 | + if ($attachment) { |
|
| 266 | + header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
| 267 | + } else { |
|
| 268 | + header('Content-Disposition: inline; filename="' . $filename . '"'); |
|
| 269 | + } |
|
| 238 | 270 | header('Content-Length: ' . dol_filesize($fullpath_original_file)); |
| 239 | 271 | |
| 240 | 272 | readfile($fullpath_original_file_osencoded); |
| 241 | 273 | } |
| 242 | -if (is_object($db)) $db->close(); |
|
| 274 | +if (is_object($db)) { |
|
| 275 | + $db->close(); |
|
| 276 | +} |
|
| 243 | 277 | // END PHP |
@@ -44,9 +44,15 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | |
| 46 | 46 | $nbmodulesnotautoenabled = count($conf->modules); |
| 47 | -if (in_array('fckeditor', $conf->modules)) $nbmodulesnotautoenabled--; |
|
| 48 | -if (in_array('export', $conf->modules)) $nbmodulesnotautoenabled--; |
|
| 49 | -if (in_array('import', $conf->modules)) $nbmodulesnotautoenabled--; |
|
| 47 | +if (in_array('fckeditor', $conf->modules)) { |
|
| 48 | + $nbmodulesnotautoenabled--; |
|
| 49 | +} |
|
| 50 | +if (in_array('export', $conf->modules)) { |
|
| 51 | + $nbmodulesnotautoenabled--; |
|
| 52 | +} |
|
| 53 | +if (in_array('import', $conf->modules)) { |
|
| 54 | + $nbmodulesnotautoenabled--; |
|
| 55 | +} |
|
| 50 | 56 | |
| 51 | 57 | // Check if company name is defined (first install) |
| 52 | 58 | if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || !getDolGlobalString('MAIN_INFO_SOCIETE_NOM')) { |
@@ -445,7 +445,9 @@ |
||
| 445 | 445 | { |
| 446 | 446 | $paymentsalary = array(); |
| 447 | 447 | $fields = Salaries::$FIELDSPAYMENT; |
| 448 | - if (isModEnabled("bank")) array_push($fields, "accountid"); |
|
| 448 | + if (isModEnabled("bank")) { |
|
| 449 | + array_push($fields, "accountid"); |
|
| 450 | + } |
|
| 449 | 451 | foreach ($fields as $field) { |
| 450 | 452 | if (!isset($data[$field])) { |
| 451 | 453 | throw new RestException(400, "$field field missing"); |
@@ -49,7 +49,9 @@ |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // Not sure this is required |
| 52 | -if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
| 52 | +if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) { |
|
| 53 | + unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
| 54 | +} |
|
| 53 | 55 | |
| 54 | 56 | if (GETPOST('noredirect')) { |
| 55 | 57 | return; |
@@ -365,7 +365,9 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // if $moreParams is an array |
| 367 | 367 | if (!empty($moreParams) && is_array($moreParams)) { |
| 368 | - if (isset($moreParams['controller'])) unset($moreParams['controller']); |
|
| 368 | + if (isset($moreParams['controller'])) { |
|
| 369 | + unset($moreParams['controller']); |
|
| 370 | + } |
|
| 369 | 371 | if (!empty($moreParams)) { |
| 370 | 372 | foreach ($moreParams as $paramKey => $paramVal) { |
| 371 | 373 | $Tparams[$paramKey] = $paramVal; |
@@ -384,8 +386,12 @@ discard block |
||
| 384 | 386 | // if $moreParams is a string |
| 385 | 387 | if (!empty($moreParams) && !is_array($moreParams)) { |
| 386 | 388 | if (empty($Tparams)) { |
| 387 | - if ($moreParams[0] !== '?') $url .= '?'; |
|
| 388 | - if ($moreParams[0] === '&') $moreParams = substr($moreParams, 1); |
|
| 389 | + if ($moreParams[0] !== '?') { |
|
| 390 | + $url .= '?'; |
|
| 391 | + } |
|
| 392 | + if ($moreParams[0] === '&') { |
|
| 393 | + $moreParams = substr($moreParams, 1); |
|
| 394 | + } |
|
| 389 | 395 | } |
| 390 | 396 | $url .= $moreParams; |
| 391 | 397 | } |
@@ -454,10 +460,16 @@ discard block |
||
| 454 | 460 | */ |
| 455 | 461 | public function setError($errors) |
| 456 | 462 | { |
| 457 | - if (!is_array($errors)) $errors = array($errors); |
|
| 458 | - if (!isset($_SESSION['webportal_errors'])) $_SESSION['webportal_errors'] = array(); |
|
| 463 | + if (!is_array($errors)) { |
|
| 464 | + $errors = array($errors); |
|
| 465 | + } |
|
| 466 | + if (!isset($_SESSION['webportal_errors'])) { |
|
| 467 | + $_SESSION['webportal_errors'] = array(); |
|
| 468 | + } |
|
| 459 | 469 | foreach ($errors as $msg) { |
| 460 | - if (!in_array($msg, $_SESSION['webportal_errors'])) $_SESSION['webportal_errors'][] = $msg; |
|
| 470 | + if (!in_array($msg, $_SESSION['webportal_errors'])) { |
|
| 471 | + $_SESSION['webportal_errors'][] = $msg; |
|
| 472 | + } |
|
| 461 | 473 | } |
| 462 | 474 | } |
| 463 | 475 | |
@@ -2,6 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | // File generated to link to the master file - DO NOT MODIFY - It is just an include |
| 4 | 4 | if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { |
| 5 | - if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); |
|
| 5 | + if (! defined('USEEXTERNALSERVER')) { |
|
| 6 | + define('USEEXTERNALSERVER', 1); |
|
| 7 | + } |
|
| 6 | 8 | require_once '/home/ldestailleur/git/dolibarr_dev/htdocs/master.inc.php'; |
| 7 | 9 | } |
@@ -2,6 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | // File generated to link to the master file - DO NOT MODIFY - It is just an include |
| 4 | 4 | if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { |
| 5 | - if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); |
|
| 5 | + if (! defined('USEEXTERNALSERVER')) { |
|
| 6 | + define('USEEXTERNALSERVER', 1); |
|
| 7 | + } |
|
| 6 | 8 | require_once '/var/www/html/dolibarr_dev/htdocs/master.inc.php'; |
| 7 | 9 | } |