コード例 #1
0
ファイル: usergroups.php プロジェクト: nrueckmann/yeager
                $backendObject->permissions->setByUsergroup($roleID, 'RWRITE', $embeddedCblockFolder, 1);
                $backendObject->permissions->setByUsergroup($roleID, 'RDELETE', $embeddedCblockFolder, 1);
                $backendObject->permissions->setByUsergroup($roleID, 'RSUB', $embeddedCblockFolder, 1);
                $backendObject->permissions->setByUsergroup($roleID, 'RSTAGE', $embeddedCblockFolder, 1);
                $backendObject->permissions->setByUsergroup($roleID, 'RMODERATE', $embeddedCblockFolder, 1);
                $backendObject->permissions->setByUsergroup($roleID, 'RCOMMENT', $embeddedCblockFolder, 1);
                $backendObject->permissions->setByUsergroup($roleID, 'RSEND', $embeddedCblockFolder, 1);
            }
            if ($objectType == 'pages' || $objectType == 'mailings') {
                sCblockMgr()->permissions->setPermissions($embcbperm, -1);
            }
        }
        if ($objectType == 'pages' && $currentSite) {
            $koala->queueScript('Koala.windows[\'' . $winID . '\'].tabs.params = {site:' . $currentSite . '};');
        }
        $koala->queueScript('Koala.windows[\'' . $winID . '\'].tabs.select(Koala.windows[\'' . $winID . '\'].tabs.selected, Koala.windows[\'' . $winID . '\'].tabs.params);');
        break;
    case 'usergroupsSelectNode':
        $node = $this->params['node'];
        $wid = $this->params['wid'];
        $rootGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTGROUPID");
        $anonGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ANONGROUPID");
        // Check rights
        $rwrite = sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $node, "RDELETE");
        if ($rwrite && $node != $rootGroupId && $node != $anonGroupId) {
            $koala->callJSFunction('Koala.yg_enable', 'tree_btn_delete', 'btn-' . $wid, 'tree_btn');
        } else {
            $koala->callJSFunction('Koala.yg_disable', 'tree_btn_delete', 'btn-' . $wid, 'tree_btn');
        }
        break;
}
コード例 #2
0
ファイル: koala.php プロジェクト: nrueckmann/yeager
 /**
  * Function to get the queued commands from the history
  */
 public function getQueuedCommands()
 {
     $entrymaskMgr = new Entrymasks();
     $jsQueue = new JSQueue(NULL);
     $tagMgr = new Tags();
     $queuedCommands = array();
     $currentQueueId = sGuiLH();
     if (!$currentQueueId || $currentQueueId == 'false') {
         return;
         // if running first time (only)
         //$currentQueueId = $jsQueue->getLastQueueId();
     }
     if ($currentQueueId) {
         $queuedCommandsRaw = $jsQueue->getQueue($currentQueueId, sGuiUS());
         $templateMgr = new Templates();
         $viewMgr = new Views();
         foreach ($queuedCommandsRaw as $queuedCommandRaw) {
             // Check permissions
             $permissionsObj = NULL;
             $objectID = $queuedCommandRaw['OID'];
             $siteID = $queuedCommandRaw['SITEID'];
             $icons = new Icons();
             $url = $imgurl = '';
             switch ($queuedCommandRaw['TYPE']) {
                 case HISTORYTYPE_MAILING:
                     $mailingMgr = new MailingMgr();
                     $mailingObj = $mailingMgr->getMailing($objectID);
                     $permissionsObj = $mailingObj->permissions;
                     break;
                 case HISTORYTYPE_PAGE:
                     if ($siteID > 0 && $objectID > 0) {
                         $pageMgr = new PageMgr($siteID);
                         $pageObj = $pageMgr->getPage($objectID);
                         if ($pageObj) {
                             $url = $pageObj->getUrl();
                             $permissionsObj = $pageObj->permissions;
                         }
                     }
                     break;
                 case HISTORYTYPE_CO:
                     if (!$objectID) {
                         continue;
                     }
                     $cb = sCblockMgr()->getCblock($objectID);
                     $permissionsObj = $cb->permissions;
                     break;
                 case HISTORYTYPE_ENTRYMASK:
                     $permissionsObj = $entrymaskMgr->permissions;
                     break;
                 case HISTORYTYPE_FILE:
                     $permissionsObj = sFileMgr()->permissions;
                     if ($objectID) {
                         $file = sFileMgr()->getFile($objectID);
                         if ($file) {
                             $info = $file->get();
                             $url = sApp()->webroot . "download/" . $info['PNAME'] . "/";
                             $hiddenviews = $file->views->getHiddenViews();
                             foreach ($hiddenviews as $hiddenview) {
                                 if ($hiddenview['IDENTIFIER'] == "YGSOURCE") {
                                     $tmpviewinfo = $file->views->getGeneratedViewInfo($hiddenview['ID']);
                                     if ($tmpviewinfo[0]['TYPE'] == FILE_TYPE_WEBIMAGE) {
                                         $imgurl = sApp()->webroot . "image/" . $info['PNAME'] . "/";
                                     }
                                 }
                             }
                         }
                     }
                     break;
                 case HISTORYTYPE_TEMPLATE:
                     $permissionsObj = $templateMgr->permissions;
                     break;
                 case HISTORYTYPE_TAG:
                     $permissionsObj = $tagMgr->permissions;
                     break;
                 case HISTORYTYPE_SITE:
                     $pageMgr = new PageMgr($siteID);
                     $sitePages = $pageMgr->tree->get(0, 1);
                     $tmpPageID = $sitePages[0]["ID"];
                     if ($tmpPageID) {
                         $pageObj = $pageMgr->getPage($tmpPageID);
                         $permissionsObj = $pageObj->permissions;
                     }
                     break;
                 case HISTORYTYPE_USER:
                     $permissionsObj = sUsergroups()->usergroupPermissions;
                     break;
                 case HISTORYTYPE_USERGROUP:
                 case HISTORYTYPE_EXTERNAL:
                 case HISTORYTYPE_IMAGE:
                 case HISTORYTYPE_FILETYPES:
                 case HISTORYTYPE_FILEVIEWS:
                 case HISTORYTYPE_JSQUEUE:
                 case HISTORYTYPE_PERMISSION:
                 default:
                     break;
             }
             if ($queuedCommandRaw['TEXT'] == 'NOPERMISSIONCHECK' || strpos($queuedCommandRaw['OLDVALUE'], 'HIGHLIGHT') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'UNHIGHLIGHT') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_MOVE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_HIDE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_UNHIDE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_ACTIVATE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'RELOAD_WINDOW') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'CLEAR_USERINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'SET_USERINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'CLEAR_FILEINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'REFRESH_WINDOW') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'ADD_FILE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_DELETE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_ADD_TAG') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGECLASS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGEPNAME') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGEBGIMAGE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGE_LOCK_STATE') === 0) {
                 $allowed = true;
             } else {
                 if ($permissionsObj != NULL) {
                     $allowed = $permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RREAD");
                 }
             }
             if ($permissionsObj != NULL || $allowed) {
                 if ($allowed) {
                     $itext = sItext();
                     switch ($queuedCommandRaw['OLDVALUE']) {
                         case 'UNHIGHLIGHT':
                             if ($queuedCommandRaw['TEXT']) {
                                 //$queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\''.$queuedCommandRaw['TEXT'].'\', \''.$objectID.'-template\', \''.$queuedCommandRaw['TEXT'].'\');';
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\');';
                             }
                             break;
                         case 'OBJECT_CHANGE_LOCK_STATE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_changeWindowLockStateForObject(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\');';
                             }
                             break;
                         case 'OBJECT_CHANGEBGIMAGE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_changeBGImage(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\', \'' . $queuedCommandRaw['VALUE3'] . '\');';
                             }
                             break;
                         case 'OBJECT_CHANGECLASS':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_changeClass(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\', \'' . $queuedCommandRaw['VALUE3'] . '\');';
                             }
                             break;
                         case 'OBJECT_CHANGEPNAME':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_changePName(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\', \'' . $queuedCommandRaw['VALUE3'] . '\', \'' . $url . '\', \'' . $imgurl . '\');';
                             }
                             break;
                         case 'OBJECT_CHANGE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_change(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . addslashes($queuedCommandRaw['VALUE1']) . '\', \'' . addslashes($queuedCommandRaw['VALUE2']) . '\', \'' . addslashes($queuedCommandRaw['VALUE3']) . '\');';
                             }
                             break;
                         case 'OBJECT_ADD_TAG':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addTag(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\', \'' . $queuedCommandRaw['VALUE3'] . '\', \'' . $queuedCommandRaw['VALUE4'] . '\', ' . stripslashes($queuedCommandRaw['VALUE5']) . ', \'' . $queuedCommandRaw['VALUE6'] . '\', \'' . $queuedCommandRaw['VALUE7'] . '\');';
                             }
                             break;
                         case 'OBJECT_DELETE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_del(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\', \'' . $queuedCommandRaw['VALUE3'] . '\', \'' . $queuedCommandRaw['VALUE4'] . '\');';
                             }
                             break;
                         case 'ADD_FILE':
                             $file = new File($objectID);
                             $latestVersion = $file->getLatestApprovedVersion();
                             $file = new File($objectID, $latestVersion);
                             $fileInfo = $file->get();
                             $reftracker = new Reftracker();
                             if ($fileInfo['CREATEDBY']) {
                                 $user = new User($fileInfo['CREATEDBY']);
                                 $userInfo = $user->get();
                                 $userInfo['PROPS'] = $user->properties->getValues($fileInfo['CREATEDBY']);
                             }
                             $fileInfo['CUSTOM_DATE'] = date('d.m.Y', TStoLocalTS($fileInfo['CHANGEDTS']));
                             $fileInfo['CUSTOM_TIME'] = date('G:i', TStoLocalTS($fileInfo['CHANGEDTS']));
                             $fileInfo['REFS'] = $reftracker->getIncomingForFile($fileInfo['OBJECTID']);
                             $tags = $file->tags->getAssigned();
                             for ($t = 0; $t < count($tags); $t++) {
                                 $tp = array();
                                 $tp = $file->tags->tree->getParents($tags[$t]['ID']);
                                 $tp2 = array();
                                 for ($p = 0; $p < count($tp); $p++) {
                                     $tinfo = $file->tags->get($tp[$p]);
                                     $tp2[$p]['ID'] = $tinfo['ID'];
                                     $tp2[$p]['NAME'] = $tinfo['NAME'];
                                 }
                                 $tp2[count($tp2) - 1]['NAME'] = $itext['TXT_TAGS'] != '' ? $itext['TXT_TAGS'] : '$TXT_TAGS';
                                 $tags[$t]['PARENTS'] = $tp2;
                             }
                             $fileInfo['TAGS'] = $tags;
                             $fileInfo['THUMB'] = 1;
                             if ($queuedCommandRaw['TEXT'] == 'nothumb') {
                                 $fileInfo['THUMB'] = 0;
                             }
                             $views = $file->views->getAssigned();
                             foreach ($views as $view) {
                                 if ($view["IDENTIFIER"] == "YGSOURCE") {
                                     $viewinfo = $file->views->getGeneratedViewInfo($view["ID"]);
                                     $fileInfo["WIDTH"] = $viewinfo[0]["WIDTH"];
                                     $fileInfo["HEIGHT"] = $viewinfo[0]["HEIGHT"];
                                 }
                             }
                             $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addFile(\'file\', \'' . $fileInfo['PARENT'] . '-file\', \'' . $objectID . '\', \'' . $fileInfo['THUMB'] . '\', \'' . $fileInfo['COLOR'] . '\', \'' . $fileInfo['CODE'] . '\', \'' . $fileInfo['NAME'] . '\', \'' . $fileInfo['PNAME'] . '\', \'' . json_encode($fileInfo['TAGS']) . '\', \'' . $fileInfo['FILESIZE'] . '\', \'' . count($fileInfo['REFS']) . '\', \'' . TStoLocalTS($fileInfo['CHANGEDTS']) . '\', \'' . $fileInfo['CUSTOM_DATE'] . '\', \'' . $fileInfo['CUSTOM_TIME'] . '\', \'' . $fileInfo['UID'] . '\', \'' . $userInfo['PROPS']['FIRSTNAME'] . ' ' . $userInfo['PROPS']['LASTNAME'] . '\', \'' . $fileInfo['FILENAME'] . '\', \'' . $fileInfo["WIDTH"] . '\', \'' . $fileInfo['HEIGHT'] . '\');';
                             break;
                         case 'REFRESH_TAGS':
                             if ($queuedCommandRaw['TEXT']) {
                                 switch ($queuedCommandRaw['TYPE']) {
                                     case HISTORYTYPE_CO:
                                         $objType = 'cblock';
                                         break;
                                     case HISTORYTYPE_FILE:
                                         $objType = 'file';
                                         break;
                                 }
                             }
                             $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshTags(\'' . $objType . '\', \'' . $objectID . '-' . $objType . '\', \'tags\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             break;
                         case 'REFRESH_WINDOW':
                             if ($queuedCommandRaw['TEXT']) {
                                 switch ($queuedCommandRaw['TYPE']) {
                                     case HISTORYTYPE_CO:
                                         $objType = 'cblock';
                                         break;
                                     case HISTORYTYPE_PAGE:
                                         $objType = 'page';
                                         break;
                                     case HISTORYTYPE_FILE:
                                         $objType = 'file';
                                         break;
                                     case HISTORYTYPE_TAG:
                                         $objType = 'tag';
                                         break;
                                     case HISTORYTYPE_TEMPLATE:
                                         $objType = 'template';
                                         break;
                                     case HISTORYTYPE_ENTRYMASK:
                                         $objType = 'entrymask';
                                         break;
                                     case HISTORYTYPE_SITE:
                                         $objType = 'site';
                                         break;
                                 }
                                 // Special cases
                                 switch ($queuedCommandRaw['TYPE']) {
                                     case HISTORYTYPE_PAGE:
                                         $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshWin(\'' . $objType . '\',\'' . $objectID . '-' . $siteID . '\',\'' . $queuedCommandRaw['TEXT'] . '\');';
                                         break;
                                     case HISTORYTYPE_FILE:
                                         $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshWin(\'' . $objType . '\',\'' . $objectID . '-' . $objType . '\',\'' . $queuedCommandRaw['TEXT'] . '\');';
                                         $queuedCommands[$queuedCommandRaw['ID']] .= 'Koala.yg_refreshWin(\'' . $objType . 'folder\',\'' . $objectID . '-' . $objType . '\',\'' . $queuedCommandRaw['TEXT'] . '\');';
                                         break;
                                     default:
                                         $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshWin(\'' . $objType . '\',\'' . $objectID . '-' . $objType . '\',\'' . $queuedCommandRaw['TEXT'] . '\');';
                                         break;
                                 }
                             }
                             break;
                         case 'CLEAR_FILEINFOS':
                             $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_fileInfos[' . $objectID . '] = null;';
                             break;
                         case 'SET_FILEINFOS':
                             $file = sFileMgr()->getFile($objectID);
                             if ($file) {
                                 $latestFinalVersion = $file->getLatestApprovedVersion();
                                 $file = new File($objectID, $latestFinalVersion);
                                 $fileInfo = $file->get();
                                 $fileTypes = sFileMgr()->getFiletypes();
                                 $user = new User(sUserMgr()->getCurrentUserID());
                                 $fileInfo['DATE'] = date($itext['DATE_FORMAT'], TStoLocalTS($fileInfo['CHANGEDTS']));
                                 $fileInfo['TIME'] = date($itext['TIME_FORMAT'], TStoLocalTS($fileInfo['CHANGEDTS']));
                                 $fileInfo['FILESIZE'] = formatFileSize($fileInfo['FILESIZE']);
                                 $views = $file->views->getAssigned(true);
                                 $viewInfo = $file->views->getGeneratedViewInfo($views[0]["ID"]);
                                 $fileInfo['WIDTH'] = $viewInfo[0]["WIDTH"];
                                 $fileInfo['HEIGHT'] = $viewInfo[0]["HEIGHT"];
                                 $fileInfo['TAGS'] = $file->tags->getAssigned();
                                 $tags = array();
                                 foreach ($fileInfo['TAGS'] as $tag) {
                                     array_push($tags, $tag['NAME']);
                                 }
                                 $fileTags = implode(', ', $tags);
                                 if (strlen($fileTags) > 40) {
                                     $fileTags = substr($fileTags, 0, 40);
                                     $fileTags .= '...';
                                 }
                                 $fileInfo['TAGS'] = $fileTags;
                                 if (strlen($fileInfo['NAME']) > 40) {
                                     $fileInfo['NAME'] = substr($fileInfo['NAME'], 0, 40);
                                     $fileInfo['NAME'] .= '...';
                                 }
                                 if (strlen($fileInfo['FILENAME']) > 40) {
                                     $fileInfo['FILENAME'] = substr($fileInfo['FILENAME'], 0, 40);
                                     $fileInfo['FILENAME'] .= '...';
                                 }
                                 if ($fileInfo['CREATEDBY']) {
                                     $user = new User($fileInfo['CREATEDBY']);
                                     $userInfo = $user->get();
                                     $userInfo['PROPS'] = $user->properties->getValues($fileInfo['CREATEDBY']);
                                     $fileInfo['USERNAME'] = $userInfo['PROPS']['FIRSTNAME'] . ' ' . $userInfo['PROPS']['LASTNAME'];
                                 }
                                 foreach ($fileTypes as $fileTypes_item) {
                                     if ($fileTypes_item['ID'] == $fileInfo['FILETYPE']) {
                                         $fileInfo['FILETYPE_TXT'] = $fileTypes_item['NAME'];
                                     }
                                 }
                                 $fileInfo['THUMB'] = 0;
                                 $hiddenViews = $file->views->getHiddenViews();
                                 foreach ($hiddenViews as $view) {
                                     if ($view['IDENTIFIER'] == 'yg-preview') {
                                         $tmpviewinfo = $file->views->getGeneratedViewInfo($view["ID"]);
                                         if ($tmpviewinfo[0]["TYPE"] == FILE_TYPE_WEBIMAGE) {
                                             $fileInfo['THUMB'] = 1;
                                             $fileInfo['PREVIEWWIDTH'] = $tmpviewinfo[0]["WIDTH"];
                                             $fileInfo['PREVIEWHEIGHT'] = $tmpviewinfo[0]["HEIGHT"];
                                         }
                                     }
                                 }
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_fileInfos[' . $objectID . '] = ' . json_encode($fileInfo) . ';Koala.yg_showFileHint(\'' . $objectID . '\');';
                             }
                             break;
                         case 'SET_USERINFOS':
                             $user = new User($objectID);
                             $userInfo = $user->get();
                             $userInfo['PROPS'] = $user->properties->getValues($objectID);
                             $userInfo['USERGROUPS'] = $user->getUsergroups($objectID);
                             $roles = array();
                             foreach ($userInfo['USERGROUPS'] as $role) {
                                 array_push($roles, $role['NAME']);
                             }
                             $user_roles = implode(', ', $roles);
                             if (strlen($user_roles) > 30) {
                                 $user_roles = substr($user_roles, 0, 30);
                                 $user_roles .= '...';
                             }
                             if (file_exists(sApp()->app_root . sApp()->userpicdir . $objectID . '-picture.jpg')) {
                                 $internPrefix = (string) sConfig()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX');
                                 $user_picture = $internPrefix . 'userimage/' . $objectID . '/48x48?rnd=' . rand();
                             } else {
                                 $user_picture = sApp()->imgpath . 'content/temp_userpic.png';
                             }
                             $user_company = $userInfo['PROPS']['COMPANY'];
                             $user_name = $userInfo['PROPS']['FIRSTNAME'] . ' ' . $userInfo['PROPS']['LASTNAME'];
                             $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_userInfos[' . $objectID . '] = {name: \'' . $user_name . '\', groups: \'' . $user_roles . '\', pic: \'' . $user_picture . '\', company: \'' . $user_company . '\'}';
                             break;
                         case 'CLEAR_USERINFOS':
                             $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_userInfos[' . $objectID . '] = null;';
                             break;
                         case 'CLEAR_REFRESH':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_clearRefresh(\'' . $objectID . '-' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'RELOAD_WINDOW':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_reloadWin(null, \'' . $objectID . '-' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'PAGE_DEACTIVATE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_deActivate(\'page\', \'' . $objectID . '-' . $siteID . '\', \'name\');';
                             }
                             break;
                         case 'PAGE_ACTIVATE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_activate(\'page\', \'' . $objectID . '-' . $siteID . '\', \'name\');';
                             }
                             break;
                         case 'PAGE_UNHIDE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHide(\'page\', \'' . $objectID . '-' . $siteID . '\', \'name\');';
                             }
                             break;
                         case 'PAGE_HIDE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_hide(\'page\', \'' . $objectID . '-' . $siteID . '\', \'name\');';
                             }
                             break;
                         case 'FILE_DELVIEW':
                             if ($queuedCommandRaw['TEXT']) {
                                 $file = sFileMgr()->getFile($objectID);
                                 $fileInfo = $file->get();
                                 if ($fileInfo['FOLDER'] == 1) {
                                     $isFolder = 'true';
                                 } else {
                                     $isFolder = 'false';
                                 }
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'if (Koala.yg_delViewArr[' . $queuedCommandRaw['TEXT'] . ']) Koala.yg_delViewArr[' . $queuedCommandRaw['TEXT'] . '](' . $objectID . ', ' . $isFolder . ');';
                             }
                             break;
                         case 'FILE_CLEAR_DELVIEW':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'if (Koala.yg_delViewArr[' . $queuedCommandRaw['TEXT'] . ']) Koala.yg_delViewArr[' . $queuedCommandRaw['TEXT'] . ']=undefined;';
                             }
                             break;
                         case 'FILE_ADDVIEW':
                             if ($queuedCommandRaw['TEXT']) {
                                 $file = sFileMgr()->getFile($objectID);
                                 $fileInfo = $file->get();
                                 $viewInfo = $viewMgr->get($queuedCommandRaw['TEXT']);
                                 if ($fileInfo['FOLDER'] == 1) {
                                     $isFolder = 'true';
                                 } else {
                                     $isFolder = 'false';
                                 }
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addView(\'' . $objectID . '\', \'' . $viewInfo['ID'] . '\', \'' . $viewInfo['IDENTIFIER'] . '\', \'' . $viewInfo['NAME'] . '\', \'' . $viewInfo['WIDTH'] . '\', \'' . $viewInfo['HEIGHT'] . '\', \'' . $isFolder . '\');';
                             }
                             break;
                         case 'FILE_GENERATEDVIEW':
                             if ($queuedCommandRaw['TEXT']) {
                                 $file = sFileMgr()->getFile($objectID);
                                 $viewInfo = $viewMgr->get($queuedCommandRaw['TEXT']);
                                 $generatedViewInfo = $file->views->getGeneratedViewInfo($viewInfo['ID']);
                                 if ($generatedViewInfo[0]['TYPE'] == FILE_TYPE_WEBIMAGE) {
                                     $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addGenerated(\'' . $objectID . '\',\'' . $viewInfo['IDENTIFIER'] . '\', \'' . $viewInfo['WIDTH'] . '\', \'' . $viewInfo['HEIGHT'] . '\');';
                                 } else {
                                     if ($generatedViewInfo[0]) {
                                         $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addGenerated(\'' . $objectID . '\',\'NULL\');';
                                     }
                                 }
                             }
                             break;
                         case 'UNHIGHLIGHT_TEMPLATE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'template\', \'' . $objectID . '-template\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'HIGHLIGHT_PAGE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_hilite(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'UNHIGHLIGHT_PAGE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'HIGHLIGHT_CBLOCK':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_hilite(\'cblock\', \'' . $objectID . '-cblock\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'UNHIGHLIGHT_CBLOCK':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'cblock\', \'' . $objectID . '-cblock\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'UNHIGHLIGHT_ENTRYMASK':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'entrymask\', \'' . $objectID . '-entrymask\', \'' . $queuedCommandRaw['TEXT'] . '\');' . 'Koala.yg_unHilite(\'page\', \'' . $objectID . '-entrymask\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'UNHIGHLIGHT_SITE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'page\', \'' . $objectID . '-site\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'HIGHLIGHT_SITE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_hilite(\'page\', \'' . $objectID . '-site\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'HIGHLIGHT_MAILING':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_hilite(\'mailing\', \'' . $objectID . '-mailing' . '\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'UNHIGHLIGHT_MAILING':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'mailing\', \'' . $objectID . '-mailing' . '\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'PAGE_MOVE':
                             if ($queuedCommandRaw['TEXT']) {
                                 if ($queuedCommandRaw['TARGETID'] == 1) {
                                     $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveTreeNode(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\', 2);';
                                 } else {
                                     $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveTreeNode(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\', 1);';
                                 }
                             }
                             break;
                         case 'PAGE_MOVEUP':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveUp(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'PAGE_MOVEDOWN':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveDown(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             break;
                         case 'CBLOCK_MOVE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveTreeNode(\'cblock\', \'' . $objectID . '-cblock\', \'' . $queuedCommandRaw['TEXT'] . '-cblock\', 1);';
                             }
                             break;
                         case 'FILE_MOVE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveTreeNode(\'file\', \'' . $objectID . '-file\', \'' . $queuedCommandRaw['TEXT'] . '-file\', 1);';
                             }
                             break;
                         case 'TAG_MOVE':
                             if ($queuedCommandRaw['TEXT']) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveTreeNode(\'tag\', \'' . $objectID . '-tag\', \'' . $queuedCommandRaw['TEXT'] . '-tag\', 1);';
                             }
                             break;
                         case 'TAG_ADD':
                             $objectInfo = $tagMgr->get($objectID);
                             $icon = $icons->icon['tag_small'];
                             $statusClass = '';
                             if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE")) {
                                 // Nur Leserecht (hellgrau)
                                 $statusClass .= " nowrite";
                             }
                             if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RDELETE")) {
                                 // Nur Leserecht (hellgrau)
                                 $statusClass .= " nodelete";
                             }
                             if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RSUB")) {
                                 $statusClass .= " nosub";
                             }
                             $objectName = $objectInfo['NAME'];
                             $objectParents = $tagMgr->getParents($objectID);
                             $parentNodeId = $objectParents[0][0]["ID"];
                             if ($queuedCommandRaw['NEWVALUE'] == sGuiUS()) {
                                 $andSelect = 'true';
                             } else {
                                 $andSelect = 'false';
                             }
                             $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addChild(\'tag\', \'' . $parentNodeId . '-tag\', \'name\', \'' . $objectName . '\', \'tag\', \'' . $objectID . '-tag\', \'name\', \'' . $icon . '\', \'' . $statusClass . '\', ' . $andSelect . ');';
                             break;
                         case 'FILE_ADD':
                         case 'FILEFOLDER_ADD':
                             $file = sFileMgr()->getFile($objectID);
                             if ($file) {
                                 $objectInfo = $file->get();
                                 $icon = $icons->icon['folder'];
                                 $statusClass = '';
                                 if ($objectInfo["VERSIONPUBLISHED"] + 2 != $objectInfo["VERSION"] && $objectInfo["VERSIONPUBLISHED"] != ALWAYS_LATEST_APPROVED_VERSION && $objectInfo["HASCHANGED"] == "1") {
                                     // Editiert (grün)
                                     $statusClass = "changed";
                                 } elseif ($objectInfo["HASCHANGED"] == "1") {
                                     $statusClass = "changed";
                                 }
                                 if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE")) {
                                     // Nur Leserecht (hellgrau)
                                     $statusClass .= " nowrite";
                                 }
                                 if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RDELETE")) {
                                     // Nur Leserecht (hellgrau)
                                     $statusClass .= " nodelete";
                                 }
                                 if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RSUB")) {
                                     $statusClass .= " nosub";
                                 }
                                 $objectName = $objectInfo['NAME'];
                                 $objectParents = sFileMgr()->getParents($objectID);
                                 $parentNodeId = $objectParents[0][0]["ID"];
                                 if ($queuedCommandRaw['NEWVALUE'] == sGuiUS()) {
                                     $andSelect = 'true';
                                 } else {
                                     $andSelect = 'false';
                                 }
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addChild(\'file\', \'' . $parentNodeId . '-file\', \'name\', \'' . $objectName . '\', \'file\', \'' . $objectID . '-file\', \'name\', \'' . $icon . '\', \'' . $statusClass . '\', ' . $andSelect . ');';
                             }
                             break;
                         case 'CBLOCK_ADD':
                             $cb = sCblockMgr()->getCblock($objectID);
                             $objectInfo = $cb->get();
                             $icon = $icons->icon['cblock_small'];
                             $statusClass = '';
                             if ($objectInfo['FOLDER'] != 1) {
                                 if ($objectInfo["VERSIONPUBLISHED"] + 2 != $objectInfo["VERSION"] && $objectInfo["VERSIONPUBLISHED"] != ALWAYS_LATEST_APPROVED_VERSION && $objectInfo["HASCHANGED"] == "1") {
                                     // Editiert (grün)
                                     $statusClass .= "changed changed1 nosub";
                                 } elseif ($objectInfo["HASCHANGED"] == "1") {
                                     $statusClass .= "changed changed2 nosub";
                                 }
                             } else {
                                 if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RSUB")) {
                                     $statusClass .= " nosub";
                                 }
                                 $icon = $icons->icon['folder'];
                                 $statusClass .= " folder";
                             }
                             if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE")) {
                                 // Nur Leserecht (hellgrau)
                                 $statusClass .= " nowrite";
                             }
                             if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RDELETE")) {
                                 // Nur Leserecht (hellgrau)
                                 $statusClass .= " nodelete";
                             }
                             $objectName = $objectInfo['NAME'];
                             $objectParents = sCblockMgr()->getParents($objectID);
                             $parentNodeId = $objectParents[0][0]["ID"];
                             if ($queuedCommandRaw['NEWVALUE'] == sGuiUS() && $queuedCommandRaw['TEXT'] != 'list') {
                                 $andSelect = 'true';
                             } else {
                                 $andSelect = 'false';
                             }
                             if ($queuedCommandRaw['NEWVALUE'] == sGuiUS()) {
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addListItem(\'' . $parentNodeId . '-cblock\', \'' . addslashes(json_encode($objectInfo)) . '\', \'' . $queuedCommandRaw['TEXT'] . '\');';
                             }
                             $queuedCommands[$queuedCommandRaw['ID']] .= 'Koala.yg_addChild(\'cblock\', \'' . $parentNodeId . '-cblock\', \'name\', \'' . $objectName . '\', \'cblock\', \'' . $objectID . '-cblock\', \'name\', \'' . $icon . '\', \'' . $statusClass . '\', ' . $andSelect . ');';
                             break;
                         case 'PAGE_ADD':
                             if ($pageObj) {
                                 $objectInfo = $pageObj->get();
                                 $icon = $icons->icon['page_small'];
                                 $statusClass = '';
                                 $inactive = false;
                                 if ($objectInfo["ACTIVE"] == "0") {
                                     $icon = $icons->icon['page_inactive_small'];
                                     $inactive = true;
                                 }
                                 $naviinfo = NULL;
                                 $navis = $templateMgr->getNavis($objectInfo["TEMPLATEID"]);
                                 for ($i = 0; $i < count($navis); $i++) {
                                     if ($navis[$i]["ID"] == $objectInfo["NAVIGATIONID"]) {
                                         $naviinfo = $navis[$i];
                                     }
                                 }
                                 if ($objectInfo["HIDDEN"] == "1" || $objectInfo["TEMPLATEID"] == "0" || !$naviinfo['ID']) {
                                     $icon = $icons->icon['page_hidden_small'];
                                     if ($inactive == true) {
                                         $icon = $icons->icon['page_inactive_hidden_small'];
                                     }
                                 }
                                 if ($objectInfo["VERSIONPUBLISHED"] + 2 != $objectInfo["VERSION"] && $objectInfo["VERSIONPUBLISHED"] != ALWAYS_LATEST_APPROVED_VERSION && $objectInfo["HASCHANGED"] == "1") {
                                     // Editiert (grün)
                                     $statusClass = "changed";
                                 } elseif ($objectInfo["HASCHANGED"] == "1") {
                                     $statusClass = "changed";
                                 }
                                 if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE")) {
                                     // Nur Leserecht (hellgrau)
                                     $statusClass .= " nowrite";
                                 }
                                 if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RDELETE")) {
                                     // Nur Leserecht (hellgrau)
                                     $statusClass .= " nodelete";
                                 }
                                 if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RSUB")) {
                                     $statusClass .= " nosub";
                                 }
                                 $objectName = $objectInfo['NAME'];
                                 $objectParents = $pageMgr->getParents($objectID);
                                 $parentNodeId = $objectParents[0][0]["ID"];
                                 if (!$parentNodeId) {
                                     $parentNodeId = 1;
                                 }
                                 $url = $pageObj->getUrl();
                                 if ($queuedCommandRaw['NEWVALUE'] == sGuiUS()) {
                                     $andSelect = 'true';
                                 } else {
                                     $andSelect = 'false';
                                 }
                                 $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addChild(\'page\', \'' . $parentNodeId . '-' . $siteID . '\', \'name\', \'' . $objectName . '\', \'page\', \'' . $objectID . '-' . $siteID . '\', \'name\', \'' . $icon . '\', \'' . $statusClass . '\', ' . $andSelect . ',  \'' . $url . '\');' . "\n";
                             }
                             break;
                         case 'MAILING_ADD':
                             $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshMailingsWindow();' . "\n";
                             break;
                         case 'MAILING_DELETE':
                             $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshMailingsWindow(true);' . "\n";
                             break;
                         default:
                             $queuedCommands[$queuedCommandRaw['ID']] = stripslashes($queuedCommandRaw['OLDVALUE']) . "\n";
                             break;
                     }
                 }
             }
         }
         if (count($queuedCommandsRaw)) {
             $currentQueueId = $queuedCommandsRaw[count($queuedCommandsRaw) - 1]['ID'];
         }
     }
     $output = "\n<script>\n";
     $output .= "parent.Koala.currentGuiSyncHistoryId = " . $currentQueueId . ";\n";
     $output .= "parent.Koala.yg_executeGuiJSQueue( " . json_encode($queuedCommands) . " );\n";
     $output .= "</script>\n";
     print $output;
 }
