Test Failed
Push — master ( 2c8b6d...9d1fea )
by Alxarafe
45:51
created
dolibarr/htdocs/admin/translation.php 1 patch
Braces   +23 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@  discard block
 block discarded – undo
32 32
 // Load translation files required by the page
33 33
 $langs->loadLangs(array("companies", "products", "admin", "sms", "other", "errors"));
34 34
 
35
-if (!$user->admin)
35
+if (!$user->admin) {
36 36
     accessforbidden();
37
+}
37 38
 
38 39
 $id = GETPOST('rowid', 'int');
39 40
 $action = GETPOST('action', 'alpha');
@@ -55,10 +56,12 @@  discard block
 block discarded – undo
55 56
 $offset = $limit * $page;
56 57
 $pageprev = $page - 1;
57 58
 $pagenext = $page + 1;
58
-if (!$sortfield)
59
+if (!$sortfield) {
59 60
     $sortfield = 'lang,transkey';
60
-if (!$sortorder)
61
+}
62
+if (!$sortorder) {
61 63
     $sortorder = 'ASC';
64
+}
62 65
 
63 66
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
64 67
 $hookmanager->initHooks(array('admintranslation', 'globaladmin'));
@@ -78,8 +81,9 @@  discard block
 block discarded – undo
78 81
 
79 82
 $parameters = array('socid' => $socid);
80 83
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);    // Note that $action and $object may have been modified by some hooks
81
-if ($reshook < 0)
84
+if ($reshook < 0) {
82 85
     setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
86
+}
83 87
 
84 88
 include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
85 89
 
@@ -219,18 +223,24 @@  discard block
 block discarded – undo
219 223
 
220 224
 print '<br>';
221 225
 
222
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"])
226
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
223 227
     $param .= '&contextpage=' . $contextpage;
224
-if ($limit > 0 && $limit != $conf->liste_limit)
228
+}
229
+if ($limit > 0 && $limit != $conf->liste_limit) {
225 230
     $param .= '&limit=' . $limit;
226
-if ($optioncss != '')
231
+}
232
+if ($optioncss != '') {
227 233
     $param .= '&optioncss=' . $optioncss;
228
-if ($langcode)
234
+}
235
+if ($langcode) {
229 236
     $param .= '&langcode=' . urlencode($langcode);
230
-if ($transkey)
237
+}
238
+if ($transkey) {
231 239
     $param .= '&transkey=' . urlencode($transkey);
232
-if ($transvalue)
240
+}
241
+if ($transvalue) {
233 242
     $param .= '&transvalue=' . urlencode($transvalue);
243
+}
234 244
 
235 245
 
236 246
 print '<form action="' . $_SERVER["PHP_SELF"] . ((empty($user->entity) && $debug) ? '?debug=1' : '') . '" method="POST">';
@@ -255,8 +265,9 @@  discard block
 block discarded – undo
255 265
         $disabled = ' disabled="disabled"';
256 266
     }
257 267
     $disablededit = '';
258
-    if ($action == 'edit' || empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
259
-        $disablededit = ' disabled';
268
+    if ($action == 'edit' || empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) {
269
+            $disablededit = ' disabled';
270
+    }
260 271
 
261 272
     print '<div class="justify"><span class="opacitymedium">';
262 273
     print img_info() . ' ' . $langs->trans("SomeTranslationAreUncomplete");
Please login to merge, or discard this patch.
dolibarr/htdocs/admin/company.php 1 patch
Braces   +67 added lines, -47 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
 
60 60
 $parameters = array();
61 61
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);    // Note that $action and $object may have been modified by some hooks
62
-if ($reshook < 0)
62
+if ($reshook < 0) {
63 63
     setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
64
+}
64 65
 
65 66
 if (($action == 'update' && !GETPOST("cancel", 'alpha')) || ($action == 'updateedit')) {
66 67
     $tmparray = getCountry(GETPOST('country_id', 'int'), 'all', $db, $langs, 0);
@@ -116,20 +117,22 @@  discard block
 block discarded – undo
116 117
                         if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
117 118
                             $imgThumbSmall = $reg[1];    // Save only basename
118 119
                             dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
119
-                        } else
120
-                            dol_syslog($imgThumbSmall);
120
+                        } else {
121
+                                                    dol_syslog($imgThumbSmall);
122
+                        }
121 123
 
122 124
                         // Create mini thumb, Used on menu or for setup page for example
123 125
                         $imgThumbMini = vignette($dirforimage . $original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
124 126
                         if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) {
125 127
                             $imgThumbMini = $reg[1];     // Save only basename
126 128
                             dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
127
-                        } else
128
-                            dol_syslog($imgThumbMini);
129
-                    } else
130
-                        dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING);
131
-                }
132
-                else if (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
129
+                        } else {
130
+                                                    dol_syslog($imgThumbMini);
131
+                        }
132
+                    } else {
133
+                                            dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING);
134
+                    }
135
+                } else if (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
133 136
                     $error++;
134 137
                     $langs->load("errors");
135 138
                     $tmparray = explode(':', $result);
@@ -221,21 +224,22 @@  discard block
 block discarded – undo
221 224
             if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
222 225
                 $imgThumbSmall = $reg[1];   // Save only basename
223 226
                 dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
224
-            } else
225
-                dol_syslog($imgThumbSmall);
227
+            } else {
228
+                            dol_syslog($imgThumbSmall);
229
+            }
226 230
 
227 231
             // Create mini thumbs. Used on menu or for setup page for example
228 232
             $imgThumbMini = vignette($conf->mycompany->dir_output . '/logos/' . $_GET["file"], $maxwidthmini, $maxheightmini, '_mini', $quality);
229 233
             if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) {
230 234
                 $imgThumbMini = $reg[1];   // Save only basename
231 235
                 dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
232
-            } else
233
-                dol_syslog($imgThumbMini);
236
+            } else {
237
+                            dol_syslog($imgThumbMini);
238
+            }
234 239
 
235 240
             header("Location: " . $_SERVER["PHP_SELF"]);
236 241
             exit;
237
-        }
238
-        else {
242
+        } else {
239 243
             $error++;
240 244
             $langs->load("errors");
241 245
             setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
@@ -253,20 +257,23 @@  discard block
 block discarded – undo
253 257
     require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
254 258
 
255 259
     $logofile = $conf->mycompany->dir_output . '/logos/' . $mysoc->logo;
256
-    if ($mysoc->logo != '')
257
-        dol_delete_file($logofile);
260
+    if ($mysoc->logo != '') {
261
+            dol_delete_file($logofile);
262
+    }
258 263
     dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO", $conf->entity);
259 264
     $mysoc->logo = '';
260 265
 
261 266
     $logosmallfile = $conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small;
262
-    if ($mysoc->logo_small != '')
263
-        dol_delete_file($logosmallfile);
267
+    if ($mysoc->logo_small != '') {
268
+            dol_delete_file($logosmallfile);
269
+    }
264 270
     dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $conf->entity);
265 271
     $mysoc->logo_small = '';
266 272
 
267 273
     $logominifile = $conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_mini;
268
-    if ($mysoc->logo_mini != '')
269
-        dol_delete_file($logominifile);
274
+    if ($mysoc->logo_mini != '') {
275
+            dol_delete_file($logominifile);
276
+    }
270 277
     dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $conf->entity);
271 278
     $mysoc->logo_mini = '';
272 279
 }
@@ -337,8 +344,9 @@  discard block
 block discarded – undo
337 344
     print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">' . $langs->trans("Country") . '</label></td><td class="maxwidthonsmartphone">';
338 345
     //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2);    // By default, country of localization
339 346
     print $form->select_country($mysoc->country_id, 'country_id');
340
-    if ($user->admin)
341
-        print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
347
+    if ($user->admin) {
348
+            print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
349
+    }
342 350
     print '</td></tr>' . "\n";
343 351
 
344 352
 
@@ -553,8 +561,9 @@  discard block
 block discarded – undo
553 561
     print '<td colspan="2">';
554 562
     print "<table>";
555 563
     print "<tr><td><label for=\"use_vat\">" . $langs->trans("VATIsUsedDesc") . "</label></td></tr>";
556
-    if ($mysoc->country_code == 'FR')
557
-        print "<tr><td><i>" . $langs->trans("Example") . ': ' . $langs->trans("VATIsUsedExampleFR") . "</i></td></tr>\n";
564
+    if ($mysoc->country_code == 'FR') {
565
+            print "<tr><td><i>" . $langs->trans("Example") . ': ' . $langs->trans("VATIsUsedExampleFR") . "</i></td></tr>\n";
566
+    }
558 567
     print "</table>";
559 568
     print "</td></tr>\n";
560 569
 
@@ -563,8 +572,9 @@  discard block
 block discarded – undo
563 572
     print '<td colspan="2">';
564 573
     print "<table>";
565 574
     print "<tr><td><label for=\"no_vat\">" . $langs->trans("VATIsNotUsedDesc") . "</label></td></tr>";
566
-    if ($mysoc->country_code == 'FR')
567
-        print "<tr><td><i>" . $langs->trans("Example") . ': ' . $langs->trans("VATIsNotUsedExampleFR") . "</i></td></tr>\n";
575
+    if ($mysoc->country_code == 'FR') {
576
+            print "<tr><td><i>" . $langs->trans("Example") . ': ' . $langs->trans("VATIsNotUsedExampleFR") . "</i></td></tr>\n";
577
+    }
568 578
     print "</table>";
569 579
     print "</td></tr>\n";
570 580
 
@@ -740,8 +750,9 @@  discard block
 block discarded – undo
740 750
     print '<tr class="oddeven"><td>' . $langs->trans("Web") . '</td><td>';
741 751
     $arrayofurl = preg_split('/\s/', $conf->global->MAIN_INFO_SOCIETE_WEB);
742 752
     foreach ($arrayofurl as $urltoshow) {
743
-        if ($urltoshow)
744
-            print dol_print_url($urltoshow, '_blank', 80);
753
+        if ($urltoshow) {
754
+                    print dol_print_url($urltoshow, '_blank', 80);
755
+        }
745 756
     }
746 757
     print '</td></tr>';
747 758
 
@@ -756,8 +767,9 @@  discard block
 block discarded – undo
756 767
     print '<tr class="oddeven"><td>' . $langs->trans("Logo") . '</td><td>';
757 768
 
758 769
     $tagtd = 'tagtd ';
759
-    if ($conf->browser->layout == 'phone')
760
-        $tagtd = '';
770
+    if ($conf->browser->layout == 'phone') {
771
+            $tagtd = '';
772
+    }
761 773
     print '<div class="tagtable centpercent"><div class="tagtr inline-block centpercent valignmiddle"><div class="' . $tagtd . 'inline-block valignmiddle left">';
762 774
     print $mysoc->logo;
763 775
     print '</div><div class="' . $tagtd . 'inline-block valignmiddle left">';
@@ -820,8 +832,9 @@  discard block
 block discarded – undo
820 832
         if (!empty($conf->global->MAIN_INFO_SIREN)) {
821 833
             print $conf->global->MAIN_INFO_SIREN;
822 834
             $s = $mysoc->id_prof_url(1, $mysoc);
823
-            if ($s)
824
-                print ' - ' . $s;
835
+            if ($s) {
836
+                            print ' - ' . $s;
837
+            }
825 838
         } else {
826 839
             print '&nbsp;';
827 840
         }
@@ -835,8 +848,9 @@  discard block
 block discarded – undo
835 848
         if (!empty($conf->global->MAIN_INFO_SIRET)) {
836 849
             print $conf->global->MAIN_INFO_SIRET;
837 850
             $s = $mysoc->id_prof_url(2, $mysoc);
838
-            if ($s)
839
-                print ' - ' . $s;
851
+            if ($s) {
852
+                            print ' - ' . $s;
853
+            }
840 854
         } else {
841 855
             print '&nbsp;';
842 856
         }
@@ -850,8 +864,9 @@  discard block
 block discarded – undo
850 864
         if (!empty($conf->global->MAIN_INFO_APE)) {
851 865
             print $conf->global->MAIN_INFO_APE;
852 866
             $s = $mysoc->id_prof_url(3, $mysoc);
853
-            if ($s)
854
-                print ' - ' . $s;
867
+            if ($s) {
868
+                            print ' - ' . $s;
869
+            }
855 870
         } else {
856 871
             print '&nbsp;';
857 872
         }
@@ -865,8 +880,9 @@  discard block
 block discarded – undo
865 880
         if (!empty($conf->global->MAIN_INFO_RCS)) {
866 881
             print $conf->global->MAIN_INFO_RCS;
867 882
             $s = $mysoc->id_prof_url(4, $mysoc);
868
-            if ($s)
869
-                print ' - ' . $s;
883
+            if ($s) {
884
+                            print ' - ' . $s;
885
+            }
870 886
         } else {
871 887
             print '&nbsp;';
872 888
         }
@@ -880,8 +896,9 @@  discard block
 block discarded – undo
880 896
         if (!empty($conf->global->MAIN_INFO_PROFID5)) {
881 897
             print $conf->global->MAIN_INFO_PROFID5;
882 898
             $s = $mysoc->id_prof_url(5, $mysoc);
883
-            if ($s)
884
-                print ' - ' . $s;
899
+            if ($s) {
900
+                            print ' - ' . $s;
901
+            }
885 902
         } else {
886 903
             print '&nbsp;';
887 904
         }
@@ -895,8 +912,9 @@  discard block
 block discarded – undo
895 912
         if (!empty($conf->global->MAIN_INFO_PROFID6)) {
896 913
             print $conf->global->MAIN_INFO_PROFID6;
897 914
             $s = $mysoc->id_prof_url(6, $mysoc);
898
-            if ($s)
899
-                print ' - ' . $s;
915
+            if ($s) {
916
+                            print ' - ' . $s;
917
+            }
900 918
         } else {
901 919
             print '&nbsp;';
902 920
         }
@@ -978,8 +996,9 @@  discard block
 block discarded – undo
978 996
     print '<td colspan="2">';
979 997
     print "<table>";
980 998
     print "<tr><td><label for=\"use_vat\">" . $langs->trans("VATIsUsedDesc") . "</label></td></tr>";
981
-    if ($mysoc->country_code == 'FR')
982
-        print "<tr><td><i>" . $langs->trans("Example") . ': ' . $langs->trans("VATIsUsedExampleFR") . "</i></td></tr>\n";
999
+    if ($mysoc->country_code == 'FR') {
1000
+            print "<tr><td><i>" . $langs->trans("Example") . ': ' . $langs->trans("VATIsUsedExampleFR") . "</i></td></tr>\n";
1001
+    }
983 1002
     print "</table>";
984 1003
     print "</td></tr>\n";
985 1004
 
@@ -989,8 +1008,9 @@  discard block
 block discarded – undo
989 1008
     print '<td colspan="2">';
990 1009
     print "<table>";
991 1010
     print "<tr><td><label=\"no_vat\">" . $langs->trans("VATIsNotUsedDesc") . "</label></td></tr>";
992
-    if ($mysoc->country_code == 'FR')
993
-        print "<tr><td><i>" . $langs->trans("Example") . ': ' . $langs->trans("VATIsNotUsedExampleFR") . "</i></td></tr>\n";
1011
+    if ($mysoc->country_code == 'FR') {
1012
+            print "<tr><td><i>" . $langs->trans("Example") . ': ' . $langs->trans("VATIsNotUsedExampleFR") . "</i></td></tr>\n";
1013
+    }
994 1014
     print "</table>";
995 1015
     print "</td></tr>\n";
996 1016
 
Please login to merge, or discard this patch.
dolibarr/htdocs/admin/accountant.php 1 patch
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -53,25 +53,25 @@  discard block
 block discarded – undo
53 53
 if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
54 54
 || ($action == 'updateedit') )
55 55
 {
56
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
57
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address",'nohtml'),'chaine',0,'',$conf->entity);
58
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town",'nohtml'),'chaine',0,'',$conf->entity);
59
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode",'alpha'),'chaine',0,'',$conf->entity);
60
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity);
61
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code",'alpha'),'chaine',0,'',$conf->entity);
62
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id','int'), 'chaine',0,'',$conf->entity);
63
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity);
64
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity);
65
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity);
66
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity);
67
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code",'nohtml'),'chaine',0,'',$conf->entity);
68
-	dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity);
69
-
70
-	if ($action != 'updateedit' && ! $error)
71
-	{
72
-		header("Location: ".$_SERVER["PHP_SELF"]);
73
-		exit;
74
-	}
56
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
57
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address",'nohtml'),'chaine',0,'',$conf->entity);
58
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town",'nohtml'),'chaine',0,'',$conf->entity);
59
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode",'alpha'),'chaine',0,'',$conf->entity);
60
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity);
61
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code",'alpha'),'chaine',0,'',$conf->entity);
62
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id','int'), 'chaine',0,'',$conf->entity);
63
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity);
64
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity);
65
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity);
66
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity);
67
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code",'nohtml'),'chaine',0,'',$conf->entity);
68
+    dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity);
69
+
70
+    if ($action != 'updateedit' && ! $error)
71
+    {
72
+        header("Location: ".$_SERVER["PHP_SELF"]);
73
+        exit;
74
+    }
75 75
 }
