Code Duplication    Length = 23-23 lines in 2 locations

admin/maintenance.php 2 locations

@@ 150-172 (lines=23) @@
147
148
        echo '</table>';
149
        break;
150
    case 'del_import':
151
        if (true === \Xmf\Request::getBool('ok', false, 'POST')) {
152
            $result = $xoopsDB->queryF("TRUNCATE TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
153
            $result = $xoopsDB->queryF("REPAIR TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
154
            $result = $xoopsDB->queryF("OPTIMIZE TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
155
            $result = $xoopsDB->queryF("ALTER TABLE `{$xoopsDB->prefix('xnewsletter_import')}` AUTO_INCREMENT =1");
156
157
            $protocolObj = $helper->getHandler('Protocol')->create();
158
            $protocolObj->setVar('protocol_letter_id', 0);
159
            $protocolObj->setVar('protocol_subscriber_id', 0);
160
            $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' import] ' . _AM_XNEWSLETTER_MAINTENANCE_DELETE_IMPORT_OK);
161
            $protocolObj->setVar('protocol_success', true);
162
            $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
163
            $protocolObj->setVar('protocol_created', time());
164
165
            if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
166
                // IN PROGRESS
167
            }
168
            redirect_header($currentFile, 3, _AM_XNEWSLETTER_MAINTENANCE_DELETE_IMPORT_OK);
169
        } else {
170
            xoops_confirm(['ok' => true, 'op' => 'del_import'], $currentFile, _AM_XNEWSLETTER_MAINTENANCE_DELETE_IMPORT);
171
        }
172
        break;
173
    case 'del_oldsubscr':
174
        $time = strtotime($_POST['del_date']);
175
        if ($time >= time() || 0 == $time) {
@@ 241-263 (lines=23) @@
238
            }
239
        }
240
        break;
241
    case 'del_oldprotocol':
242
        if (true === \Xmf\Request::getBool('ok', false, 'POST')) {
243
            $result = $xoopsDB->queryF("TRUNCATE TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}`");
244
            $result = $xoopsDB->queryF("REPAIR TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}`");
245
            $result = $xoopsDB->queryF("OPTIMIZE TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}`");
246
            $result = $xoopsDB->queryF("ALTER TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}` AUTO_INCREMENT =1");
247
248
            $protocolObj = $helper->getHandler('Protocol')->create();
249
            $protocolObj->setVar('protocol_letter_id', 0);
250
            $protocolObj->setVar('protocol_subscriber_id', 0);
251
            $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' prot] ' . _AM_XNEWSLETTER_MAINTENANCE_DELETEPROTOK);
252
            $protocolObj->setVar('protocol_success', true);
253
            $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
254
            $protocolObj->setVar('protocol_created', time());
255
256
            if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
257
                // IN PROGRESS
258
            }
259
            redirect_header($currentFile, 3, _AM_XNEWSLETTER_MAINTENANCE_DELETEPROTOK);
260
        } else {
261
            xoops_confirm(['ok' => true, 'op' => 'del_oldprotocol'], $currentFile, _AM_XNEWSLETTER_MAINTENANCE_DELETEPROTOCOL);
262
        }
263
        break;
264
    case 'del_invalid_catsubscr':
265
        //delete data in table catsubscr, if catsubscr_subscrid is no more existing in table subscr
266
        if (true === \Xmf\Request::getBool('ok', false, 'POST')) {