public function onRender() { // get page $page = $this->getPage(); // get tags assigned to this page $tags = $page->tags->getAssigned(); $dynamicContent = array(); // loop through tags for ($i = 0; $i < count($tags); $i++) { // get all content blocks which got a tag assigned $cbs = sCblockMgr()->tags->getByTag($tags[$i]['ID']); for ($j = 0; $j < count($cbs); $j++) { // instance content block object $cb = sCblockMgr()->getCblock($cbs[$j]['OBJECTID']); if ($cb) { // get additional information like name and push it to the $dynamicContent $info = $cb->get(); $cbs[$j] = array_merge($cbs[$j], $info); /* optionally get the full content of each content block gets slow if performed for a large number of content blocks $cbs[$j]["CONTENT"] = $cb->getContent();*/ array_push($dynamicContent, $cbs[$j]); } } } // assign array sSmarty()->assign("dynamicContent", $dynamicContent); }
public function getCblockList($id = 0, $maxlevel = 0, $roleid = 0, $filterArray) { if ($filterArray[0]['CBID']) { $limit = array('CBID' => $filterArray[0]['CBID']); $coList = \sCblockMgr()->filterEntrymasks(false, $this->getFilter(), $limit, false); } else { $limit = array('FOLDER' => $id); $coList = \sCblockMgr()->filterEntrymasks(false, $this->getFilter(), $limit, false); } // Get additional data for each formfield (and strip folders) $finalCoList = array(); foreach ($coList as $coListItem) { if ($coListItem['FOLDER'] == 0) { // get last modifier $history = \sCblockMgr()->history->getList($coListItem['CBID']); if ($allMailingsItem['CHANGEDBY']) { $userObj = new \user($history[0]['UID'] ? $history[0]['UID'] : $coListItem['CHANGEDBY']); } else { $userObj = new \user($history[0]['UID'] ? $history[0]['UID'] : $coListItem['CREATEDBY']); } $userInfo = $userObj->get(); $userProps = $userObj->properties->getValues($userInfo['ID']); $userInfo['PROPS'] = $userProps; // Get controls $cb = new \Cblock($coListItem['CBID']); $coListItem['ENTRYMASKS'] = $cb->getEntrymasks(); // Get additional control info $col1Data = array(array('CO_NAME' => $coListItem['NAME'], 'FORMFIELD' => 101, 'OBJECTIDENTIFIER' => true)); $col2Data = array(array('USER_NAME' => trim($userInfo['PROPS']['FIRSTNAME'] . ' ' . $userInfo['PROPS']['LASTNAME']), 'USER_ID' => $userInfo['ID'], 'FORMFIELD' => 100)); $col3Data = array(array('CHANGEDTS' => TStoLocalTS($coListItem['CHANGEDTS']), 'FORMFIELD' => 103)); $result[0] = $col1Data; $result[1] = $col2Data; $result[2] = $col3Data; $data = array('CBID' => $coListItem['CBID'], 'CBVERSION' => $coListItem['CBVERSION'], 'NAME' => $coListItem['NAME'], 'HASCHANGED' => $coListItem['HASCHANGED'], 'FIELDS' => $result, 'RREAD' => $coListItem['RREAD'], 'RWRITE' => $coListItem['RWRITE'], 'RDELETE' => $coListItem['RDELETE'], 'RSUB' => $coListItem['RSUB'], 'RSTAGE' => $coListItem['RSTAGE'], 'RMODERATE' => $coListItem['RMODERATE'], 'RCOMMENT' => $coListItem['RCOMMENT']); array_push($finalCoList, $data); } } if (!$filterArray[0]['CBID']) { $pageDirOrderBy = $filterArray[1]['VALUE']; $pageDirOrderDir = $filterArray[1]['VALUE2']; if (strlen($pageDirOrderBy) && strlen($pageDirOrderDir)) { $listColumns = $this->getListColumns(); usort($finalCoList, array('com\\nt\\DefaultCblockListView', $listColumns['COLUMNS'][$pageDirOrderBy]['SORTFUNC'])); if ($pageDirOrderDir == -1) { $finalCoList = array_reverse($finalCoList); } } $pageDirFrom = $filterArray[0]['VALUE']; $pageDirCount = $filterArray[0]['VALUE2']; if (strlen($pageDirFrom) && strlen($pageDirCount)) { $finalCoList = array_slice($finalCoList, $pageDirFrom, $pageDirCount); } } return $finalCoList; }
public function process($objectId, $params) { $objectId = (int) $objectId; $publishVersion = (int) $params['VERSION']; $cb = sCblockMgr()->getCblock($objectId); if ($cb) { $objectInfo = $cb->get(); if (count($objectInfo) > 0) { $cb->publishVersion($publishVersion); // Add to history if ($publishVersion != ALWAYS_LATEST_APPROVED_VERSION) { $cb->history->add(HISTORYTYPE_CO, NULL, $publishVersion, 'TXT_CBLOCK_H_PUBLISH'); } else { $lastfinalversion = $cb->getLatestApprovedVersion(); $cb->history->add(HISTORYTYPE_CO, NULL, $lastfinalversion, 'TXT_CBLOCK_H_PUBLISH'); } return true; } else { return false; } } }
public function getCblockList($id = 0, $maxlevel = 0, $roleid = 0, $filterArray) { if ($filterArray[0]['CBID']) { // If a CBID filter is set (this is set when a single line is requested from the frontend $limit = array('CBID' => $filterArray[0]['CBID']); $coList = sCblockMgr()->filterEntrymasks(false, $this->getFilter(), $limit, false); } else { // Normal mode, return full list (all children of the specified folder) $limit = array('FOLDER' => $id); $coList = sCblockMgr()->filterEntrymasks(false, $this->getFilter(), $limit, false); // Chop array for pagedirectory $pageDirFrom = $filterArray[0]['VALUE']; $pageDirCount = $filterArray[0]['VALUE2']; if ($pageDirFrom && $pageDirCount) { $coList = array_slice($coList, $pageDirFrom, $pageDirCount); } // Sort array for pagedirectory $pageDirOrderBy = $filterArray[1]['VALUE']; $pageDirOrderDir = $filterArray[1]['VALUE2']; if ($pageDirOrderBy && $pageDirOrderDir) { $listColumns = $this->getListColumns(); usort($coList, array('com\\yg\\ExampleCBListSmall', $listColumns['COLUMNS'][$pageDirOrderBy]['SORTFUNC'])); if ($pageDirOrderDir == -1) { $coList = array_reverse($coList); } } } // Get additional data for each formfield (and strip folders) $finalCoList = array(); foreach ($coList as $coListItem) { $lcb = sCblockMgr()->getCBlock($coListItem['CBID']); $cbInfo = $lcb->get(); // Get userinfos from the user who latest modified this object $userObj = sUserMgr()->getUser($cbInfo["CHANGEDBY"]); if ($userObj) { $userInfo = $userObj->get(); $userProps = $userObj->properties->get(); $userInfo['PROPS'] = $userProps; } if ($coListItem['FOLDER'] == 0) { // Get controls $coListItem['ENTRYMASKS'] = $lcb->getEntrymasks(); // Get additional control info $col1Data = array(); $col2Data = array(); $col3Data = array(); $col1Data[] = array('VALUE01' => $cbInfo['NAME'], 'FORMFIELD' => 1); // Add an additional custom column which contains the current user information $col3Data = array(array('USER_NAME' => trim($userInfo['PROPS']['FIRSTNAME'] . ' ' . $userInfo['PROPS']['LASTNAME']), 'USER_ID' => $userInfo['ID'], 'FORMFIELD' => 100)); $col2field = '(' . count($coListItem['ENTRYMASKS']) . ') '; for ($c = 0; $c < count($coListItem['ENTRYMASKS']); $c++) { if ($c != 0) { $col2field .= ", "; } $col2field .= $coListItem['ENTRYMASKS'][$c]['CODE']; } $col2Data[] = array('VALUE01' => $col2field, 'FORMFIELD' => 1); $result[0] = $col1Data; $result[1] = $col2Data; $result[2] = $col3Data; // Map everything into an array (represents one line) $data = array('CBID' => $coListItem['CBID'], 'CBVERSION' => $coListItem['CBVERSION'], 'NAME' => $coListItem['NAME'], 'HASCHANGED' => $coListItem['HASCHANGED'], 'FIELDS' => $result, 'RREAD' => $coListItem['RREAD'], 'RWRITE' => $coListItem['RWRITE'], 'RDELETE' => $coListItem['RDELETE'], 'RSUB' => $coListItem['RSUB'], 'RSTAGE' => $coListItem['RSTAGE'], 'RMODERATE' => $coListItem['RMODERATE'], 'RCOMMENT' => $coListItem['RCOMMENT']); array_push($finalCoList, $data); } } // Return the whole list return $finalCoList; }
/** * 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; }
$jsQueue->add($objectid, HISTORYTYPE_MAILING, 'HIGHLIGHT_MAILING', sGuiUS(), 'name'); // Add to history $mailing->history->add(HISTORYTYPE_PAGE, NULL, $tagInfo[NAME], "TXT_TAG_H_REMOVE", $tag); } break; } break; case 'orderObjectTag': $objectid = $this->params['objectID']; $objectType = $this->params['objectType']; $siteID = $this->params['site']; $taglist = $this->params['listArray']; switch ($objectType) { case 'cblock': // For Contentblocks $cb = sCblockMgr()->getCblock($objectid); $cblockInfo = $cb->get(); for ($i = 0; $i < count($taglist); $i++) { $cb->tags->setOrder($taglist[$i], $i); } // Add to history $cb->history->add(HISTORYTYPE_CO, NULL, NULL, "TXT_TAG_H_TAGORDER", NULL); break; case 'file': // For Files // For Files case 'filefolder': $file = sFileMgr()->getFile($objectid); $fileinfo = $file->get(); for ($i = 0; $i < count($taglist); $i++) { $file->tags->setOrder($taglist[$i], $i);
/** * Assigns a Cblock to a specific Contentarea in this Mailing * * @param int $cbId Cblock Id * @param string $contentarea Contentarea code * @return int|false Link Id of the newly assigned Cblock or FALSE in case of an error * @throws Exception */ function addCblockLink($cbId, $contentarea) { $mailingID = (int) $this->_id; if ($this->permissions->checkInternal($this->_uid, $mailingID, "RWRITE")) { $cbId = (int) $cbId; $contentarea = sYDB()->escape_string(sanitize($contentarea)); // Check if contentblock is blind or not $sql = "SELECT\n\t\t\t*, pv.*\n\t\t\tFROM (yg_contentblocks_properties, yg_contentblocks_tree)\n\t\t\tLEFT JOIN yg_contentblocks_propsv AS pv ON pv.OID = yg_contentblocks_properties.ID\n\t\t\tWHERE OBJECTID = {$cbId} AND yg_contentblocks_properties.OBJECTID = yg_contentblocks_tree.ID"; $ra = $this->cacheExecuteGetArray($sql); if (count($ra) > 0 && $ra[0]['EMBEDDED'] == 1) { // Blind contentblock $tmpCblock = sCblockMgr()->getCblock($cbId); $cbVersion = $tmpCblock->getVersion(); } else { // Normal contentblock $cbVersion = ALWAYS_LATEST_APPROVED_VERSION; } $version = (int) $this->getVersion(); $sql = "INSERT INTO `yg_mailing_lnk_cb`\n\t\t\t(`CBID`, `CBVERSION`, `PID`, `PVERSION`, `TEMPLATECONTENTAREA`)\n\t\t\tVALUES\n\t\t\t(?, ?, ?, ?, ?);"; $result = sYDB()->Execute($sql, $cbId, $cbVersion, $mailingID, $version, $contentarea); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $insertid = sYDB()->Insert_ID(); $this->markAsChanged(); return $insertid; } else { return false; } }
} } $co['ALLOWED'] = true; if ($childNotAllowed) { $co['ALLOWED'] = false; } $output[] = $co; $loop++; } } } if ($siteID && $pageID && $siteID != 'dummy' && $pageID != 'dummy' && $siteID != 'cblock_copy' && $pageID != 'cblock_copy') { switch ($siteID) { case 'cblock': // For contentblocks $contentblockMgr = sCblockMgr(); $page = $contentblockMgr->getCblock($pageID); // Get current locks for this token (and unlock them) $lockToken = sGuiUS() . '_' . $this->request->parameters['win_no']; $lockedObjects = $contentblockMgr->getLocksByToken($lockToken); foreach ($lockedObjects as $lockedObject) { $currentObject = $contentblockMgr->getCblock($lockedObject['OBJECTID']); $currentObject->releaseLock($lockedObject['TOKEN']); } break; case 'file': // For files $fileMgr = sFileMgr(); $page = $fileMgr->getFile($pageID); // Get current locks for this token (and unlock them) $lockToken = sGuiUS() . '_' . $this->request->parameters['win_no'];
$cb = sCblockMgr()->getCblock($contentblockID); $cblockInfo = $cb->get(); if ($contentblockID > 0) { $cb = sCblockMgr()->getCblock($contentblockID); $targetcb = sCblockMgr()->getCblock($target_co); // Get original order of controls $co_oldlink_info = $targetcb->getEntrymasks(); $co_oldlinks = array(); foreach ($co_oldlink_info as $co_oldlink_info_item) { array_push($co_oldlinks, $co_oldlink_info_item['LINKID']); } $co_controllinks = $cb->getEntrymasks(); $new_controls = array(); foreach ($co_controllinks as $co_controllink) { $controlinfo = sCblockMgr()->getCblockLinkByEntrymaskLinkId($co_controllink['LINKID']); $lcb = sCblockMgr()->getCblock($controlinfo['CBLOCKID']); $new_control = $targetcb->addEntrymask($controlinfo['ENTRYMASK']); array_push($new_controls, $new_control); $controlFormfields = $lcb->getFormfieldsInternal($co_controllink['LINKID']); // Get Formfields for control $controlFormfields_new = $targetcb->getFormfieldsInternal($new_control); for ($c = 0; $c < count($controlFormfields); $c++) { $formfield = $controlFormfields[$c]['FORMFIELD']; $targetcb->setFormfield($controlFormfields_new[$c]['LINKID'], $controlFormfields[$c]['VALUE01'], $controlFormfields[$c]['VALUE02'], $controlFormfields[$c]['VALUE03'], $controlFormfields[$c]['VALUE04'], $controlFormfields[$c]['VALUE05'], $controlFormfields[$c]['VALUE06'], $controlFormfields[$c]['VALUE07'], $controlFormfields[$c]['VALUE08']); } // Change the id in the $newcolist array foreach ($newcolists[0] as $idx => $item) { if ($item[0] == $moved_co) { $newcolists[0][$idx][0] = $target_co; $newcolists[0][$idx][1] = $new_control; }
$user = new User(sUserMgr()->getCurrentUserID()); // Last changes from pages per site into an array $lastchanges['PAGES'] = array(); $startx = 0; for ($i = 0; $i < count($sites); $i++) { $msites[] = $sites[$i]; $PageMgr = sPageMgr($sites[$i]["ID"]); $changeslist = $PageMgr->history->getLastChange(HISTORYTYPE_PAGE, $sites[$i]["ID"]); for ($x = $startx; $x < count($changeslist) + $startx; $x++) { $lastchanges['PAGES'][$x] = $changeslist[$x - $startx]; $lastchanges['PAGES'][$x]['SITE'] = $sites[$i]['ID']; } $startx = $x; } // Last changes from content, files, mailings and comments $lastchanges['CONTENT'] = sCblockMgr()->history->getLastChange(HISTORYTYPE_CO); $fileMgr = sFileMgr(); $lastchanges['FILES'] = $fileMgr->history->getLastChange(HISTORYTYPE_FILE); $mailingMgr = new MailingMgr(); $lastchanges['MAILING'] = $mailingMgr->history->getLastChange(HISTORYTYPE_MAILING); /* $commentMgr = new Comments(); $lastchanges['COMMENT'] = $commentMgr->getAllComments( $filterArray, $pageDirLimit ); */ // Enrich information for pages, content, files, mailing foreach (array('PAGES', 'CONTENT', 'FILES', 'MAILING') as $item) { foreach ($lastchanges[$item] as $lastchanges_idx => $lastchanges_item) { $lastchanges[$item][$lastchanges_idx]['DATETIME'] = TStoLocalTS($lastchanges_item['DATETIME']); $user = new User($lastchanges_item['UID']); $userinfo = $user->get(); if ($userinfo['ID']) {
if ($objectID) { $cblock = sCblockMgr()->getCblock($objectID); $cblockInfo = $cblock->get(); $cblockInfo['RWRITE'] = $cblock->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE"); $cblockInfo['RSTAGE'] = $cblock->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RSTAGE"); if ($cblockInfo['DELETED']) { $cblockInfo['RWRITE'] = false; $cblockInfo['READONLY'] = true; $cblockInfo['RSTAGE'] = false; } // Get current locks for this token (and unlock them) $lockToken = sGuiUS() . '_' . $this->request->parameters['win_no']; $lockedObjects = sCblockMgr()->getLocksByToken($lockToken); foreach ($lockedObjects as $lockedObject) { if ($lockedObject['OBJECTID']) { $currentObject = sCblockMgr()->getCblock($lockedObject['OBJECTID']); $currentObject->releaseLock($lockedObject['TOKEN']); } } // Check for lock, and lock if not locked $lockStatus = $cblock->getLock(); if ($lockStatus['LOCKED'] == 0) { $lockedFailed = !$cblock->acquireLock($lockToken); } else { $lockedFailed = true; } $all_cblock_extensions = $extensionMgr->getList(EXTENSION_CBLOCK, true); $used_extensions = array(); $used_extensions_info = array(); foreach ($all_cblock_extensions as $all_cblock_extension) { $extension = $extensionMgr->getExtension($all_cblock_extension["CODE"]);
$refresh = $this->params['refresh']; $target_id = $this->params['targetId']; $target_pos = $this->params['targetPosition']; $objectInfo = $extensionMgr->get($extension); if ($objectInfo["CODE"]) { $extension = $extensionMgr->getExtension($objectInfo["CODE"]); if ($extension) { $jsQueue = new JSQueue(NULL); switch ($siteID) { case 'cblock': $addFunc = 'addToCBlock'; $isUsedFunc = 'usedByCblock'; $historySuffix = 'CBLOCK'; $historyType = HISTORYTYPE_CO; $extensionType = EXTENSION_CBLOCK; $cblock = sCblockMgr()->getCblock($pageID); $pageInfo = $cblock->get(); $object = $cblock; break; case 'file': $addFunc = 'addToFile'; $isUsedFunc = 'usedByFile'; $historyType = HISTORYTYPE_FILE; $extensionType = EXTENSION_FILE; $fileMgr = sFileMgr(); $file = $fileMgr->getFile($pageID); $pageInfo = $file->get(); $object = $file; break; case 'mailing': $addFunc = 'addToMailing';
function sumchanges_new($newchangeslist) { for ($i = 0; $i < count($newchangeslist); $i++) { if ($newchangeslist[$i]['TYPE'] == HISTORYTYPE_PAGE) { if ($newchangeslist[$i]["SITEID"] && $newchangeslist[$i]["OID"]) { try { $PageMgr = new PageMgr($newchangeslist[$i]["SITEID"]); $page = $PageMgr->getPage($newchangeslist[$i]["OID"]); if ($page) { $oidinfo = $page->get(); $name = $oidinfo["NAME"]; } } catch (Exception $ex) { } } } if ($newchangeslist[$i]['TYPE'] == HISTORYTYPE_CO) { try { $cb = sCblockMgr()->getCblock($newchangeslist[$i]["OID"]); if ($cb) { $oidinfo = $cb->get(); $name = $oidinfo["NAME"]; } } catch (Exception $ex) { } } if ($newchangeslist[$i]['TYPE'] == HISTORYTYPE_FILE) { try { $file = sFileMgr()->getFile($newchangeslist[$i]["OID"]); if ($file) { $oidinfo = $file->get(); $name = $oidinfo["NAME"]; } } catch (Exception $ex) { } } if ($newchangeslist[$i]['TYPE'] == HISTORYTYPE_MAILING) { try { $mailing = sMailingMgr()->getMailing($newchangeslist[$i]["OID"]); if ($mailing) { $oidinfo = $mailing->get(); $name = $oidinfo["NAME"]; } } catch (Exception $ex) { } } if (strlen($name) > 0) { $changeslist[$i] = $newchangeslist[$i]; $changeslist[$i]["NAME"] = $name; } } return $changeslist; }
/** * Gets n last History entries * * @param int $max (optional) Maximum number of entries * @param string|array $text (optional) One or multiple text filters * @return array List of History entries * @throws Exception */ function getLastChanges($max = 8, $text = '') { $max = (int) $max; $tmpTableName = 'TMP_' . strtoupper(sApp()->request->parameters['us']) . '_' . rand() . '_HISTORY'; $sql = "DROP TEMPORARY TABLE IF EXISTS `{$tmpTableName}`;"; $result = sYDB()->Execute($sql); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $sql = "CREATE TEMPORARY TABLE `{$tmpTableName}` (\n\t\t\t\t\t`ID` int(11) NOT NULL,\n\t\t\t\t\t`SOURCEID` varchar(20) NOT NULL,\n\t\t\t\t\t`OID` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t`DATETIME` int(11) DEFAULT NULL,\n\t\t\t\t\t`TEXT` text NOT NULL,\n\t\t\t\t\t`UID` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t`TYPE` int(11) NOT NULL,\n\t\t\t\t\t`TARGETID` int(11) NOT NULL,\n\t\t\t\t\t`OLDVALUE` text NOT NULL,\n\t\t\t\t\t`NEWVALUE` text NOT NULL,\n\t\t\t\t\t`SITEID` int(11) NOT NULL,\n\t\t\t\t\t`FROM` int(11) DEFAULT '0',\n\t\t\t\t\t`TYPE_OID` int(11) DEFAULT NULL,\n\t\t\t\t\tPRIMARY KEY (`ID`),\n\t\t\t\t\tKEY `OID` (`OID`)\n\t\t\t\t);"; $result = sYDB()->Execute($sql); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $sqlargs = array(); if (!is_array($text) && strlen($text) > 1) { $wheresql .= "TEXT=?"; array_push($sqlargs, $text); } else { if (is_array($text) && count($text) > 0) { for ($t = 0; $t < count($text); $t++) { $wheresql .= "TEXT = ? "; array_push($sqlargs, $text[$t]); if ($t < count($text) - 1) { $wheresql .= " OR "; } } } else { $wheresql .= "1"; } } if ($this->_sourceid != "") { $sourcesql = "AND SOURCEID = ?"; array_push($sqlargs, $this->_sourceid); } $sql = "INSERT INTO `{$tmpTableName}`\n\t\t\t\tSELECT\n\t\t\t\t\t*,\n\t\t\t\t\t((TYPE *1000000) + OID) AS `TYPE_OID`\n\t\t\t\tFROM " . $this->_table . "\n\t\t\t\tWHERE {$wheresql} {$sourcesql}\n\t\t\t\tORDER BY `DATETIME` DESC\n\t\t\t\tLIMIT 0, 2000;"; array_unshift($sqlargs, $sql); $dbr = call_user_func_array(array(sYDB(), 'Execute'), $sqlargs); if ($dbr === false) { throw new Exception(sYDB()->ErrorMsg()); } // Get folder for embedded cblocks $embeddedCblockFolder = (int) sConfig()->getVar('CONFIG/EMBEDDED_CBLOCKFOLDER'); // Remove all embedded Cblocks from temporary table $sql = "DELETE\n\t\t\t\tFROM\n\t\t\t\t\t`{$tmpTableName}`\n\t\t\t\tUSING\n\t\t\t\t\t`{$tmpTableName}`\n\t\t\t\tINNER JOIN\n\t\t\t\t\t`yg_contentblocks_tree`\n\t\t\t\tWHERE\n\t\t\t\t\t(`{$tmpTableName}`.OID = `yg_contentblocks_tree`.ID) AND\n\t\t\t\t\t(`yg_contentblocks_tree`.PARENT = " . $embeddedCblockFolder . ") AND\n\t\t\t\t\t(TYPE = " . HISTORYTYPE_CO . ");"; $result = sYDB()->Execute($sql); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $sql = "SELECT *, (SELECT\n\t\t\t\t\t\tMAX(`DATETIME`)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t" . $this->_table . " AS `h2`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`h2`.`OID` = `lft`.`OID`) AS `MAXDATETIME`\n\t\t\t\tFROM `{$tmpTableName}` AS `lft`\n\t\t\t\tGROUP BY `TYPE_OID`\n\t\t\t\tORDER BY `DATETIME` DESC\n\t\t\t\tLIMIT 0, {$max};"; $result = sYDB()->Execute($sql); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $resultarray = $result->GetArray(); for ($i = 0; $i < count($resultarray); $i++) { $oid = $resultarray[$i]['OID']; $rread = false; if ($this->permissions == NULL) { if ($resultarray[$i]['SITEID'] && $resultarray[$i]['TYPE'] == HISTORYTYPE_PAGE) { $tmpPageMgr = new PageMgr($resultarray[$i]['SITEID']); if ($tmpPageMgr->permissions->checkInternal($this->_uid, $oid, "RREAD")) { $rread = true; } } if ($resultarray[$i]['TYPE'] == HISTORYTYPE_CO) { if (sCblockMgr()->permissions->checkInternal($this->_uid, $oid, "RREAD")) { $rread = true; } } if ($resultarray[$i]['TYPE'] == HISTORYTYPE_FILE) { if (sFileMgr()->permissions->checkInternal($this->_uid, $oid, "RREAD")) { $file = sFileMgr()->getFile($oid); if ($file) { $fileinfo = $file->get(); if ($fileinfo["FOLDER"] == 0) { $rread = true; } } } } } else { if ($this->permissions->checkInternal($this->_uid, $oid, "RREAD")) { $rread = true; } } if ($rread) { if ($resultarray[$i]['TYPE'] == HISTORYTYPE_CO) { $tmpCblock = sCblockMgr()->getCblock($resultarray[$i]['OID']); if ($tmpCblock) { $tmpCblockInfo = $tmpCblock->get(); $embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER"); if ($tmpCblockInfo['PARENT'] != $embeddedCblockFolder) { $ra[] = $resultarray[$i]; } } } else { $ra[] = $resultarray[$i]; } } } return $ra; }
/** * Sets the default permissions for Objects without an Admin * * @param int $usergroupId Usergroup Id * @return bool TRUE on success or FALSE in case of an error */ function setDefaultPermissions($usergroupId) { // For Templates $templateMgr = new Templates(); $allTemplates = $templateMgr->getList(); $permissionList = array(); foreach ($allTemplates as $allTemplate) { $permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'RDELETE' => 1, 'OID' => $allTemplate['ID'], 'USERGROUPID' => $usergroupId); } $templateMgr->permissions->setPermissions($permissionList); // For Views $viewMgr = new Views(); $allViews = $viewMgr->getList(); $permissionList = array(); foreach ($allViews as $allView) { $permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'RDELETE' => 1, 'OID' => $allView['ID'], 'USERGROUPID' => $usergroupId); } $viewMgr->permissions->setPermissions($permissionList); // For Entrymasks $entrymaskMgr = new Entrymasks(); $allEntrymasks = $entrymaskMgr->getList(); $permissionList = array(); foreach ($allEntrymasks as $allEntrymask) { $permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'RDELETE' => 1, 'OID' => $allEntrymask['ID'], 'USERGROUPID' => $usergroupId); } $entrymaskMgr->permissions->setPermissions($permissionList); // For Cblock blindfolder $embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER"); $permissionList = array(); $permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'OID' => $embeddedCblockFolder, 'USERGROUPID' => $usergroupId); sCblockMgr()->permissions->setPermissions($permissionList); // Remove rights for Cblock root node $cblockRootNodeId = sCblockMgr()->tree->getRoot(); $permissionList = array(); $permissionList[] = array('RREAD' => 0, 'RSUB' => 0, 'RWRITE' => 0, 'RDELETE' => 0, 'OID' => $cblockRootNodeId, 'USERGROUPID' => $usergroupId); sCblockMgr()->permissions->setPermissions($permissionList); }
if ($tmpFile) { $fileInfo = $tmpFile->get(); $objectdynprops[$objectdynprops_cnt]['FILETITLE'] = $fileInfo['NAME']; $objectdynprops[$objectdynprops_cnt]['FILECOLOR'] = $fileInfo['COLOR']; $objectdynprops[$objectdynprops_cnt]['FILEIDENTIFIER'] = $fileInfo['IDENTIFIER']; $objectdynprops[$objectdynprops_cnt]['FILEABBREVIATION'] = $fileInfo['ABBREVIATION']; } } } if ($object_property['TYPE'] == 'TAG') { $tagInfo = $tagMgr->get($objectdynprops[$objectdynprops_cnt]['VALUE']); $objectdynprops[$objectdynprops_cnt]['TAGTITLE'] = $tagInfo['NAME']; } if ($object_property['TYPE'] == 'CBLOCK') { if ($objectdynprops[$objectdynprops_cnt]['VALUE']) { $tmpCb = sCblockMgr()->getCblock($objectdynprops[$objectdynprops_cnt]['VALUE']); if ($tmpCb) { $cblockInfo = $tmpCb->get(); $objectdynprops[$objectdynprops_cnt]['CBLOCKTITLE'] = $cblockInfo['NAME']; } } } if ($object_property['TYPE'] == 'PAGE') { if ($objectdynprops[$objectdynprops_cnt]['VALUE']['site'] && $objectdynprops[$objectdynprops_cnt]['VALUE']['page']) { $pageMgr = new PageMgr($objectdynprops[$objectdynprops_cnt]['VALUE']['site']); $currPage = $pageMgr->getPage($objectdynprops[$objectdynprops_cnt]['VALUE']['page']); $pageInfo = $currPage->get(); $objectdynprops[$objectdynprops_cnt]['PAGETITLE'] = $pageInfo['NAME']; } } if ($object_property['TYPE'] == 'DATETIME' || $object_property['TYPE'] == 'DATE') {
} if ($backendObject) { $backendObject->permissions->setPermissions($nodepermissions, -1); // Always set all permissions for blindfolder if ($objectType == 'cblocks') { $backendObject->permissions->setByUsergroup($roleID, 'RREAD', $embeddedCblockFolder, 1); $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) {
$tmpUserInfo = $tmpUser->get(); $adminAllowed = $tmpUser->checkPermission('RPROPERTIES'); if ($adminAllowed) { switch (strtolower($this->page)) { case 'tab_config_page-properties': // Page // Get first site $siteMgr = new Sites(); $sites = $siteMgr->getList(); $pageMgr = new PageMgr($sites[0]['ID']); $properties_object = $pageMgr->properties; $object_type = 'page'; break; case 'tab_config_cblock-properties': // Contentblocks $properties_object = sCblockMgr()->properties; $object_type = 'cblock'; break; case 'tab_config_file-properties': // File $fileMgr = sFileMgr(); $properties_object = $fileMgr->properties; $object_type = 'file'; break; case 'tab_config_user-properties': // User $properties_object = sUserMgr()->properties; $object_type = 'user'; break; } $object_properties = $properties_object->getList('LISTORDER');
/** * Post processes a property value (resolves urls, permanent names, etc.) * * @param string $type Property type * @param string $value Property value * @return mixed Post processed property value */ function postProcessValue($type, $value) { switch ($type) { case 'LINK': $linkInfo = checkLinkInternalExternal(resolveSpecialURL($value)); if ($linkInfo['TYPE'] == 'internal') { return resolveSpecialURL($linkInfoJSON['href']); } elseif ($linkInfo['TYPE'] == 'file') { $pname = sFileMgr()->getPNameByFileId($linkInfo['INFO']['FILE_ID']); if ($pname) { return sApp()->webroot . 'download/' . $pname; } } else { if ($value != '') { return $value; } else { return NULL; } } case 'PAGE': $pageInfo = json_decode($value, true); $tmpPageMgr = sPageMgr($pageInfo['site']); $tmpPage = $tmpPageMgr->getPage($pageInfo['page']); if ($tmpPage) { $tmpUrl = $tmpPage->getUrl(); $tmpPname = $tmpPageMgr->getPNameByPageId($pageInfo['page']); return array('SITE_ID' => $pageInfo['site'], 'PAGE_ID' => $pageInfo['page'], 'URL' => $tmpUrl, 'PNAME' => $tmpPname, 'VALUE' => $value); } else { return NULL; } case 'FILE': $pname = sFileMgr()->getPNameByFileId($value); if ($pname) { return array('FILE_ID' => $value, 'URL' => sApp()->webroot . 'download/' . $pname, 'IMAGE_URL' => sApp()->webroot . 'image/' . $pname, 'PNAME' => $pname, 'VALUE' => $value); } else { return NULL; } case 'RICHTEXT': return replaceSpecialURLs($value); break; case 'CBLOCK': $pname = sCblockMgr()->getPNameByCblockId($value); if ($pname) { return array('CBLOCK_ID' => $value, 'PNAME' => $pname, 'VALUE' => $value); } else { return NULL; } case 'TAG': $tagInfo = sTags()->get($value); if ($tagInfo) { return array('TAG_ID' => $value, 'NAME' => $tagInfo['NAME'], 'VALUE' => $value); } else { return NULL; } default: return $value; } }
if ($uid) { $user = new User($uid); $uinfo = $user->get(); $uinfo['PROPS'] = $user->properties->getValues($uid); $versions[$i]['USERNAME'] = $uinfo['PROPS']['LASTNAME']; $versions[$i]['VORNAME'] = $uinfo['PROPS']['FIRSTNAME']; } } $autopublish = sCblockMgr()->scheduler->getSchedule($cblockID, 'SCH_AUTOPUBLISH'); $onlineversion = $cb->getPublishedVersion(); $latestversion = $cb->getLatestApprovedVersion(); if (!$latestversion) { $latestversion = 1; $neverpublished = true; } $latestfinalcb = sCblockMgr()->getCblock($cblockID, $latestversion); $latestversioninfo = $latestfinalcb->get(); break; case 'page': $pageID = $data[0]; $siteID = $data[1]; $pageMgr = new PageMgr($siteID); $page = $pageMgr->getPage($pageID); $objectInfo = $page->get(); $objectInfo['RSTAGE'] = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $pageID, "RSTAGE"); $objectInfo['NOSTAGE'] = !$objectInfo['RSTAGE']; if ($objectInfo['DELETED']) { $objectInfo['RSTAGE'] = false; $objectInfo['NOSTAGE'] = true; } // Get current locks for this token (and unlock them)
for ($j = 0; $j < count($contentareas); $j++) { $pagelist = $sourcePage->getCblockList($contentareas[$j]['CODE']); for ($x = 0; $x < count($pagelist); $x++) { $coid = $pagelist[$x]['OBJECTID']; // Check if we have a blind contentblock if ($pagelist[$x]['EMBEDDED'] == 1) { // Yes, we have to copy it to the blind folder // Check which entrymasks are contained $sourcecb = sCblockMgr()->getCblock($coid); $src_co = $sourcecb->get(); $src_entrymasks = $sourcecb->getEntrymasks(); // Create blind contentblocks with these entrymasks foreach ($src_entrymasks as $src_entrymask_item) { // Add new contentblock to folder $contentblockID = $newPage->addCblockEmbedded($contentareas[$j]['CODE']); $newcb = sCblockMgr()->getCblock($contentblockID); $newcb->properties->setValue("NAME", $src_entrymask_item['ENTRYMASKNAME']); // Add requested control to contentblock $new_control = $newcb->addEntrymask($src_entrymask_item['ENTRYMASKID']); // Get the LinkId of the newly created contentblock $new_colnkid = $newPage->getEmbeddedCblockLinkId($contentblockID); // Loop through all formfields $controlFormfields = $sourcecb->getFormfieldsInternal($src_entrymask_item['LINKID']); $newControlFormfields = $newcb->getFormfieldsInternal($new_control); // Fill all formfield parameter values with content from the source formfield for ($c = 0; $c < count($newControlFormfields); $c++) { $newcb->setFormfield($newControlFormfields[$c]['LINKID'], $controlFormfields[$c]['VALUE01'], $controlFormfields[$c]['VALUE02'], $controlFormfields[$c]['VALUE03'], $controlFormfields[$c]['VALUE04'], $controlFormfields[$c]['VALUE05'], $controlFormfields[$c]['VALUE06'], $controlFormfields[$c]['VALUE07'], $controlFormfields[$c]['VALUE08']); } } } else { // No, it's a normal one, just link it to the page
/** * Removes a Mailing from the Trash * * @param int $mailingId Mailing Id * * @return array Array with all elements which were successfully deleted */ function remove($mailingId) { $mailingId = $origMailingId = (int) $mailingId; $rootNode = $this->tree->getRoot(); if ($mailingId == $rootNode) { return array(); } // Get all nodes $successNodes = array(); $allNodes = $this->tree->get($mailingId, 1000); foreach ($allNodes as $allNodesItem) { $mailingId = (int) $allNodesItem['ID']; if ($this->permissions->checkInternal($this->_uid, $mailingId, "RDELETE")) { // Collect and remove all linked blind contentblocks $sql = "SELECT * FROM `yg_mailing_lnk_cb` WHERE PID = {$mailingId};"; $linked_cos = $this->cacheExecuteGetArray($sql); $c = sCblockMgr(); foreach ($linked_cos as $linked_co) { $cblock = $c->getCblock($linked_co['CBID']); if ($cblock) { $coInfo = $cblock->get(); // Blind contentblock? if ($coInfo['EMBEDDED'] == 1) { $cblock->delete(); $c->remove($linked_co['CBID']); } } } $tmpMailing = $this->getMailing($mailingId); $mailingInfo = $tmpMailing->get(); $tmpMailing->tags->clear(); $tmpMailing->history->clear(); // Remove mailing $sql = "DELETE FROM `yg_mailing_properties` WHERE OBJECTID = ?;"; sYDB()->Execute($sql, $mailingId); // Remove content object links $sql = "DELETE FROM `yg_mailing_lnk_cb` WHERE PID = ?;"; sYDB()->Execute($sql, $mailingId); // Remove statusinfo $sql = "DELETE FROM `yg_mailing_status` WHERE OID = ?;"; sYDB()->Execute($sql, $mailingId); $this->callExtensionHook('onRemove', $mailingId, 0, $mailingInfo); $successNodes[] = $mailingId; } } if (in_array($origMailingId, $successNodes)) { $this->tree->remove($origMailingId); } if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/MAILING_DELETE") == "true") { Singleton::FC()->emptyBucket(); } return $successNodes; }
$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']); array_pop($assignedComments[$assignedCommentIdx]['PARENTS']); $acb = sCblockMgr()->getCblock($assignedComment['OBJECTID']); if ($acb) { $assignedComments[$assignedCommentIdx]['CBLOCKINFO'] = $acb->get(); $assignedComments[$assignedCommentIdx]['CBLOCKINFO']['RWRITE'] = $acb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], "RWRITE"); $assignedComments[$assignedCommentIdx]['CBLOCKINFO']['RDELETE'] = $acb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], "RDELETE"); $styleData = getStyleForContentblock($assignedComments[$assignedCommentIdx]['CBLOCKINFO']); $assignedComments[$assignedCommentIdx]['STYLE'] = $styleData; $assignedComments[$assignedCommentIdx]['HASCHANGED'] = $assignedComments[$assignedCommentIdx]['CBLOCKINFO']['HASCHANGED']; $assignedComments[$assignedCommentIdx]['RMODERATE'] = $acb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], 'RMODERATE'); $assignedComments[$assignedCommentIdx]['RCOMMENT'] = $acb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], 'RCOMMENT'); $commentsObject = $acb->comments; } break; case 'FILE': $assignedComments[$assignedCommentIdx]['PARENTS'] = $fileMgr->getParents($assignedComment['OBJECTID']); array_pop($assignedComments[$assignedCommentIdx]['PARENTS']);
function gen_tree($current, $site = 1, $icons, $imgpath, &$xml_tree, &$tree_id, &$tree_level, $itext, $maxlevels, $currentnode) { if ($tree_level > $maxlevels) { $tree_level--; return; } $svrload = 'false'; if ($tree_level == (int) $maxlevels) { $svrload = 'true'; } if (is_array($currentnode['CONTENTAREAS']) && count($currentnode['CONTENTAREAS']) > 0 && $currentnode['ID'] != 1) { $props = array('TREE_ID' => ++$tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => 'contentareacontainer_' . $currentnode['ID'], 'CAPTION' => '<i>' . ($itext['TXT_CONTENTAREAS'] != '') ? $itext['TXT_CONTENTAREAS'] : '$TXT_CONTENTAREAS' . '</i>', 'URL' => $url, 'IC' => $imgpath . '/icons/' . $icons['contentareas_small'], 'EXP' => 'false', 'CHK' => 'false', 'CSTSTYLE' => '', 'TARGET' => '', 'TITLE' => '', 'YG_ID' => $currentnode['ID'] . '-contentareacontainer', 'YG_TYPE' => 'contentareacontainer', 'YG_PROPERTY' => 'name', 'DND' => 'false', 'XTRA' => 'noclick'); array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level, 'PROPS' => $props)); $tree_level++; foreach ($currentnode['CONTENTAREAS'] as $contentarea) { $props = array('TREE_ID' => ++$tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => 'contentarea' . $currentnode['ID'] . '_' . $contentarea['ID'], 'CAPTION' => '<i>' . htmlspecialchars($contentarea['NAME']) . '</i>', 'URL' => $url, 'IC' => $imgpath . '/icons/' . $icons['contentarea_small'], 'EXP' => 'false', 'CHK' => 'false', 'CSTSTYLE' => '', 'TARGET' => '', 'TITLE' => '', 'YG_ID' => $contentarea['ID'] . '-contentarea' . $current[$key]['ID'], 'YG_TYPE' => 'contentarea', 'YG_PROPERTY' => 'name', 'DND' => 'false', 'XTRA' => 'noclick'); array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level, 'PROPS' => $props)); foreach ($contentarea['LIST'] as $co_item) { if ($co_item['EMBEDDED'] != 1) { $tmpCblock = sCblockMgr()->getCblock($co_item['OBJECTID']); if ($tmpCblock) { $cBlockInfo = $tmpCblock->get(); $co_item['NAME'] = $cBlockInfo['NAME']; } $props = array('TREE_ID' => ++$tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => 'co' . $current[$key]['ID'] . '_' . $co_item['OBJECTID'] . '_' . $co_item['LINKID'], 'CAPTION' => htmlspecialchars($co_item['NAME']), 'URL' => $url, 'IC' => $imgpath . '/icons/' . $icons['cblock_small'], 'EXP' => 'false', 'CHK' => 'false', 'CSTSTYLE' => '', 'TARGET' => '', 'TITLE' => '', 'YG_ID' => $co_item['OBJECTID'] . '-cblock' . $current[$key]['ID'], 'YG_TYPE' => 'cblock', 'YG_PROPERTY' => 'name'); array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level, 'PROPS' => $props)); } } } $tree_level--; } while (list($key, $value) = each($current)) { if ($current[$key]['RREAD'] > 0) { $iconData = getIconForPage($current[$key]); $img = $icons[$iconData['img']]; $cststyle = $iconData['style']; // Add path if ($img == '' || img != undefined) { $img = $imgpath . 'icons/' . $img; } $node_svrload = 'false'; if ($svrload == 'true' && $current[$key]['CHILDREN'] != NULL) { $node_svrload = $svrload; } $props = array('TREE_ID' => ++$tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => 'page_' . $current[$key]["ID"], 'CAPTION' => htmlspecialchars($current[$key]["NAME"]), 'URL' => $url, 'IC' => $img, 'EXP' => 'false', 'CHK' => 'false', 'CSTSTYLE' => $cststyle, 'TARGET' => '', 'TITLE' => '', 'SVRLOAD' => $node_svrload, 'YG_ID' => $current[$key]["ID"] . '-' . $site, 'YG_TYPE' => 'page', 'YG_PROPERTY' => 'name', 'XTRA' => 'noclick'); array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level, 'PROPS' => $props)); if (is_array($current[$key]['CONTENTAREAS']) && count($current[$key]['CONTENTAREAS']) > 0) { $tree_level++; $props = array('TREE_ID' => ++$tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => 'contentareacontainer_' . $current[$key]['ID'], 'CAPTION' => '<i>' . ($itext['TXT_CONTENTAREAS'] != '') ? $itext['TXT_CONTENTAREAS'] : '$TXT_CONTENTAREAS' . '</i>', 'URL' => $url, 'IC' => $imgpath . '/icons/' . $icons['contentareas_small'], 'EXP' => 'false', 'CHK' => 'false', 'CSTSTYLE' => '', 'TARGET' => '', 'TITLE' => '', 'YG_ID' => $current[$key]['ID'] . '-contentareacontainer', 'YG_TYPE' => 'contentareacontainer', 'YG_PROPERTY' => 'name', 'XTRA' => 'noclick'); array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level, 'PROPS' => $props)); $tree_level++; foreach ($current[$key]['CONTENTAREAS'] as $contentarea) { $props = array('TREE_ID' => ++$tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => 'contentarea' . $current[$key]['ID'] . '_' . $contentarea['ID'], 'CAPTION' => '<i>' . htmlspecialchars($contentarea['NAME']) . '</i>', 'URL' => $url, 'IC' => $imgpath . '/icons/' . $icons['contentarea_small'], 'EXP' => 'false', 'CHK' => 'false', 'CSTSTYLE' => '', 'TARGET' => '', 'TITLE' => '', 'YG_ID' => $contentarea['ID'] . '-contentarea' . $current[$key]['ID'], 'YG_TYPE' => 'contentarea', 'YG_PROPERTY' => 'name', 'XTRA' => 'noclick'); array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level, 'PROPS' => $props)); foreach ($contentarea['LIST'] as $co_item) { if ($co_item['EMBEDDED'] != 1) { $tmpCblock = sCblockMgr()->getCblock($co_item['OBJECTID']); if ($tmpCblock) { $cBlockInfo = $tmpCblock->get(); $co_item['NAME'] = $cBlockInfo['NAME']; } $props = array('TREE_ID' => ++$tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => 'co' . $current[$key]['ID'] . '_' . $co_item['OBJECTID'] . '_' . $co_item['LINKID'], 'CAPTION' => htmlspecialchars($co_item['NAME']), 'URL' => $url, 'IC' => $imgpath . '/icons/' . $icons['cblock_small'], 'EXP' => 'false', 'CHK' => 'false', 'CSTSTYLE' => '', 'TARGET' => '', 'TITLE' => '', 'YG_ID' => $co_item['OBJECTID'] . '-cblock' . $current[$key]['ID'], 'YG_TYPE' => 'cblock', 'YG_PROPERTY' => 'name'); /* 'YG_PROPERTY' => 'name', ); */ array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level, 'PROPS' => $props)); } } } $tree_level--; $tree_level--; } if (is_array($current[$key]['CHILDREN'])) { $tree_level++; gen_tree($current[$key]['CHILDREN'], $site, $icons, $imgpath, $xml_tree, $tree_id, $tree_level, $itext, $maxlevels, $current[$key]); } } } $tree_level--; }
foreach ($linkedmailings as $linkedmailingsItem) { $mailingsHash .= $linkedmailingsItem['HASH'] . '#'; } $contentblocks[$idx]['MAILINGS'] = $linkedmailings; $contentblocks[$idx]['MAILINGSHASH'] = $mailingsHash; } // Get all pages & mailings for all blind contentblocks $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"]) {
/** * Removes this Extension from the specified Cblock * * @param string $cbId Cblock Id * @param string $version Cblock version * @return bool TRUE on success or FALSE in case of an error * @throws Exception */ public function removeFromCBlock($cbId, $version) { $cbId = (int) $cbId; $version = (int) $version; $sql = "DELETE FROM yg_extensions_lnk_cblocks WHERE CODE = ? AND CBID = ? AND CBVERSION = ?;"; $result = sYDB()->Execute($sql, $this->_code, $cbId, $version); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $cblock = sCblockMgr()->getCblock($cbId, $version); if ($cblock) { $cblock->markAsChanged(); } return true; }
$iconData = getIconForPage($object_item); $objects[$objectIndex]['ICON'] = $iconData['iconclass']; $objects[$objectIndex]['STYLE'] = $iconData['style']; $objects[$objectIndex]['SITEID'] = $siteID; } } sUserMgr()->unimpersonate(); break; case 'cblocks': sUserMgr()->impersonate(sUserMgr()->getAdministratorID()); $cb = sCblockMgr()->getCblock($obj_id); if ($cb) { $base = $cb->get(); $maxlevels = $base['LEVEL'] + 2; $objects = sCblockMgr()->getList($obj_id, array('SUBNODES'), $maxlevels, $roleid); $objects = sCblockMgr()->getAdditionalTreeInfo(false, $objects); // Check if the folder for blind contentblocks already exists and create it if it doesn't exist $embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER"); $smarty->assign("embeddedCblockFolder", $embeddedCblockFolder); } sUserMgr()->unimpersonate(); break; case 'files': sUserMgr()->impersonate(sUserMgr()->getAdministratorID()); $filetypeMgr = new Filetypes(); $objects = sFileMgr()->getList($obj_id, array('SUBNODES'), 'group2.LFT', $maxlevels, $roleid); $objects = sFileMgr()->getAdditionalTreeInfo(false, $objects); $filetypes = $filetypeMgr->getList(); foreach ($objects as $objects_idx => $objects_item) { foreach ($filetypes as $filetypes_item) { if ($objects_item['FILETYPE'] == $filetypes_item['OBJECTID']) {
$pageMgr = new PageMgr($siteID); $page = $pageMgr->getPage($objectID); $objectInfo = $page->get(); $commentsObject = $page->comments; $historyObject = $page->history; $historyType = HISTORYTYPE_PAGE; break; case 'file': $file = sFileMgr()->getFile($objectID); $objectInfo = $file->get(); $commentsObject = $file->comments; $historyObject = $file->history; $historyType = HISTORYTYPE_FILE; break; case 'cblock': $cb = sCblockMgr()->getCblock($objectID); $objectInfo = $cb->get(); $commentsObject = $cb->comments; $historyObject = $cb->history; $historyType = HISTORYTYPE_CO; break; } $hadError = false; $errorCode = NULL; $needFrontEndUpdate = false; foreach ($commentIDs as $commentID) { $result = $commentsObject->remove($objectID, $commentID); if ($result !== ERROR_NONE) { $hadError = true; $errorCode = $result; } else {
} } } if ($listViewExtensionId) { // Get entries for special from chosen extension $objectInfo = $extensionMgr->get($listViewExtensionId); if ($objectInfo["CODE"]) { $extension = $extensionMgr->getExtension($objectInfo["CODE"]); if ($extension && $objectInfo["INSTALLED"]) { $extensionProperties = $extension->properties; $listColumns = $extension->getListColumns(); if (strtoupper($this->page) == 'CONTENTBLOCK_LISTITEM') { $filterArray = array(array('CBID' => $coId)); } else { // Get additional information about contentblock $cb = sCblockMgr()->getCblock($coFolderID); $coInfo = $cb->get(); $coListCount = $extension->getCblockListCount($coFolderID, "SUBNODES", $coInfo['LEVEL'] + 1, 0, array()); // for paging $pageDirInfo = calcPageDir($coListCount, '0', 'ASC'); //$pageDirOrderBy = $pageDirInfo['pageDirOrderBy']; //$pageDirOrderDir = $pageDirInfo['pageDirOrderDir']; $pageDirOrderBy = $sortcol; $pageDirOrderDir = $sortorder; $pageDirLimit = explode(',', $pageDirInfo['pageDirLimit']); $pageDirLimitFrom = $pageDirLimit[0]; $pageDirLimitLength = $pageDirLimit[1]; // END for paging $filterArray = array(); $filterArray[] = array('TYPE' => 'LIMITER', 'VALUE' => $pageDirLimitFrom, 'VALUE2' => $pageDirLimitLength); $filterArray[] = array('TYPE' => 'ORDER', 'VALUE' => $pageDirOrderBy, 'VALUE2' => $pageDirOrderDir);
$file = sFileMgr()->getFile($tagged_file_item['OBJECTID']); if ($file) { $objectInfo = $file->get(); $pr = sFileMgr()->getParents($tagged_file_item['OBJECTID']); array_pop($pr); $objectparents = $pr; array_push($incoming_files, array('ID' => $tagged_file_item['OBJECTID'], 'NAME' => $objectInfo['NAME'], 'PARENTS' => $objectparents, 'IDENTIFIER' => $objectInfo['IDENTIFIER'], 'CODE' => $objectInfo['CODE'], 'COLOR' => $objectInfo['COLOR'], 'FOLDER' => $objectInfo['FOLDER'])); } } // Get all cos with this tag $filterArray = array(); $filterArray[] = array('TYPE' => 'DELETED', 'OPERATOR' => 'is_not', 'VALUE' => 1); $tagged_cos = sCblockMgr()->tags->getByTag($tag_id, "OBJECTORDER DESC", "OR", false, $filterArray); foreach ($tagged_cos as $tagged_co_item) { $pr = sCblockMgr()->getParents($tagged_co_item['OBJECTID']); $cb = sCblockMgr()->getCblock($tagged_co_item['OBJECTID']); $cblockInfo = $cb->get(); $cblockInfo['RWRITE'] = $cb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $tagged_co_item['OBJECTID'], "RWRITE"); $cblockInfo['RDELETE'] = $cb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $tagged_co_item['OBJECTID'], "RDELETE"); $styleData = getStyleForContentblock($cblockInfo, true); array_pop($pr); $objectparents = $pr; array_push($incoming_cos, array('ID' => $cblockInfo['OBJECTID'], 'STYLE' => $styleData, 'NAME' => $cblockInfo['NAME'], 'FOLDER' => $cblockInfo['FOLDER'], 'PARENTS' => $objectparents)); } // Get all mailings with this tag $filterArray = array(); $filterArray[] = array('TYPE' => 'DELETED', 'OPERATOR' => 'is_not', 'VALUE' => 1); $tagged_mailings = sMailingMgr()->tags->getByTag($tag_id, "OBJECTORDER DESC", "OR", false, $filterArray); foreach ($tagged_mailings as $tagged_mailing_item) { $pr = sMailingMgr()->getParents($tagged_mailing_item['OBJECTID']); $mailing = sMailingMgr()->getMailing($tagged_mailing_item['OBJECTID']);