76 76
 
77 77
 /*
@@ -98,155 +98,155 @@  discard block
 block discarded – undo
98 98
 
99 99
 if ($action == 'edit' || $action == 'updateedit')
100 100
 {
101
-	/**
102
-	 * Edit parameters
103
-	 */
104
-	print "\n".'<script type="text/javascript" language="javascript">';
105
-	print '$(document).ready(function () {
101
+    /**
102
+     * Edit parameters
103
+     */
104
+    print "\n".'<script type="text/javascript" language="javascript">';
105
+    print '$(document).ready(function () {
106 106
 			  $("#selectcountry_id").change(function() {
107 107
 				document.form_index.action.value="updateedit";
108 108
 				document.form_index.submit();
109 109
 			  });
110 110
 		  });';
111
-	print '</script>'."\n";
111
+    print '</script>'."\n";
112 112
 
113
-	//print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
113
+    //print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
114 114
     print '<form method="POST" href="' . BASE_URI . '?controller=admin&method=accountant" name="form_index">';
115 115
     print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
116
-	print '<input type="hidden" name="action" value="update">';
116
+    print '<input type="hidden" name="action" value="update">';
117 117
 
118
-	print '<table class="noborder" width="100%">';
119
-	print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
118
+    print '<table class="noborder" width="100%">';
119
+    print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
120 120
 
121
-	// Name
122
-	print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
123
-	print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_NAME?$conf->global->MAIN_INFO_ACCOUNTANT_NAME: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
121
+    // Name
122
+    print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
123
+    print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_NAME?$conf->global->MAIN_INFO_ACCOUNTANT_NAME: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
124 124
 
125
-	// Address
126
-	print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
127
-	print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS?$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS: GETPOST("address",'nohtml')) . '</textarea></td></tr>'."\n";
125
+    // Address
126
+    print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
127
+    print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS?$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS: GETPOST("address",'nohtml')) . '</textarea></td></tr>'."\n";
128 128
 
129
-	print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
130
-	print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_ZIP?$conf->global->MAIN_INFO_ACCOUNTANT_ZIP: GETPOST("zipcode",'alpha')) . '"></td></tr>'."\n";
129
+    print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
130
+    print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_ZIP?$conf->global->MAIN_INFO_ACCOUNTANT_ZIP: GETPOST("zipcode",'alpha')) . '"></td></tr>'."\n";
131 131
 
132
-	print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
133
-	print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_TOWN?$conf->global->MAIN_INFO_ACCOUNTANT_TOWN: GETPOST("town",'nohtml')) . '"></td></tr>'."\n";
132
+    print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
133
+    print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_TOWN?$conf->global->MAIN_INFO_ACCOUNTANT_TOWN: GETPOST("town",'nohtml')) . '"></td></tr>'."\n";
134 134
 
135
-	// Country
136
-	print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
137
-	//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2);    // By default, country of localization
138
-	print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id');
139
-	if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
140
-	print '</td></tr>'."\n";
135
+    // Country
136
+    print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
137
+    //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2);    // By default, country of localization
138
+    print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id');
139
+    if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
140
+    print '</td></tr>'."\n";
141 141
 
142
-	print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
143
-	$formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id');
144
-	print '</td></tr>'."\n";
142
+    print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
143
+    $formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id');
144
+    print '</td></tr>'."\n";
145 145
 
146
-	print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
147
-	print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_PHONE . '"></td></tr>';
148
-	print '</td></tr>'."\n";
146
+    print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
147
+    print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_PHONE . '"></td></tr>';
148
+    print '</td></tr>'."\n";
149 149
 
150
-	print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
151
-	print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_FAX . '"></td></tr>';
152
-	print '</td></tr>'."\n";
150
+    print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
151
+    print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_FAX . '"></td></tr>';
152
+    print '</td></tr>'."\n";
153 153
 
154
-	print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
155
-	print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_MAIL . '"></td></tr>';
156
-	print '</td></tr>'."\n";
154
+    print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
155
+    print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_MAIL . '"></td></tr>';
156
+    print '</td></tr>'."\n";
157 157
 
158
-	// Web
159
-	print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
160
-	print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_WEB . '"></td></tr>';
161
-	print '</td></tr>'."\n";
158
+    // Web
159
+    print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
160
+    print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_WEB . '"></td></tr>';
161
+    print '</td></tr>'."\n";
162 162
 
163
-	// Code
164
-	print '<tr class="oddeven"><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>';
165
-	print '<input name="code" id="code" class="minwidth100" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_CODE?$conf->global->MAIN_INFO_ACCOUNTANT_CODE: GETPOST("code",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
163
+    // Code
164
+    print '<tr class="oddeven"><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>';
165
+    print '<input name="code" id="code" class="minwidth100" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_CODE?$conf->global->MAIN_INFO_ACCOUNTANT_CODE: GETPOST("code",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
166 166
 
167
-	// Note
168
-	print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
169
-	print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note','none') ? GETPOST('note','none') : $conf->global->MAIN_INFO_ACCOUNTANT_NOTE).'</textarea></td></tr>';
170
-	print '</td></tr>';
167
+    // Note
168
+    print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
169
+    print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note','none') ? GETPOST('note','none') : $conf->global->MAIN_INFO_ACCOUNTANT_NOTE).'</textarea></td></tr>';
170
+    print '</td></tr>';
171 171
 
172
-	print '</table>';
172
+    print '</table>';
173 173
 
174
-	print '<br><div class="center">';
175
-	print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
176
-	print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
177
-	print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
178
-	print '</div>';
179
-	print '<br>';
174
+    print '<br><div class="center">';
175
+    print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
176
+    print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
177
+    print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
178
+    print '</div>';
179
+    print '<br>';
180 180
 
181
-	print '</form>';
181
+    print '</form>';
182 182
 }
183 183
 else
184 184
 {
185
-	/*
185
+    /*
186 186
 	 * Show parameters
187 187
 	 */
188 188
 
189
-	// Actions buttons
190
-	//print '<div class="tabsAction">';
191
-	//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
192
-	//print '</div><br>';
189
+    // Actions buttons
190
+    //print '<div class="tabsAction">';
191
+    //print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
192
+    //print '</div><br>';
193 193
 
194
-	print '<div class="div-table-responsive-no-min">';
195
-	print '<table class="noborder" width="100%">';
196
-	print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
194
+    print '<div class="div-table-responsive-no-min">';
195
+    print '<table class="noborder" width="100%">';
196
+    print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
197 197
 
198 198
 
199
-	print '<tr class="oddeven"><td class="titlefield wordbreak">'.$langs->trans("CompanyName").'</td><td>';
200
-	print $conf->global->MAIN_INFO_ACCOUNTANT_NAME;
201
-	print '</td></tr>';
199
+    print '<tr class="oddeven"><td class="titlefield wordbreak">'.$langs->trans("CompanyName").'</td><td>';
200
+    print $conf->global->MAIN_INFO_ACCOUNTANT_NAME;
201
+    print '</td></tr>';
202 202
 
203 203
 
204
-	print '<tr class="oddeven"><td>'.$langs->trans("CompanyAddress").'</td><td>' . nl2br(empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) . '</td></tr>';
204
+    print '<tr class="oddeven"><td>'.$langs->trans("CompanyAddress").'</td><td>' . nl2br(empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) . '</td></tr>';
205 205
 
206 206
 
207
-	print '<tr class="oddeven"><td>'.$langs->trans("CompanyZip").'</td><td>' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ZIP) . '</td></tr>';
207
+    print '<tr class="oddeven"><td>'.$langs->trans("CompanyZip").'</td><td>' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ZIP) . '</td></tr>';
208 208
 
209 209
 
210
-	print '<tr class="oddeven"><td>'.$langs->trans("CompanyTown").'</td><td>' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN)?'':$conf->global->MAIN_INFO_ACCOUNTANT_TOWN) . '</td></tr>';
210
+    print '<tr class="oddeven"><td>'.$langs->trans("CompanyTown").'</td><td>' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN)?'':$conf->global->MAIN_INFO_ACCOUNTANT_TOWN) . '</td></tr>';
211 211
 
212 212
 
213
-	print '<tr class="oddeven"><td>'.$langs->trans("CompanyCountry").'</td><td>';
214
-	if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY))
215
-	{
216
-		$code = getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 2);
217
-		$img=picto_from_langcode($code);
218
-		print $img?$img.' ':'';
219
-		print getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY,1);
220
-	}
221
-	print '</td></tr>';
213
+    print '<tr class="oddeven"><td>'.$langs->trans("CompanyCountry").'</td><td>';
214
+    if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY))
215
+    {
216
+        $code = getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 2);
217
+        $img=picto_from_langcode($code);
218
+        print $img?$img.' ':'';
219
+        print getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY,1);
220
+    }
221
+    print '</td></tr>';
222 222
 
223 223
 
224
-	if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print '<tr class="oddeven"><td>'.$langs->trans("Region-State").'</td><td>';
225
-	else print '<tr class="oddeven"><td>'.$langs->trans("State").'</td><td>';
226
-	if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE)) print getState($conf->global->MAIN_INFO_ACCOUNTANT_STATE,$conf->global->MAIN_SHOW_STATE_CODE,0,$conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
227
-	else print '&nbsp;';
228
-	print '</td></tr>';
224
+    if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print '<tr class="oddeven"><td>'.$langs->trans("Region-State").'</td><td>';
225
+    else print '<tr class="oddeven"><td>'.$langs->trans("State").'</td><td>';
226
+    if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE)) print getState($conf->global->MAIN_INFO_ACCOUNTANT_STATE,$conf->global->MAIN_SHOW_STATE_CODE,0,$conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
227
+    else print '&nbsp;';
228
+    print '</td></tr>';
229 229
 
230
-	print '<tr class="oddeven"><td>'.$langs->trans("Phone").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_PHONE,$mysoc->country_code) . '</td></tr>';
230
+    print '<tr class="oddeven"><td>'.$langs->trans("Phone").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_PHONE,$mysoc->country_code) . '</td></tr>';
231 231
 
232
-	print '<tr class="oddeven"><td>'.$langs->trans("Fax").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_FAX,$mysoc->country_code) . '</td></tr>';
232
+    print '<tr class="oddeven"><td>'.$langs->trans("Fax").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_FAX,$mysoc->country_code) . '</td></tr>';
233 233
 
234
-	print '<tr class="oddeven"><td>'.$langs->trans("Mail").'</td><td>' . dol_print_email($conf->global->MAIN_INFO_ACCOUNTANT_MAIL,0,0,0,80) . '</td></tr>';
234
+    print '<tr class="oddeven"><td>'.$langs->trans("Mail").'</td><td>' . dol_print_email($conf->global->MAIN_INFO_ACCOUNTANT_MAIL,0,0,0,80) . '</td></tr>';
235 235
 
236
-	print '<tr class="oddeven"><td>'.$langs->trans("Web").'</td><td>' . dol_print_url($conf->global->MAIN_INFO_ACCOUNTANT_WEB,'_blank',80) . '</td></tr>';
236
+    print '<tr class="oddeven"><td>'.$langs->trans("Web").'</td><td>' . dol_print_url($conf->global->MAIN_INFO_ACCOUNTANT_WEB,'_blank',80) . '</td></tr>';
237 237
 
238
-	print '<tr class="oddeven"><td>'.$langs->trans("AccountantFileNumber").'</td><td>' . $conf->global->MAIN_INFO_ACCOUNTANT_CODE . '</td></tr>';
238
+    print '<tr class="oddeven"><td>'.$langs->trans("AccountantFileNumber").'</td><td>' . $conf->global->MAIN_INFO_ACCOUNTANT_CODE . '</td></tr>';
239 239
 
240
-	print '<tr class="oddeven"><td class="tdtop">'.$langs->trans("Note").'</td><td>' . (! empty($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) ? nl2br($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) : '') . '</td></tr>';
240
+    print '<tr class="oddeven"><td class="tdtop">'.$langs->trans("Note").'</td><td>' . (! empty($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) ? nl2br($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) : '') . '</td></tr>';
241 241
 
242
-	print '</table>';
243
-	print "</div>";
242
+    print '</table>';
243
+    print "</div>";
244 244
 
245
-	print '</form>';
245
+    print '</form>';
246 246
 
247
-	// Actions buttons
248
-	print '<div class="tabsAction">';
249
-	// print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a></div>';
247
+    // Actions buttons
248
+    print '<div class="tabsAction">';
249
+    // print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a></div>';
250 250
     print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=admin&method=accountant&action=edit">' . $langs->trans("Modify") . '</a></div>';
251 251
     print '</div>';
252 252
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/menus/standard/empty.php 1 patch
Braces   +70 added lines, -49 removed lines patch added patch discarded remove patch
@@ -83,8 +83,9 @@  discard block
 block discarded – undo
83 83
         }
84 84
 
85 85
         if ($mode == 'top') {
86
-            if (empty($noout))
87
-                print_start_menu_array_empty();
86
+            if (empty($noout)) {
87
+                            print_start_menu_array_empty();
88
+            }
88 89
 
89 90
             $usemenuhider = (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER));
90 91
 
@@ -110,22 +111,28 @@  discard block
 block discarded – undo
110 111
 
111 112
             // Output menu entries
112 113
             foreach ($this->menu->liste as $menkey => $menuval) {
113
-                if (empty($noout))
114
-                    print_start_menu_entry_empty($menuval['idsel'], $menuval['classname'], $menuval['enabled']);
115
-                if (empty($noout))
116
-                    print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ? DOL_URL_ROOT : '') . $menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget));
117
-                if (empty($noout))
118
-                    print_end_menu_entry_empty($menuval['enabled']);
114
+                if (empty($noout)) {
115
+                                    print_start_menu_entry_empty($menuval['idsel'], $menuval['classname'], $menuval['enabled']);
116
+                }
117
+                if (empty($noout)) {
118
+                                    print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ? DOL_URL_ROOT : '') . $menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget));
119
+                }
120
+                if (empty($noout)) {
121
+                                    print_end_menu_entry_empty($menuval['enabled']);
122
+                }
119 123
             }
120 124
 
121 125
             $showmode = 1;
122
-            if (empty($noout))
123
-                print_start_menu_entry_empty('', 'class="tmenuend"', $showmode);
124
-            if (empty($noout))
125
-                print_end_menu_entry_empty($showmode);
126
+            if (empty($noout)) {
127
+                            print_start_menu_entry_empty('', 'class="tmenuend"', $showmode);
128
+            }
129
+            if (empty($noout)) {
130
+                            print_end_menu_entry_empty($showmode);
131
+            }
126 132
 
127
-            if (empty($noout))
128
-                print_end_menu_array_empty();
133
+            if (empty($noout)) {
134
+                            print_end_menu_array_empty();
135
+            }
129 136
 
130 137
             if ($mode == 'jmobile') {
131 138
                 $this->topmenu = clone $this->menu;
@@ -161,8 +168,9 @@  discard block
 block discarded – undo
161 168
                     print '<a class="alilevel0" href="#">';
162 169
 
163 170
                     // Add font-awesome
164
-                    if ($val['level'] == 0 && $val['mainmenu'] == 'home')
165
-                        print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
171
+                    if ($val['level'] == 0 && $val['mainmenu'] == 'home') {
172
+                                            print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
173
+                    }
166 174
 
167 175
                     print $val['titre'];
168 176
                     print '</a>' . "\n";
@@ -205,12 +213,14 @@  discard block
 block discarded – undo
205 213
                         print str_pad('', 1) . '<li class="lilevel1 ui-btn-icon-right ui-btn">';  // ui-btn to highlight on clic
206 214
                         print '<a href="' . $relurl . '">';
207 215
                         if ($langs->trans(ucfirst($val['mainmenu']) . "Dashboard") == ucfirst($val['mainmenu']) . "Dashboard") {  // No translation
208
-                            if (in_array($val['mainmenu'], array('cashdesk', 'websites')))
209
-                                print $langs->trans("Access");
210
-                            else
211
-                                print $langs->trans("Dashboard");
212
-                        } else
213
-                            print $langs->trans(ucfirst($val['mainmenu']) . "Dashboard");
216
+                            if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) {
217
+                                                            print $langs->trans("Access");
218
+                            } else {
219
+                                                            print $langs->trans("Dashboard");
220
+                            }
221
+                        } else {
222
+                                                    print $langs->trans(ucfirst($val['mainmenu']) . "Dashboard");
223
+                        }
214 224
                         print '</a>';
215 225
                         print '</li>' . "\n";
216 226
                     }
@@ -228,15 +238,17 @@  discard block
 block discarded – undo
228 238
                     $lastlevel2 = array();
229 239
                     foreach ($submenu->liste as $key2 => $val2) {  // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
230 240
                         $showmenu = true;
231
-                        if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled']))
232
-                            $showmenu = false;
241
+                        if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) {
242
+                                                    $showmenu = false;
243
+                        }
233 244
 
234 245
                         // If at least one parent is not enabled, we do not show any menu of all children
