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 !== "") {

sources/items.queries.php 2 locations

@@ 693-701 (lines=9) @@
690
                                    logItems($dataReceived['id'], $label, $_SESSION['user_id'], 'at_modification', $_SESSION['login'], 'at_field : '.$dataTmpCat['title'].' : '.$field_data[1]);
691
                                } else {
692
                                    // compare the old and new value
693
                                    if ($dataTmpCat['encryption_type'] === "defuse") {
694
                                        $oldVal = cryption(
695
                                            $dataTmpCat['data'],
696
                                            "",
697
                                            "decrypt"
698
                                        );
699
                                    } else {
700
                                        $oldVal['string'] = $dataTmpCat['data'];
701
                                    }
702
703
                                    if ($field_data[1] !== $oldVal['string']) {
704
                                        // should we encrypt the data
@@ 1659-1668 (lines=10) @@
1656
                        );
1657
                        foreach ($rows_tmp as $row) {
1658
                            // Uncrypt data
1659
                            if ($row['encryption_type'] === "defuse") {
1660
                                $fieldText = cryption(
1661
                                    $row['data'],
1662
                                    "",
1663
                                    "decrypt"
1664
                                );
1665
                                $fieldText = $fieldText['string'];
1666
                            } else {
1667
                                $fieldText = $row['data'];
1668
                            }
1669
1670
                            // build returned list of Fields text
1671
                            if (empty($fieldsTmp)) {

admin.settings.php 1 location

@@ 1306-1315 (lines=10) @@
1303
                        </td>
1304
                    </tr>';
1305
// Backup key
1306
if (isset($SETTINGS['bck_script_passkey'])) {
1307
    require_once './sources/main.functions.php';
1308
    $currentKey = cryption(
1309
        $SETTINGS['bck_script_passkey'],
1310
        "",
1311
        "decrypt"
1312
    )['string'];
1313
} else {
1314
    $currentKey = "";
1315
}
1316
echo '
1317
                    <tr style="margin-bottom:3px">
1318
                        <td>