Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/admin/ldap_members.php 1 patch
Braces   +98 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
36 36
 // Load translation files required by the page
37 37
 $langs->loadLangs(array('admin', 'errors'));
38 38
 
39
-if (!$user->admin)
39
+if (!$user->admin) {
40 40
   accessforbidden();
41
+}
41 42
 
42 43
 $action = GETPOST('action', 'aZ09');
43 44
 
@@ -51,45 +52,109 @@  discard block
 block discarded – undo
51 52
 
52 53
 	$db->begin();
53 54
 
54
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_DN', GETPOST("user"), 'chaine', 0, '', $conf->entity)) $error++;
55
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_OBJECT_CLASS', GETPOST("objectclass"), 'chaine', 0, '', $conf->entity)) $error++;
56
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FILTER', GETPOST("filterconnection"), 'chaine', 0, '', $conf->entity)) $error++;
55
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_DN', GETPOST("user"), 'chaine', 0, '', $conf->entity)) {
56
+		$error++;
57
+	}
58
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_OBJECT_CLASS', GETPOST("objectclass"), 'chaine', 0, '', $conf->entity)) {
59
+		$error++;
60
+	}
61
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FILTER', GETPOST("filterconnection"), 'chaine', 0, '', $conf->entity)) {
62
+		$error++;
63
+	}
57 64
 	// Members