コード例 #3
0
ファイル: users.php プロジェクト: nrueckmann/yeager
     $koala->callJSFunction('Koala.yg_addRoleItem', $wid, $newRoleId, $itext['TXT_NEW_OBJECT'] ? $itext['TXT_NEW_OBJECT'] : '$TXT_NEW_OBJECT');
     break;
 case 'deleteRole':
     $roleID = $this->params['roleID'];
     $wid = $this->params['wid'];
     $confirmed = $this->params['confirmed'];
     $positive = $this->params['positive'];
     if ($confirmed != 'true') {
         $parameters = array('roleID' => $roleID, 'wid' => $wid);
         $koala->callJSFunction('Koala.yg_confirm', $itext['TXT_USERGROUP_DELETE'] != '' ? $itext['TXT_USERGROUP_DELETE'] : '$TXT_USERGROUP_DELETE', $itext['TXT_USERGROUP_DELETE_TEXT'] != '' ? $itext['TXT_USERGROUP_DELETE_TEXT'] : '$TXT_USERGROUP_DELETE_TEXT', $action, json_encode($parameters));
     } else {
         if ($confirmed == 'true' && $positive == 'true') {
             // Remove all assignments to this role in mailings
             $mailingMgr = new MailingMgr();
             $mailingMgr->removeUsergroupFromMailings($roleID);
             sUsergroups()->remove($roleID);
             $koala->queueScript('$(Koala.windows[\'' . $wid . '\'].boundWindow).addClassName(\'boxghost\')');
             $koala->queueScript('Koala.windows[Koala.windows[\'' . $wid . '\'].boundWindow].init();');
             $jsQueue->add($roleID, HISTORYTYPE_USERGROUP, 'OBJECT_DELETE', sGuiUS(), 'usergroup', NULL, NULL, $roleID . '-usergroup', 'item');
         }
     }
     break;
 case 'setNewPassword':
     $userPassword = $this->params['userPassword'];
     $userToken = $this->params['userToken'];
     $winID = $this->params['winID'];
     if ($userID = sUserMgr()->getUserIdByToken($userToken)) {
         $user = new User($userID);
         $userinfo = $user->get();
         if ($userinfo) {
             // Check if password is secure enough
コード例 #4
0
ファイル: common.php プロジェクト: nrueckmann/yeager
         $result = checkLinkInternalExternal($value);
         if ($result['TYPE'] != 'external') {
             $value = createSpecialURLfromShortURL($value);
         }
     }
     // Special handling for textareas
     if ($propertyInfo[0]['TYPE'] == 'TEXTAREA') {
         $value = str_replace('\\n', "\n", $value);
     }
     // Special handling for wysiwyg
     if ($propertyInfo[0]['TYPE'] == 'RICHTEXT') {
         $value = str_replace('\\n', "\n", $value);
         $value = convertShortURLsToSpecialURLs($value);
     }
     // Set the new property
     if (sUsergroups()->setName($data[0], $value) === false) {
         $koala->alert($itext['TXT_ERROR_ACCESS_DENIED']);
     } else {
         $value = str_replace("\n", '\\n', $value);
         $jsQueue->add($data[0], HISTORYTYPE_USERGROUP, 'OBJECT_CHANGE', sGuiUS(), 'usergroup', NULL, NULL, $this->reponsedata[$property]->yg_id, $property, $value);
         $jsQueue->add($data[0], HISTORYTYPE_USERGROUP, 'OBJECT_CHANGE', sGuiUS(), 'page', NULL, NULL, $this->reponsedata[$property]->yg_id, $property, $value);
         $jsQueue->add($data[0], HISTORYTYPE_USERGROUP, 'Koala.yg_resortRolesList(\'' . $winID . '\');', sGuiUS());
     }
     break;
 case 'cblock':
     $cb = sCblockMgr()->getCblock($data[0]);
     // Get the versioned contentblockid
     $cblockInfo = $cb->get();
     // Get old property value & check if change is needed
     $oldvalue = $cb->properties->getValueInternal(strtoupper($property));
     $value = str_replace("\r", '', str_replace("\n", '\\n', $this->reponsedata[$property]->value));
コード例 #5
0
ファイル: user_list.php プロジェクト: nrueckmann/yeager
    // All Users
    $users = sUserMgr()->getList($pageDirOrderBy, $pageDirOrderDir, $pageDirLimit, $newSearchText);
}
foreach ($users as $users_idx => $users_item) {
    $user = new User($users_item['ID']);
    $props = $user->properties->getValues($users_item['ID']);
    $users[$users_idx]['PROPS'] = $props;
    if (file_exists($this->approot . $this->userpicdir . $users_item['ID'] . '-picture.jpg')) {
        $internPrefix = (string) sConfig()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX');
        $users[$users_idx]['USERPICTURE'] = $internPrefix . 'userimage/' . $users_item['ID'] . '/48x48?rnd=' . rand();
    } else {
        $users[$users_idx]['USERPICTURE'] = $this->imgpath . 'content/temp_userpic.png';
    }
}
// Check rights
$rusers = sUsergroups()->permissions->check(sUserMgr()->getCurrentUserID(), "RUSERS");
$smarty->assign('rootUserId', $rootUserId);
$smarty->assign('anonUserId', $anonUserId);
$smarty->assign('newRole', $newRole);
$smarty->assign('rusers', $rusers);
$smarty->assign('roles', $roles);
$smarty->assign('userlist', $users);
$smarty->assign('usercount', $userCount);
$smarty->assign('usercountfiltered', $userCountFiltered);
$smarty->assign('site', $site);
$smarty->assign('refresh', $refresh);
$smarty->assign('initload', $initload);
$smarty->assign('chooser', $chooser);
$smarty->assign('displaymode', $displaymode);
$smarty->assign('win_no', $this->request->parameters['win_no']);
$smarty->display('file:' . $this->page_template);
コード例 #6
0
ファイル: permissions.php プロジェクト: nrueckmann/yeager
 /**
  * Clears Permissions of the current specific Object
  *
  * @param int $objectId (optional) Object Id
  * @throws Exception
  */
 public function clear($objectId = NULL)
 {
     if ($objectId == NULL) {
         $objectId = $this->_object->getID();
     }
     // oid is optional
     $sql = "DELETE FROM " . $this->_table . " WHERE OID = ?;";
     $result = sYDB()->Execute($sql, $objectId);
     if ($result === false) {
         throw new Exception(sYDB()->ErrorMsg());
     }
     sUsergroups()->emptyUsergroupHash($this->_table);
 }
