2019-11-04 16:04:08 +00:00
|
|
|
<?php
|
2020-07-24 17:30:36 +00:00
|
|
|
|
2019-11-04 16:04:08 +00:00
|
|
|
/**
|
|
|
|
* Project:
|
|
|
|
* Contenido Content Management System
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Checks userrights for cats
|
|
|
|
*
|
|
|
|
* Requirements:
|
|
|
|
* @con_php_req 5.0
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @package Contenido Backend plugins
|
|
|
|
* @version 1.0.1
|
|
|
|
* @author Mario Diaz
|
|
|
|
* @copyright four for business AG <www.4fb.de>
|
|
|
|
* @license http://www.contenido.org/license/LIZENZ.txt
|
|
|
|
* @link http://www.4fb.de
|
|
|
|
* @link http://www.contenido.org
|
|
|
|
* @since file available since contenido release 4.8.7
|
|
|
|
*
|
|
|
|
* {@internal
|
|
|
|
* created 2006-06-08
|
|
|
|
* modified 2007-11-07, Frederic Schneider, Linkchecker-Edition
|
|
|
|
* modified 2008-02-08, Andreas Lindner, Performance enhancements
|
|
|
|
* modified 2008-07-02, Frederic Schneider, add security fix
|
|
|
|
*
|
|
|
|
* $Id: include.checkperms.php 128 2019-07-03 11:58:28Z oldperl $:
|
|
|
|
* }}
|
|
|
|
*
|
|
|
|
*/
|
2020-07-24 17:30:36 +00:00
|
|
|
if (!defined('CON_FRAMEWORK')) {
|
|
|
|
die('Illegal call');
|
2019-11-04 16:04:08 +00:00
|
|
|
}
|
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
function cCatPerm($widcat, $db = null) {
|
|
|
|
global $cfg, $sess, $auth, $group_id, $_arrCatIDs_cCP;
|
|
|
|
|
|
|
|
if (strpos($auth->auth['perm'], 'admin') !== FALSE) {
|
|
|
|
return true;
|
|
|
|
}
|
2019-11-04 16:04:08 +00:00
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
if (is_null($db) || !is_object($db)) {
|
|
|
|
$db = new DB_ConLite;
|
|
|
|
}
|
2019-11-04 16:04:08 +00:00
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
$group_ids = getGroupIDs($db);
|
|
|
|
$group_ids[] = Contenido_Security::escapeDB($auth->auth['uid'], $db);
|
2019-11-04 16:04:08 +00:00
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
if (!is_array($_arrCatIDs_cCP)) {
|
|
|
|
$_arrCatIDs_cCP = array();
|
2019-11-04 16:04:08 +00:00
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
$sql_inc = " user_id='";
|
|
|
|
$sql_inc .= implode("' OR user_id='", $group_ids) . "' ";
|
|
|
|
$sql = "SELECT idcat FROM " . $cfg['tab']['rights'] . "
|
2019-11-04 16:04:08 +00:00
|
|
|
WHERE idarea=6 AND idaction=359 AND ($sql_inc)";
|
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
$db->query($sql);
|
|
|
|
|
|
|
|
while ($db->next_record()) {
|
|
|
|
$_arrCatIDs_cCP[$db->f('idcat')] = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return array_key_exists($widcat, $_arrCatIDs_cCP);
|
2019-11-04 16:04:08 +00:00
|
|
|
}
|
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
function getGroupIDs(&$db) {
|
|
|
|
global $cfg, $sess, $auth, $group_id, $_arrGroupIDs_gGI;
|
|
|
|
|
|
|
|
if (is_array($_arrGroupIDs_gGI)) {
|
|
|
|
return $_arrGroupIDs_gGI;
|
|
|
|
}
|
2019-11-04 16:04:08 +00:00
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
$sql = "SELECT group_id FROM " . $cfg["tab"]["groupmembers"] . " WHERE user_id='" . Contenido_Security::escapeDB($auth->auth["uid"], $db) . "'";
|
|
|
|
$db->query($sql);
|
2019-11-04 16:04:08 +00:00
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
$_arrGroupIDs_gGI = array();
|
2019-11-04 16:04:08 +00:00
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
while ($db->next_record())
|
|
|
|
$_arrGroupIDs_gGI[] = $db->f('group_id');
|
2019-11-04 16:04:08 +00:00
|
|
|
|
2020-07-24 17:30:36 +00:00
|
|
|
return $_arrGroupIDs_gGI;
|
2019-11-04 16:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|