58
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FULLNAME', GETPOST("fieldfullname"), 'chaine', 0, '', $conf->entity)) $error++;
59
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_LOGIN', GETPOST("fieldlogin"), 'chaine', 0, '', $conf->entity)) $error++;
60
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_LOGIN_SAMBA', GETPOST("fieldloginsamba"), 'chaine', 0, '', $conf->entity)) $error++;
61
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PASSWORD', GETPOST("fieldpassword"), 'chaine', 0, '', $conf->entity)) $error++;
62
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PASSWORD_CRYPTED', GETPOST("fieldpasswordcrypted"), 'chaine', 0, '', $conf->entity)) $error++;
63
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_NAME', GETPOST("fieldname"), 'chaine', 0, '', $conf->entity)) $error++;
64
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FIRSTNAME', GETPOST("fieldfirstname"), 'chaine', 0, '', $conf->entity)) $error++;
65
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MAIL', GETPOST("fieldmail"), 'chaine', 0, '', $conf->entity)) $error++;
66
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE', GETPOST("fieldphone"), 'chaine', 0, '', $conf->entity)) $error++;
67
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE_PERSO', GETPOST("fieldphoneperso"), 'chaine', 0, '', $conf->entity)) $error++;
68
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE', GETPOST("fieldmobile"), 'chaine', 0, '', $conf->entity)) $error++;
69
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE', GETPOST("fieldskype"), 'chaine', 0, '', $conf->entity)) $error++;
70
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX', GETPOST("fieldfax"), 'chaine', 0, '', $conf->entity)) $error++;
71
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COMPANY', GETPOST("fieldcompany"), 'chaine', 0, '', $conf->entity)) $error++;
72
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS', GETPOST("fieldaddress"), 'chaine', 0, '', $conf->entity)) $error++;
73
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP', GETPOST("fieldzip"), 'chaine', 0, '', $conf->entity)) $error++;
74
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN', GETPOST("fieldtown"), 'chaine', 0, '', $conf->entity)) $error++;
75
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COUNTRY', GETPOST("fieldcountry"), 'chaine', 0, '', $conf->entity)) $error++;
76
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_DESCRIPTION', GETPOST("fielddescription"), 'chaine', 0, '', $conf->entity)) $error++;
77
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_NOTE_PUBLIC', GETPOST("fieldnotepublic"), 'chaine', 0, '', $conf->entity)) $error++;
78
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_BIRTHDATE', GETPOST("fieldbirthdate"), 'chaine', 0, '', $conf->entity)) $error++;
79
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_STATUS', GETPOST("fieldstatus"), 'chaine', 0, '', $conf->entity)) $error++;
80
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION', GETPOST("fieldendlastsubscription"), 'chaine', 0, '', $conf->entity)) $error++;
65
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FULLNAME', GETPOST("fieldfullname"), 'chaine', 0, '', $conf->entity)) {
66
+		$error++;
67
+	}
68
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_LOGIN', GETPOST("fieldlogin"), 'chaine', 0, '', $conf->entity)) {
69
+		$error++;
70
+	}
71
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_LOGIN_SAMBA', GETPOST("fieldloginsamba"), 'chaine', 0, '', $conf->entity)) {
72
+		$error++;
73
+	}
74
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PASSWORD', GETPOST("fieldpassword"), 'chaine', 0, '', $conf->entity)) {
75
+		$error++;
76
+	}
77
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PASSWORD_CRYPTED', GETPOST("fieldpasswordcrypted"), 'chaine', 0, '', $conf->entity)) {
78
+		$error++;
79
+	}
80
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_NAME', GETPOST("fieldname"), 'chaine', 0, '', $conf->entity)) {
81
+		$error++;
82
+	}
83
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FIRSTNAME', GETPOST("fieldfirstname"), 'chaine', 0, '', $conf->entity)) {
84
+		$error++;
85
+	}
86
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MAIL', GETPOST("fieldmail"), 'chaine', 0, '', $conf->entity)) {
87
+		$error++;
88
+	}
89
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE', GETPOST("fieldphone"), 'chaine', 0, '', $conf->entity)) {
90
+		$error++;
91
+	}
92
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE_PERSO', GETPOST("fieldphoneperso"), 'chaine', 0, '', $conf->entity)) {
93
+		$error++;
94
+	}
95
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE', GETPOST("fieldmobile"), 'chaine', 0, '', $conf->entity)) {
96
+		$error++;
97
+	}
98
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE', GETPOST("fieldskype"), 'chaine', 0, '', $conf->entity)) {
99
+		$error++;
100
+	}
101
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX', GETPOST("fieldfax"), 'chaine', 0, '', $conf->entity)) {
102
+		$error++;
103
+	}
104
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COMPANY', GETPOST("fieldcompany"), 'chaine', 0, '', $conf->entity)) {
105
+		$error++;
106
+	}
107
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS', GETPOST("fieldaddress"), 'chaine', 0, '', $conf->entity)) {
108
+		$error++;
109
+	}
110
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP', GETPOST("fieldzip"), 'chaine', 0, '', $conf->entity)) {
111
+		$error++;
112
+	}
113
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN', GETPOST("fieldtown"), 'chaine', 0, '', $conf->entity)) {
114
+		$error++;
115
+	}
116
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COUNTRY', GETPOST("fieldcountry"), 'chaine', 0, '', $conf->entity)) {
117
+		$error++;
118
+	}
119
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_DESCRIPTION', GETPOST("fielddescription"), 'chaine', 0, '', $conf->entity)) {
120
+		$error++;
121
+	}
122
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_NOTE_PUBLIC', GETPOST("fieldnotepublic"), 'chaine', 0, '', $conf->entity)) {
123
+		$error++;
124
+	}
125
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_BIRTHDATE', GETPOST("fieldbirthdate"), 'chaine', 0, '', $conf->entity)) {
126
+		$error++;
127
+	}
128
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_STATUS', GETPOST("fieldstatus"), 'chaine', 0, '', $conf->entity)) {
129
+		$error++;
130
+	}
131
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION', GETPOST("fieldendlastsubscription"), 'chaine', 0, '', $conf->entity)) {
132
+		$error++;
133
+	}
81 134
 
82 135
 	// Subscriptions
83
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE', GETPOST("fieldfirstsubscriptiondate"), 'chaine', 0, '', $conf->entity)) $error++;
84
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT', GETPOST("fieldfirstsubscriptionamount"), 'chaine', 0, '', $conf->entity)) $error++;
85
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE', GETPOST("fieldlastsubscriptiondate"), 'chaine', 0, '', $conf->entity)) $error++;
86
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT', GETPOST("fieldlastsubscriptionamount"), 'chaine', 0, '', $conf->entity)) $error++;
136
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE', GETPOST("fieldfirstsubscriptiondate"), 'chaine', 0, '', $conf->entity)) {
137
+		$error++;
138
+	}
139
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT', GETPOST("fieldfirstsubscriptionamount"), 'chaine', 0, '', $conf->entity)) {
140
+		$error++;
141
+	}
142
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE', GETPOST("fieldlastsubscriptiondate"), 'chaine', 0, '', $conf->entity)) {
143
+		$error++;
144
+	}
145
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT', GETPOST("fieldlastsubscriptionamount"), 'chaine', 0, '', $conf->entity)) {
146
+		$error++;
147
+	}
87 148
 
