Code Duplication    Length = 8-10 lines in 4 locations

sources/categories.queries.php 1 location

@@ 315-322 (lines=8) @@
312
                        "decrypt"
313
                    );
314
                    $encryption_type = "none";
315
                } elseif ($recordF['encryption_type'] === "none" || $recordF['encryption_type'] === "") {
316
                    $encrypt = cryption(
317
                        $recordF['data'],
318
                        "",
319
                        "encrypt"
320
                    );
321
                    $encryption_type = "defuse";
322
                }
323
324
                // store in DB
325
                if ($encryption_type !== "") {

admin.settings.php 1 location

@@ 1273-1282 (lines=10) @@
1270
                        </td>
1271
                    </tr>';
1272
// Backup key
1273
if (isset($SETTINGS['bck_script_passkey'])) {
1274
    require_once './sources/main.functions.php';
1275
    $currentKey = cryption(
1276
        $SETTINGS['bck_script_passkey'],
1277
        "",
1278
        "decrypt"
1279
    )['string'];
1280
} else {
1281
    $currentKey = "";
1282
}
1283
echo '
1284
                    <tr style="margin-bottom:3px">
1285
                        <td>

sources/items.queries.php 2 locations

@@ 689-697 (lines=9) @@
686
                                    logItems($dataReceived['id'], $label, $_SESSION['user_id'], 'at_modification', $_SESSION['login'], 'at_field : '.$dataTmpCat['title'].' : '.$field_data[1]);
687
                                } else {
688
                                    // compare the old and new value
689
                                    if ($dataTmpCat['encryption_type'] === "defuse") {
690
                                        $oldVal = cryption(
691
                                            $dataTmpCat['data'],
692
                                            "",
693
                                            "decrypt"
694
                                        );
695
                                    } else {
696
                                        $oldVal['string'] = $dataTmpCat['data'];
697
                                    }
698
699
                                    if ($field_data[1] !== $oldVal['string']) {
700
                                        // should we encrypt the data
@@ 1644-1653 (lines=10) @@
1641
                        );
1642
                        foreach ($rows_tmp as $row) {
1643
                            // Uncrypt data
1644
                            if ($row['encryption_type'] === "defuse") {
1645
                                $fieldText = cryption(
1646
                                    $row['data'],
1647
                                    "",
1648
                                    "decrypt"
1649
                                );
1650
                                $fieldText = $fieldText['string'];
1651
                            } else {
1652
                                $fieldText = $row['data'];
1653
                            }
1654
1655
                            // build returned list of Fields text
1656
                            if (empty($fieldsTmp)) {