/** * Copies Extensions from another Mailing to this Mailing * * @param object $sourceObject Source Mailing object */ function copyExtensionsFrom(&$sourceObject) { $sourceId = $sourceObject->getID(); $sourceVersion = $sourceObject->getVersion(); $targetId = $this->getID(); $targetVersion = $this->getVersion(); $extensions = new ExtensionMgr(sYDB(), $this->_uid); $all_extensions = $extensions->getList(EXTENSION_MAILING, true); foreach ($all_extensions as $all_extension) { $extension = $extensions->getExtension($all_extension['CODE']); if ($extension && $extension->usedByMailing($sourceId, $sourceVersion) === true) { if ($extension->usedByMailing($targetId, $targetVersion) !== true) { $newfid = $extension->addToMailingInternal($targetId, $targetVersion); } $extension = $extensions->getExtension($all_extension['CODE'], $targetId, $targetVersion); $sourceext = $extensions->getExtension($all_extension['CODE'], $sourceId, $sourceVersion); if ($extension && $sourceext) { $newfid = $extension->getPropertyId(); $oldfid = $sourceext->getPropertyId(); $extension->properties->copyTo($oldfid, $newfid); } } } }
$listViewExtensionId = $this->request->parameters['listViewExtensionId']; $wid_id = explode('_', $wid); $wid_id = $wid_id[1]; $coFolderID = explode('-', $ygid); $coFolderID = $coFolderID[0]; $sortcol = $this->request->parameters['pagedir_orderby']; $sortorder = $this->request->parameters['pagedir_orderdir']; if ($sortcol == NULL) { $sortcol = 0; } if ($sortorder == NULL) { $sortorder = 1; } // Get all listview extensions $extensionMgr = new ExtensionMgr(); $listviewExtensions = $extensionMgr->getList(EXTENSION_CBLOCKLISTVIEW, true); // Check if a special listview was chosen if ($listViewExtensionId == '') { $listViewExtensionId = 0; } if ($listViewExtensionId == 0) { // Find default extension foreach ($listviewExtensions as $listviewExtension) { if ($listviewExtension['CODE'] == 'defaultCblockListView') { $listViewExtensionId = $listviewExtension['ID']; $isDefaultExtension = true; } } } if ($listViewExtensionId) { // Get entries for special from chosen extension
} else { $newPage = $TargetPageMgr->getPage($newPageID); $newPage->copyFrom($sourcePage); // Copy PName (and generate new, if needed) $sourcePName = $oldPageInfo['PNAME']; if (!$sourcePName) { $sourcePName = $oldPageInfo['NAME']; } if ($TargetPageMgr->getPageIdByPname($sourcePName)) { $sourcePName = $newPage->calcPName(); } $newPage->setPName($sourcePName); $newPage->setActive(1); $jsQueue->add($newPageID, HISTORYTYPE_PAGE, 'PAGE_ADD', sGuiUS(), NULL); // Check for extensions to copy $all_page_extensions = $extensionMgr->getList(EXTENSION_PAGE, true); $used_extensions = array(); $used_extensions_info = array(); foreach ($all_page_extensions as $all_page_extension) { $extension = $extensionMgr->getExtension($all_page_extension["CODE"]); if ($extension && $extension->usedByPage($source, $oldPageInfo['VERSION'], $sourcesite) === true) { $tmpExtension = $extensionMgr->getExtension($all_page_extension["CODE"], $source, $oldPageInfo['VERSION'], $sourcesite); if ($tmpExtension) { array_push($used_extensions_info, $all_page_extension); array_push($used_extensions, $tmpExtension); } } } foreach ($used_extensions as $used_extension_idx => $used_extension) { $used_extensions_info[$used_extension_idx]['PROPERTIES'] = $used_extension->properties->getList(); }
/** * Calls a specific Extension hook Callback method * * @param string $method * @param int $fileId File Id * @param int $version File version * @param mixed $args Arbitrary arguments */ function callExtensionHook($method, $fileId, $version, $args) { $extensions = new ExtensionMgr($this->_db, $this->_uid); $all_file_extensions = $extensions->getList(EXTENSION_FILE, true); $extarr = array(); foreach ($all_file_extensions as $all_file_extension) { $extension = $extensions->getExtension($all_file_extension['CODE']); if ($extension && $extension->usedByFile($fileId, $version) === true) { $extension = $extensions->getExtension($all_file_extension['CODE'], $fileId, $version); if ($extension) { array_push($extarr, $extension); } } } foreach ($extarr as $extension) { $extension->callExtensionHook($method, $args); } }
$roleid = $this->request->parameters['yg_id']; $roleid = explode('-', $roleid); $roleid = $roleid[0]; $isRORole = false; // Check if role is rootrole $rootGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTGROUPID"); $anonGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ANONGROUPID"); if ($rootGroupId == $roleid) { $isRORole = true; } $maxlevels = 3; $objecttype = $site = 'system'; $privileges = sUsergroups()->permissions->getByUsergroup($roleid); $objects = array(array('ID' => 99, 'NAME' => $itext['TXT_PERM_YEAGER_LOGIN'] ? $itext['TXT_PERM_YEAGER_LOGIN'] : '******', 'LEVEL' => 1, 'PARENT' => 0, 'RREAD' => $privileges['RBACKEND'], 'CHILDREN' => 25), array('ID' => 1, 'NAME' => $itext['TXT_PERM_PAGES'] ? $itext['TXT_PERM_PAGES'] : '$TXT_PERM_PAGES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RPAGES']), array('ID' => 2, 'NAME' => $itext['TXT_PERM_CONTENTBLOCKS'] ? $itext['TXT_PERM_CONTENTBLOCKS'] : 'TXT_PERM_CONTENTBLOCKS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RCONTENTBLOCKS']), array('ID' => 3, 'NAME' => $itext['TXT_PERM_FILES'] ? $itext['TXT_PERM_FILES'] : '$TXT_PERM_FILES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RFILES']), array('ID' => 4, 'NAME' => $itext['TXT_PERM_TAGS'] ? $itext['TXT_PERM_TAGS'] : '$TXT_PERM_TAGS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RTAGS']), array('ID' => 21, 'NAME' => $itext['TXT_PERM_COMMENTS'] ? $itext['TXT_PERM_COMMENTS'] : '$TXT_PERM_COMMENTS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RCOMMENTS']), array('ID' => 19, 'NAME' => $itext['TXT_PERM_MAILINGS'] ? $itext['TXT_PERM_MAILINGS'] : '$TXT_PERM_MAILINGS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RMAILINGS']), array('ID' => 12, 'NAME' => $itext['TXT_PERM_TEMPLATES'] ? $itext['TXT_PERM_TEMPLATES'] : '$TXT_PERM_TEMPLATES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RTEMPLATES']), array('ID' => 13, 'NAME' => $itext['TXT_PERM_ENTRYMASKS'] ? $itext['TXT_PERM_ENTRYMASKS'] : '$TXT_PERM_ENTRYMASKS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RENTRYMASKS']), array('ID' => 11, 'NAME' => $itext['TXT_PERM_SITES'] ? $itext['TXT_PERM_SITES'] : '$TXT_PERM_SITES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RSITES']), array('ID' => 10, 'NAME' => $itext['TXT_PERM_DATA'] ? $itext['TXT_PERM_DATA'] : '$TXT_PERM_DATA', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RDATA']), array('ID' => 5, 'NAME' => $itext['TXT_PERM_USER'] ? $itext['TXT_PERM_USER'] : '******', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RUSERS']), array('ID' => 6, 'NAME' => $itext['TXT_PERM_USERGROUPS'] ? $itext['TXT_PERM_USERGROUPS'] : '$TXT_PERM_USERGROUPS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RUSERGROUPS']), array('ID' => 14, 'NAME' => $itext['TXT_PERM_PROPERTIES'] ? $itext['TXT_PERM_PROPERTIES'] : '$TXT_PERM_PROPERTIES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RPROPERTIES']), array('ID' => 15, 'NAME' => $itext['TXT_PERM_FILETYPES'] ? $itext['TXT_PERM_FILETYPES'] : '$TXT_PERM_FILETYPES', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RFILETYPES']), array('ID' => 16, 'NAME' => $itext['TXT_PERM_VIEWS'] ? $itext['TXT_PERM_VIEWS'] : '$TXT_PERM_VIEWS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RVIEWS']), array('ID' => 17, 'NAME' => $itext['TXT_PERM_COMMENTS_CONFIG'] ? $itext['TXT_PERM_COMMENTS_CONFIG'] : '$TXT_PERM_COMMENTS_CONFIG', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RCOMMENTCONFIG']), array('ID' => 20, 'NAME' => $itext['TXT_PERM_MAILINGS_CONFIG'] ? $itext['TXT_PERM_MAILINGS_CONFIG'] : '$TXT_PERM_MAILINGS_CONFIG', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RMAILINGCONFIG']), array('ID' => 7, 'NAME' => $itext['TXT_PERM_PAGE_EXTENSIONS'] ? $itext['TXT_PERM_PAGE_EXTENSIONS'] : '$TXT_PERM_PAGE_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXTENSIONS_PAGE']), array('ID' => 22, 'NAME' => $itext['TXT_PERM_MAILING_EXTENSIONS'] ? $itext['TXT_PERM_MAILING_EXTENSIONS'] : '$TXT_PERM_MAILING_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXTENSIONS_MAILING']), array('ID' => 23, 'NAME' => $itext['TXT_PERM_FILE_EXTENSIONS'] ? $itext['TXT_PERM_FILE_EXTENSIONS'] : '$TXT_PERM_FILE_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXTENSIONS_FILE']), array('ID' => 24, 'NAME' => $itext['TXT_PERM_CBLOCK_EXTENSIONS'] ? $itext['TXT_PERM_CBLOCK_EXTENSIONS'] : '$TXT_PERM_CBLOCK_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXTENSIONS_CBLOCK']), array('ID' => 8, 'NAME' => $itext['TXT_PERM_IMPORT_EXTENSIONS'] ? $itext['TXT_PERM_IMPORT_EXTENSIONS'] : '$TXT_PERM_IMPORT_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RIMPORT']), array('ID' => 9, 'NAME' => $itext['TXT_PERM_EXPORT_EXTENSIONS'] ? $itext['TXT_PERM_EXPORT_EXTENSIONS'] : '$TXT_PERM_EXPORT_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXPORT']), array('ID' => 18, 'NAME' => $itext['TXT_PERM_COLISTVIEW_EXTENSIONS'] ? $itext['TXT_PERM_COLISTVIEW_EXTENSIONS'] : '$TXT_PERM_COLISTVIEW_EXTENSIONS', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['REXTENSIONS_CBLISTVIEW']), array('ID' => 25, 'NAME' => $itext['TXT_PERM_UPDATER'] ? $itext['TXT_PERM_UPDATER'] : '$TXT_PERM_UPDATER', 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $privileges['RUPDATER'])); $extensionMgr = new ExtensionMgr(); $extensions = $extensionMgr->getList(0, true, true); foreach ($extensions as $extensionItem) { $extPrivileges = sUsergroups()->permissions->getList($extensionItem['CODE']); if (count($extPrivileges) > 0) { foreach ($extPrivileges as $extPrivilegeItem) { $permissions = sUsergroups()->permissions->getByUsergroup($roleid, $extensionItem['CODE']); $permValue = $permissions[$extPrivilegeItem['PRIVILEGE']]; $objects[] = array('ID' => (int) $extPrivilegeItem['ID'] + 1000, 'NAME' => $extPrivilegeItem['NAME'], 'LEVEL' => 2, 'PARENT' => 99, 'RREAD' => $permValue); } } } $objects[0]['CHILDREN'] = count($objects) - 1; $objectInfo = sUsergroups()->get($roleid); $object_permissions = array(); $object_permissions["RWRITE"] = sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $roleid, "RWRITE"); $smarty->assign('isRORole', $isRORole);
$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"]); if ($extension && $extension->usedByCblock($objectID, $cblockInfo['VERSION']) === true) { $extension = $extensionMgr->getExtension($all_cblock_extension["CODE"], $objectID, $cblockInfo['VERSION']); if ($extension) { array_push($used_extensions_info, $all_cblock_extension); array_push($used_extensions, $extension); } } } $object_property_ids = array(); foreach ($used_extensions as $used_extension_idx => $used_extension) { // Call callback
/** * Calls a specific Extension hook Callback method * * @param string $callbackName * @param mixed ... (any type of parameters) */ function callExtensionHook() { $args = func_get_args(); $extensionMgr = new ExtensionMgr(); $all_extensions = $extensionMgr->getList(EXTENSION_ALL, true); foreach ($all_extensions as $all_extension_item) { $extension = $extensionMgr->getExtension($all_extension_item['CODE']); if ($extension) { return call_user_func_array(array($extension, 'callExtensionHook'), $args); } } }
/** * Calls a specific Extension hook Callback method * * @param string $method * @param int $mailingId Mailing Id * @param int $version Mailing version * @param mixed $args Arbitrary arguments */ function callExtensionHook($method, $mailingId, $version, $args) { $extensions = new ExtensionMgr($this->_db, $this->_uid); $all_mailing_extensions = $extensions->getList(EXTENSION_MAILING, true); $extarr = array(); foreach ($all_mailing_extensions as $all_mailing_extension) { $extension = $extensions->getExtension($all_mailing_extension['CODE']); if ($extension && $extension->usedByMailing($mailingId, $version) === true) { $extension = $extensions->getExtension($all_mailing_extension['CODE'], $mailingId, $version); if ($extension) { array_push($extarr, $extension); } } } $origargs = $args; $ext_result = false; foreach ($extarr as $extension) { $ext_result = $extension->callExtensionHook($method, $args); if ($ext_result && $method == "beforeSend") { $args = $ext_result; } } if ($ext_result === false) { return $origargs; } else { return $ext_result; } }
$addFunc = 'addToPage'; $isUsedFunc = 'usedByPage'; $historySuffix = 'PAGE'; $historyType = HISTORYTYPE_PAGE; $extensionType = EXTENSION_PAGE; $jsQueue = new JSQueue(NULL, $siteID); $object = $page; break; } if ($extension->{$addFunc}($pageID, $pageInfo['VERSION'], $siteID) === false) { $koala->alert($itext['TXT_ERROR_ACCESS_DENIED']); } else { // Add to history $object->history->add($historyType, '', $objectInfo['NAME'], 'TXT_OBJECT_H_EXTADD', $objectInfo['ID']); /* Re-get all extensions in object */ $all_page_extensions = $extensionMgr->getList($extensionType, true); $used_extensions_ids = array(); foreach ($all_page_extensions as $all_page_extension) { $extension = $extensionMgr->getExtension($all_page_extension['CODE']); if ($extension && $extension->{$isUsedFunc}($pageID, $pageInfo['VERSION'], $siteID) === true) { array_push($used_extensions_ids, $all_page_extension['ID']); } } $dta_cnt = 0; $js_array = '[ '; foreach ($used_extensions_ids as $extension_list_item) { $dta_cnt++; $js_array .= "[ '" . $pageID . "', '" . ($itext['TXT_EXTENSIONS'] != '' ? $itext['TXT_EXTENSIONS'] : '$TXT_EXTENSIONS') . "', '0', 'extension-" . $extension_list_item . "' ], "; } $js_array = substr($js_array, 0, strlen($js_array) - 2); $js_array .= ' ]';
$adminAllowed = $tmpUser->checkPermission('RDATA'); switch ($extensiontype) { default: case 'import': $extensiontype = EXTENSION_IMPORT; break; case 'export': $extensiontype = EXTENSION_EXPORT; break; } break; } if ($adminAllowed) { $extensionMgr = new ExtensionMgr(); $extensionMgr->refreshList($this->approot . $this->extensiondir); $extensions = $extensionMgr->getList($extensiontype, $only_installed, true); // Filter out self-controlled extensions if ($selectiondialog || $objecttype == 'data') { $real_extensions = array(); foreach ($extensions as $extensionItem) { $currExtension = $extensionMgr->getExtension($extensionItem['CODE']); if ($currExtension && $currExtension->info['ASSIGNMENT'] != EXTENSION_ASSIGNMENT_EXT_CONTROLLED) { $real_extensions[] = $extensionItem; } } $extensions = $real_extensions; } } $smarty->assign('mode', $mode); $smarty->assign('extensioncount', count($extensions)); $smarty->assign('extensions', $extensions);
/** * Calls a specific Extension hook Callback method * * @param string $method * @param int $siteId Site Id * @param int $pageId Page Id * @param int $version Page version * @param mixed $args Arbitrary arguments */ function callExtensionHook($method, $siteId, $pageId, $version, $args) { $extensions = new ExtensionMgr($this->_db, $this->_uid); $all_page_extensions = $extensions->getList(EXTENSION_PAGE, true); $extarr = array(); foreach ($all_page_extensions as $all_page_extension) { $extension = $extensions->getExtension($all_page_extension["CODE"]); if ($extension && $extension->usedByPage($pageId, $version, $siteId) === true) { $extension = $extensions->getExtension($all_page_extension["CODE"], $pageId, $version, $siteId); if ($extension) { array_push($extarr, $extension); } } } foreach ($extarr as $extension) { $extension->callExtensionHook($method, $args); } }