235 246
                         if ($val2['level'] > 0) {
236 247
                             $levelcursor = $val2['level'] - 1;
237 248
                             while ($levelcursor >= 0) {
238
-                                if ($lastlevel2[$levelcursor] != 'enabled')
239
-                                    $showmenu = false;
249
+                                if ($lastlevel2[$levelcursor] != 'enabled') {
250
+                                                                    $showmenu = false;
251
+                                }
240 252
                                 $levelcursor--;
241 253
                             }
242 254
                         }
@@ -249,8 +261,9 @@  discard block
 block discarded – undo
249 261
                             $relurl2 = dol_buildpath($val2['url'], 1);
250 262
                             $canonurl2 = preg_replace('/\?.*$/', '', $val2['url']);
251 263
                             //var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
252
-                            if (in_array($canonurl2, array('/admin/index.php', '/admin/tools/index.php', '/core/tools.php')))
253
-                                $relurl2 = '';
264
+                            if (in_array($canonurl2, array('/admin/index.php', '/admin/tools/index.php', '/core/tools.php'))) {
265
+                                                            $relurl2 = '';
266
+                            }
254 267
 
255 268
                             $disabled = '';
256 269
                             if (!$val2['enabled']) {
@@ -259,8 +272,10 @@  discard block
 block discarded – undo
259 272
 
260 273
                             print str_pad('', $val2['level'] + 1);
261 274
                             print '<li class="lilevel' . ($val2['level'] + 1);
262
-                            if ($val2['level'] == 0)
263
-                                print ' ui-btn-icon-right ui-btn';  // ui-btn to highlight on clic
275
+                            if ($val2['level'] == 0) {
276
+                                                            print ' ui-btn-icon-right ui-btn';
277
+                            }
278
+                            // ui-btn to highlight on clic
264 279
                             print $disabled . '">';  // ui-btn to highlight on clic
265 280
                             if ($relurl2) {
266 281
                                 if ($val2['enabled']) { // Allowed
@@ -283,10 +298,12 @@  discard block
 block discarded – undo
283 298
                             //var_dump($lastlevel2);
284 299
                             print $val2['titre'];
285 300
                             if ($relurl2) {
286
-                                if ($val2['enabled']) // Allowed
287
-                                    print '</a>';
288
-                                else
301
+                                if ($val2['enabled']) {
302
+                                    // Allowed
289 303
                                     print '</a>';
304
+                                } else {
305
+                                                                    print '</a>';
306
+                                }
290 307
                             }
291 308
                             print '</li>' . "\n";
292 309
                         }
@@ -361,8 +378,9 @@  discard block
 block discarded – undo
361 378
                         $blockvmenuopened = true;
362 379
                         $lastopened = true;
363 380
                         for ($j = ($i + 1); $j < $num; $j++) {
364
-                            if (empty($menu_array[$j]['level']))
365
-                                $lastopened = false;
381
+                            if (empty($menu_array[$j]['level'])) {
382
+                                                            $lastopened = false;
383
+                            }
366 384
                         }
367 385
                         $alt = 0;   // For menu manager "empty", we force to not have blockvmenufirst defined
368 386
                         $lastopened = 1; // For menu manager "empty", we force to not have blockvmenulast defined
@@ -393,29 +411,32 @@  discard block
 block discarded – undo
393 411
 
394 412
                     if ($this->menu->liste[$i]['level'] > 0) {
395 413
                         $cssmenu = '';
396
-                        if ($this->menu->liste[$i]['url'])
397
-                            $cssmenu = ' menu_contenu' . dol_string_nospecial(preg_replace('/\.php.*$/', '', $this->menu->liste[$i]['url']));
414
+                        if ($this->menu->liste[$i]['url']) {
415
+                                                    $cssmenu = ' menu_contenu' . dol_string_nospecial(preg_replace('/\.php.*$/', '', $this->menu->liste[$i]['url']));
416
+                        }
398 417
 
399 418
                         print '<div class="menu_contenu' . $cssmenu . '">';
400 419
 
401 420
                         if ($this->menu->liste[$i]['enabled']) {
402 421
                             print $tabstring;
403
-                            if ($this->menu->liste[$i]['url'])
404
-                                print '<a class="vsmenu" href="' . dol_buildpath($this->menu->liste[$i]['url'], 1) . '"' . ($this->menu->liste[$i]['target'] ? ' target="' . $this->menu->liste[$i]['target'] . '"' : '') . '>';
405
-                            else
406
-                                print '<span class="vsmenu">';
407
-                            if ($this->menu->liste[$i]['url'])
408
-                                print $this->menu->liste[$i]['titre'] . '</a>';
409
-                            else
410
-                                print '</span>';
411
-                        }
412
-                        else {
422
+                            if ($this->menu->liste[$i]['url']) {
423
+                                                            print '<a class="vsmenu" href="' . dol_buildpath($this->menu->liste[$i]['url'], 1) . '"' . ($this->menu->liste[$i]['target'] ? ' target="' . $this->menu->liste[$i]['target'] . '"' : '') . '>';
424
+                            } else {
425
+                                                            print '<span class="vsmenu">';
426
+                            }
427
+                            if ($this->menu->liste[$i]['url']) {
428
+                                                            print $this->menu->liste[$i]['titre'] . '</a>';
429
+                            } else {
430
+                                                            print '</span>';
431
+                            }
432
+                        } else {
413 433
                             print $tabstring . '<font class="vsmenudisabled vsmenudisabledmargin">' . $this->menu->liste[$i]['titre'] . '</font>';
414 434
                         }
415 435
 
416 436
                         // If title is not pure text and contains a table, no carriage return added
417
-                        if (!strstr($this->menu->liste[$i]['titre'], '<table'))
418
-                            print '<br>';
437
+                        if (!strstr($this->menu->liste[$i]['titre'], '<table')) {
438
+                                                    print '<br>';
439
+                        }
419 440
                         print '</div>' . "\n";
420 441
                     }
421 442
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/admin.lib.php 1 patch
Braces   +237 added lines, -169 removed lines patch added patch discarded remove patch
@@ -35,12 +35,15 @@  discard block
 block discarded – undo
35 35
 function versiontostring($versionarray)
36 36
 {
37 37
     $string = '?';
38
-    if (isset($versionarray[0]))
39
-        $string = $versionarray[0];
40
-    if (isset($versionarray[1]))
41
-        $string .= '.' . $versionarray[1];
42
-    if (isset($versionarray[2]))
43
-        $string .= '.' . $versionarray[2];
38
+    if (isset($versionarray[0])) {
39
+            $string = $versionarray[0];
40
+    }
41
+    if (isset($versionarray[1])) {
42
+            $string .= '.' . $versionarray[1];
43
+    }
44
+    if (isset($versionarray[2])) {
45
+            $string .= '.' . $versionarray[2];
46
+    }
44 47
     return $string;
45 48
 }
46 49
 
@@ -68,26 +71,36 @@  discard block
 block discarded – undo
68 71
     while ($level < $maxcount) {
69 72
         $operande1 = isset($versionarray1[$level]) ? $versionarray1[$level] : 0;
70 73
         $operande2 = isset($versionarray2[$level]) ? $versionarray2[$level] : 0;
71
-        if (preg_match('/alpha|dev/i', $operande1))
72
-            $operande1 = -5;
73
-        if (preg_match('/alpha|dev/i', $operande2))
74
-            $operande2 = -5;
75
-        if (preg_match('/beta$/i', $operande1))
76
-            $operande1 = -4;
77
-        if (preg_match('/beta$/i', $operande2))
78
-            $operande2 = -4;
79
-        if (preg_match('/beta([0-9])+/i', $operande1))
80
-            $operande1 = -3;
81
-        if (preg_match('/beta([0-9])+/i', $operande2))
82
-            $operande2 = -3;
83
-        if (preg_match('/rc$/i', $operande1))
84
-            $operande1 = -2;
85
-        if (preg_match('/rc$/i', $operande2))
86
-            $operande2 = -2;
87
-        if (preg_match('/rc([0-9])+/i', $operande1))
88
-            $operande1 = -1;
89
-        if (preg_match('/rc([0-9])+/i', $operande2))
90
-            $operande2 = -1;
74
+        if (preg_match('/alpha|dev/i', $operande1)) {
75
+                    $operande1 = -5;
76
+        }
77
+        if (preg_match('/alpha|dev/i', $operande2)) {
78
+                    $operande2 = -5;
79
+        }
80
+        if (preg_match('/beta$/i', $operande1)) {
81
+                    $operande1 = -4;
82
+        }
83
+        if (preg_match('/beta$/i', $operande2)) {
84
+                    $operande2 = -4;
85
+        }
86
+        if (preg_match('/beta([0-9])+/i', $operande1)) {
87
+                    $operande1 = -3;
88
+        }
89
+        if (preg_match('/beta([0-9])+/i', $operande2)) {
90
+                    $operande2 = -3;
91
+        }
92
+        if (preg_match('/rc$/i', $operande1)) {
93
+                    $operande1 = -2;
94
+        }
95
+        if (preg_match('/rc$/i', $operande2)) {
96
+                    $operande2 = -2;
97
+        }
98
+        if (preg_match('/rc([0-9])+/i', $operande1)) {
99
+                    $operande1 = -1;
100
+        }
101
+        if (preg_match('/rc([0-9])+/i', $operande2)) {
102
+                    $operande2 = -1;
103
+        }
91 104
         $level++;
92 105
         //print 'level '.$level.' '.$operande1.'-'.$operande2.'<br>';
93 106
         if ($operande1 < $operande2) {
@@ -167,10 +180,11 @@  discard block
 block discarded – undo
167 180
     if ($fp) {
168 181
         while (!feof($fp)) {
169 182
             // Warning fgets with second parameter that is null or 0 hang.
170
-            if ($linelengthlimit > 0)
171
-                $buf = fgets($fp, $linelengthlimit);
172
-            else
173
-                $buf = fgets($fp);
183
+            if ($linelengthlimit > 0) {
184
+                            $buf = fgets($fp, $linelengthlimit);
185
+            } else {
186
+                            $buf = fgets($fp);
187
+            }
174 188
 
175 189
             // Test if request must be ran only for particular database or version (if yes, we must remove the -- comment)
176 190
             if (preg_match('/^--\sV(MYSQL|PGSQL)([^\s]*)/i', $buf, $reg)) {
@@ -178,8 +192,9 @@  discard block
 block discarded – undo
178 192
 
179 193
                 // restrict on database type
180 194
                 if (!empty($reg[1])) {
181
-                    if (!preg_match('/' . preg_quote($reg[1]) . '/i', $db->type))
182
-                        $qualified = 0;
195
+                    if (!preg_match('/' . preg_quote($reg[1]) . '/i', $db->type)) {
196
+                                            $qualified = 0;
197
+                    }
183 198
                 }
184 199
 
185 200
                 // restrict on version
@@ -196,8 +211,9 @@  discard block
 block discarded – undo
196 211
                             $dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation));
197 212
                             //var_dump($reg[2]);
198 213
                             //var_dump($dbcollation);
199
-                            if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation))
200
-                                $qualified = 0;
214
+                            if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) {
215
+                                                            $qualified = 0;
216
+                            }
201 217
                             //var_dump($qualified);
202 218
                         }
203 219
                     }
@@ -212,8 +228,10 @@  discard block
 block discarded – undo
212 228
 
213 229
             // Add line buf to buffer if not a comment
214 230
             if ($nocommentremoval || !preg_match('/^\s*--/', $buf)) {
215
-                if (empty($nocommentremoval))
216
-                    $buf = preg_replace('/([,;ERLT\)])\s*--.*$/i', '\1', $buf); //remove comment from a line that not start with -- before add it to the buffer
231
+                if (empty($nocommentremoval)) {
232
+                                    $buf = preg_replace('/([,;ERLT\)])\s*--.*$/i', '\1', $buf);
233
+                }
234
+                //remove comment from a line that not start with -- before add it to the buffer
217 235
                 $buffer .= trim($buf);
218 236
             }
219 237
 
@@ -221,18 +239,19 @@  discard block
 block discarded – undo
221 239
 
222 240
             if (preg_match('/;/', $buffer)) { // If string contains ';', it's end of a request string, we save it in arraysql.
223 241
                 // Found new request
224
-                if ($buffer)
225
-                    $arraysql[$i] = $buffer;
242
+                if ($buffer) {
243
+                                    $arraysql[$i] = $buffer;
244
+                }
226 245
                 $i++;
227 246
                 $buffer = '';
228 247
             }
229 248
         }
230 249
 
231
-        if ($buffer)
232
-            $arraysql[$i] = $buffer;
250
+        if ($buffer) {
251
+                    $arraysql[$i] = $buffer;
252
+        }
233 253
         fclose($fp);
234
-    }
235
-    else {
254
+    } else {
236 255
         dol_syslog("Admin.lib::run_sql failed to open file " . $sqlfile, LOG_ERR);
237 256
     }
238 257
 
@@ -251,16 +270,19 @@  discard block
 block discarded – undo
251 270
                 if ($resql) {
252 271
                     $obj = $db->fetch_object($resql);
253 272
                     $listofmaxrowid[$table] = $obj->max;
254
-                    if (empty($listofmaxrowid[$table]))
255
-                        $listofmaxrowid[$table] = 0;
256
-                }
257
-                else {
258
-                    if (!$silent)
259
-                        print '<tr><td valign="top" colspan="2">';
260
-                    if (!$silent)
261
-                        print '<div class="error">' . $langs->trans("Failed to get max rowid for " . $table) . "</div></td>";
262
-                    if (!$silent)
263
-                        print '</tr>';
273
+                    if (empty($listofmaxrowid[$table])) {
274
+                                            $listofmaxrowid[$table] = 0;
275
+                    }
276
+                } else {
277
+                    if (!$silent) {
278
+                                            print '<tr><td valign="top" colspan="2">';
279
+                    }
280
+                    if (!$silent) {
281
+                                            print '<div class="error">' . $langs->trans("Failed to get max rowid for " . $table) . "</div></td>";
282
+                    }
283
+                    if (!$silent) {
284
+                                            print '</tr>';
285
+                    }
264 286
                     $error++;
265 287
                     break;
266 288
                 }
@@ -296,14 +318,16 @@  discard block
 block discarded – undo
296 318
                 $sql = preg_replace('/llx_/i', MAIN_DB_PREFIX, $sql);
297 319
             }
298 320
 
299
-            if (!empty($handler))
300
-                $sql = preg_replace('/__HANDLER__/i', "'" . $handler . "'", $sql);
321
+            if (!empty($handler)) {
322
+                            $sql = preg_replace('/__HANDLER__/i', "'" . $handler . "'", $sql);
323
+            }
301 324
 
302 325
             $newsql = preg_replace('/__ENTITY__/i', (!empty($entity) ? $entity : $conf->entity), $sql);
303 326
 
304 327
             // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes)
305
-            if (!$silent)
306
-                print '<tr><td class="tdtop">' . $langs->trans("Request") . ' ' . ($i + 1) . " sql='" . dol_htmlentities($newsql, ENT_NOQUOTES) . "'</td></tr>\n";
328
+            if (!$silent) {
329
+                            print '<tr><td class="tdtop">' . $langs->trans("Request") . ' ' . ($i + 1) . " sql='" . dol_htmlentities($newsql, ENT_NOQUOTES) . "'</td></tr>\n";
330
+            }
307 331
             dol_syslog('Admin.lib::run_sql Request ' . ($i + 1), LOG_DEBUG);
308 332
             $sqlmodified = 0;
309 333
 
@@ -335,12 +359,15 @@  discard block
 block discarded – undo
335 359
             while (preg_match('/__([0-9]+)__/', $newsql, $reg)) {
336 360
                 $cursor = $reg[1];
337 361
                 if (empty($listofinsertedrowid[$cursor])) {
338
-                    if (!$silent)
339
-                        print '<tr><td valign="top" colspan="2">';
340
-                    if (!$silent)
341
-                        print '<div class="error">' . $langs->trans("FileIsNotCorrect") . "</div></td>";
342
-                    if (!$silent)
343
-                        print '</tr>';
362
+                    if (!$silent) {
363
+                                            print '<tr><td valign="top" colspan="2">';
364
+                    }
365
+                    if (!$silent) {
366
+                                            print '<div class="error">' . $langs->trans("FileIsNotCorrect") . "</div></td>";
367
+                    }
368
+                    if (!$silent) {
369
+                                            print '</tr>';
370
+                    }
344 371
                     $error++;
345 372
                     break;
346 373
                 }
@@ -350,13 +377,15 @@  discard block
 block discarded – undo
350 377
                 $sqlmodified++;
351 378
             }
352 379
 
353
-            if ($sqlmodified)
354
-                dol_syslog('Admin.lib::run_sql New Request ' . ($i + 1), LOG_DEBUG);
380
+            if ($sqlmodified) {
381
+                            dol_syslog('Admin.lib::run_sql New Request ' . ($i + 1), LOG_DEBUG);
382
+            }
355 383
 
356 384
             $result = $db->query($newsql, $usesavepoint);
