Completed
Push — development ( 362b6c...477849 )
by Nils
08:04
created
install/upgrade_run_2.1.27.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -31,6 +31,9 @@
 block discarded – undo
31 31
 ################
32 32
 ## Function permits to get the value from a line
33 33
 ################
34
+/**
35
+ * @param string $val
36
+ */
34 37
 function getSettingValue($val)
35 38
 {
36 39
     $val = trim(strstr($val, "="));
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 function getSettingValue($val)
35 35
 {
36 36
     $val = trim(strstr($val, "="));
37
-    return trim(str_replace('"', '', substr($val, 1, strpos($val, ";")-1)));
37
+    return trim(str_replace('"', '', substr($val, 1, strpos($val, ";") - 1)));
38 38
 }
39 39
 
40 40
 ################
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     global $dbTmp;
46 46
     $exists = false;
47 47
     $columns = mysqli_query($dbTmp, "show columns from $db");
48
-    while ($c = mysqli_fetch_assoc( $columns)) {
48
+    while ($c = mysqli_fetch_assoc($columns)) {
49 49
         if ($c['Field'] == $column) {
50 50
             $exists = true;
51 51
             return true;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     }
59 59
 }
60 60
 
61
-function addIndexIfNotExist($table, $index, $sql ) {
61
+function addIndexIfNotExist($table, $index, $sql) {
62 62
     global $dbTmp;
63 63
 
64 64
     $mysqli_result = mysqli_query($dbTmp, "SHOW INDEX FROM $table WHERE key_name LIKE \"$index\"");
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     // if index does not exist, then add it
68 68
     if (!$res) {
69
-        $res = mysqli_query($dbTmp, "ALTER TABLE `$table` " . $sql);
69
+        $res = mysqli_query($dbTmp, "ALTER TABLE `$table` ".$sql);
70 70
     }
71 71
 
72 72
     return $res;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 // if yes, then don't execute re-encryption
153 153
 $_SESSION['tp_defuse_installed'] = false;
154 154
 $columns = mysqli_query($dbTmp, "show columns from ".$_SESSION['pre']."items");
155
-while ($c = mysqli_fetch_assoc( $columns)) {
155
+while ($c = mysqli_fetch_assoc($columns)) {
156 156
     if ($c['Field'] === "encryption_type") {
157 157
         $_SESSION['tp_defuse_installed'] = true;
158 158
     }
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 // do clean of users table
212 212
 $fieldsToUpdate = ['groupes_visibles', 'fonction_id', 'groupes_interdits'];
213 213
 $result = mysqli_query($dbTmp, "SELECT id, groupes_visibles, fonction_id, groupes_interdits FROM `".$_SESSION['pre']."users`");
214
-while($row = mysqli_fetch_assoc($result)) {
214
+while ($row = mysqli_fetch_assoc($result)) {
215 215
     // check if field contains , instead of ;
216
-    foreach($fieldsToUpdate as $field) {
216
+    foreach ($fieldsToUpdate as $field) {
217 217
         $tmp = cleanFields($row[$field]);
218 218
         if ($tmp !== $row[$field]) {
219 219
             mysqli_query($dbTmp,
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
 if (!isset($_SESSION['tp_defuse_installed']) || $_SESSION['tp_defuse_installed'] === false) {
335 335
     $filename = "../includes/config/settings.php";
336 336
     $settingsFile = file($filename);
337
-    while (list($key,$val) = each($settingsFile)) {
338
-        if (substr_count($val, 'require_once "')>0 && substr_count($val, 'sk.php')>0) {
339
-            $_SESSION['sk_file'] = substr($val, 14, strpos($val, '";')-14);
337
+    while (list($key, $val) = each($settingsFile)) {
338
+        if (substr_count($val, 'require_once "') > 0 && substr_count($val, 'sk.php') > 0) {
339
+            $_SESSION['sk_file'] = substr($val, 14, strpos($val, '";') - 14);
340 340
         }
341 341
     }
342 342
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             $dbTmp,
381 381
             "SELECT id FROM `".$_SESSION['pre']."users`"
382 382
         );
383
-        while($row_user = mysqli_fetch_assoc($result)) {
383
+        while ($row_user = mysqli_fetch_assoc($result)) {
384 384
             $result_items = mysqli_query(
385 385
                 $dbTmp,
386 386
                 "SELECT i.id AS item_id
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `".$_SESSION['pre']."misc` WHERE type = 'admin' AND intitule = 'send_stats_time'"));
455 455
 if ($tmp === "0") {
456 456
     mysqli_query($dbTmp,
457
-        "INSERT INTO `".$_SESSION['pre']."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'send_stats_time', '".(time()-2592000)."')"
457
+        "INSERT INTO `".$_SESSION['pre']."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'send_stats_time', '".(time() - 2592000)."')"
458 458
     );
459 459
 }
460 460
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -83,16 +83,27 @@
 block discarded – undo
83 83
         AND table_name = '$tablename'"
84 84
     );
85 85
 
86
-    if ($res > 0) return true;
87
-    else return false;
88
-}
86
+    if ($res > 0) {
87
+        return true;
88
+    } else {
89
+        return false;
90
+    }
91
+    }
89 92
 
90 93
 function cleanFields($txt) {
91 94
     $tmp = str_replace(",", ";", trim($txt));
92
-    if (empty($tmp)) return $tmp;
93
-    if ($tmp === ";") return "";
94
-    if (strpos($tmp, ';') === 0) $tmp = substr($tmp, 1);
95
-    if (substr($tmp, -1) !== ";") $tmp = $tmp.";";
95
+    if (empty($tmp)) {
96
+        return $tmp;
97
+    }
98
+    if ($tmp === ";") {
99
+        return "";
100
+    }
101
+    if (strpos($tmp, ';') === 0) {
102
+        $tmp = substr($tmp, 1);
103
+    }
104
+    if (substr($tmp, -1) !== ";") {
105
+        $tmp = $tmp.";";
106
+    }
96 107
     return $tmp;
97 108
 }
98 109
 
Please login to merge, or discard this patch.
install/upgrade_run_db_original.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@
 block discarded – undo
37 37
 ################
38 38
 ## Function permits to get the value from a line
39 39
 ################
40
+/**
41
+ * @param string $val
42
+ */
40 43
 function getSettingValue($val)
41 44
 {
42 45
     $val = trim(strstr($val, "="));
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 function getSettingValue($val)
41 41
 {
42 42
     $val = trim(strstr($val, "="));
43
-    return trim(str_replace('"', '', substr($val, 1, strpos($val, ";")-1)));
43
+    return trim(str_replace('"', '', substr($val, 1, strpos($val, ";") - 1)));
44 44
 }
45 45
 
46 46
 ################
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     global $dbTmp;
52 52
     $exists = false;
53 53
     $columns = mysqli_query($dbTmp, "show columns from $db");
54
-    while ($c = mysqli_fetch_assoc( $columns)) {
54
+    while ($c = mysqli_fetch_assoc($columns)) {
55 55
         if ($c['Field'] == $column) {
56 56
             $exists = true;
57 57
             return true;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     }
65 65
 }
66 66
 
67
-function addIndexIfNotExist($table, $index, $sql ) {
67
+function addIndexIfNotExist($table, $index, $sql) {
68 68
     global $dbTmp;
69 69
 
70 70
     $mysqli_result = mysqli_query($dbTmp, "SHOW INDEX FROM $table WHERE key_name LIKE \"$index\"");
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
     // if index does not exist, then add it
74 74
     if (!$res) {
75
-        $res = mysqli_query($dbTmp, "ALTER TABLE `$table` " . $sql);
75
+        $res = mysqli_query($dbTmp, "ALTER TABLE `$table` ".$sql);
76 76
     }
77 77
 
78 78
     return $res;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 // if yes, then don't execute re-encryption
129 129
 $_SESSION['tp_defuse_installed'] = false;
130 130
 $columns = mysqli_query($dbTmp, "show columns from ".$_SESSION['pre']."items");
131
-while ($c = mysqli_fetch_assoc( $columns)) {
131
+while ($c = mysqli_fetch_assoc($columns)) {
132 132
     if ($c['Field'] === "encryption_type") {
133 133
         $_SESSION['tp_defuse_installed'] = true;
134 134
     }
@@ -137,49 +137,49 @@  discard block
 block discarded – undo
137 137
 
138 138
 ## Populate table MISC
139 139
 $val = array(
140
-    array('admin', 'max_latest_items', '10',0),
141
-    array('admin', 'enable_favourites', '1',0),
142
-    array('admin', 'show_last_items', '1',0),
143
-    array('admin', 'enable_pf_feature', '0',0),
144
-    array('admin', 'menu_type', 'context',0),
145
-    array('admin', 'log_connections', '0',0),
146
-    array('admin', 'time_format', 'H:i:s',0),
147
-    array('admin', 'date_format', 'd/m/Y',0),
148
-    array('admin', 'duplicate_folder', '0',0),
149
-    array('admin', 'duplicate_item', '0',0),
150
-    array('admin', 'item_duplicate_in_same_folder', '0',0),
151
-    array('admin', 'number_of_used_pw', '3',0),
152
-    array('admin', 'manager_edit', '1',0),
153
-    array('admin', 'cpassman_dir', '',0),
154
-    array('admin', 'cpassman_url', '',0),
155
-    array('admin', 'favicon', '',0),
156
-    array('admin', 'activate_expiration', '0',0),
157
-    array('admin', 'pw_life_duration','30',0),
140
+    array('admin', 'max_latest_items', '10', 0),
141
+    array('admin', 'enable_favourites', '1', 0),
142
+    array('admin', 'show_last_items', '1', 0),
143
+    array('admin', 'enable_pf_feature', '0', 0),
144
+    array('admin', 'menu_type', 'context', 0),
145
+    array('admin', 'log_connections', '0', 0),
146
+    array('admin', 'time_format', 'H:i:s', 0),
147
+    array('admin', 'date_format', 'd/m/Y', 0),
148
+    array('admin', 'duplicate_folder', '0', 0),
149
+    array('admin', 'duplicate_item', '0', 0),
150
+    array('admin', 'item_duplicate_in_same_folder', '0', 0),
151
+    array('admin', 'number_of_used_pw', '3', 0),
152
+    array('admin', 'manager_edit', '1', 0),
153
+    array('admin', 'cpassman_dir', '', 0),
154
+    array('admin', 'cpassman_url', '', 0),
155
+    array('admin', 'favicon', '', 0),
156
+    array('admin', 'activate_expiration', '0', 0),
157
+    array('admin', 'pw_life_duration', '30', 0),
158 158
     //array('admin', 'maintenance_mode','1',1),
159
-    array('admin', 'cpassman_version',$k['version'],1),
160
-    array('admin', 'ldap_mode','0',0),
161
-    array('admin','ldap_type','0',0),
162
-    array('admin','ldap_suffix','0',0),
163
-    array('admin','ldap_domain_dn','0',0),
164
-    array('admin','ldap_domain_controler','0',0),
165
-    array('admin','ldap_user_attribute','0',0),
166
-    array('admin','ldap_ssl','0',0),
167
-    array('admin','ldap_tls','0',0),
168
-    array('admin','ldap_elusers','0',0),
169
-    array('admin', 'richtext',0,0),
170
-    array('admin', 'allow_print',0,0),
171
-    array('admin', 'roles_allowed_to_print',0,0),
172
-    array('admin', 'show_description',1,0),
173
-    array('admin', 'anyone_can_modify',0,0),
174
-    array('admin', 'anyone_can_modify_bydefault',0,0),
175
-    array('admin', 'nb_bad_authentication',0,0),
176
-    array('admin', 'restricted_to',0,0),
177
-    array('admin', 'restricted_to_roles',0,0),
178
-    array('admin', 'utf8_enabled',1,0),
179
-    array('admin', 'custom_logo','',0),
180
-    array('admin', 'custom_login_text','',0),
181
-    array('admin', 'log_accessed', '1',1),
182
-    array('admin', 'default_language', 'english',0),
159
+    array('admin', 'cpassman_version', $k['version'], 1),
160
+    array('admin', 'ldap_mode', '0', 0),
161
+    array('admin', 'ldap_type', '0', 0),
162
+    array('admin', 'ldap_suffix', '0', 0),
163
+    array('admin', 'ldap_domain_dn', '0', 0),
164
+    array('admin', 'ldap_domain_controler', '0', 0),
165
+    array('admin', 'ldap_user_attribute', '0', 0),
166
+    array('admin', 'ldap_ssl', '0', 0),
167
+    array('admin', 'ldap_tls', '0', 0),
168
+    array('admin', 'ldap_elusers', '0', 0),
169
+    array('admin', 'richtext', 0, 0),
170
+    array('admin', 'allow_print', 0, 0),
171
+    array('admin', 'roles_allowed_to_print', 0, 0),
172
+    array('admin', 'show_description', 1, 0),
173
+    array('admin', 'anyone_can_modify', 0, 0),
174
+    array('admin', 'anyone_can_modify_bydefault', 0, 0),
175
+    array('admin', 'nb_bad_authentication', 0, 0),
176
+    array('admin', 'restricted_to', 0, 0),
177
+    array('admin', 'restricted_to_roles', 0, 0),
178
+    array('admin', 'utf8_enabled', 1, 0),
179
+    array('admin', 'custom_logo', '', 0),
180
+    array('admin', 'custom_login_text', '', 0),
181
+    array('admin', 'log_accessed', '1', 1),
182
+    array('admin', 'default_language', 'english', 0),
183 183
     array(
184 184
         'admin',
185 185
         'send_stats',
@@ -195,16 +195,16 @@  discard block
 block discarded – undo
195 195
         'admin',
196 196
         'path_to_upload_folder',
197 197
         strrpos($_SERVER['DOCUMENT_ROOT'], "/") == 1 ?
198
-            (strlen($_SERVER['DOCUMENT_ROOT'])-1).substr(
198
+            (strlen($_SERVER['DOCUMENT_ROOT']) - 1).substr(
199 199
                 $_SERVER['PHP_SELF'],
200 200
                 0,
201
-                strlen($_SERVER['PHP_SELF'])-25
201
+                strlen($_SERVER['PHP_SELF']) - 25
202 202
             ).'/upload'
203 203
         :
204 204
         $_SERVER['DOCUMENT_ROOT'].substr(
205 205
             $_SERVER['PHP_SELF'],
206 206
             0,
207
-            strlen($_SERVER['PHP_SELF'])-25
207
+            strlen($_SERVER['PHP_SELF']) - 25
208 208
         ).'/upload',
209 209
         0
210 210
     ),
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         'http://'.$_SERVER['HTTP_HOST'].substr(
215 215
             $_SERVER['PHP_SELF'],
216 216
             0,
217
-            strrpos($_SERVER['PHP_SELF'], '/')-8
217
+            strrpos($_SERVER['PHP_SELF'], '/') - 8
218 218
         ).'/upload',
219 219
         0
220 220
     ),
@@ -224,16 +224,16 @@  discard block
 block discarded – undo
224 224
         'admin',
225 225
         'path_to_files_folder',
226 226
         strrpos($_SERVER['DOCUMENT_ROOT'], "/") == 1 ?
227
-        (strlen($_SERVER['DOCUMENT_ROOT'])-1).substr(
227
+        (strlen($_SERVER['DOCUMENT_ROOT']) - 1).substr(
228 228
             $_SERVER['PHP_SELF'],
229 229
             0,
230
-            strlen($_SERVER['PHP_SELF'])-25
230
+            strlen($_SERVER['PHP_SELF']) - 25
231 231
         ).'/files'
232 232
         :
233 233
         $_SERVER['DOCUMENT_ROOT'].substr(
234 234
             $_SERVER['PHP_SELF'],
235 235
             0,
236
-            strlen($_SERVER['PHP_SELF'])-25
236
+            strlen($_SERVER['PHP_SELF']) - 25
237 237
         ).'/files',
238 238
         0
239 239
     ),
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
         'http://'.$_SERVER['HTTP_HOST'].substr(
244 244
             $_SERVER['PHP_SELF'],
245 245
             0,
246
-            strrpos($_SERVER['PHP_SELF'], '/')-8
246
+            strrpos($_SERVER['PHP_SELF'], '/') - 8
247 247
         ).'/files',
248 248
         0
249 249
     ),
250
-    array('admin', 'pwd_maximum_length','40',0),
251
-    array('admin', 'ga_website_name','TeamPass for ChangeMe',0),
250
+    array('admin', 'pwd_maximum_length', '40', 0),
251
+    array('admin', 'ga_website_name', 'TeamPass for ChangeMe', 0),
252 252
     array('admin', 'email_smtp_server', @$_SESSION['smtp_server'], 0),
253 253
     array('admin', 'email_smtp_auth', @$_SESSION['smtp_auth'], 0),
254 254
     array('admin', 'email_auth_username', @$_SESSION['smtp_auth_username'], 0),
@@ -259,43 +259,43 @@  discard block
 block discarded – undo
259 259
     array('admin', 'email_from_name', @$_SESSION['email_from_name'], 0),
260 260
     array('admin', 'google_authentication', 0, 0),
261 261
     array('admin', 'delay_item_edition', 0, 0),
262
-    array('admin', 'allow_import',0,0),
263
-    array('admin', 'proxy_port',0,0),
264
-    array('admin', 'proxy_port',0,0),
265
-    array('admin','upload_maxfilesize','10mb',0),
262
+    array('admin', 'allow_import', 0, 0),
263
+    array('admin', 'proxy_port', 0, 0),
264
+    array('admin', 'proxy_port', 0, 0),
265
+    array('admin', 'upload_maxfilesize', '10mb', 0),
266 266
     array(
267 267
         'admin',
268 268
         'upload_docext',
269 269
         'doc,docx,dotx,xls,xlsx,xltx,rtf,csv,txt,pdf,ppt,pptx,pot,dotx,xltx',
270 270
         0
271 271
     ),
272
-    array('admin','upload_imagesext','jpg,jpeg,gif,png',0),
273
-    array('admin','upload_pkgext','7z,rar,tar,zip',0),
274
-    array('admin','upload_otherext','sql,xml',0),
275
-    array('admin','upload_imageresize_options','1',0),
276
-    array('admin','upload_imageresize_width','800',0),
277
-    array('admin','upload_imageresize_height','600',0),
278
-    array('admin','upload_imageresize_quality','90',0),
279
-    array('admin','enable_send_email_on_user_login','0', 0),
280
-    array('admin','enable_user_can_create_folders','0', 0),
281
-    array('admin','insert_manual_entry_item_history','0', 0),
282
-    array('admin','enable_kb','0', 0),
283
-    array('admin','enable_email_notification_on_item_shown','0', 0),
284
-    array('admin','enable_email_notification_on_user_pw_change','0', 0),
285
-    array('admin','enable_sts','0', 0),
286
-    array('admin','encryptClientServer','1', 0),
287
-    array('admin','use_md5_password_as_salt','0', 0),
288
-    array('admin','api','0', 0),
272
+    array('admin', 'upload_imagesext', 'jpg,jpeg,gif,png', 0),
273
+    array('admin', 'upload_pkgext', '7z,rar,tar,zip', 0),
274
+    array('admin', 'upload_otherext', 'sql,xml', 0),
275
+    array('admin', 'upload_imageresize_options', '1', 0),
276
+    array('admin', 'upload_imageresize_width', '800', 0),
277
+    array('admin', 'upload_imageresize_height', '600', 0),
278
+    array('admin', 'upload_imageresize_quality', '90', 0),
279
+    array('admin', 'enable_send_email_on_user_login', '0', 0),
280
+    array('admin', 'enable_user_can_create_folders', '0', 0),
281
+    array('admin', 'insert_manual_entry_item_history', '0', 0),
282
+    array('admin', 'enable_kb', '0', 0),
283
+    array('admin', 'enable_email_notification_on_item_shown', '0', 0),
284
+    array('admin', 'enable_email_notification_on_user_pw_change', '0', 0),
285
+    array('admin', 'enable_sts', '0', 0),
286
+    array('admin', 'encryptClientServer', '1', 0),
287
+    array('admin', 'use_md5_password_as_salt', '0', 0),
288
+    array('admin', 'api', '0', 0),
289 289
     array('admin', 'subfolder_rights_as_parent', '0', 0),
290 290
     array('admin', 'show_only_accessible_folders', '0', 0),
291 291
     array('admin', 'enable_suggestion', '0', 0),
292 292
     array('admin', 'email_server_url', '', 0),
293
-    array('admin','otv_expiration_period','7', 0),
294
-    array('admin','default_session_expiration_time','60', 0),
295
-    array('admin','duo','0', 0),
296
-    array('admin','enable_server_password_change','0', 0),
297
-    array('admin','bck_script_path', $_SESSION['abspath']."/backups", 0),
298
-    array('admin','bck_script_filename', 'bck_cpassman', 0)
293
+    array('admin', 'otv_expiration_period', '7', 0),
294
+    array('admin', 'default_session_expiration_time', '60', 0),
295
+    array('admin', 'duo', '0', 0),
296
+    array('admin', 'enable_server_password_change', '0', 0),
297
+    array('admin', 'bck_script_path', $_SESSION['abspath']."/backups", 0),
298
+    array('admin', 'bck_script_filename', 'bck_cpassman', 0)
299 299
 );
300 300
 $res1 = "na";
301 301
 foreach ($val as $elem) {
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 );
606 606
 
607 607
 // Clean timestamp for users table
608
-mysqli_query($dbTmp,"UPDATE ".$_SESSION['pre']."users SET timestamp = ''");
608
+mysqli_query($dbTmp, "UPDATE ".$_SESSION['pre']."users SET timestamp = ''");
609 609
 
610 610
 ## Alter nested_tree table
611 611
 $res2 = addColumnIfNotExist(
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 );
700 700
 
701 701
 ## TABLE CACHE
702
-mysqli_query($dbTmp,"DROP TABLE IF EXISTS `".$_SESSION['pre']."cache`");
702
+mysqli_query($dbTmp, "DROP TABLE IF EXISTS `".$_SESSION['pre']."cache`");
703 703
 $res8 = mysqli_query($dbTmp,
704 704
     "CREATE TABLE IF NOT EXISTS `".$_SESSION['pre']."cache` (
705 705
     `id` int(12) NOT NULL,
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
             INNER JOIN ".$_SESSION['pre']."log_items as l ON (l.id_item = i.id)
723 723
             AND l.action = 'at_creation'
724 724
             WHERE i.inactif=0";
725
-    $rows = mysqli_query($dbTmp,$sql);
725
+    $rows = mysqli_query($dbTmp, $sql);
726 726
     while ($reccord = mysqli_fetch_array($rows)) {
727 727
         //Get all TAGS
728 728
         $tags = "";
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
         if (!empty($itemTags)) {
735 735
             foreach ($itemTags as $itemTag) {
736 736
                 if (!empty($itemTag['tag'])) {
737
-                    $tags .= $itemTag['tag']. " ";
737
+                    $tags .= $itemTag['tag']." ";
738 738
                 }
739 739
             }
740 740
         }
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
     );
869 869
 
870 870
     //Drop old table
871
-    mysqli_query($dbTmp,"DROP TABLE ".$_SESSION['pre']."functions");
871
+    mysqli_query($dbTmp, "DROP TABLE ".$_SESSION['pre']."functions");
872 872
 } elseif ($tableFunctionExists == false) {
873 873
     echo '[{"finish":"1", "msg":"", "error":"An error appears on table ROLES! '.addslashes(mysqli_error($dbTmp)).'"}]';
874 874
     mysqli_close($dbTmp);
@@ -962,9 +962,9 @@  discard block
 block discarded – undo
962 962
     exit();
963 963
 }
964 964
 $resTmp = mysqli_fetch_row(
965
-    mysqli_query($dbTmp,"SELECT COUNT(*) FROM ".$_SESSION['pre']."languages")
965
+    mysqli_query($dbTmp, "SELECT COUNT(*) FROM ".$_SESSION['pre']."languages")
966 966
 );
967
-mysqli_query($dbTmp,"TRUNCATE TABLE ".$_SESSION['pre']."languages");
967
+mysqli_query($dbTmp, "TRUNCATE TABLE ".$_SESSION['pre']."languages");
968 968
 mysqli_query($dbTmp,
969 969
     "INSERT IGNORE INTO `".$_SESSION['pre']."languages`
970 970
     (`id`, `name`, `label`, `code`, `flag`) VALUES
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,9 +89,12 @@
 block discarded – undo
89 89
         AND table_name = '$tablename'"
90 90
     );
91 91
 
92
-    if ($res > 0) return true;
93
-    else return false;
94
-}
92
+    if ($res > 0) {
93
+        return true;
94
+    } else {
95
+        return false;
96
+    }
97
+    }
95 98
 
96 99
 //define pbkdf2 iteration count
97 100
 @define('ITCOUNT', '2072');
Please login to merge, or discard this patch.
sources/import.queries.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -39,6 +39,9 @@
 block discarded – undo
39 39
  *
40 40
  * Used to format the string ready for insertion in to the database
41 41
  */
42
+/**
43
+ * @param string $crLFReplacement
44
+ */
42 45
 function sanitiseString($str, $crLFReplacement) {
43 46
     $str = preg_replace('#[\r\n]#', $crLFReplacement, $str);
44 47
     $str = str_replace('\\', '\', $str);
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
                     'id_tree' => $_POST['folder'],
276 276
                     'login' => substr($item[1], 0, 200),
277 277
                     'anyone_can_modify' => $_POST['import_csv_anyone_can_modify'] == "true" ? 1 : 0
278
-               )
278
+                )
279 279
             );
280 280
             $newId = DB::insertId();
281 281
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                         array(
288 288
                             'role_id' => $role['id'],
289 289
                             'item_id' => $newId
290
-                       )
290
+                        )
291 291
                     );
292 292
                 }
293 293
             }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
                     'date' => time(),
301 301
                     'id_user' => $_SESSION['user_id'],
302 302
                     'action' => 'at_creation'
303
-               )
303
+                )
304 304
             );
305 305
 
306 306
             if (empty($list)) {
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
                     'timestamp' => time(),
325 325
                     'tags' => '',
326 326
                     'restricted_to' => ''
327
-               )
327
+                )
328 328
             );
329 329
         }
330 330
         echo '[{"items":"'.$list.'"}]';
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 
358 358
         /**
359 359
         Recursive function that will permit to read each level of XML nodes
360
-        */
360
+         */
361 361
         function recursiveKeepassXML($xmlRoot, $xmlLevel = 0)
362 362
         {
363 363
             global $meta, $root, $group, $name, $entry, $levelMin, $key, $title, $notes, $pw, $username, $url,
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
                         $keepassVersion = 2;
516 516
                         break;
517 517
                     } elseif ($root == true && $xmlLevel > $levelMin) {
518
- //                       error_log($nom.",".$elem." - ");
518
+    //                       error_log($nom.",".$elem." - ");
519 519
                         //Check each node name and get data from some of them
520 520
                         if ($entry == true && $nom == "Key" && $elem == "Title") {
521 521
                             $title = true;
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
                                 'parent_id' => $parent_id,
722 722
                                 'title' => stripslashes($fold),
723 723
                                 'nlevel' => $folderLevel
724
-                           )
724
+                            )
725 725
                         );
726 726
                         $id = DB::insertId();
727 727
                         //Add complexity level => level is set to "medium" by default.
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
                                 'type' => 'complex',
732 732
                                 'intitule' => $id,
733 733
                                 'valeur' => $levelPwComplexity
734
-                           )
734
+                            )
735 735
                         );
736 736
 
737 737
                         //For each role to which the user depends on, add the folder just created.
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
                                     'role_id' => $role['id'],
743 743
                                     'folder_id' => $id,
744 744
                                     'type' => "W"
745
-                               )
745
+                                )
746 746
                             );
