@@ -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 | |
@@ -321,7 +321,9 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | // if $moreParams is an array |
| 323 | 323 | if (!empty($moreParams) && is_array($moreParams)) { |
| 324 | - if (isset($moreParams['controller'])) unset($moreParams['controller']); |
|
| 324 | + if (isset($moreParams['controller'])) { |
|
| 325 | + unset($moreParams['controller']); |
|
| 326 | + } |
|
| 325 | 327 | if (!empty($moreParams)) { |
| 326 | 328 | foreach ($moreParams as $paramKey => $paramVal) { |
| 327 | 329 | $Tparams[$paramKey] = $paramVal; |
@@ -340,8 +342,12 @@ discard block |
||
| 340 | 342 | // if $moreParams is a string |
| 341 | 343 | if (!empty($moreParams) && !is_array($moreParams)) { |
| 342 | 344 | if (empty($Tparams)) { |
| 343 | - if ($moreParams[0] !== '?') $url .= '?'; |
|
| 344 | - if ($moreParams[0] === '&') $moreParams = substr($moreParams, 1); |
|
| 345 | + if ($moreParams[0] !== '?') { |
|
| 346 | + $url .= '?'; |
|
| 347 | + } |
|
| 348 | + if ($moreParams[0] === '&') { |
|
| 349 | + $moreParams = substr($moreParams, 1); |
|
| 350 | + } |
|
| 345 | 351 | } |
| 346 | 352 | $url .= $moreParams; |
| 347 | 353 | } |
@@ -410,10 +416,16 @@ discard block |
||
| 410 | 416 | */ |
| 411 | 417 | public function setError($errors) |
| 412 | 418 | { |
| 413 | - if (!is_array($errors)) $errors = array($errors); |
|
| 414 | - if (!isset($_SESSION['webportal_errors'])) $_SESSION['webportal_errors'] = array(); |
|
| 419 | + if (!is_array($errors)) { |
|
| 420 | + $errors = array($errors); |
|
| 421 | + } |
|
| 422 | + if (!isset($_SESSION['webportal_errors'])) { |
|
| 423 | + $_SESSION['webportal_errors'] = array(); |
|
| 424 | + } |
|
| 415 | 425 | foreach ($errors as $msg) { |
| 416 | - if (!in_array($msg, $_SESSION['webportal_errors'])) $_SESSION['webportal_errors'][] = $msg; |
|
| 426 | + if (!in_array($msg, $_SESSION['webportal_errors'])) { |
|
| 427 | + $_SESSION['webportal_errors'][] = $msg; |
|
| 428 | + } |
|
| 417 | 429 | } |
| 418 | 430 | } |
| 419 | 431 | |
@@ -40,12 +40,29 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | // Change this following line to use the correct relative path (../, ../../, etc) |
| 42 | 42 | $res = 0; |
| 43 | -if (!$res && file_exists('../../main.inc.php')) $res = @include '../../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory |
|
| 44 | -if (!$res && file_exists('../../../main.inc.php')) $res = @include '../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory |
|
| 45 | -if (!$res && file_exists('../../../../main.inc.php')) $res = @include '../../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory |
|
| 46 | -if (!$res && file_exists('../../../../../main.inc.php')) $res = @include '../../../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory |
|
| 47 | -if (!$res && file_exists('../../../../../../main.inc.php')) $res = @include '../../../../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory |
|
| 48 | -if (!$res) die('Include of main fails'); |
|
| 43 | +if (!$res && file_exists('../../main.inc.php')) { |
|
| 44 | + $res = @include '../../main.inc.php'; |
|
| 45 | +} |
|
| 46 | +// to work if your module directory is into dolibarr root htdocs directory |
|
| 47 | +if (!$res && file_exists('../../../main.inc.php')) { |
|
| 48 | + $res = @include '../../../main.inc.php'; |
|
| 49 | +} |
|
| 50 | +// to work if your module directory is into a subdir of root htdocs directory |
|
| 51 | +if (!$res && file_exists('../../../../main.inc.php')) { |
|
| 52 | + $res = @include '../../../../main.inc.php'; |
|
| 53 | +} |
|
| 54 | +// to work if your module directory is into a subdir of root htdocs directory |
|
| 55 | +if (!$res && file_exists('../../../../../main.inc.php')) { |
|
| 56 | + $res = @include '../../../../../main.inc.php'; |
|
| 57 | +} |
|
| 58 | +// to work if your module directory is into a subdir of root htdocs directory |
|
| 59 | +if (!$res && file_exists('../../../../../../main.inc.php')) { |
|
| 60 | + $res = @include '../../../../../../main.inc.php'; |
|
| 61 | +} |
|
| 62 | +// to work if your module directory is into a subdir of root htdocs directory |
|
| 63 | +if (!$res) { |
|
| 64 | + die('Include of main fails'); |
|
| 65 | +} |
|
| 49 | 66 | require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
| 50 | 67 | require_once DOL_DOCUMENT_ROOT . '/societe/class/societeaccount.class.php'; |
| 51 | 68 | dol_include_once('/public/webportal/lib/webportal.lib.php'); |
@@ -113,7 +130,9 @@ discard block |
||
| 113 | 130 | } |
| 114 | 131 | if (empty($password)) { |
| 115 | 132 | $context->setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Password")), 'errors'); |
| 116 | - if (empty($focus_element)) $focus_element = 'password'; |
|
| 133 | + if (empty($focus_element)) { |
|
| 134 | + $focus_element = 'password'; |
|
| 135 | + } |
|
| 117 | 136 | $error++; |
| 118 | 137 | } |
| 119 | 138 | // check security graphic code |
@@ -112,7 +112,9 @@ |
||
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | 114 | $reshook = $hookmanager->executeHooks('PrintTopMenu', $parameters, $context, $context->action); // Note that $action and $object may have been modified by hook |
| 115 | -if ($reshook < 0) $context->setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 115 | +if ($reshook < 0) { |
|
| 116 | + $context->setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 117 | +} |
|
| 116 | 118 | |
| 117 | 119 | if (empty($reshook)) { |
| 118 | 120 | if (!empty($hookmanager->resArray)) { |
@@ -35,8 +35,13 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | // Change this following line to use the correct relative path (../, ../../, etc) |
| 37 | 37 | $res = 0; |
| 38 | -if (!$res && file_exists('./webportal.main.inc.php')) $res = @include './webportal.main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory |
|
| 39 | -if (!$res) die('Include of WebPortal main fails'); |
|
| 38 | +if (!$res && file_exists('./webportal.main.inc.php')) { |
|
| 39 | + $res = @include './webportal.main.inc.php'; |
|
| 40 | +} |
|
| 41 | +// to work if your module directory is into dolibarr root htdocs directory |
|
| 42 | +if (!$res) { |
|
| 43 | + die('Include of WebPortal main fails'); |
|
| 44 | +} |
|
| 40 | 45 | |
| 41 | 46 | global $db; |
| 42 | 47 | |
@@ -50,7 +55,9 @@ discard block |
||
| 50 | 55 | } |
| 51 | 56 | |
| 52 | 57 | // Not sure this is required |
| 53 | -if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
| 58 | +if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) { |
|
| 59 | + unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
| 60 | +} |
|
| 54 | 61 | |
| 55 | 62 | if (GETPOST('noredirect')) { |
| 56 | 63 | return; |
@@ -2,8 +2,13 @@ |
||
| 2 | 2 | |
| 3 | 3 | // Change this following line to use the correct relative path (../, ../../, etc) |
| 4 | 4 | $res = 0; |
| 5 | -if (!$res && file_exists('./webportal.main.inc.php')) $res = @include './webportal.main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory |
|
| 6 | -if (!$res) die('Include of WebPortal main fails'); |
|
| 5 | +if (!$res && file_exists('./webportal.main.inc.php')) { |
|
| 6 | + $res = @include './webportal.main.inc.php'; |
|
| 7 | +} |
|
| 8 | +// to work if your module directory is into dolibarr root htdocs directory |
|
| 9 | +if (!$res) { |
|
| 10 | + die('Include of WebPortal main fails'); |
|
| 11 | +} |
|
| 7 | 12 | |
| 8 | 13 | /** @var Context $context */ |
| 9 | 14 | |
@@ -2313,10 +2313,16 @@ |
||
| 2313 | 2313 | $type = $prod->type; |
| 2314 | 2314 | $fk_unit = $prod->fk_unit; |
| 2315 | 2315 | } else { |
| 2316 | - if (!empty($price_ht)) $pu_ht = price2num($price_ht, 'MU'); |
|
| 2317 | - else $pu_ht = ''; |
|
| 2318 | - if (!empty($price_ttc)) $pu_ttc = price2num($price_ttc, 'MU'); |
|
| 2319 | - else $pu_ttc = ''; |
|
| 2316 | + if (!empty($price_ht)) { |
|
| 2317 | + $pu_ht = price2num($price_ht, 'MU'); |
|
| 2318 | + } else { |
|
| 2319 | + $pu_ht = ''; |
|
| 2320 | + } |
|
| 2321 | + if (!empty($price_ttc)) { |
|
| 2322 | + $pu_ttc = price2num($price_ttc, 'MU'); |
|
| 2323 | + } else { |
|
| 2324 | + $pu_ttc = ''; |
|
| 2325 | + } |
|
| 2320 | 2326 | $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); |
| 2321 | 2327 | $tva_tx = str_replace('*', '', $tva_tx); |
| 2322 | 2328 | if (empty($tva_tx)) { |
@@ -828,7 +828,9 @@ |
||
| 828 | 828 | $out = (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans('MissingTranslationForConfKey', $this->confKey)); |
| 829 | 829 | |
| 830 | 830 | // if conf defined on entity 0, prepend a picto to indicate it will apply across all entities |
| 831 | - if (isModEnabled('multicompany') && $this->entity == 0) $out = img_picto($this->langs->trans('AllEntities'), 'fa-globe-americas em088 opacityhigh') . ' ' . $out; |
|
| 831 | + if (isModEnabled('multicompany') && $this->entity == 0) { |
|
| 832 | + $out = img_picto($this->langs->trans('AllEntities'), 'fa-globe-americas em088 opacityhigh') . ' ' . $out; |
|
| 833 | + } |
|
| 832 | 834 | |
| 833 | 835 | return $out; |
| 834 | 836 | } |
@@ -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 |