357 385
             if ($result) {
358
-                if (!$silent)
359
-                    print '<!-- Result = OK -->' . "\n";
386
+                if (!$silent) {
387
+                                    print '<!-- Result = OK -->' . "\n";
388
+                }
360 389
 
361 390
                 if (preg_replace('/insert into ([^\s]+)/i', $newsql, $reg)) {
362 391
                     $cursorinsert++;
@@ -370,8 +399,9 @@  discard block
 block discarded – undo
370 399
                 // 	          print '<td align="right">OK</td>';
371 400
             } else {
372 401
                 $errno = $db->errno();
373
-                if (!$silent)
374
-                    print '<!-- Result = ' . $errno . ' -->' . "\n";
402
+                if (!$silent) {
403
+                                    print '<!-- Result = ' . $errno . ' -->' . "\n";
404
+                }
375 405
 
376 406
                 // Define list of errors we accept (array $okerrors)
377 407
                 $okerrors = array(// By default
@@ -389,39 +419,47 @@  discard block
 block discarded – undo
389 419
                     'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
390 420
                     'DB_ERROR_22P02'
391 421
                 );
392
-                if ($okerror == 'none')
393
-                    $okerrors = array();
422
+                if ($okerror == 'none') {
423
+                                    $okerrors = array();
424
+                }
394 425
 
395 426
                 // Is it an error we accept
396 427
                 if (!in_array($errno, $okerrors)) {
397
-                    if (!$silent)
398
-                        print '<tr><td valign="top" colspan="2">';
399
-                    if (!$silent)
400
-                        print '<div class="error">' . $langs->trans("Error") . " " . $db->errno() . ": " . $newsql . "<br>" . $db->error() . "</div></td>";
401
-                    if (!$silent)
402
-                        print '</tr>' . "\n";
428
+                    if (!$silent) {
429
+                                            print '<tr><td valign="top" colspan="2">';
430
+                    }
431
+                    if (!$silent) {
432
+                                            print '<div class="error">' . $langs->trans("Error") . " " . $db->errno() . ": " . $newsql . "<br>" . $db->error() . "</div></td>";
433
+                    }
434
+                    if (!$silent) {
435
+                                            print '</tr>' . "\n";
436
+                    }
403 437
                     dol_syslog('Admin.lib::run_sql Request ' . ($i + 1) . " Error " . $db->errno() . " " . $newsql . "<br>" . $db->error(), LOG_ERR);
404 438
                     $error++;
405 439
                 }
406 440
             }
407 441
 
408
-            if (!$silent)
409
-                print '</tr>' . "\n";
442
+            if (!$silent) {
443
+                            print '</tr>' . "\n";
444
+            }
410 445
         }
411 446
     }
412 447
 
413 448
     if ($error == 0) {
414
-        if (!$silent)
415
-            print '<tr><td>' . $langs->trans("ProcessMigrateScript") . '</td>';
416
-        if (!$silent)
417
-            print '<td align="right">' . $langs->trans("OK") . '</td></tr>' . "\n";
449
+        if (!$silent) {
450
+                    print '<tr><td>' . $langs->trans("ProcessMigrateScript") . '</td>';
451
+        }
452
+        if (!$silent) {
453
+                    print '<td align="right">' . $langs->trans("OK") . '</td></tr>' . "\n";
454
+        }
418 455
         $ok = 1;
419
-    }
420
-    else {
421
-        if (!$silent)
422
-            print '<tr><td>' . $langs->trans("ProcessMigrateScript") . '</td>';
423
-        if (!$silent)
424
-            print '<td align="right"><font class="error">' . $langs->trans("KO") . '</font></td></tr>' . "\n";
456
+    } else {
457
+        if (!$silent) {
458
+                    print '<tr><td>' . $langs->trans("ProcessMigrateScript") . '</td>';
459
+        }
460
+        if (!$silent) {
461
+                    print '<td align="right"><font class="error">' . $langs->trans("KO") . '</font></td></tr>' . "\n";
462
+        }
425 463
         $ok = 0;
426 464
     }
427 465
 
@@ -449,11 +487,13 @@  discard block
 block discarded – undo
449 487
 
450 488
     $sql = "DELETE FROM " . MAIN_DB_PREFIX . "const";
451 489
     $sql .= " WHERE (" . $db->decrypt('name') . " = '" . $db->escape($name) . "'";
452
-    if (is_numeric($name))
453
-        $sql .= " OR rowid = '" . $db->escape($name) . "'";
490
+    if (is_numeric($name)) {
491
+            $sql .= " OR rowid = '" . $db->escape($name) . "'";
492
+    }
454 493
     $sql .= ")";
455
-    if ($entity >= 0)
456
-        $sql .= " AND entity = " . $entity;
494
+    if ($entity >= 0) {
495
+            $sql .= " AND entity = " . $entity;
496
+    }
457 497
 
458 498
     dol_syslog("admin.lib::dolibarr_del_const", LOG_DEBUG);
459 499
     $resql = $db->query($sql);
@@ -490,8 +530,9 @@  discard block
 block discarded – undo
490 530
     $resql = $db->query($sql);
491 531
     if ($resql) {
492 532
         $obj = $db->fetch_object($resql);
493
-        if ($obj)
494
-            $value = $obj->value;
533
+        if ($obj) {
534
+                    $value = $obj->value;
535
+        }
495 536
     }
496 537
     return $value;
497 538
 }
@@ -529,8 +570,9 @@  discard block
 block discarded – undo
529 570
 
530 571
     $sql = "DELETE FROM " . MAIN_DB_PREFIX . "const";
531 572
     $sql .= " WHERE name = " . $db->encrypt($name, 1);
532
-    if ($entity >= 0)
533
-        $sql .= " AND entity = " . $entity;
573
+    if ($entity >= 0) {
574
+            $sql .= " AND entity = " . $entity;
575
+    }
534 576
 
535 577
     dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG);
536 578
     $resql = $db->query($sql);
@@ -849,8 +891,9 @@  discard block
 block discarded – undo
849 891
                     // We remove session if it's not ourself
850 892
                     if ($idsess != $mysessionid) {
851 893
                         $res = @unlink($fullpath);
852
-                        if (!$res)
853
-                            $error++;
894
+                        if (!$res) {
895
+                                                    $error++;
896
+                        }
854 897
                     }
855 898
                 }
856 899
             }
@@ -858,11 +901,12 @@  discard block
 block discarded – undo
858 901
     }
859 902
     @closedir($dh);
860 903
 
861
-    if (!$error)
862
-        return 1;
863
-    else
864
-        return -$error;
865
-}
904
+    if (!$error) {
905
+            return 1;
906
+    } else {
907
+            return -$error;
908
+    }
909
+    }
866 910
 
867 911
 /**
868 912
  *  Enable a module
@@ -893,8 +937,9 @@  discard block
 block discarded – undo
893 937
     foreach ($modulesdir as $dir) {
894 938
         if (file_exists($dir . $modFile)) {
895 939
             $found = @include_once $dir . $modFile;
896
-            if ($found)
897
-                break;
940
+            if ($found) {
941
+                            break;
942
+            }
898 943
         }
899 944
     }
900 945
 
@@ -1003,8 +1048,9 @@  discard block
 block discarded – undo
1003 1048
     global $db, $modules, $conf;
1004 1049
 
1005 1050
     // Check parameters
1006
-    if (empty($value))
1007
-        return 'ErrorBadParameter';
1051
+    if (empty($value)) {
1052
+            return 'ErrorBadParameter';
1053
+    }
1008 1054
 
1009 1055
     $ret = '';
1010 1056
     $modName = $value;
@@ -1018,18 +1064,19 @@  discard block
 block discarded – undo
1018 1064
     foreach ($modulesdir as $dir) {
1019 1065
         if (file_exists($dir . $modFile)) {
1020 1066
             $found = @include_once $dir . $modFile;
1021
-            if ($found)
1022
-                break;
1067
+            if ($found) {
1068
+                            break;
1069
+            }
1023 1070
         }
1024 1071
     }
1025 1072
 
1026 1073
     if ($found) {
1027 1074
         $objMod = new $modName($db);
1028 1075
         $result = $objMod->remove();
1029
-        if ($result <= 0)
1030
-            $ret = $objMod->error;
1031
-    }
1032
-    else {
1076
+        if ($result <= 0) {
1077
+                    $ret = $objMod->error;
1078
+        }
1079
+    } else {
1033 1080
         //print $dir.$modFile;
1034 1081
         // TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded
1035 1082
         include_once DOL_BASE_PATH . '/core/modules/DolibarrModules.class.php';
@@ -1105,13 +1152,16 @@  discard block
 block discarded – undo
1105 1152
 
1106 1153
                         // We discard modules according to features level (PS: if module is activated we always show it)
1107 1154
                         $const_name = 'MAIN_MODULE_' . strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
1108
-                        if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name)
1109
-                            $modulequalified = 0;
1110
-                        if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name)
1111
-                            $modulequalified = 0;
1155
+                        if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) {
1156
+                                                    $modulequalified = 0;
1157
+                        }
1158
+                        if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) {
1159
+                                                    $modulequalified = 0;
1160
+                        }
1112 1161
                         //If module is not activated disqualified
1113
-                        if (empty($conf->global->$const_name))
1114
-                            $modulequalified = 0;
1162
+                        if (empty($conf->global->$const_name)) {
1163
+                                                    $modulequalified = 0;
1164
+                        }
1115 1165
 
1116 1166
                         if ($modulequalified) {
1117 1167
                             // Load languages files of module
@@ -1122,8 +1172,10 @@  discard block
 block discarded – undo
1122 1172
                             }
1123 1173
 
1124 1174
                             // Complete the arrays &$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond
1125
-                            if (empty($objMod->dictionaries) && !empty($objMod->dictionnaries))
1126
-                                $objMod->dictionaries = $objMod->dictionnaries;  // For backward compatibility
1175
+                            if (empty($objMod->dictionaries) && !empty($objMod->dictionnaries)) {
1176
+                                                            $objMod->dictionaries = $objMod->dictionnaries;
1177
+                            }
1178
+                            // For backward compatibility
1127 1179
 
1128 1180
                             if (!empty($objMod->dictionaries)) {
1129 1181
                                 //var_dump($objMod->dictionaries['tabname']);
@@ -1165,14 +1217,16 @@  discard block
 block discarded – undo
1165 1217
                                     $nbtabcond++;
1166 1218
                                     $tabcond[] = $val;
1167 1219
                                 }
1168
-                                if (!empty($objMod->dictionaries['tabhelp']))
1169
-                                    foreach ($objMod->dictionaries['tabhelp'] as $val) {
1220
+                                if (!empty($objMod->dictionaries['tabhelp'])) {
1221
+                                                                    foreach ($objMod->dictionaries['tabhelp'] as $val) {
1170 1222
                                         $nbtabhelp++;
1223
+                                }
1171 1224
                                         $tabhelp[] = $val;
1172 1225
                                     }
1173
-                                if (!empty($objMod->dictionaries['tabfieldcheck']))
1174
-                                    foreach ($objMod->dictionaries['tabfieldcheck'] as $val) {
1226
+                                if (!empty($objMod->dictionaries['tabfieldcheck'])) {
1227
+                                                                    foreach ($objMod->dictionaries['tabfieldcheck'] as $val) {
1175 1228
                                         $nbtabfieldcheck++;
1229
+                                }
1176 1230
                                         $tabfieldcheck[] = $val;
1177 1231
                                     }
1178 1232
 
@@ -1186,14 +1240,14 @@  discard block
 block discarded – undo
1186 1240
 
1187 1241
                             $j++;
1188 1242
                             $i++;
1189
-                        } else
1190
-                            dol_syslog("Module " . get_class($objMod) . " not qualified");
1243
+                        } else {
1244
+                                                    dol_syslog("Module " . get_class($objMod) . " not qualified");
1245
+                        }
1191 1246
                     }
1192 1247
                 }
1193 1248
             }
1194 1249
             closedir($handle);
1195
-        }
1196
-        else {
1250
+        } else {
1197 1251
             dol_syslog("htdocs/admin/modules.php: Failed to open directory " . $dir . ". See permission and open_basedir option.", LOG_WARNING);
1198 1252
         }
1199 1253
     }
@@ -1231,12 +1285,16 @@  discard block
 block discarded – undo
1231 1285
                         // We discard modules according to features level (PS: if module is activated we always show it)
1232 1286
                         $const_name = 'MAIN_MODULE_' . strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
1233 1287
 
1234
-                        if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
1235
-                            $modulequalified = 0;
1236
-                        if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
1237
-                            $modulequalified = 0;
1238
-                        if (!empty($conf->global->$const_name))
1239
-                            $modulequalified = 0; // already activated
1288
+                        if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
1289
+                                                    $modulequalified = 0;
1290
+                        }
1291
+                        if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
1292
+                                                    $modulequalified = 0;
1293
+                        }
1294
+                        if (!empty($conf->global->$const_name)) {
1295
+                                                    $modulequalified = 0;
1296
+                        }
1297
+                        // already activated
1240 1298
 
1241 1299
                         if ($modulequalified) {
1242 1300
                             // Load languages files of module
@@ -1245,14 +1303,14 @@  discard block
 block discarded – undo
1245 1303
 
1246 1304
                                 setEventMessages($objMod->automatic_activation[$country_code], null, 'warnings');
1247 1305
                             }
1248
-                        } else
1249
-                            dol_syslog("Module " . get_class($objMod) . " not qualified");
1306
+                        } else {
1307
+                                                    dol_syslog("Module " . get_class($objMod) . " not qualified");
1308
+                        }
1250 1309
                     }
1251 1310
                 }
1252 1311
             }
1253 1312
             closedir($handle);
1254
-        }
1255
-        else {
1313
+        } else {
1256 1314
             dol_syslog("htdocs/admin/modules.php: Failed to open directory " . $dir . ". See permission and open_basedir option.", LOG_WARNING);
1257 1315
         }
1258 1316
     }
@@ -1307,13 +1365,16 @@  discard block
 block discarded – undo
1307 1365
 
1308 1366
                         // We discard modules according to features level (PS: if module is activated we always show it)
1309 1367
                         $const_name = 'MAIN_MODULE_' . strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
1310
-                        if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name)
1311
-                            $modulequalified = 0;
1312
-                        if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name)
1313
-                            $modulequalified = 0;
1368
+                        if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) {
1369
+                                                    $modulequalified = 0;
1370
+                        }
1371
+                        if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) {
1372
+                                                    $modulequalified = 0;
1373
+                        }
1314 1374
                         //If module is not activated disqualified
1315
-                        if (empty($conf->global->$const_name))
1316
-                            $modulequalified = 0;
1375
+                        if (empty($conf->global->$const_name)) {
1376
+                                                    $modulequalified = 0;
1377
+                        }
1317 1378
 
1318 1379
                         if ($modulequalified) {
1319 1380
                             // Load languages files of module
@@ -1335,14 +1396,14 @@  discard block
 block discarded – undo
1335 1396
 
1336 1397
                             $j++;
1337 1398
                             $i++;
1338
-                        } else
1339
-                            dol_syslog("Module " . get_class($objMod) . " not qualified");
1399
+                        } else {
1400
+                                                    dol_syslog("Module " . get_class($objMod) . " not qualified");
1401
+                        }
1340 1402
                     }
1341 1403
                 }
1342 1404
             }
1343 1405
             closedir($handle);
1344
-        }
1345
-        else {
1406
+        } else {
1346 1407
             dol_syslog("htdocs/admin/modules.php: Failed to open directory " . $dir . ". See permission and open_basedir option.", LOG_WARNING);
1347 1408
         }
1348 1409
     }
@@ -1366,8 +1427,9 @@  discard block
 block discarded – undo
1366 1427
 
1367 1428
     $form = new Form($db);
1368 1429
 
1369
-    if (!empty($strictw3c) && $strictw3c == 1)
1370
-        print "\n" . '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
1430
+    if (!empty($strictw3c) && $strictw3c == 1) {
1431
+            print "\n" . '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
1432
+    }
1371 1433
 
1372 1434
     print '<table class="noborder" width="100%">';
1373 1435
     print '<tr class="liste_titre">';
@@ -1376,8 +1438,9 @@  discard block
 block discarded – undo
1376 1438
     $text = $langs->trans("Value");
1377 1439
     print $form->textwithpicto($text, $helptext, 1, 'help', '', 0, 2, 'idhelptext');
1378 1440
     print '</td>';
1379
-    if (empty($strictw3c))
1380
-        print '<td align="center" width="80">' . $langs->trans("Action") . '</td>';
1441
+    if (empty($strictw3c)) {
1442
+            print '<td align="center" width="80">' . $langs->trans("Action") . '</td>';
1443
+    }
1381 1444
     print "</tr>\n";
1382 1445
 
1383 1446
     $label = '';
@@ -1427,8 +1490,9 @@  discard block
 block discarded – undo
1427 1490
 
1428 1491
             // Show constant
1429 1492
             print '<td>';
1430
-            if (empty($strictw3c))
1431
-                print '<input type="hidden" name="action" value="update">';
1493
+            if (empty($strictw3c)) {
1494
+                            print '<input type="hidden" name="action" value="update">';
1495
+            }
1432 1496
             print '<input type="hidden" name="rowid' . (empty($strictw3c) ? '' : '[]') . '" value="' . $obj->rowid . '">';
1433 1497
             print '<input type="hidden" name="constname' . (empty($strictw3c) ? '' : '[]') . '" value="' . $const . '">';
1434 1498
             print '<input type="hidden" name="constnote_' . $obj->name . '" value="' . nl2br(dol_escape_htmltag($obj->note)) . '">';
@@ -1456,8 +1520,9 @@  discard block
 block discarded – undo
1456 1520
                 print 'mymailmanlist<br>';
1457 1521
                 print 'mymailmanlist1,mymailmanlist2<br>';
1458 1522
                 print 'TYPE:Type1:mymailmanlist1,TYPE:Type2:mymailmanlist2<br>';
1459
-                if ($conf->categorie->enabled)
1460
-                    print 'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2<br>';
1523
+                if ($conf->categorie->enabled) {
1524
+                                    print 'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2<br>';
1525
+                }
1461 1526
                 print '</div>';
1462 1527
                 //print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
1463 1528
             }
@@ -1504,16 +1569,16 @@  discard block
 block discarded – undo
1504 1569
                         foreach ($formmail->lines_model as $modelmail) {
1505 1570
                             //var_dump($modelmail);
1506 1571
                             $moreonlabel = '';
1507
-                            if (!empty($arrayofmessagename[$modelmail->label]))
1508
-                                $moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
1572
+                            if (!empty($arrayofmessagename[$modelmail->label])) {
1573
+                                                            $moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
1574
+                            }
1509 1575
                             $arrayofmessagename[$modelmail->label] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
1510 1576
                         }
1511 1577
                     }
1512 1578
                     //var_dump($arraydefaultmessage);
1513 1579
                     //var_dump($arrayofmessagename);
1514 1580
                     print $form->selectarray('constvalue_' . $obj->name, $arrayofmessagename, $obj->value, 'None', 1, 0, '', 0, 0, 0, '', '', 1);
1515
-                }
1516
-                else { // type = 'string' ou 'chaine'
1581
+                } else { // type = 'string' ou 'chaine'
1517 1582
                     print '<input type="text" class="flat" size="48" name="constvalue' . (empty($strictw3c) ? '' : '[]') . '" value="' . dol_escape_htmltag($obj->value) . '">';
1518 1583
                 }
1519 1584
                 print '</td>';
@@ -1525,8 +1590,9 @@  discard block
 block discarded – undo
1525 1590
                 print "</td>";
1526 1591
             }
1527 1592
             print "</tr>\n";
1528
-            if (empty($strictw3c))
1529
-                print "</form>\n";
1593
+            if (empty($strictw3c)) {
1594
+                            print "</form>\n";
1595
+            }
1530 1596
         }
1531 1597
     }
1532 1598
     print '</table>';
@@ -1556,14 +1622,16 @@  discard block
 block discarded – undo
1556 1622
             $modulename = strtolower($module->name);
1557 1623
             //print 'modulename='.$modulename;
1558 1624
             //if (empty($conf->global->$moduleconst)) continue;
1559
-            if (!in_array($modulename, $listofmodules))
1560
-                continue;
1625
+            if (!in_array($modulename, $listofmodules)) {
1626
+                            continue;
1627
+            }
1561 1628
             //var_dump($modulename.' - '.$langs->trans('Module'.$module->numero.'Name'));
1562 1629
 
1563
-            if ($i > 0)
1564
-                $text .= ', ';
1565
-            else
1566
-                $text .= ' ';
1630
+            if ($i > 0) {
1631
+                            $text .= ', ';
1632
+            } else {
1633
+                            $text .= ' ';
1634
+            }
1567 1635
             $i++;
1568 1636
             $text .= $langs->trans('Module' . $module->numero . 'Name');
1569 1637
         }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/boxes/box_task.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -69,47 +69,47 @@  discard block
 block discarded – undo
69 69
         $this->hidden = ! ($user->rights->projet->lire);
70 70
     }
71 71
 
72
-	/**
73
-	 *  Load data for box to show them later
74
-	 *
75
-	 *  @param  int     $max        Maximum number of records to load
76
-	 *  @return void
77
-	 */
78
-	function loadBox($max=5)
79
-	{
80
-		global $conf, $user, $langs, $db;
81
-
82
-		$this->max=$max;
83
-
84
-		$totalMnt = 0;
85
-		$totalnb = 0;
86
-		$totalDuree=0;
87
-		$totalplannedtot=0;
88
-		$totaldurationtot=0;
72
+    /**
73
+     *  Load data for box to show them later
74
+     *
75
+     *  @param  int     $max        Maximum number of records to load
76
+     *  @return void
77
+     */
78
+    function loadBox($max=5)
79
+    {
80
+        global $conf, $user, $langs, $db;
81
+
82
+        $this->max=$max;
83
+
84
+        $totalMnt = 0;
85
+        $totalnb = 0;
86
+        $totalDuree=0;
87
+        $totalplannedtot=0;
88
+        $totaldurationtot=0;
89 89
 		
90
-		include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php";
91
-		$taskstatic=new Task($db);
92
-
93
-
94
-		$textHead = $langs->trans("Tasks")."&nbsp;".date("Y");
95
-		$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
96
-
97
-		// list the summary of the orders
98
-		if ($user->rights->projet->lire) {
99
-			// FIXME fk_statut on a task is not be used. We use the percent. This means this box is useless.
100
-			$sql = "SELECT pt.fk_statut, count(DISTINCT pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot";
101
-			$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt";
102
-			$sql.= " WHERE pt.datec BETWEEN '".$this->db->idate(dol_get_first_day(date("Y"), 1))."' AND '".$this->db->idate(dol_get_last_day(date("Y"), 12))."'";
103
-			$sql.= " AND pt.rowid = ptt.fk_task";
104
-			$sql.= " GROUP BY pt.fk_statut ";
105
-			$sql.= " ORDER BY pt.fk_statut DESC";
106
-			$sql.= $db->plimit($max, 0);
107
-
108
-			$result = $db->query($sql);
109
-			if ($result)
110
-			{
111
-				$num = $db->num_rows($result);
112
-				$i = 0;
90
+        include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php";
91
+        $taskstatic=new Task($db);
92
+
93
+
94
+        $textHead = $langs->trans("Tasks")."&nbsp;".date("Y");
95
+        $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
96
+
97
+        // list the summary of the orders
98
+        if ($user->rights->projet->lire) {
99
+            // FIXME fk_statut on a task is not be used. We use the percent. This means this box is useless.
100
+            $sql = "SELECT pt.fk_statut, count(DISTINCT pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot";
101
+            $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt";
102
+            $sql.= " WHERE pt.datec BETWEEN '".$this->db->idate(dol_get_first_day(date("Y"), 1))."' AND '".$this->db->idate(dol_get_last_day(date("Y"), 12))."'";
103
+            $sql.= " AND pt.rowid = ptt.fk_task";
104
+            $sql.= " GROUP BY pt.fk_statut ";
105
+            $sql.= " ORDER BY pt.fk_statut DESC";
106
+            $sql.= $db->plimit($max, 0);
107
+
108
+            $result = $db->query($sql);
109
+            if ($result)
110
+            {
111
+                $num = $db->num_rows($result);
112
+                $i = 0;
113 113
                 while ($i < $num)
114 114
                 {
115 115
                     $objp = $db->fetch_object($result);
@@ -124,39 +124,39 @@  discard block
 block discarded – undo
124 124
                         //'url' => DOL_URL_ROOT."/projet/tasks/list.php?leftmenu=projects&viewstatut=".$objp->fk_statut,
125 125
                         'url' => BASE_URI . "?controller=projet/tasks&method=list&leftmenu=projects&viewstatut=" . $objp->fk_statut,
126 126
                     );
127
-					$totalnb += $objp->nb;
128
-					$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5));
129
-					$totalplannedtot += $objp->plannedtot;
130
-					$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5));
131
-					$totaldurationtot += $objp->durationtot;
132
-
133
-					$this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3));
134
-
135
-					$i++;
136
-				}
137
-			}
138
-			else dol_print_error($this->db);
139
-		}
140
-
141
-
142
-		// Add the sum at the bottom of the boxes
143
-		$this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => '', 'text' => $langs->trans("Total")."&nbsp;".$textHead);
144
-		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks"));
145
-		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5));
146
-		$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5));
147
-		$this->info_box_contents[$i][] = array('td' => '', 'text' => "");
148
-	}
149
-
150
-	/**
151
-	 *	Method to show box
152
-	 *
153
-	 *	@param	array	$head       Array with properties of box title
154
-	 *	@param  array	$contents   Array with properties of box lines
155
-	 *  @param	int		$nooutput	No print, only return string
156
-	 *	@return	string
157
-	 */
158
-	function showBox($head = null, $contents = null, $nooutput=0)
159
-	{
160
-		return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
161
-	}
127
+                    $totalnb += $objp->nb;
128
+                    $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5));
129
+                    $totalplannedtot += $objp->plannedtot;
130
+                    $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5));
131
+                    $totaldurationtot += $objp->durationtot;
132
+
133
+                    $this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3));
134
+
135
+                    $i++;
136
+                }
137
+            }
138
+            else dol_print_error($this->db);
139
+        }
140
+
141
+
142
+        // Add the sum at the bottom of the boxes
143
+        $this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => '', 'text' => $langs->trans("Total")."&nbsp;".$textHead);
144
+        $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks"));
145
+        $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5));
146
+        $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5));
147
+        $this->info_box_contents[$i][] = array('td' => '', 'text' => "");
148
+    }
149
+
150
+    /**
151
+     *	Method to show box
152
+     *
153
+     *	@param	array	$head       Array with properties of box title
154
+     *	@param  array	$contents   Array with properties of box lines
155
+     *  @param	int		$nooutput	No print, only return string
156
+     *	@return	string
157
+     */
158
+    function showBox($head = null, $contents = null, $nooutput=0)
159
+    {
160
+        return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
161
+    }
162 162
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/js/lib_head.js.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1044,8 +1044,9 @@
 block discarded – undo
