|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
You may not change or alter any portion of this comment or credits |
|
5
|
|
|
of supporting developers from this source code or any supporting source code |
|
6
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
7
|
|
|
|
|
8
|
|
|
This program is distributed in the hope that it will be useful, |
|
9
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Module: soapbox |
|
15
|
|
|
* |
|
16
|
|
|
* @category Module |
|
17
|
|
|
* @package soapbox |
|
18
|
|
|
* @author XOOPS Development Team <[email protected]> - <https://xoops.org> |
|
19
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
20
|
|
|
* @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
|
21
|
|
|
* @link https://xoops.org/ |
|
22
|
|
|
* @since 1.0.0 |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
use Xmf\Request; |
|
26
|
|
|
use XoopsModules\Soapbox; |
|
27
|
|
|
|
|
28
|
|
|
require_once __DIR__ . '/admin_header.php'; |
|
29
|
|
|
//require_once dirname(__DIR__) . '/include/config.inc.php'; |
|
30
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
|
31
|
|
|
if ('' != Request::getString('submit', '')) { |
|
32
|
|
|
redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->dirname() . '/admin/permissions.php', 1, _MP_GPERMUPDATED); |
|
|
|
|
|
|
33
|
|
|
} |
|
34
|
|
|
// Check admin have access to this page |
|
35
|
|
|
/*$group = $GLOBALS['xoopsUser']->getGroups (); |
|
36
|
|
|
$groups = xoops_getModuleOption ( 'admin_groups', $thisDirname ); |
|
37
|
|
|
if (count ( array_intersect ( $group, $groups ) ) <= 0) { |
|
38
|
|
|
redirect_header ( 'index.php', 3, _NOPERM ); |
|
39
|
|
|
}*/ |
|
40
|
|
|
|
|
41
|
|
|
xoops_cp_header(); |
|
42
|
|
|
$adminObject = \Xmf\Module\Admin::getInstance(); |
|
43
|
|
|
$adminObject->displayNavigation(basename(__FILE__)); |
|
44
|
|
|
|
|
45
|
|
|
//$permission = soapbox_CleanVars($_POST, 'permission', 1, 'int'); |
|
46
|
|
|
$permission = Request::getInt('permission', 1, 'POST'); |
|
47
|
|
|
$selected = ['', '', '', '']; |
|
48
|
|
|
$selected[$permission - 1] = ' selected'; |
|
49
|
|
|
|
|
50
|
|
|
echo " |
|
51
|
|
|
<form method='post' name='fselperm' action='permissions.php'> |
|
52
|
|
|
<table border=0> |
|
53
|
|
|
<tr> |
|
54
|
|
|
<td> |
|
55
|
|
|
<select name='permission' onChange='document.fselperm.submit()'> |
|
56
|
|
|
<option value='1'" . $selected[0] . '>' . _AM_SOAPBOX_PERMISSIONS_GLOBAL . "</option> |
|
57
|
|
|
<option value='2'" . $selected[1] . '>' . _AM_SOAPBOX_PERMISSIONS_APPROVE . "</option> |
|
58
|
|
|
<option value='3'" . $selected[2] . '>' . _AM_SOAPBOX_PERMISSIONS_SUBMIT . "</option> |
|
59
|
|
|
<option value='4'" . $selected[3] . '>' . _AM_SOAPBOX_PERMISSIONS_VIEW . '</option> |
|
60
|
|
|
</select> |
|
61
|
|
|
</td> |
|
62
|
|
|
</tr> |
|
63
|
|
|
</table> |
|
64
|
|
|
</form>'; |
|
65
|
|
|
|
|
66
|
|
|
$module_id = $GLOBALS['xoopsModule']->getVar('mid'); |
|
67
|
|
|
switch ($permission) { |
|
68
|
|
|
case 1: |
|
69
|
|
|
$formTitle = _AM_SOAPBOX_PERMISSIONS_GLOBAL; |
|
70
|
|
|
$permName = 'soapbox_ac'; |
|
71
|
|
|
$permDesc = _AM_SOAPBOX_PERMISSIONS_GLOBAL_DESC; |
|
72
|
|
|
$globalPerms = [ |
|
73
|
|
|
'4' => _AM_SOAPBOX_PERMISSIONS_GLOBAL_4, |
|
74
|
|
|
'8' => _AM_SOAPBOX_PERMISSIONS_GLOBAL_8, |
|
75
|
|
|
'16' => _AM_SOAPBOX_PERMISSIONS_GLOBAL_16, |
|
76
|
|
|
]; |
|
77
|
|
|
break; |
|
78
|
|
|
case 2: |
|
79
|
|
|
$formTitle = _AM_SOAPBOX_PERMISSIONS_APPROVE; |
|
80
|
|
|
$permName = 'soapbox_approve'; |
|
81
|
|
|
$permDesc = _AM_SOAPBOX_PERMISSIONS_APPROVE_DESC; |
|
82
|
|
|
break; |
|
83
|
|
|
case 3: |
|
84
|
|
|
$formTitle = _AM_SOAPBOX_PERMISSIONS_SUBMIT; |
|
85
|
|
|
$permName = 'soapbox_submit'; |
|
86
|
|
|
$permDesc = _AM_SOAPBOX_PERMISSIONS_SUBMIT_DESC; |
|
87
|
|
|
break; |
|
88
|
|
|
case 4: |
|
89
|
|
|
$formTitle = _AM_SOAPBOX_PERMISSIONS_VIEW; |
|
90
|
|
|
$permName = 'soapbox_view'; |
|
91
|
|
|
$permDesc = _AM_SOAPBOX_PERMISSIONS_VIEW_DESC; |
|
92
|
|
|
break; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
//$Form2 = new \XoopsGroupPermForm ( "", $xoopsModule -> getVar ( 'mid'), "Column_permissions", _AM_SB_SELECT_COLS); |
|
96
|
|
|
|
|
97
|
|
|
$permform = new \XoopsGroupPermForm($formTitle, $module_id, $permName, $permDesc, 'admin/permissions.php'); |
|
98
|
|
|
if (1 == $permission) { |
|
99
|
|
|
foreach ($globalPerms as $perm_id => $perm_name) { |
|
100
|
|
|
$permform->addItem($perm_id, $perm_name); |
|
101
|
|
|
} |
|
102
|
|
|
echo $permform->render(); |
|
103
|
|
|
echo '<br><br>'; |
|
104
|
|
|
} else { |
|
105
|
|
|
$criteria = new \CriteriaCompo(); |
|
106
|
|
|
$criteria->setSort('name'); |
|
107
|
|
|
$criteria->setOrder('ASC'); |
|
108
|
|
|
$cat_count = $sbColumnHandler->getCount($criteria); |
|
109
|
|
|
$cat_arr = $sbColumnHandler->getObjects($criteria); |
|
110
|
|
|
unset($criteria); |
|
111
|
|
|
foreach (array_keys($cat_arr) as $i) { |
|
112
|
|
|
$permform->addItem($cat_arr[$i]->getVar('columnID'), $cat_arr[$i]->getVar('name')); |
|
113
|
|
|
} |
|
114
|
|
|
// Check if cat exist before rendering the form and redirect, if there aren't cat |
|
115
|
|
|
if ($cat_count > 0) { |
|
116
|
|
|
echo $permform->render(); |
|
117
|
|
|
echo '<br><br>'; |
|
118
|
|
|
} else { |
|
119
|
|
|
redirect_header('column.php', 3, _AM_SOAPBOX_PERMISSIONS_NOPERMSSET); |
|
120
|
|
|
} |
|
121
|
|
|
} |
|
122
|
|
|
unset($permform); |
|
123
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
|
124
|
|
|
|