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

@@ 696-704 (lines=9) @@
693
                                    logItems($dataReceived['id'], $label, $_SESSION['user_id'], 'at_modification', $_SESSION['login'], 'at_field : '.$dataTmpCat['title'].' : '.$field_data[1]);
694
                                } else {
695
                                    // compare the old and new value
696
                                    if ($dataTmpCat['encryption_type'] === "defuse") {
697
                                        $oldVal = cryption(
698
                                            $dataTmpCat['data'],
699
                                            "",
700
                                            "decrypt"
701
                                        );
702
                                    } else {
703
                                        $oldVal['string'] = $dataTmpCat['data'];
704
                                    }
705
706
                                    if ($field_data[1] !== $oldVal['string']) {
707
                                        // should we encrypt the data
@@ 1667-1676 (lines=10) @@
1664
                        );
1665
                        foreach ($rows_tmp as $row) {
1666
                            // Uncrypt data
1667
                            if ($row['encryption_type'] === "defuse") {
1668
                                $fieldText = cryption(
1669
                                    $row['data'],
1670
                                    "",
1671
                                    "decrypt"
1672
                                );
1673
                                $fieldText = $fieldText['string'];
1674
                            } else {
1675
                                $fieldText = $row['data'];
1676
                            }
1677
1678
                            // build returned list of Fields text
1679
                            if (empty($fieldsTmp)) {

admin.settings.php 1 location

@@ 1336-1345 (lines=10) @@
1333
                        </td>
1334
                    </tr>';
1335
// Backup key
1336
if (isset($SETTINGS['bck_script_passkey']) === true) {
1337
    require_once './sources/main.functions.php';
1338
    $currentKey = cryption(
1339
        $SETTINGS['bck_script_passkey'],
1340
        "",
1341
        "decrypt"
1342
    )['string'];
1343
} else {
1344
    $currentKey = "";
1345
}
1346
echo '
1347
                    <tr style="margin-bottom:3px">
1348
                        <td>