コード例 #7
0
ファイル: usergroup_list.php プロジェクト: nrueckmann/yeager
        $lockedByUser['PROPS'] = $userWithLock->properties->getValues($mailingStatus['UID']);
        $smarty->assign('lockedByUser', $lockedByUser);
        $object_permissions['RWRITE'] = false;
    }
    $object_permissions['READONLY'] = !$object_permissions['RWRITE'];
} else {
    $object_permissions = array();
    $object_permissions["RWRITE"] = sUsergroups()->permissions->check(sUserMgr()->getCurrentUserID(), 'RUSERS');
    if (sUserMgr()->getAnonymousID() == (int) $userID) {
        $object_permissions['RWRITE'] = 0;
        $object_permissions['READONLY'] = 1;
    }
}
$smarty->assign("object_permissions", $object_permissions);
// Check rights
$rroles = sUsergroups()->permissions->check(sUserMgr()->getCurrentUserID(), 1, 'RUSERGROUPS');
$empty_item = array('ID' => '#<<new_id>>', 'NAME' => '#<<new_name>>', 'SHOW_DELETE' => true);
$smarty->assign("mode", $mode);
$smarty->assign("rootGroupId", $rootGroupId);
$smarty->assign("anonGroupId", $anonGroupId);
$smarty->assign("rroles", $rroles);
$smarty->assign("objecttype", $objecttype);
$smarty->assign("yg_id", $this->request->parameters['yg_id']);
$smarty->assign("empty_item", $empty_item);
$smarty->assign("usergroups", $usergroups);
if ($this->request->parameters['action'] == 'addrole') {
    $smarty->assign('selectiondialog', true);
}
$smarty->assign("win_no", $this->request->parameters['win_no']);
$smarty->assign("action", $this->request->parameters['action']);
$smarty->assign("opener_reference", $this->request->parameters['opener_reference']);
コード例 #8
0
ファイル: extensions.php プロジェクト: nrueckmann/yeager
 /**
  * Uninstalls this Extension
  *
  * @return bool TRUE on success or FALSE in case of an error
  */
 public function uninstall()
 {
     $hasRights = false;
     switch ($this->info['TYPE']) {
         case EXTENSION_PAGE:
             if (sUsergroups()->permissions->check($this->_uid, 'REXTENSIONS_PAGE')) {
                 $hasRights = true;
             }
             break;
         case EXTENSION_MAILING:
             if (sUsergroups()->permissions->check($this->_uid, 'REXTENSIONS_MAILING')) {
                 $hasRights = true;
             }
             break;
         case EXTENSION_FILE:
             if (sUsergroups()->permissions->check($this->_uid, 'REXTENSIONS_FILE')) {
                 $hasRights = true;
             }
             break;
         case EXTENSION_CBLOCK:
             if (sUsergroups()->permissions->check($this->_uid, 'REXTENSIONS_CBLOCK')) {
                 $hasRights = true;
             }
             break;
         case EXTENSION_CBLOCKLISTVIEW:
             if (sUsergroups()->permissions->check($this->_uid, 'REXTENSIONS_CBLISTVIEW')) {
                 $hasRights = true;
             }
             break;
         case EXTENSION_IMPORT:
             if (sUsergroups()->permissions->check($this->_uid, 'RIMPORT')) {
                 $hasRights = true;
             }
             break;
         case EXTENSION_EXPORT:
             if (sUsergroups()->permissions->check($this->_uid, 'REXPORT')) {
                 $hasRights = true;
             }
             break;
     }
     if ($hasRights) {
         sUsergroups()->permissions->removeAllExtensionPrivileges($this->_code);
         if ($this->uninstallPropertyTables("yg_ext_" . $this->_code)) {
             return $this->setUnInstalled();
         }
     }
     return false;
 }