1044 1044
     if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") {
1045 1045
         $thousand = $langs->transnoentitiesnoconv("SeparatorThousand");
1046 1046
     }
1047
-    if ($thousand == 'Space')
1048
-        $thousand = ' ';
1047
+    if ($thousand == 'Space') {
1048
+            $thousand = ' ';
1049
+    }
1049 1050
     print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n";    // Set var in javascript
1050 1051
 
1051 1052
     ?>
Please login to merge, or discard this patch.
dolibarr/htdocs/theme/eldy/style.css.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6000,6 +6000,6 @@
 block discarded – undo
6000 6000
 
6001 6001
 <?php
6002 6002
 if (is_object($db))
6003
- {
6003
+    {
6004 6004
     $db->close();
6005 6005
 }
Please login to merge, or discard this patch.
Braces   +54 added lines, -26 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
 if (!defined('NOCSRFCHECK')) {
35 35
     define('NOCSRFCHECK', 1);
36 36
 }
37
-if (!defined('NOTOKENRENEWAL'))
37
+if (!defined('NOTOKENRENEWAL')) {
38 38
     define('NOTOKENRENEWAL', 1);
39
+}
39 40
 if (!defined('NOLOGIN')) {
40 41
     define('NOLOGIN', 1); // File must be accessed by logon page so without login
41 42
 }
@@ -68,8 +69,9 @@  discard block
 block discarded – undo
68 69
 $fontsize = '0.86em';
69 70
 $fontsizesmaller = '0.75em';
70 71
 
71
-if (defined('THEME_ONLY_CONSTANT'))
72
+if (defined('THEME_ONLY_CONSTANT')) {
72 73
     return;
74
+}
73 75
 
74 76
 session_cache_limiter('public');
75 77
 
@@ -130,24 +132,33 @@  discard block
 block discarded – undo
130 132
 $borderwidth = 1;
131 133
 
132 134
 // Case of option always editable
133
-if (!isset($conf->global->THEME_ELDY_BACKBODY))
135
+if (!isset($conf->global->THEME_ELDY_BACKBODY)) {
134 136
     $conf->global->THEME_ELDY_BACKBODY = $colorbackbody;
135
-if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1))
137
+}
138
+if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) {
136 139
     $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
137
-if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1))
140
+}
141
+if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) {
138 142
     $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1;
139
-if (!isset($conf->global->THEME_ELDY_BACKTITLE1))
143
+}
144
+if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) {
140 145
     $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1;
141
-if (!isset($conf->global->THEME_ELDY_USE_HOVER))
146
+}
147
+if (!isset($conf->global->THEME_ELDY_USE_HOVER)) {
142 148
     $conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover;
143
-if (!isset($conf->global->THEME_ELDY_USE_CHECKED))
149
+}
150
+if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) {
144 151
     $conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked;
145
-if (!isset($conf->global->THEME_ELDY_LINEBREAK))
152
+}
153
+if (!isset($conf->global->THEME_ELDY_LINEBREAK)) {
146 154
     $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak;
147
-if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB))
155
+}
156
+if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) {
148 157
     $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab;
149
-if (!isset($conf->global->THEME_ELDY_TEXTLINK))
158
+}
159
+if (!isset($conf->global->THEME_ELDY_TEXTLINK)) {
150 160
     $conf->global->THEME_ELDY_TEXTLINK = $colortextlink;
161
+}
151 162
 
152 163
 // Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
153 164
 if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) {
@@ -191,10 +202,11 @@  discard block
 block discarded – undo
191 202
 $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1));    // Normalize value to 'x,y,z'
192 203
 $tmppart = explode(',', $colorbackhmenu1);
193 204
 $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
194
-if ($tmpval <= 460)
205
+if ($tmpval <= 460) {
195 206
     $colortextbackhmenu = 'FFFFFF';
196
-else
207
+} else {
197 208
     $colortextbackhmenu = '000000';
209
+}
198 210
 
199 211
 $colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1));    // Normalize value to 'x,y,z'
200 212
 $tmppart = explode(',', $colorbackvmenu1);
@@ -216,8 +228,9 @@  discard block
 block discarded – undo
216 228
         $colortexttitle = '000000';
217 229
         $colorshadowtitle = 'FFFFFF';
218 230
     }
219
-} else
231
+} else {
220 232
     $colorshadowtitle = '888888';
233
+}
221 234
 
222 235
 $colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1));    // Normalize value to 'x,y,z'
223 236
 $tmppart = explode(',', $colorbacktabcard1);
@@ -239,10 +252,12 @@  discard block
 block discarded – undo
239 252
 $colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2));
240 253
 $colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1));
241 254
 $colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2));
242
-if ($colorbacklinepairhover != '')
255
+if ($colorbacklinepairhover != '') {
243 256
     $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover));
244
-if ($colorbacklinepairchecked != '')
257
+}
258
+if ($colorbacklinepairchecked != '') {
245 259
     $colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked));
260
+}
246 261
 $colorbackbody = join(',', colorStringToArray($colorbackbody));
247 262
 $colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab));
248 263
 $colortexttitle = join(',', colorStringToArray($colortexttitle));
@@ -950,7 +965,10 @@  discard block
 block discarded – undo
950 965
 }
951 966
 
952 967
 .flexcontainer {
953
-<?php if (in_array($conf->browser->name, array('chrome', 'firefox'))) echo 'display: inline-flex;' . "\n"; ?>
968
+<?php if (in_array($conf->browser->name, array('chrome', 'firefox'))) {
969
+    echo 'display: inline-flex;' . "\n";
970
+}
971
+?>
954 972
 flex-flow: row wrap;
955 973
 justify-content: flex-start;
956 974
 }
@@ -1339,8 +1357,14 @@  discard block
 block discarded – undo
1339 1357
 div.fiche {
1340 1358
 margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '30' : '6')); ?>px;
1341 1359
 margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '29' : '6')); ?>px;
1342
-<?php if (!empty($dol_hide_leftmenu)) print 'margin-bottom: 12px;' . "\n"; ?>
1343
-<?php if (!empty($dol_hide_leftmenu)) print 'margin-top: 12px;' . "\n"; ?>
1360
+<?php if (!empty($dol_hide_leftmenu)) {
1361
+    print 'margin-bottom: 12px;' . "\n";
1362
+}
1363
+?>
1364
+<?php if (!empty($dol_hide_leftmenu)) {
1365
+    print 'margin-top: 12px;' . "\n";
1366
+}
1367
+?>
1344 1368
 }
1345 1369
 body.onlinepaymentbody div.fiche {	/* For online payment page */
1346 1370
 margin: 20px !important;
@@ -1428,8 +1452,9 @@  discard block
 block discarded – undo
1428 1452
 <?php
1429 1453
 if ($conf->browser->layout != 'phone') {
1430 1454
     print "padding-" . $left . ": 16px;\n";
1431
-} else
1455
+} else {
1432 1456
     print "margin-top: 10px;\n";
1457
+}
1433 1458
 
1434 1459
 ?>
1435 1460
 }
@@ -1917,10 +1942,12 @@  discard block
 block discarded – undo
1917 1942
 // Put here list of menu entries we are sure we don't want
