Code Duplication    Length = 3-3 lines in 5 locations

install/upgrade_run_2.1.26.php 4 locations

@@ 270-272 (lines=3) @@
267
268
// add Estonian
269
$tmp = mysqli_fetch_row(mysqli_query($dbTmp, "SELECT COUNT(*) FROM `".$_SESSION['pre']."languages` WHERE name = 'estonian'"));
270
if ($tmp[0] == 0 || empty($tmp[0])) {
271
    mysqli_query($dbTmp, "INSERT INTO `".$_SESSION['pre']."languages` VALUES (null, 'estonian', 'Estonian', 'ee', 'ee.png')");
272
}
273
274
// remove Estonia
275
$tmp = mysqli_fetch_row(mysqli_query($dbTmp, "SELECT COUNT(*) FROM `".$_SESSION['pre']."languages` WHERE name = 'estonia'"));
@@ 276-278 (lines=3) @@
273
274
// remove Estonia
275
$tmp = mysqli_fetch_row(mysqli_query($dbTmp, "SELECT COUNT(*) FROM `".$_SESSION['pre']."languages` WHERE name = 'estonia'"));
276
if ($tmp[0] == 0 || empty($tmp[0])) {
277
    mysqli_query($dbTmp, "DELETE FROM `".$_SESSION['pre']."languages` WHERE name = 'estonia'");
278
}
279
280
// ensure CSRFP config file is ready
281
if (!isset($_SESSION['upgrade']['csrfp_config_file']) || $_SESSION['upgrade']['csrfp_config_file'] != 1) {
@@ 342-344 (lines=3) @@
339
340
// clean duplicate ldap_object_class from bad update script version
341
$tmp = mysqli_fetch_row(mysqli_query($dbTmp, "SELECT COUNT(*) FROM `".$_SESSION['pre']."misc` WHERE type = 'admin' AND intitule = 'ldap_object_class'"));
342
if ($tmp[0] > 1) {
343
    mysqli_query($dbTmp, "DELETE FROM `".$_SESSION['pre']."misc` WHERE type = 'admin' AND intitule = 'ldap_object_class' AND `valeur` = 0");
344
}
345
// add new setting - ldap_object_class
346
$tmp = mysqli_fetch_row(mysqli_query($dbTmp, "SELECT COUNT(*) FROM `".$_SESSION['pre']."misc` WHERE type = 'admin' AND intitule = 'ldap_object_class'"));
347
if ($tmp[0] == 0 || empty($tmp[0])) {
@@ 347-349 (lines=3) @@
344
}
345
// add new setting - ldap_object_class
346
$tmp = mysqli_fetch_row(mysqli_query($dbTmp, "SELECT COUNT(*) FROM `".$_SESSION['pre']."misc` WHERE type = 'admin' AND intitule = 'ldap_object_class'"));
347
if ($tmp[0] == 0 || empty($tmp[0])) {
348
    mysqli_query($dbTmp, "INSERT INTO `".$_SESSION['pre']."misc` VALUES ('admin', 'ldap_object_class', '0')");
349
}
350
351
// convert 2factors_ to google_ due to illegal id, and for clarification of purpose
352
$tmp_googlecount = mysqli_fetch_row(mysqli_query($dbTmp, "SELECT COUNT(*) FROM `".$_SESSION['pre']."misc` WHERE type = 'admin' AND intitule = 'google_authentication'"));

install/upgrade_run_db_original.php 1 location

@@ 1200-1202 (lines=3) @@
1197
    "SELECT `pw_iv` FROM ".$_SESSION['pre']."items WHERE perso='1'"
1198
);
1199
$tmp = mysqli_fetch_row($tmpResult);
1200
if ($tmp[0] == "") {
1201
    mysqli_query($dbTmp, "UPDATE ".$_SESSION['pre']."users SET upgrade_needed = true WHERE 1 = 1");
1202
}
1203
1204
/*// Since 2.1.17, encrypt process is changed.
1205
// Previous PW need to be re-encrypted