コード例 #9
0
ファイル: properties.php プロジェクト: nrueckmann/yeager
         $smarty->assign('company', $company);
         $smarty->assign('department', $department);
         $smarty->assign('firstname', $firstname);
         $smarty->assign('lastname', $lastname);
         $smarty->assign('phone', $phone);
         $smarty->assign('fax', $fax);
         $smarty->assign('mobile', $mobile);
         $smarty->assign('website', $website);
         $smarty->assign('password', $password);
     }
     break;
 case 'usergroup':
     $no_traceline = true;
     $autosave = true;
     $object_permissions['RWRITE'] = sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $object, 'RWRITE');
     $objectInfo = sUsergroups()->get($object);
     $objectdynprops = array(0 => array(0 => 'Name', 'NAME' => 'Name', 1 => 1, 'ID' => 1, 2 => 'NAME', 'IDENTIFIER' => 'NAME', 3 => 1, 'VISIBLE' => 1, 4 => 'TEXT', 'TYPE' => 'TEXT', 5 => $objectInfo['NAME'], 'VALUE' => $objectInfo['NAME']));
     break;
 case 'extension':
     $extensionMgr = new ExtensionMgr();
     $autosave = false;
     $objectInfo = $extensionMgr->get($object);
     if ($objectInfo["CODE"]) {
         $extension = $extensionMgr->getExtension($objectInfo["CODE"]);
         if ($extension && $objectInfo["INSTALLED"]) {
             switch ($siteID) {
                 case 'extpage':
                     if ($siteID == 'extpage') {
                         $object_permissions['RWRITE'] = $user->checkPermission("REXTENSIONS_PAGE");
                     }
                 case 'extcblock':
コード例 #10
0
ファイル: usermgr.php プロジェクト: nrueckmann/yeager
 /**
  * Searches for a single User by email address
  *
  * @param string $email Email to search for
  * @param bool $exact TRUE if an exact search should be performed
  * @return array|false Array containing User information or FALSE in case of an error
  */
 function getByEmail($email, $exact = false)
 {
     if (sUsergroups()->permissions->check($this->_uid, 'RUSERS')) {
         $email = sYDB()->escape_string(sanitize($email));
         if ($exact !== true) {
             $email = "%" . $email . "%";
         }
         if (strlen($email) > 0) {
             $sql = "SELECT u.LOGIN AS LOGIN,\n\t\t\t\tu.PASSWORD AS PASSWORD,\n\t\t\t\tu.ID AS ID\n\t\t\t\tFROM\n\t\t\t\tyg_user as u\n\t\t\t\tLEFT JOIN yg_user_propsv ON u.ID = yg_user_propsv.OID\n\t\t\t\tWHERE\n\t\t\t\t(yg_user_propsv.EMAIL LIKE ?);";
             $result = sYDB()->Execute($sql, $email);
             if ($result === false) {
                 throw new Exception(sYDB()->ErrorMsg());
             }
             $resultarray = $result->GetArray();
         }
         return $resultarray[0];
     } else {
         return false;
     }
 }
コード例 #11
0
ファイル: entrymasks.php プロジェクト: nrueckmann/yeager
 /**
  * Sets the order of list values of a Formfield
  *
  * @param array $orderArray Array of list Ids
  * @return bool TRUE on success or FALSE in case of an error
  * @throws Exception
  */
 function setListOrder($orderArray)
 {
     if (sUsergroups()->permissions->check($this->_uid, 'RENTRYMASKS')) {
         $order = 0;
         foreach ($orderArray as $order_array_item) {
             $order_array_item = (int) $order_array_item;
             $sql = "UPDATE `yg_entrymasks_lnk_formfields_lv` SET `LISTORDER` = ? WHERE ID = ?;";
             $result = sYDB()->Execute($sql, $order, $order_array_item);
             if ($result === false) {
                 throw new Exception(sYDB()->ErrorMsg());
             }
             $order++;
         }
         return true;
     } else {
         return false;
     }
 }
コード例 #12
0
ファイル: sites.php プロジェクト: nrueckmann/yeager
 /**
  * Sets the favicon of the specified Site
  *
  * @param int $siteId Site Id
  * @param int $fileId File Id
  * @return bool TRUE on success or FALSE in case of an error
  */
 public function setFavicon($siteId, $fileId)
 {
     if (sUsergroups()->permissions->check($this->_uid, 'RSITES')) {
         $siteId = (int) $siteId;
         $fileId = (int) $fileId;
         $sql = "UPDATE yg_site SET FAVICON = ? WHERE ID = ?;";
         $result = $this->_db->execute($sql, $fileId, $siteId);
         if ($result === false) {
             return false;
         }
         return true;
     } else {
         return false;
     }
 }
コード例 #13
0
ファイル: cblock.php プロジェクト: nrueckmann/yeager
 /**
  * Sets the permission of an embedded Entrymasks to the same permissions a page has
  *
  * @param object $page Page object
  */
 function setPagePermissions($page)
 {
     // Get an instance of this new embedded Cblock and inherit rights from this page to embedded contentblock
     $usergroups = sUsergroups()->getList();
     foreach ($usergroups as $usergroupItem) {
         $usergroupId = $usergroupItem['ID'];
         $objectPermissions = $page->permissions->getByUsergroup($usergroupId, $page->getID());
         if ($objectPermissions) {
             $permissionsArray = array('RREAD', 'RWRITE', 'RDELETE', 'RSUB', 'RSTAGE');
             foreach ($permissionsArray as $permissionsItem) {
                 if ($objectPermissions[$permissionsItem]) {
                     $this->permissions->setByUsergroup($usergroupId, $permissionsItem, $this->getID(), 1);
                 } else {
                     $this->permissions->setByUsergroup($usergroupId, $permissionsItem, $this->getID(), 0);
                 }
             }
         }
     }
 }
コード例 #14
0
ファイル: mailings.php プロジェクト: nrueckmann/yeager
$filterArray[] = array('TYPE' => 'STATUS', 'VALUE' => $filterStatus);
$mailings = $mailingMgr->getList($mailingMgr->tree->getRoot(), array('SUBNODES'), 2, NULL, $filterArray);
// Get additional user information
$allMailings = array();
foreach ($mailings as $mailingsIdx => $mailingsItem) {
    $currMailing = $mailingMgr->getMailing($mailingsItem['ID']);
    if ($currMailing) {
        $mailings[$mailingsIdx]['CREATEDTS'] = TStoLocalTS($mailings[$mailingsIdx]['CREATEDTS']);
        $mailings[$mailingsIdx]['CHANGEDTS'] = TStoLocalTS($mailings[$mailingsIdx]['CHANGEDTS']);
        // Get assigned groups
        $currMailingGroups = $currMailing->getUsergroups();
        $mailings[$mailingsIdx]['GROUPS'] = $currMailingGroups;
        // Check groups permissions (and set RWRITE to 0) if one of the groups has no RREAD
        $mailings[$mailingsIdx]['RWRITE'] = $currMailing->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $mailingsItem['ID'], "RREAD");
        foreach ($currMailingGroups as $currMailingGroupsItem) {
            if (!sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $currMailingGroupsItem['ID'], "RREAD")) {
                // NO RREAD
                $mailings[$mailingsIdx]['RWRITE'] = 0;
            }
        }
        // Get # of receipients
        $receipients = 0;
        $userIds = array();
        foreach ($currMailingGroups as $currMailingGroup) {
            // Get # of users in this group
            $usersInRole = sUserMgr()->getByUsergroup($currMailingGroup['ID']);
            foreach ($usersInRole as $usersInRoleItem) {
                array_push($userIds, $usersInRoleItem['UID']);
            }
        }
        $userIds = array_unique($userIds);
コード例 #15
0
ファイル: sites.php プロジェクト: nrueckmann/yeager
<?php

\framework\import('org.phpmailer.phpmailer');
$jsQueue = new JSQueue(NULL);
$templateMgr = new Templates();
$siteMgr = new Sites();
switch ($action) {
    case 'addSite':
        $wid = $this->params['wid'];
        $newSiteId = $siteMgr->add($itext['TXT_NEW_OBJECT'] ? $itext['TXT_NEW_OBJECT'] : '$TXT_NEW_OBJECT');
        // Set permissions for newly created site (but only for roles with "RSITES" privilege)
        $pageMgr = new PageMgr($newSiteId);
        $roles = sUsergroups()->getList();
        $pagesList = $pageMgr->getList(0, array(), 1, $roleID);
        $koala->callJSFunction('Koala.yg_addSiteItem', $wid, $newSiteId, $itext['TXT_NEW_OBJECT'] ? $itext['TXT_NEW_OBJECT'] : '$TXT_NEW_OBJECT');
        break;
    case 'deleteSite':
        $wid = $this->params['wid'];
        $siteID = $this->params['siteID'];
        $winID = explode('_', $wid);
        $winID = $winID[1];
        $siteMgr->remove($siteID);
        $koala->queueScript('if ($(\'sites_' . $winID . '_' . $siteID . '\')) $(\'sites_' . $winID . '_' . $siteID . '\').remove();');
        $koala->queueScript('Koala.windows[\'wid_' . $winID . '\'].refresh();');
        $koala->queueScript('$(Koala.windows[\'wid_' . $winID . '\'].boundWindow).addClassName(\'boxghost\');');
        $koala->queueScript('Koala.windows[Koala.windows[\'wid_' . $winID . '\'].boundWindow].init();');
        $koala->callJSFunction('Koala.yg_disable', 'tree_btn_delete', 'btn-' . $winID, 'tree_btn');
        break;
    case 'setSiteTemplateRoot':
        $siteID = $this->params['siteID'];
        $template = $this->params['templateId'];
コード例 #16
0
ファイル: templates.php プロジェクト: nrueckmann/yeager
 /**
  * Sets the default Navigation
  *
  * @param int $templateId Template Id
  * @param string $code Navigation code
  * @return bool TRUE on success or FALSE in case of an error
  */
 function setDefaultNavi($templateId, $code)
 {
     if (sUsergroups()->permissions->check($this->_uid, 'RTEMPLATES')) {
         $templateId = (int) $templateId;
         $code = sYDB()->escape_string(sanitize($code));
         $sql = "UPDATE yg_templates_navis SET `DEFAULT` = 0 WHERE (TEMPLATE = ?) AND (CODE <> ?);";
         sYDB()->Execute($sql, $templateId, $code);
         $sql = "UPDATE yg_templates_navis SET `DEFAULT` = 1 WHERE (TEMPLATE = ?) AND (CODE = ?);";
         sYDB()->Execute($sql, $templateId, $code);
         return true;
     } else {
         return false;
     }
 }
コード例 #17
0
$privileges = sUsergroups()->permissions->getByUsergroup($roleid);
$objects = array(array('ID' => 99, 'NAME' => $itext['TXT_PERM_YEAGER_LOGIN'] ? $itext['TXT_PERM_YEAGER_LOGIN'] : '******', 'LEVEL' => 1, 'PARENT' => 0, 'RREAD' => $privileges['RBACKEND'], 'CHILDREN' => 25), array('ID' => 1, 'NAME' => $itext['TXT_PERM_PAGES'] ? $itext['TXT_PERM_PAGES'] : '$TXT_PERM_PAGES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RPAGES']), array('ID' => 2, 'NAME' => $itext['TXT_PERM_CONTENTBLOCKS'] ? $itext['TXT_PERM_CONTENTBLOCKS'] : 'TXT_PERM_CONTENTBLOCKS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RCONTENTBLOCKS']), array('ID' => 3, 'NAME' => $itext['TXT_PERM_FILES'] ? $itext['TXT_PERM_FILES'] : '$TXT_PERM_FILES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RFILES']), array('ID' => 4, 'NAME' => $itext['TXT_PERM_TAGS'] ? $itext['TXT_PERM_TAGS'] : '$TXT_PERM_TAGS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RTAGS']), array('ID' => 21, 'NAME' => $itext['TXT_PERM_COMMENTS'] ? $itext['TXT_PERM_COMMENTS'] : '$TXT_PERM_COMMENTS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RCOMMENTS']), array('ID' => 19, 'NAME' => $itext['TXT_PERM_MAILINGS'] ? $itext['TXT_PERM_MAILINGS'] : '$TXT_PERM_MAILINGS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RMAILINGS']), array('ID' => 12, 'NAME' => $itext['TXT_PERM_TEMPLATES'] ? $itext['TXT_PERM_TEMPLATES'] : '$TXT_PERM_TEMPLATES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RTEMPLATES']), array('ID' => 13, 'NAME' => $itext['TXT_PERM_ENTRYMASKS'] ? $itext['TXT_PERM_ENTRYMASKS'] : '$TXT_PERM_ENTRYMASKS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RENTRYMASKS']), array('ID' => 11, 'NAME' => $itext['TXT_PERM_SITES'] ? $itext['TXT_PERM_SITES'] : '$TXT_PERM_SITES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RSITES']), array('ID' => 10, 'NAME' => $itext['TXT_PERM_DATA'] ? $itext['TXT_PERM_DATA'] : '$TXT_PERM_DATA', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RDATA']), array('ID' => 5, 'NAME' => $itext['TXT_PERM_USER'] ? $itext['TXT_PERM_USER'] : '******', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RUSERS']), array('ID' => 6, 'NAME' => $itext['TXT_PERM_USERGROUPS'] ? $itext['TXT_PERM_USERGROUPS'] : '$TXT_PERM_USERGROUPS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RUSERGROUPS']), array('ID' => 14, 'NAME' => $itext['TXT_PERM_PROPERTIES'] ? $itext['TXT_PERM_PROPERTIES'] : '$TXT_PERM_PROPERTIES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RPROPERTIES']), array('ID' => 15, 'NAME' => $itext['TXT_PERM_FILETYPES'] ? $itext['TXT_PERM_FILETYPES'] : '$TXT_PERM_FILETYPES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RFILETYPES']), array('ID' => 16, 'NAME' => $itext['TXT_PERM_VIEWS'] ? $itext['TXT_PERM_VIEWS'] : '$TXT_PERM_VIEWS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RVIEWS']), array('ID' => 17, 'NAME' => $itext['TXT_PERM_COMMENTS_CONFIG'] ? $itext['TXT_PERM_COMMENTS_CONFIG'] : '$TXT_PERM_COMMENTS_CONFIG', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RCOMMENTCONFIG']), array('ID' => 20, 'NAME' => $itext['TXT_PERM_MAILINGS_CONFIG'] ? $itext['TXT_PERM_MAILINGS_CONFIG'] : '$TXT_PERM_MAILINGS_CONFIG', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RMAILINGCONFIG']), array('ID' => 7, 'NAME' => $itext['TXT_PERM_PAGE_EXTENSIONS'] ? $itext['TXT_PERM_PAGE_EXTENSIONS'] : '$TXT_PERM_PAGE_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXTENSIONS_PAGE']), array('ID' => 22, 'NAME' => $itext['TXT_PERM_MAILING_EXTENSIONS'] ? $itext['TXT_PERM_MAILING_EXTENSIONS'] : '$TXT_PERM_MAILING_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXTENSIONS_MAILING']), array('ID' => 23, 'NAME' => $itext['TXT_PERM_FILE_EXTENSIONS'] ? $itext['TXT_PERM_FILE_EXTENSIONS'] : '$TXT_PERM_FILE_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXTENSIONS_FILE']), array('ID' => 24, 'NAME' => $itext['TXT_PERM_CBLOCK_EXTENSIONS'] ? $itext['TXT_PERM_CBLOCK_EXTENSIONS'] : '$TXT_PERM_CBLOCK_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXTENSIONS_CBLOCK']), array('ID' => 8, 'NAME' => $itext['TXT_PERM_IMPORT_EXTENSIONS'] ? $itext['TXT_PERM_IMPORT_EXTENSIONS'] : '$TXT_PERM_IMPORT_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RIMPORT']), array('ID' => 9, 'NAME' => $itext['TXT_PERM_EXPORT_EXTENSIONS'] ? $itext['TXT_PERM_EXPORT_EXTENSIONS'] : '$TXT_PERM_EXPORT_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXPORT']), array('ID' => 18, 'NAME' => $itext['TXT_PERM_COLISTVIEW_EXTENSIONS'] ? $itext['TXT_PERM_COLISTVIEW_EXTENSIONS'] : '$TXT_PERM_COLISTVIEW_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXTENSIONS_CBLISTVIEW']), array('ID' => 25, 'NAME' => $itext['TXT_PERM_UPDATER'] ? $itext['TXT_PERM_UPDATER'] : '$TXT_PERM_UPDATER', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RUPDATER']));
$extensionMgr = new ExtensionMgr();
$extensions = $extensionMgr->getList(0, true, true);
foreach ($extensions as $extensionItem) {
    $extPrivileges = sUsergroups()->permissions->getList($extensionItem['CODE']);
    if (count($extPrivileges) > 0) {
        foreach ($extPrivileges as $extPrivilegeItem) {
            $permissions = sUsergroups()->permissions->getByUsergroup($roleid, $extensionItem['CODE']);
            $permValue = $permissions[$extPrivilegeItem['PRIVILEGE']];
            $objects[] = array('ID' => (int) $extPrivilegeItem['ID'] + 1000, 'NAME' => $extPrivilegeItem['NAME'], 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $permValue);
        }
    }
}
$objects[0]['CHILDREN'] = count($objects) - 1;
$objectInfo = sUsergroups()->get($roleid);
$object_permissions = array();
$object_permissions["RWRITE"] = sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $roleid, "RWRITE");
$smarty->assign('isRORole', $isRORole);
$smarty->assign("maxlevels", $maxlevels);
$smarty->assign("site", $siteID);
$smarty->assign("objects", $objects);
$smarty->assign("page", $objectID);
$smarty->assign("refresh", $refresh);
$smarty->assign("tags", $tags);
$smarty->assign("ygid", $ygid);
$smarty->assign("object_permissions", $object_permissions);
$smarty->assign("objectInfo", $objectInfo);
$smarty->assign("objecttype", $objecttype);
$smarty->assign("win_no", $this->request->parameters['win_no']);
$smarty->display('file:' . $this->page_template);
コード例 #18
0
ファイル: privileges.php プロジェクト: nrueckmann/yeager
 /**
  * Sets a Privilege for a specific Usergroup
  *
  * @param int $usergroupId
  * @param string $privilege Privilege
  * @param int $value Privilege value (1 for allowed, 0 for not allowed)
  * @return bool TRUE on success or FALSE if not allowed
  * @throws Exception
  */
 public function setByUsergroup($usergroupId, $privilege, $value)
 {
     $usergroupId = (int) $usergroupId;
     $privilege = sYDB()->escape_string(sanitize($privilege));
     $value = sYDB()->escape_string(sanitize($value));
     if ($value < 1) {
         $value = 0;
     }
     // Check if current user has permissions to change usergroup-permissions
     if (!sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $usergroupId, 'RWRITE')) {
         return false;
     }
     $sql = "SELECT ID FROM " . $this->_table . " WHERE PRIVILEGE = ?;";
     $result = sYDB()->Execute($sql, $privilege);
     $resultarray = @$result->GetArray();
     $privilegeId = (int) $resultarray[0]['ID'];
     if ($privilegeId) {
         $pinfo = $this->getByUsergroup($usergroupId);
         if ($pinfo[$privilege] === NULL) {
             // Insert
             $sql = "INSERT INTO " . $this->_table_values . "\n\t\t\t\t\t\t\t(`USERGROUPID`, `PRIVILEGEID`, `VALUE`)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(?, ?, ?);";
             $result = sYDB()->Execute($sql, $usergroupId, $privilegeId, $value);
         } else {
             // Update
             $sql = "UPDATE " . $this->_table_values . " SET VALUE = ? WHERE USERGROUPID = ? AND PRIVILEGEID = ?;";
             $result = sYDB()->Execute($sql, $value, $usergroupId, $privilegeId);
         }
         if ($result === false) {
             throw new Exception(sYDB()->ErrorMsg());
         }
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/PERMISSION_CHANGE") == "true") {
             Singleton::FC()->emptyBucket();
         }
         return true;
     }
     return false;
 }
