$contentblocks_blind_final = array(); foreach ($contentblocks_blind as $idx => $contentblock_blind) { // Get links to pages $a = 0; $linkedpages = array(); $cbb = sCblockMgr()->getCblock($contentblock_blind['OBJECTID']); $cbbVersions = $cbb->getVersions(); foreach ($cbbVersions as $cbbVersion) { $cbv = sCblockMgr()->getCblock($contentblock_blind['OBJECTID'], $cbbVersion['VERSION']); for ($i = 0; $i < count($sites); $i++) { $linkedtosite = $cbv->getLinkedPageVersions($sites[$i]["ID"], false, true); if (count($linkedtosite) > 0) { for ($x = 0; $x < count($linkedtosite); $x++) { $linkpageid = $linkedtosite[$x]["ID"]; $lThePageMgr = new PageMgr($sites[$i]["ID"]); $linkpageparents = $lThePageMgr->getParents($linkpageid); array_pop($linkpageparents); $lPage = $lThePageMgr->getPage($linkpageid); if ($lPage) { $pageversions = $lPage->getVersionsByCblockId($co); $linkedPageInfo = $lPage->get(); $addToArray = true; foreach ($linkedpages as $linkedpagesItem) { if ($linkedpagesItem['PAGEID'] == $linkpageid && $linkedpagesItem['SITEID'] == $sites[$i]["ID"]) { $addToArray = false; } } if ($addToArray) { $linkedpages[$a]["SITEID"] = $sites[$i]["ID"]; $linkedpages[$a]["SITENAME"] = $sites[$i]["NAME"]; $linkedpages[$a]["PAGEID"] = $linkpageid;
if ($node == 'trash') { break; } // Pages $pageMgr = new PageMgr($siteID); $root_node = $pageMgr->getTree(NULL, 0); $page = $pageMgr->getPage($node); // 1 = rsub // 2 = rread // 3 = rdelete // 4 = parent -> rsub & rwrite // 5 = parent -> rsub & rwrite // 6 = rdelete $buttons = array(); // Get Parents $parents = $pageMgr->getParents($node); $parentid = $parents[0][0]['ID']; // Check rights $rread = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $node, "RREAD"); $rwrite = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $node, "RWRITE"); $rsub = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $node, "RSUB"); $rdelete = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $node, "RDELETE"); $rstage = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $node, "RSTAGE"); // Check rights of parents $prsub = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $parentid, "RSUB"); $prwrite = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $parentid, "RWRITE"); // Check permissions for button "add" if ($rsub) { $buttons[0] = true; } else { $buttons[0] = false;
// Get amount of comments $commentsObject = new Comments(); $commentsCount = $commentsObject->getAllCommentsCount($filterArray); // for paging $pageDirInfo = calcPageDir($commentsCount, 'created'); // X $pageDirOrderBy = $pageDirInfo['pageDirOrderBy']; $pageDirLimit = $pageDirInfo['pageDirLimit']; // END for paging $assignedComments = $commentsObject->getAllComments($filterArray, $pageDirLimit); $fileMgr = sFileMgr(); foreach ($assignedComments as $assignedCommentIdx => $assignedComment) { switch ($assignedComment['OBJECTTYPE']) { case 'PAGE': $PageMgr = new PageMgr($assignedComment['SITEID']); $assignedComments[$assignedCommentIdx]['PARENTS'] = $PageMgr->getParents($assignedComment['OBJECTID']); $cPage = $PageMgr->getPage($assignedComment['OBJECTID']); $cPageInfo = $cPage->get(); $cPageInfo['RWRITE'] = $cPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], "RWRITE"); $cPageInfo['RDELETE'] = $cPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], "RDELETE"); $assignedComments[$assignedCommentIdx]['PAGEINFO'] = $cPageInfo; $iconData = getIconForPage($cPageInfo); $assignedComments[$assignedCommentIdx]['ICON'] = $iconData['iconclass']; $assignedComments[$assignedCommentIdx]['STYLE'] = $iconData['style']; $assignedComments[$assignedCommentIdx]['HASCHANGED'] = $assignedComments[$assignedCommentIdx]['HASCHANGED']; $assignedComments[$assignedCommentIdx]['RMODERATE'] = $cPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], 'RMODERATE'); $assignedComments[$assignedCommentIdx]['RCOMMENT'] = $cPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], 'RCOMMENT'); $commentsObject = $cPage->comments; break; case 'CO': $assignedComments[$assignedCommentIdx]['PARENTS'] = sCblockMgr()->getParents($assignedComment['OBJECTID']);
/** * Gets the URL of this Page * * @return string URL of this Page */ function getUrl() { $pageID = $this->_id; if ($this->permissions->checkInternal($this->_uid, $pageID, "RREAD")) { $pageMgr = new PageMgr($this->_site); $pnames = $pageMgr->getParents($pageID); $pi = count($pnames); while ($pi > 0) { if ($pnames[$pi - 1][0]["PNAME"] != "") { $url .= $pnames[$pi - 1][0]["PNAME"] . "/"; } $pi--; } $pinfo = $this->get(); return sApp()->webroot . $url . $pinfo["PNAME"] . "/"; } else { return false; } }
/** * 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; }
$objectInfo['PNAME'] = $cb->calcPName(); } } break; case 'page': $autosave = true; $pageMgr = new PageMgr($siteID); $page = $pageMgr->getPage($object); if ($page) { $objectInfo = $page->get(); $objectInfo['RWRITE'] = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $object, "RWRITE"); $objectInfo['RDELETE'] = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $object, "RDELETE"); $iconData = getIconForPage($objectInfo); $objectInfo['ICON'] = $iconData['iconclass']; $objectInfo['STYLE'] = $iconData['style']; $objectparents = $pageMgr->getParents($object); array_pop($objectparents); // Gather all required info from parents foreach ($objectparents as $objectparent_idx => $objectparent_item) { $tmpPage = $pageMgr->getPage($objectparent_item[0]['ID']); $tmpObjectinfo = $tmpPage->get(); $objectparents[$objectparent_idx][0]['NAVIGATIONID'] = $tmpObjectinfo['NAVIGATIONID']; $objectparents[$objectparent_idx][0]['HASCHANGED'] = $tmpObjectinfo['HASCHANGED']; $objectparents[$objectparent_idx][0]['RWRITE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $objectparent_item[0]['ID'], "RWRITE"); $objectparents[$objectparent_idx][0]['RDELETE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $objectparent_item[0]['ID'], "RDELETE"); $iconData = getIconForPage($objectparents[$objectparent_idx][0]); $objectparents[$objectparent_idx][0]['ICON'] = $iconData['iconclass']; $objectparents[$objectparent_idx][0]['STYLE'] = $iconData['style']; } // Get page properties $object_properties = $pageMgr->properties->getList('LISTORDER');
} } } $history[$i]['CONTENTAREA'] = $contentarea_name; $history[$i]['FORMFIELD'] = $formfield_name; $history[$i]['EMBLOCK'] = $control_name; $history[$i]['TYPE'] = 'COEDIT'; } switch ($history[$i]['TYPE']) { case 'COEDIT': case HISTORYTYPE_PAGE: try { if ($history[$i]['SITEID']) { $PageMgr = new PageMgr($history[$i]['SITEID']); if ($PageMgr) { $history[$i]['PARENTS'] = $PageMgr->getParents($history[$i]['OID']); $hPage = $PageMgr->getPage($history[$i]['OID']); if ($hPage && $hPage->permissions) { $hPageInfo = $hPage->get(); $hPageInfo['RWRITE'] = $hPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $history[$i]['OID'], "RWRITE"); $hPageInfo['RDELETE'] = $hPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $history[$i]['OID'], "RDELETE"); $history[$i]['PAGEINFO'] = $hPageInfo; $iconData = getIconForPage($hPageInfo); $history[$i]['ICON'] = $iconData['iconclass']; $history[$i]['STYLE'] = $iconData['style']; $history[$i]['HASCHANGED'] = $history[$i]['PAGEINFO']['HASCHANGED']; } } } } catch (Exception $ex) { }
} // Get all sites $sites = sSites()->getList(); foreach ($sites as $currentSite) { // Get all pages with this tag $pageMgr = new PageMgr($currentSite['ID']); $filterArray = array(); $filterArray[] = array('TYPE' => 'DELETED', 'OPERATOR' => 'is_not', 'VALUE' => 1); $tagged_pages = $pageMgr->tags->getByTag($tag_id, "OBJECTORDER DESC", "OR", false, $filterArray); foreach ($tagged_pages as $tagged_page_item) { $page = $pageMgr->getPage($tagged_page_item['OBJECTID']); if ($page) { $lpv = $page->getPublishedVersion(true); $page = $pageMgr->getPage($tagged_page_item['OBJECTID'], $lpv); $pageInfo = $page->get(); $pr = $pageMgr->getParents($tagged_page_item['OBJECTID']); $pageInfo['RWRITE'] = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $tagged_page_item['OBJECTID'], "RWRITE"); $pageInfo['RDELETE'] = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $tagged_page_item['OBJECTID'], "RDELETE"); $iconData = getIconForPage($pageInfo); array_pop($pr); $objectparents = $pr; array_push($incoming_pages, array('ID' => $tagged_page_item['OBJECTID'], 'SITEID' => $currentSite['ID'], 'ICON' => $iconData['iconclass'], 'STYLE' => $iconData['style'], 'NAME' => $pageInfo['NAME'], 'PARENTS' => $objectparents, 'SITENAME' => $currentSite['NAME'])); } } } $smarty->assign("incoming_files", $incoming_files); $smarty->assign("incoming_cos", $incoming_cos); $smarty->assign("incoming_mailings", $incoming_mailings); $smarty->assign("incoming_pages", $incoming_pages); break; }
$trashedObjects = $pageMgr->getList(0, array('TRASHCAN'), 0, 0, $filterArray); // for paging $pageDirInfo = calcPageDir(count($trashedObjects), 'prop.CHANGEDTS', 'DESC'); $pageDirOrderBy = $pageDirInfo['pageDirOrderBy']; $pageDirOrderDir = $pageDirInfo['pageDirOrderDir']; $pageDirLimit = explode(',', $pageDirInfo['pageDirLimit']); $pageDirLimitFrom = $pageDirLimit[0]; $pageDirLimitLength = $pageDirLimit[1]; // END for paging $filterArray[] = array('TYPE' => 'LIMITER', 'VALUE' => $pageDirLimitFrom, 'VALUE2' => $pageDirLimitLength); $filterArray[] = array('TYPE' => 'ORDER', 'VALUE' => $pageDirOrderBy, 'VALUE2' => $pageDirOrderDir); $trashedObjects = $pageMgr->getList(0, array('TRASHCAN'), 0, 0, $filterArray); foreach ($trashedObjects as $trashedObjectIdx => $trashedObject) { $page = $pageMgr->getPage($trashedObject['ID']); $lastHistory = $page->history->getChanges(1); $trashedObjects[$trashedObjectIdx]['PARENTS'] = $pageMgr->getParents($trashedObject['ID']); $trashedObjects[$trashedObjectIdx]['SITE'] = $siteID; $trashedObjects[$trashedObjectIdx]['LASTCHANGE'] = $lastHistory; // Get permissions and style and icon for page $tPageInfo = $page->get(); $tPageInfo['RWRITE'] = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $history[$i]['OID'], "RWRITE"); $tPageInfo['RDELETE'] = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $history[$i]['OID'], "RDELETE"); $trashedObjects[$trashedObjectIdx]['PAGEINFO'] = $tPageInfo; $iconData = getIconForPage($tPageInfo); $trashedObjects[$trashedObjectIdx]['ICON'] = $iconData['iconclass']; $trashedObjects[$trashedObjectIdx]['STYLE'] = $iconData['style']; // Get information for creator if ($trashedObject['CREATEDBY']) { $user = new User($trashedObject['CREATEDBY']); $uinfo = $user->get(); $uinfo['PROPS'] = $user->properties->getValues($trashedObject['CREATEDBY']);
$viacnt = count($incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"]); } if (!isset($refphash[$sites[$s]["ID"] . $linkedtosite[$p]["ID"]])) { $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]["TARGETTYPE"] = REFTYPE_PAGE; $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]["NAME"] = $linkedtosite[$p]["NAME"]; $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]["ID"] = $linkedtosite[$p]["PID"]; $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]["SITE"] = $sites[$s]["ID"]; $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]['PAGEINFO'] = $referredPage->get(); $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]['PAGEINFO']['RWRITE'] = $referredPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $linkedtosite[$p]["PID"], "RWRITE"); $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]['PAGEINFO']['RDELETE'] = $referredPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $linkedtosite[$p]["PID"], "RDELETE"); $iconData = getIconForPage($incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]['PAGEINFO']); $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]['ICON'] = $iconData['iconclass']; $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]['STYLE'] = $iconData['style']; $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]['HASCHANGED'] = $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]['PAGEINFO']['HASCHANGED']; $lPageMgr = new PageMgr($sites[$s]["ID"]); $pr = $lPageMgr->getParents($linkedtosite[$p]["ID"]); $pr[count($pr) - 1][0]['NAME'] = $siteMgr->getname($sites[$s]["ID"]); $incoming[$refcohash[$cblockInfo["ID"]]]["VIATARGETS"][$viacnt]["PARENTS"] = $pr; $refphash[$sites[$s]["ID"] . $linkedtosite[$p]["ID"]] = $p; } } } } } } } } } } $pageMgr = new PageMgr($siteID); $page = $pageMgr->getPage($pageID);
/** * Gets all published Pages linked to this Cblock * * @param bool $onlyPublished TRUE if only published Pageversions should be returned (optional) * @return array|false Array of linked Pages or FALSE in case of an error */ function getLinkedPages($onlyPublished = false) { $cbId = $this->_id; if ($this->permissions->checkInternal($this->_uid, $cbId, "RREAD")) { $siteMgr = new Sites(); $sites = $siteMgr->getList(); $a = 0; for ($i = 0; $i < count($sites); $i++) { $linkedtosite = $this->getLinkedPageVersions($sites[$i]['ID'], true); if (count($linkedtosite) > 0) { for ($x = 0; $x < count($linkedtosite); $x++) { $linkpageid = $linkedtosite[$x]['ID']; $PageMgr = new PageMgr($sites[$i]['ID']); $linkpageparents = $PageMgr->getParents($linkpageid); $p = $PageMgr->getPage($linkpageid); $pageversions = $p->getVersionsByCblockId($cbId); $linkedPageInfo = $p->get(); $linkedpages[$a]['SITEID'] = $sites[$i]['ID']; $linkedpages[$a]['SITENAME'] = $sites[$i]['NAME']; $linkedpages[$a]['PAGEID'] = $linkpageid; $linkedpages[$a]['PAGENAME'] = $linkedPageInfo['NAME']; $linkedpages[$a]['HASCHANGED'] = $linkedtosite[$x]['HASCHANGED']; $linkedpages[$a]['PARENTS'] = $linkpageparents; if ($onlyPublished) { $tmpVersion = $p->getPublishedVersion(true); $linkedpages[$a]['VERSION'] = $tmpVersion; $linkedInPublishedVersion = false; foreach ($pageversions as $pageversionsItem) { if ($pageversionsItem['VERSION'] == $tmpVersion) { $linkedInPublishedVersion = true; } } if (!$linkedInPublishedVersion) { unset($linkedpages[$a]); } else { $a++; } } else { $linkedpages[$a]['VERSIONS'] = $pageversions; $a++; } } } } return $linkedpages; } else { return false; } }
<?php $ygid = $this->request->parameters['yg_id']; $refresh = $this->request->parameters['refresh']; $template = explode('-', $ygid); $template = $template[0]; $icons = new Icons(); $sites = sSites()->getList(); $all_pages = array(); foreach ($sites as $curr_site) { $pageMgr = new PageMgr($curr_site['ID']); $pages = $pageMgr->getPagesByTemplate($template); if (count($pages) > 0) { foreach ($pages as $curr_idx => $curr_page) { $parents = $pageMgr->getParents($curr_page['ID']); $pages[$curr_idx]['PARENTS'] = $parents; $pages[$curr_idx]['SITE'] = $curr_site['ID']; $pages[$curr_idx]['SITENAME'] = $curr_site['NAME']; $tmpPage = $pageMgr->getPage($curr_page['ID']); $tmpPageInfo = $tmpPage->get(); $tmpPageInfo['RWRITE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $curr_page['ID'], "RWRITE"); $tmpPageInfo['RDELETE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $curr_page['ID'], "RDELETE"); $pages[$curr_idx]['PAGEINFO'] = $tmpPageInfo; $iconData = getIconForPage($tmpPageInfo); $pages[$curr_idx]['ICON'] = $iconData['iconclass']; $pages[$curr_idx]['STYLE'] = $iconData['style']; $pages[$curr_idx]['HASCHANGED'] = $tmpPageInfo['HASCHANGED']; } $all_pages = array_merge($all_pages, $pages); } }