1918 1943
         $divnotrequired = array('multicurrency', 'salaries', 'ticket', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition');
1919 1944
         foreach ($mainmenuusedarray as $val) {
1920
-            if (empty($val) || in_array($val, $divalreadydefined))
1921
-                continue;
1922
-            if (in_array($val, $divnotrequired))
1923
-                continue;
1945
+            if (empty($val) || in_array($val, $divalreadydefined)) {
1946
+                            continue;
1947
+            }
1948
+            if (in_array($val, $divnotrequired)) {
1949
+                            continue;
1950
+            }
1924 1951
             //print "XXX".$val;
1925 1952
             // Search img file in module dir
1926 1953
             $found = 0;
@@ -1936,8 +1963,9 @@  discard block
 block discarded – undo
1936 1963
             if (!$found) {
1937 1964
                 $url = dol_buildpath($path . '/theme/' . $theme . '/img/menus/generic' . $generic . "_over.png", 1);
1938 1965
                 $found = 1;
1939
-                if ($generic < 4)
1940
-                    $generic++;
1966
+                if ($generic < 4) {
1967
+                                    $generic++;
1968
+                }
1941 1969
                 print "/* A mainmenu entry was found but img file " . $val . ".png not found (check /" . $val . "/img/" . $val . ".png), so we use a generic one */\n";
1942 1970
             }
1943 1971
             if ($found) {
Please login to merge, or discard this patch.
dolibarr/htdocs/main.inc.php 1 patch
Braces   +399 added lines, -263 removed lines patch added patch discarded remove patch
@@ -213,16 +213,18 @@  discard block
 block discarded – undo
213 213
     foreach ($tmplist as $tmpkey) {
214 214
         $postkey = $tmpautoset[0] . '_' . $tmpkey;
215 215
         //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]);
216
-        if (!empty($_POST[$postkey]))
217
-            $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
216
+        if (!empty($_POST[$postkey])) {
217
+                    $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
218
+        }
218 219
     }
219 220
     $cookiename = $tmpautoset[0];
220 221
     $cookievalue = json_encode($cookiearrayvalue);
221 222
     //var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
222 223
     setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, false, true); // keep cookie 1 year and add tag httponly
223
-    if (empty($cookievalue))
224
-        unset($_COOKIE[$cookiename]);
225
-}
224
+    if (empty($cookievalue)) {
225
+            unset($_COOKIE[$cookiename]);
226
+    }
227
+    }
226 228
 
227 229
 
228 230
 // Init session. Name of session is specific to Dolibarr instance.
@@ -231,8 +233,9 @@  discard block
 block discarded – undo
231 233
 
232 234
 $sessionname = 'DOLSESSID_' . $prefix;
233 235
 $sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix;
234
-if (!empty($_COOKIE[$sessiontimeout]))
236
+if (!empty($_COOKIE[$sessiontimeout])) {
235 237
     ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
238
+}
236 239
 session_name($sessionname);
237 240
 session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
238 241
 // This create lock, released when session_write_close() or end of page.
@@ -263,11 +266,13 @@  discard block
 block discarded – undo
263 266
     $conf->browser->layout = $tmp['layout'];     // 'classic', 'phone', 'tablet'
264 267
     //var_dump($conf->browser);
265 268
 
266
-    if ($conf->browser->layout == 'phone')
267
-        $conf->dol_no_mouse_hover = 1;
268
-    if ($conf->browser->layout == 'phone')
269
-        $conf->global->MAIN_TESTMENUHIDER = 1;
270
-}
269
+    if ($conf->browser->layout == 'phone') {
270
+            $conf->dol_no_mouse_hover = 1;
271
+    }
272
+    if ($conf->browser->layout == 'phone') {
273
+            $conf->global->MAIN_TESTMENUHIDER = 1;
274
+    }
275
+    }
271 276
 
272 277
 // Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url)
273 278
 // $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
@@ -312,10 +317,14 @@  discard block
 block discarded – undo
312 317
 }
313 318
 
314 319
 // Loading of additional presentation includes
315
-if (!defined('NOREQUIREHTML'))
316
-    require_once DOL_BASE_PATH . '/core/class/html.form.class.php';     // Need 660ko memory (800ko in 2.2)
317
-if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax)
318
-    require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; // Need 22ko memory
320
+if (!defined('NOREQUIREHTML')) {
321
+    require_once DOL_BASE_PATH . '/core/class/html.form.class.php';
322
+}
323
+// Need 660ko memory (800ko in 2.2)
324
+if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) {
325
+    require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php';
326
+}
327
+// Need 22ko memory
319 328
 
320 329
 
321 330
 
@@ -346,8 +355,9 @@  discard block
 block discarded – undo
346 355
 // Creation of a token against CSRF vulnerabilities
347 356
 if (!defined('NOTOKENRENEWAL')) {
348 357
     // roulement des jetons car cree a chaque appel
349
-    if (isset($_SESSION['newtoken']))
350
-        $_SESSION['token'] = $_SESSION['newtoken'];
358
+    if (isset($_SESSION['newtoken'])) {
359
+            $_SESSION['token'] = $_SESSION['newtoken'];
360
+    }
351 361
 
352 362
     // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
353 363
     $token = dol_hash(uniqid(mt_rand(), true)); // Generates a hash of a random number
@@ -369,14 +379,16 @@  discard block
 block discarded – undo
369 379
 }
370 380
 
371 381
 // Disable modules (this must be after session_start and after conf has been loaded)
372
-if (GETPOST('disablemodules', 'alpha'))
382
+if (GETPOST('disablemodules', 'alpha')) {
373 383
     $_SESSION["disablemodules"] = GETPOST('disablemodules', 'alpha');
384
+}
374 385
 if (!empty($_SESSION["disablemodules"])) {
375 386
     $disabled_modules = explode(',', $_SESSION["disablemodules"]);
376 387
     foreach ($disabled_modules as $module) {
377 388
         if ($module) {
378
-            if (empty($conf->$module))
379
-                $conf->$module = new stdClass();
389
+            if (empty($conf->$module)) {
390
+                            $conf->$module = new stdClass();
391
+            }
380 392
             $conf->$module->enabled = false;
381 393
             if ($module == 'fournisseur') {  // Special case
382 394
                 $conf->supplier_order->enabled = 0;
@@ -398,11 +410,13 @@  discard block
 block discarded – undo
398 410
         $dolibarr_main_authentication = constant('MAIN_AUTHENTICATION_MODE');
399 411
     } else {
400 412
         // Authentication mode
401
-        if (empty($dolibarr_main_authentication))
402
-            $dolibarr_main_authentication = 'http,dolibarr';
413
+        if (empty($dolibarr_main_authentication)) {
414
+                    $dolibarr_main_authentication = 'http,dolibarr';
415
+        }
403 416
         // Authentication mode: forceuser
404
-        if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user))
405
-            $dolibarr_auto_user = 'auto';
417
+        if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) {
418
+                    $dolibarr_auto_user = 'auto';
419
+        }
406 420
     }
407 421
     // Set authmode
408 422
     $authmode = explode(',', $dolibarr_main_authentication);
@@ -479,35 +493,41 @@  discard block
 block discarded – undo
479 493
                 $hookmanager->initHooks(array('login'));
480 494
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
481 495
                 $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
482
-                if ($reshook < 0)
483
-                    $error++;
496
+                if ($reshook < 0) {
497
+                                    $error++;
498
+                }
484 499
 
485 500
                 // Note: exit is done later
486 501
             }
487 502
         }
488 503
 
489 504
         $allowedmethodtopostusername = 2;
490
-        if (defined('MAIN_AUTHENTICATION_POST_METHOD'))
491
-            $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD');
505
+        if (defined('MAIN_AUTHENTICATION_POST_METHOD')) {
506
+                    $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD');
507
+        }
492 508
         $usertotest = (!empty($_COOKIE['login_dolibarr']) ? $_COOKIE['login_dolibarr'] : GETPOST("username", "alpha", $allowedmethodtopostusername));
493 509
         $passwordtotest = GETPOST('password', 'none', $allowedmethodtopostusername);
494 510
         $entitytotest = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : (!empty($conf->entity) ? $conf->entity : 1));
495 511
 
496 512
         // Define if we received data to test the login.
497 513
         $goontestloop = false;
498
-        if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode))
499
-            $goontestloop = true;
500
-        if ($dolibarr_main_authentication == 'forceuser' && !empty($dolibarr_auto_user))
501
-            $goontestloop = true;
502
-        if (GETPOST("username", "alpha", $allowedmethodtopostusername) || !empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode', 'alpha', 1))
503
-            $goontestloop = true;
514
+        if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode)) {
515
+                    $goontestloop = true;
516
+        }
517
+        if ($dolibarr_main_authentication == 'forceuser' && !empty($dolibarr_auto_user)) {
518
+                    $goontestloop = true;
519
+        }
520
+        if (GETPOST("username", "alpha", $allowedmethodtopostusername) || !empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode', 'alpha', 1)) {
521
+                    $goontestloop = true;
522
+        }
504 523
 
505 524
         if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages.
506 525
             include_once DOL_BASE_PATH . '/core/class/translate.class.php';
507 526
             $langs = new Translate("", $conf);
508 527
             $langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT));
509
-            if (defined('MAIN_LANG_DEFAULT'))
510
-                $langcode = constant('MAIN_LANG_DEFAULT');
528
+            if (defined('MAIN_LANG_DEFAULT')) {
529
+                            $langcode = constant('MAIN_LANG_DEFAULT');
530
+            }
511 531
             $langs->setDefaultLang($langcode);
512 532
         }
513 533
 
@@ -529,8 +549,9 @@  discard block
 block discarded – undo
529 549
                     $datenow = dol_now();
530 550
                     $datefirst = dol_stringtotime($_POST["dst_first"]);
531 551
                     $datesecond = dol_stringtotime($_POST["dst_second"]);
532
-                    if ($datenow >= $datefirst && $datenow < $datesecond)
533
-                        $dol_dst = 1;
552
+                    if ($datenow >= $datefirst && $datenow < $datesecond) {
553
+                                            $dol_dst = 1;
554
+                    }
534 555
                 }
535 556
                 //print $datefirst.'-'.$datesecond.'-'.$datenow.'-'.$dol_tz.'-'.$dol_tzstring.'-'.$dol_dst; exit;
536 557
             }
@@ -542,8 +563,9 @@  discard block
 block discarded – undo
542 563
 
543 564
                 // Bad password. No authmode has found a good password.
544 565
                 // We set a generic message if not defined inside function checkLoginPassEntity or subfunctions
545
-                if (empty($_SESSION["dol_loginmesg"]))
546
-                    $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
566
+                if (empty($_SESSION["dol_loginmesg"])) {
567
+                                    $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
568
+                }
547 569
 
548 570
                 // Call trigger for the "security events" log
549 571
                 $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword") . ' - login=' . GETPOST("username", "alpha", 2);
@@ -560,8 +582,9 @@  discard block
 block discarded – undo
560 582
                 $hookmanager->initHooks(array('login'));
561 583
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
562 584
                 $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
563
-                if ($reshook < 0)
564
-                    $error++;
585
+                if ($reshook < 0) {
586
+                                    $error++;
587
+                }
565 588
 
566 589
                 // Note: exit is done in next chapter
567 590
             }
@@ -571,10 +594,11 @@  discard block
 block discarded – undo
571 594
         if (!$login || (in_array('ldap', $authmode) && empty($passwordtotest))) { // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success.
572 595
             // No data to test login, so we show the login page
573 596
             dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . " showing the login form and exit");
574
-            if (defined('NOREDIRECTBYMAINTOLOGIN'))
575
-                return 'ERROR_NOT_LOGGED';
576
-            else
577
-                dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));
597
+            if (defined('NOREDIRECTBYMAINTOLOGIN')) {
598
+                            return 'ERROR_NOT_LOGGED';
599
+            } else {
600
+                            dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));
601
+            }
578 602
             exit;
579 603
         }
580 604
 
@@ -613,21 +637,24 @@  discard block
 block discarded – undo
613 637
             $hookmanager->initHooks(array('login'));
614 638
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
615 639
             $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
616
-            if ($reshook < 0)
617
-                $error++;
640
+            if ($reshook < 0) {
641
+                            $error++;
642
+            }
618 643
 
619 644
             $paramsurl = array();
620
-            if (GETPOST('textbrowser', 'int'))
621
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
622
-            if (GETPOST('nojs', 'int'))
623
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
624
-            if (GETPOST('lang', 'aZ09'))
625
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
645
+            if (GETPOST('textbrowser', 'int')) {
646
+                            $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
647
+            }
648
+            if (GETPOST('nojs', 'int')) {
649
+                            $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
650
+            }
651
+            if (GETPOST('lang', 'aZ09')) {
652
+                            $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
653
+            }
626 654
             header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
627 655
             exit;
628 656
         }
629
-    }
630
-    else {
657
+    } else {
631 658
         // We are already into an authenticated session
632 659
         $login = $_SESSION["dol_login"];
633 660
         $entity = $_SESSION["dol_entity"];
@@ -669,20 +696,23 @@  discard block
 block discarded – undo
669 696
             $hookmanager->initHooks(array('login'));
670 697
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
671 698
             $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
672
-            if ($reshook < 0)
673
-                $error++;
699
+            if ($reshook < 0) {
700
+                            $error++;
701
+            }
674 702
 
675 703
             $paramsurl = array();
676
-            if (GETPOST('textbrowser', 'int'))
677
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
678
-            if (GETPOST('nojs', 'int'))
679
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
680
-            if (GETPOST('lang', 'aZ09'))
681
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
704
+            if (GETPOST('textbrowser', 'int')) {
705
+                            $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
706
+            }
707
+            if (GETPOST('nojs', 'int')) {
708
+                            $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
709
+            }
710
+            if (GETPOST('lang', 'aZ09')) {
711
+                            $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
712
+            }
682 713
             header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
683 714
             exit;
684
-        }
685
-        else {
715
+        } else {
686 716
             // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
687 717
             $hookmanager->initHooks(array('main'));
688 718
 
@@ -691,8 +721,9 @@  discard block
 block discarded – undo
691 721
                 $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]);
692 722
                 $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring);     // Get full path except host server
693 723
                 // Clean $relativepathstring
694
-                if (constant('DOL_BASE_URI'))
695
-                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
724
+                if (constant('DOL_BASE_URI')) {
725
+                                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
726
+                }
696 727
                 $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
697 728
                 $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
698 729
                 //var_dump($relativepathstring);
@@ -743,16 +774,21 @@  discard block
 block discarded – undo
743 774
         $_SESSION["dol_company"] = $conf->global->MAIN_INFO_SOCIETE_NOM;
744 775
         $_SESSION["dol_entity"] = $conf->entity;
745 776
         // Store value into session (values stored only if defined)
746
-        if (!empty($dol_hide_topmenu))
747
-            $_SESSION['dol_hide_topmenu'] = $dol_hide_topmenu;
748
-        if (!empty($dol_hide_leftmenu))
749
-            $_SESSION['dol_hide_leftmenu'] = $dol_hide_leftmenu;
750
-        if (!empty($dol_optimize_smallscreen))
751
-            $_SESSION['dol_optimize_smallscreen'] = $dol_optimize_smallscreen;
752
-        if (!empty($dol_no_mouse_hover))
753
-            $_SESSION['dol_no_mouse_hover'] = $dol_no_mouse_hover;
754
-        if (!empty($dol_use_jmobile))
755
-            $_SESSION['dol_use_jmobile'] = $dol_use_jmobile;
777
+        if (!empty($dol_hide_topmenu)) {
778
+                    $_SESSION['dol_hide_topmenu'] = $dol_hide_topmenu;
779
+        }
780
+        if (!empty($dol_hide_leftmenu)) {
781
+                    $_SESSION['dol_hide_leftmenu'] = $dol_hide_leftmenu;
782
+        }
783
+        if (!empty($dol_optimize_smallscreen)) {
784
+                    $_SESSION['dol_optimize_smallscreen'] = $dol_optimize_smallscreen;
785
+        }
786
+        if (!empty($dol_no_mouse_hover)) {
787
+                    $_SESSION['dol_no_mouse_hover'] = $dol_no_mouse_hover;
788
+        }
789
+        if (!empty($dol_use_jmobile)) {
790
+                    $_SESSION['dol_use_jmobile'] = $dol_use_jmobile;
791
+        }
756 792
 
757 793
         dol_syslog("This is a new started user session. _SESSION['dol_login']=" . $_SESSION["dol_login"] . " Session id=" . session_id());
758 794
 
@@ -777,8 +813,9 @@  discard block
 block discarded – undo
777 813
         $hookmanager->initHooks(array('login'));
778 814
         $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginfo' => $loginfo);
779 815
         $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
780
-        if ($reshook < 0)
781
-            $error++;
816
+        if ($reshook < 0) {
817
+                    $error++;
818
+        }
782 819
 