747 747
                         }
748 748
 
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
                                 'id_tree' => $folderId,
872 872
                                 'login' => substr(stripslashes($item[KP_USERNAME]), 0, 500),
873 873
                                 'anyone_can_modify' => $_POST['import_kps_anyone_can_modify'] == "true" ? 1 : 0
874
-                           )
874
+                            )
875 875
                         );
876 876
                         $newId = DB::insertId();
877 877
 
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
                                     array(
884 884
                                         'role_id' => $role['id'],
885 885
                                         'item_id' => $newId
886
-                                   )
886
+                                    )
887 887
                                 );
888 888
                             }
889 889
                         }
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
                                 'id_user' => $_SESSION['user_id'],
898 898
                                 'action' => 'at_creation',
899 899
                                 'raison' => 'at_import'
900
-                           )
900
+                            )
901 901
                         );
902 902
 
903 903
                         //Add entry to cache table
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
                                 'folder' => $data['title'],
914 914
                                 'author' => $_SESSION['user_id'],
915 915
                                 'timestamp' => time()
916
-                           )
916
+                            )
917 917
                         );
918 918
 
919 919
                         //show
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 set_time_limit(0);
26 26
 
27 27
 // Set some constants for program readability
28
-define('KP_PATH',0);
29
-define('KP_GROUP',1);
30
-define('KP_TITLE',2);
31
-define('KP_PASSWORD',3);
32
-define('KP_USERNAME',4);
33
-define('KP_URL',5);
34
-define('KP_UUID',6);
35
-define('KP_NOTES',7);
28
+define('KP_PATH', 0);
29
+define('KP_GROUP', 1);
30
+define('KP_TITLE', 2);
31
+define('KP_PASSWORD', 3);
32
+define('KP_USERNAME', 4);
33
+define('KP_URL', 5);
34
+define('KP_UUID', 6);
35
+define('KP_NOTES', 7);
36 36
 
