|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits |
|
4
|
|
|
of supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Contact module |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
16
|
|
|
* @license https://www.fsf.org/copyleft/gpl.html GNU public license |
|
17
|
|
|
* @author Kazumi Ono (aka Onokazu) |
|
18
|
|
|
* @author Trabis <[email protected]> |
|
19
|
|
|
* @author Hossein Azizabadi (AKA Voltan) |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
use Xmf\Request; |
|
23
|
|
|
|
|
24
|
|
|
/** @var ContactHandler $contactHandler */ |
|
25
|
|
|
/** @var Admin $adminObject */ |
|
26
|
|
|
|
|
27
|
|
|
// Call header |
|
28
|
|
|
require_once __DIR__ . '/admin_header.php'; |
|
29
|
|
|
// Display Admin header |
|
30
|
|
|
xoops_cp_header(); |
|
31
|
|
|
// Define default value |
|
32
|
|
|
$op = Request::getString('op', 'list'); |
|
33
|
|
|
|
|
34
|
|
|
switch ($op) { |
|
35
|
|
|
case 'list': |
|
36
|
|
|
// prune manager |
|
37
|
|
|
$form = new \XoopsThemeForm(_AM_CONTACT_TOOLS_PRUNE, 'tools', 'tools.php', 'post', true); |
|
38
|
|
|
$form->addElement(new \XoopsFormTextDateSelect(_AM_CONTACT_TOOLS_PRUNE_BEFORE, 'prune_date', 15, time())); |
|
39
|
|
|
$onlyreply = new xoopsFormCheckBox('', 'onlyreply'); |
|
40
|
|
|
$onlyreply->addOption(1, _AM_CONTACT_TOOLS_PRUNE_REPLYONLY); |
|
41
|
|
|
$form->addElement($onlyreply, false); |
|
42
|
|
|
$form->addElement(new \XoopsFormHidden('op', 'prune')); |
|
43
|
|
|
$form->addElement(new \XoopsFormButton('', 'post', _SUBMIT, 'submit')); |
|
44
|
|
|
$GLOBALS['xoopsTpl']->assign('prune', $form->render()); |
|
45
|
|
|
break; |
|
46
|
|
|
case 'prune': |
|
47
|
|
|
$timestamp = Request::getInt('prune_date', ''); |
|
|
|
|
|
|
48
|
|
|
$onlyreply = Request::getInt('onlyreply', 0); |
|
49
|
|
|
$timestamp = strtotime((string)$timestamp); |
|
50
|
|
|
$count = $contactHandler->contactPruneCount($timestamp, $onlyreply); |
|
51
|
|
|
$contactHandler->contactDeleteBeforeDate($timestamp, $onlyreply); |
|
52
|
|
|
redirect_header('tools.php', 1, sprintf(_AM_CONTACT_MSG_PRUNE_DELETED, $count)); |
|
53
|
|
|
// xoops_cp_footer(); |
|
54
|
|
|
// exit(); |
|
55
|
|
|
// break; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation(basename(__FILE__))); |
|
59
|
|
|
// Call template file |
|
60
|
|
|
$GLOBALS['xoopsTpl']->display(XOOPS_ROOT_PATH . '/modules/contact/templates/admin/contact_tools.tpl'); |
|
61
|
|
|
// Call footer |
|
62
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
|
63
|
|
|
|