Code Duplication    Length = 30-34 lines in 2 locations

sources/main.functions.php 2 locations

@@ 81-114 (lines=34) @@
78
 * crypt a string
79
 * @param string $text
80
 */
81
function encryptOld($text, $personalSalt = "")
82
{
83
    if (!empty($personalSalt)) {
84
        return trim(
85
            base64_encode(
86
                mcrypt_encrypt(
87
                    MCRYPT_RIJNDAEL_256,
88
                    $personalSalt,
89
                    $text,
90
                    MCRYPT_MODE_ECB,
91
                    mcrypt_create_iv(
92
                        mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB),
93
                        MCRYPT_RAND
94
                    )
95
                )
96
            )
97
        );
98
    } else {
99
        return trim(
100
            base64_encode(
101
                mcrypt_encrypt(
102
                    MCRYPT_RIJNDAEL_256,
103
                    SALT,
104
                    $text,
105
                    MCRYPT_MODE_ECB,
106
                    mcrypt_create_iv(
107
                        mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB),
108
                        MCRYPT_RAND
109
                    )
110
                )
111
            )
112
        );
113
    }
114
}
115
116
/**
117
 * decryptOld()
@@ 121-150 (lines=30) @@
118
 *
119
 * decrypt a crypted string
120
 */
121
function decryptOld($text, $personalSalt = "")
122
{
123
    if (!empty($personalSalt)) {
124
        return trim(
125
            mcrypt_decrypt(
126
                MCRYPT_RIJNDAEL_256,
127
                $personalSalt,
128
                base64_decode($text),
129
                MCRYPT_MODE_ECB,
130
                mcrypt_create_iv(
131
                    mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB),
132
                    MCRYPT_RAND
133
                )
134
            )
135
        );
136
    } else {
137
        return trim(
138
            mcrypt_decrypt(
139
                MCRYPT_RIJNDAEL_256,
140
                SALT,
141
                base64_decode($text),
142
                MCRYPT_MODE_ECB,
143
                mcrypt_create_iv(
144
                    mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB),
145
                    MCRYPT_RAND
146
                )
147
            )
148
        );
149
    }
150
}
151
152
/**
153
 * encrypt()