37 37
 /*
38 38
  * sanitiseString
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $size = 4096;
99 99
         $separator = ",";
100 100
         $enclosure = '"';
101
-        $fields_expected = array("Label","Login","Password","URL","Comments");  //requiered fields from CSV
101
+        $fields_expected = array("Label", "Login", "Password", "URL", "Comments"); //requiered fields from CSV
102 102
         $importation_possible = true;
103 103
         $display = "<table>";
104 104
         $line_number = $prev_level = 0;
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
                     $login = addslashes($row['Login']);
174 174
                     $pw = str_replace('"', "&quot;", $row['Password']);
175 175
                     $url = addslashes($row['url']);
176
-                    $to_find = array ( "\"" , "'" );
177
-                    $to_ins = array ( "&quot" , "&#39;");
176
+                    $to_find = array("\"", "'");
177
+                    $to_ins = array("&quot", "&#39;");
178 178
                     $comment = htmlentities(addslashes(str_replace($to_find, $to_ins, $row['Comments'])), ENT_QUOTES, 'UTF-8');
179 179
 
180 180
                     $continue_on_next_line = false;
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
             $display .= '</table><div style=\"margin:10px 0 10px 0;\"><label><b>'.$LANG['import_to_folder'].'</b></label>&nbsp;<select id=\"import_items_to\" style=\"width:87%;\">';
205 205
             foreach ($tree as $t) {
206 206
                 if (in_array($t->id, $_SESSION['groupes_visibles'])) {
207
-                    $ident="";
208
-                    for ($x=1; $x<$t->nlevel; $x++) {
207
+                    $ident = "";
208
+                    for ($x = 1; $x < $t->nlevel; $x++) {
209 209
                         $ident .= "&nbsp;&nbsp;";
210 210
                     }
211 211
                     if (isset($_POST['folder_id']) && $_POST['folder_id'] == $t->id) $selected = " selected";
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
         foreach (explode('@_#sep#_@', mysqli_escape_string($link, stripslashes($listItems))) as $item) {
248 248
             //For each item, insert into DB
249
-            $item = explode('@|@', $item);   //explode item to get all fields
249
+            $item = explode('@|@', $item); //explode item to get all fields
250 250
 
251 251
             //Encryption key
252 252
             if ($personalFolder == 1) {
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
         $cacheFileNameFolder = $cacheFileName."_folders";
348 348
         $cacheFile = fopen($cacheFileName, "w");
349 349
         $cacheFileF = fopen($cacheFileNameFolder, "w");
350
-        $logFileName = "/keepassImport_" . date('YmdHis');
351
-        $cacheLogFile = fopen($_SESSION['settings']['path_to_files_folder'].$logFileName,'w');
350
+        $logFileName = "/keepassImport_".date('YmdHis');
351
+        $cacheLogFile = fopen($_SESSION['settings']['path_to_files_folder'].$logFileName, 'w');
352 352
 
353 353
         //read xml file
354 354
         if (file_exists("'".$_SESSION['settings']['path_to_files_folder']."/".$_POST['file'])."'") {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
                                 }
424 424
                             }
425 425
                         }
426
-                        $numGroups ++;
426
+                        $numGroups++;
427 427
                     } elseif ($entry == true && $nom == "title") {
428 428
                         $temparray[KP_TITLE] = sanitiseString($elem, '');
429 429
                     } elseif ($entry == true && $nom == "username") {
@@ -548,15 +548,15 @@  discard block
 block discarded – undo
548 548
                                 if ($levelInProgress == 3) {
549 549
                                     $temparray[KP_PATH] = $temparray[KP_GROUP];
550 550
                                 } else {
551
-                                    $temparray[KP_PATH] = substr($temparray[KP_PATH], 0, strrpos($temparray[KP_PATH], $foldersSeparator)+strlen($foldersSeparator)).$temparray[KP_GROUP];
551
+                                    $temparray[KP_PATH] = substr($temparray[KP_PATH], 0, strrpos($temparray[KP_PATH], $foldersSeparator) + strlen($foldersSeparator)).$temparray[KP_GROUP];
552 552
                                 }
553 553
                             } else {
554
-                                $diff = abs($xmlLevel-$levelInProgress)+1;
554
+                                $diff = abs($xmlLevel - $levelInProgress) + 1;
555 555
                                 $tmp = explode($foldersSeparator, $temparray[KP_PATH]);
556 556
                                 $temparray[KP_PATH] = "";
557
-                                for ($x=0; $x<(count($tmp)-$diff); $x++) {
557
+                                for ($x = 0; $x < (count($tmp) - $diff); $x++) {
558 558
                                     if (!empty($temparray[KP_PATH])) {
559
-                                        $temparray[KP_PATH] = $temparray[KP_PATH]. $foldersSeparator.$tmp[$x];
559
+                                        $temparray[KP_PATH] = $temparray[KP_PATH].$foldersSeparator.$tmp[$x];
560 560
                                     } else {
561 561
                                         $temparray[KP_PATH] = $tmp[$x];
562 562
                                     }
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
                                 fwrite($cacheFileF, $temparray[KP_PATH]."\n");
574 574
                                 array_push($groupsArray, $temparray[KP_PATH]);
575 575
                                 //increment number
576
-                                $numGroups ++;
576
+                                $numGroups++;
577 577
                             }
578 578
 
579 579
                             //Store actual level
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
             }
601 601
         }
602 602
 
603
-        fputs($cacheLogFile, date('H:i:s ') . "Writing XML File ".$_POST['file']."\n");
603
+        fputs($cacheLogFile, date('H:i:s ')."Writing XML File ".$_POST['file']."\n");
604 604
 
605 605
         // Go through each node of XML file
606 606
         recursiveKeepassXML($xml);
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
             unlink($cacheFileNameFolder);
615 615
             unlink($_SESSION['settings']['url_to_files_folder']."/".$_POST['file']);
616 616
 
617
-            fputs($cacheLogFile, date('H:i') . $LANG['import_error_no_read_possible_kp']."\n");
617
+            fputs($cacheLogFile, date('H:i').$LANG['import_error_no_read_possible_kp']."\n");
618 618
 
619 619
             echo '[{"error":"not_kp_file" , "message":"'.$LANG['import_error_no_read_possible_kp'].'"}]';
620 620
             break;
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
         ##################
638 638
         ## STARTING IMPORTING IF NO ERRORS OR NOT EMPTY
639 639
         ##################
640
-        if ($numItems>0 || $numGroups>0) {
640
+        if ($numItems > 0 || $numGroups > 0) {
641 641
 
642
-            fputs($cacheLogFile, date('H:i:s ') . $LANG['nb_folders']. ' '.$numGroups."\n");
643
-            fputs($cacheLogFile, date('H:i:s ') . $LANG['nb_items'] . ' '. $numItems."\n");
642
+            fputs($cacheLogFile, date('H:i:s ').$LANG['nb_folders'].' '.$numGroups."\n");
643
+            fputs($cacheLogFile, date('H:i:s ').$LANG['nb_items'].' '.$numItems."\n");
644 644
 
645 645
             $import_perso = false;
646 646
             $itemsArray = array();
@@ -674,12 +674,12 @@  discard block
 block discarded – undo
674 674
             $cacheFileF = fopen($cacheFileNameFolder, "r");
675 675
 
676 676
             //Create folders
677
-            $i=1;
677
+            $i = 1;
678 678
             $level = 0;
679 679
             $foldersArray = array();
680 680
             $nbFoldersImported = 0;
681 681
 
682
-            fputs($cacheLogFile, date('H:i:s ') . "Creating Folders\n");
682
+            fputs($cacheLogFile, date('H:i:s ')."Creating Folders\n");
683 683
             $results = "Folders\n\n";
684 684
 
685 685
             while (!feof($cacheFileF)) {
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 
693 693
                     //get folder name
694 694
                     if (strrpos($folder, $foldersSeparator) > 0) {
695
-                        $fold = substr($folder, strrpos($folder, $foldersSeparator)+strlen($foldersSeparator));
695
+                        $fold = substr($folder, strrpos($folder, $foldersSeparator) + strlen($foldersSeparator));
696 696
                         //$parent_id = $foldersArray[$path[$folderLevel-2]]['id'];
697 697
                         $parent = implode($foldersSeparator, array_slice($path, 0, -1));
698 698
                         $parent_id = $foldersArray[$parent]['id'];
@@ -701,19 +701,19 @@  discard block
 block discarded – undo
701 701
                         $parent_id = $_POST['destination']; //permits to select the folder destination
702 702
                     }
703 703
 
704
-                    $fold=stripslashes($fold);
704
+                    $fold = stripslashes($fold);
705 705
                     //create folder - if not exists at the same level
706 706
                     DB::query(
707 707
                         "SELECT * FROM ".prefix_table("nested_tree")."
708 708
                         WHERE nlevel = %i AND title = %s AND parent_id = %i LIMIT 1",
709
-                        intval($folderLevel+$startPathLevel),
709
+                        intval($folderLevel + $startPathLevel),
710 710
                         $fold,
711 711
                         $parent_id
712 712
                     );
713
-                    $results.= str_replace($foldersSeparator, '\\', $folder);
713
+                    $results .= str_replace($foldersSeparator, '\\', $folder);
714 714
                     $counter = DB::count();
715 715
                     if ($counter == 0) {
716
-                        $results.= " - Inserting\n";
716
+                        $results .= " - Inserting\n";
717 717
                         //do query
718 718
                         DB::insert(
719 719
                             prefix_table("nested_tree"),
@@ -754,12 +754,12 @@  discard block
 block discarded – undo
754 754
                         //increment number of imported folders
755 755
                         $nbFoldersImported++;
756 756
                     } else {
757
-                        $results.= " - Skipped\n";
757
+                        $results .= " - Skipped\n";
758 758
                         //get folder actual ID
759 759
                         $data = DB::queryFirstRow(
760 760
                             "SELECT id FROM ".prefix_table("nested_tree")."
761 761
                             WHERE nlevel = %i AND title = %s AND parent_id = %i",
762
-                            intval($folderLevel+$startPathLevel),
762
+                            intval($folderLevel + $startPathLevel),
763 763
                             $fold,
764 764
                             $parent_id
765 765
                         );
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
                         'id' => $id
774 774
                     );
775 775
 
776
-                    $_SESSION['nb_folders'] ++;
776
+                    $_SESSION['nb_folders']++;
777 777
                     $i++;
778 778
                 }
779 779
             }
@@ -783,18 +783,18 @@  discard block
 block discarded – undo
783 783
             if ($nbFoldersImported == 0) {
784 784
                 //$text .= $LANG['none'].'<br />';
785 785
             } else {
786
-                fputs($cacheLogFile, date('H:i:s ') . "Setting User Rights\n");
786
+                fputs($cacheLogFile, date('H:i:s ')."Setting User Rights\n");
787 787
                 //Refresh the rights of actual user
788 788
                 identifyUserRights(implode(';', $_SESSION['groupes_visibles']).';'.$newId, $_SESSION['groupes_interdits'], $_SESSION['is_admin'], $_SESSION['fonction_id'], true);
789 789
 
790
-                fputs($cacheLogFile, date('H:i:s ') . "Rebuilding Tree\n");
790
+                fputs($cacheLogFile, date('H:i:s ')."Rebuilding Tree\n");
791 791
                 //rebuild full tree
792 792
                 $tree->rebuild();
793 793
             }
794 794
             //show
795 795
             //$text .= '<br /><b>'.$LANG['importing_items'].':</b><br />';
796 796
 
797
-            fputs($cacheLogFile, date('H:i:s ') . "Importing Items\n");
797
+            fputs($cacheLogFile, date('H:i:s ')."Importing Items\n");
798 798
 
799 799
             // Now import ITEMS
800 800
             $nbItemsImported = 0;
@@ -819,18 +819,18 @@  discard block
 block discarded – undo
819 819
 
820 820
                 $count++;
821 821
                 if (!($count % 10)) {
822
-                    fputs($cacheLogFile, date('H:i:s ') . "  Imported $count items (" . number_format(($count / $numItems) * 100, 1) . ")\n");
822
+                    fputs($cacheLogFile, date('H:i:s ')."  Imported $count items (".number_format(($count / $numItems) * 100, 1).")\n");
823 823
                 }
824 824
 
825 825
                 if (!empty($item[KP_TITLE])) {
826 826
                     //$count++;
827 827
                     //check if not exists
828
-                    $results .= str_replace($foldersSeparator,"\\",$item[KP_PATH]).'\\'.$item[KP_TITLE];
828
+                    $results .= str_replace($foldersSeparator, "\\", $item[KP_PATH]).'\\'.$item[KP_TITLE];
829 829
 
830 830
                     $pw = $item[KP_PASSWORD];
831 831
 
832 832
                     //Get folder label
833
-                    if (count($foldersArray)==0 || empty($item[KP_PATH])) {
833
+                    if (count($foldersArray) == 0 || empty($item[KP_PATH])) {
834 834
                         $folderId = $_POST['destination'];
835 835
                     } else {
836 836
                         $folderId = $foldersArray[$item[KP_PATH]]['id'];
@@ -938,10 +938,10 @@  discard block
 block discarded – undo
938 938
             $text .= '</div><br /><br /><b>'.$LANG['import_kp_finished'].'</b>';
939 939
             $text .= '<a href=\''.$_SESSION['settings']['url_to_files_folder'].'/'.$logFileName.'\' target=\'_blank\'>'.$LANG['pdf_download'].'</a>';
940 940
 
941
-            fputs($cacheLogFile, date('H:i:s ') . "Import finished\n");
942
-            fputs($cacheLogFile, date('H:i:s ') . "Statistics\n");
943
-            fputs($cacheLogFile, date('H:i:s ') . "Folders imported: $nbFoldersImported\n");
944
-            fputs($cacheLogFile, date('H:i:s ') . "Items imported: $nbItemsImported\n\n".$results);
941
+            fputs($cacheLogFile, date('H:i:s ')."Import finished\n");
942
+            fputs($cacheLogFile, date('H:i:s ')."Statistics\n");
943
+            fputs($cacheLogFile, date('H:i:s ')."Folders imported: $nbFoldersImported\n");
944
+            fputs($cacheLogFile, date('H:i:s ')."Items imported: $nbItemsImported\n\n".$results);
945 945
 
946 946
             //Delete cache file
947 947
             fclose($cacheFileF);
@@ -958,9 +958,9 @@  discard block
 block discarded – undo
958 958
         }
959 959
         break;
960 960
 }
961
-spl_autoload_register(function ($class) {
962
-    $prefix = 'League\\Csv\\';echo "ici2";
963
-    $base_dir = __DIR__ . '/src/';
961
+spl_autoload_register(function($class) {
962
+    $prefix = 'League\\Csv\\'; echo "ici2";
963
+    $base_dir = __DIR__.'/src/';
964 964
     $len = strlen($prefix);
965 965
     if (strncmp($prefix, $class, $len) !== 0) {
966 966
         // no, move to the next registered autoloader
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
         return;
969 969
     }
970 970
     $relative_class = substr($class, $len);
971
-    $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
971
+    $file = $base_dir.str_replace('\\', '/', $relative_class).'.php';
972 972
     if (file_exists($file)) {
973 973
         require $file;
974 974
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -208,8 +208,11 @@
 block discarded – undo
208 208
                     for ($x=1; $x<$t->nlevel; $x++) {
209 209
                         $ident .= "&nbsp;&nbsp;";
210 210
                     }
211
-                    if (isset($_POST['folder_id']) && $_POST['folder_id'] == $t->id) $selected = " selected";
212
-                    else $selected = "";
211
+                    if (isset($_POST['folder_id']) && $_POST['folder_id'] == $t->id) {
212
+                        $selected = " selected";
213
+                    } else {
214
+                        $selected = "";
215
+                    }
213 216
                     if ($prev_level != null && $prev_level < $t->nlevel) {
214 217
                         $display .= '<option value=\"'.$t->id.'\"'.$selected.'>'.$ident.str_replace(array("&", '"'), array("&amp;", "&quot;"), $t->title).'</option>';
215 218
                     } elseif ($prev_level != null && $prev_level == $t->nlevel) {
Please login to merge, or discard this patch.
sources/items.queries.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,6 @@
 block discarded – undo
79 79
 // phpcrypt
80 80
 require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/phpcrypt/phpCrypt.php';
81 81
 use PHP_Crypt\PHP_Crypt as PHP_Crypt;
82
-use PHP_Crypt\Cipher as Cipher;
83 82
 
84 83
 // prepare Encryption class calls
85 84
 use \Defuse\Crypto\Crypto;
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     70 => array(70, $LANG['complex_level4']),
51 51
     80 => array(80, $LANG['complex_level5']),
52 52
     90 => array(90, $LANG['complex_level6'])
53
-   );
53
+    );
54 54
 
55 55
 //Class loader
56 56
 require_once $_SESSION['settings']['cpassman_dir'].'/sources/SplClassLoader.php';
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                         'perso' => ($dataReceived['salt_key_set'] == 1 && isset($dataReceived['salt_key_set']) && $dataReceived['is_pf'] == 1 && isset($dataReceived['is_pf'])) ? '1' : '0',
208 208
                         'anyone_can_modify' => (isset($dataReceived['anyone_can_modify']) && $dataReceived['anyone_can_modify'] == "on") ? '1' : '0',
209 209
                         'complexity_level' => $dataReceived['complexity_level']
210
-                       )
210
+                        )
211 211
                 );
212 212
                 $newID = DB::insertId();
213 213
                 $pw = $passwd['string'];
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                             'del_enabled' => 1, // 0=deactivated;1=activated
260 260
                             'del_type' => $date_stamp != false ? 2 : 1, // 1=counter;2=date
261 261
                             'del_value' => $date_stamp != false ? $date_stamp : $dataReceived['to_be_deleted']
262
-                           )
262
+                            )
263 263
                     );
264 264
                 }
265 265
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
                             array(
272 272
                                 'role_id' => $role,
273 273
                                 'item_id' => $newID
274
-                               )
274
+                                )
275 275
                         );
276 276
                     }
277 277
                 }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                             array(
287 287
                                 'item_id' => $newID,
288 288
                                 'tag' => strtolower($tag)
289
-                               )
289
+                                )
290 290
                         );
291 291
                     }
292 292
                 }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
                             prefix_table('files'),
303 303
                             array(
304 304
                                 'id_item' => $newID
305
-                               ),
305
+                                ),
306 306
                             "id=%i", $record['id']
307 307
                         );
308 308
                     }
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                     "new_entry" => $html,
391 391
                     "array_items" => $itemsIDList,
392 392
                     "show_clipboard_small_icons" => (isset($_SESSION['settings']['copy_to_clipboard_small_icons']) && $_SESSION['settings']['copy_to_clipboard_small_icons'] == 1) ? 1 : 0
393
-                   );
393
+                    );
394 394
             } elseif (isset($_SESSION['settings']['duplicate_item']) && $_SESSION['settings']['duplicate_item'] == 0 && $itemExists == 1) {
395 395
                 $returnValues = array("error" => "item_exists");
396 396
             }
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
                     )
476 476
                     ||
477 477
                     (@in_array($_POST['id'], $_SESSION['list_folders_limited'][$_POST['folder_id']]))
478
-                 ) {
478
+                    ) {
479 479
 
480 480
                     // is pwd empty?
481 481
                     if (empty($pw) && isset($_SESSION['user_settings']['create_item_without_password']) && $_SESSION['user_settings']['create_item_without_password'] !== "1") {
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
                             'restricted_to' => $dataReceived['restricted_to'],
564 564
                             'anyone_can_modify' => (isset($dataReceived['anyone_can_modify']) && $dataReceived['anyone_can_modify'] == "on") ? '1' : '0',
565 565
                             'complexity_level' => $dataReceived['complexity_level']
566
-                           ),
566
+                            ),
567 567
                         "id=%i",
568 568
                         $dataReceived['id']
569 569
                     );
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
                                         'del_enabled' => 1,
689 689
                                         'del_type' => is_numeric($dataReceived['to_be_deleted']) ? 1 : 2,
690 690
                                         'del_value' => is_numeric($dataReceived['to_be_deleted']) ? $dataReceived['to_be_deleted'] : dateToStamp($dataReceived['to_be_deleted'])
691
-                                       )
691
+                                        )
692 692
                                 );
693 693
                                 // update LOG
694 694
                                 logItems($dataReceived['id'], $label, $_SESSION['user_id'], 'at_modification', $_SESSION['login'], 'at_automatic_del : '.$dataReceived['to_be_deleted']);
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
                                     array(
703 703
                                         'del_type' => is_numeric($dataReceived['to_be_deleted']) ? 1 : 2,
704 704
                                         'del_value' => is_numeric($dataReceived['to_be_deleted']) ? $dataReceived['to_be_deleted'] : dateToStamp($dataReceived['to_be_deleted'])
705
-                                       ),
705
+                                        ),
706 706
                                     "item_id = %i",
707 707
                                     $dataReceived['id']
708 708
                                 );
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
                                 array(
773 773
                                     'role_id' => $role,
774 774
                                     'item_id' => $dataReceived['id']
775
-                                   )
775
+                                    )
776 776
                             );
777 777
                             $dataTmp = DB::queryfirstrow("SELECT title FROM ".prefix_table("roles_title")." WHERE id= ".$role);
778 778
                             if (empty($listOfRestricted)) {
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
                                     ),
955 955
                                 'receivers' => $mailing,
956 956
                                 'status' => ''
957
-                               )
957
+                                )
958 958
                         );
959 959
                     }
960 960
 
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
                         "list_of_restricted" => $listOfRestricted,
971 971
                         "tags" => $return_tags,
972 972
                         "error" => ""
973
-                       );
973
+                        );
974 974
                 } else {
975 975
                     echo prepareExchangedData(array("error" => "ERR_NOT_ALLOWED_TO_EDIT"), "encode");
976 976
                     break;
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
                             'extension' => $record['extension'],
1158 1158
                             'type' => $record['type'],
1159 1159
                             'file' => $record['file']
1160
-                           )
1160
+                            )
1161 1161
                     );
1162 1162
                 }
1163 1163
 
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
                         array(
1170 1170
                             'item_id' => $newID,
1171 1171
                             'role_id' => $record['role_id']
1172
-                           )
1172
+                            )
1173 1173
                     );
1174 1174
                 }
1175 1175
 
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
                         array(
1182 1182
                             'item_id' => $newID,
1183 1183
                             'tag' => $record['tag']
1184
-                           )
1184
+                            )
1185 1185
                     );
1186 1186
                 }
1187 1187
 
@@ -1548,14 +1548,14 @@  discard block
 block discarded – undo
1548 1548
                                 $pre."automatic_del",
1549 1549
                                 array(
1550 1550
                                     'del_value' => $dataDelete['del_value'] - 1
1551
-                                   ),
1551
+                                    ),
1552 1552
                                 "item_id = %i",
1553 1553
                                 $_POST['id']
1554 1554
                             );
1555 1555
                             // store value
1556 1556
                             $arrData['to_be_deleted'] = $dataDelete['del_value'] - 1;
1557 1557
                         } elseif ($dataDelete['del_type'] == 1 && $dataDelete['del_value'] <= 1 || $dataDelete['del_type'] == 2 && $dataDelete['del_value'] < time()
1558
-                               )
1558
+                                )
1559 1559
                         {
1560 1560
                             $arrData['show_details'] = 0;
1561 1561
                             // delete item
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
1565 1565
                                 prefix_table("items"),
1566 1566
                                 array(
1567 1567
                                     'inactif' => '1',
1568
-                                   ),
1568
+                                    ),
1569 1569
                                 "id = %i",
1570 1570
                                 $_POST['id']
1571 1571
                             );
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
                                 'body' => str_replace(array('#tp_item_author#', '#tp_user#', '#tp_item#'), array(" ".addslashes($arrData['author']), addslashes($_SESSION['login']), addslashes($dataItem['label'])), $LANG['email_on_open_notification_mail']),
1596 1596
                                 'receivers' => $listNotificationEmails,
1597 1597
                                 'status' => ''
1598
-                               )
1598
+                                )
1599 1599
                         );
1600 1600
                     //}
1601 1601
                 } else {
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
                     prefix_table("users"),
1745 1745
                     array(
1746 1746
                         'latest_items' => implode(';', $_SESSION['latest_items'])
1747
-                       ),
1747
+                        ),
1748 1748
                     "id=".$_SESSION['user_id']
1749 1749
                 );
1750 1750
             }
@@ -1788,7 +1788,7 @@  discard block
 block discarded – undo
1788 1788
                 prefix_table("items"),
1789 1789
                 array(
1790 1790
                     'inactif' => '1',
1791
-                   ),
1791
+                    ),
1792 1792
                 "id = %i",
1793 1793
                 $_POST['id']
1794 1794
             );
@@ -1869,7 +1869,7 @@  discard block
 block discarded – undo
1869 1869
                     prefix_table("nested_tree"),
1870 1870
                     array(
1871 1871
                         'title' => $title
1872
-                       ),
1872
+                        ),
1873 1873
                     'id=%s',
1874 1874
                     $dataReceived['folder']
1875 1875
                 );
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
                     prefix_table("misc"),
1879 1879
                     array(
1880 1880
                         'valeur' => $dataReceived['complexity']
1881
-                       ),
1881
+                        ),
1882 1882
                     'intitule = %s AND type = %s',
1883 1883
                     $dataReceived['folder'],
1884 1884
                     "complex"
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
                     prefix_table("nested_tree"),
1950 1950
                     array(
1951 1951
                         'parent_id' => $dataReceived['target_folder_id']
1952
-                       ),
1952
+                        ),
1953 1953
                     'id=%s',
1954 1954
                     $dataReceived['source_folder_id']
1955 1955
                 );
@@ -1970,7 +1970,7 @@  discard block
 block discarded – undo
1970 1970
                 prefix_table("nested_tree"),
1971 1971
                 array(
1972 1972
                     'parent_id' => $_POST['destination']
1973
-                   ),
1973
+                    ),
1974 1974
                 'id = %i',
1975 1975
                 $_POST['source']
1976 1976
             );
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
                         $_SESSION['is_admin'] == 1
2587 2587
                         || ($_SESSION['user_manager'] == 1)
2588 2588
                         || (
2589
-                           isset($_SESSION['settings']['enable_user_can_create_folders'])
2589
+                            isset($_SESSION['settings']['enable_user_can_create_folders'])
2590 2590
                            && $_SESSION['settings']['enable_user_can_create_folders'] == 1
2591 2591
                         )
2592 2592
                         || (
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
                     prefix_table("users"),
2763 2763
                     array(
2764 2764
                         'favourites' => implode(';', $_SESSION['favourites'])
2765
-                       ),
2765
+                        ),
2766 2766
                     'id = %i',
2767 2767
                     $_SESSION['user_id']
2768 2768
                 );
@@ -2771,7 +2771,7 @@  discard block
 block discarded – undo
2771 2771
                 $_SESSION['favourites_tab'][$_POST['id']] = array(
2772 2772
                     'label' => $data['label'],
2773 2773
                     'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$_POST['id']
2774
-                   );
2774
+                    );
2775 2775
             } elseif ($_POST['action'] == 0) {
2776 2776
                 // delete from session
2777 2777
                 foreach ($_SESSION['favourites'] as $key => $value) {
@@ -2832,7 +2832,7 @@  discard block
 block discarded – undo
2832 2832
                     prefix_table("items"),
2833 2833
                     array(
2834 2834
                         'id_tree' => $_POST['folder_id']
2835
-                       ),
2835
+                        ),
2836 2836
                     "id=%i",
2837 2837
                     $_POST['item_id']
2838 2838
                 );
@@ -2939,7 +2939,7 @@  discard block
 block discarded – undo
2939 2939
                             prefix_table("items"),
2940 2940
                             array(
2941 2941
                                 'id_tree' => $_POST['folder_id']
2942
-                               ),
2942
+                                ),
2943 2943
                             "id=%i",
2944 2944
                             $item_id
2945 2945
                         );
@@ -3051,7 +3051,7 @@  discard block
 block discarded – undo
3051 3051
                         prefix_table("items"),
3052 3052
                         array(
3053 3053
                             'inactif' => '1',
3054
-                           ),
3054
+                            ),
3055 3055
                         "id = %i",
3056 3056
                         $item_id
3057 3057
                     );
@@ -3132,7 +3132,7 @@  discard block
 block discarded – undo
3132 3132
                             prefix_table("items"),
3133 3133
                             array(
3134 3134
                                 'notification' => empty($data['notification']) ? $_POST['user_id'].";" : $data['notification'].$_POST['user_id']
3135
-                               ),
3135
+                                ),
3136 3136
                             "id=%i",
3137 3137
                             $_POST['item_id']
3138 3138
                         );
@@ -3145,7 +3145,7 @@  discard block
 block discarded – undo
3145 3145
                             prefix_table("items"),
3146 3146
                             array(
3147 3147
                                 'notification' => empty($data['notification']) ? $_POST['user_id'] : $data['notification'].";".$_POST['user_id']
3148
-                               ),
3148
+                                ),
3149 3149
                             "id=%i",
3150 3150
                             $_POST['item_id']
3151 3151
                         );
@@ -3280,7 +3280,7 @@  discard block
 block discarded – undo
3280 3280
                     'timestamp' => time(),
3281 3281
                     'originator' => intval($_SESSION['user_id']),
3282 3282
                     'code' => $otv_code
3283
-                   )
3283
+                    )
3284 3284
             );
3285 3285
             $newID = DB::insertId();
3286 3286
 
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 $aes->register();
78 78
 
79 79
 // phpcrypt
80
-require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/phpcrypt/phpCrypt.php';
80
+require_once $_SESSION['settings']['cpassman_dir'].'/includes/libraries/phpcrypt/phpCrypt.php';
81 81
 use PHP_Crypt\PHP_Crypt as PHP_Crypt;
82 82
 use PHP_Crypt\Cipher as Cipher;
83 83
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
                 if (isset($_SESSION['settings']['item_extra_fields']) && $_SESSION['settings']['item_extra_fields'] == 1) {
217 217
                     foreach (explode("_|_", $dataReceived['fields']) as $field) {
218 218
                         $field_data = explode("~~", $field);
219
-                        if (count($field_data)>1 && !empty($field_data[1])) {
219
+                        if (count($field_data) > 1 && !empty($field_data[1])) {
220 220
                             // should we encrypt the data
221 221
                             $dataTmp = DB::queryFirstRow("SELECT encrypted_data
222 222
                                     FROM ".prefix_table("categories")."
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
                 $html = '<li class="item_draggable'
345 345
                 .'" id="'.$newID.'" style="margin-left:-30px;">'
346 346
                 .'<span style="cursor:hand;" class="grippy"><i class="fa fa-sm fa-arrows mi-grey-1"></i>&nbsp;</span>'
347
-                .$expirationFlag.'<i class="fa fa-sm fa-warning mi-yellow"></i>&nbsp;' .
348
-                '&nbsp;<a id="fileclass'.$newID.'" class="file" onclick="AfficherDetailsItem(\''.$newID.'\', \'0\', \'\', \'\', \'\', \'\', \'\')" ondblclick="AfficherDetailsItem(\''.$newID.'\', \'0\', \'\', \'\', \'\', true, \'\')">' .
347
+                .$expirationFlag.'<i class="fa fa-sm fa-warning mi-yellow"></i>&nbsp;'.
348
+                '&nbsp;<a id="fileclass'.$newID.'" class="file" onclick="AfficherDetailsItem(\''.$newID.'\', \'0\', \'\', \'\', \'\', \'\', \'\')" ondblclick="AfficherDetailsItem(\''.$newID.'\', \'0\', \'\', \'\', \'\', true, \'\')">'.
349 349
                 stripslashes($dataReceived['label']);
350 350
                 if (!empty($dataReceived['description']) && isset($_SESSION['settings']['show_description']) && $_SESSION['settings']['show_description'] == 1) {
351 351
                     $html .= '&nbsp;<font size=2px>['.strip_tags(stripslashes(substr(cleanString($dataReceived['description']), 0, 30))).']</font>';
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
                     if (isset($_SESSION['settings']['item_extra_fields']) && $_SESSION['settings']['item_extra_fields'] == 1) {
572 572
                         foreach (explode("_|_", $dataReceived['fields']) as $field) {
573 573
                             $field_data = explode("~~", $field);
574
-                            if (count($field_data)>1 && !empty($field_data[1])) {
574
+                            if (count($field_data) > 1 && !empty($field_data[1])) {
575 575
                                 $dataTmpCat = DB::queryFirstRow(
576 576
                                     "SELECT c.title AS title, i.data AS data, i.data_iv AS data_iv, i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data
577 577
                                     FROM ".prefix_table("categories_items")." AS i
@@ -856,12 +856,12 @@  discard block
 block discarded – undo
856 856
                     foreach ($rows as $record) {
857 857
                         $reason = explode(':', $record['raison']);
858 858
                         if (empty($history)) {
859
-                            $history = date($_SESSION['settings']['date_format']." ".$_SESSION['settings']['time_format'], $record['date'])." - ".$record['login']." - ".$LANG[$record['action']] .
860
-                            " - ".(!empty($record['raison']) ? (count($reason) > 1 ? $LANG[trim($reason[0])].' : '.$reason[1] : $LANG[trim($reason[0])]):'');
859
+                            $history = date($_SESSION['settings']['date_format']." ".$_SESSION['settings']['time_format'], $record['date'])." - ".$record['login']." - ".$LANG[$record['action']].
860
+                            " - ".(!empty($record['raison']) ? (count($reason) > 1 ? $LANG[trim($reason[0])].' : '.$reason[1] : $LANG[trim($reason[0])]) : '');
861 861
                         } else {
862
-                            $history .= "<br />".date($_SESSION['settings']['date_format']." ".$_SESSION['settings']['time_format'], $record['date'])." - " .
863
-                            $record['login']." - ".$LANG[$record['action']]." - " .
864
-                            (!empty($record['raison']) ? (count($reason) > 1 ? $LANG[trim($reason[0])].' => '.$reason[1] : ($record['action'] != "at_manual" ? $LANG[trim($reason[0])] : trim($reason[0]))):'');
862
+                            $history .= "<br />".date($_SESSION['settings']['date_format']." ".$_SESSION['settings']['time_format'], $record['date'])." - ".
863
+                            $record['login']." - ".$LANG[$record['action']]." - ".
864
+                            (!empty($record['raison']) ? (count($reason) > 1 ? $LANG[trim($reason[0])].' => '.$reason[1] : ($record['action'] != "at_manual" ? $LANG[trim($reason[0])] : trim($reason[0]))) : '');
865 865
                         }
866 866
                     }
867 867
                     // decrypt PW
@@ -960,9 +960,9 @@  discard block
 block discarded – undo
960 960
 
961 961
                     // Prepare some stuff to return
962 962
                     $arrData = array(
963
-                        "files" => $files,//str_replace('"', '&quot;', $files),
963
+                        "files" => $files, //str_replace('"', '&quot;', $files),
964 964
                         "history" => str_replace('"', '&quot;', $history),
965
-                        "files_edit" => $filesEdit,//str_replace('"', '&quot;', $filesEdit),
965
+                        "files_edit" => $filesEdit, //str_replace('"', '&quot;', $filesEdit),
966 966
                         "id_tree" => $dataItem['id_tree'],
967 967
                         "id" => $dataItem['id'],
968 968
                         "reload_page" => $reloadPage,
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
                 // previous is public folder and personal one
1042 1042
                 else if ($originalRecord['perso'] === "0" && $dataDestination['personal_folder'] === "1") {
1043 1043
                     // check if PSK is set
1044
-                    if (!isset($_SESSION['user_settings']['session_psk']) || empty($_SESSION['user_settings']['session_psk'])){
1044
+                    if (!isset($_SESSION['user_settings']['session_psk']) || empty($_SESSION['user_settings']['session_psk'])) {
1045 1045
                         $returnValues = '[{"error" : "no_psk"}, {"error_text" : "'.addslashes($LANG['alert_message_personal_sk_missing']).'"}]';
1046 1046
                         echo $returnValues;
1047 1047
                         break;
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
                 } else if ($originalRecord['perso'] === "1" && $dataDestination['personal_folder'] === "1") {
1068 1068
                 // previous is public folder and personal one
1069 1069
                     // check if PSK is set
1070
-                    if (!isset($_SESSION['user_settings']['session_psk']) || empty($_SESSION['user_settings']['session_psk'])){
1070
+                    if (!isset($_SESSION['user_settings']['session_psk']) || empty($_SESSION['user_settings']['session_psk'])) {
1071 1071
                         $returnValues = '[{"error" : "no_psk"}, {"error_text" : "'.addslashes($LANG['alert_message_personal_sk_missing']).'"}]';
1072 1072
                         echo $returnValues;
1073 1073
                         break;
@@ -1471,12 +1471,12 @@  discard block
 block discarded – undo
1471 1471
                 DB::update(
1472 1472
                     prefix_table("items"),
1473 1473
                     array(
1474
-                        'viewed_no' => $dataItem['viewed_no']+1,
1474
+                        'viewed_no' => $dataItem['viewed_no'] + 1,
1475 1475
                     ),
1476 1476
                     "id = %i",
1477 1477
                     $_POST['id']
1478 1478
                 );
1479
-                $arrData['viewed_no'] = $dataItem['viewed_no']+1;
1479
+                $arrData['viewed_no'] = $dataItem['viewed_no'] + 1;
1480 1480
 
1481 1481
                 // get fields
1482 1482
                 $fieldsTmp = $arrCatList = "";
@@ -1821,7 +1821,7 @@  discard block
 block discarded – undo
1821 1821
             }
1822 1822
             // check that title is not numeric
1823 1823
             if (is_numeric($title) === true) {
1824
-                echo '[{"error" : "ERR_TITLE_ONLY_WITH_NUMBERS"}]';;
1824
+                echo '[{"error" : "ERR_TITLE_ONLY_WITH_NUMBERS"}]'; ;
1825 1825
                 break;
1826 1826
             }
1827 1827
 
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
                 "SELECT title, parent_id, personal_folder FROM ".prefix_table("nested_tree")." WHERE id = %i",
1865 1865
                 $dataReceived['folder']
1866 1866
             );
1867
-            if ( $tmp['parent_id'] != 0 || $tmp['title'] != $_SESSION['user_id'] || $tmp['personal_folder'] != 1 ) {
1867
+            if ($tmp['parent_id'] != 0 || $tmp['title'] != $_SESSION['user_id'] || $tmp['personal_folder'] != 1) {
1868 1868
                 DB::update(
1869 1869
                     prefix_table("nested_tree"),
1870 1870
                     array(
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
                 break;
1943 1943
             }*/
