@@ -35,11 +35,17 @@ discard block |
||
35 | 35 | /* ******************************************************************** */ |
36 | 36 | /* FONT FILE */ |
37 | 37 | /* ******************************************************************** */ |
38 | -if (defined('DOL_DEFAULT_TTF_BOLD')) $font_loc=constant('DOL_DEFAULT_TTF_BOLD'); |
|
38 | +if (defined('DOL_DEFAULT_TTF_BOLD')) { |
|
39 | + $font_loc=constant('DOL_DEFAULT_TTF_BOLD'); |
|
40 | +} |
|
39 | 41 | // Automatic-Detection of Font if running Windows |
40 | 42 | // @CHANGE LDR |
41 | -if (isset($_SERVER['WINDIR']) && @file_exists($_SERVER['WINDIR'])) $font_loc=$_SERVER['WINDIR'].'\Fonts\arialbd.ttf'; |
|
42 | -if (empty($font_loc)) die('DOL_DEFAULT_TTF_BOLD must de defined with full path to a TTF font.'); |
|
43 | +if (isset($_SERVER['WINDIR']) && @file_exists($_SERVER['WINDIR'])) { |
|
44 | + $font_loc=$_SERVER['WINDIR'].'\Fonts\arialbd.ttf'; |
|
45 | +} |
|
46 | +if (empty($font_loc)) { |
|
47 | + die('DOL_DEFAULT_TTF_BOLD must de defined with full path to a TTF font.'); |
|
48 | +} |
|
43 | 49 | |
44 | 50 | |
45 | 51 | /* ******************************************************************** */ |
@@ -50,8 +56,11 @@ discard block |
||
50 | 56 | * genbarcode is needed to render encodings other than EAN-12/EAN-13/ISBN |
51 | 57 | */ |
52 | 58 | |
53 | -if (defined('PHP-BARCODE_PATH_COMMAND')) $genbarcode_loc=constant('PHP-BARCODE_PATH_COMMAND'); |
|
54 | -else $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; |
|
59 | +if (defined('PHP-BARCODE_PATH_COMMAND')) { |
|
60 | + $genbarcode_loc=constant('PHP-BARCODE_PATH_COMMAND'); |
|
61 | +} else { |
|
62 | + $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; |
|
63 | +} |
|
55 | 64 | |
56 | 65 | |
57 | 66 | |
@@ -73,12 +82,17 @@ discard block |
||
73 | 82 | if (! $bars || ! empty($bars['error'])) |
74 | 83 | { |
75 | 84 | // Return error message instead of array |
76 | - if (empty($bars['error'])) $error='Bad Value '.$code.' for encoding '.$encoding; |
|
77 | - else $error=$bars['error']; |
|
85 | + if (empty($bars['error'])) { |
|
86 | + $error='Bad Value '.$code.' for encoding '.$encoding; |
|
87 | + } else { |
|
88 | + $error=$bars['error']; |
|
89 | + } |
|
78 | 90 | dol_syslog('barcode.lib.php::barcode_print '.$error, LOG_ERR); |
79 | 91 | return $error; |
80 | 92 | } |
81 | - if (! $mode) $mode="png"; |
|
93 | + if (! $mode) { |
|
94 | + $mode="png"; |
|
95 | + } |
|
82 | 96 | //if (preg_match("/^(text|txt|plain)$/i",$mode)) print barcode_outtext($bars['text'],$bars['bars']); |
83 | 97 | //elseif (preg_match("/^(html|htm)$/i",$mode)) print barcode_outhtml($bars['text'],$bars['bars'], $scale,0, 0); |
84 | 98 | //else |
@@ -127,14 +141,14 @@ discard block |
||
127 | 141 | /* use built-in EAN-Encoder */ |
128 | 142 | dol_syslog("barcode.lib.php::barcode_encode Use barcode_encode_ean"); |
129 | 143 | $bars=barcode_encode_ean($code, $encoding); |
130 | - } |
|
131 | - else if (file_exists($genbarcode_loc)) // For example C39 |
|
144 | + } else if (file_exists($genbarcode_loc)) { |
|
145 | + // For example C39 |
|
132 | 146 | { |
133 | 147 | /* use genbarcode */ |
134 | 148 | dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding); |
135 | - $bars=barcode_encode_genbarcode($code, $encoding); |
|
136 | 149 | } |
137 | - else |
|
150 | + $bars=barcode_encode_genbarcode($code, $encoding); |
|
151 | + } else |
|
138 | 152 | { |
139 | 153 | print "barcode_encode needs an external programm for encodings other then EAN/ISBN (code=".$code.", encoding=".$encoding.")<BR>\n"; |
140 | 154 | print "<UL>\n"; |
@@ -164,7 +178,11 @@ discard block |
||
164 | 178 | $ln=strlen($ean)-1; |
165 | 179 | for ($i=$ln; $i>=0; $i--) |
166 | 180 | { |
167 | - if ($even) $esum+=$ean[$i]; else $osum+=$ean[$i]; |
|
181 | + if ($even) { |
|
182 | + $esum+=$ean[$i]; |
|
183 | + } else { |
|
184 | + $osum+=$ean[$i]; |
|
185 | + } |
|
168 | 186 | $even=!$even; |
169 | 187 | } |
170 | 188 | return (10-((3*$esum+$osum)%10))%10; |
@@ -191,9 +209,13 @@ discard block |
||
191 | 209 | $encoding=strtoupper($encoding); |
192 | 210 | if ($encoding=="ISBN") |
193 | 211 | { |
194 | - if (!preg_match("/^978/", $ean)) $ean="978".$ean; |
|
212 | + if (!preg_match("/^978/", $ean)) { |
|
213 | + $ean="978".$ean; |
|
214 | + } |
|
215 | + } |
|
216 | + if (preg_match("/^978/", $ean)) { |
|
217 | + $encoding="ISBN"; |
|
195 | 218 | } |
196 | - if (preg_match("/^978/", $ean)) $encoding="ISBN"; |
|
197 | 219 | if (strlen($ean)<12 || strlen($ean)>13) |
198 | 220 | { |
199 | 221 | return array("error"=>"Invalid encoding/code. encoding=".$encoding." code=".$ean." (must have 12/13 numbers)", "text"=>"Invalid encoding/code. encoding=".$encoding." code=".$ean." (must have 12/13 numbers)"); |
@@ -206,8 +228,14 @@ discard block |
||
206 | 228 | for ($i=1;$i<13;$i++) |
207 | 229 | { |
208 | 230 | $str=$digits[$ean[$i]]; |
209 | - if ($i<7 && $mirror[$ean[0]][$i-1]==1) $line.=strrev($str); else $line.=$str; |
|
210 | - if ($i==6) $line.=$guards[1]; |
|
231 | + if ($i<7 && $mirror[$ean[0]][$i-1]==1) { |
|
232 | + $line.=strrev($str); |
|
233 | + } else { |
|
234 | + $line.=$str; |
|
235 | + } |
|
236 | + if ($i==6) { |
|
237 | + $line.=$guards[1]; |
|
238 | + } |
|
211 | 239 | } |
212 | 240 | $line.=$guards[2]; |
213 | 241 | |
@@ -216,11 +244,17 @@ discard block |
||
216 | 244 | $text=""; |
217 | 245 | for ($a=0;$a<13;$a++) |
218 | 246 | { |
219 | - if ($a>0) $text.=" "; |
|
247 | + if ($a>0) { |
|
248 | + $text.=" "; |
|
249 | + } |
|
220 | 250 | $text.="$pos:12:{$ean[$a]}"; |
221 | - if ($a==0) $pos+=12; |
|
222 | - else if ($a==6) $pos+=12; |
|
223 | - else $pos+=7; |
|
251 | + if ($a==0) { |
|
252 | + $pos+=12; |
|
253 | + } else if ($a==6) { |
|
254 | + $pos+=12; |
|
255 | + } else { |
|
256 | + $pos+=7; |
|
257 | + } |
|
224 | 258 | } |
225 | 259 | |
226 | 260 | return array( |
@@ -243,8 +277,12 @@ discard block |
||
243 | 277 | global $genbarcode_loc; |
244 | 278 | |
245 | 279 | // Clean parameters |
246 | - if (preg_match("/^ean$/i", $encoding) && strlen($code)==13) $code=substr($code,0,12); |
|
247 | - if (!$encoding) $encoding="ANY"; |
|
280 | + if (preg_match("/^ean$/i", $encoding) && strlen($code)==13) { |
|
281 | + $code=substr($code,0,12); |
|
282 | + } |
|
283 | + if (!$encoding) { |
|
284 | + $encoding="ANY"; |
|
285 | + } |
|
248 | 286 | $encoding=preg_replace("/[\\\|]/", "_", $encoding); |
249 | 287 | $code=preg_replace("/[\\\|]/", "_", $code); |
250 | 288 | |
@@ -263,8 +301,7 @@ discard block |
||
263 | 301 | $text=fgets($fp, 1024); |
264 | 302 | $encoding=fgets($fp, 1024); |
265 | 303 | pclose($fp); |
266 | - } |
|
267 | - else |
|
304 | + } else |
|
268 | 305 | { |
269 | 306 | dol_syslog("barcode.lib.php::barcode_encode_genbarcode failed to run popen ".$fullcommandclear, LOG_ERR); |
270 | 307 | return false; |
@@ -282,9 +319,15 @@ discard block |
||
282 | 319 | $ret['error']=$ret['bars']; $ret['bars']=''; |
283 | 320 | return $ret; |
284 | 321 | } |
285 | - if (!$ret['bars']) return false; |
|
286 | - if (!$ret['text']) return false; |
|
287 | - if (!$ret['encoding']) return false; |
|
322 | + if (!$ret['bars']) { |
|
323 | + return false; |
|
324 | + } |
|
325 | + if (!$ret['text']) { |
|
326 | + return false; |
|
327 | + } |
|
328 | + if (!$ret['encoding']) { |
|
329 | + return false; |
|
330 | + } |
|
288 | 331 | return $ret; |
289 | 332 | } |
290 | 333 | |
@@ -310,11 +353,16 @@ discard block |
||
310 | 353 | //var_dump($font_loc); |
311 | 354 | |
312 | 355 | /* set defaults */ |
313 | - if ($scale<1) $scale=2; |
|
356 | + if ($scale<1) { |
|
357 | + $scale=2; |
|
358 | + } |
|
314 | 359 | $total_y=(int) $total_y; |
315 | - if ($total_y<1) $total_y=(int) $scale * 60; |
|
316 | - if (!$space) |
|
317 | - $space=array('top'=>2*$scale,'bottom'=>2*$scale,'left'=>2*$scale,'right'=>2*$scale); |
|
360 | + if ($total_y<1) { |
|
361 | + $total_y=(int) $scale * 60; |
|
362 | + } |
|
363 | + if (!$space) { |
|
364 | + $space=array('top'=>2*$scale,'bottom'=>2*$scale,'left'=>2*$scale,'right'=>2*$scale); |
|
365 | + } |
|
318 | 366 | |
319 | 367 | /* count total width */ |
320 | 368 | $xpos=0; |
@@ -371,7 +419,9 @@ discard block |
||
371 | 419 | /* tall bar */ |
372 | 420 | $val=ord($val)-ord('a')+1; |
373 | 421 | $h=$height2; |
374 | - } else $h=$height; |
|
422 | + } else { |
|
423 | + $h=$height; |
|
424 | + } |
|
375 | 425 | imagefilledrectangle($im, $xpos, $space['top'], $xpos+($val*$scale)-1, $h, $col_bar); |
376 | 426 | $xpos+=$val*$scale; |
377 | 427 | $width=true; |
@@ -396,17 +446,16 @@ discard block |
||
396 | 446 | { |
397 | 447 | header("Content-Type: image/jpeg; name=\"barcode.jpg\""); |
398 | 448 | imagejpeg($im); |
399 | - } |
|
400 | - else if ($mode=='gif') |
|
449 | + } else if ($mode=='gif') |
|
401 | 450 | { |
402 | 451 | header("Content-Type: image/gif; name=\"barcode.gif\""); |
403 | 452 | imagegif($im); |
404 | - } |
|
405 | - else if (! empty($filebarcode)) // To wxrite into afile onto disk |
|
453 | + } else if (! empty($filebarcode)) { |
|
454 | + // To wxrite into afile onto disk |
|
406 | 455 | { |
407 | 456 | imagepng($im,$filebarcode); |
408 | 457 | } |
409 | - else |
|
458 | + } else |
|
410 | 459 | { |
411 | 460 | header("Content-Type: image/png; name=\"barcode.png\""); |
412 | 461 | imagepng($im); |
@@ -75,9 +75,13 @@ discard block |
||
75 | 75 | { |
76 | 76 | global $conf; |
77 | 77 | |
78 | - if ($account < 0 || empty($account)) return ''; |
|
78 | + if ($account < 0 || empty($account)) { |
|
79 | + return ''; |
|
80 | + } |
|
79 | 81 | |
80 | - if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account; |
|
82 | + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { |
|
83 | + return $account; |
|
84 | + } |
|
81 | 85 | |
82 | 86 | $g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT; |
83 | 87 | if (! empty($g)) { |
@@ -110,9 +114,13 @@ discard block |
||
110 | 114 | { |
111 | 115 | global $conf, $langs; |
112 | 116 | |
113 | - if ($accounta < 0 || empty($accounta)) return ''; |
|
117 | + if ($accounta < 0 || empty($accounta)) { |
|
118 | + return ''; |
|
119 | + } |
|
114 | 120 | |
115 | - if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta; |
|
121 | + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { |
|
122 | + return $accounta; |
|
123 | + } |
|
116 | 124 | |
117 | 125 | $a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT; |
118 | 126 | if (! empty($a)) { |
@@ -156,11 +164,15 @@ discard block |
||
156 | 164 | { |
157 | 165 | global $langs; |
158 | 166 | |
159 | - if (empty($hselected)) $hselected='report'; |
|
167 | + if (empty($hselected)) { |
|
168 | + $hselected='report'; |
|
169 | + } |
|
160 | 170 | |
161 | 171 | print "\n\n<!-- debut cartouche journal -->\n"; |
162 | 172 | |
163 | - if(! empty($varlink)) $varlink = '?'.$varlink; |
|
173 | + if(! empty($varlink)) { |
|
174 | + $varlink = '?'.$varlink; |
|
175 | + } |
|
164 | 176 | |
165 | 177 | $h=0; |
166 | 178 | $head[$h][0] = $_SERVER["PHP_SELF"].$varlink; |
@@ -180,10 +192,15 @@ discard block |
||
180 | 192 | // Ligne de titre |
181 | 193 | print '<tr>'; |
182 | 194 | print '<td width="110">'.$langs->trans("Name").'</td>'; |
183 | - if (! $variantexxx) print '<td colspan="3">'; |
|
184 | - else print '<td>'; |
|
195 | + if (! $variantexxx) { |
|
196 | + print '<td colspan="3">'; |
|
197 | + } else { |
|
198 | + print '<td>'; |
|
199 | + } |
|
185 | 200 | print $nom; |
186 | - if ($variantexxx) print '</td><td colspan="2">'.$variantexxx; |
|
201 | + if ($variantexxx) { |
|
202 | + print '</td><td colspan="2">'.$variantexxx; |
|
203 | + } |
|
187 | 204 | print '</td>'; |
188 | 205 | print '</tr>'; |
189 | 206 | |
@@ -192,10 +209,15 @@ discard block |
||
192 | 209 | { |
193 | 210 | print '<tr>'; |
194 | 211 | print '<td width="110">'.$langs->trans("CalculationMode").'</td>'; |
195 | - if (! $variante) print '<td colspan="3">'; |
|
196 | - else print '<td>'; |
|
212 | + if (! $variante) { |
|
213 | + print '<td colspan="3">'; |
|
214 | + } else { |
|
215 | + print '<td>'; |
|
216 | + } |
|
197 | 217 | print $calcmode; |
198 | - if ($variante) print '</td><td colspan="2">'.$variante; |
|
218 | + if ($variante) { |
|
219 | + print '</td><td colspan="2">'.$variante; |
|
220 | + } |
|
199 | 221 | print '</td>'; |
200 | 222 | print '</tr>'; |
201 | 223 | } |
@@ -203,10 +225,17 @@ discard block |
||
203 | 225 | // Ligne de la periode d'analyse du rapport |
204 | 226 | print '<tr>'; |
205 | 227 | print '<td>'.$langs->trans("ReportPeriod").'</td>'; |
206 | - if (! $periodlink) print '<td colspan="3">'; |
|
207 | - else print '<td>'; |
|
208 | - if ($period) print $period; |
|
209 | - if ($periodlink) print '</td><td colspan="2">'.$periodlink; |
|
228 | + if (! $periodlink) { |
|
229 | + print '<td colspan="3">'; |
|
230 | + } else { |
|
231 | + print '<td>'; |
|
232 | + } |
|
233 | + if ($period) { |
|
234 | + print $period; |
|
235 | + } |
|
236 | + if ($periodlink) { |
|
237 | + print '</td><td colspan="2">'.$periodlink; |
|
238 | + } |
|
210 | 239 | print '</td>'; |
211 | 240 | print '</tr>'; |
212 | 241 |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
46 | 46 | $head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id; |
47 | 47 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
48 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
48 | + if ($nbContact > 0) { |
|
49 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
50 | + } |
|
49 | 51 | $head[$h][2] = 'contact'; |
50 | 52 | $h++; |
51 | 53 | } |
@@ -59,11 +61,17 @@ discard block |
||
59 | 61 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
60 | 62 | { |
61 | 63 | $nbNote = 0; |
62 | - if(!empty($object->note_private)) $nbNote++; |
|
63 | - if(!empty($object->note_public)) $nbNote++; |
|
64 | + if(!empty($object->note_private)) { |
|
65 | + $nbNote++; |
|
66 | + } |
|
67 | + if(!empty($object->note_public)) { |
|
68 | + $nbNote++; |
|
69 | + } |
|
64 | 70 | $head[$h][0] = DOL_URL_ROOT.'/resource/note.php?id='.$object->id; |
65 | 71 | $head[$h][1] = $langs->trans('Notes'); |
66 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
72 | + if ($nbNote > 0) { |
|
73 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
74 | + } |
|
67 | 75 | $head[$h][2] = 'note'; |
68 | 76 | $h++; |
69 | 77 | } |
@@ -73,7 +81,9 @@ discard block |
||
73 | 81 | $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
74 | 82 | $head[$h][0] = DOL_URL_ROOT.'/resource/document.php?id='.$object->id; |
75 | 83 | $head[$h][1] = $langs->trans("Documents"); |
76 | - if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>'; |
|
84 | + if($nbFiles > 0) { |
|
85 | + $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>'; |
|
86 | + } |
|
77 | 87 | $head[$h][2] = 'documents'; |
78 | 88 | $h++; |
79 | 89 |
@@ -58,8 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $error++; |
60 | 60 | $errorcode='ERROR_FETCH_USER'; $errorlabel='A technical error occurred during fetch of user'; |
61 | - } |
|
62 | - else if ($result == 0) |
|
61 | + } else if ($result == 0) |
|
63 | 62 | { |
64 | 63 | $error++; |
65 | 64 | $errorcode='BAD_CREDENTIALS'; $errorlabel='Bad value for login or password'; |
@@ -77,9 +76,13 @@ discard block |
||
77 | 76 | $fuser->getrights(); // Load permission of user |
78 | 77 | |
79 | 78 | // Authentication mode |
80 | - if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr'; |
|
79 | + if (empty($dolibarr_main_authentication)) { |
|
80 | + $dolibarr_main_authentication='http,dolibarr'; |
|
81 | + } |
|
81 | 82 | // Authentication mode: forceuser |
82 | - if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) $dolibarr_auto_user='auto'; |
|
83 | + if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) { |
|
84 | + $dolibarr_auto_user='auto'; |
|
85 | + } |
|
83 | 86 | // Set authmode |
84 | 87 | $authmode=explode(',',$dolibarr_main_authentication); |
85 | 88 |
@@ -51,7 +51,9 @@ discard block |
||
51 | 51 | $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
52 | 52 | $head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id; |
53 | 53 | $head[$h][1] = $langs->trans('InterventionContact'); |
54 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
54 | + if ($nbContact > 0) { |
|
55 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
56 | + } |
|
55 | 57 | $head[$h][2] = 'contact'; |
56 | 58 | $h++; |
57 | 59 | } |
@@ -82,7 +84,9 @@ discard block |
||
82 | 84 | |
83 | 85 | $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id; |
84 | 86 | $head[$h][1] = $langs->trans("Resources"); |
85 | - if ($nbResource > 0) $head[$h][1].= ' <span class="badge">'.$nbResource.'</span>'; |
|
87 | + if ($nbResource > 0) { |
|
88 | + $head[$h][1].= ' <span class="badge">'.$nbResource.'</span>'; |
|
89 | + } |
|
86 | 90 | $head[$h][2] = 'resource'; |
87 | 91 | $h++; |
88 | 92 | } |
@@ -90,11 +94,17 @@ discard block |
||
90 | 94 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
91 | 95 | { |
92 | 96 | $nbNote = 0; |
93 | - if(!empty($object->note_private)) $nbNote++; |
|
94 | - if(!empty($object->note_public)) $nbNote++; |
|
97 | + if(!empty($object->note_private)) { |
|
98 | + $nbNote++; |
|
99 | + } |
|
100 | + if(!empty($object->note_public)) { |
|
101 | + $nbNote++; |
|
102 | + } |
|
95 | 103 | $head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id; |
96 | 104 | $head[$h][1] = $langs->trans('Notes'); |
97 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
105 | + if ($nbNote > 0) { |
|
106 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
107 | + } |
|
98 | 108 | $head[$h][2] = 'note'; |
99 | 109 | $h++; |
100 | 110 | } |
@@ -106,7 +116,9 @@ discard block |
||
106 | 116 | $nbLinks=Link::count($db, $object->element, $object->id); |
107 | 117 | $head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id; |
108 | 118 | $head[$h][1] = $langs->trans("Documents"); |
109 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
119 | + if (($nbFiles+$nbLinks) > 0) { |
|
120 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
121 | + } |
|
110 | 122 | $head[$h][2] = 'documents'; |
111 | 123 | $h++; |
112 | 124 |
@@ -43,7 +43,9 @@ |
||
43 | 43 | { |
44 | 44 | $head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id; |
45 | 45 | $head[$h][1] = $langs->trans("MailRecipients"); |
46 | - if ($object->nbemail > 0) $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>'; |
|
46 | + if ($object->nbemail > 0) { |
|
47 | + $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>'; |
|
48 | + } |
|
47 | 49 | $head[$h][2] = 'targets'; |
48 | 50 | $h++; |
49 | 51 | } |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | function commande_prepare_head(Commande $object) |
35 | 35 | { |
36 | 36 | global $db, $langs, $conf, $user; |
37 | - if (! empty($conf->expedition->enabled)) $langs->load("sendings"); |
|
37 | + if (! empty($conf->expedition->enabled)) { |
|
38 | + $langs->load("sendings"); |
|
39 | + } |
|
38 | 40 | $langs->load("orders"); |
39 | 41 | |
40 | 42 | $h = 0; |
@@ -53,7 +55,9 @@ discard block |
||
53 | 55 | $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
54 | 56 | $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id; |
55 | 57 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
56 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
58 | + if ($nbContact > 0) { |
|
59 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
60 | + } |
|
57 | 61 | $head[$h][2] = 'contact'; |
58 | 62 | $h++; |
59 | 63 | } |
@@ -64,13 +68,27 @@ discard block |
||
64 | 68 | $nbShipments=$object->getNbOfShipments(); $nbReceiption=0; |
65 | 69 | $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; |
66 | 70 | $text=''; |
67 | - if ($conf->expedition_bon->enabled) $text.=$langs->trans("Shipments"); |
|
68 | - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/'; |
|
69 | - if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings"); |
|
70 | - if ($nbShipments > 0 || $nbReceiption > 0) $text.= ' <span class="badge">'.($nbShipments?$nbShipments:0); |
|
71 | - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/'; |
|
72 | - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text.= ($nbReceiption?$nbReceiption:0); |
|
73 | - if ($nbShipments > 0 || $nbReceiption > 0) $text.= '</span>'; |
|
71 | + if ($conf->expedition_bon->enabled) { |
|
72 | + $text.=$langs->trans("Shipments"); |
|
73 | + } |
|
74 | + if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) { |
|
75 | + $text.='/'; |
|
76 | + } |
|
77 | + if ($conf->livraison_bon->enabled) { |
|
78 | + $text.=$langs->trans("Receivings"); |
|
79 | + } |
|
80 | + if ($nbShipments > 0 || $nbReceiption > 0) { |
|
81 | + $text.= ' <span class="badge">'.($nbShipments?$nbShipments:0); |
|
82 | + } |
|
83 | + if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) { |
|
84 | + $text.='/'; |
|
85 | + } |
|
86 | + if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) { |
|
87 | + $text.= ($nbReceiption?$nbReceiption:0); |
|
88 | + } |
|
89 | + if ($nbShipments > 0 || $nbReceiption > 0) { |
|
90 | + $text.= '</span>'; |
|
91 | + } |
|
74 | 92 | $head[$h][1] = $text; |
75 | 93 | $head[$h][2] = 'shipping'; |
76 | 94 | $h++; |
@@ -85,11 +103,17 @@ discard block |
||
85 | 103 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
86 | 104 | { |
87 | 105 | $nbNote = 0; |
88 | - if(!empty($object->note_private)) $nbNote++; |
|
89 | - if(!empty($object->note_public)) $nbNote++; |
|
106 | + if(!empty($object->note_private)) { |
|
107 | + $nbNote++; |
|
108 | + } |
|
109 | + if(!empty($object->note_public)) { |
|
110 | + $nbNote++; |
|
111 | + } |
|
90 | 112 | $head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$object->id; |
91 | 113 | $head[$h][1] = $langs->trans('Notes'); |
92 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
114 | + if ($nbNote > 0) { |
|
115 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
116 | + } |
|
93 | 117 | $head[$h][2] = 'note'; |
94 | 118 | $h++; |
95 | 119 | } |
@@ -101,7 +125,9 @@ discard block |
||
101 | 125 | $nbLinks=Link::count($db, $object->element, $object->id); |
102 | 126 | $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id; |
103 | 127 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
128 | + if (($nbFiles+$nbLinks) > 0) { |
|
129 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
130 | + } |
|
105 | 131 | $head[$h][2] = 'documents'; |
106 | 132 | $h++; |
107 | 133 |
@@ -39,28 +39,40 @@ discard block |
||
39 | 39 | |
40 | 40 | // Replace php code. Note $content may come from database and does not contains body tags. |
41 | 41 | $replacewith='...php...'; |
42 | - if ($removephppart) $replacewith=''; |
|
42 | + if ($removephppart) { |
|
43 | + $replacewith=''; |
|
44 | + } |
|
43 | 45 | $content = preg_replace('/value="<\?php((?!\?>).)*\?>\n*/ims', 'value="'.$replacewith.'"', $content); |
44 | 46 | |
45 | 47 | $replacewith='"callto=#'; |
46 | - if ($removephppart) $replacewith=''; |
|
48 | + if ($removephppart) { |
|
49 | + $replacewith=''; |
|
50 | + } |
|
47 | 51 | $content = preg_replace('/"callto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content); |
48 | 52 | |
49 | 53 | $replacewith='"mailto=#'; |
50 | - if ($removephppart) $replacewith=''; |
|
54 | + if ($removephppart) { |
|
55 | + $replacewith=''; |
|
56 | + } |
|
51 | 57 | $content = preg_replace('/"mailto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content); |
52 | 58 | |
53 | 59 | $replacewith='src="php'; |
54 | - if ($removephppart) $replacewith=''; |
|
60 | + if ($removephppart) { |
|
61 | + $replacewith=''; |
|
62 | + } |
|
55 | 63 | $content = preg_replace('/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content); |
56 | 64 | |
57 | 65 | $replacewith='href="php'; |
58 | - if ($removephppart) $replacewith=''; |
|
66 | + if ($removephppart) { |
|
67 | + $replacewith=''; |
|
68 | + } |
|
59 | 69 | $content = preg_replace('/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content); |
60 | 70 | |
61 | 71 | //$replacewith='<span class="phptag">...php...</span>'; |
62 | 72 | $replacewith='<span class="phptag">...php...</span>'; |
63 | - if ($removephppart) $replacewith=''; |
|
73 | + if ($removephppart) { |
|
74 | + $replacewith=''; |
|
75 | + } |
|
64 | 76 | //$content = preg_replace('/<\?php((?!\?toremove>).)*\?toremove>\n*/ims', $replacewith, $content); |
65 | 77 | /*if ($content === null) { |
66 | 78 | if (preg_last_error() == PREG_JIT_STACKLIMIT_ERROR) $content = 'preg_replace error (when removing php tags) PREG_JIT_STACKLIMIT_ERROR'; |
@@ -113,9 +125,11 @@ discard block |
||
113 | 125 | $i=0; |
114 | 126 | foreach($parts as $part) |
115 | 127 | { |
116 | - if ($i == 0) // The first part is never php code |
|
128 | + if ($i == 0) { |
|
129 | + // The first part is never php code |
|
117 | 130 | { |
118 | 131 | $i++; |
132 | + } |
|
119 | 133 | $newstr .= $part; |
120 | 134 | continue; |
121 | 135 | } |
@@ -124,7 +138,9 @@ discard block |
||
124 | 138 | if (!empty($partlings)) |
125 | 139 | { |
126 | 140 | //remove content before closing tag |
127 | - if (count($partlings) > 1) $partlings[0] = ''; |
|
141 | + if (count($partlings) > 1) { |
|
142 | + $partlings[0] = ''; |
|
143 | + } |
|
128 | 144 | //append to out string |
129 | 145 | $newstr .= $replacewith.implode('',$partlings); |
130 | 146 | } |
@@ -154,16 +170,19 @@ discard block |
||
154 | 170 | $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
155 | 171 | //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current |
156 | 172 | |
157 | - if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor |
|
173 | + if (defined('USEDOLIBARREDITOR')) { |
|
174 | + // REPLACEMENT OF LINKS When page called from Dolibarr editor |
|
158 | 175 | { |
159 | 176 | // We remove the <head> part of content |
160 | 177 | $content = preg_replace('/<head>.*<\/head>/ims', '', $content); |
178 | + } |
|
161 | 179 | $content = preg_replace('/^.*<body(\s[^>]*)*>/ims', '', $content); |
162 | 180 | $content = preg_replace('/<\/body(\s[^>]*)*>.*$/ims', '', $content); |
163 | - } |
|
164 | - elseif (defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from Dolibarr server |
|
181 | + } elseif (defined('USEDOLIBARRSERVER')) { |
|
182 | + // REPLACEMENT OF LINKS When page called from Dolibarr server |
|
165 | 183 | { |
166 | 184 | global $website; |
185 | + } |
|
167 | 186 | |
168 | 187 | // Replace relative link / with dolibarr URL: ...href="/"... |
169 | 188 | $content=preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'"', $content, -1, $nbrep); |
@@ -194,8 +213,7 @@ discard block |
||
194 | 213 | |
195 | 214 | // action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage |
196 | 215 | $content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep); |
197 | - } |
|
198 | - else // REPLACEMENT OF LINKS When page called from virtual host |
|
216 | + } else // REPLACEMENT OF LINKS When page called from virtual host |
|
199 | 217 | { |
200 | 218 | $symlinktomediaexists=1; |
201 | 219 | |
@@ -217,8 +235,7 @@ discard block |
||
217 | 235 | $content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp\3\4', $content, -1, $nbrep); |
218 | 236 | |
219 | 237 | $content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep); |
220 | - } |
|
221 | - else |
|
238 | + } else |
|
222 | 239 | { |
223 | 240 | $content=preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1medias/\4\5', $content, -1, $nbrep); |
224 | 241 | |
@@ -293,20 +310,21 @@ discard block |
||
293 | 310 | if ($result > 0) |
294 | 311 | { |
295 | 312 | $containerref = $tmpwebsitepage->pageurl; |
296 | - } |
|
297 | - else |
|
313 | + } else |
|
298 | 314 | { |
299 | 315 | print "Error, page contains a redirect to the alternative alias '".$containeraliasalt."' that does not exists in web site (".$website->id." / ".$website->ref.")"; |
300 | 316 | exit; |
301 | 317 | } |
302 | 318 | } |
303 | 319 | |
304 | - if (defined('USEDOLIBARRSERVER')) // When page called from Dolibarr server |
|
320 | + if (defined('USEDOLIBARRSERVER')) { |
|
321 | + // When page called from Dolibarr server |
|
305 | 322 | { |
306 | 323 | // Check new container exists |
307 | 324 | if (! $containeraliasalt) // If containeraliasalt set, we already did the test |
308 | 325 | { |
309 | 326 | include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; |
327 | + } |
|
310 | 328 | $tmpwebsitepage=new WebsitePage($db); |
311 | 329 | $result = $tmpwebsitepage->fetch(0, $website->id, $containerref); |
312 | 330 | unset($tmpwebsitepage); |
@@ -320,19 +338,16 @@ discard block |
||
320 | 338 | { |
321 | 339 | print "Error, page with uri '.$currenturi.' try a redirect to the same alias page '".$containerref."' in web site '".$website->ref."'"; |
322 | 340 | exit; |
323 | - } |
|
324 | - else |
|
341 | + } else |
|
325 | 342 | { |
326 | 343 | $newurl = preg_replace('/&pageref=([^&]+)/', '&pageref='.$containerref, $currenturi); |
327 | 344 | } |
328 | - } |
|
329 | - else |
|
345 | + } else |
|
330 | 346 | { |
331 | 347 | $newurl = $currenturi.'&pageref='.urlencode($containerref); |
332 | 348 | } |
333 | 349 | } |
334 | - } |
|
335 | - else // When page called from virtual host server |
|
350 | + } else // When page called from virtual host server |
|
336 | 351 | { |
337 | 352 | $newurl = '/'.$containerref.'.php'; |
338 | 353 | } |
@@ -341,8 +356,7 @@ discard block |
||
341 | 356 | { |
342 | 357 | header("Location: ".$newurl); |
343 | 358 | exit; |
344 | - } |
|
345 | - else |
|
359 | + } else |
|
346 | 360 | { |
347 | 361 | print "Error, page contains a redirect to the alias page '".$containerref."' that does not exists in web site (".$website->id." / ".$website->ref.")"; |
348 | 362 | exit; |
@@ -365,11 +379,15 @@ discard block |
||
365 | 379 | |
366 | 380 | $MAXLEVEL=20; |
367 | 381 | |
368 | - if (! preg_match('/\.php$/i', $containerref)) $containerref.='.php'; |
|
382 | + if (! preg_match('/\.php$/i', $containerref)) { |
|
383 | + $containerref.='.php'; |
|
384 | + } |
|
369 | 385 | |
370 | 386 | $fullpathfile=DOL_DATA_ROOT.'/website/'.$websitekey.'/'.$containerref; |
371 | 387 | |
372 | - if (empty($includehtmlcontentopened)) $includehtmlcontentopened=0; |
|
388 | + if (empty($includehtmlcontentopened)) { |
|
389 | + $includehtmlcontentopened=0; |
|
390 | + } |
|
373 | 391 | $includehtmlcontentopened++; |
374 | 392 | if ($includehtmlcontentopened > $MAXLEVEL) |
375 | 393 | { |
@@ -422,7 +440,9 @@ discard block |
||
422 | 440 | |
423 | 441 | $alreadygrabbed=array(); |
424 | 442 | |
425 | - if (preg_match('/\/$/', $urltograb)) $urltograb.='.'; |
|
443 | + if (preg_match('/\/$/', $urltograb)) { |
|
444 | + $urltograb.='.'; |
|
445 | + } |
|
426 | 446 | $urltograb = dirname($urltograb); // So urltograb is now http://www.nltechno.com or http://www.nltechno.com/dir1 |
427 | 447 | |
428 | 448 | // Search X in "img...src=X" |
@@ -430,21 +450,25 @@ discard block |
||
430 | 450 | |
431 | 451 | foreach ($regs[0] as $key => $val) |
432 | 452 | { |
433 | - if (preg_match('/^data:image/i', $regs[2][$key])) continue; // We do nothing for such images |
|
453 | + if (preg_match('/^data:image/i', $regs[2][$key])) { |
|
454 | + continue; |
|
455 | + } |
|
456 | + // We do nothing for such images |
|
434 | 457 | |
435 | 458 | if (preg_match('/^\//', $regs[2][$key])) |
436 | 459 | { |
437 | 460 | $urltograbdirrootwithoutslash = getRootURLFromURL($urltograb); |
438 | 461 | $urltograbbis = $urltograbdirrootwithoutslash.$regs[2][$key]; // We use dirroot |
439 | - } |
|
440 | - else |
|
462 | + } else |
|
441 | 463 | { |
442 | 464 | $urltograbbis = $urltograb.'/'.$regs[2][$key]; // We use dir of grabbed file |
443 | 465 | } |
444 | 466 | |
445 | 467 | $linkwithoutdomain = $regs[2][$key]; |
446 | 468 | $dirforimages = '/'.$objectpage->pageurl; |
447 | - if ($grabimagesinto == 'root') $dirforimages=''; |
|
469 | + if ($grabimagesinto == 'root') { |
|
470 | + $dirforimages=''; |
|
471 | + } |
|
448 | 472 | |
449 | 473 | // Define $filetosave and $filename |
450 | 474 | $filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.$dirforimages.(preg_match('/^\//', $regs[2][$key])?'':'/').$regs[2][$key]; |
@@ -474,14 +498,12 @@ discard block |
||
474 | 498 | $error++; |
475 | 499 | setEventMessages('Error getting '.$urltograbbis.': '.$tmpgeturl['curl_error_msg'], null, 'errors'); |
476 | 500 | $action='create'; |
477 | - } |
|
478 | - elseif ($tmpgeturl['http_code'] != '200') |
|
501 | + } elseif ($tmpgeturl['http_code'] != '200') |
|
479 | 502 | { |
480 | 503 | $error++; |
481 | 504 | setEventMessages('Error getting '.$urltograbbis.': '.$tmpgeturl['http_code'], null, 'errors'); |
482 | 505 | $action='create'; |
483 | - } |
|
484 | - else |
|
506 | + } else |
|
485 | 507 | { |
486 | 508 | $alreadygrabbed[$urltograbbis]=1; // Track that file was alreay grabbed. |
487 | 509 | |
@@ -490,8 +512,9 @@ discard block |
||
490 | 512 | $fp = fopen($filetosave, "w"); |
491 | 513 | fputs($fp, $tmpgeturl['content']); |
492 | 514 | fclose($fp); |
493 | - if (! empty($conf->global->MAIN_UMASK)) |
|
494 | - @chmod($filetosave, octdec($conf->global->MAIN_UMASK)); |
|
515 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
516 | + @chmod($filetosave, octdec($conf->global->MAIN_UMASK)); |
|
517 | + } |
|
495 | 518 | } |
496 | 519 | } |
497 | 520 | } |
@@ -507,14 +530,16 @@ discard block |
||
507 | 530 | |
508 | 531 | foreach ($regs[0] as $key => $val) |
509 | 532 | { |
510 | - if (preg_match('/^data:image/i', $regs[2][$key])) continue; // We do nothing for such images |
|
533 | + if (preg_match('/^data:image/i', $regs[2][$key])) { |
|
534 | + continue; |
|
535 | + } |
|
536 | + // We do nothing for such images |
|
511 | 537 | |
512 | 538 | if (preg_match('/^\//', $regs[2][$key])) |
513 | 539 | { |
514 | 540 | $urltograbdirrootwithoutslash = getRootURLFromURL($urltograb); |
515 | 541 | $urltograbbis = $urltograbdirrootwithoutslash.$regs[2][$key]; // We use dirroot |
516 | - } |
|
517 | - else |
|
542 | + } else |
|
518 | 543 | { |
519 | 544 | $urltograbbis = $urltograb.'/'.$regs[2][$key]; // We use dir of grabbed file |
520 | 545 | } |
@@ -522,7 +547,9 @@ discard block |
||
522 | 547 | $linkwithoutdomain = $regs[2][$key]; |
523 | 548 | |
524 | 549 | $dirforimages = '/'.$objectpage->pageurl; |
525 | - if ($grabimagesinto == 'root') $dirforimages=''; |
|
550 | + if ($grabimagesinto == 'root') { |
|
551 | + $dirforimages=''; |
|
552 | + } |
|
526 | 553 | |
527 | 554 | $filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.$dirforimages.(preg_match('/^\//', $regs[2][$key])?'':'/').$regs[2][$key]; |
528 | 555 | |
@@ -553,14 +580,12 @@ discard block |
||
553 | 580 | $error++; |
554 | 581 | setEventMessages('Error getting '.$urltograbbis.': '.$tmpgeturl['curl_error_msg'], null, 'errors'); |
555 | 582 | $action='create'; |
556 | - } |
|
557 | - elseif ($tmpgeturl['http_code'] != '200') |
|
583 | + } elseif ($tmpgeturl['http_code'] != '200') |
|
558 | 584 | { |
559 | 585 | $error++; |
560 | 586 | setEventMessages('Error getting '.$urltograbbis.': '.$tmpgeturl['http_code'], null, 'errors'); |
561 | 587 | $action='create'; |
562 | - } |
|
563 | - else |
|
588 | + } else |
|
564 | 589 | { |
565 | 590 | $alreadygrabbed[$urltograbbis]=1; // Track that file was alreay grabbed. |
566 | 591 | |
@@ -569,8 +594,9 @@ discard block |
||
569 | 594 | $fp = fopen($filetosave, "w"); |
570 | 595 | fputs($fp, $tmpgeturl['content']); |
571 | 596 | fclose($fp); |
572 | - if (! empty($conf->global->MAIN_UMASK)) |
|
573 | - @chmod($filetosave, octdec($conf->global->MAIN_UMASK)); |
|
597 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
598 | + @chmod($filetosave, octdec($conf->global->MAIN_UMASK)); |
|
599 | + } |
|
574 | 600 | } |
575 | 601 | } |
576 | 602 | } |
@@ -603,8 +629,9 @@ discard block |
||
603 | 629 | $mastercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n"; |
604 | 630 | $mastercontent.= '?>'."\n"; |
605 | 631 | $result = file_put_contents($filemaster, $mastercontent); |
606 | - if (! empty($conf->global->MAIN_UMASK)) |
|
607 | - @chmod($filemaster, octdec($conf->global->MAIN_UMASK)); |
|
632 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
633 | + @chmod($filemaster, octdec($conf->global->MAIN_UMASK)); |
|
634 | + } |
|
608 | 635 | |
609 | 636 | return $result; |
610 | 637 | } |
@@ -657,7 +684,10 @@ discard block |
||
657 | 684 | dol_delete_file($filetpl); |
658 | 685 | |
659 | 686 | $shortlangcode = ''; |
660 | - if ($objectpage->lang) $shortlangcode=preg_replace('/[_-].*$/', '', $objectpage->lang); // en_US or en-US -> en |
|
687 | + if ($objectpage->lang) { |
|
688 | + $shortlangcode=preg_replace('/[_-].*$/', '', $objectpage->lang); |
|
689 | + } |
|
690 | + // en_US or en-US -> en |
|
661 | 691 | |
662 | 692 | $tplcontent =''; |
663 | 693 | $tplcontent.= "<?php // BEGIN PHP\n"; |
@@ -699,8 +729,9 @@ discard block |
||
699 | 729 | |
700 | 730 | //var_dump($filetpl);exit; |
701 | 731 | $result = file_put_contents($filetpl, $tplcontent); |
702 | - if (! empty($conf->global->MAIN_UMASK)) |
|
703 | - @chmod($filetpl, octdec($conf->global->MAIN_UMASK)); |
|
732 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
733 | + @chmod($filetpl, octdec($conf->global->MAIN_UMASK)); |
|
734 | + } |
|
704 | 735 | |
705 | 736 | return $result; |
706 | 737 | } |
@@ -737,16 +768,18 @@ discard block |
||
737 | 768 | $indexcontent.= "include_once './".basename($filetpl)."'\n"; |
738 | 769 | $indexcontent.= '// END PHP ?>'."\n"; |
739 | 770 | $result1 = file_put_contents($fileindex, $indexcontent); |
740 | - if (! empty($conf->global->MAIN_UMASK)) |
|
741 | - @chmod($fileindex, octdec($conf->global->MAIN_UMASK)); |
|
771 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
772 | + @chmod($fileindex, octdec($conf->global->MAIN_UMASK)); |
|
773 | + } |
|
742 | 774 | |
743 | 775 | dol_delete_file($filewrapper); |
744 | 776 | |
745 | 777 | $wrappercontent=file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.html'); |
746 | 778 | |
747 | 779 | $result2 = file_put_contents($filewrapper, $wrappercontent); |
748 | - if (! empty($conf->global->MAIN_UMASK)) |
|
749 | - @chmod($filewrapper, octdec($conf->global->MAIN_UMASK)); |
|
780 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
781 | + @chmod($filewrapper, octdec($conf->global->MAIN_UMASK)); |
|
782 | + } |
|
750 | 783 | |
751 | 784 | return ($result1 && $result2); |
752 | 785 | } |
@@ -767,8 +800,9 @@ discard block |
||
767 | 800 | |
768 | 801 | dol_mkdir($pathofwebsite); |
769 | 802 | $result = file_put_contents($filehtmlheader, $htmlheadercontent); |
770 | - if (! empty($conf->global->MAIN_UMASK)) |
|
771 | - @chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK)); |
|
803 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
804 | + @chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK)); |
|
805 | + } |
|
772 | 806 | |
773 | 807 | if (! $result) |
774 | 808 | { |
@@ -794,8 +828,9 @@ discard block |
||
794 | 828 | |
795 | 829 | dol_mkdir($pathofwebsite); |
796 | 830 | $result = file_put_contents($filecss, $csscontent); |
797 | - if (! empty($conf->global->MAIN_UMASK)) |
|
798 | - @chmod($filecss, octdec($conf->global->MAIN_UMASK)); |
|
831 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
832 | + @chmod($filecss, octdec($conf->global->MAIN_UMASK)); |
|
833 | + } |
|
799 | 834 | |
800 | 835 | if (! $result) |
801 | 836 | { |
@@ -821,8 +856,9 @@ discard block |
||
821 | 856 | |
822 | 857 | dol_mkdir($pathofwebsite); |
823 | 858 | $result = file_put_contents($filejs, $jscontent); |
824 | - if (! empty($conf->global->MAIN_UMASK)) |
|
825 | - @chmod($filejs, octdec($conf->global->MAIN_UMASK)); |
|
859 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
860 | + @chmod($filejs, octdec($conf->global->MAIN_UMASK)); |
|
861 | + } |
|
826 | 862 | |
827 | 863 | if (! $result) |
828 | 864 | { |
@@ -848,8 +884,9 @@ discard block |
||
848 | 884 | |
849 | 885 | dol_mkdir($pathofwebsite); |
850 | 886 | $result = file_put_contents($filerobot, $robotcontent); |
851 | - if (! empty($conf->global->MAIN_UMASK)) |
|
852 | - @chmod($filerobot, octdec($conf->global->MAIN_UMASK)); |
|
887 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
888 | + @chmod($filerobot, octdec($conf->global->MAIN_UMASK)); |
|
889 | + } |
|
853 | 890 | |
854 | 891 | if (! $result) |
855 | 892 | { |
@@ -875,8 +912,9 @@ discard block |
||
875 | 912 | |
876 | 913 | dol_mkdir($pathofwebsite); |
877 | 914 | $result = file_put_contents($filehtaccess, $htaccess); |
878 | - if (! empty($conf->global->MAIN_UMASK)) |
|
879 | - @chmod($filehtaccess, octdec($conf->global->MAIN_UMASK)); |
|
915 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
916 | + @chmod($filehtaccess, octdec($conf->global->MAIN_UMASK)); |
|
917 | + } |
|
880 | 918 | |
881 | 919 | if (! $result) |
882 | 920 | { |
@@ -49,7 +49,9 @@ discard block |
||
49 | 49 | $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
50 | 50 | $head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/contact.php?id='.$object->id; |
51 | 51 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
52 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
52 | + if ($nbContact > 0) { |
|
53 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
54 | + } |
|
53 | 55 | $head[$h][2] = 'contact'; |
54 | 56 | $h++; |
55 | 57 | } |
@@ -63,11 +65,17 @@ discard block |
||
63 | 65 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
64 | 66 | { |
65 | 67 | $nbNote = 0; |
66 | - if(!empty($object->note_private)) $nbNote++; |
|
67 | - if(!empty($object->note_public)) $nbNote++; |
|
68 | + if(!empty($object->note_private)) { |
|
69 | + $nbNote++; |
|
70 | + } |
|
71 | + if(!empty($object->note_public)) { |
|
72 | + $nbNote++; |
|
73 | + } |
|
68 | 74 | $head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/note.php?id='.$object->id; |
69 | 75 | $head[$h][1] = $langs->trans('Notes'); |
70 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
76 | + if ($nbNote > 0) { |
|
77 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
78 | + } |
|
71 | 79 | $head[$h][2] = 'note'; |
72 | 80 | $h++; |
73 | 81 | } |
@@ -79,7 +87,9 @@ discard block |
||
79 | 87 | $nbLinks=Link::count($db, $object->element, $object->id); |
80 | 88 | $head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/document.php?id='.$object->id; |
81 | 89 | $head[$h][1] = $langs->trans('Documents'); |
82 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
90 | + if (($nbFiles+$nbLinks) > 0) { |
|
91 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
92 | + } |
|
83 | 93 | $head[$h][2] = 'document'; |
84 | 94 | $h++; |
85 | 95 |