Code Duplication    Length = 15-19 lines in 7 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/cat.php 1 location

@@ 196-210 (lines=15) @@
193
        $form   = $catObj->getForm();
194
        $GLOBALS['xoopsTpl']->assign('form', $form->render());
195
        break;
196
    case 'delete_cat':
197
        $catObj = $helper->getHandler('Cat')->get($_REQUEST['cat_id']);
198
        if (true === Request::getBool('ok', false, 'POST')) {
199
            if (!$GLOBALS['xoopsSecurity']->check()) {
200
                redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
201
            }
202
            if ($helper->getHandler('Cat')->delete($catObj)) {
203
                redirect_header($currentFile, 3, _AM_XNEWSLETTER_FORMDELOK);
204
            } else {
205
                $GLOBALS['xoopsTpl']->assign('error', $catObj->getHtmlErrors());
206
            }
207
        } else {
208
            xoops_confirm(['ok' => true, 'cat_id' => $cat_id, 'op' => 'delete_cat'], $_SERVER['REQUEST_URI'], sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $catObj->getVar('cat_name')));
209
        }
210
        break;
211
}
212
require_once __DIR__ . '/admin_footer.php';
213

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/protocol.php 1 location

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

admin/subscr.php 1 location

@@ 285-300 (lines=16) @@
282
        $form      = $subscrObj->getFormAdmin();
283
        $GLOBALS['xoopsTpl']->assign('form', $form->render());
284
        break;
285
    case 'delete_subscr':
286
        $subscrObj = $helper->getHandler('Subscr')->get($subscrId);
287
        if (true === Request::getBool('ok', false, 'POST')) {
288
            if (!$GLOBALS['xoopsSecurity']->check()) {
289
                redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
290
            }
291
            // delete subscriber (subscr), subscriptions (catsubscrs) and mailinglist
292
            if ($helper->getHandler('Subscr')->delete($subscrObj)) {
293
                redirect_header($currentFile, 3, _AM_XNEWSLETTER_FORMDELOK);
294
            } else {
295
                $GLOBALS['xoopsTpl']->assign('error', $subscrObj->getHtmlErrors());
296
            }
297
        } else {
298
            xoops_confirm(['ok' => true, 'subscr_id' => $subscrId, 'op' => 'delete_subscr'], $_SERVER['REQUEST_URI'], sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $subscrObj->getVar('subscr_email')));
299
        }
300
        break;
301
}
302
require_once __DIR__ . '/admin_footer.php';
303

admin/template.php 1 location

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