XOOPS  2.6.0
header.php
Go to the documentation of this file.
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 
14 
24 require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
25 
26 XoopsLoad::load('system', 'system');
27 
31 
32 // Get Action type
33 $op = Request::getCmd('op', 'list');
34 $start = Request::getInt('start', 0);
35 $imgcat_id = Request::getInt('imgcat_id', 0);
36 
37 $redirect = basename($xoops->getenv('SCRIPT_NAME'));
38 if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) {
40 }
41 
42 $gperm_handler = $xoops->getHandlerGroupperm();
43 $groups = $xoops->getUserGroups();
44 
45 // check WRITE right by category before continue
46 if (isset($imgcat_id) && ($op == 'addfile' || $op == 'editcat' || $op == 'updatecat' || $op == 'delcatok' || $op == 'delcat')) {
47  $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imgcat_id, $groups, $xoops->module->mid());
48  if (!$imgcat_write) {
49  $xoops->redirect($redirect, 1);
50  }
51 }
52 
53 // Only website administator can delete categories or images
54 if (!in_array(FixedGroups::ADMIN, $groups) && ($op == 'delfile' || $op == 'delfileok' || $op == 'delcatok' || $op == 'delcat')) {
55  $xoops->redirect($redirect, 1);
56 }
57 
58 // check READ right by category before continue
59 if (isset($imgcat_id) && $op == 'list') {
60  $imgcat_read = $gperm_handler->checkRight('imgcat_read', $imgcat_id, $groups, $xoops->module->mid());
61  $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imgcat_id, $groups, $xoops->module->mid());
62  if (!$imgcat_read && !$imgcat_write) {
63  $xoops->redirect('images.php', 1);
64  }
65 }
66 
67 // Add Script
68 $xoops->theme()->addScript('media/xoops/xoops.js');
69 $xoops->theme()->addScript('modules/system/js/admin.js');
70 // Add Stylesheet
71 $xoops->theme()->addStylesheet('modules/system/css/admin.css');
72 $xoops->theme()->addStylesheet('modules/images/css/admin.css');
$imgcat_id
Definition: header.php:35
$start
Definition: header.php:34
if(!$xoops->isUser()||!$xoops->isModule()||!$xoops->user->isAdmin($xoops->module->mid())) $gperm_handler
Definition: header.php:42
static getInstance()
Definition: system.php:46
$xoops
Definition: header.php:25
static getInstance()
Definition: Xoops.php:160
$groups
Definition: header.php:43
exit
Definition: browse.php:104
$redirect
Definition: header.php:37
$op
Definition: header.php:33
$system
Definition: header.php:26
static getHelper($dirname= 'system')
Definition: Helper.php:27
static load($name, $type="core")
Definition: xoopsload.php:65
const E_NO_ACCESS_PERMISSION
Definition: en_US.php:351
$helper
Definition: header.php:30