1
|
|
|
<?php |
2
|
|
|
// |
3
|
|
|
// ------------------------------------------------------------------------ // |
4
|
|
|
// XOOPS - PHP Content Management System // |
5
|
|
|
// Copyright (c) 2000-2020 XOOPS.org // |
6
|
|
|
// <https://xoops.org> // |
7
|
|
|
// ------------------------------------------------------------------------ // |
8
|
|
|
// This program is free software; you can redistribute it and/or modify // |
9
|
|
|
// it under the terms of the GNU General Public License as published by // |
10
|
|
|
// the Free Software Foundation; either version 2 of the License, or // |
11
|
|
|
// (at your option) any later version. // |
12
|
|
|
// // |
13
|
|
|
// You may not change or alter any portion of this comment or credits // |
14
|
|
|
// of supporting developers from this source code or any supporting // |
15
|
|
|
// source code which is considered copyrighted (c) material of the // |
16
|
|
|
// original comment or credit authors. // |
17
|
|
|
// // |
18
|
|
|
// This program is distributed in the hope that it will be useful, // |
19
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
20
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
21
|
|
|
// GNU General Public License for more details. // |
22
|
|
|
// // |
23
|
|
|
// You should have received a copy of the GNU General Public License // |
24
|
|
|
// along with this program; if not, write to the Free Software // |
25
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
26
|
|
|
// ------------------------------------------------------------------------ // |
27
|
|
|
// Author: Kazumi Ono (AKA onokazu) // |
28
|
|
|
// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ // |
29
|
|
|
// Project: XOOPS Project // |
30
|
|
|
// ------------------------------------------------------------------------- // |
31
|
|
|
|
32
|
|
|
use Xmf\Request; |
33
|
|
|
|
34
|
|
|
require_once __DIR__ . '/admin_header.php'; |
35
|
|
|
require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
36
|
|
|
|
37
|
|
|
$op = Request::getCmd('op', Request::getCmd('op', 'default', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"default"); |
38
|
|
|
$item = Request::getString('op', Request::getInt('item', 'process', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['item'] : (!empty($_POST['item'])?$_POST['item']:"process"); |
|
|
|
|
39
|
|
|
|
40
|
|
|
$start = Request::getInt('start', 0, 'GET'); |
41
|
|
|
//$reportHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Report'); |
42
|
|
|
|
43
|
|
|
xoops_cp_header(); |
44
|
|
|
switch ($op) { |
45
|
|
|
case 'delete': |
46
|
|
|
$digest_ids = Request::getArray('digest_id', [], 'POST'); |
47
|
|
|
// /** @var Newbb\DigestHandler $digestHandler */ |
48
|
|
|
// $digestHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Digest'); |
49
|
|
|
foreach ($digest_ids as $did => $value) { |
50
|
|
|
$digest = $digestHandler->get($did); |
51
|
|
|
$digestHandler->delete($digest); |
52
|
|
|
} |
53
|
|
|
redirect_header('admin_digest.php', 1); |
54
|
|
|
break; |
55
|
|
|
case 'digest': |
56
|
|
|
xoops_confirm(['op' => 'digestconfirmed'], 'admin_digest.php', _AM_NEWBB_DIGEST_CONFIRM); |
57
|
|
|
break; |
58
|
|
|
case 'digestconfirmed': |
59
|
|
|
$message = ''; |
60
|
|
|
if ('POST' === Request::getMethod()) { |
61
|
|
|
// $digestHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Digest'); |
62
|
|
|
|
63
|
|
|
switch ($digestHandler->process(true)) { |
64
|
|
|
case 0: |
65
|
|
|
$message = _AM_NEWBB_DIGEST_SENT; |
66
|
|
|
break; |
67
|
|
|
case 4: |
68
|
|
|
$message = _AM_NEWBB_DIGEST_NOT_SENT; |
69
|
|
|
break; |
70
|
|
|
default: |
71
|
|
|
$message = _AM_NEWBB_DIGEST_FAILED; |
72
|
|
|
break; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
redirect_header('admin_digest.php', 1, $message); |
76
|
|
|
break; |
77
|
|
|
default: |
78
|
|
|
require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
79
|
|
|
|
80
|
|
|
$limit = 5; |
81
|
|
|
$adminObject->displayNavigation(basename(__FILE__)); |
82
|
|
|
|
83
|
|
|
$adminObject->addItemButton(_AM_NEWBB_DIGEST, 'admin_digest.php?op=digest', $icon = 'add'); |
84
|
|
|
$adminObject->displayButton('left'); |
85
|
|
|
|
86
|
|
|
//if (!$newXoopsModuleGui) loadModuleAdminMenu(7,_AM_NEWBB_DIGESTADMIN); |
87
|
|
|
// else $adminObject->displayNavigation(basename(__FILE__)); |
88
|
|
|
echo '<ul><li>' . _AM_NEWBB_DIGEST_HELP_1 . '</li>'; |
89
|
|
|
echo '<li>' . _AM_NEWBB_DIGEST_HELP_2 . '</li>'; |
90
|
|
|
echo '<li>' . _AM_NEWBB_DIGEST_HELP_3 . '</li>'; |
91
|
|
|
echo '<li>' . _AM_NEWBB_DIGEST_HELP_4 . '</li></ul>'; |
92
|
|
|
echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
93
|
|
|
echo '<form action="' . xoops_getenv('SCRIPT_NAME') . '" method="post">'; |
94
|
|
|
echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
95
|
|
|
echo "<tr align='center'>"; |
96
|
|
|
echo "<th class='bg3' width='2%'>" . _DELETE . '</th>'; |
97
|
|
|
echo "<th class='bg3'>" . _AM_NEWBB_DIGESTCONTENT . '</th>'; |
98
|
|
|
echo '</tr>'; |
99
|
|
|
|
100
|
|
|
$digests = []; |
101
|
|
|
// /** @var Newbb\DigestHandler $digestHandler */ |
102
|
|
|
// $digestHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Digest'); |
103
|
|
|
$digests = $digestHandler->getAllDigests($start, $limit); |
104
|
|
|
foreach ($digests as $digest) { |
105
|
|
|
echo "<tr class='odd' align='left'>"; |
106
|
|
|
echo "<td align='center' ><input type='checkbox' name='digest_id[" . $digest['digest_id'] . "]' value='1' ></td>"; |
107
|
|
|
echo '<td><strong>#' . $digest['digest_id'] . ' @ ' . formatTimestamp($digest['digest_time']) . '</strong><br>' . str_replace("\n", '<br>', $digest['digest_content']) . '</td>'; |
108
|
|
|
echo '</tr>'; |
109
|
|
|
echo "<tr colspan='2'><td height='2'></td></tr>"; |
110
|
|
|
} |
111
|
|
|
$submit = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
112
|
|
|
echo "<tr><td colspan='2' align='center'>" . $submit->render() . '</td></tr>'; |
113
|
|
|
$hidden = new \XoopsFormHidden('op', 'delete'); |
114
|
|
|
echo $hidden->render(); |
115
|
|
|
$hidden = new \XoopsFormHidden('item', $item); |
116
|
|
|
echo $hidden->render() . '</form>'; |
117
|
|
|
|
118
|
|
|
echo '</table>'; |
119
|
|
|
echo '</td></tr></table>'; |
120
|
|
|
echo '<fieldset>'; |
121
|
|
|
echo '<legend> ' . _AM_NEWBB_PREFERENCES . ' - ' . _MI_NEWBB_ADMENU_DIGEST . ' </legend>'; |
122
|
|
|
echo _AM_NEWBB_DIGEST_HELP_AUTO_DIGEST; |
123
|
|
|
echo '</fieldset>'; |
124
|
|
|
$nav = new \XoopsPageNav($digestHandler->getDigestCount(), $limit, $start, 'start'); |
125
|
|
|
echo $nav->renderNav(4); |
126
|
|
|
|
127
|
|
|
break; |
128
|
|
|
} |
129
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
130
|
|
|
|