![Wink ;-)](./images/smilies/icon_wink.gif)
jedoch noch etwas fehlt...
-> http://www.contenido.org/forum/viewtopi ... 5253#35253
Code: Alles auswählen
//checks if an item have any perms
function have_perm_item($mainarea, $itemid) {
global $cfg, $item_rights, $cfg, $client, $lang, $auth, $area_tree, $sess;
$mainarea = $this->getIDForArea($mainarea);
//if is not admin or sysadmin
if (!$this->have_perm()) {
$db = new DB_Contenido;
$this->showareas($mainarea);
$flg = false;
//check if there are any rights for this areas
foreach ($area_tree[$mainarea] as $value) {
// if the flag noright is set there are no rights in this area
if ($item_rights[$value] == "noright") {
return false;
}
elseif (is_array($item_rights[$value])) {
//if there are any rights
foreach ($item_rights[$value] as $value2) {
if (in_array($itemid, $value2)) {
return true;
}
}
}
elseif ($item_rights[$value] != "noright") {
$groupsForUser = $this->getGroupsForUser($auth->auth[uid]);
$groupsForUser[] = $auth->auth[uid];
//else search for rights for this user in this area
$sql = "SELECT
*
FROM
".$cfg["tab"]["rights"]."
WHERE
user_id IN ('".implode("','", $groupsForUser)."') AND
idclient = '$client' AND
idlang = '$lang' AND
idarea = '$area' AND
idcat != '0'";
$db->query($sql);
//if there are no rights for this area set the flag norights
if ($db->affected_rows() == 0) {
$item_rights[$area] = "noright";
}
//set the rights
while ($db->next_record()) {
if ($db->f("idcat") == $itemid) {
$flg = true;
}
$item_rights[$db->f("idarea")][$db->f("idaction")][$db->f("idcat")] = $db->f("idcat");
}
} //end if
} //end for
return $flg;
} //end if
return true;
}
}
timo hat geschrieben:du glaubst nicht, wie heilfroh ich bin, daß wenigstens du den Durchblick hast
Code: Alles auswählen
function tplDuplicateTemplate($idtpl) {
...
return $new_idtpl;
}
Code: Alles auswählen
cInclude ("includes", "functions.rights.php");
copyRightsForElement("tpl", $idtpl, $new_idtpl);