88 149
 	// This one must be after the others
89 150
 	$valkey = '';
90 151
 	$key = GETPOST("key");
91
-	if ($key) $valkey = $conf->global->$key;
92
-	if (!dolibarr_set_const($db, 'LDAP_KEY_MEMBERS', $valkey, 'chaine', 0, '', $conf->entity)) $error++;
152
+	if ($key) {
153
+		$valkey = $conf->global->$key;
154
+	}
155
+	if (!dolibarr_set_const($db, 'LDAP_KEY_MEMBERS', $valkey, 'chaine', 0, '', $conf->entity)) {
156
+		$error++;
157
+	}
93 158
 
94 159
 	if (!$error)
95 160
 	{
Please login to merge, or discard this patch.
htdocs/admin/menus.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 $langs->loadLangs(array("companies", "products", "admin", "users", "other"));
35 35
 
36 36
 // Security check
37
-if (!$user->admin) accessforbidden();
37
+if (!$user->admin) {
38
+	accessforbidden();
39
+}
38 40
 
39 41
 $dirstandard = array();
40 42
 $dirsmartphone = array();
@@ -74,8 +76,12 @@  discard block
 block discarded – undo
74 76
 	$listofmenuhandler = array();
75 77
 	$listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i', '', GETPOST('MAIN_MENU_STANDARD', 'alpha'))] = 1;
76 78
 	$listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i', '', GETPOST('MAIN_MENUFRONT_STANDARD', 'alpha'))] = 1;
77
-	if (GETPOST('MAIN_MENU_SMARTPHONE', 'alpha'))      $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i', '', GETPOST('MAIN_MENU_SMARTPHONE', 'alpha'))] = 1;
78
-	if (GETPOST('MAIN_MENUFRONT_SMARTPHONE', 'alpha')) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i', '', GETPOST('MAIN_MENUFRONT_SMARTPHONE', 'alpha'))] = 1;
79
+	if (GETPOST('MAIN_MENU_SMARTPHONE', 'alpha')) {
80
+		$listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i', '', GETPOST('MAIN_MENU_SMARTPHONE', 'alpha'))] = 1;
81
+	}
82
+	if (GETPOST('MAIN_MENUFRONT_SMARTPHONE', 'alpha')) {
83
+		$listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i', '', GETPOST('MAIN_MENUFRONT_SMARTPHONE', 'alpha'))] = 1;
84
+	}
79 85
 
80 86
 	// Initialize menu handlers
81 87
 	foreach ($listofmenuhandler as $key => $val)
Please login to merge, or discard this patch.
htdocs/admin/debugbar.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@
 block discarded – undo
29 29
 
30 30
 global $conf;
31 31
 
32
-if (!$user->admin) accessforbidden();
32
+if (!$user->admin) {
33
+	accessforbidden();
34
+}
33 35
 
34 36
 // Load translation files required by the page
35 37
 $langs->loadLangs(array("admin", "other"));
Please login to merge, or discard this patch.
htdocs/admin/socialnetworks.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@
 block discarded – undo
30 30
 // Load translation files required by the page
31 31
 $langs->loadLangs(array("admin", "errors"));
32 32
 
33
-if (!$user->admin) accessforbidden();
33
+if (!$user->admin) {
34
+	accessforbidden();
35
+}
34 36
 
35 37
 $type = array('yesno', 'texte', 'chaine');
36 38
 
Please login to merge, or discard this patch.
htdocs/admin/geoipmaxmind.php 1 patch
Braces   +35 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
29 29
 
30 30
 // Security check
31
-if (!$user->admin)
32
-accessforbidden();
31
+if (!$user->admin) {
32
+	accessforbidden();
33
+}
33 34
 
34 35
 // Load translation files required by the page
35 36
 $langs->loadLangs(array("admin", "errors"));
@@ -56,10 +57,14 @@  discard block
 block discarded – undo
56 57
 	if (!$error)
57 58
 	{
58 59
 		$res1 = dolibarr_set_const($db, "GEOIP_VERSION", GETPOST('geoipversion', 'aZ09'), 'chaine', 0, '', $conf->entity);
59
-		if (!$res1 > 0) $error++;
60
+		if (!$res1 > 0) {
61
+			$error++;
62
+		}
60 63
 
61 64
 		$res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
62
-		if (!$res2 > 0) $error++;
65
+		if (!$res2 > 0) {
66
+			$error++;
67
+		}
63 68
 
64 69
 		if (!$error)
65 70
 		{
@@ -70,7 +75,9 @@  discard block
 block discarded – undo
70 75
 	}
71 76
 }
72 77
 
73
-if (!isset($conf->global->GEOIP_VERSION)) $conf->global->GEOIP_VERSION = '2';
78
+if (!isset($conf->global->GEOIP_VERSION)) {
79
+	$conf->global->GEOIP_VERSION = '2';
80
+}
74 81
 
75 82
 
76 83
 /*
@@ -110,7 +117,9 @@  discard block
 block discarded – undo
110 117
 print $form->selectarray('geoipversion', $arrayofvalues, (isset($conf->global->GEOIP_VERSION) ? $conf->global->GEOIP_VERSION : '2'));
111 118
 if ($conf->global->GEOIP_VERSION == 'php')
112 119
 {
113
-	if ($geoip) $version = $geoip->getVersion();
120
+	if ($geoip) {
121
+		$version = $geoip->getVersion();
122
+	}
114 123
 	if ($version)
115 124
 	{
116 125
 		print '<br>'.$langs->trans("Version").': '.$version;
@@ -153,14 +162,20 @@  discard block
 block discarded – undo
153 162
 	$ip = '24.24.24.24';
154 163
 	print '<br>'.$ip.' -> ';
155 164
 	$result = dol_print_ip($ip, 1);
156
-	if ($result) print $result;
157
-	else print $langs->trans("Error");
165
+	if ($result) {
166
+		print $result;
167
+	} else {
168
+		print $langs->trans("Error");
169
+	}
158 170
 
159 171
 	$ip = '2a01:e0a:7e:4a60:429a:23ff:f7b8:dc8a'; // should be France
160 172
 	print '<br>'.$ip.' -> ';
161 173
 	$result = dol_print_ip($ip, 1);
162
-	if ($result) print $result;
163
-	else print $langs->trans("Error");
174
+	if ($result) {
175
+		print $result;
176
+	} else {
177
+		print $langs->trans("Error");
178
+	}
164 179
 
165 180
 
166 181
 	/* We disable this test because dol_print_ip need an ip as input
@@ -178,13 +193,19 @@  discard block
 block discarded – undo
178 193
 	{
179 194
 		print '<br>'.$ip.' -> ';
180 195
 		$result = dol_print_ip($ip, 1);
181
-		if ($result) print $result;
182
-		else print $langs->trans("Error");
196
+		if ($result) {
197
+			print $result;
198
+		} else {
199
+			print $langs->trans("Error");
200
+		}
183 201
 	} else {
184 202
 		print '<br>'.$ip.' -> ';
185 203
 		$result = dol_print_ip($ip, 1);
186
-		if ($result) print $result;
187
-		else print $langs->trans("NotAPublicIp");
204
+		if ($result) {
205
+			print $result;
206
+		} else {
207
+			print $langs->trans("NotAPublicIp");
208
+		}
188 209
 	}
189 210
 
190 211
 	$geoip->close();
Please login to merge, or discard this patch.
htdocs/admin/ldap_users.php 1 patch
Braces   +89 added lines, -30 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
 // Load translation files required by the page
38 38
 $langs->loadLangs(array('admin', 'errors'));
39 39
 
40
-if (!$user->admin)
40
+if (!$user->admin) {
41 41
   accessforbidden();
42
+}
42 43
 
43 44
 $action = GETPOST('action', 'aZ09');
44 45
 
@@ -51,39 +52,97 @@  discard block
 block discarded – undo
51 52
 	$error = 0;
52 53
 	$db->begin();
53 54
 
54
-	if (!dolibarr_set_const($db, 'LDAP_USER_DN', GETPOST("user"), 'chaine', 0, '', $conf->entity)) $error++;
55
-	if (!dolibarr_set_const($db, 'LDAP_USER_OBJECT_CLASS', GETPOST("objectclass"), 'chaine', 0, '', $conf->entity)) $error++;
56
-	if (!dolibarr_set_const($db, 'LDAP_FILTER_CONNECTION', GETPOST("filterconnection"), 'chaine', 0, '', $conf->entity)) $error++;
57
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_FULLNAME', GETPOST("fieldfullname"), 'chaine', 0, '', $conf->entity)) $error++;
58
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_LOGIN', GETPOST("fieldlogin"), 'chaine', 0, '', $conf->entity)) $error++;
59
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_LOGIN_SAMBA', GETPOST("fieldloginsamba"), 'chaine', 0, '', $conf->entity)) $error++;
60
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_PASSWORD', GETPOST("fieldpassword"), 'chaine', 0, '', $conf->entity)) $error++;
61
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_PASSWORD_CRYPTED', GETPOST("fieldpasswordcrypted"), 'chaine', 0, '', $conf->entity)) $error++;
62
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_NAME', GETPOST("fieldname"), 'chaine', 0, '', $conf->entity)) $error++;
63
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_FIRSTNAME', GETPOST("fieldfirstname"), 'chaine', 0, '', $conf->entity)) $error++;
64
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_MAIL', GETPOST("fieldmail"), 'chaine', 0, '', $conf->entity)) $error++;
65
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_PHONE', GETPOST("fieldphone"), 'chaine', 0, '', $conf->entity)) $error++;
66
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_MOBILE', GETPOST("fieldmobile"), 'chaine', 0, '', $conf->entity)) $error++;
67
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_SKYPE', GETPOST("fieldskype"), 'chaine', 0, '', $conf->entity)) $error++;
68
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_FAX', GETPOST("fieldfax"), 'chaine', 0, '', $conf->entity)) $error++;
69
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_COMPANY', GETPOST("fieldcompany"), 'chaine', 0, '', $conf->entity)) $error++;
70
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_ADDRESS', GETPOST("fieldaddress"), 'chaine', 0, '', $conf->entity)) $error++;
71
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_ZIP', GETPOST("fieldzip"), 'chaine', 0, '', $conf->entity)) $error++;
72
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_TOWN', GETPOST("fieldtown"), 'chaine', 0, '', $conf->entity)) $error++;
73
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_COUNTRY', GETPOST("fieldcountry"), 'chaine', 0, '', $conf->entity)) $error++;
74
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION', GETPOST("fielddescription"), 'chaine', 0, '', $conf->entity)) $error++;
75
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_SID', GETPOST("fieldsid"), 'chaine', 0, '', $conf->entity)) $error++;
76
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_TITLE', GETPOST("fieldtitle"), 'chaine', 0, '', $conf->entity)) $error++;
77
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_GROUPID', GETPOST("fieldgroupid"), 'chaine', 0, '', $conf->entity)) $error++;
78
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_USERID', GETPOST("fielduserid"), 'chaine', 0, '', $conf->entity)) $error++;
79
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_HOMEDIRECTORY', GETPOST("fieldhomedirectory"), 'chaine', 0, '', $conf->entity)) $error++;
80
-	if (!dolibarr_set_const($db, 'LDAP_FIELD_HOMEDIRECTORYPREFIX', GETPOST("fieldhomedirectoryprefix"), 'chaine', 0, '', $conf->entity)) $error++;
55
+	if (!dolibarr_set_const($db, 'LDAP_USER_DN', GETPOST("user"), 'chaine', 0, '', $conf->entity)) {
56
+		$error++;
57
+	}
58
+	if (!dolibarr_set_const($db, 'LDAP_USER_OBJECT_CLASS', GETPOST("objectclass"), 'chaine', 0, '', $conf->entity)) {
59
+		$error++;
60
+	}
61
+	if (!dolibarr_set_const($db, 'LDAP_FILTER_CONNECTION', GETPOST("filterconnection"), 'chaine', 0, '', $conf->entity)) {
62
+		$error++;
63
+	}
64
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_FULLNAME', GETPOST("fieldfullname"), 'chaine', 0, '', $conf->entity)) {
65
+		$error++;
66
+	}
67
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_LOGIN', GETPOST("fieldlogin"), 'chaine', 0, '', $conf->entity)) {
68
+		$error++;
69
+	}
70
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_LOGIN_SAMBA', GETPOST("fieldloginsamba"), 'chaine', 0, '', $conf->entity)) {
71
+		$error++;
72
+	}
73
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_PASSWORD', GETPOST("fieldpassword"), 'chaine', 0, '', $conf->entity)) {
74
+		$error++;
75
+	}
76
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_PASSWORD_CRYPTED', GETPOST("fieldpasswordcrypted"), 'chaine', 0, '', $conf->entity)) {
77
+		$error++;
78
+	}
79
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_NAME', GETPOST("fieldname"), 'chaine', 0, '', $conf->entity)) {
80
+		$error++;
81
+	}
82
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_FIRSTNAME', GETPOST("fieldfirstname"), 'chaine', 0, '', $conf->entity)) {
83
+		$error++;
84
+	}
85
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_MAIL', GETPOST("fieldmail"), 'chaine', 0, '', $conf->entity)) {
86
+		$error++;
87
+	}
88
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_PHONE', GETPOST("fieldphone"), 'chaine', 0, '', $conf->entity)) {
89
+		$error++;
90
+	}
91
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_MOBILE', GETPOST("fieldmobile"), 'chaine', 0, '', $conf->entity)) {
92
+		$error++;
93
+	}
94
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_SKYPE', GETPOST("fieldskype"), 'chaine', 0, '', $conf->entity)) {
95
+		$error++;
96
+	}
97
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_FAX', GETPOST("fieldfax"), 'chaine', 0, '', $conf->entity)) {
98
+		$error++;
99
+	}
100
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_COMPANY', GETPOST("fieldcompany"), 'chaine', 0, '', $conf->entity)) {
101
+		$error++;
102
+	}
103
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_ADDRESS', GETPOST("fieldaddress"), 'chaine', 0, '', $conf->entity)) {
104
+		$error++;
105
+	}
106
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_ZIP', GETPOST("fieldzip"), 'chaine', 0, '', $conf->entity)) {
107
+		$error++;
108
+	}
109
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_TOWN', GETPOST("fieldtown"), 'chaine', 0, '', $conf->entity)) {
110
+		$error++;
111
+	}
112
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_COUNTRY', GETPOST("fieldcountry"), 'chaine', 0, '', $conf->entity)) {
113
+		$error++;
114
+	}
115
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION', GETPOST("fielddescription"), 'chaine', 0, '', $conf->entity)) {
116
+		$error++;
117
+	}
118
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_SID', GETPOST("fieldsid"), 'chaine', 0, '', $conf->entity)) {
119
+		$error++;
120
+	}
121
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_TITLE', GETPOST("fieldtitle"), 'chaine', 0, '', $conf->entity)) {
122
+		$error++;
123
+	}
124
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_GROUPID', GETPOST("fieldgroupid"), 'chaine', 0, '', $conf->entity)) {
125
+		$error++;
126
+	}
127
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_USERID', GETPOST("fielduserid"), 'chaine', 0, '', $conf->entity)) {
128
+		$error++;
129
+	}
130
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_HOMEDIRECTORY', GETPOST("fieldhomedirectory"), 'chaine', 0, '', $conf->entity)) {
131
+		$error++;
132
+	}
133
+	if (!dolibarr_set_const($db, 'LDAP_FIELD_HOMEDIRECTORYPREFIX', GETPOST("fieldhomedirectoryprefix"), 'chaine', 0, '', $conf->entity)) {
134
+		$error++;
135
+	}
81 136
 
82 137
 	// This one must be after the others
83 138
 	$valkey = '';
84 139
 	$key = GETPOST("key");
85
-	if ($key) $valkey = $conf->global->$key;
86
-	if (!dolibarr_set_const($db, 'LDAP_KEY_USERS', $valkey, 'chaine', 0, '', $conf->entity)) $error++;
140
+	if ($key) {
141
+		$valkey = $conf->global->$key;
142
+	}
143
+	if (!dolibarr_set_const($db, 'LDAP_KEY_USERS', $valkey, 'chaine', 0, '', $conf->entity)) {
144
+		$error++;
145
+	}
87 146
 
88 147
 	if (!$error)
89 148
 	{
Please login to merge, or discard this patch.
htdocs/admin/expensereport_rules.php 1 patch
Braces   +31 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 // Load translation files required by the page
35 35
 $langs->loadLangs(array("admin", "other", "trips", "errors", "dict"));
36 36
 
37
-if (!$user->admin) accessforbidden();
37
+if (!$user->admin) {
38
+	accessforbidden();
39
+}
38 40
 
39 41
 //Init error
40 42
 $error = false;
@@ -58,8 +60,10 @@  discard block
 block discarded – undo
58 60
 if (!empty($id))
59 61
 {
60 62
 	$result = $object->fetch($id);
61
-	if ($result < 0) dol_print_error('', $object->error, $object->errors);
62
-}
63
+	if ($result < 0) {
64
+		dol_print_error('', $object->error, $object->errors);
65
+	}
66
+	}
63 67
 
64 68
 // TODO do action
65 69
 if ($action == 'save')
@@ -116,8 +120,11 @@  discard block
 block discarded – undo
116 120
 		$object->entity = $conf->entity;
117 121
 
118 122
 		$res = $object->create($user);
119
-		if ($res > 0) setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
120
-		else dol_print_error($object->db);
123
+		if ($res > 0) {
124
+			setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
125
+		} else {
126
+			dol_print_error($object->db);
127
+		}
121 128
 
122 129
 		header('Location: '.$_SERVER['PHP_SELF']);
123 130
 		exit;
@@ -127,7 +134,9 @@  discard block
 block discarded – undo
127 134
 	// TODO add confirm
128 135
 	$res = $object->delete($user);
129 136
 
130
-	if ($res < 0) dol_print_error($object->db);
137
+	if ($res < 0) {
138
+		dol_print_error($object->db);
139
+	}
131 140
 
132 141
 	header('Location: '.$_SERVER['PHP_SELF']);
133 142
 	exit;
@@ -228,9 +237,13 @@  discard block
 block discarded – undo
228 237
 		echo '<div id="user" class="float">'.$form->select_dolusers($object->fk_user, 'fk_user').'</div>';
229 238
 		echo '<div id="group" class="float">'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'</div>';
230 239
 	} else {
231
-		if ($rule->is_for_all > 0) echo $tab_apply['A'];
232
-		elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
233
-		elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')';
240
+		if ($rule->is_for_all > 0) {
241
+			echo $tab_apply['A'];
242
+		} elseif ($rule->fk_usergroup > 0) {
243
+			echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
244
+		} elseif ($rule->fk_user > 0) {
245
+			echo $tab_apply['U'].' ('.$rule->getUserName().')';
246
+		}
234 247
 	}
235 248
 	echo '</td>';
236 249
 
@@ -240,11 +253,16 @@  discard block
 block discarded – undo
240 253
 	{
241 254
 		echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
242 255
 	} else {
243
-		if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport');
244
-		else {
256
+		if ($rule->fk_c_type_fees == -1) {
257
+			echo $langs->trans('AllExpenseReport');
258
+		} else {
245 259
 			$key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
246
-			if ($key != $langs->trans($key)) echo $langs->trans($key);
247
-			else echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
260
+			if ($key != $langs->trans($key)) {
261
+				echo $langs->trans($key);
262
+			} else {
263
+				echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id'));
264
+			}
265
+			// TODO check to return trans of 'code'
248 266
 		}
249 267
 	}
250 268
 	echo '</td>';
Please login to merge, or discard this patch.
htdocs/admin/ldap_members_types.php 1 patch
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
36 36
 // Load translation files required by the page
37 37
 $langs->loadLangs(array('admin', 'errors'));
38 38
 
39
-if (!$user->admin)
39
+if (!$user->admin) {
40 40
 	accessforbidden();
41
+}
41 42
 
42 43
 $action = GETPOST('action', 'aZ09');
43 44
 
@@ -51,18 +52,32 @@  discard block
 block discarded – undo
51 52
 	$error = 0;
52 53
 	$db->begin();
53 54
 
54
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_DN', GETPOST("membertype"), 'chaine', 0, '', $conf->entity)) $error++;
55
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_OBJECT_CLASS', GETPOST("objectclass"), 'chaine', 0, '', $conf->entity)) $error++;
55
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_DN', GETPOST("membertype"), 'chaine', 0, '', $conf->entity)) {
56
+		$error++;
57
+	}
58
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_OBJECT_CLASS', GETPOST("objectclass"), 'chaine', 0, '', $conf->entity)) {
59
+		$error++;
60
+	}
56 61
 
57
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_FIELD_FULLNAME', GETPOST("fieldfullname"), 'chaine', 0, '', $conf->entity)) $error++;
58
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_FIELD_DESCRIPTION', GETPOST("fielddescription"), 'chaine', 0, '', $conf->entity)) $error++;
59
-	if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS', GETPOST("fieldmembertypemembers"), 'chaine', 0, '', $conf->entity)) $error++;
62
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_FIELD_FULLNAME', GETPOST("fieldfullname"), 'chaine', 0, '', $conf->entity)) {
63
+		$error++;
64
+	}
65
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_FIELD_DESCRIPTION', GETPOST("fielddescription"), 'chaine', 0, '', $conf->entity)) {
66
+		$error++;
67
+	}
68
+	if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS', GETPOST("fieldmembertypemembers"), 'chaine', 0, '', $conf->entity)) {
69
+		$error++;
70
+	}
60 71
 
61 72
 	// This one must be after the others
62 73
 	$valkey = '';
63 74
 	$key = GETPOST("key");
64
-	if ($key) $valkey = $conf->global->$key;
65
-	if (!dolibarr_set_const($db, 'LDAP_KEY_MEMBERS_TYPES', $valkey, 'chaine', 0, '', $conf->entity)) $error++;
75
+	if ($key) {
76
+		$valkey = $conf->global->$key;
77
+	}
78
+	if (!dolibarr_set_const($db, 'LDAP_KEY_MEMBERS_TYPES', $valkey, 'chaine', 0, '', $conf->entity)) {
79
+		$error++;
80
+	}
66 81
 
67 82
 	if (!$error)
68 83
 	{
Please login to merge, or discard this patch.
htdocs/admin/const.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,8 +30,9 @@  discard block
 block discarded – undo
30 30
 // Load translation files required by the page
31 31
 $langs->load("admin");
32 32
 
33
-if (!$user->admin)
33
+if (!$user->admin) {
34 34
 	accessforbidden();
35
+}
35 36
 
36 37
 $rowid = GETPOST('rowid', 'int');
37 38
 $entity = GETPOST('entity', 'int');
@@ -53,8 +54,12 @@  discard block
 block discarded – undo
53 54
 $offset = $limit * $page;
54 55
 $pageprev = $page - 1;
55 56
 $pagenext = $page + 1;
56
-if (empty($sortfield)) $sortfield = 'entity,name';
57
-if (empty($sortorder)) $sortorder = 'ASC';
57
+if (empty($sortfield)) {
58
+	$sortfield = 'entity,name';
59
+}
60
+if (empty($sortorder)) {
61
+	$sortorder = 'ASC';
62
+}
58 63
 
59 64
 
60 65
 /*
@@ -107,7 +112,9 @@  discard block
 block discarded – undo
107 112
 			}
108 113
 		}
109 114
 	}
110
-	if ($nbmodified > 0) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
115
+	if ($nbmodified > 0) {
116
+		setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
117
+	}
111 118
 	$action = '';
112 119
 }
113 120
 
@@ -117,17 +124,21 @@  discard block
 block discarded – undo
117 124
 	$nbdeleted = 0;
118 125
 	foreach ($consts as $const)
119 126
 	{
120
-		if (!empty($const["check"]))	// Is checkbox checked
127
+		if (!empty($const["check"])) {
128
+			// Is checkbox checked
121 129
 		{
122 130
 			if (dolibarr_del_const($db, $const["rowid"], -1) >= 0)
123 131
 			{
124 132
 				$nbdeleted++;
133
+		}
125 134
 			} else {
126 135
 				dol_print_error($db);
127 136
 			}
128 137
 		}
129 138
 	}
130
-	if ($nbdeleted > 0) setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
139
+	if ($nbdeleted > 0) {
140
+		setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
141
+	}
131 142
 	$action = '';
132 143
 }
133 144
 
@@ -243,8 +254,13 @@  discard block
 block discarded – undo
243 254
 $sql .= " FROM ".MAIN_DB_PREFIX."const";
244 255
 $sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
245 256
 if ((empty($user->entity) || $user->admin) && $debug) {} 										// to force for superadmin to debug
246
-elseif (!GETPOST('visible') || GETPOST('visible') != 'all') $sql .= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
247
-if (GETPOST('name')) $sql .= natural_search("name", GETPOST('name'));
257
+elseif (!GETPOST('visible') || GETPOST('visible') != 'all') {
258
+	$sql .= " AND visible = 1";
259
+}
260
+// We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
261
+if (GETPOST('name')) {
262
+	$sql .= natural_search("name", GETPOST('name'));
263
+}
248 264
 $sql .= $db->order($sortfield, $sortorder);
249 265
 
250 266
 dol_syslog("Const::listConstant", LOG_DEBUG);
Please login to merge, or discard this patch.