Code Duplication    Length = 13-14 lines in 2 locations

install/upgrade_run_2.1.26.php 1 location

@@ 182-195 (lines=14) @@
179
180
// check that SYSLOG doesn't exist
181
$tmp = mysqli_fetch_row(mysqli_query($dbTmp, "SELECT COUNT(*) FROM `".$_SESSION['pre']."misc` WHERE type = 'admin' AND intitule = 'syslog_enable'"));
182
if ($tmp[0] == 0 || empty($tmp[0])) {
183
    mysqli_query(
184
        $dbTmp,
185
        "INSERT INTO `".$_SESSION['pre']."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'syslog_enable', '0')"
186
    );
187
    mysqli_query(
188
        $dbTmp,
189
        "INSERT INTO `".$_SESSION['pre']."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'syslog_host', 'localhost')"
190
    );
191
    mysqli_query(
192
        $dbTmp,
193
        "INSERT INTO `".$_SESSION['pre']."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'syslog_port', '514')"
194
    );
195
}
196
197
198
// alter table Items

install/upgrade_run_2.1.27.php 1 location

@@ 150-162 (lines=13) @@
147
// 2.1.27 introduce new encryption protocol with DEFUSE library.
148
// Now evaluate if current instance has already this version
149
$tmp = mysqli_fetch_row(mysqli_query($dbTmp, "SELECT valeur FROM `".$_SESSION['pre']."misc` WHERE type = 'admin' AND intitule = 'teampass_version'"));
150
if (count($tmp[0]) === 0 || empty($tmp[0])) {
151
    mysqli_query(
152
        $dbTmp,
153
        "INSERT INTO `".$_SESSION['pre']."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'teampass_version', '".$k['version']."')"
154
    );
155
} else {
156
    mysqli_query(
157
        $dbTmp,
158
        "UPDATE `".$_SESSION['pre']."misc`
159
        SET `valeur` = '".$k['version']."'
160
        WHERE intitule = 'teampass_version' AND type = 'admin'"
161
    );
162
}
163
164
// add new admin setting "migration_to_2127"
165
$tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `".$_SESSION['pre']."misc` WHERE type = 'admin' AND intitule = 'migration_to_2127'"));