Code Duplication    Length = 23-23 lines in 2 locations

admin/maintenance.php 2 locations

@@ 173-195 (lines=23) @@
170
        $maintenance .= '</table>';
171
        $GLOBALS['xoopsTpl']->assign('maintenance', $maintenance);
172
        break;
173
    case 'del_import':
174
        if (true === \Xmf\Request::getBool('ok', false, 'POST')) {
175
            $result = $xoopsDB->queryF("TRUNCATE TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
176
            $result = $xoopsDB->queryF("REPAIR TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
177
            $result = $xoopsDB->queryF("OPTIMIZE TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
178
            $result = $xoopsDB->queryF("ALTER TABLE `{$xoopsDB->prefix('xnewsletter_import')}` AUTO_INCREMENT =1");
179
180
            $protocolObj = $helper->getHandler('Protocol')->create();
181
            $protocolObj->setVar('protocol_letter_id', 0);
182
            $protocolObj->setVar('protocol_subscriber_id', 0);
183
            $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' import] ' . _AM_XNEWSLETTER_MAINTENANCE_DELETE_IMPORT_OK);
184
            $protocolObj->setVar('protocol_success', true);
185
            $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
186
            $protocolObj->setVar('protocol_created', time());
187
188
            if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
189
                // IN PROGRESS
190
            }
191
            redirect_header($currentFile, 3, _AM_XNEWSLETTER_MAINTENANCE_DELETE_IMPORT_OK);
192
        } else {
193
            xoops_confirm(['ok' => true, 'op' => 'del_import'], $currentFile, _AM_XNEWSLETTER_MAINTENANCE_DELETE_IMPORT);
194
        }
195
        break;
196
    case 'del_oldsubscr':
197
        $time = strtotime($_POST['del_date']);
198
        if ($time >= time() || 0 == $time) {
@@ 264-286 (lines=23) @@
261
            }
262
        }
263
        break;
264
    case 'del_oldprotocol':
265
        if (true === Request::getBool('ok', false, 'POST')) {
266
            $result = $xoopsDB->queryF("TRUNCATE TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}`");
267
            $result = $xoopsDB->queryF("REPAIR TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}`");
268
            $result = $xoopsDB->queryF("OPTIMIZE TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}`");
269
            $result = $xoopsDB->queryF("ALTER TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}` AUTO_INCREMENT =1");
270
271
            $protocolObj = $helper->getHandler('Protocol')->create();
272
            $protocolObj->setVar('protocol_letter_id', 0);
273
            $protocolObj->setVar('protocol_subscriber_id', 0);
274
            $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' prot] ' . _AM_XNEWSLETTER_MAINTENANCE_DELETEPROTOK);
275
            $protocolObj->setVar('protocol_success', true);
276
            $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
277
            $protocolObj->setVar('protocol_created', time());
278
279
            if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
280
                // IN PROGRESS
281
            }
282
            redirect_header($currentFile, 3, _AM_XNEWSLETTER_MAINTENANCE_DELETEPROTOK);
283
        } else {
284
            xoops_confirm(['ok' => true, 'op' => 'del_oldprotocol'], $currentFile, _AM_XNEWSLETTER_MAINTENANCE_DELETEPROTOCOL);
285
        }
286
        break;
287
    case 'del_invalid_catsubscr':
288
        //delete data in table catsubscr, if catsubscr_subscrid is no more existing in table subscr
289
        if (true === Request::getBool('ok', false, 'POST')) {