1944 1944
 
1945
-            if ( $tmp_source['parent_id'] != 0 || $tmp_source['title'] != $_SESSION['user_id'] || $tmp_source['personal_folder'] != 1 || $tmp_target['title'] != $_SESSION['user_id'] || $tmp_target['personal_folder'] != 1) {
1945
+            if ($tmp_source['parent_id'] != 0 || $tmp_source['title'] != $_SESSION['user_id'] || $tmp_source['personal_folder'] != 1 || $tmp_target['title'] != $_SESSION['user_id'] || $tmp_target['personal_folder'] != 1) {
1946 1946
 
1947 1947
                 // moving SOURCE folder
1948 1948
                 DB::update(
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
                 if (in_array($elem->id, $_SESSION['groupes_visibles'])) {
2011 2011
                     $arboHtml_tmp .= ' style="cursor:pointer;" onclick="ListerItems('.$elem->id.', \'\', 0)"';
2012 2012
                 }
2013
-                $arboHtml_tmp .= '>'. htmlspecialchars(stripslashes($elem->title), ENT_QUOTES). '</a>';
2013
+                $arboHtml_tmp .= '>'.htmlspecialchars(stripslashes($elem->title), ENT_QUOTES).'</a>';
2014 2014
                 if (empty($arboHtml)) {
2015 2015
                     $arboHtml = $arboHtml_tmp;
2016 2016
                 } else {
@@ -2109,12 +2109,12 @@  discard block
 block discarded – undo
2109 2109
                         INNER JOIN ".prefix_table("log_items")." AS l ON (i.id = l.id_item)
2110 2110
                         WHERE %l
2111 2111
                         GROUP BY i.id, l.date, l.id_user, l.action
2112
-                        ORDER BY i.label ASC, l.date DESC".$query_limit,//
2112
+                        ORDER BY i.label ASC, l.date DESC".$query_limit, //
2113 2113
                         $where
2114 2114
                     );
2115 2115
                 } else {
2116 2116
                     $items_to_display_once = "max";
2117
-                    $where->add('i.inactif=%i',0);
2117
+                    $where->add('i.inactif=%i', 0);
2118 2118
 
2119 2119
                     $rows = DB::query(
2120 2120
                         "SELECT i.id AS id, MIN(i.restricted_to) AS restricted_to, MIN(i.perso) AS perso,
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
                         // Build array with items
2397 2397
                         array_push($itemsIDList, array($record['id'], $pw, $record['login'], $displayItem));
2398 2398
 
2399
-                        $i ++;
2399
+                        $i++;
2400 2400
                     }
2401 2401
                     $idManaged = $record['id'];
2402 2402
                 }
@@ -2524,12 +2524,12 @@  discard block
 block discarded – undo
2524 2524
 
2525 2525
             if (isset($_POST['item_id']) && !empty($_POST['item_id'])) {
2526 2526
                 // Lock Item (if already locked), go back and warn
2527
-                $dataTmp = DB::queryFirstRow("SELECT timestamp, user_id FROM ".prefix_table("items_edition")." WHERE item_id = %i", $_POST['item_id']);//echo ">".$dataTmp[0];
2527
+                $dataTmp = DB::queryFirstRow("SELECT timestamp, user_id FROM ".prefix_table("items_edition")." WHERE item_id = %i", $_POST['item_id']); //echo ">".$dataTmp[0];
2528 2528
 
2529 2529
                 // If token is taken for this Item and delay is passed then delete it.
2530 2530
                 if (isset($_SESSION['settings']['delay_item_edition']) &&
2531 2531
                     $_SESSION['settings']['delay_item_edition'] > 0 && !empty($dataTmp['timestamp']) &&
2532
-                    round(abs(time()-$dataTmp['timestamp']) / 60, 2) > $_SESSION['settings']['delay_item_edition']
2532
+                    round(abs(time() - $dataTmp['timestamp']) / 60, 2) > $_SESSION['settings']['delay_item_edition']
2533 2533
                 ) {
2534 2534
                     DB::delete(prefix_table("items_edition"), "item_id = %i", $_POST['item_id']);
2535 2535
                     //reload the previous data
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
                 // Delete from FILES table
2706 2706
                 DB::delete(prefix_table("files"), "id = %i", $_POST['file_id']);
2707 2707
                 // Update the log
2708
-                logItems($data['id_item'], $dataItem['label'], $_SESSION['user_id'], 'at_modification', $_SESSION['login'],'at_del_file : '.$data['name']);
2708
+                logItems($data['id_item'], $dataItem['label'], $_SESSION['user_id'], 'at_modification', $_SESSION['login'], 'at_del_file : '.$data['name']);
2709 2709
                 // Delete file from server
2710 2710
                 @unlink($_SESSION['settings']['path_to_upload_folder']."/".$data['file']);
2711 2711
             }
@@ -2745,7 +2745,7 @@  discard block
 block discarded – undo
2745 2745
                 "SELECT description FROM ".prefix_table("items")." WHERE id=%i", $_POST['id_item']
2746 2746
             );
2747 2747
             // Clean up the string
2748
-            echo json_encode(array("description" => strip_tags($dataItem['description'])), JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP);
2748
+            echo json_encode(array("description" => strip_tags($dataItem['description'])), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
2749 2749
             break;
2750 2750
 
2751 2751
         /*
@@ -3293,7 +3293,7 @@  discard block
 block discarded – undo
3293 3293
                 $_SESSION['settings']['otv_expiration_period'] = 7;
3294 3294
             }
3295 3295
             $url = $_SESSION['settings']['cpassman_url']."/index.php?otv=true&".http_build_query($otv_session);
3296
-            $exp_date = date($_SESSION['settings']['date_format']." ".$_SESSION['settings']['time_format'], time() + (intval($_SESSION['settings']['otv_expiration_period'])*86400));
3296
+            $exp_date = date($_SESSION['settings']['date_format']." ".$_SESSION['settings']['time_format'], time() + (intval($_SESSION['settings']['otv_expiration_period']) * 86400));
3297 3297
 
3298 3298
             echo json_encode(
3299 3299
                 array(
@@ -3323,7 +3323,7 @@  discard block
 block discarded – undo
3323 3323
 
3324 3324
             // prepare image info
3325 3325
             $image_code = $file_info['file'];
3326
-            $extension = substr($_POST['title'], strrpos($_POST['title'], '.')+1);
3326
+            $extension = substr($_POST['title'], strrpos($_POST['title'], '.') + 1);
3327 3327
             $file_to_display = $_SESSION['settings']['url_to_upload_folder'].'/'.$image_code;
3328 3328
             $file_suffix = "";
3329 3329
 
@@ -3610,7 +3610,7 @@  discard block
 block discarded – undo
3610 3610
                         $fldTitle = str_replace("&", "&amp;", $folder->title);
3611 3611
 
3612 3612
                         // rename personal folder with user login
3613
-                        if ($folder->title == $_SESSION['user_id'] && $folder->nlevel == 1 ) {
3613
+                        if ($folder->title == $_SESSION['user_id'] && $folder->nlevel == 1) {
3614 3614
                             $fldTitle = $_SESSION['login'];
3615 3615
                         }
3616 3616
 
@@ -3738,7 +3738,7 @@  discard block
 block discarded – undo
3738 3738
                         '<td rowspan="2" style="width:40px;"><img src="'.$avatar.'" style="border-radius:20px; height:35px;"></td>'.
3739 3739
                         '<td colspan="2" style="font-size:11px;"><i>'.$LANG['by'].' '.$record['login'].' '.$LANG['at'].' '.date($_SESSION['settings']['date_format'].' '.$_SESSION['settings']['time_format'], $record['date']).'</i></td></tr>'.
3740 3740
                         '<tr style="border-bottom:3px solid #C9C9C9;"><td style="width:100px;"><b>'.$LANG[$record['action']].'</b></td>'.
3741
-                        '<td style="">' . (!empty($record['raison']) && $record['action'] !== "at_creation" ? (count($reason) > 1 ? $LANG[trim($reason[0])].' : '.handleBackslash($reason[1]) : ($record['action'] == "at_manual" ? $reason[0] : $LANG[trim($reason[0])])) : '') . '</td>'.
3741
+                        '<td style="">'.(!empty($record['raison']) && $record['action'] !== "at_creation" ? (count($reason) > 1 ? $LANG[trim($reason[0])].' : '.handleBackslash($reason[1]) : ($record['action'] == "at_manual" ? $reason[0] : $LANG[trim($reason[0])])) : '').'</td>'.
3742 3742
                         '</tr>'.
3743 3743
                         '<tr></tr>';
3744 3744
                 }
Please login to merge, or discard this patch.
Braces   +27 added lines, -11 removed lines patch added patch discarded remove patch
@@ -543,8 +543,11 @@  discard block
 block discarded – undo
543 543
                                 )
544 544
                             );
545 545
                             // prepare display
546
-                            if (empty($tags)) $return_tags = "<span class='round-grey pointer tip' title='".addslashes($LANG['list_items_with_tag'])."' onclick='searchItemsWithTags(\"".strtolower($tag)."\")'><i class='fa fa-tag fa-sm'></i>&nbsp;<span class=\"item_tag\">".strtolower($tag)."</span></span>";
547
-                            else $return_tags .= "&nbsp;&nbsp;<span class='round-grey pointer tip' title='".addslashes($LANG['list_items_with_tag'])."' onclick='searchItemsWithTags(\"".strtolower($tag)."\")'><i class='fa fa-tag fa-sm'></i>&nbsp;<span class=\"item_tag\">".strtolower($tag)."</span></span>";
546
+                            if (empty($tags)) {
547
+                                $return_tags = "<span class='round-grey pointer tip' title='".addslashes($LANG['list_items_with_tag'])."' onclick='searchItemsWithTags(\"".strtolower($tag)."\")'><i class='fa fa-tag fa-sm'></i>&nbsp;<span class=\"item_tag\">".strtolower($tag)."</span></span>";
548
+                            } else {
549
+                                $return_tags .= "&nbsp;&nbsp;<span class='round-grey pointer tip' title='".addslashes($LANG['list_items_with_tag'])."' onclick='searchItemsWithTags(\"".strtolower($tag)."\")'><i class='fa fa-tag fa-sm'></i>&nbsp;<span class=\"item_tag\">".strtolower($tag)."</span></span>";
550
+                            }
548 551
                         }
549 552
                     }
550 553
 
@@ -765,8 +768,11 @@  discard block
 block discarded – undo
765 768
                         // add roles for item
766 769
                         foreach (array_filter(explode(';', $dataReceived['restricted_to_roles'])) as $role) {
767 770
                             $role = explode("role_", $role);
768
-                            if (count($role) > 1) $role = $role[1];
769
-                            else $role = $role[0];
771
+                            if (count($role) > 1) {
772
+                                $role = $role[1];
773
+                            } else {
774
+                                $role = $role[0];
775
+                            }
770 776
                             DB::insert(
771 777
                                 prefix_table('restriction_to_roles'),
772 778
                                 array(
@@ -1314,8 +1320,11 @@  discard block
 block discarded – undo
1314 1320
             $tags = "";
1315 1321
             $rows = DB::query("SELECT tag FROM ".prefix_table("tags")." WHERE item_id=%i", $_POST['id']);
1316 1322
             foreach ($rows as $record) {
1317
-                if (empty($tags)) $tags = "<span style='' class='round-grey pointer tip' title='".addslashes($LANG['list_items_with_tag'])."' onclick='searchItemsWithTags(\"".$record['tag']."\")'><i class='fa fa-tag fa-sm'></i>&nbsp;<span class=\"item_tag\">".$record['tag']."</span></span>";
1318
-                else $tags .= "&nbsp;&nbsp;<span style='' class='round-grey pointer tip' title='".addslashes($LANG['list_items_with_tag'])."' onclick='searchItemsWithTags(\"".$record['tag']."\")'><i class='fa fa-tag fa-sm'></i>&nbsp;<span class=\"item_tag\">".$record['tag']."</span></span>";
1323
+                if (empty($tags)) {
1324
+                    $tags = "<span style='' class='round-grey pointer tip' title='".addslashes($LANG['list_items_with_tag'])."' onclick='searchItemsWithTags(\"".$record['tag']."\")'><i class='fa fa-tag fa-sm'></i>&nbsp;<span class=\"item_tag\">".$record['tag']."</span></span>";
1325
+                } else {
1326
+                    $tags .= "&nbsp;&nbsp;<span style='' class='round-grey pointer tip' title='".addslashes($LANG['list_items_with_tag'])."' onclick='searchItemsWithTags(\"".$record['tag']."\")'><i class='fa fa-tag fa-sm'></i>&nbsp;<span class=\"item_tag\">".$record['tag']."</span></span>";
1327
+                }
1319 1328
             }
1320 1329
 
1321 1330
             // TODO -> improve this check
@@ -1423,8 +1432,11 @@  discard block
 block discarded – undo
1423 1432
                         $_POST['id']
1424 1433
                     );
1425 1434
                     foreach ($rows as $record) {
1426
-                        if (empty($tmp)) $tmp = "<a class='round-grey' href='".$_SESSION['settings']['cpassman_url']."/index.php?page=kb&id=".$record['id']."'><i class='fa fa-map-pin fa-sm'></i>&nbsp;".$record['label']."</a>";
1427
-                        else $tmp .= "&nbsp;<a class='round-grey' href='".$_SESSION['settings']['cpassman_url']."/index.php?page=kb&id=".$record['id']."'><i class='fa fa-map-pin fa-sm'></i>&nbsp;".$record['label']."</a>";
1435
+                        if (empty($tmp)) {
1436
+                            $tmp = "<a class='round-grey' href='".$_SESSION['settings']['cpassman_url']."/index.php?page=kb&id=".$record['id']."'><i class='fa fa-map-pin fa-sm'></i>&nbsp;".$record['label']."</a>";
1437
+                        } else {
1438
+                            $tmp .= "&nbsp;<a class='round-grey' href='".$_SESSION['settings']['cpassman_url']."/index.php?page=kb&id=".$record['id']."'><i class='fa fa-map-pin fa-sm'></i>&nbsp;".$record['label']."</a>";
1439
+                        }
1428 1440
                     }
1429 1441
                     $arrData['links_to_kbs'] = $tmp;
1430 1442
                 }
@@ -2063,9 +2075,13 @@  discard block
 block discarded – undo
2063 2075
                     $role,
2064 2076
                     $_POST['id']
2065 2077
                 );
2066
-                if ($access['type'] == "R") array_push($arrTmp, 1);
2067
-                else if ($access['type'] == "W") array_push($arrTmp, 0);
2068
-                else array_push($arrTmp, 3);
2078
+                if ($access['type'] == "R") {
2079
+                    array_push($arrTmp, 1);
2080
+                } else if ($access['type'] == "W") {
2081
+                    array_push($arrTmp, 0);
2082
+                } else {
2083
+                    array_push($arrTmp, 3);
2084
+                }
2069 2085
             }
2070 2086
             $accessLevel = min($arrTmp);
2071 2087
 //echo $_POST['id']." - ".$accessLevel." - ";
Please login to merge, or discard this patch.
sources/main.functions.php 5 patches
Doc Comments   +34 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@  discard block
 block discarded – undo
33 33
 use \Defuse\Crypto\Exception as Ex;
34 34
 
35 35
 //Generate N# of random bits for use as salt
36
+/**
37
+ * @param integer $n
38
+ */
36 39
 function getBits($n)
37 40
 {
38 41
     $str = '';
@@ -73,6 +76,7 @@  discard block
 block discarded – undo
73 76
  * encryptOld()
74 77
  *
75 78
  * crypt a string
79
+ * @param string $text
76 80
  */
77 81
 function encryptOld($text, $personalSalt = "")
78 82
 {
@@ -149,6 +153,7 @@  discard block
 block discarded – undo
149 153
  * encrypt()
150 154
  *
151 155
  * crypt a string
156
+ * @param string $decrypted
152 157
  */
153 158
 function encrypt($decrypted, $personalSalt = "")
154 159
 {
@@ -235,6 +240,7 @@  discard block
 block discarded – undo
235 240
  * genHash()
236 241
  *
237 242
  * Generate a hash for user login
243
+ * @param string $password
238 244
  */
239 245
 function bCrypt($password, $cost)
240 246
 {
@@ -349,6 +355,10 @@  discard block
 block discarded – undo
349 355
     return hex2bin($val);
350 356
 }
351 357
 
358
+/**
359
+ * @param string $ascii_key
360
+ * @param string $type
361
+ */
352 362
 function cryption($message, $ascii_key, $type) //defuse_crypto
353 363
 {
354 364
     // load PhpEncryption library
@@ -439,6 +449,9 @@  discard block
 block discarded – undo
439 449
     return $protected_key_encoded;  // save this in user table
440 450
 }
441 451
 
452
+/**
453
+ * @param string $psk
454
+ */
442 455
 function defuse_validate_personal_key($psk, $protected_key_encoded) {
443 456
     require_once '../includes/libraries/Encryption/Encryption/Crypto.php';
444 457
     require_once '../includes/libraries/Encryption/Encryption/Encoding.php';
@@ -469,6 +482,8 @@  discard block
 block discarded – undo
469 482
  * trimElement()
470 483
  *
471 484
  * trim a string depending on a specific string
485
+ * @param string $element
486
+ * @return string
472 487
  */
473 488
 function trimElement($chaine, $element)
474 489
 {
@@ -514,6 +529,7 @@  discard block
 block discarded – undo
514 529
  * identifyUserRights()
515 530
  *
516 531
  * @return
532
+ * @param boolean $refresh
517 533
  */
518 534
 function identifyUserRights($groupesVisiblesUser, $groupesInterditsUser, $isAdmin, $idFonctions, $refresh)
519 535
 {
@@ -818,6 +834,7 @@  discard block
 block discarded – undo
818 834
  * updateCacheTable()
819 835
  *
820 836
  * Update the CACHE table
837
+ * @param string $action
821 838
  */
822 839
 function updateCacheTable($action, $id = "")
823 840
 {
@@ -1190,7 +1207,7 @@  discard block
 block discarded – undo
1190 1207
 /**
1191 1208
  * isUTF8()
1192 1209
  *
1193
- * @return string is the string in UTF8 format.
1210
+ * @return integer is the string in UTF8 format.
1194 1211
  */
1195 1212
 
1196 1213
 function isUTF8($string)
@@ -1215,6 +1232,9 @@  discard block
 block discarded – undo
1215 1232
 * FUNCTION
1216 1233
 * permits to prepare data to be exchanged
1217 1234
 */
1235
+/**
1236
+ * @param string $type
1237
+ */
1218 1238
 function prepareExchangedData($data, $type)
1219 1239
 {
1220 1240
     //load ClassLoader
@@ -1287,6 +1307,9 @@  discard block
 block discarded – undo
1287 1307
 /*
1288 1308
 ** check table prefix in SQL query
1289 1309
 */
1310
+/**
1311
+ * @param string $table
1312
+ */
1290 1313
 function prefix_table($table)
1291 1314
 {
1292 1315
     global $pre;
@@ -1325,6 +1348,9 @@  discard block
 block discarded – undo
1325 1348
 /*
1326 1349
 * Send sysLOG message
1327 1350
 */
1351
+/**
1352
+ * @param string $message
1353
+ */
1328 1354
 function send_syslog($message, $component = "teampass", $program = "php", $host , $port)
1329 1355
 {
1330 1356
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
@@ -1340,6 +1366,9 @@  discard block
 block discarded – undo
1340 1366
  * logEvents()
1341 1367
  *
1342 1368
  * permits to log events into DB
1369
+ * @param string $type
1370
+ * @param string $label
1371
+ * @param string $field_1
1343 1372
  */
1344 1373
 function logEvents($type, $label, $who, $login="", $field_1 = NULL)
1345 1374
 {
@@ -1378,6 +1407,10 @@  discard block
 block discarded – undo
1378 1407
     }
1379 1408
 }
1380 1409
 
1410
+/**
1411
+ * @param string $item
1412
+ * @param string $action
1413
+ */
1381 1414
 function logItems($id, $item, $id_user, $action, $login = "", $raison = NULL, $raison_iv = NULL, $encryption_type = "")
1382 1415
 {
1383 1416
     global $server, $user, $pass, $database, $pre, $port, $encoding;
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,6 @@
 block discarded – undo
25 25
     require_once $_SESSION['settings']['cpassman_dir'] . '/includes/config/settings.php';
26 26
 }
27 27
 use PHP_Crypt\PHP_Crypt as PHP_Crypt;
28
-use PHP_Crypt\Cipher as Cipher;
29 28
 
30 29
 
31 30
 // prepare Encryption class calls
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
     }
160 160
 
161 161
     if (!empty($personalSalt)) {
162
-         $staticSalt = $personalSalt;
162
+            $staticSalt = $personalSalt;
163 163
     } else {
164
-         $staticSalt = SALT;
164
+            $staticSalt = SALT;
165 165
     }
166 166
 
167 167
     //set our salt to a variable
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
                     'author' => $record['id_user'],
899 899
                     'renewal_period' => isset($resNT['renewal_period']) ? $resNT['renewal_period'] : "0",
900 900
                     'timestamp' => $record['date']
901
-                   )
901
+                    )
902 902
             );
903 903
         }
904 904
         // UPDATE an item
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
                 'login' => isset($data['login']) ? $data['login'] : "",
944 944
                 'folder' => $folder,
945 945
                 'author' => $_SESSION['user_id'],
946
-               ),
946
+                ),
947 947
             "id = %i",
948 948
             $id
949 949
         );
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
                 'folder' => $folder,
997 997
                 'author' => $_SESSION['user_id'],
998 998
                 'timestamp' => $data['date']
999
-               )
999
+                )
1000 1000
         );
1001 1001
         // DELETE an item
1002 1002
     } elseif ($action === "delete_value") {
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
 *
1009 1009
 */
1010 1010
 function getStatisticsData() {
1011
-     DB::query(
1011
+        DB::query(
1012 1012
         "SELECT id FROM ".prefix_table("nested_tree")." WHERE personal_folder = %i",
1013 1013
         0
1014 1014
     );
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
 
1583 1583
     $cf_diff = array_diff($source_cf, $target_cf);
1584 1584
     if (count($cf_diff) > 0) {
1585
-       return false;
1585
+        return false;
1586 1586
     }
1587 1587
 
1588 1588
     return true;
@@ -1645,7 +1645,7 @@  discard block
 block discarded – undo
1645 1645
                 prefix_table('files'),
1646 1646
                 array(
1647 1647
                     'status' => 'encrypted'
1648
-                   ),
1648
+                    ),
1649 1649
                 "id=%i",
1650 1650
                 substr($_POST['uri'], 1)
1651 1651
             );
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
                 prefix_table('files'),
1689 1689
                 array(
1690 1690
                     'status' => 'clear'
1691
-                   ),
1691
+                    ),
1692 1692
                 "id=%i",
