Code Duplication    Length = 15-19 lines in 5 locations

admin/attachment.php 1 location

@@ 106-120 (lines=15) @@
103
            $GLOBALS['xoopsTpl']->assign('form', $form->render());
104
        }
105
        break;
106
    case 'delete_attachment':
107
        $attachmentObj = $helper->getHandler('Attachment')->get($attachment_id);
108
        if (true === Request::getBool('ok', false, 'POST')) {
109
            if (!$GLOBALS['xoopsSecurity']->check()) {
110
                redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
111
            }
112
            if ($helper->getHandler('Attachment')->delete($attachmentObj)) {
113
                redirect_header($currentFile, 3, _AM_XNEWSLETTER_FORMDELOK);
114
            } else {
115
                $GLOBALS['xoopsTpl']->assign('error', $attachmentObj->getHtmlErrors());
116
            }
117
        } else {
118
            xoops_confirm(['ok' => true, 'attachment_id' => $attachment_id, 'op' => 'delete_attachment'], $_SERVER['REQUEST_URI'], sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $attachmentObj->getVar('attachment_name')));
119
        }
120
        break;
121
}
122
123
require_once __DIR__ . '/admin_footer.php';

admin/bmh.php 1 location

@@ 314-328 (lines=15) @@
311
        $form   = $bmhObj->getForm();
312
        $GLOBALS['xoopsTpl']->assign('form', $form->render());
313
        break;
314
    case 'delete_bmh':
315
        $bmhObj = $helper->getHandler('Bmh')->get($bmh_id);
316
        if (true === Request::getBool('ok', false, 'POST')) {
317
            if (!$GLOBALS['xoopsSecurity']->check()) {
318
                redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
319
            }
320
            if ($helper->getHandler('Bmh')->delete($bmhObj)) {
321
                redirect_header($currentFile, 3, _AM_XNEWSLETTER_FORMDELOK);
322
            } else {
323
                $GLOBALS['xoopsTpl']->assign('error', $bmhObj->getHtmlErrors());
324
            }
325
        } else {
326
            xoops_confirm(['ok' => true, 'bmh_id' => $bmh_id, 'op' => 'delete_bmh'], $_SERVER['REQUEST_URI'], sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $bmhObj->getVar('bmh_email')));
327
        }
328
        break;
329
}
330
require_once __DIR__ . '/admin_footer.php';
331

admin/mailinglist.php 1 location

@@ 159-177 (lines=19) @@
156
        }
157
158
        break;
159
    case 'delete_mailinglist':
160
        $mailinglistObj = $helper->getHandler('Mailinglist')->get($mailinglistId);
161
        if (true === Request::getBool('ok', false, 'POST')) {
162
            if (!$GLOBALS['xoopsSecurity']->check()) {
163
                redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
164
            }
165
            if ($helper->getHandler('Mailinglist')->delete($mailinglistObj)) {
166
                redirect_header($currentFile, 3, _AM_XNEWSLETTER_FORMDELOK);
167
            } else {
168
                $GLOBALS['xoopsTpl']->assign('error', $mailinglistObj->getHtmlErrors());
169
            }
170
        } else {
171
            xoops_confirm([
172
                              'ok'             => true,
173
                              'mailinglist_id' => $mailinglistId,
174
                              'op'             => 'delete_mailinglist',
175
                          ], $_SERVER['REQUEST_URI'], sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $mailinglistObj->getVar('mailinglist_name')));
176
        }
177
        break;
178
}
179
require_once __DIR__ . '/admin_footer.php';
180

admin/template.php 1 location

@@ 169-183 (lines=15) @@
166
        $form        = $templateObj->getForm();
167
        $GLOBALS['xoopsTpl']->assign('form', $form->render());
168
        break;
169
    case 'delete_template':
170
        $templateObj = $helper->getHandler('Template')->get($templateId);
171
        if (true === Request::getBool('ok', false, 'POST')) {
172
            if (!$GLOBALS['xoopsSecurity']->check()) {
173
                redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
174
            }
175
            if ($helper->getHandler('Template')->delete($templateObj)) {
176
                redirect_header($currentFile, 3, _AM_XNEWSLETTER_FORMDELOK);
177
            } else {
178
                $GLOBALS['xoopsTpl']->assign('error', $templateObj->getHtmlErrors());
179
            }
180
        } else {
181
            xoops_confirm(['ok' => true, 'template_id' => $templateId, 'op' => 'delete_template'], $_SERVER['REQUEST_URI'], sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $templateObj->getVar('template_title')));
182
        }
183
        break;
184
    case 'state_template':
185
        $templateObj = $helper->getHandler('Template')->get($templateId);
186
        $templateObj->setVar('template_online', Request::getInt('template_online', 0));

admin/protocol.php 1 location

@@ 229-244 (lines=16) @@
226
        $form        = $protocolObj->getForm();
227
        $GLOBALS['xoopsTpl']->assign('form', $form->render());
228
        break;
229
    case 'delete_protocol':
230
        $protocolId = Request::getInt('protocol_id', 0);
231
        $protocolObj = $helper->getHandler('Protocol')->get($protocolId);
232
        if (true === Request::getBool('ok', false, 'POST')) {
233
            if (!$GLOBALS['xoopsSecurity']->check()) {
234
                redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
235
            }
236
            if ($helper->getHandler('Protocol')->delete($protocolObj)) {
237
                redirect_header($currentFile, 3, _AM_XNEWSLETTER_FORMDELOK);
238
            } else {
239
                $GLOBALS['xoopsTpl']->assign('error', $protocolObj->getHtmlErrors());
240
            }
241
        } else {
242
            xoops_confirm(['ok' => true, 'protocol_id' => $protocolId, 'op' => 'delete_protocol'], $_SERVER['REQUEST_URI'], sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $protocolId));
243
        }
244
        break;
245
    case 'delete_protocol_list':
246
        $letter_id = Request::getInt('letter_id', -1, 'REQUEST');
247
        if ($letter_id >= 0) {