| @@ -69,7 +69,7 @@ | ||
| 69 | 69 | /* | 
| 70 | 70 | * Actions | 
| 71 | 71 | */ | 
| 72 | -$parameters = array('id' => $id,  'label' => $label, 'confirm' => $confirm, 'type' => $type, 'uploaddir' => $upload_dir, 'sendfile' => (GETPOST("sendit") ? true : false)); | |
| 72 | +$parameters = array('id' => $id, 'label' => $label, 'confirm' => $confirm, 'type' => $type, 'uploaddir' => $upload_dir, 'sendfile' => (GETPOST("sendit") ? true : false)); | |
| 73 | 73 | // Note that $action and $object may be modified by some hooks | 
| 74 | 74 |  $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); | 
| 75 | 75 |  if ($reshook < 0) { | 
| @@ -51,7 +51,7 @@ | ||
| 51 | 51 | $result = restrictedArea($user, 'commande', $id, ''); | 
| 52 | 52 |  $hookmanager->initHooks(array('ordercontactcard', 'globalcard')); | 
| 53 | 53 | |
| 54 | -$usercancreate  =  $user->hasRight("commande", "creer"); | |
| 54 | +$usercancreate = $user->hasRight("commande", "creer"); | |
| 55 | 55 | |
| 56 | 56 | $object = new Commande($db); | 
| 57 | 57 | |
| @@ -73,7 +73,7 @@ | ||
| 73 | 73 | |
| 74 | 74 | $object = new Commande($db); | 
| 75 | 75 | |
| 76 | -$usercancreate  =  $user->hasRight("commande", "creer"); | |
| 76 | +$usercancreate = $user->hasRight("commande", "creer"); | |
| 77 | 77 | $permissiontoadd = $usercancreate; | 
| 78 | 78 | |
| 79 | 79 | // Security check | 
| @@ -52,7 +52,7 @@ | ||
| 52 | 52 | |
| 53 | 53 | $result = restrictedArea($user, 'commande', $id, ''); | 
| 54 | 54 | |
| 55 | -$usercancreate  =  $user->hasRight("commande", "creer"); | |
| 55 | +$usercancreate  = $user->hasRight("commande", "creer"); | |
| 56 | 56 | |
| 57 | 57 |  $permissionnote = $user->hasRight('commande', 'creer'); // Used by the include of actions_setnotes.inc.php | 
| 58 | 58 | |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | 3 | // File generated to link to the master file - DO NOT MODIFY - It is just an include | 
| 4 | -if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { | |
| 5 | -    if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); | |
| 4 | +if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) { | |
| 5 | +    if (!defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); | |
| 6 | 6 | require_once '/var/www/html/dolibarr_dev/htdocs/master.inc.php'; | 
| 7 | 7 | } | 
| @@ -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 | } | 
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | 3 | // File generated to link to the master file - DO NOT MODIFY - It is just an include | 
| 4 | -if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { | |
| 5 | -    if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); | |
| 4 | +if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) { | |
| 5 | +    if (!defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); | |
| 6 | 6 | require_once '/home/ldestailleur/git/dolibarr_dev/htdocs/master.inc.php'; | 
| 7 | 7 | } | 
| @@ -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 | 
| @@ -40,7 +40,7 @@ | ||
| 40 | 40 | |
| 41 | 41 |  $action             = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... | 
| 42 | 42 |  $massaction         = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) | 
| 43 | -$mode      = GETPOST('mode', 'alpha'); | |
| 43 | +$mode = GETPOST('mode', 'alpha'); | |
| 44 | 44 |  $show_files         = GETPOSTINT('show_files'); // Show files area generated by bulk actions ? | 
| 45 | 45 |  $confirm            = GETPOST('confirm', 'alpha'); // Result of a confirmation | 
| 46 | 46 |  $cancel             = GETPOST('cancel', 'alpha'); // We click on a Cancel button | 
| @@ -33,7 +33,7 @@ | ||
| 33 | 33 | |
| 34 | 34 | // Get parameters | 
| 35 | 35 |  $id = GETPOSTINT('id'); | 
| 36 | -$ref        = GETPOST('ref', 'alpha'); | |
| 36 | +$ref = GETPOST('ref', 'alpha'); | |
| 37 | 37 |  $action = GETPOST('action', 'aZ09'); | 
| 38 | 38 | |
| 39 | 39 | // Initialize technical objects |