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']) { $objects[$objects_idx]['TYPEINFO'] = $filetypes_item; } } } sUserMgr()->unimpersonate(); break; case 'tags': sUserMgr()->impersonate(sUserMgr()->getAdministratorID()); $tagMgr = new Tags();
<?php $jsQueue = new JSQueue(NULL); $reftracker = new Reftracker(); $viewMgr = new Views(); $filetypeMgr = new Filetypes(); switch ($action) { case 'getFileInfo': $fileID = $this->params['fileID']; $jsQueue->add($fileID, HISTORYTYPE_FILE, 'SET_FILEINFOS', sGuiUS(), NULL); break; case 'saveViews': $widprefix = $this->params['wid']; $view_ids = $this->params[$widprefix . '_view_ids[]']; $view_ids = explode(',', $view_ids); $view_del_ids = $this->params[$widprefix . '_view_del_ids[]']; $view_del_ids = explode(',', $view_del_ids); foreach ($view_del_ids as $view_del_id) { $viewMgr->remove($view_del_id); } $view_info = array(); foreach ($view_ids as $view_id) { $view_info_item['ID'] = $view_id; $view_info_item['NAME'] = $this->params[$widprefix . '_view_' . $view_id . '_name']; $view_info_item['IDENTIFIER'] = $this->params[$widprefix . '_view_' . $view_id . '_identifier']; $view_info_item['WIDTH'] = $this->params[$widprefix . '_view_' . $view_id . '_width']; $view_info_item['HEIGHT'] = $this->params[$widprefix . '_view_' . $view_id . '_height']; $view_info_item['CONSTRAINWIDTH'] = $this->params[$widprefix . '_view_' . $view_id . '_constrainwidth']; $view_info_item['CONSTRAINHEIGHT'] = $this->params[$widprefix . '_view_' . $view_id . '_constrainheight']; $view_info_item['WIDTHCROP'] = $this->params[$widprefix . '_view_' . $view_id . '_widthcrop']; $view_info_item['HEIGHTCROP'] = $this->params[$widprefix . '_view_' . $view_id . '_heightcrop'];
if ($controlFormfields[$w]['FORMFIELD'] == 8) { $pageMgr = new PageMgr($co_site); $info = $pageMgr->tags->get($controlFormfields[$w]['VALUE01']); $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME']; } } $cos[0]['ENTRYMASKS'][$c]['FORMFIELDS'] = $controlFormfields; } $cos[0]['LINKID'] = $cos[0]['ENTRYMASKS'][0]['LINKID']; $output = $cos; } } } elseif (substr($objectType, 0, 3) == 'ext') { // extension mode $extensionMgr = new ExtensionMgr(); $filetypeMgr = new Filetypes(); $loop = 0; foreach ($data as $item) { $coid = $item[0]; $contentarea = $item[1]; $contentarea_id = $item[2]; $colnkid = $item[3]; $extension_id = explode('-', $item[3]); $extension_id = $extension_id[1]; $ex = $extensioninfo = $extensionMgr->get($extension_id); $extension = $extensionMgr->getExtension($ex["CODE"], $pageID, $pageInfo['VERSION'], $siteID); if ($extension) { $props = $extension->properties->getList('LISTORDER'); foreach ($props as $prop_idx => $prop) { $props[$prop_idx]['VALUE'] = $extension->properties->getValueInternal($prop['IDENTIFIER']); if ($props[$prop_idx]['TYPE'] == 'LIST') {
function getAdditionalFormfieldData(&$controlFormfields) { $entrymaskMgr = new Entrymasks(); $tagMgr = new Tags(); $filetypeMgr = new Filetypes(); for ($w = 0; $w < count($controlFormfields); $w++) { $controlFormfields[$w]['LVALUES'] = NULL; $controlFormfields[$w]['DISPLAYNAME'] = NULL; // Date & Datetime if ($controlFormfields[$w]['TYPE'] == 'DATE' || $controlFormfields[$w]['TYPE'] == 'DATETIME') { if ($controlFormfields[$w]['VALUE']) { $controlFormfields[$w]['VALUE'] = TStoLocalTS($controlFormfields[$w]['VALUE']); } } // Link if ($controlFormfields[$w]['TYPE'] == 'LINK') { $special_url = resolveSpecialURL($controlFormfields[$w]['URL']); if ($special_url !== false) { $special_url_info = getSpecialURLInfo($controlFormfields[$w]['VALUE01']); if ($special_url_info['TYPE'] == 'IMG' || $special_url_info['TYPE'] == 'DOWN') { $controlFormfields[$w]['IS_FILE'] = true; $file = sFileMgr()->getFile($special_url_info['ID']); $link_fileinfo = $file->get(); $controlFormfields[$w]['DISPLAYNAME'] = $link_fileinfo['NAME']; $link_filetype = $filetypeMgr->get($link_fileinfo['FILETYPE']); $controlFormfields[$w]['IDENTIFIER'] = $link_filetype['IDENTIFIER']; $controlFormfields[$w]['TYPECODE'] = $link_filetype['CODE']; $controlFormfields[$w]['COLOR'] = $link_filetype['COLOR']; $controlFormfields[$w]['FILE_ID'] = $special_url_info['ID']; } else { $pageMgr = new PageMgr($special_url_info['SITE']); $page = $pageMgr->getPage($special_url_info['ID']); $link_pageInfo = $page->get(); $controlFormfields[$w]['DISPLAYNAME'] = $link_pageInfo['NAME']; $controlFormfields[$w]['IS_INTERNAL'] = true; } } else { if (preg_match_all(sApp()->URLRegEx1, $controlFormfields[$w]['VALUE01'], $internal) > 0) { if ($internal[2][0] == 'download') { $controlFormfields[$w]['IS_FILE'] = true; $link_file = str_replace('/', '', $internal[3][0]); $file = sFileMgr()->getFile($link_file); $link_fileinfo = $file->get(); $controlFormfields[$w]['DISPLAYNAME'] = $link_fileinfo['NAME']; $link_filetype = $filetypeMgr->get($link_fileinfo['FILETYPE']); $controlFormfields[$w]['IDENTIFIER'] = $link_filetype['IDENTIFIER']; $controlFormfields[$w]['TYPECODE'] = $link_filetype['CODE']; $controlFormfields[$w]['COLOR'] = $link_filetype['COLOR']; $controlFormfields[$w]['FILE_ID'] = $link_file; } else { $link_site = $internal[3][0]; $link_page = str_replace('/', '', $internal[5][0]); $pageMgr = new PageMgr($link_site); $page = $pageMgr->getPage($link_page); $link_pageInfo = $page->get(); $controlFormfields[$w]['DISPLAYNAME'] = $link_pageInfo['NAME']; $controlFormfields[$w]['IS_INTERNAL'] = true; } } elseif (substr($controlFormfields[$w]['URL'], 0, 7) == 'mailto:') { $controlFormfields[$w]['IS_EMAIL'] = true; } else { $linkInfo = checkLinkInternalExternal($controlFormfields[$w]['URL']); switch ($linkInfo['TYPE']) { case 'external': $controlFormfields[$w]['DISPLAYNAME'] = $controlFormfields[$w]['URL']; break; case 'internal': $controlFormfields[$w]['DISPLAYNAME'] = $linkInfo['NAME']; $controlFormfields[$w]['IS_INTERNAL'] = true; break; case 'file': $controlFormfields[$w]['IS_FILE'] = true; $controlFormfields[$w]['DISPLAYNAME'] = $linkInfo['NAME']; $controlFormfields[$w]['IDENTIFIER'] = $linkInfo['INFO']['IDENTIFIER']; $controlFormfields[$w]['TYPECODE'] = $linkInfo['INFO']['CODE']; $controlFormfields[$w]['COLOR'] = $linkInfo['INFO']['COLOR']; $controlFormfields[$w]['FILE_ID'] = $linkInfo['INFO']['FILE_ID']; break; } } } } // File if ($controlFormfields[$w]['TYPE'] == 'FILE') { if (trim($controlFormfields[$w]['FILE_ID'])) { $file = sFileMgr()->getFile($controlFormfields[$w]['FILE_ID']); if ($file) { $fileInfo = $file->get(); $controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME']; $controlFormfields[$w]['IDENTIFIER'] = $fileInfo['IDENTIFIER']; $controlFormfields[$w]['TYPECODE'] = $fileInfo['CODE']; $controlFormfields[$w]['COLOR'] = $fileInfo['COLOR']; } } } // File if ($controlFormfields[$w]['TYPE'] == 'FILEFOLDER') { if (trim($controlFormfields[$w]['FILE_ID'])) { $file = sFileMgr()->getFile($controlFormfields[$w]['FILE_ID']); if ($file) { $fileInfo = $file->get(); $controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME']; } } } // Contentblock if ($controlFormfields[$w]['TYPE'] == 'CO') { if (trim($controlFormfields[$w]['CBLOCK_ID'])) { $cb = sCblockMgr()->getCblock($controlFormfields[$w]['CBLOCK_ID']); $info = $cb->get(); $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME']; } } // Tag if ($controlFormfields[$w]['TYPE'] == 'TAG') { if (trim($controlFormfields[$w]['TAG_ID'])) { $info = $tagMgr->get($controlFormfields[$w]['TAG_ID']); $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME']; } } // Page if ($controlFormfields[$w]['TYPE'] == 'PAGE') { if (trim($controlFormfields[$w]['SITE_ID']) && trim($controlFormfields[$w]['PAGE_ID'])) { $tmpPageMgr = new PageMgr($controlFormfields[$w]['SITE_ID']); $tmpPage = $tmpPageMgr->getPage($controlFormfields[$w]['PAGE_ID']); $info = $tmpPage->get(); $info['RWRITE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $controlFormfields[$w]['PAGE_ID'], "RWRITE"); $info['RDELETE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $controlFormfields[$w]['PAGE_ID'], "RDELETE"); $iconData = getIconForPage($info); $controlFormfields[$w]['ICON'] = $iconData['iconclass']; $controlFormfields[$w]['STYLE'] = $iconData['style']; $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME']; } } // List if ($controlFormfields[$w]['TYPE'] == 'LIST') { if (trim($controlFormfields[$w]['ENTRYMASKFORMFIELD'])) { $controlFormfields[$w]['LIST_VALUES'] = $entrymaskMgr->getListValuesByLinkID($controlFormfields[$w]['ENTRYMASKFORMFIELD']); } } } }