1693 1693
                 substr($_POST['uri'], 1)
1694 1694
             );
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
     require_once '../includes/libraries/phpcrypt/phpCrypt.php';
22 22
     require_once '../includes/config/settings.php';
23 23
 } else {
24
-    require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/phpcrypt/phpCrypt.php';
25
-    require_once $_SESSION['settings']['cpassman_dir'] . '/includes/config/settings.php';
24
+    require_once $_SESSION['settings']['cpassman_dir'].'/includes/libraries/phpcrypt/phpCrypt.php';
25
+    require_once $_SESSION['settings']['cpassman_dir'].'/includes/config/settings.php';
26 26
 }
27 27
 use PHP_Crypt\PHP_Crypt as PHP_Crypt;
28 28
 use PHP_Crypt\Cipher as Cipher;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 {
38 38
     $str = '';
39 39
     $x = $n + 10;
40
-    for ($i=0; $i<$x; $i++) {
40
+    for ($i = 0; $i < $x; $i++) {
41 41
         $str .= base_convert(mt_rand(1, 36), 10, 36);
42 42
     }
43 43
     return substr($str, 0, $n);
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 //generate pbkdf2 compliant hash
47 47
 function strHashPbkdf2($p, $s, $c, $kl, $a = 'sha256', $st = 0)
48 48
 {
49
-    $kb = $st+$kl;  // Key blocks to compute
50
-    $dk = '';    // Derived key
49
+    $kb = $st + $kl; // Key blocks to compute
50
+    $dk = ''; // Derived key
51 51
 
52
-    for ($block=1; $block<=$kb; $block++) { // Create key
53
-        $ib = $h = hash_hmac($a, $s . pack('N', $block), $p, true); // Initial hash for this block
54
-        for ($i=1; $i<$c; $i++) { // Perform block iterations
55
-            $ib ^= ($h = hash_hmac($a, $h, $p, true));  // XOR each iterate
52
+    for ($block = 1; $block <= $kb; $block++) { // Create key
53
+        $ib = $h = hash_hmac($a, $s.pack('N', $block), $p, true); // Initial hash for this block
54
+        for ($i = 1; $i < $c; $i++) { // Perform block iterations
55
+            $ib ^= ($h = hash_hmac($a, $h, $p, true)); // XOR each iterate
56 56
         }
57 57
         $dk .= $ib; // Append iterated block
58 58
     }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     if (!isset($_SESSION['settings']['cpassman_dir']) || empty($_SESSION['settings']['cpassman_dir'])) {
156 156
         require_once '../includes/libraries/Encryption/PBKDF2/PasswordHash.php';
157 157
     } else {
158
-        require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Encryption/PBKDF2/PasswordHash.php';
158
+        require_once $_SESSION['settings']['cpassman_dir'].'/includes/libraries/Encryption/PBKDF2/PasswordHash.php';
159 159
     }
160 160
 
161 161
     if (!empty($personalSalt)) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     $pbkdf2Salt = getBits(64);
170 170
     // generate a pbkdf2 key to use for the encryption.
171 171
     //$key = strHashPbkdf2($staticSalt, $pbkdf2Salt, ITCOUNT, 16, 'sha256', 32);
172
-    $key = substr(pbkdf2('sha256', $staticSalt, $pbkdf2Salt, ITCOUNT, 16+32, true), 32, 16);
172
+    $key = substr(pbkdf2('sha256', $staticSalt, $pbkdf2Salt, ITCOUNT, 16 + 32, true), 32, 16);
173 173
     // Build $iv and $ivBase64.  We use a block size of 256 bits (AES compliant)
174 174
     // and CTR mode.  (Note: ECB mode is inadequate as IV is not used.)
175 175
     $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, 'ctr'), MCRYPT_RAND);
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     // MAC the encrypted text
184 184
     $mac = hash_hmac('sha256', $encrypted, $staticSalt);
185 185
     // We're done!
186
-    return base64_encode($ivBase64 . $encrypted . $mac . $pbkdf2Salt);
186
+    return base64_encode($ivBase64.$encrypted.$mac.$pbkdf2Salt);
187 187
 }
188 188
 
189 189
 /**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     if (!isset($_SESSION['settings']['cpassman_dir']) || empty($_SESSION['settings']['cpassman_dir'])) {
197 197
         require_once '../includes/libraries/Encryption/PBKDF2/PasswordHash.php';
198 198
     } else {
199
-        require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Encryption/PBKDF2/PasswordHash.php';
199
+        require_once $_SESSION['settings']['cpassman_dir'].'/includes/libraries/Encryption/PBKDF2/PasswordHash.php';
200 200
     }
201 201
 
202 202
     if (!empty($personalSalt)) {
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
     //remove the salt from the string
212 212
     $encrypted = substr($encrypted, 0, -64);
213 213
     //$key = strHashPbkdf2($staticSalt, $pbkdf2Salt, ITCOUNT, 16, 'sha256', 32);
214
-    $key = substr(pbkdf2('sha256', $staticSalt, $pbkdf2Salt, ITCOUNT, 16+32, true), 32, 16);
214
+    $key = substr(pbkdf2('sha256', $staticSalt, $pbkdf2Salt, ITCOUNT, 16 + 32, true), 32, 16);
215 215
     // Retrieve $iv which is the first 22 characters plus ==, base64_decoded.
216
-    $iv = base64_decode(substr($encrypted, 0, 43) . '==');
216
+    $iv = base64_decode(substr($encrypted, 0, 43).'==');
217 217
     // Remove $iv from $encrypted.
218 218
     $encrypted = substr($encrypted, 43);
219 219
     // Retrieve $mac which is the last 64 characters of $encrypted.
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
     if (function_exists('openssl_random_pseudo_bytes')) {
243 243
         $salt .= bin2hex(openssl_random_pseudo_bytes(11));
244 244
     } else {
245
-        $chars='./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
246
-        for ($i=0; $i<22; $i++) {
247
-            $salt.=$chars[mt_rand(0, 63)];
245
+        $chars = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
246
+        for ($i = 0; $i < 22; $i++) {
247
+            $salt .= $chars[mt_rand(0, 63)];
248 248
         }
249 249
     }
250 250
     return crypt($password, $salt);
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     }
342 342
 }
343 343
 
344
-function testHex2Bin ($val)
344
+function testHex2Bin($val)
345 345
 {
346 346
     if (!@hex2bin($val)) {
347 347
         throw new Exception("ERROR");
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     if (!isset($_SESSION['settings']['cpassman_dir']) || empty($_SESSION['settings']['cpassman_dir'])) {
356 356
         $path = '../includes/libraries/Encryption/Encryption/';
357 357
     } else {
358
-        $path = $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
358
+        $path = $_SESSION['settings']['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
359 359
     }
360 360
 
361 361
     require_once $path.'Crypto.php';
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
437 437
     $protected_key_encoded = $protected_key->saveToAsciiSafeString();
438 438
 
439
-    return $protected_key_encoded;  // save this in user table
439
+    return $protected_key_encoded; // save this in user table
440 440
 }
441 441
 
442 442
 function defuse_validate_personal_key($psk, $protected_key_encoded) {
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
         return "Error - The saltkey is not the correct one.";
463 463
     }
464 464
 
465
-    return $user_key_encoded;   // store it in session once user has entered his psk
465
+    return $user_key_encoded; // store it in session once user has entered his psk
466 466
 }
467 467
 
468 468
 /**
@@ -505,8 +505,8 @@  discard block
 block discarded – undo
505 505
 }
506 506
 
507 507
 function db_error_handler($params) {
508
-    echo "Error: " . $params['error'] . "<br>\n";
509
-    echo "Query: " . $params['query'] . "<br>\n";
508
+    echo "Error: ".$params['error']."<br>\n";
509
+    echo "Query: ".$params['query']."<br>\n";
510 510
     die; // don't want to keep going if a query broke
511 511
 }
512 512
 
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
                     $tmp = DB::queryfirstrow("SELECT allow_pw_change FROM ".prefix_table("roles_title")." WHERE id = %i", $roleId);
636 636
                     foreach ($rows as $record) {
637 637
                         if (isset($record['folder_id']) && !in_array($record['folder_id'], $listAllowedFolders)) {
638
-                            array_push($listAllowedFolders, $record['folder_id']);//echo $record['folder_id'].";";
638
+                            array_push($listAllowedFolders, $record['folder_id']); //echo $record['folder_id'].";";
639 639
                         }
640 640
                         // Check if this group is allowed to modify any pw in allowed folders
641 641
                         if ($tmp['allow_pw_change'] == 1 && !in_array($record['folder_id'], $listFoldersEditableByRole)) {
@@ -736,14 +736,14 @@  discard block
 block discarded – undo
736 736
             // get list of readonly folders when pf is disabled.
737 737
             // rule - if one folder is set as W or N in one of the Role, then User has access as W
738 738
             foreach ($listAllowedFolders as $folderId) {
739
-                if (!in_array($folderId, array_unique (array_merge ($listReadOnlyFolders, $_SESSION['personal_folders'])))) {   //
739
+                if (!in_array($folderId, array_unique(array_merge($listReadOnlyFolders, $_SESSION['personal_folders'])))) {   //
740 740
                     DB::query(
741 741
                         "SELECT *
742 742
                         FROM ".prefix_table("roles_values")."
743 743
                         WHERE folder_id = %i AND role_id IN %li AND type IN %ls",
744 744
                         $folderId,
745 745
                         $fonctionsAssociees,
746
-                        array("W","ND","NE","NDNE")
746
+                        array("W", "ND", "NE", "NDNE")
747 747
 
748 748
                     );
749 749
                     if (DB::count() == 0 && !in_array($folderId, $groupesVisiblesUser)) {
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
                         WHERE folder_id = %i AND role_id IN %li AND type IN %ls",
763 763
                         $folderId,
764 764
                         $fonctionsAssociees,
765
-                        array("W","ND","NE","NDNE")
765
+                        array("W", "ND", "NE", "NDNE")
766 766
                     );
767 767
                     if (DB::count() == 0 && !in_array($folderId, $groupesVisiblesUser)) {
768 768
                         array_push($listReadOnlyFolders, $folderId);
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
     global $LANG;
1122 1122
     include $_SESSION['settings']['cpassman_dir'].'/includes/config/settings.php';
1123 1123
     //load library
1124
-    $user_language = isset($_SESSION['user_language']) ?$_SESSION['user_language'] : "english";
1124
+    $user_language = isset($_SESSION['user_language']) ? $_SESSION['user_language'] : "english";
1125 1125
     require_once $_SESSION['settings']['cpassman_dir'].'/includes/language/'.$user_language.'.php';
1126 1126
     require_once $_SESSION['settings']['cpassman_dir'].'/includes/libraries/Email/Phpmailer/PHPMailerAutoload.php';
1127 1127
 
@@ -1230,19 +1230,19 @@  discard block
 block discarded – undo
1230 1230
         ) {
1231 1231
             return json_encode(
1232 1232
                 $data,
1233
-                JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP
1233
+                JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
1234 1234
             );
1235 1235
         } else {
1236 1236
             return Encryption\Crypt\aesctr::encrypt(
1237 1237
                 json_encode(
1238 1238
                     $data,
1239
-                    JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP
1239
+                    JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
1240 1240
                 ),
1241 1241
                 $_SESSION['key'],
1242 1242
                 256
1243 1243
             );
1244 1244
         }
1245
-    } elseif  ($type == "decode") {
1245
+    } elseif ($type == "decode") {
1246 1246
         if (
1247 1247
             isset($_SESSION['settings']['encryptClientServer'])
1248 1248
             && $_SESSION['settings']['encryptClientServer'] == 0
@@ -1303,7 +1303,7 @@  discard block
 block discarded – undo
1303 1303
 /*
1304 1304
  * Creates a KEY using PasswordLib
1305 1305
  */
1306
-function GenerateCryptKey($size="", $secure="", $numerals="", $capitalize="", $ambiguous="", $symbols="")
1306
+function GenerateCryptKey($size = "", $secure = "", $numerals = "", $capitalize = "", $ambiguous = "", $symbols = "")
1307 1307
 {
1308 1308
     // load library
1309 1309
     $pwgen = new SplClassLoader('Encryption\PwGen', '../includes/libraries');
@@ -1311,12 +1311,12 @@  discard block
 block discarded – undo
1311 1311
     $pwgen = new Encryption\PwGen\pwgen();
1312 1312
 
1313 1313
     // init
1314
-    if(!empty($size)) $pwgen->setLength($size);
1315
-    if(!empty($secure)) $pwgen->setSecure($secure);
1316
-    if(!empty($numerals)) $pwgen->setNumerals($numerals);
1317
-    if(!empty($capitalize)) $pwgen->setCapitalize($capitalize);
1318
-    if(!empty($ambiguous)) $pwgen->setAmbiguous($ambiguous);
1319
-    if(!empty($symbols)) $pwgen->setSymbols($symbols);
1314
+    if (!empty($size)) $pwgen->setLength($size);
1315
+    if (!empty($secure)) $pwgen->setSecure($secure);
1316
+    if (!empty($numerals)) $pwgen->setNumerals($numerals);
1317
+    if (!empty($capitalize)) $pwgen->setCapitalize($capitalize);
1318
+    if (!empty($ambiguous)) $pwgen->setAmbiguous($ambiguous);
1319
+    if (!empty($symbols)) $pwgen->setSymbols($symbols);
1320 1320
 
1321 1321
     // generate and send back
1322 1322
     return $pwgen->generate();
@@ -1325,11 +1325,11 @@  discard block
 block discarded – undo
1325 1325
 /*
1326 1326
 * Send sysLOG message
1327 1327
 */
1328
-function send_syslog($message, $component = "teampass", $program = "php", $host , $port)
1328
+function send_syslog($message, $component = "teampass", $program = "php", $host, $port)
1329 1329
 {
1330 1330
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1331 1331
         //$syslog_message = "<123>" . date('M d H:i:s ') . " " .$host . " " . $component . ": " . $message;
1332
-    $syslog_message = "<123>" . date('M d H:i:s ') . $component . ": " . $message;
1332
+    $syslog_message = "<123>".date('M d H:i:s ').$component.": ".$message;
1333 1333
         socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1334 1334
     socket_close($sock);
1335 1335
 }
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
  *
1342 1342
  * permits to log events into DB
1343 1343
  */
1344
-function logEvents($type, $label, $who, $login="", $field_1 = NULL)
1344
+function logEvents($type, $label, $who, $login = "", $field_1 = NULL)
1345 1345
 {
1346 1346
     global $server, $user, $pass, $database, $pre, $port, $encoding;
1347 1347
 
@@ -1370,10 +1370,10 @@  discard block
 block discarded – undo
1370 1370
         )
1371 1371
     );
1372 1372
     if (isset($_SESSION['settings']['syslog_enable']) && $_SESSION['settings']['syslog_enable'] == 1) {
1373
-        if ($type == "user_mngt"){
1374
-            send_syslog("The User " .$login. " perform the acction off " .$label. " to the user " .$field_1. " - " .$type,"teampass","php",$_SESSION['settings']['syslog_host'],$_SESSION['settings']['syslog_port']);
1373
+        if ($type == "user_mngt") {
1374
+            send_syslog("The User ".$login." perform the acction off ".$label." to the user ".$field_1." - ".$type, "teampass", "php", $_SESSION['settings']['syslog_host'], $_SESSION['settings']['syslog_port']);
1375 1375
         } else {
1376
-            send_syslog("The User " .$login. " perform the acction off " .$label. " - " .$type,"teampass","php",$_SESSION['settings']['syslog_host'],$_SESSION['settings']['syslog_port']);
1376
+            send_syslog("The User ".$login." perform the acction off ".$label." - ".$type, "teampass", "php", $_SESSION['settings']['syslog_host'], $_SESSION['settings']['syslog_port']);
1377 1377
         }
1378 1378
     }
1379 1379
 }
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
             )
1407 1407
         );
