1
|
|
|
<?php |
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
|
|
|
* @copyright {@link http://xoops.org/ XOOPS Project} |
14
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
15
|
|
|
* @package |
16
|
|
|
* @since |
17
|
|
|
* @author XOOPS Development Team, |
18
|
|
|
* @author GIJ=CHECKMATE (PEAK Corp. http://www.peak.ne.jp/) |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
22
|
|
|
require_once __DIR__ . '/admin_header.php'; |
23
|
|
|
//require_once __DIR__ . '/../../../include/cp_header.php'; |
24
|
|
|
require_once __DIR__ . '/mygrouppermform.php'; |
25
|
|
|
|
26
|
|
|
// for "Duplicatable" |
27
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
28
|
|
|
if (!preg_match('/^(\D+)(\d*)$/', $moduleDirName, $regs)) { |
29
|
|
|
echo('invalid dirname: ' . htmlspecialchars($moduleDirName)); |
30
|
|
|
} |
31
|
|
|
$mydirnumber = $regs[2] === '' ? '' : (int)$regs[2]; |
32
|
|
|
|
33
|
|
|
require_once XOOPS_ROOT_PATH . "/modules/$moduleDirName/include/gtickets.php"; |
34
|
|
|
|
35
|
|
|
// language files |
36
|
|
|
$language = $xoopsConfig['language']; |
37
|
|
|
if (!file_exists(XOOPS_ROOT_PATH . "/modules/system/language/$language/admin/blocksadmin.php")) { |
38
|
|
|
$language = 'english'; |
39
|
|
|
} |
40
|
|
|
require_once XOOPS_ROOT_PATH . "/modules/system/language/$language/admin.php"; |
41
|
|
|
xoops_loadLanguage('main', $moduleDirName); |
42
|
|
|
|
43
|
|
View Code Duplication |
if (!empty($_POST['submit'])) { |
|
|
|
|
44
|
|
|
|
45
|
|
|
// Ticket Check |
46
|
|
|
if (!$xoopsGTicket->check(true, 'myblocksadmin')) { |
47
|
|
|
redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
include __DIR__ . '/mygroupperm.php'; |
51
|
|
|
redirect_header(XOOPS_URL . "/modules/$moduleDirName/admin/groupperm.php", 1, _AM_APCALAM_APCALDBUPDATED); |
52
|
|
|
exit; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
$item_list = array( |
56
|
|
|
'1' => _AM_APCAL_GPERM_G_INSERTABLE, |
57
|
|
|
'2' => _AM_APCAL_GPERM_G_SUPERINSERT, |
58
|
|
|
'4' => _AM_APCAL_GPERM_G_EDITABLE, |
59
|
|
|
'8' => _AM_APCAL_GPERM_G_SUPEREDIT, |
60
|
|
|
// '16' => _AM_APCAL_GPERM_G_DELETABLE , |
61
|
|
|
'32' => _AM_APCAL_GPERM_G_SUPERDELETE// '64' => _AM_APCAL_GPERM_G_TOUCHOTHERS |
62
|
|
|
); |
63
|
|
|
|
64
|
|
|
$form = new MyXoopsGroupPermForm(_AM_APCAL_GROUPPERM, $xoopsModule->mid(), 'apcal_global', _AM_APCAL_GROUPPERMDESC); |
65
|
|
|
foreach ($item_list as $item_id => $item_name) { |
66
|
|
|
$form->addItem($item_id, $item_name); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
xoops_cp_header(); |
70
|
|
|
$adminObject->displayNavigation(basename(__FILE__)); |
71
|
|
|
echo $form->render(); |
72
|
|
|
|
73
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
74
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.