783 820
         if ($error) {
784 821
             $db->rollback();
@@ -816,10 +853,14 @@  discard block
 block discarded – undo
816 853
      */
817 854
 
818 855
     // Set liste_limit
819
-    if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT))
820
-        $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT; // Can be 0
821
-    if (isset($user->conf->PRODUIT_LIMIT_SIZE))
822
-        $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE; // Can be 0
856
+    if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) {
857
+            $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
858
+    }
859
+    // Can be 0
860
+    if (isset($user->conf->PRODUIT_LIMIT_SIZE)) {
861
+            $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
862
+    }
863
+    // Can be 0
823 864
 
824 865
 
825 866
 
@@ -848,8 +889,9 @@  discard block
 block discarded – undo
848 889
     if (!empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) {
849 890
         $conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
850 891
     }
851
-} else
892
+} else {
852 893
     $conf->use_javascript_ajax = 0;
894
+}
853 895
 // Set MAIN_OPTIMIZEFORTEXTBROWSER
854 896
 if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks') || !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {   // If we must enable text browser
855 897
     $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
@@ -858,25 +900,32 @@  discard block
 block discarded – undo
858 900
 }
859 901
 
860 902
 // Set terminal output option according to conf->browser.
861
-if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu']))
903
+if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu'])) {
862 904
     $conf->dol_hide_leftmenu = 1;
863
-if (GETPOST('dol_hide_topmenu', 'int') || !empty($_SESSION['dol_hide_topmenu']))
905
+}
906
+if (GETPOST('dol_hide_topmenu', 'int') || !empty($_SESSION['dol_hide_topmenu'])) {
864 907
     $conf->dol_hide_topmenu = 1;
865
-if (GETPOST('dol_optimize_smallscreen', 'int') || !empty($_SESSION['dol_optimize_smallscreen']))
908
+}
909
+if (GETPOST('dol_optimize_smallscreen', 'int') || !empty($_SESSION['dol_optimize_smallscreen'])) {
866 910
     $conf->dol_optimize_smallscreen = 1;
867
-if (GETPOST('dol_no_mouse_hover', 'int') || !empty($_SESSION['dol_no_mouse_hover']))
911
+}
912
+if (GETPOST('dol_no_mouse_hover', 'int') || !empty($_SESSION['dol_no_mouse_hover'])) {
868 913
     $conf->dol_no_mouse_hover = 1;
869
-if (GETPOST('dol_use_jmobile', 'int') || !empty($_SESSION['dol_use_jmobile']))
914
+}
915
+if (GETPOST('dol_use_jmobile', 'int') || !empty($_SESSION['dol_use_jmobile'])) {
870 916
     $conf->dol_use_jmobile = 1;
871
-if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic')
917
+}
918
+if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic') {
872 919
     $conf->dol_no_mouse_hover = 1;
920
+}
873 921
 if ((!empty($conf->browser->layout) && $conf->browser->layout == 'phone') || (!empty($_SESSION['dol_screenwidth']) && $_SESSION['dol_screenwidth'] < 400) || (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 400)
874 922
 ) {
875 923
     $conf->dol_optimize_smallscreen = 1;
876 924
 }
877 925
 // If we force to use jmobile, then we reenable javascript
878
-if (!empty($conf->dol_use_jmobile))
926
+if (!empty($conf->dol_use_jmobile)) {
879 927
     $conf->use_javascript_ajax = 1;
928
+}
880 929
 // Replace themes bugged with jmobile with eldy
881 930
 if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) {
882 931
     $conf->theme = 'eldy';
@@ -900,8 +949,9 @@  discard block
 block discarded – undo
900 949
 if (!defined('NOLOGIN')) {
901 950
     // If the login is not recovered, it is identified with an account that does not exist.
902 951
     // Hacking attempt?
903
-    if (!$user->login)
904
-        accessforbidden();
952
+    if (!$user->login) {
953
+            accessforbidden();
954
+    }
905 955
 
906 956
     // Check if user is active
907 957
     if ($user->statut < 1) {
@@ -976,15 +1026,18 @@  discard block
 block discarded – undo
976 1026
 
977 1027
     // Load the menu manager (only if not already done)
978 1028
     $file_menu = $conf->standard_menu;
979
-    if (GETPOST('menu', 'alpha'))
980
-        $file_menu = GETPOST('menu', 'alpha');     // example: menu=eldy_menu.php
1029
+    if (GETPOST('menu', 'alpha')) {
1030
+            $file_menu = GETPOST('menu', 'alpha');
1031
+    }
1032
+    // example: menu=eldy_menu.php
981 1033
     if (!class_exists('MenuManager')) {
982 1034
         $menufound = 0;
983 1035
         $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
984 1036
         foreach ($dirmenus as $dirmenu) {
985 1037
             $menufound = dol_include_once($dirmenu . "standard/" . $file_menu);
986
-            if (class_exists('MenuManager'))
987
-                break;
1038
+            if (class_exists('MenuManager')) {
1039
+                            break;
1040
+            }
988 1041
         }
989 1042
         if (!class_exists('MenuManager')) { // If failed to include, we try with standard eldy_menu.php
990 1043
             dol_syslog("You define a menu manager '" . $file_menu . "' that can not be loaded.", LOG_WARNING);
@@ -1134,18 +1187,20 @@  discard block
 block discarded – undo
1134 1187
     }
1135 1188
     print '<!doctype html>' . "\n";
1136 1189
 
1137
-    if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST))
1138
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n";
1139
-    else
1140
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n";
1190
+    if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST)) {
1191
+            print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n";
1192
+    } else {
1193
+            print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n";
1194
+    }
1141 1195
     //print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n";
1142 1196
     if (empty($disablehead)) {
1143 1197
         $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
1144 1198
 
1145 1199
         print "<head>\n";
1146 1200
 
1147
-        if (GETPOST('dol_basehref', 'alpha'))
1148
-            print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n";
1201
+        if (GETPOST('dol_basehref', 'alpha')) {
1202
+                    print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n";
1203
+        }
1149 1204
 
1150 1205
         // Displays meta
1151 1206
         print '<meta charset="UTF-8">' . "\n";
@@ -1155,10 +1210,13 @@  discard block
 block discarded – undo
1155 1210
 
1156 1211
         // Favicon
1157 1212
         $favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1);
1158
-        if (!empty($conf->global->MAIN_FAVICON_URL))
1159
-            $favicon = $conf->global->MAIN_FAVICON_URL;
1160
-        if (empty($conf->dol_use_jmobile))
1161
-            print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n"; // Not required into an Android webview
1213
+        if (!empty($conf->global->MAIN_FAVICON_URL)) {
1214
+                    $favicon = $conf->global->MAIN_FAVICON_URL;
1215
+        }
1216
+        if (empty($conf->dol_use_jmobile)) {
1217
+                    print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n";
1218
+        }
1219
+        // Not required into an Android webview
1162 1220
 
1163 1221
 
1164 1222
 
@@ -1170,47 +1228,59 @@  discard block
 block discarded – undo
1170 1228
         //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
1171 1229
         //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n";
1172 1230
         // Auto refresh page
1173
-        if (GETPOST('autorefresh', 'int') > 0)
1174
-            print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">';
1231
+        if (GETPOST('autorefresh', 'int') > 0) {
1232
+                    print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">';
1233
+        }
1175 1234
 
1176 1235
         // Displays title
1177 1236
         $appli = constant('DOL_APPLICATION_TITLE');
1178
-        if (!empty($conf->global->MAIN_APPLICATION_TITLE))
1179
-            $appli = $conf->global->MAIN_APPLICATION_TITLE;
1237
+        if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1238
+                    $appli = $conf->global->MAIN_APPLICATION_TITLE;
1239
+        }
1180 1240
 
1181 1241
         print '<title>';
1182 1242
         $titletoshow = '';
1183
-        if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE))
1184
-            $titletoshow = dol_htmlentities($title);
1185
-        else if ($title)
1186
-            $titletoshow = dol_htmlentities($appli . ' - ' . $title);
1187
-        else
1188
-            $titletoshow = dol_htmlentities($appli);
1189
-
1190
-        if (!is_object($hookmanager))
1191
-            $hookmanager = new HookManager($db);
1243
+        if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE)) {
1244
+                    $titletoshow = dol_htmlentities($title);
1245
+        } else if ($title) {
1246
+                    $titletoshow = dol_htmlentities($appli . ' - ' . $title);
1247
+        } else {
1248
+                    $titletoshow = dol_htmlentities($appli);
1249
+        }
1250
+
1251
+        if (!is_object($hookmanager)) {
1252
+                    $hookmanager = new HookManager($db);
1253
+        }
1192 1254
         $hookmanager->initHooks("main");
1193 1255
         $parameters = array('title' => $titletoshow);
1194 1256
         $result = $hookmanager->executeHooks('setHtmlTitle', $parameters);  // Note that $action and $object may have been modified by some hooks
1195
-        if ($result > 0)
1196
-            $titletoshow = $hookmanager->resPrint;    // Replace Title to show
1197
-        else
1198
-            $titletoshow .= $hookmanager->resPrint;      // Concat to Title to show
1257
+        if ($result > 0) {
1258
+                    $titletoshow = $hookmanager->resPrint;
1259
+        }
1260
+        // Replace Title to show
1261
+        else {
1262
+                    $titletoshow .= $hookmanager->resPrint;
1263
+        }
1264
+        // Concat to Title to show
1199 1265
 
1200 1266
         print $titletoshow;
1201 1267
         print '</title>';
1202 1268
 
1203 1269
         print "\n";
1204 1270
 
1205
-        if (GETPOST('version', 'int'))
1206
-            $ext = 'version=' . GETPOST('version', 'int'); // usefull to force no cache on css/js
1207
-        if (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER))
1208
-            $ext .= '&testmenuhider=' . (GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER);
1271
+        if (GETPOST('version', 'int')) {
1272
+                    $ext = 'version=' . GETPOST('version', 'int');
1273
+        }
1274
+        // usefull to force no cache on css/js
1275
+        if (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER)) {
1276
+                    $ext .= '&testmenuhider=' . (GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER);
1277
+        }
1209 1278
 
1210 1279
         $themeparam = '&lang=' . $langs->defaultlang . '&amp;theme=' . $conf->theme . (GETPOST('optioncss', 'aZ09') ? '&amp;optioncss=' . GETPOST('optioncss', 'aZ09', 1) : '') . '&amp;userid=' . $user->id . '&amp;entity=' . $conf->entity;
1211 1280
         $themeparam .= ($ext ? '&amp;' . $ext : '');
1212
-        if (!empty($_SESSION['dol_resetcache']))
1213
-            $themeparam .= '&amp;dol_resetcache=' . $_SESSION['dol_resetcache'];
1281
+        if (!empty($_SESSION['dol_resetcache'])) {
1282
+                    $themeparam .= '&amp;dol_resetcache=' . $_SESSION['dol_resetcache'];
1283
+        }
1214 1284
         if (GETPOST('dol_hide_topmenu', 'int')) {
1215 1285
             $themeparam .= '&amp;dol_hide_topmenu=' . GETPOST('dol_hide_topmenu', 'int');
1216 1286
         }
@@ -1231,14 +1301,21 @@  discard block
 block discarded – undo
1231 1301
         if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) {
1232 1302
             print '<!-- Includes CSS for JQuery (Ajax library) -->' . "\n";
1233 1303
             $jquerytheme = 'base';
1234
-            if (!empty($conf->global->MAIN_USE_JQUERY_THEME))
1235
-                $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
1236
-            if (constant('JS_JQUERY_UI'))
1237
-                print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";  // JQuery
1238
-            else
1239
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n";    // JQuery
1240
-            if (!defined('DISABLE_JQUERY_JNOTIFY'))
1241
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";          // JNotify
1304
+            if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) {
1305
+                            $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
1306
+            }
1307
+            if (constant('JS_JQUERY_UI')) {
1308
+                            print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1309
+            }
1310
+            // JQuery
1311
+            else {
1312
+                            print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1313
+            }
1314
+            // JQuery
1315
+            if (!defined('DISABLE_JQUERY_JNOTIFY')) {
1316
+                            print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1317
+            }
1318
+            // JNotify
1242 1319
             if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) {     // jQuery plugin "mutiselect", "multiple-select", "select2"...
1243 1320
                 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1244 1321
                 print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/' . $tmpplugin . '/dist/css/' . $tmpplugin . '.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
@@ -1266,8 +1343,9 @@  discard block
 block discarded – undo
1266 1343
 
1267 1344
         //print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
1268 1345
         print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n";
1269
-        if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME))
1270
-            print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->' . "\n" . '<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">' . "\n";
1346
+        if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) {
1347
+                    print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->' . "\n" . '<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">' . "\n";
1348
+        }
1271 1349
 
1272 1350
         // CSS forced by modules (relative url starting with /)
1273 1351
         if (!empty($conf->modules_parts['css'])) {
@@ -1275,13 +1353,15 @@  discard block
 block discarded – undo
1275 1353
             foreach ($arraycss as $modcss => $filescss) {
1276 1354
                 $filescss = (array) $filescss; // To be sure filecss is an array
1277 1355
                 foreach ($filescss as $cssfile) {
1278
-                    if (empty($cssfile))
1279
-                        dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING);
1356
+                    if (empty($cssfile)) {
1357
+                                            dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING);
1358
+                    }
1280 1359
                     // cssfile is a relative path
1281 1360
                     print '<!-- Includes CSS added by module ' . $modcss . ' -->' . "\n" . '<link rel="stylesheet" type="text/css" href="' . dol_buildpath($cssfile, 1);
1282 1361
                     // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
1283
-                    if (!preg_match('/\.css$/i', $cssfile))
1284
-                        print $themeparam;
1362
+                    if (!preg_match('/\.css$/i', $cssfile)) {
1363
+                                            print $themeparam;
1364
+                    }
1285 1365
                     print '">' . "\n";
1286 1366
                 }
1287 1367
             }
@@ -1291,8 +1371,9 @@  discard block
 block discarded – undo
1291 1371
             foreach ($arrayofcss as $cssfile) {
1292 1372
                 print '<!-- Includes CSS added by page -->' . "\n" . '<link rel="stylesheet" type="text/css" title="default" href="' . dol_buildpath($cssfile, 1);
1293 1373
                 // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used.
1294
-                if (!preg_match('/\.css$/i', $cssfile))
1295
-                    print $themeparam;
1374
+                if (!preg_match('/\.css$/i', $cssfile)) {
1375
+                                    print $themeparam;
1376
+                }
1296 1377
                 print '">' . "\n";
1297 1378
             }
1298 1379
         }
@@ -1301,22 +1382,26 @@  discard block
 block discarded – undo
1301 1382
         if (!defined('DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) {
1302 1383
             // JQuery. Must be before other includes
1303 1384
             print '<!-- Includes JS for JQuery -->' . "\n";
1304
-            if (defined('JS_JQUERY') && constant('JS_JQUERY'))
1305
-                print '<script type="text/javascript" src="' . JS_JQUERY . 'jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1306
-            else
1307
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1385
+            if (defined('JS_JQUERY') && constant('JS_JQUERY')) {
1386
+                            print '<script type="text/javascript" src="' . JS_JQUERY . 'jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1387
+            } else {
1388
+                            print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1389
+            }
1308 1390
             if (!empty($conf->global->MAIN_FEATURES_LEVEL) && !defined('JS_JQUERY_MIGRATE_DISABLED')) {
1309
-                if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE'))
1310
-                    print '<script type="text/javascript" src="' . JS_JQUERY_MIGRATE . 'jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1311
-                else
1312
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1313
-            }
1314
-            if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI'))
1315
-                print '<script type="text/javascript" src="' . JS_JQUERY_UI . 'jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1316
-            else
1317
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1318
-            if (!defined('DISABLE_JQUERY_TABLEDND'))
1319
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/tablednd/jquery.tablednd.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1391
+                if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) {
1392
+                                    print '<script type="text/javascript" src="' . JS_JQUERY_MIGRATE . 'jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1393
+                } else {
1394
+                                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1395
+                }
1396
+            }
1397
+            if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) {
1398
+                            print '<script type="text/javascript" src="' . JS_JQUERY_UI . 'jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1399
+            } else {
1400
+                            print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1401
+            }
1402
+            if (!defined('DISABLE_JQUERY_TABLEDND')) {
1403
+                            print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/tablednd/jquery.tablednd.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1404
+            }
1320 1405
             // jQuery jnotify
1321 1406
             if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) {
1322 1407
                 print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
@@ -1387,10 +1472,12 @@  discard block
 block discarded – undo
1387 1472
             // Browser notifications
1388 1473
             if (!defined('DISABLE_BROWSER_NOTIF')) {
1389 1474
                 $enablebrowsernotif = false;
1390
-                if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER))
1391
-                    $enablebrowsernotif = true;
1392
-                if ($conf->browser->layout == 'phone')
1393
-                    $enablebrowsernotif = false;
1475
+                if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER)) {
1476
+                                    $enablebrowsernotif = true;
1477
+                }
1478
+                if ($conf->browser->layout == 'phone') {
1479
+                                    $enablebrowsernotif = false;
1480
+                }
1394 1481
                 if ($enablebrowsernotif) {
1395 1482
                     print '<!-- Includes JS of Dolibarr (brwoser layout = ' . $conf->browser->layout . ')-->' . "\n";
1396 1483
                     //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_notification.js.php' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
@@ -1427,10 +1514,12 @@  discard block
 block discarded – undo
1427 1514
             }