1408 1408
         if (isset($_SESSION['settings']['syslog_enable']) && $_SESSION['settings']['syslog_enable'] == 1) {
1409
-                send_syslog("The Item ".$item." was ".$action." by ".$login." ".$raison,"teampass","php",$_SESSION['settings']['syslog_host'],$_SESSION['settings']['syslog_port']);
1409
+                send_syslog("The Item ".$item." was ".$action." by ".$login." ".$raison, "teampass", "php", $_SESSION['settings']['syslog_host'], $_SESSION['settings']['syslog_port']);
1410 1410
         }
1411 1411
 }
1412 1412
 
@@ -1417,15 +1417,15 @@  discard block
 block discarded – undo
1417 1417
     $ipaddress = '';
1418 1418
     if (getenv('HTTP_CLIENT_IP'))
1419 1419
         $ipaddress = getenv('HTTP_CLIENT_IP');
1420
-    else if(getenv('HTTP_X_FORWARDED_FOR'))
1420
+    else if (getenv('HTTP_X_FORWARDED_FOR'))
1421 1421
         $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
1422
-    else if(getenv('HTTP_X_FORWARDED'))
1422
+    else if (getenv('HTTP_X_FORWARDED'))
1423 1423
         $ipaddress = getenv('HTTP_X_FORWARDED');
1424
-    else if(getenv('HTTP_FORWARDED_FOR'))
1424
+    else if (getenv('HTTP_FORWARDED_FOR'))
1425 1425
         $ipaddress = getenv('HTTP_FORWARDED_FOR');
1426
-    else if(getenv('HTTP_FORWARDED'))
1426
+    else if (getenv('HTTP_FORWARDED'))
1427 1427
         $ipaddress = getenv('HTTP_FORWARDED');
1428
-    else if(getenv('REMOTE_ADDR'))
1428
+    else if (getenv('REMOTE_ADDR'))
1429 1429
         $ipaddress = getenv('REMOTE_ADDR');
1430 1430
     else
1431 1431
         $ipaddress = 'UNKNOWN';
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
         // perform a copy
1473 1473
         if (file_exists($tp_config_file)) {
1474 1474
             if (!copy($tp_config_file, $tp_config_file.'.'.date("Y_m_d_His", time()))) {
1475
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
1475
+                return "ERROR: Could not copy file '".$tp_config_file."'";
1476 1476
             }
1477 1477
         }
1478 1478
 
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
         $data = file($tp_config_file);
1495 1495
         $x = 0;
1496 1496
         $bFound = false;
1497
-        foreach($data as $line) {
1497
+        foreach ($data as $line) {
1498 1498
             if (stristr($line, ");")) break;
1499 1499
             if (stristr($line, "'".$field."' => '")) {
1500 1500
                 $data[$x] = "    '".$field."' => '".$value."',\n";
@@ -1504,7 +1504,7 @@  discard block
 block discarded – undo
1504 1504
             $x++;
1505 1505
         }
1506 1506
         if ($bFound === false) {
1507
-            $data[($x-1)] = "    '".$field."' => '".$value."',\n";
1507
+            $data[($x - 1)] = "    '".$field."' => '".$value."',\n";
1508 1508
         }
1509 1509
     } else {
1510 1510
         // ERROR
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
 /*
1520 1520
 ** Permits to replace &#92; to permit correct display
1521 1521
 */
1522
-function handleBackslash ($input)
1522
+function handleBackslash($input)
1523 1523
 {
1524 1524
     return str_replace("&amp;#92;", "&#92;", $input);
1525 1525
 }
@@ -1527,15 +1527,15 @@  discard block
 block discarded – undo
1527 1527
 /*
1528 1528
 ** Permits to loas settings
1529 1529
 */
1530
-function loadSettings ()
1530
+function loadSettings()
1531 1531
 {
1532 1532
     /* LOAD CPASSMAN SETTINGS */
1533 1533
     if (!isset($_SESSION['settings']['loaded']) || $_SESSION['settings']['loaded'] != 1) {
1534
-        $_SESSION['settings']['duplicate_folder'] = 0;  //by default, this is false;
1535
-        $_SESSION['settings']['duplicate_item'] = 0;  //by default, this is false;
1534
+        $_SESSION['settings']['duplicate_folder'] = 0; //by default, this is false;
1535
+        $_SESSION['settings']['duplicate_item'] = 0; //by default, this is false;
1536 1536
         $_SESSION['settings']['number_of_used_pw'] = 5; //by default, this value is 5;
1537 1537
 
1538
-        $rows = DB::query("SELECT * FROM " . prefix_table("misc") . " WHERE type=%s_type OR type=%s_type2",
1538
+        $rows = DB::query("SELECT * FROM ".prefix_table("misc")." WHERE type=%s_type OR type=%s_type2",
1539 1539
             array(
1540 1540
                 'type' => "admin",
1541 1541
                 'type2' => "settings"
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
             unlink($file);
1717 1717
         } else {
1718 1718
             $lines = array();
1719
-            exec("DEL /F/Q \"" . $file . "\"", $lines, $deleteError);
1719
+            exec("DEL /F/Q \"".$file."\"", $lines, $deleteError);
1720 1720
         }
1721 1721
     }
1722 1722
 }
1723 1723
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +56 added lines, -42 removed lines patch added patch discarded remove patch
@@ -309,18 +309,18 @@  discard block
 block discarded – undo
309 309
         );
310 310
     } else if ($type == "decrypt") {
311 311
         // case if IV is empty
312
-        if (empty($iv))
313
-            return array(
312
+        if (empty($iv)) {
313
+                    return array(
314 314
                 'string' => "",
315 315
                 'error' => "ERR_ENCRYPTION_NOT_CORRECT"
316 316
             );
317
+        }
317 318
 
318 319
         // convert
319 320
         try {
320 321
             $string = testHex2Bin(trim($string));
321 322
             $iv = testHex2Bin($iv);
322
-        }
323
-        catch (Exception $e) {
323
+        } catch (Exception $e) {
324 324
             // error - $e->getMessage();
325 325
             return array(
326 326
                 'string' => "",
@@ -383,20 +383,15 @@  discard block
 block discarded – undo
383 383
         } else if ($type === "decrypt") {
384 384
             $text = \Defuse\Crypto\Crypto::decrypt($message, $key);
385 385
         }
386
-    }
387
-    catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
386
+    } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
388 387
         $err = "An attack! Either the wrong key was loaded, or the ciphertext has changed since it was created either corrupted in the database or intentionally modified by someone trying to carry out an attack.";
389
-    }
390
-    catch (Defuse\Crypto\Exception\BadFormatException $ex) {
388
+    } catch (Defuse\Crypto\Exception\BadFormatException $ex) {
391 389
         $err = $ex;
392
-    }
393
-    catch (Defuse\Crypto\Exception\EnvironmentIsBrokenException $ex) {
390
+    } catch (Defuse\Crypto\Exception\EnvironmentIsBrokenException $ex) {
394 391
         $err = $ex;
395
-    }
396
-    catch (Defuse\Crypto\Exception\CryptoException $ex) {
392
+    } catch (Defuse\Crypto\Exception\CryptoException $ex) {
397 393
         $err = $ex;
398
-    }
399
-    catch (Defuse\Crypto\Exception\IOException $ex) {
394
+    } catch (Defuse\Crypto\Exception\IOException $ex) {
400 395
         $err = $ex;
401 396
     }
402 397
 
@@ -454,11 +449,9 @@  discard block
 block discarded – undo
454 449
         $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
455 450
         $user_key = $protected_key->unlockKey($psk);
456 451
         $user_key_encoded = $user_key->saveToAsciiSafeString();
457
-    }
458
-    catch (Defuse\Crypto\Exception\EnvironmentIsBrokenException $ex) {
452
+    } catch (Defuse\Crypto\Exception\EnvironmentIsBrokenException $ex) {
459 453
         return "Error - Major issue as the encryption is broken.";
460
-    }
461
-    catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
454
+    } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
462 455
         return "Error - The saltkey is not the correct one.";
463 456
     }
464 457
 
@@ -1126,7 +1119,9 @@  discard block
 block discarded – undo
1126 1119
     require_once $_SESSION['settings']['cpassman_dir'].'/includes/libraries/Email/Phpmailer/PHPMailerAutoload.php';
1127 1120
 
1128 1121
     // load PHPMailer
1129
-    if (!isset($mail)) $mail = new PHPMailer();
1122
+    if (!isset($mail)) {
1123
+        $mail = new PHPMailer();
1124
+    }
1130 1125
     // send to user
1131 1126
     $mail->setLanguage("en", "../includes/libraries/Email/Phpmailer/language/");
1132 1127
     $mail->SMTPDebug = 0; //value 1 can be used to debug
@@ -1195,7 +1190,9 @@  discard block
 block discarded – undo
1195 1190
 
1196 1191
 function isUTF8($string)
