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: Dirk Herrmann (AKA alfred) // |
28
|
|
|
// URL: http://www.mymyxoops.org/, http://simple-xoops.de/ // |
29
|
|
|
// Project: XOOPS Project // |
30
|
|
|
// ------------------------------------------------------------------------- // |
31
|
|
|
|
32
|
|
|
use Xmf\Request; |
33
|
|
|
|
34
|
|
|
require_once __DIR__ . '/admin_header.php'; |
35
|
|
|
xoops_cp_header(); |
36
|
|
|
require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
37
|
|
|
$adminObject->displayNavigation(basename(__FILE__)); |
38
|
|
|
/** @var \XoopsMemberHandler $memberHandler */ |
39
|
|
|
$memberHandler = xoops_getHandler('member'); |
40
|
|
|
///** @var Newbb\ForumHandler $forumHandler */ |
41
|
|
|
//$forumHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); |
42
|
|
|
if (Request::getString('submit', '', 'POST')) { |
43
|
|
|
$fgroups = Request::getArray('group', '', 'POST'); // !empty($_POST['group']) ? $_POST['group'] : ''; |
44
|
|
|
$fforum = Request::getInt('forenid', 0, 'POST'); // (int)($_POST['forenid']); |
45
|
|
|
$fuser = []; |
46
|
|
|
if (0 !== $fforum) { |
47
|
|
|
if ('' !== $fgroups) { |
|
|
|
|
48
|
|
|
$gg = []; |
49
|
|
|
foreach ($fgroups as $k) { |
50
|
|
|
$gg = $memberHandler->getUsersByGroup($k, false); |
51
|
|
|
foreach ($gg as $f) { |
52
|
|
|
if (!in_array($f, $fuser)) { |
53
|
|
|
$fuser[] = $f; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
if (-1 == $fforum) { // alle Foren |
59
|
|
|
$sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "'"; |
60
|
|
|
} else { |
61
|
|
|
$sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "' WHERE forum_id =" . $fforum; |
62
|
|
|
} |
63
|
|
|
if (is_array($fuser) && $GLOBALS['xoopsDB']->queryF($sql)) { |
64
|
|
|
$mess = _AM_NEWBB_GROUPMOD_ADDMOD; |
65
|
|
|
} else { |
66
|
|
|
$mess = _AM_NEWBB_GROUPMOD_ERRMOD . '<br><small>( ' . $sql . ' )</small>'; |
67
|
|
|
} |
68
|
|
|
redirect_header('admin_groupmod.php', 1, $mess); |
69
|
|
|
// echo '<div class="confirmMsg">' . $mess . '</div><br><br>'; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
echo _AM_NEWBB_GROUPMOD_TITLEDESC; |
74
|
|
|
echo "<br><br><table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
75
|
|
|
echo "<form name='reorder' method='post'>"; |
76
|
|
|
///** @var Newbb\CategoryHandler $categoryHandler */ |
77
|
|
|
//$categoryHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Category'); |
78
|
|
|
$criteriaCategory = new \CriteriaCompo(new \Criteria('cat_id')); |
79
|
|
|
$criteriaCategory->setSort('cat_order'); |
80
|
|
|
$categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); |
81
|
|
|
$forums = $forumHandler->getTree(array_keys($categories), 0, 'all', ' '); |
82
|
|
|
echo '<select name="forenid">'; |
83
|
|
|
echo '<option value="-1">-- ' . _AM_NEWBB_GROUPMOD_ALLFORUMS . ' --</option>'; |
84
|
|
|
foreach (array_keys($categories) as $c) { |
85
|
|
|
if (!isset($forums[$c])) { |
86
|
|
|
continue; |
87
|
|
|
} |
88
|
|
|
$i = 0; |
89
|
|
|
foreach ($forums[$c] as $key => $forum) { |
90
|
|
|
echo '<option value="' . $forum['forum_id'] . '"> ' . $categories[$c]->getVar('cat_title') . '::' . $forum['forum_name'] . '</option>'; |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
echo '</select>'; |
94
|
|
|
echo "</td><tr><tr><td class='even'>"; |
95
|
|
|
|
96
|
|
|
$groups = $memberHandler->getGroups(); |
97
|
|
|
foreach ($groups as $value) { |
98
|
|
|
echo '<input type="checkbox" name="group[]" value="' . $value->getVar('groupid') . '" > ' . $value->getVar('name') . '<br>'; |
99
|
|
|
} |
100
|
|
|
echo "</td><tr><tr><td class='odd' style='text-align:center;'>"; |
101
|
|
|
echo '<input type="submit" value="' . _SUBMIT . '" name="submit" >'; |
102
|
|
|
echo '</td></tr></table>'; |
103
|
|
|
echo '</form>'; |
104
|
|
|
echo '<fieldset>'; |
105
|
|
|
echo '<legend> ' . _MI_NEWBB_ADMENU_GROUPMOD . ' </legend>'; |
106
|
|
|
echo _AM_NEWBB_HELP_GROUPMOD_TAB; |
107
|
|
|
echo '</fieldset>'; |
108
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
109
|
|
|
|