1
|
|
|
<?php |
2
|
|
|
// ------------------------------------------------------------------------- // |
3
|
|
|
// myblocksadmin.php // |
4
|
|
|
// - XOOPS block admin for each modules - // |
5
|
|
|
// GIJOE <http://www.peak.ne.jp> // |
6
|
|
|
// ------------------------------------------------------------------------- // |
7
|
|
|
|
8
|
|
|
use XoopsModules\Blocksadmin\Helper; |
9
|
|
|
|
10
|
|
|
/** @var Helper $helper */ |
11
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
12
|
|
|
|
13
|
|
|
require_once __DIR__ . '/admin_header.php'; |
14
|
|
|
|
15
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
16
|
|
|
$moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
17
|
|
|
|
18
|
|
|
$helper = Helper::getInstance(); |
19
|
|
|
$helper->loadLanguage('admin', 'system'); |
|
|
|
|
20
|
|
|
$helper->loadLanguage('common'); |
21
|
|
|
$helper->loadLanguage('blocksadmin'); |
22
|
|
|
|
23
|
|
|
//if( substr( XOOPS_VERSION , 6 , 3 ) > 2.0 ) { |
24
|
|
|
// require __DIR__ . '/myblocksadmin2.php' ; |
25
|
|
|
// exit ; |
26
|
|
|
//} |
27
|
|
|
|
28
|
|
|
//if (mb_substr(XOOPS_VERSION, 6, 3) > 2.0 && mb_substr(XOOPS_VERSION, 6, 3) < 2.3) { |
29
|
|
|
// require __DIR__ . '/myblocksadmin2.php'; |
30
|
|
|
// exit; |
31
|
|
|
//} |
32
|
|
|
|
33
|
|
|
require __DIR__ . '/mygrouppermform.php'; |
34
|
|
|
require XOOPS_ROOT_PATH . '/kernel/block.php'; |
35
|
|
|
|
36
|
|
|
$xoops_system_path = XOOPS_ROOT_PATH . '/modules/system'; |
37
|
|
|
|
38
|
|
|
// language files |
39
|
|
|
$language = $xoopsConfig['language']; |
40
|
|
|
if (!file_exists("$xoops_system_path/language/$language/admin/blocksadmin.php")) { |
41
|
|
|
$language = 'english'; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
// to prevent from notice that constants already defined |
45
|
|
|
$error_reporting_level = error_reporting(0); |
46
|
|
|
require_once "$xoops_system_path/constants.php"; |
47
|
|
|
require_once "$xoops_system_path/language/$language/admin.php"; |
48
|
|
|
require_once "$xoops_system_path/language/$language/admin/blocksadmin.php"; |
49
|
|
|
error_reporting($error_reporting_level); |
50
|
|
|
|
51
|
|
|
$group_defs = file("$xoops_system_path/language/$language/admin/groups.php"); |
52
|
|
|
foreach ($group_defs as $def) { |
53
|
|
|
if (mb_strstr($def, '_AM_SYSTEM_GROUPS_ACCESSRIGHTS') || mb_strstr($def, '_AM_SYSTEM_GROUPS_ACTIVERIGHTS')) { |
54
|
|
|
eval($def); |
|
|
|
|
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
// check $xoopsModule |
59
|
|
|
if (!is_object($xoopsModule)) { |
60
|
|
|
redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
// set target_module if specified by $_GET['dirname'] |
64
|
|
|
$moduleHandler = xoops_getHandler('module'); |
65
|
|
|
if (!empty($_GET['dirname'])) { |
66
|
|
|
$target_module = $moduleHandler->getByDirname($_GET['dirname']); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
/* else if( ! empty( $_GET['mid'] ) ) { |
69
|
|
|
$target_module = $moduleHandler->get( intval( $_GET['mid'] ) ); |
70
|
|
|
}*/ |
71
|
|
|
|
72
|
|
|
if (!empty($target_module) && is_object($target_module)) { |
73
|
|
|
// specified by dirname |
74
|
|
|
$target_mid = $target_module->getVar('mid'); |
75
|
|
|
$target_mname = $target_module->getVar('name') . ' ' . sprintf('(%2.2f)', $target_module->getVar('version') / 100.0); |
76
|
|
|
$query4redirect = '?dirname=' . urlencode(strip_tags($_GET['dirname'])); |
77
|
|
|
} elseif ((isset($_GET['mid']) && 0 == $_GET['mid']) || 'blocksadmin' === $xoopsModule->getVar('dirname')) { |
78
|
|
|
$target_mid = 0; |
79
|
|
|
$target_mname = ''; |
80
|
|
|
$query4redirect = '?mid=0'; |
81
|
|
|
} else { |
82
|
|
|
$target_mid = $xoopsModule->getVar('mid'); |
83
|
|
|
$target_mname = $xoopsModule->getVar('name'); |
84
|
|
|
$query4redirect = ''; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
// check access right (needs system_admin of BLOCK) |
88
|
|
|
/** @var \XoopsGroupPermHandler $grouppermHandler */ |
89
|
|
|
$grouppermHandler = xoops_getHandler('groupperm'); |
90
|
|
|
if (!$grouppermHandler->checkRight('system_admin', XOOPS_SYSTEM_BLOCK, $xoopsUser->getGroups())) { |
91
|
|
|
redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
// get blocks owned by the module (Imported from xoopsblock.php then modified) |
95
|
|
|
//$block_arr =& XoopsBlock::getByModule( $target_mid ) ; |
96
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
97
|
|
|
$sql = 'SELECT * FROM ' . $db->prefix('newblocks') . " WHERE mid='$target_mid' ORDER BY visible DESC,side,weight"; |
98
|
|
|
$result = $db->query($sql); |
99
|
|
|
$block_arr = []; |
100
|
|
|
while (false !== ($myrow = $db->fetchArray($result))) { |
101
|
|
|
$block_arr[] = new XoopsBlock($myrow); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
function list_blocks() |
105
|
|
|
{ |
106
|
|
|
global $query4redirect, $block_arr, $pathIcon16; |
107
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
108
|
|
|
$moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
109
|
|
|
|
110
|
|
|
// cachetime options |
111
|
|
|
$cachetimes = ['0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK, '2592000' => _MONTH]; |
112
|
|
|
|
113
|
|
|
// displaying TH |
114
|
|
|
echo " |
115
|
|
|
<form action='admin.php' name='blockadmin' method='post'> |
116
|
|
|
<table width='95%' class='outer' cellpadding='4' cellspacing='1'>" . $GLOBALS['xoopsSecurity']->getTokenHTML() . " |
117
|
|
|
|
118
|
|
|
<tr valign='middle'> |
119
|
|
|
<th>" . _AM_SYSTEM_BLOCKS_TITLE . "</th> |
120
|
|
|
<th align='center' nowrap='nowrap'>" . constant('CO_' . $moduleDirNameUpper . '_' . 'SIDE') . "</th> |
121
|
|
|
<th align='center'>" . constant('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT') . "</th> |
122
|
|
|
<th align='center'>" . constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE') . "</th> |
123
|
|
|
<th align='center'>" . constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN') . "</th> |
124
|
|
|
<th align='center'>" . constant('CO_' . $moduleDirNameUpper . '_' . 'AGDS') . "</th> |
125
|
|
|
<th align='center'>" . constant('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME') . "</th> |
126
|
|
|
<th align='right'>" . constant('CO_' . $moduleDirNameUpper . '_' . 'ACTION') . "</th> |
127
|
|
|
</tr>\n"; |
128
|
|
|
|
129
|
|
|
// blocks displaying loop |
130
|
|
|
$class = 'even'; |
131
|
|
|
$block_configs = get_block_configs(); |
132
|
|
|
foreach (array_keys($block_arr) as $i) { |
133
|
|
|
$sseln = $sseln0 = $sseln1 = $ssel0 = $ssel1 = $ssel2 = $ssel3 = $ssel4 = $ssel5 = $ssel6 = $ssel7 = $ssel8 = $ssel9 = $sse20 = ''; |
134
|
|
|
$scoln = $scoln0 = $scoln1 = $scol0 = $scol1 = $scol2 = $scol3 = $scol4 = $scol5 = $scol6 = $scol7 = $scol8 = $scol9 = $sco20 = '#FFFFFF'; |
|
|
|
|
135
|
|
|
|
136
|
|
|
$weight = $block_arr[$i]->getVar('weight'); |
137
|
|
|
$title = $block_arr[$i]->getVar('title'); |
138
|
|
|
$name = $block_arr[$i]->getVar('name'); |
139
|
|
|
$bcachetime = $block_arr[$i]->getVar('bcachetime'); |
140
|
|
|
$bid = $block_arr[$i]->getVar('bid'); |
141
|
|
|
|
142
|
|
|
// visible and side |
143
|
|
|
if (1 != $block_arr[$i]->getVar('visible')) { |
144
|
|
|
$sseln = ' checked'; |
145
|
|
|
$scoln = '#FF0000'; |
146
|
|
|
$sseln0 = ' checked'; |
147
|
|
|
$scoln0 = '#00FF00'; |
148
|
|
|
} else { |
149
|
|
|
$sseln1 = ' checked'; |
150
|
|
|
$scoln1 = '#00FF00'; |
151
|
|
|
switch ($block_arr[$i]->getVar('side')) { |
152
|
|
|
default: |
153
|
|
|
case XOOPS_SIDEBLOCK_LEFT: |
154
|
|
|
$ssel0 = ' checked'; |
155
|
|
|
$scol0 = '#00FF00'; |
156
|
|
|
break; |
157
|
|
|
case XOOPS_SIDEBLOCK_RIGHT: |
158
|
|
|
$ssel1 = ' checked'; |
159
|
|
|
$scol1 = '#00FF00'; |
160
|
|
|
break; |
161
|
|
|
case XOOPS_CENTERBLOCK_LEFT: |
162
|
|
|
$ssel2 = ' checked'; |
163
|
|
|
$scol2 = '#00FF00'; |
164
|
|
|
break; |
165
|
|
|
case XOOPS_CENTERBLOCK_RIGHT: |
166
|
|
|
$ssel4 = ' checked'; |
167
|
|
|
$scol4 = '#00FF00'; |
168
|
|
|
break; |
169
|
|
|
case XOOPS_CENTERBLOCK_CENTER: |
170
|
|
|
$ssel3 = ' checked'; |
171
|
|
|
$scol3 = '#00FF00'; |
172
|
|
|
break; |
173
|
|
|
case XOOPS_CENTERBLOCK_BOTTOMLEFT: |
174
|
|
|
$ssel5 = ' checked'; |
175
|
|
|
$scol5 = '#00FF00'; |
176
|
|
|
break; |
177
|
|
|
case XOOPS_CENTERBLOCK_BOTTOMRIGHT: |
178
|
|
|
$ssel6 = ' checked'; |
179
|
|
|
$scol6 = '#00FF00'; |
180
|
|
|
break; |
181
|
|
|
case XOOPS_CENTERBLOCK_BOTTOM: |
182
|
|
|
$ssel7 = ' checked'; |
183
|
|
|
$scol7 = '#00FF00'; |
184
|
|
|
break; |
185
|
|
|
//footer |
186
|
|
|
|
187
|
|
|
case XOOPS_FOOTERBLOCK_LEFT: |
188
|
|
|
$ssel8 = ' checked'; |
189
|
|
|
$scol8 = '#00FF00'; |
190
|
|
|
break; |
191
|
|
|
case XOOPS_FOOTERBLOCK_CENTER: |
192
|
|
|
$ssel9 = ' checked'; |
193
|
|
|
$scol9 = '#00FF00'; |
194
|
|
|
break; |
195
|
|
|
case XOOPS_FOOTERBLOCK_RIGHT: |
196
|
|
|
$sse20 = ' checked'; |
197
|
|
|
$sco20 = '#00FF00'; |
198
|
|
|
break; |
199
|
|
|
} |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
// bcachetime |
203
|
|
|
$cachetime_options = ''; |
204
|
|
|
foreach ($cachetimes as $cachetime => $cachetime_name) { |
205
|
|
|
if ($bcachetime == $cachetime) { |
206
|
|
|
$cachetime_options .= "<option value='$cachetime' selected='selected'>$cachetime_name</option>\n"; |
207
|
|
|
} else { |
208
|
|
|
$cachetime_options .= "<option value='$cachetime'>$cachetime_name</option>\n"; |
209
|
|
|
} |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
// target modules |
213
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
214
|
|
|
$result = $db->query('SELECT module_id FROM ' . $db->prefix('block_module_link') . " WHERE block_id='$bid'"); |
215
|
|
|
$selected_mids = []; |
216
|
|
|
while (list($selected_mid) = $db->fetchRow($result)) { |
217
|
|
|
$selected_mids[] = (int)$selected_mid; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
221
|
|
|
$moduleHandler = xoops_getHandler('module'); |
222
|
|
|
$criteria = new CriteriaCompo(new Criteria('hasmain', 1)); |
223
|
|
|
$criteria->add(new Criteria('isactive', 1)); |
224
|
|
|
$module_list = $moduleHandler->getList($criteria); |
225
|
|
|
$module_list[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE; |
226
|
|
|
$module_list[0] = _AM_SYSTEM_BLOCKS_ALLPAGES; |
227
|
|
|
ksort($module_list); |
228
|
|
|
$module_options = ''; |
229
|
|
|
foreach ($module_list as $mid => $mname) { |
230
|
|
|
if (in_array($mid, $selected_mids)) { |
231
|
|
|
$module_options .= "<option value='$mid' selected='selected'>$mname</option>\n"; |
232
|
|
|
} else { |
233
|
|
|
$module_options .= "<option value='$mid'>$mname</option>\n"; |
234
|
|
|
} |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
$visibleInGroup = ''; |
238
|
|
|
/** @var \XoopsMemberHandler $memberHandler */ |
239
|
|
|
$memberHandler = xoops_getHandler('member'); |
240
|
|
|
/** @var \XoopsGroupPermHandler $grouppermHandler */ |
241
|
|
|
$grouppermHandler = xoops_getHandler('groupperm'); |
242
|
|
|
$groups = $memberHandler->getGroups(); |
243
|
|
|
$groups_perms = $grouppermHandler->getGroupIds('block_read', $block_arr[$i]->getVar('bid')); |
244
|
|
|
|
245
|
|
|
// echo "<td class='$class' align='center'><select size='5' name='groups[" . $block_arr[$i]->getVar('bid') . "][]' id='groups[" . $block_arr[$i]->getVar('bid') . "][]' multiple='multiple'>"; |
246
|
|
|
foreach ($groups as $grp) { |
247
|
|
|
$visibleInGroup .= "<option value='" . $grp->getVar('groupid') . "' " . (in_array($grp->getVar('groupid'), $groups_perms) ? " selected='selected'" : '') . '>' . $grp->getVar('name') . '</option>'; |
248
|
|
|
} |
249
|
|
|
// echo '</select></td>'; |
250
|
|
|
|
251
|
|
|
// delete link if it is cloned block |
252
|
|
|
if ('D' === $block_arr[$i]->getVar('block_type') || 'C' === $block_arr[$i]->getVar('block_type')) { |
253
|
|
|
$delete_link = "<a href='admin.php?fct=blocksadmin&op=delete&bid=$bid'><img src=" . $pathIcon16 . '/delete.png' . " alt='" . _DELETE . "' title='" . _DELETE . "'> </a>";// . _DELETE . '</a>'; |
254
|
|
|
} else { |
255
|
|
|
$delete_link = ''; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
global $pathIcon16; |
259
|
|
|
|
260
|
|
|
// clone link if it is marked as cloneable block |
261
|
|
|
// $modversion['blocks'][n]['can_clone'] |
262
|
|
|
if ('D' === $block_arr[$i]->getVar('block_type') || 'C' === $block_arr[$i]->getVar('block_type')) { |
263
|
|
|
$can_clone = true; |
264
|
|
|
} else { |
265
|
|
|
$can_clone = false; |
266
|
|
|
foreach ($block_configs as $bconf) { |
267
|
|
|
if ($block_arr[$i]->getVar('show_func') == $bconf['show_func'] && $block_arr[$i]->getVar('func_file') == $bconf['file'] && (empty($bconf['template']) || $block_arr[$i]->getVar('template') == $bconf['template'])) { |
268
|
|
|
if (!empty($bconf['can_clone'])) { |
269
|
|
|
$can_clone = true; |
270
|
|
|
} |
271
|
|
|
} |
272
|
|
|
} |
273
|
|
|
} |
274
|
|
|
if ($can_clone) { |
275
|
|
|
$clone_link = "<a href='admin.php?fct=blocksadmin&op=clone&bid=$bid'> <img src=" . $pathIcon16 . '/editcopy.png' . " alt='" . _CLONE . "' title='" . _CLONE . "'> </a>"; |
276
|
|
|
} else { |
277
|
|
|
$clone_link = ''; |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
// displaying part |
281
|
|
|
echo " |
282
|
|
|
<tr valign='middle'> |
283
|
|
|
<td class='$class'> |
284
|
|
|
$name |
285
|
|
|
<br> |
286
|
|
|
<input type='text' name='title[$bid]' value='$title' size='20'> |
287
|
|
|
</td> |
288
|
|
|
<td class='$class' align='center' nowrap='nowrap' width='125px'> |
289
|
|
|
<div align='center' > |
290
|
|
|
<input style='background-color:$scol2;' type='radio' name='side[$bid]' value='" . XOOPS_CENTERBLOCK_LEFT . "'$ssel2> |
291
|
|
|
<input style='background-color:$scol3;'type='radio' name='side[$bid]' value='" . XOOPS_CENTERBLOCK_CENTER . "'$ssel3> |
292
|
|
|
<input style='background-color:$scol4;'type='radio' name='side[$bid]' value='" . XOOPS_CENTERBLOCK_RIGHT . "'$ssel4> |
293
|
|
|
</div> |
294
|
|
|
<div> |
295
|
|
|
<span style='float:right'> |
296
|
|
|
<input style='background-color:$scol1;' type='radio' name='side[$bid]' value='" . XOOPS_SIDEBLOCK_RIGHT . "'$ssel1> |
297
|
|
|
</span> |
298
|
|
|
<div align='left'> |
299
|
|
|
<input style='background-color:$scol0;' type='radio' name='side[$bid]' value='" . XOOPS_SIDEBLOCK_LEFT . "'$ssel0> |
300
|
|
|
</div> |
301
|
|
|
</div> |
302
|
|
|
<div align='center'> |
303
|
|
|
<input style='background-color:$scol5;' type='radio' name='side[$bid]' value='" . XOOPS_CENTERBLOCK_BOTTOMLEFT . "'$ssel5> |
304
|
|
|
<input style='background-color:$scol7;' type='radio' name='side[$bid]' value='" . XOOPS_CENTERBLOCK_BOTTOM . "'$ssel7> |
305
|
|
|
<input style='background-color:$scol6;' type='radio' name='side[$bid]' value='" . XOOPS_CENTERBLOCK_BOTTOMRIGHT . "'$ssel6> |
306
|
|
|
</div> |
307
|
|
|
|
308
|
|
|
<div align='center'> |
309
|
|
|
<input style='background-color:$scol8;' type='radio' name='side[$bid]' value='" . XOOPS_FOOTERBLOCK_LEFT . "'$ssel8> |
310
|
|
|
<input style='background-color:$scol9;' type='radio' name='side[$bid]' value='" . XOOPS_FOOTERBLOCK_CENTER . "'$ssel9> |
311
|
|
|
<input style='background-color:$sco20;' type='radio' name='side[$bid]' value='" . XOOPS_FOOTERBLOCK_RIGHT . "'$sse20> |
312
|
|
|
</div> |
313
|
|
|
|
314
|
|
|
<br> |
315
|
|
|
<br> |
316
|
|
|
<div style='float:left;width:40px;'> </div> |
317
|
|
|
<div style='float:left;background-color:$scoln;'> |
318
|
|
|
<input type='radio' name='side[$bid]' value='-1' style='background-color:$scoln;' $sseln> |
319
|
|
|
</div> |
320
|
|
|
<div style='float:left;'>" . _NONE . "</div> |
321
|
|
|
</td> |
322
|
|
|
<td class='$class' align='center'> |
323
|
|
|
<input type='text' name=weight[$bid] value='$weight' size='3' maxlength='5' style='text-align:right;'> |
324
|
|
|
</td> |
325
|
|
|
|
326
|
|
|
<td class='$class' align='center' nowrap> |
327
|
|
|
<input type='radio' name='visible[$bid]' value='1' style='background-color:$scoln1;' {$sseln1}>" . _YES . " <input type='radio' name='visible[$bid]' value='-1'{$sseln0}>" . _NO . " |
328
|
|
|
</td> |
329
|
|
|
|
330
|
|
|
|
331
|
|
|
|
332
|
|
|
<td class='$class' align='center'> |
333
|
|
|
<select name='bmodule[$bid][]' size='5' multiple='multiple'> |
334
|
|
|
$module_options |
335
|
|
|
</select> |
336
|
|
|
</td> |
337
|
|
|
|
338
|
|
|
|
339
|
|
|
|
340
|
|
|
<td class='$class' align='center'><select size='5' name='groups[$bid][]' id='groups[$bid][]' multiple='multiple'> |
341
|
|
|
$visibleInGroup |
342
|
|
|
</select></td> |
343
|
|
|
|
344
|
|
|
|
345
|
|
|
|
346
|
|
|
|
347
|
|
|
|
348
|
|
|
<td class='$class' align='center'> |
349
|
|
|
<select name='bcachetime[$bid]' size='1'> |
350
|
|
|
$cachetime_options |
351
|
|
|
</select> |
352
|
|
|
</td> |
353
|
|
|
<td class='$class' align='center'> |
354
|
|
|
<a href='admin.php?fct=blocksadmin&op=edit&bid=$bid'><img src=" . $pathIcon16 . '/edit.png' . " alt='" . _EDIT . "' title='" . _EDIT . "'> </a>{$delete_link}{$clone_link} |
355
|
|
|
<input type='hidden' name='bid[$bid]' value='$bid'> |
356
|
|
|
</td> |
357
|
|
|
|
358
|
|
|
|
359
|
|
|
|
360
|
|
|
|
361
|
|
|
|
362
|
|
|
|
363
|
|
|
|
364
|
|
|
</tr>\n"; |
365
|
|
|
|
366
|
|
|
$class = ('even' === $class) ? 'odd' : 'even'; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
echo " |
370
|
|
|
<tr><td class='foot' align='center' colspan='6'> |
371
|
|
|
<input type='hidden' name='query4redirect' value='$query4redirect'> |
372
|
|
|
<input type='hidden' name='fct' value='blocksadmin'> |
373
|
|
|
<input type='hidden' name='op' value='order'> |
374
|
|
|
" . $GLOBALS['xoopsSecurity']->getTokenHTML() . " |
375
|
|
|
<input type='submit' name='submit' value='" . _SUBMIT . "'> |
376
|
|
|
</td></tr></table> |
377
|
|
|
</form>\n"; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* @return array |
382
|
|
|
*/ |
383
|
|
|
function get_block_configs() |
384
|
|
|
{ |
385
|
|
|
$error_reporting_level = error_reporting(0); |
386
|
|
|
if (preg_match('/^[.0-9a-zA-Z_-]+$/', @$_GET['dirname'])) { |
387
|
|
|
xoops_loadLanguage('modinfo', $_GET['dirname']); |
388
|
|
|
require \dirname(__DIR__, 2) . '/' . $_GET['dirname'] . '/xoops_version.php'; |
389
|
|
|
} else { |
390
|
|
|
require \dirname(__DIR__) . '/xoops_version.php'; |
391
|
|
|
} |
392
|
|
|
error_reporting($error_reporting_level); |
393
|
|
|
if (empty($modversion['blocks'])) { |
|
|
|
|
394
|
|
|
return []; |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
return $modversion['blocks']; |
398
|
|
|
} |
399
|
|
|
|
400
|
|
|
function list_groups() |
401
|
|
|
{ |
402
|
|
|
global $target_mid, $target_mname, $block_arr; |
403
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
404
|
|
|
$moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
405
|
|
|
|
406
|
|
|
$item_list = []; |
407
|
|
|
foreach (array_keys($block_arr) as $i) { |
408
|
|
|
$item_list[$block_arr[$i]->getVar('bid')] = $block_arr[$i]->getVar('title'); |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
$form = new MyXoopsGroupPermForm(_AM_SYSTEM_ADGS, 1, 'block_read', ''); |
412
|
|
|
if ($target_mid > 1) { |
413
|
|
|
$form->addAppendix('module_admin', $target_mid, $target_mname . ' ' . constant('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS')); |
414
|
|
|
$form->addAppendix('module_read', $target_mid, $target_mname . ' ' . constant('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS')); |
415
|
|
|
} |
416
|
|
|
foreach ($item_list as $item_id => $item_name) { |
417
|
|
|
$form->addItem($item_id, $item_name); |
418
|
|
|
} |
419
|
|
|
echo $form->render(); |
420
|
|
|
} |
421
|
|
|
|
422
|
|
|
if (!empty($_POST['submit'])) { |
423
|
|
|
if (!$GLOBALS['xoopsSecurity']->check()) { |
424
|
|
|
redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors()); |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
require __DIR__ . '/mygroupperm.php'; |
428
|
|
|
redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/admin/myblocksadmin.php$query4redirect", 1, _AM_SYSTEM_DBUPDATED); |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
xoops_cp_header(); |
432
|
|
|
if (file_exists('./mymenu.php')) { |
433
|
|
|
require __DIR__ . '/mymenu.php'; |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
echo "<h3 style='text-align:left;'>$target_mname</h3>\n"; |
437
|
|
|
|
438
|
|
|
if (!empty($block_arr)) { |
439
|
|
|
echo "<h4 style='text-align:left;'>" . constant('CO_' . $moduleDirNameUpper . '_' . 'BADMIN') . "</h4>\n"; |
440
|
|
|
list_blocks(); |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
list_groups(); |
444
|
|
|
xoops_cp_footer(); |
445
|
|
|
|
446
|
|
|
?> |
|
|
|
|
447
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.