1197 1192
 {
1198
-    if (is_array($string) === true) $string = $string['string'];
1193
+    if (is_array($string) === true) {
1194
+        $string = $string['string'];
1195
+    }
1199 1196
     return preg_match(
1200 1197
         '%^(?:
1201 1198
         [\x09\x0A\x0D\x20-\x7E] # ASCII
@@ -1311,12 +1308,24 @@  discard block
 block discarded – undo
1311 1308
     $pwgen = new Encryption\PwGen\pwgen();
1312 1309
 
1313 1310
     // init
1314
-    if(!empty($size)) $pwgen->setLength($size);
1315
-    if(!empty($secure)) $pwgen->setSecure($secure);
1316
-    if(!empty($numerals)) $pwgen->setNumerals($numerals);
1317
-    if(!empty($capitalize)) $pwgen->setCapitalize($capitalize);
1318
-    if(!empty($ambiguous)) $pwgen->setAmbiguous($ambiguous);
1319
-    if(!empty($symbols)) $pwgen->setSymbols($symbols);
1311
+    if(!empty($size)) {
1312
+        $pwgen->setLength($size);
1313
+    }
1314
+    if(!empty($secure)) {
1315
+        $pwgen->setSecure($secure);
1316
+    }
1317
+    if(!empty($numerals)) {
1318
+        $pwgen->setNumerals($numerals);
1319
+    }
1320
+    if(!empty($capitalize)) {
1321
+        $pwgen->setCapitalize($capitalize);
1322
+    }
1323
+    if(!empty($ambiguous)) {
1324
+        $pwgen->setAmbiguous($ambiguous);
1325
+    }
1326
+    if(!empty($symbols)) {
1327
+        $pwgen->setSymbols($symbols);
1328
+    }
1320 1329
 
1321 1330
     // generate and send back
1322 1331
     return $pwgen->generate();
@@ -1345,7 +1354,9 @@  discard block
 block discarded – undo
1345 1354
 {
1346 1355
     global $server, $user, $pass, $database, $pre, $port, $encoding;
1347 1356
 
1348
-    if (empty($who)) $who = get_client_ip_server();
1357
+    if (empty($who)) {
1358
+        $who = get_client_ip_server();
1359
+    }
1349 1360
 
1350 1361
     // include librairies & connect to DB
1351 1362
     require_once $_SESSION['settings']['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
@@ -1415,20 +1426,21 @@  discard block
 block discarded – undo
1415 1426
  */
1416 1427
 function get_client_ip_server() {
1417 1428
     $ipaddress = '';
1418
-    if (getenv('HTTP_CLIENT_IP'))
1419
-        $ipaddress = getenv('HTTP_CLIENT_IP');
1420
-    else if(getenv('HTTP_X_FORWARDED_FOR'))
1421
-        $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
1422
-    else if(getenv('HTTP_X_FORWARDED'))
1423
-        $ipaddress = getenv('HTTP_X_FORWARDED');
1424
-    else if(getenv('HTTP_FORWARDED_FOR'))
1425
-        $ipaddress = getenv('HTTP_FORWARDED_FOR');
1426
-    else if(getenv('HTTP_FORWARDED'))
1427
-        $ipaddress = getenv('HTTP_FORWARDED');
1428
-    else if(getenv('REMOTE_ADDR'))
1429
-        $ipaddress = getenv('REMOTE_ADDR');
1430
-    else
1431
-        $ipaddress = 'UNKNOWN';
1429
+    if (getenv('HTTP_CLIENT_IP')) {
1430
+            $ipaddress = getenv('HTTP_CLIENT_IP');
1431
+    } else if(getenv('HTTP_X_FORWARDED_FOR')) {
1432
+            $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
1433
+    } else if(getenv('HTTP_X_FORWARDED')) {
1434
+            $ipaddress = getenv('HTTP_X_FORWARDED');
1435
+    } else if(getenv('HTTP_FORWARDED_FOR')) {
1436
+            $ipaddress = getenv('HTTP_FORWARDED_FOR');
1437
+    } else if(getenv('HTTP_FORWARDED')) {
1438
+            $ipaddress = getenv('HTTP_FORWARDED');
1439
+    } else if(getenv('REMOTE_ADDR')) {
1440
+            $ipaddress = getenv('REMOTE_ADDR');
1441
+    } else {
1442
+            $ipaddress = 'UNKNOWN';
1443
+    }
1432 1444
 
1433 1445
     return $ipaddress;
1434 1446
 }
@@ -1495,7 +1507,9 @@  discard block
 block discarded – undo
1495 1507
         $x = 0;
1496 1508
         $bFound = false;
1497 1509
         foreach($data as $line) {
1498
-            if (stristr($line, ");")) break;
1510
+            if (stristr($line, ");")) {
1511
+                break;
1512
+            }
1499 1513
             if (stristr($line, "'".$field."' => '")) {
1500 1514
                 $data[$x] = "    '".$field."' => '".$value."',\n";
1501 1515
                 $bFound = true;
Please login to merge, or discard this patch.
kb.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     "SELECT id, login FROM ".prefix_table("users")." ORDER BY login ASC"
41 41
 );
42 42
 $counter = DB::count();
43
-if ($counter>0) {
43
+if ($counter > 0) {
44 44
     foreach ($rows as $reccord) {
45 45
         $tab_users[$reccord['login']] = array(
46 46
             'id'=>$reccord['id'],
Please login to merge, or discard this patch.
items.offline.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -116,35 +116,35 @@  discard block
 block discarded – undo
116 116
         $("#offline_password").simplePassMeter({
117 117
             "requirements": {},
118 118
             "container": "#offline_pw_strength",
119
-            "defaultText" : "<?php echo $LANG['index_pw_level_txt'];?>",
119
+            "defaultText" : "<?php echo $LANG['index_pw_level_txt']; ?>",
120 120
             "ratings": [
121 121
                 {"minScore": 0,
122 122
                     "className": "meterFail",
123
-                    "text": "<?php echo $LANG['complex_level0'];?>"
123
+                    "text": "<?php echo $LANG['complex_level0']; ?>"
124 124
                 },
125 125
                 {"minScore": 25,
126 126
                     "className": "meterWarn",
127
-                    "text": "<?php echo $LANG['complex_level1'];?>"
127
+                    "text": "<?php echo $LANG['complex_level1']; ?>"
128 128
                 },
129 129
                 {"minScore": 50,
130 130
                     "className": "meterWarn",
131
-                    "text": "<?php echo $LANG['complex_level2'];?>"
131
+                    "text": "<?php echo $LANG['complex_level2']; ?>"
132 132
                 },
133 133
                 {"minScore": 60,
134 134
                     "className": "meterGood",
135
-                    "text": "<?php echo $LANG['complex_level3'];?>"
135
+                    "text": "<?php echo $LANG['complex_level3']; ?>"
136 136
                 },
137 137
                 {"minScore": 70,
138 138
                     "className": "meterGood",
139
-                    "text": "<?php echo $LANG['complex_level4'];?>"
139
+                    "text": "<?php echo $LANG['complex_level4']; ?>"
140 140
                 },
141 141
                 {"minScore": 80,
142 142
                     "className": "meterExcel",
143
-                    "text": "<?php echo $LANG['complex_level5'];?>"
143
+                    "text": "<?php echo $LANG['complex_level5']; ?>"
144 144
                 },
145 145
                 {"minScore": 90,
146 146
                     "className": "meterExcel",
147
-                    "text": "<?php echo $LANG['complex_level6'];?>"
147
+                    "text": "<?php echo $LANG['complex_level6']; ?>"
148 148
                 }
149 149
             ]
150 150
         });
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     function generateOfflineFile()
164 164
     {
165
-        $("#offline_information").html('<i class="fa fa-cog fa-spin"></i>&nbsp;<?php echo $LANG['please_wait'];?>').attr("class","").show();
165
+        $("#offline_information").html('<i class="fa fa-cog fa-spin"></i>&nbsp;<?php echo $LANG['please_wait']; ?>').attr("class","").show();
166 166
 
167 167
         //Get list of selected folders
168 168
         var ids = "";
@@ -172,19 +172,19 @@  discard block
 block discarded – undo
172 172
         });
173 173
 
174 174
         if (ids == "") {
175
-            $("#offline_information").show().html("<?php echo $LANG['error_no_selected_folder'];?>").attr("class","ui-state-error");
175
+            $("#offline_information").show().html("<?php echo $LANG['error_no_selected_folder']; ?>").attr("class","ui-state-error");
176 176
             setTimeout(function(){$("#offline_information").effect( "fade", "slow" );}, 1000);
177 177
             return;
178 178
         }
179 179
 
180 180
         if ($("#offline_password").val() == "") {
181
-            $("#offline_information").show().html("<?php echo $LANG['pdf_password_warning'];?>").attr("class","ui-state-error");
181
+            $("#offline_information").show().html("<?php echo $LANG['pdf_password_warning']; ?>").attr("class","ui-state-error");
182 182
             setTimeout(function(){$("#offline_information").effect( "fade", "slow" );}, 1000);
183 183
             return;
184 184
         }
185 185
 
186 186
         if ($("#offline_pw_strength_value").val() < $("#min_offline_pw_strength_value").val()) {
187
-            $("#offline_information").addClass("ui-state-error ui-corner-all").show().html("<?php echo $LANG['error_complex_not_enought'];?>");
187
+            $("#offline_information").addClass("ui-state-error ui-corner-all").show().html("<?php echo $LANG['error_complex_not_enought']; ?>");
188 188
             setTimeout(function(){$("#offline_information").effect( "fade", "slow" );}, 1000);
189 189
             return;
190 190
         }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     {
217 217
         // prpare list of ids to treat during this run
218 218
         if (idsList != "") {
219
-            $("#offline_information").html('<i class="fa fa-cog fa-spin"></i>&nbsp;<?php echo $LANG['please_wait'];?> - ' + Math.round((parseInt(cpt)*100)/parseInt(number)) + "%");
219
+            $("#offline_information").html('<i class="fa fa-cog fa-spin"></i>&nbsp;<?php echo $LANG['please_wait']; ?> - ' + Math.round((parseInt(cpt)*100)/parseInt(number)) + "%");
220 220
 
221 221
             tab = idsList.split(';');
222 222
             idTree = tab[0];
Please login to merge, or discard this patch.
admin.settings.load.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             $("#tbl_categories").append(
63 63
                 '<tr id="t_cat_'+data[0].id+'"><td colspan="2">'+
64 64
                 '<input type="text" id="catOrd_'+data[0].id+'" size="1" class="category_order" value="1" />&nbsp;&nbsp;'+
65
-                '<span class="fa-stack tip" title="<?php echo $LANG['field_add_in_category'];?>" onclick="fieldAdd('+
65
+                '<span class="fa-stack tip" title="<?php echo $LANG['field_add_in_category']; ?>" onclick="fieldAdd('+
66 66
                 data[0].id+')" style="cursor:pointer;">'+
67 67
                 '<i class="fa fa-square fa-stack-2x"></i><i class="fa fa-plus fa-stack-1x fa-inverse"></i>'+
68 68
                 '</span>&nbsp;'+
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
                 '<label for="item_'+data[0].id+'_cat" id="item_'+data[0].id+'">'+
71 71
                 $("#new_category_label").val()+'</label>'+
72 72
                 '</td><td>'+
73
-                '<span class="fa-stack tip" title="<?php echo $LANG['category_in_folders'];?>" onclick="catInFolders('+data[0].id+')" style="cursor:pointer;">'+
73
+                '<span class="fa-stack tip" title="<?php echo $LANG['category_in_folders']; ?>" onclick="catInFolders('+data[0].id+')" style="cursor:pointer;">'+
74 74
                 '<i class="fa fa-square fa-stack-2x"></i><i class="fa fa-edit fa-stack-1x fa-inverse"></i>'+
75 75
                 '</span>&nbsp;'+
76
-                '<?php echo $LANG['category_in_folders_title'];?>:'+
76
+                '<?php echo $LANG['category_in_folders_title']; ?>:'+
77 77
                 '<span style="font-family:italic; margin-left:10px;" id="catFolders_'+data[0].id+'"></span>'+
78 78
                 '<input type="hidden" id="catFoldersList_'+data[0].id+'" value="'+data[0].id+'" /></td><td></td>');
79 79
             // Add new cat
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     var data = $("input[name=sel_item]:checked").attr("id").split('_');
95 95
     $("#post_id").val(data[1]);
96 96
     $("#post_type").val("renameItem");
97
-    $("#category_confirm_text").html("<?php echo $LANG['confirm_rename'];?>");
97
+    $("#category_confirm_text").html("<?php echo $LANG['confirm_rename']; ?>");
98 98
     $("#category_confirm").dialog("open");
99 99
 }
100 100
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     var data = $("input[name=sel_item]:checked").attr("id").split('_');
106 106
     $("#post_id").val(data[1]);
107 107
     $("#post_type").val("deleteCategory");
108
-    $("#category_confirm_text").html("<?php echo $LANG['confirm_deletion'];?>");
108
+    $("#category_confirm_text").html("<?php echo $LANG['confirm_deletion']; ?>");
109 109
     $("#category_confirm").dialog("open");
110 110
 }
111 111
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     var data = $("input[name=sel_item]:checked").attr("id").split('_');
117 117
     $("#post_id").val(data[1]);
118 118
     $("#post_type").val("moveItem");
119
-    $("#category_confirm_text").html("<?php echo $LANG['confirm_moveto'];?>");
119
+    $("#category_confirm_text").html("<?php echo $LANG['confirm_moveto']; ?>");
120 120
     $("#category_confirm").dialog("open");
121 121
 }
122 122
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         "sources/categories.queries.php",
168 168
         {
169 169
             type    : "loadFieldsList",
170
-            title   : prepareExchangedData(sanitizeString($("#new_category_label").val()), "encode", "<?php echo $_SESSION['key'];?>")
170
+            title   : prepareExchangedData(sanitizeString($("#new_category_label").val()), "encode", "<?php echo $_SESSION['key']; ?>")
171 171
         },
172 172
         function(data) {
173 173
             var newList = '<table id="tbl_categories" style="">';
@@ -177,17 +177,17 @@  discard block
 block discarded – undo
177 177
                 if (val[0] === "1") {
178 178
                     newList += '<tr id="t_cat_'+val[1]+'"><td colspan="2">'+
179 179
                     '<input type="text" id="catOrd_'+val[1]+'" size="1" class="category_order" value="'+val[3]+'" />&nbsp;'+
180
-                    '<span class="fa-stack tip" title="<?php echo $LANG['field_add_in_category'];?>" onclick="fieldAdd('+
180
+                    '<span class="fa-stack tip" title="<?php echo $LANG['field_add_in_category']; ?>" onclick="fieldAdd('+
181 181
                     val[1]+')" style="cursor:pointer;">'+
182 182
                     '<i class="fa fa-square fa-stack-2x"></i><i class="fa fa-plus fa-stack-1x fa-inverse"></i>'+
183 183
                     '</span>&nbsp;'+
184 184
                     '<input type="radio" name="sel_item" id="item_'+val[1]+'_cat" />'+
185 185
                     '<label for="item_'+val[1]+'_cat" id="item_'+val[1]+'">'+val[2]+'</label>'+
186 186
                     '</td><td>'+
187
-                    '<span class="fa-stack tip" title="<?php echo $LANG['category_in_folders'];?>" onclick="catInFolders('+val[1]+')" style="cursor:pointer;">'+
187
+                    '<span class="fa-stack tip" title="<?php echo $LANG['category_in_folders']; ?>" onclick="catInFolders('+val[1]+')" style="cursor:pointer;">'+
188 188
                     '<i class="fa fa-square fa-stack-2x"></i><i class="fa fa-edit fa-stack-1x fa-inverse"></i>'+
189 189
                     '</span>&nbsp;'+
190
-                    '<?php echo $LANG['category_in_folders_title'];?>:'+
190
+                    '<?php echo $LANG['category_in_folders_title']; ?>:'+
191 191
                     '<span style="font-family:italic; margin-left:10px;" id="catFolders_'+val[1]+'">'+val[4]+'</span>'+
192 192
                     '<input type="hidden" id="catFoldersList_'+val[1]+'" value="'+val[5]+'" /></td></tr>';
193 193
                 } else {
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
                     if (val[4] !== "") {
200 200
                         newList += '<span id="encryt_data_'+val[1]+'" style="margin-left:4px; cursor:pointer;">';
201 201
                         if (val[4] === "1") {
202
-                            newList += '<i class="fa fa-key tip" title="<?php echo $LANG['encrypted_data'];?>" onclick="changeEncrypMode('+val[1]+', 1)"></i>';
202
+                            newList += '<i class="fa fa-key tip" title="<?php echo $LANG['encrypted_data']; ?>" onclick="changeEncrypMode('+val[1]+', 1)"></i>';
203 203
                         } else if (val[4] === "0") {
204
-                            newList += '<span class="fa-stack" title="<?php echo $LANG['not_encrypted_data'];?>" onclick="changeEncrypMode('+val[1]+', 0)"><i class="fa fa-key fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x fa-lg" style="color:red;"></i></span>';
204
+                            newList += '<span class="fa-stack" title="<?php echo $LANG['not_encrypted_data']; ?>" onclick="changeEncrypMode('+val[1]+', 0)"><i class="fa fa-key fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x fa-lg" style="color:red;"></i></span>';
205 205
                         }
206 206
                         newList += '</span>'
207 207
                     }
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     else if (action === "admin_action_change_salt_key") {
235 235
         option = aes_encrypt(sanitizeString($("#new_salt_key").val()));
236 236
     } else if (action === "admin_email_send_backlog") {
237
-        $("#email_testing_results").show().html("<?php echo addslashes($LANG['please_wait']);?>").attr("class","ui-corner-all ui-state-focus");
237
+        $("#email_testing_results").show().html("<?php echo addslashes($LANG['please_wait']); ?>").attr("class","ui-corner-all ui-state-focus");
238 238
     } else if (action === "admin_action_attachments_cryption") {
239 239
         option = $("input[name=attachments_cryption]:checked").val();
240 240
         if (option === "" || option === undefined) {
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         if (option === "" || option.length === 0) return;
262 262
 
263 263
         // convert to json string
264
-        option = prepareExchangedData(JSON.stringify(option) , "encode", "<?php echo $_SESSION['key'];?>");
264
+        option = prepareExchangedData(JSON.stringify(option) , "encode", "<?php echo $_SESSION['key']; ?>");
265 265
     }
266 266
     //Lauchn ajax query
267 267
     $.post(
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
             $("#div_loading").hide();
275 275
             if (data != null) {
276 276
                 if (data[0].result == "db_backup") {
277
-                    $("#result_admin_action_db_backup").html("<span class='fa fa-file-code-o'></span>&nbsp;<a href='"+data[0].href+"'><?php echo $LANG['pdf_download'];?></a>").show();
277
+                    $("#result_admin_action_db_backup").html("<span class='fa fa-file-code-o'></span>&nbsp;<a href='"+data[0].href+"'><?php echo $LANG['pdf_download']; ?></a>").show();
278 278
                 } else if (data[0].result == "pf_done") {
279 279
                     $("#result_admin_action_check_pf").html("<span class='fa fa-check mi-green'></span>").show();
280 280
                 } else if (data[0].result == "db_restore") {
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
                 } else if (data[0].result == "db_optimize") {
290 290
                     $("#result_admin_action_db_optimize").html("<span class='fa fa-check mi-green'></span>").show();
291 291
                 } else if (data[0].result == "purge_old_files") {
292
-                    $("#result_admin_action_purge_old_files").html("<span class='fa fa-check mi-green'></span>&nbsp;"+data[0].nb_files_deleted+"&nbsp;<? echo $LANG['admin_action_purge_old_files_result'];?>").show();
292
+                    $("#result_admin_action_purge_old_files").html("<span class='fa fa-check mi-green'></span>&nbsp;"+data[0].nb_files_deleted+"&nbsp;<? echo $LANG['admin_action_purge_old_files_result']; ?>").show();
293 293
                 } else if (data[0].result == "db_clean_items") {
294
-                    $("#result_admin_action_db_clean_items").html("<span class='fa fa-check mi-green'></span>&nbsp;"+data[0].nb_items_deleted+"&nbsp;<?php echo $LANG['admin_action_db_clean_items_result'];?>").show();
294
+                    $("#result_admin_action_db_clean_items").html("<span class='fa fa-check mi-green'></span>&nbsp;"+data[0].nb_items_deleted+"&nbsp;<?php echo $LANG['admin_action_db_clean_items_result']; ?>").show();
295 295
                 } else if (data[0].result == "changed_salt_key") {
296 296
                     //deconnect user
297 297
                     $("#menu_action").val("deconnexion");
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
                     window.location.href = "logout.php"
300 300
                 } else if (data[0].result == "email_test_conf" || data[0].result == "admin_email_send_backlog") {
301 301
                     if (data[0].error != "") {
302
-                        $("#email_testing_results").html("<?php echo addslashes($LANG['admin_email_result_nok']);?>&nbsp;"+data[0].message).show().attr("class","ui-state-error ui-corner-all");
302
+                        $("#email_testing_results").html("<?php echo addslashes($LANG['admin_email_result_nok']); ?>&nbsp;"+data[0].message).show().attr("class","ui-state-error ui-corner-all");
303 303
                     } else {
304
-                        $("#email_testing_results").html("<?php echo addslashes(str_replace("#email#", $_SESSION['user_email'], $LANG['admin_email_result_ok']));?>").show().attr("class","ui-corner-all ui-state-focus");
304
+                        $("#email_testing_results").html("<?php echo addslashes(str_replace("#email#", $_SESSION['user_email'], $LANG['admin_email_result_ok'])); ?>").show().attr("class","ui-corner-all ui-state-focus");
305 305
                     }
306 306
                 } else if (data[0].result == "pw_prefix_correct") {
307 307
                     $("result_admin_action_pw_prefix_correct").html(data[0].ret).show();
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
                 } else if (data[0].result === "backup_decrypt_fails") {
327 327
                     $("#result_admin_script_backup").html(data[0].msg).show();
328 328
                 } else if (data[0].result === "backup_decrypt_success") {
329
-                    $("#result_admin_script_backup").html("<span class='fa fa-check mi-green'></span>&nbsp;<?php echo addslashes($LANG['file_is_now_ready']);?> - " + data[0].msg).show(1).delay(5000).fadeOut(500);
329
+                    $("#result_admin_script_backup").html("<span class='fa fa-check mi-green'></span>&nbsp;<?php echo addslashes($LANG['file_is_now_ready']); ?> - " + data[0].msg).show(1).delay(5000).fadeOut(500);
330 330
                 }
331 331
                 //--
332 332
             }
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 *
340 340
 */
341 341
 function confirmChangingSk() {
342
-    if (confirm("<?php echo addslashes($LANG['confirm_database_reencryption']);?>")) {
342
+    if (confirm("<?php echo addslashes($LANG['confirm_database_reencryption']); ?>")) {
343 343
         changeMainSaltKey('starting', '');
344 344
     }
345 345
 }
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
     // start change
361 361
     if (start === "starting") {
362 362
         // inform
363
-        $("#changeMainSaltKey_message").html("<i class=\"fa fa-cog fa-spin fa\"></i>&nbsp;<?php echo $LANG['starting'];?>").show();
363
+        $("#changeMainSaltKey_message").html("<i class=\"fa fa-cog fa-spin fa\"></i>&nbsp;<?php echo $LANG['starting']; ?>").show();
364 364
 
365 365
         // launch query
366 366
         $.post(
367 367
             "sources/admin.queries.php",
368 368
             {
369 369
                 type     : "admin_action_change_salt_key___start",
370
-                key     : "<?php echo $_SESSION['key'];?>"
370
+                key     : "<?php echo $_SESSION['key']; ?>"
371 371
             },
372 372
             function(data) {
373 373
                 if (data[0].error == "" && data[0].nextAction == "encrypt_items") {
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
                     //changeMainSaltKey(0, "files");
380 380
                 } else {
381 381
                     // error mngt
382
-                    $("#changeMainSaltKey_message").html("<i class=\"fa fa-alert fa-spin fa\"></i>&nbsp;<?php echo $LANG['error_sent_back'];?> : "+data[0].error);
382
+                    $("#changeMainSaltKey_message").html("<i class=\"fa fa-alert fa-spin fa\"></i>&nbsp;<?php echo $LANG['error_sent_back']; ?> : "+data[0].error);
383 383
                 }
384 384
             },
385 385
             "json"
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
     } else if (isFinite(start) && object !== "") {
389 389
         console.log("Step Encrypt - " +start+" ; "+nb+" ; "+$("#changeMainSaltKey_itemsCount").val());
390 390
 
391
-        $("#changeMainSaltKey_message").html("<i class=\"fa fa-cog fa-spin fa\"></i>&nbsp;<?php echo $LANG['treating_items'];?>...&nbsp;"+start+" > "+(parseInt(start)+parseInt(nb))+" (<?php echo $LANG['total_number_of_items'];?> : "+$("#changeMainSaltKey_itemsCount").val()+")");
391
+        $("#changeMainSaltKey_message").html("<i class=\"fa fa-cog fa-spin fa\"></i>&nbsp;<?php echo $LANG['treating_items']; ?>...&nbsp;"+start+" > "+(parseInt(start)+parseInt(nb))+" (<?php echo $LANG['total_number_of_items']; ?> : "+$("#changeMainSaltKey_itemsCount").val()+")");
392 392
 
393 393
         $.post(
394 394
             "sources/admin.queries.php",
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                 start        : start,
399 399
                 length       : nb,
400 400
                 nbItems      : $("#changeMainSaltKey_itemsCount").val(),
401
-                key     : "<?php echo $_SESSION['key'];?>"
401
+                key     : "<?php echo $_SESSION['key']; ?>"
402 402
             },
403 403
             function(data) {
404 404
                 console.log("Next action: "+data[0].nextAction);
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
                     }
413 413
                     changeMainSaltKey(data[0].nextStart, object);
414 414
                 } else if (data[0].nextAction === "finishing") {
415
-                    $("#changeMainSaltKey_message").html("<?php echo $LANG['finalizing'];?>...");
415
+                    $("#changeMainSaltKey_message").html("<?php echo $LANG['finalizing']; ?>...");
416 416
                     changeMainSaltKey("finishing");
417 417
                 } else {
418 418
                     // error mngt
419
-                    $("#changeMainSaltKey_message").html("<i class=\"fa fa-alert fa-spin fa\"></i>&nbsp;<?php echo $LANG['error_sent_back'];?> : "+data[0].error);
419
+                    $("#changeMainSaltKey_message").html("<i class=\"fa fa-alert fa-spin fa\"></i>&nbsp;<?php echo $LANG['error_sent_back']; ?> : "+data[0].error);
420 420
                 }
421 421
             },
422 422
             "json"
@@ -427,12 +427,12 @@  discard block
 block discarded – undo
427 427
             "sources/admin.queries.php",
428 428
             {
429 429
                 type     : "admin_action_change_salt_key___end",
430
-                key     : "<?php echo $_SESSION['key'];?>"
430
+                key     : "<?php echo $_SESSION['key']; ?>"
431 431
             },
432 432
             function(data) {
433 433
                 if (data[0].nextAction === "done") {
434 434
                     console.log("done");
435
-                    $("#changeMainSaltKey_message").html("<i class=\"fa fa-info fa-lg\"></i>&nbsp;<?php echo $LANG['alert_message_done']." ".$LANG['number_of_items_treated'];?> : " + $("#changeMainSaltKey_itemsCountTotal").val() + '<p><?php echo $LANG['check_data_after_reencryption'];?><p><div style=\"margin-top:5px;\"><a href=\"#\" onclick=\"encryption_show_revert()\"><?php echo $LANG['revert'];?></a></div>');
435
+                    $("#changeMainSaltKey_message").html("<i class=\"fa fa-info fa-lg\"></i>&nbsp;<?php echo $LANG['alert_message_done']." ".$LANG['number_of_items_treated']; ?> : " + $("#changeMainSaltKey_itemsCountTotal").val() + '<p><?php echo $LANG['check_data_after_reencryption']; ?><p><div style=\"margin-top:5px;\"><a href=\"#\" onclick=\"encryption_show_revert()\"><?php echo $LANG['revert']; ?></a></div>');
436 436
                 } else {
437 437
                     // error mngt
438 438
                 }
@@ -444,13 +444,13 @@  discard block
 block discarded – undo
444 444
 }
445 445
 
446 446
 function encryption_show_revert() {
447
-    if (confirm('<?php echo $LANG['revert_the_database'];?>')) {
448
-        $("#changeMainSaltKey_message").append('<div style="margin-top:5px;"><i class="fa fa-cog fa-spin fa-lg"></i>&nbsp;<?php echo addslashes($LANG['please_wait']);?>...</div>')
447
+    if (confirm('<?php echo $LANG['revert_the_database']; ?>')) {
448
+        $("#changeMainSaltKey_message").append('<div style="margin-top:5px;"><i class="fa fa-cog fa-spin fa-lg"></i>&nbsp;<?php echo addslashes($LANG['please_wait']); ?>...</div>')
449 449
         $.post(
450 450
             "sources/admin.queries.php",
451 451
             {
452 452
                 type    : "admin_action_change_salt_key___restore_backup",
453
-                key     : "<?php echo $_SESSION['key'];?>"
453
+                key     : "<?php echo $_SESSION['key']; ?>"
454 454
             },
455 455
             function(data) {
456 456
                 $("#changeMainSaltKey_message").html('').hide();
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
         "sources/admin.queries.php",
475 475
         {
476 476
             type    : "save_option_change",
477
-            data    : prepareExchangedData(data, "encode", "<?php echo $_SESSION['key'];?>"),
478
-            key     : "<?php echo $_SESSION['key'];?>"
477
+            data    : prepareExchangedData(data, "encode", "<?php echo $_SESSION['key']; ?>"),
478
+            key     : "<?php echo $_SESSION['key']; ?>"
479 479
         },
480 480
         function(data) {
481 481
             // force page reload in case of encryptClientServer
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
             }
486 486
             //decrypt data
487 487
             try {
488
-                data = prepareExchangedData(data , "decode", "<?php echo $_SESSION['key'];?>");
488
+                data = prepareExchangedData(data , "decode", "<?php echo $_SESSION['key']; ?>");
489 489
             } catch (e) {
490 490
                 // error
491 491
                 $("#message_box").html("An error appears. Answer from Server cannot be parsed!<br />Returned data:<br />"+data).show().fadeOut(4000);
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
         drag: true, // allow dragging the toggle between positions
525 525
         click: true, // allow clicking on the toggle
526 526
         text: {
527
-            on: '<?php echo $LANG['yes'];?>', // text for the ON position
528
-            off: '<?php echo $LANG['no'];?>' // and off
527
+            on: '<?php echo $LANG['yes']; ?>', // text for the ON position
528
+            off: '<?php echo $LANG['no']; ?>' // and off
529 529
         },
530 530
         on: true, // is the toggle ON on init
531 531
         animate: 250, // animation time (ms)
@@ -550,8 +550,8 @@  discard block
 block discarded – undo
550 550
             "sources/admin.queries.php",
551 551
             {
552 552
                 type    : "save_option_change",
553
-                data     : prepareExchangedData(data, "encode", "<?php echo $_SESSION['key'];?>"),
554
-                key     : "<?php echo $_SESSION['key'];?>"
553
+                data     : prepareExchangedData(data, "encode", "<?php echo $_SESSION['key']; ?>"),
554
+                key     : "<?php echo $_SESSION['key']; ?>"
555 555
             },
556 556
             function(data) {
557 557
                 // force page reload in case of encryptClientServer
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
                 }
562 562
                 //decrypt data
563 563
                 try {
564
-                    data = prepareExchangedData(data , "decode", "<?php echo $_SESSION['key'];?>");
564
+                    data = prepareExchangedData(data , "decode", "<?php echo $_SESSION['key']; ?>");
565 565
                 } catch (e) {
566 566
                     // error
567 567
                     $("#message_box").html("An error appears. Answer from Server cannot be parsed!<br />Returned data:<br />"+data).show().fadeOut(4000);
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
             }
606 606
         },
607 607
         beforeLoad: function( event, ui ) {
608
-            ui.panel.html('<div id="loader_tab"><i class="fa fa-cog fa-spin"></i>&nbsp;<?php echo $LANG['loading'];?>...</div>')
608
+            ui.panel.html('<div id="loader_tab"><i class="fa fa-cog fa-spin"></i>&nbsp;<?php echo $LANG['loading']; ?>...</div>')
609 609
         },
610 610
         load: function( event, ui ) {
611 611
             $("#loader_tab").remove();
@@ -638,9 +638,9 @@  discard block
 block discarded – undo
638 638
         autoOpen: false,
639 639
         width: 400,
640 640
         height: 120,
641
-        title: "<?php echo $LANG['confirm'];?>",
641
+        title: "<?php echo $LANG['confirm']; ?>",
642 642
         buttons: {
643
-            "<?php echo $LANG['confirm'];?>": function() {
643
+            "<?php echo $LANG['confirm']; ?>": function() {
644 644
                 $("#div_loading").show();
645 645
                 var $this = $(this);
646 646
                 // prepare data to send
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
                     "json"
676 676
                );
677 677
             },
678
-            "<?php echo $LANG['cancel_button'];?>": function() {
678
+            "<?php echo $LANG['cancel_button']; ?>": function() {
679 679
                 $("#div_loading").hide();
680 680
                 $(this).dialog("close");
681 681
             }
@@ -688,9 +688,9 @@  discard block
 block discarded – undo
688 688
         autoOpen: false,
689 689
         width: 500,
690 690
         height: 150,
691
-        title: "<?php echo $LANG['category_in_folders'];?>",
691
+        title: "<?php echo $LANG['category_in_folders']; ?>",
692 692
         buttons: {
693
-            "<?php echo $LANG['confirm'];?>": function() {
693
+            "<?php echo $LANG['confirm']; ?>": function() {
694 694
                 if ($("#new_field_title").val() != "" && $("#post_id").val() != "") {
695 695
                     $("#div_loading").show();
696 696
                     var $this = $(this);
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
                     );
713 713
                 }
714 714
             },
715
-            "<?php echo $LANG['cancel_button'];?>": function() {
715
+            "<?php echo $LANG['cancel_button']; ?>": function() {
716 716
                 $("#div_loading").hide();
717 717
                 $(this).dialog("close");
718 718
             }
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
     $("#cat_folders_selection").multiselect({
723 723
         selectedList: 7,
724 724
         multiple:true,
725
-        checkAllText: "<?php echo $LANG['check_all_text'];?>",
726
-        uncheckAllText: "<?php echo $LANG['uncheck_all_text'];?>"
725
+        checkAllText: "<?php echo $LANG['check_all_text']; ?>",
726
+        uncheckAllText: "<?php echo $LANG['uncheck_all_text']; ?>"
727 727
     });
728 728
 
729 729
     $("#category_in_folder").dialog({
@@ -732,12 +732,12 @@  discard block
 block discarded – undo
732 732
         autoOpen: false,
733 733
         width: 400,
734 734
         height: 350,
735
-        title: "<?php echo $LANG['category_in_folders'];?>",
735
+        title: "<?php echo $LANG['category_in_folders']; ?>",
736 736
         open: function() {
737 737
             $("#cat_folders_selection").multiselect('refresh');
738 738
         },
739 739
         buttons: {
740
-            "<?php echo $LANG['confirm'];?>": function() {
740
+            "<?php echo $LANG['confirm']; ?>": function() {
741 741
                 // get list of selected folders
742 742
                 var ids = "";
743 743
                 $("#cat_folders_selection :selected").each(function(i, selected) {
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
                     );
768 768
                 }
769 769
             },
770
-            "<?php echo $LANG['cancel_button'];?>": function() {
770
+            "<?php echo $LANG['cancel_button']; ?>": function() {
771 771
                 $("#div_loading").hide();
772 772
                 $(this).dialog("close");
773 773
             }
@@ -780,12 +780,12 @@  discard block
 block discarded – undo
780 780
         autoOpen: false,
781 781
         width:250,
782 782
         height:150,
783
-        title: "<?php echo $LANG['admin_action_db_restore_key'];?>",
783
+        title: "<?php echo $LANG['admin_action_db_restore_key']; ?>",
784 784
         buttons: {
785
-            "<?php echo $LANG['ok'];?>": function() {
785
+            "<?php echo $LANG['ok']; ?>": function() {
786 786
                 LaunchAdminActions("admin_action_db_restore", $("#restore_bck_fileObj").val()+"&"+$("#restore_bck_encryption_key").val());
787 787
             },
788
-            "<?php echo $LANG['cancel_button'];?>'": function() {
788
+            "<?php echo $LANG['cancel_button']; ?>'": function() {
789 789
                 $(this).dialog("close");
790 790
             }
791 791
         }
@@ -911,11 +911,11 @@  discard block
 block discarded – undo
911 911
     $.post("sources/admin.queries.php",
912 912
         {
913 913
             type        : "is_backup_table_existing",
914
-            key         : "<?php echo $_SESSION['key'];?>"
914
+            key         : "<?php echo $_SESSION['key']; ?>"
915 915
         },
916 916
         function(data) {
917 917
             if (data === "1") {
918
-                $("#changeMainSaltKey_message").show().html('<?php echo addslashes($LANG['previous_backup_exists']);?>&nbsp;&nbsp;<b><a href="#" id="but_bck_restore"><?php echo $LANG['yes'];?></a></b><br /><?php echo $LANG['previous_backup_exists_delete'];?>&nbsp;&nbsp;<b><a href="#" id="but_bck_delete"><?php echo $LANG['yes'];?></a></b>');
918
+                $("#changeMainSaltKey_message").show().html('<?php echo addslashes($LANG['previous_backup_exists']); ?>&nbsp;&nbsp;<b><a href="#" id="but_bck_restore"><?php echo $LANG['yes']; ?></a></b><br /><?php echo $LANG['previous_backup_exists_delete']; ?>&nbsp;&nbsp;<b><a href="#" id="but_bck_delete"><?php echo $LANG['yes']; ?></a></b>');
919 919
 
920 920
                 // Restore the backup
921 921
                 $("#but_bck_restore").click(function(e) {
@@ -924,13 +924,13 @@  discard block
 block discarded – undo
924 924
 
925 925
                 // Delete the backup
926 926
                 $("#but_bck_delete").click(function(e) {
927
-                    if (confirm("<?php echo $LANG['wipe_backup_data'];?>")) {
928
-                        $("#changeMainSaltKey_message").append('<div style="margin-top:5px;"><i class="fa fa-cog fa-spin fa-lg"></i>&nbsp;<?php echo addslashes($LANG['please_wait']);?>...</div>')
927
+                    if (confirm("<?php echo $LANG['wipe_backup_data']; ?>")) {
928
+                        $("#changeMainSaltKey_message").append('<div style="margin-top:5px;"><i class="fa fa-cog fa-spin fa-lg"></i>&nbsp;<?php echo addslashes($LANG['please_wait']); ?>...</div>')
929 929
                         $.post(
930 930
                             "sources/admin.queries.php",
931 931
                             {
932 932
                                 type    : "admin_action_change_salt_key___delete_backup",
933
-                                key     : "<?php echo $_SESSION['key'];?>"
933
+                                key     : "<?php echo $_SESSION['key']; ?>"
934 934
                             },
935 935
                             function(data) {
936 936
                                 $("#changeMainSaltKey_message").html('').hide();
@@ -995,9 +995,9 @@  discard block
 block discarded – undo
995 995
             // show to user
996 996
             if (data[0].error === ""){
997 997
                 if (encrypted_data === "1") {
998
-                    $("#encryt_data_"+id).html('<span class="fa-stack" title="<?php echo $LANG['not_encrypted_data'];?>" onclick="changeEncrypMode(\''+id+'\', \'0\')"><i class="fa fa-key fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x fa-lg" style="color:red;"></i></span>');
998
+                    $("#encryt_data_"+id).html('<span class="fa-stack" title="<?php echo $LANG['not_encrypted_data']; ?>" onclick="changeEncrypMode(\''+id+'\', \'0\')"><i class="fa fa-key fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x fa-lg" style="color:red;"></i></span>');
999 999
                 } else {
1000
-                    $("#encryt_data_"+id).html('<i class="fa fa-key tip" title="<?php echo $LANG['encrypted_data'];?>" onclick="changeEncrypMode(\''+id+'\', \'1\')"></i>');
1000
+                    $("#encryt_data_"+id).html('<i class="fa fa-key tip" title="<?php echo $LANG['encrypted_data']; ?>" onclick="changeEncrypMode(\''+id+'\', \'1\')"></i>');
1001 1001
                 }
1002 1002
             }
1003 1003
             $("#div_loading").hide();
Please login to merge, or discard this patch.
find.load.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 //<![CDATA[
22 22
 function aes_decrypt(text)
23 23
 {
24
-    return Aes.Ctr.decrypt(text, "<?php echo $_SESSION['key'];?>", 256);
24
+    return Aes.Ctr.decrypt(text, "<?php echo $_SESSION['key']; ?>", 256);
25 25
 }
26 26
 
27 27
 /*
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
         "sources/items.queries.php",
39 39
         {
40 40
             type    : "refresh_visible_folders",
41
-            key        : "<?php echo $_SESSION['key'];?>"
41
+            key        : "<?php echo $_SESSION['key']; ?>"
42 42
         },
43 43
         function(data) {
44
-            data = prepareExchangedData(data , "decode", "<?php echo $_SESSION['key'];?>");
44
+            data = prepareExchangedData(data , "decode", "<?php echo $_SESSION['key']; ?>");
45 45
             $("#copy_in_folder").find('option').remove().end().append(data.selectFullVisibleFoldersOptions);
46 46
             $('#div_copy_item_to_folder').dialog('open');
47 47
         }
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
       autoOpen: false,
56 56
       width: 400,
57 57
       height: 200,
58
-      title: "<?php echo $LANG['item_menu_copy_elem'];?>",
58
+      title: "<?php echo $LANG['item_menu_copy_elem']; ?>",
59 59
       buttons: {
60
-          "<?php echo $LANG['ok'];?>": function() {
60
+          "<?php echo $LANG['ok']; ?>": function() {
61 61
               //Send query
62 62
                 $.post(
63 63
                     "sources/items.queries.php",
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                         type    : "copy_item",
66 66
                         item_id : $('#id_selected_item').val(),
67 67
                         folder_id : $('#copy_in_folder').val(),
68
-                        key        : "<?php echo $_SESSION['key'];?>"
68
+                        key        : "<?php echo $_SESSION['key']; ?>"
69 69
                     },
70 70
                     function(data) {
71 71
                         //check if format error
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                         }
75 75
                         //if OK
76 76
                         if (data[0].status == "ok") {
77
-                            $("#div_dialog_message_text").html("<?php echo $LANG['alert_message_done'];?>");
77
+                            $("#div_dialog_message_text").html("<?php echo $LANG['alert_message_done']; ?>");
78 78
                             $("#div_dialog_message").dialog('open');
79 79
                             $("#div_copy_item_to_folder").dialog('close');
80 80
                         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                     "json"
83 83
                );
84 84
           },
85
-          "<?php echo $LANG['cancel_button'];?>": function() {
85
+          "<?php echo $LANG['cancel_button']; ?>": function() {
86 86
               $("#copy_item_to_folder_show_error").html("").hide();
87 87
               $(this).dialog('close');
88 88
           }
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
       autoOpen: false,
106 106
       width: 450,
107 107
       height: 220,
108
-      title: "<?php echo $LANG['see_item_title'];?>",
108
+      title: "<?php echo $LANG['see_item_title']; ?>",
109 109
       open:
110 110
         function(event, ui) {
111
-              $("#div_item_data_show_error").html("<?php echo $LANG['admin_info_loading'];?>").show();
111
+              $("#div_item_data_show_error").html("<?php echo $LANG['admin_info_loading']; ?>").show();
112 112
             $.post(
113 113
                 "sources/items.queries.php",
114 114
                 {
@@ -117,25 +117,25 @@  discard block
 block discarded – undo
117 117
                     salt_key_required : $('#personalItem').val(),
118 118
                     salt_key_set : $('#personal_sk_set').val(),
119 119
                     page    : "find",
120
-                    key        : "<?php echo $_SESSION['key'];?>"
120
+                    key        : "<?php echo $_SESSION['key']; ?>"
121 121
                 },
122 122
                 function(data) {
123 123
                     //decrypt data
124
-                    data = prepareExchangedData(data, "decode", "<?php echo $_SESSION['key'];?>");
124
+                    data = prepareExchangedData(data, "decode", "<?php echo $_SESSION['key']; ?>");
125 125
                     var return_html = "";
126 126
                     if (data.show_detail_option != "0" || data.show_details == 0) {
127 127
                         //item expired
128
-                        return_html = "<?php echo $LANG['not_allowed_to_see_pw_is_expired'];?>";
128
+                        return_html = "<?php echo $LANG['not_allowed_to_see_pw_is_expired']; ?>";
129 129
                     } else if (data.show_details == "0") {
130 130
                         //Admin cannot see Item
131
-                        return_html = "<?php echo $LANG['not_allowed_to_see_pw'];?>";
131
+                        return_html = "<?php echo $LANG['not_allowed_to_see_pw']; ?>";
132 132
                     } else {
133 133
                         return_html = "<table>"+
134
-                            "<tr><td valign='top' class='td_title'><span class='ui-icon ui-icon-carat-1-e' style='float: left; margin-right: .3em;'>&nbsp;</span><?php echo $LANG['label'];?> :</td><td style='font-style:italic;display:inline;'>"+data.label+"</td></tr>"+
135
-                            "<tr><td valign='top' class='td_title'><span class='ui-icon ui-icon-carat-1-e' style='float: left; margin-right: .3em;'>&nbsp;</span><?php echo $LANG['description'];?> :</td><td style='font-style:italic;display:inline;'>"+data.description+"</td></tr>"+
136
-                            "<tr><td valign='top' class='td_title'><span class='ui-icon ui-icon-carat-1-e' style='float: left; margin-right: .3em;'>&nbsp;</span><?php echo $LANG['pw'];?> :</td><td style='font-style:italic;display:inline;'>"+unsanitizeString(data.pw)+"</td></tr>"+
137
-                            "<tr><td valign='top' class='td_title'><span class='ui-icon ui-icon-carat-1-e' style='float: left; margin-right: .3em;'>&nbsp;</span><?php echo $LANG['index_login'];?> :</td><td style='font-style:italic;display:inline;'>"+data.login+"</td></tr>"+
138
-                            "<tr><td valign='top' class='td_title'><span class='ui-icon ui-icon-carat-1-e' style='float: left; margin-right: .3em;'>&nbsp;</span><?php echo $LANG['url'];?> :</td><td style='font-style:italic;display:inline;'>"+data.url+"</td></tr>"+
134
+                            "<tr><td valign='top' class='td_title'><span class='ui-icon ui-icon-carat-1-e' style='float: left; margin-right: .3em;'>&nbsp;</span><?php echo $LANG['label']; ?> :</td><td style='font-style:italic;display:inline;'>"+data.label+"</td></tr>"+
135
+                            "<tr><td valign='top' class='td_title'><span class='ui-icon ui-icon-carat-1-e' style='float: left; margin-right: .3em;'>&nbsp;</span><?php echo $LANG['description']; ?> :</td><td style='font-style:italic;display:inline;'>"+data.description+"</td></tr>"+
136
+                            "<tr><td valign='top' class='td_title'><span class='ui-icon ui-icon-carat-1-e' style='float: left; margin-right: .3em;'>&nbsp;</span><?php echo $LANG['pw']; ?> :</td><td style='font-style:italic;display:inline;'>"+unsanitizeString(data.pw)+"</td></tr>"+
137
+                            "<tr><td valign='top' class='td_title'><span class='ui-icon ui-icon-carat-1-e' style='float: left; margin-right: .3em;'>&nbsp;</span><?php echo $LANG['index_login']; ?> :</td><td style='font-style:italic;display:inline;'>"+data.login+"</td></tr>"+
138
+                            "<tr><td valign='top' class='td_title'><span class='ui-icon ui-icon-carat-1-e' style='float: left; margin-right: .3em;'>&nbsp;</span><?php echo $LANG['url']; ?> :</td><td style='font-style:italic;display:inline;'>"+data.url+"</td></tr>"+
139 139
                         "</table>";
140 140
                     }
141 141
                     $("#div_item_data_show_error").html("").hide();
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         }
151 151
         ,
152 152
       buttons: {
153
-          "<?php echo $LANG['ok'];?>": function() {
153
+          "<?php echo $LANG['ok']; ?>": function() {
154 154
               $(this).dialog('close');
155 155
           }
156 156
       }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         "sAjaxSource": "sources/find.queries.php",
167 167
         "bJQueryUI": true,
168 168
         "oLanguage": {
169
-            "sUrl": "includes/language/datatables.<?php echo $_SESSION['user_language'];?>.txt"
169
+            "sUrl": "includes/language/datatables.<?php echo $_SESSION['user_language']; ?>.txt"
170 170
         },
171 171
         "fnInitComplete": function() {
172 172
             $("#find_page input").focus();
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         autoOpen: false,
195 195
         width: 500,
196 196
         height: 400,
197
-        title: "<?php echo $LANG['mass_operation'];?>",
197
+        title: "<?php echo $LANG['mass_operation']; ?>",
198 198
         open: function() {
199 199
             var html = sel_items = sel_items_txt = item_id = '';
200 200
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
             // prepare display
215 215
             if ($("#div_mass_op").data('action') === "move") {
216
-                html = '<?php echo $LANG['you_decided_to_move_items'];?>: ' +
216
+                html = '<?php echo $LANG['you_decided_to_move_items']; ?>: ' +
217 217
                 '<div><ul>' + sel_items_txt + '</ul></div>';
218 218
                 var folder_options = '';
219 219
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                     "sources/folders.queries.php",
223 223
                     {
224 224
                         type    : "get_list_of_folders",
225
-                        key     : "<?php echo $_SESSION['key'];?>"
225
+                        key     : "<?php echo $_SESSION['key']; ?>"
226 226
                     },
227 227
                     function(data) {
228 228
                         $("#div_loading").hide();
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                         }
236 236
 
237 237
                         // destination folder
238
-                         html += '<div style=""><?php echo $LANG['import_keepass_to_folder'];?>:&nbsp;&nbsp;' +
238
+                         html += '<div style=""><?php echo $LANG['import_keepass_to_folder']; ?>:&nbsp;&nbsp;' +
239 239
                          '<select id="mass_move_destination_folder_id">' + data[0].list_folders + '</select>' +
240 240
                          '</div>';
241 241
 
@@ -245,19 +245,19 @@  discard block
 block discarded – undo
245 245
                     "json"
246 246
                 );
247 247
             } else if ($("#div_mass_op").data('action') === "delete") {
248
-                html = '<?php echo $LANG['you_decided_to_delete_items'];?>: ' +
248
+                html = '<?php echo $LANG['you_decided_to_delete_items']; ?>: ' +
249 249
                 '<div><ul>' + sel_items_txt + '</ul></div>' +
250
-                '<div style="padding:10px;" class="ui-corner-all ui-state-error"><span class="fa fa-warning fa-lg"></span>&nbsp;<?php echo $LANG['confirm_deletion'];?></div>';
250
+                '<div style="padding:10px;" class="ui-corner-all ui-state-error"><span class="fa fa-warning fa-lg"></span>&nbsp;<?php echo $LANG['confirm_deletion']; ?></div>';
251 251
                 
252 252
                 $("#div_mass_html").html(html);
253 253
             }
254 254
 
255 255
         },
256 256
         buttons: {
257
-            "<?php echo $LANG['ok'];?>": function() {
257
+            "<?php echo $LANG['ok']; ?>": function() {
258 258
                 $("#div_mass_op_msg")
259 259
                     .addClass("ui-state-highlight")
260
-                    .html('<span class="fa fa-cog fa-spin fa-lg"></span>&nbsp;<?php echo $LANG['please_wait'];?>')
260
+                    .html('<span class="fa fa-cog fa-spin fa-lg"></span>&nbsp;<?php echo $LANG['please_wait']; ?>')
261 261
                     .show();
262 262
 
263 263
                 var sel_items = '';
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                 if (sel_items === "") {
271 271
                     $("#div_mass_op_msg")
272 272
                         .addClass("ui-state-error")
273
-                        .html('<span class="fa fa-warning fa-lg"></span>&nbsp;<?php echo $LANG['must_select_items'];?>')
273
+                        .html('<span class="fa fa-warning fa-lg"></span>&nbsp;<?php echo $LANG['must_select_items']; ?>')
274 274
                         .show().delay(2000).fadeOut(1000);
275 275
                     return false;
276 276
                 }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                             type        : "mass_move_items",
286 286
                             item_ids    : sel_items,
287 287
                             folder_id   : $("#mass_move_destination_folder_id").val(),
288
-                            key         : "<?php echo $_SESSION['key'];?>"
288
+                            key         : "<?php echo $_SESSION['key']; ?>"
289 289
                         },
290 290
                         function(data) {
291 291
                             //check if format error
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
                                 //reload search 
298 298
                                 oTable.api().ajax.reload();
299 299
 
300
-                                $("#main_info_box_text").html("<?php echo $LANG['alert_message_done'];?>");
300
+                                $("#main_info_box_text").html("<?php echo $LANG['alert_message_done']; ?>");
301 301
                                     $("#main_info_box").show().position({
302 302
                                         my: "center",
303 303
                                         at: "center top+75",
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
                         {
321 321
                             type        : "mass_delete_items",
322 322
                             item_ids    : sel_items,
323
-                            key         : "<?php echo $_SESSION['key'];?>"
323
+                            key         : "<?php echo $_SESSION['key']; ?>"
324 324
                         },
325 325
                         function(data) {
326 326
                             //check if format error
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
                                 //reload search 
333 333
                                 oTable.api().ajax.reload();
334 334
 
335
-                                $("#main_info_box_text").html("<?php echo $LANG['alert_message_done'];?>");
335
+                                $("#main_info_box_text").html("<?php echo $LANG['alert_message_done']; ?>");
336 336
                                     $("#main_info_box").show().position({
337 337
                                         my: "center",
338 338
                                         at: "center top+75",
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                     );
349 349
                 }
350 350
             },
351
-            "<?php echo $LANG['cancel_button'];?>": function() {
351
+            "<?php echo $LANG['cancel_button']; ?>": function() {
352 352
                 $(this).dialog('close');
353 353
             }
354 354
         }
Please login to merge, or discard this patch.