1428 1515
         }
1429 1516
 
1430
-        if (!empty($head))
1431
-            print $head . "\n";
1432
-        if (!empty($conf->global->MAIN_HTML_HEADER))
1433
-            print $conf->global->MAIN_HTML_HEADER . "\n";
1517
+        if (!empty($head)) {
1518
+                    print $head . "\n";
1519
+        }
1520
+        if (!empty($conf->global->MAIN_HTML_HEADER)) {
1521
+                    print $conf->global->MAIN_HTML_HEADER . "\n";
1522
+        }
1434 1523
 
1435 1524
         print "<!-- Alixar debugBar header -->";
1436 1525
         print Debug::getRenderHeader(); // Includes Alixar debugBar header
@@ -1495,15 +1584,20 @@  discard block
 block discarded – undo
1495 1584
         if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1496 1585
             $appli = $conf->global->MAIN_APPLICATION_TITLE;
1497 1586
             if (preg_match('/\d\.\d/', $appli)) {
1498
-                if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1499
-                    $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1500
-            } else
1501
-                $appli .= " " . DOL_VERSION;
1502
-        } else
1503
-            $appli .= " " . DOL_VERSION;
1587
+                if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
1588
+                                    $appli .= " (" . DOL_VERSION . ")";
1589
+                }
1590
+                // If new title contains a version that is different than core
1591
+            } else {
1592
+                            $appli .= " " . DOL_VERSION;
1593
+            }
1594
+        } else {
1595
+                    $appli .= " " . DOL_VERSION;
1596
+        }
1504 1597
 
1505
-        if (!empty($conf->global->MAIN_FEATURES_LEVEL))
1506
-            $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL;
1598
+        if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
1599
+                    $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL;
1600
+        }
1507 1601
 
1508 1602
         $logouttext = '';
1509 1603
         if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
@@ -1541,12 +1635,15 @@  discard block
 block discarded – undo
1541 1635
         $parameters = array();
1542 1636
         $result = $hookmanager->executeHooks('printTopRightMenu', $parameters);    // Note that $action and $object may have been modified by some hooks
1543 1637
         if (is_numeric($result)) {
1544
-            if ($result == 0)
1545
-                $toprightmenu .= $hookmanager->resPrint;  // add
1546
-            else
1547
-                $toprightmenu = $hookmanager->resPrint;      // replace
1548
-        }
1549
-        else {
1638
+            if ($result == 0) {
1639
+                            $toprightmenu .= $hookmanager->resPrint;
1640
+            }
1641
+            // add
1642
+            else {
1643
+                            $toprightmenu = $hookmanager->resPrint;
1644
+            }
1645
+            // replace
1646
+        } else {
1550 1647
             $toprightmenu .= $result; // For backward compatibility
1551 1648
         }
1552 1649
 
@@ -1566,8 +1663,9 @@  discard block
 block discarded – undo
1566 1663
 
1567 1664
             if (is_array($_POST)) {
1568 1665
                 foreach ($_POST as $key => $value) {
1569
-                    if ($key !== 'action' && $key !== 'password' && !is_array($value))
1570
-                        $qs .= '&' . $key . '=' . urlencode($value);
1666
+                    if ($key !== 'action' && $key !== 'password' && !is_array($value)) {
1667
+                                            $qs .= '&' . $key . '=' . urlencode($value);
1668
+                    }
1571 1669
                 }
1572 1670
             }
1573 1671
             $qs .= (($qs && $morequerystring) ? '&' : '') . $morequerystring;
@@ -1586,8 +1684,9 @@  discard block
 block discarded – undo
1586 1684
             $helppage = '';
1587 1685
             $mode = '';
1588 1686
 
1589
-            if (empty($helppagename))
1590
-                $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios';
1687
+            if (empty($helppagename)) {
1688
+                            $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios';
1689
+            }
1591 1690
 
1592 1691
             // Get helpbaseurl, helppage and mode from helppagename and langs
1593 1692
             $arrayres = getHelpParamFor($helppagename, $langs);
@@ -1604,13 +1703,15 @@  discard block
 block discarded – undo
1604 1703
                 }
1605 1704
                 $title = $appli . '<br>';
1606 1705
                 $title .= $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage');
1607
-                if ($mode == 'wiki')
1608
-                    $title .= ' - ' . $langs->trans("PageWiki") . ' &quot;' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '&quot;';
1706
+                if ($mode == 'wiki') {
1707
+                                    $title .= ' - ' . $langs->trans("PageWiki") . ' &quot;' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '&quot;';
1708
+                }
1609 1709
                 $text .= '<a class="help" target="_blank" rel="noopener" href="';
1610
-                if ($mode == 'wiki')
1611
-                    $text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage)));
1612
-                else
1613
-                    $text .= sprintf($helpbaseurl, $helppage);
1710
+                if ($mode == 'wiki') {
1711
+                                    $text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage)));
1712
+                } else {
1713
+                                    $text .= sprintf($helpbaseurl, $helppage);
1714
+                }
1614 1715
                 $text .= '">';
1615 1716
                 //$text.=img_picto('', 'helpdoc_top').' ';
1616 1717
                 $text .= '<span class="fa fa-question-circle atoplogin"></span>';
@@ -1637,9 +1738,10 @@  discard block
 block discarded – undo
1637 1738
         print "<!-- End top horizontal menu -->\n\n";
1638 1739
     }
1639 1740
 
1640
-    if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
1641
-        print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
1642
-}
1741
+    if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
1742
+            print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
1743
+    }
1744
+    }
1643 1745
 
1644 1746
 /**
1645 1747
  *  Show left menu bar
@@ -1663,8 +1765,9 @@  discard block
 block discarded – undo
1663 1765
     $searchform = '';
1664 1766
     $bookmarks = '';
1665 1767
 
1666
-    if (!empty($menu_array_before))
1667
-        dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING);
1768
+    if (!empty($menu_array_before)) {
1769
+            dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING);
1770
+    }
1668 1771
 
1669 1772
     if (empty($conf->dol_hide_leftmenu) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) {
1670 1773
         // Instantiate hooks of thirdparty module
@@ -1672,8 +1775,10 @@  discard block
 block discarded – undo
1672 1775
 
1673 1776
         print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n";
1674 1777
 
1675
-        if ($conf->browser->layout == 'phone')
1676
-            $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
1778
+        if ($conf->browser->layout == 'phone') {
1779
+                    $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1;
1780
+        }
1781
+        // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
1677 1782
 
1678 1783
         print "\n";
1679 1784
 
@@ -1700,8 +1805,9 @@  discard block
 block discarded – undo
1700 1805
         $reshook = $hookmanager->executeHooks('printSearchForm', $parameters);    // Note that $action and $object may have been modified by some hooks
1701 1806
         if (empty($reshook)) {
1702 1807
             $searchform .= $hookmanager->resPrint;
1703
-        } else
1704
-            $searchform = $hookmanager->resPrint;
1808
+        } else {
1809
+                    $searchform = $hookmanager->resPrint;
1810
+        }
1705 1811
 
1706 1812
         // Force special value for $searchform
1707 1813
         if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) {
@@ -1745,38 +1851,49 @@  discard block
 block discarded – undo
1745 1851
         if (empty($conf->global->MAIN_HIDE_VERSION)) {    // Version is already on help picto and on login page.
1746 1852
             $doliurl = 'https://www.dolibarr.org';
1747 1853
             //local communities
1748
-            if (preg_match('/fr/i', $langs->defaultlang))
1749
-                $doliurl = 'https://www.dolibarr.fr';
1750
-            if (preg_match('/es/i', $langs->defaultlang))
1751
-                $doliurl = 'https://www.dolibarr.es';
1752
-            if (preg_match('/de/i', $langs->defaultlang))
1753
-                $doliurl = 'https://www.dolibarr.de';
1754
-            if (preg_match('/it/i', $langs->defaultlang))
1755
-                $doliurl = 'https://www.dolibarr.it';
1756
-            if (preg_match('/gr/i', $langs->defaultlang))
1757
-                $doliurl = 'https://www.dolibarr.gr';
1854
+            if (preg_match('/fr/i', $langs->defaultlang)) {
1855
+                            $doliurl = 'https://www.dolibarr.fr';
1856
+            }
1857
+            if (preg_match('/es/i', $langs->defaultlang)) {
1858
+                            $doliurl = 'https://www.dolibarr.es';
1859
+            }
1860
+            if (preg_match('/de/i', $langs->defaultlang)) {
1861
+                            $doliurl = 'https://www.dolibarr.de';
1862
+            }
1863
+            if (preg_match('/it/i', $langs->defaultlang)) {
1864
+                            $doliurl = 'https://www.dolibarr.it';
1865
+            }
1866
+            if (preg_match('/gr/i', $langs->defaultlang)) {
1867
+                            $doliurl = 'https://www.dolibarr.gr';
1868
+            }
1758 1869
 
1759 1870
             $appli = constant('DOL_APPLICATION_TITLE');
1760 1871
             if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1761 1872
                 $appli = $conf->global->MAIN_APPLICATION_TITLE;
1762 1873
                 $doliurl = '';
1763 1874
                 if (preg_match('/\d\.\d/', $appli)) {
1764
-                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1765
-                        $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1766
-                } else
1767
-                    $appli .= " " . DOL_VERSION;
1768
-            } else
1769
-                $appli .= " " . DOL_VERSION;
1875
+                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
1876
+                                            $appli .= " (" . DOL_VERSION . ")";
1877
+                    }
1878
+                    // If new title contains a version that is different than core
1879
+                } else {
1880
+                                    $appli .= " " . DOL_VERSION;
1881
+                }
1882
+            } else {
1883
+                            $appli .= " " . DOL_VERSION;
1884
+            }
1770 1885
             print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
1771
-            if ($doliurl)
1772
-                print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
1773
-            else
1774
-                print '<span class="help">';
1886
+            if ($doliurl) {
1887
+                            print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
1888
+            } else {
1889
+                            print '<span class="help">';
1890
+            }
1775 1891
             print $appli;
1776
-            if ($doliurl)
1777
-                print '</a>';
1778
-            else
1779
-                print '</span>';
1892
+            if ($doliurl) {
1893
+                            print '</a>';
1894
+            } else {
1895
+                            print '</span>';
1896
+            }
1780 1897
             print '</div>' . "\n";
1781 1898
         }
1782 1899
 
@@ -1823,9 +1940,10 @@  discard block
 block discarded – undo
1823 1940
     print "\n";
1824 1941
     print '<!-- Begin right area -->' . "\n";
1825 1942
 
1826
-    if (empty($leftmenuwithoutmainarea))
1827
-        main_area($title);
1828
-}
1943
+    if (empty($leftmenuwithoutmainarea)) {
1944
+            main_area($title);
1945
+    }
1946
+    }
1829 1947
 
1830 1948
 /**
1831 1949
  *  Begin main area
@@ -1837,16 +1955,18 @@  discard block
 block discarded – undo
1837 1955
 {
1838 1956
     global $conf, $langs;
1839 1957
 
1840
-    if (empty($conf->dol_hide_leftmenu))
1841
-        print '<div id="id-right">';
1958
+    if (empty($conf->dol_hide_leftmenu)) {
1959
+            print '<div id="id-right">';
1960
+    }
1842 1961
 
1843 1962
     print "\n";
1844 1963
 
1845 1964
     print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n";
1846 1965
 
1847
-    if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
1848
-        print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
1849
-}
1966
+    if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
1967
+            print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
1968
+    }
1969
+    }
1850 1970
 
1851 1971
 /**
1852 1972
  *  Return helpbaseurl, helppage and mode
@@ -1870,18 +1990,21 @@  discard block
 block discarded – undo
1870 1990
         // If WIKI URL
1871 1991
         if (preg_match('/^es/i', $langs->defaultlang)) {
1872 1992
             $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
1873
-            if (preg_match('/ES:([^|]+)/i', $helppagename, $reg))
1874
-                $helppage = $reg[1];
1993
+            if (preg_match('/ES:([^|]+)/i', $helppagename, $reg)) {
1994
+                            $helppage = $reg[1];
1995
+            }
1875 1996
         }
1876 1997
         if (preg_match('/^fr/i', $langs->defaultlang)) {
1877 1998
             $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
1878
-            if (preg_match('/FR:([^|]+)/i', $helppagename, $reg))
1879
-                $helppage = $reg[1];
1999
+            if (preg_match('/FR:([^|]+)/i', $helppagename, $reg)) {
2000
+                            $helppage = $reg[1];
2001
+            }
1880 2002
         }
1881 2003
         if (empty($helppage)) { // If help page not already found
1882 2004
             $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
1883
-            if (preg_match('/EN:([^|]+)/i', $helppagename, $reg))
1884
-                $helppage = $reg[1];
2005
+            if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) {
2006
+                            $helppage = $reg[1];
2007
+            }
1885 2008
         }
1886 2009
         $mode = 'wiki';
1887 2010
     }
@@ -1912,8 +2035,9 @@  discard block
 block discarded – undo
1912 2035
     $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
1913 2036
     $ret .= '<input type="hidden" name="mode" value="search">';
1914 2037
     $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag($user->login) . '">';
1915
-    if ($showtitlebefore)
1916
-        $ret .= $title . ' ';
2038
+    if ($showtitlebefore) {
2039
+            $ret .= $title . ' ';
2040
+    }
1917 2041
     $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"';
1918 2042
     $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"';
1919 2043
     $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : '');
@@ -1956,10 +2080,12 @@  discard block
 block discarded – undo
1956 2080
             foreach ($user->lastsearch_values_tmp as $key => $val) {
1957 2081
                 unset($_SESSION['lastsearch_values_tmp_' . $key]);   // Clean array to rebuild it just after
1958 2082
                 if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button
1959
-                    if (empty($val['sortfield']))
1960
-                        unset($val['sortfield']);
1961
-                    if (empty($val['sortorder']))
1962
-                        unset($val['sortorder']);
2083
+                    if (empty($val['sortfield'])) {
2084
+                                            unset($val['sortfield']);
2085
+                    }
2086
+                    if (empty($val['sortorder'])) {
2087
+                                            unset($val['sortorder']);
2088
+                    }
1963 2089
                     dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)");
1964 2090
                     $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val);
1965 2091
                     unset($_SESSION['lastsearch_values_' . $key]);
@@ -1970,8 +2096,9 @@  discard block
 block discarded – undo
1970 2096
 
1971 2097
         $relativepathstring = $_SERVER["PHP_SELF"];
1972 2098
         // Clean $relativepathstring
1973
-        if (constant('DOL_BASE_URI'))
1974
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
2099
+        if (constant('DOL_BASE_URI')) {
2100
+                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
2101
+        }
1975 2102
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
1976 2103
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
1977 2104
         if (preg_match('/list\.php$/', $relativepathstring)) {
@@ -1979,12 +2106,15 @@  discard block
 block discarded – undo
1979 2106
             unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
1980 2107
             unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
1981 2108
 
1982
-            if (!empty($contextpage))
1983
-                $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
1984
-            if (!empty($page) && $page > 1)
1985
-                $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
1986
-            if (!empty($limit) && $limit != $conf->limit)
1987
-                $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
2109
+            if (!empty($contextpage)) {
2110
+                            $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
2111
+            }
2112
+            if (!empty($page) && $page > 1) {
2113
+                            $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
2114
+            }
2115
+            if (!empty($limit) && $limit != $conf->limit) {
2116
+                            $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
2117
+            }
1988 2118
 
1989 2119
             unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]);
1990 2120
             unset($_SESSION['lastsearch_page_' . $relativepathstring]);
@@ -2011,20 +2141,26 @@  discard block
 block discarded – undo
2011 2141
 
2012 2142
         print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche
2013 2143
 
2014
-        if (empty($conf->dol_hide_leftmenu))
2015
-            print '</div> <!-- End div id-right -->' . "\n"; // End div id-right
2144
+        if (empty($conf->dol_hide_leftmenu)) {
2145
+                    print '</div> <!-- End div id-right -->' . "\n";
2146
+        }
2147
+        // End div id-right
2016 2148
 
2017
-        if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
2018
-            print '</div> <!-- End div id-container -->' . "\n"; // End div container
2149
+        if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
2150
+                    print '</div> <!-- End div id-container -->' . "\n";
2151
+        }
2152
+        // End div container
2019 2153
 
2020 2154
         print "\n";
2021
-        if ($comment)
2022
-            print '<!-- ' . $comment . ' -->' . "\n";
2155
+        if ($comment) {
2156
+                    print '<!-- ' . $comment . ' -->' . "\n";
2157
+        }
2023 2158
 
2024 2159
         printCommonFooter($zone);
2025 2160
 
2026
-        if (!empty($delayedhtmlcontent))
2027
-            print $delayedhtmlcontent;
2161
+        if (!empty($delayedhtmlcontent)) {
2162
+                    print $delayedhtmlcontent;
2163
+        }
2028 2164
 
2029 2165
         if (!empty($conf->use_javascript_ajax)) {
2030 2166
             print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n";
Please login to merge, or discard this patch.