Exemple #1
0
 /**
  * Sets the default permissions for Objects without an Admin
  *
  * @param int $usergroupId Usergroup Id
  * @return bool TRUE on success or FALSE in case of an error
  */
 function setDefaultPermissions($usergroupId)
 {
     // For Templates
     $templateMgr = new Templates();
     $allTemplates = $templateMgr->getList();
     $permissionList = array();
     foreach ($allTemplates as $allTemplate) {
         $permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'RDELETE' => 1, 'OID' => $allTemplate['ID'], 'USERGROUPID' => $usergroupId);
     }
     $templateMgr->permissions->setPermissions($permissionList);
     // For Views
     $viewMgr = new Views();
     $allViews = $viewMgr->getList();
     $permissionList = array();
     foreach ($allViews as $allView) {
         $permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'RDELETE' => 1, 'OID' => $allView['ID'], 'USERGROUPID' => $usergroupId);
     }
     $viewMgr->permissions->setPermissions($permissionList);
     // For Entrymasks
     $entrymaskMgr = new Entrymasks();
     $allEntrymasks = $entrymaskMgr->getList();
     $permissionList = array();
     foreach ($allEntrymasks as $allEntrymask) {
         $permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'RDELETE' => 1, 'OID' => $allEntrymask['ID'], 'USERGROUPID' => $usergroupId);
     }
     $entrymaskMgr->permissions->setPermissions($permissionList);
     // For Cblock blindfolder
     $embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER");
     $permissionList = array();
     $permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'OID' => $embeddedCblockFolder, 'USERGROUPID' => $usergroupId);
     sCblockMgr()->permissions->setPermissions($permissionList);
     // Remove rights for Cblock root node
     $cblockRootNodeId = sCblockMgr()->tree->getRoot();
     $permissionList = array();
     $permissionList[] = array('RREAD' => 0, 'RSUB' => 0, 'RWRITE' => 0, 'RDELETE' => 0, 'OID' => $cblockRootNodeId, 'USERGROUPID' => $usergroupId);
     sCblockMgr()->permissions->setPermissions($permissionList);
 }
header('Content-type: text/xml');
$tmpUser = new User(sUserMgr()->getCurrentUserID());
$tmpUserInfo = $tmpUser->get();
$adminAllowed = $tmpUser->checkPermission('RENTRYMASKS');
if ($adminAllowed || $this->request->parameters['selectiondialog'] == '1' || $this->request->parameters['action'] == 'insertcontent') {
    $icons = new Icons();
    $selectiondialog = $this->request->parameters['selectiondialog'];
    if ($selectiondialog || $selectiondialog == "1" || $this->request->parameters['action'] == 'insertcontent') {
        $noclick = 'noclick';
    } else {
        $noclick = '';
    }
    // All entrymasks
    $entrymaskMgr = new Entrymasks();
    $entrymasks = $entrymaskMgr->getList();
    $yo = $entrymaskMgr->tree->nest($entrymasks);
    $xml_tree = array();
    $tree_id = 0;
    $tree_level = 0;
    $props = array('TREE_ID' => $tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => 'root_1', 'CAPTION' => $itext['TXT_ENTRYMASKS'] != '' ? $itext['TXT_ENTRYMASKS'] : '$TXT_ENTRYMASKS', 'URL' => $root_link, 'IC' => $this->imgpath . '/window/x.gif', 'EXP' => 'true', 'CHK' => 'false', 'CSTSTYLE' => 'root nodelete', 'TARGET' => '', 'TITLE' => '', 'YG_ID' => $entrymasks[0]['ID'] . '-entrymask', 'YG_TYPE' => 'entrymask', 'YG_PROPERTY' => 'name', 'DND' => 'false', 'XTRA' => $noclick);
    array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level++, 'PROPS' => $props));
    gen_tree($yo[1]['CHILDREN'], $icons->icon, $this->imgpath, $xml_tree, $tree_id, $tree_level, $noclick);
}
function gen_tree($current, $icons, $imgpath, &$xml_tree, &$tree_id, &$tree_level, $noclick)
{
    while (list($key, $value) = each($current)) {
        if ($current[$key]['FOLDER']) {
            $img = $imgpath . 'icons/ico_folder_s.png,' . $imgpath . 'icons/ico_folderopen_s.png';
            $cststyle = '';
            $dnd = 'false';