コード例 #19
0
ファイル: user.php プロジェクト: nrueckmann/yeager
 /**
  * Removes this User from a Usergroup
  *
  * @param int $usergroupId Usergroup Id
  */
 function removeUsergroup($usergroupId)
 {
     $uid = (int) $this->id;
     if (sUsergroups()->permissions->check($this->_uid, 'RUSERS') || $uid == $this->_uid) {
         $usergroupId = (int) $usergroupId;
         if ($usergroupId > 0) {
             // admin user requires admin role, cannot be removed
             if (sUserMgr()->getAdministratorID() == $uid) {
                 if ($usergroupId == (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTGROUPID")) {
                     return false;
                 }
             }
             $sql = "DELETE FROM\n\t\t\t\t`yg_user_lnk_usergroups`\n\t\t\t\tWHERE\n\t\t\t\tUID = ? AND USERGROUPID = ?;";
             sYDB()->Execute($sql, $uid, $usergroupId);
         }
         return true;
     } else {
         return false;
     }
 }
コード例 #20
0
ファイル: mailingmgr.php プロジェクト: nrueckmann/yeager
 /**
  * Sets the Template-Root for Mailings
  * @param int $templateId Template Id
  * @return string Template-Root-Id for Mailings
  */
 public function setTemplateRoot($templateId)
 {
     if (sUsergroups()->permissions->check($this->_uid, 'RMAILINGCONFIG')) {
         $templateId = (int) $templateId;
         $sql = "UPDATE yg_mailing_settings SET TEMPLATEROOT = ? WHERE ID = 1;";
         $result = $this->_db->execute($sql, $templateId);
         if ($result === false) {
             return false;
         }
         return true;
     } else {
         return false;
     }
 }
コード例 #21
0
ファイル: mailing.php プロジェクト: nrueckmann/yeager
 /**
  * Adds an embedded Cblock to this Mailing
  *
  * @param string $contentarea Contentarea code
  * @return int Cblock Id
  */
 function addCblockEmbedded($contentarea)
 {
     $mailingId = (int) $this->_id;
     if ($this->permissions->checkInternal($this->_uid, $mailingId, "RWRITE")) {
         // Get folder for embedded cblocks
         $embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER");
         // Add a Cblock
         $embeddedCblockId = sCblockMgr()->add($embeddedCblockFolder);
         $newEmbeddedCblock = sCblockMgr()->getCblock($embeddedCblockId);
         // Set it to "embedded"
         $newEmbeddedCblock->setEmbedded();
         // Add this Cblock to this page
         $embeddedCblockLinkId = $this->addCblockLink($embeddedCblockId, $contentarea);
         // Get an instance of this new embedded Cblock and inherit rights from this page to embedded contentblock
         $usergroups = sUsergroups()->getList();
         foreach ($usergroups as $usergroupItem) {
             $usergroupId = $usergroupItem['ID'];
             $objectPermissions = $this->permissions->getByUsergroup($usergroupId, $mailingId);
             if ($objectPermissions) {
                 $permissionsArray = array('RREAD', 'RWRITE', 'RDELETE', 'RSUB', 'RSTAGE');
                 foreach ($permissionsArray as $permissionsItem) {
                     if ($objectPermissions[$permissionsItem]) {
                         $newEmbeddedCblock->permissions->setByUsergroup($usergroupId, $permissionsItem, $embeddedCblockId, 1);
                     } else {
                         $newEmbeddedCblock->permissions->setByUsergroup($usergroupId, $permissionsItem, $embeddedCblockId, 0);
                     }
                 }
             }
         }
         // Get an instance of this new embedded Cblock and inherit rights from this page to embedded contentblock
         $usergroups = sUsergroups()->getList();
         foreach ($usergroups as $usergroupItem) {
             $usergroupId = $usergroupItem['ID'];
             $objectPermissions = $this->permissions->getByUsergroup($usergroupId, $pageId);
             if ($objectPermissions) {
                 $permissionsArray = array('RREAD', 'RWRITE', 'RDELETE', 'RSUB', 'RSTAGE');
                 foreach ($permissionsArray as $permissionsItem) {
                     if ($objectPermissions[$permissionsItem]) {
                         $newEmbeddedCblock->permissions->setByUsergroup($usergroupId, $permissionsItem, $embeddedCblockId, 1);
                     } else {
                         $newEmbeddedCblock->permissions->setByUsergroup($usergroupId, $permissionsItem, $embeddedCblockId, 0);
                     }
                 }
             }
         }
         // Set the first version of the embedded cblock to "published"
         $newEmbeddedCblock->publishVersion();
         return $embeddedCblockId;
     } else {
         return false;
     }
 }
コード例 #22
0
ファイル: filetypes.php プロジェクト: nrueckmann/yeager
 /**
  * Gets a Filetype (by identifier)
  *
  * @param string $identifier Filetype identifier
  * @return array Array containing information about the Filetype
  * @throws Exception
  */
 function getByIdentifier($identifier)
 {
     if (sUsergroups()->permissions->check($this->_uid, 'RFILETYPES')) {
         $identifier = sYDB()->escape_string(sanitize($identifier));
         $sql = "SELECT * FROM `yg_filetypes_properties` WHERE IDENTIFIER = ?;";
         $result = sYDB()->Execute($sql, $identifier);
         if ($result === false) {
             throw new Exception(sYDB()->ErrorMsg());
         }
         return $result->GetArray();
     } else {
         return false;
     }
 }