/**
	 * @see	wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
	 */
	public function rebuild(array $parameters) {
		$data = array();
		foreach (CategoryHandler::getInstance()->getCategories() as $objectTypeName => $categories) {
			$objectType = CategoryHandler::getInstance()->getObjectTypeByName($objectTypeName);
			$aclObjectType = $objectType->getProcessor()->getObjectTypeName('com.woltlab.wcf.acl');
			if (!$aclObjectType) {
				continue;
			}
			
			$aclOptions = ACLHandler::getInstance()->getPermissions(ACLHandler::getInstance()->getObjectTypeID($aclObjectType), array_keys($categories));
			$options = $aclOptions['options']->getObjects();
			
			$data = array();
			foreach (array('group', 'user') as $type) {
				foreach ($aclOptions[$type] as $categoryID => $optionData) {
					if (!isset($aclValues[$categoryID])) {
						$data[$categoryID] = array(
							'group' => array(),
							'user' => array()
						);
					}
					
					foreach ($optionData as $typeID => $optionValues) {
						$data[$categoryID][$type][$typeID] = array();
						
						foreach ($optionValues as $optionID => $optionValue) {
							$data[$categoryID][$type][$typeID][$options[$optionID]->optionName] = $optionValue;
						}
					}
				}
			}
		}
		
		return $data;
	}
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     $this->groupName = 'wcf.acp.label.group' . $this->group->groupID;
     if (I18nHandler::getInstance()->isPlainValue('groupName')) {
         I18nHandler::getInstance()->remove($this->groupName);
         $this->groupName = I18nHandler::getInstance()->getValue('groupName');
     } else {
         I18nHandler::getInstance()->save('groupName', $this->groupName, 'wcf.acp.label', 1);
     }
     // update label
     $this->objectAction = new LabelGroupAction(array($this->groupID), 'update', array('data' => array_merge($this->additionalFields, array('forceSelection' => $this->forceSelection ? 1 : 0, 'groupName' => $this->groupName, 'groupDescription' => $this->groupDescription, 'showOrder' => $this->showOrder))));
     $this->objectAction->executeAction();
     // update acl
     ACLHandler::getInstance()->save($this->groupID, $this->objectTypeID);
     ACLHandler::getInstance()->disableAssignVariables();
     // update object type relations
     $this->saveObjectTypeRelations($this->groupID);
     foreach ($this->labelObjectTypes as $objectTypeID => $labelObjectType) {
         $labelObjectType->save();
     }
     $this->saved();
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }
 /**
  * @see	\wcf\data\IEditableObject::deleteAll()
  */
 public static function deleteAll(array $objectIDs = array())
 {
     $count = parent::deleteAll($objectIDs);
     // remove ACL values
     $objectTypeID = ACLHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.label');
     ACLHandler::getInstance()->removeValues($objectTypeID, $objectIDs);
     return $count;
 }
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 protected function rebuild(array $parameters)
 {
     $data = array('options' => array(), 'groups' => array());
     // get label groups
     $groupList = new LabelGroupList();
     $groupList->readObjects();
     $groups = $groupList->getObjects();
     foreach ($groups as &$group) {
         $data['groups'][$group->groupID] = new ViewableLabelGroup($group);
     }
     unset($group);
     // get permissions for groups
     $permissions = ACLHandler::getInstance()->getPermissions(ACLHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.label'), array_keys($data['groups']));
     // store options
     $data['options'] = $permissions['options']->getObjects();
     // assign permissions for each label group
     foreach ($data['groups'] as $groupID => $group) {
         // group permissions
         if (isset($permissions['group'][$groupID])) {
             $group->setGroupPermissions($permissions['group'][$groupID]);
         }
         // user permissions
         if (isset($permissions['user'][$groupID])) {
             $group->setUserPermissions($permissions['user'][$groupID]);
         }
     }
     if (count($groupList)) {
         // get labels
         $labelList = new LabelList();
         $labelList->sqlOrderBy = 'label';
         $labelList->readObjects();
         foreach ($labelList as $label) {
             $data['groups'][$label->groupID]->addLabel($label);
         }
     }
     return $data;
 }
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 public function rebuild(array $parameters)
 {
     $data = array();
     $objectTypeName = 'de.codequake.cms.page';
     $pageList = new PageList();
     $pageList->readObjects();
     $pageList = $pageList->getObjects();
     $aclOptions = ACLHandler::getInstance()->getPermissions(ACLHandler::getInstance()->getObjectTypeID($objectTypeName), array_keys($pageList));
     $options = $aclOptions['options']->getObjects();
     foreach (array('group', 'user') as $type) {
         foreach ($aclOptions[$type] as $pageID => $optionData) {
             if (!isset($data[$pageID])) {
                 $data[$pageID] = array('group' => array(), 'user' => array());
             }
             foreach ($optionData as $typeID => $optionValues) {
                 $data[$pageID][$type][$typeID] = array();
                 foreach ($optionValues as $optionID => $optionValue) {
                     $data[$pageID][$type][$typeID][$options[$optionID]->optionName] = $optionValue;
                 }
             }
         }
     }
     return $data;
 }
 /**
  * Returns a set of permissions and their values if applicable.
  * 
  * @return	array
  */
 public function loadAll()
 {
     $objectIDs = $this->parameters['objectID'] ? array($this->parameters['objectID']) : array();
     $permissions = ACLHandler::getInstance()->getPermissions($this->parameters['objectTypeID'], $objectIDs, $this->parameters['categoryName'], true);
     return $permissions;
 }
 /**
  * @see	wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     I18nHandler::getInstance()->assignVariables();
     if (WCF::getSession()->getPermission('admin.project.canEditPermissions')) {
         ACLHandler::getInstance()->assignVariables($this->objectTypeID);
     }
     WCF::getTPL()->assign(array('action' => 'add', 'title' => $this->title, 'subTitle' => $this->subTitle, 'description' => $this->description, 'descriptionUseHtml' => $this->descriptionUseHtml, 'position' => $this->position, 'isInvisible' => $this->isInvisible, 'isClosed' => $this->isClosed, 'issuesPerPage' => $this->issuesPerPage, 'commentsPerPage' => $this->commentsPerPage, 'styleID' => $this->styleID, 'availableStyles' => $this->availableStyles, 'objectTypeID' => $this->objectTypeID));
 }
	/**
	 * @see	wcf\form\IForm::save()
	 */
	public function save() {
		AbstractForm::save();
		
		// handle description
		if ($this->objectType->getProcessor()->hasDescription()) {
			$this->description = $this->objectType->getProcessor()->getI18nLangVarPrefix().'.description.category'.$this->category->categoryID;
			if (I18nHandler::getInstance()->isPlainValue('description')) {
				I18nHandler::getInstance()->remove($this->description, $this->packageID);
				$this->description = I18nHandler::getInstance()->getValue('description');
			}
			else {
				I18nHandler::getInstance()->save('description', $this->description, $this->objectType->getProcessor()->getDescriptionLangVarCategory(), $this->packageID);
			}
		}
		
		// handle title
		$this->title = $this->objectType->getProcessor()->getI18nLangVarPrefix().'.title.category'.$this->category->categoryID;
		if (I18nHandler::getInstance()->isPlainValue('title')) {
			I18nHandler::getInstance()->remove($this->title, $this->packageID);
			$this->title = I18nHandler::getInstance()->getValue('title');
		}
		else {
			I18nHandler::getInstance()->save('title', $this->title, $this->objectType->getProcessor()->getTitleLangVarCategory(), $this->packageID);
		}
		
		// update category
		$this->objectAction = new CategoryAction(array($this->category), 'update', array(
			'data' => array(
				'additionalData' => serialize($this->additionalData),
				'description' => $this->description,
				'isDisabled' => $this->isDisabled,
				'parentCategoryID' => $this->parentCategoryID,
				'showOrder' => $this->showOrder,
				'title' => $this->title
			)
		));
		$this->objectAction->executeAction();
		
		// update acl
		if ($this->aclObjectTypeID) {
			ACLHandler::getInstance()->save($this->category->categoryID, $this->aclObjectTypeID);
			CategoryPermissionHandler::getInstance()->resetCache();
		}
		
		// reload cache
		CategoryHandler::getInstance()->reloadCache();
		
		$this->saved();
		
		// show success message
		WCF::getTPL()->assign('success', true);
	}
Beispiel #9
0
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     I18nHandler::getInstance()->assignVariables();
     ACLHandler::getInstance()->assignVariables($this->objectTypeID);
     WCF::getTPL()->assign(array('action' => 'add', 'availableStyles' => $this->availableStyles, 'menuItems' => $this->menuItems, 'objectTypeID' => $this->objectTypeID, 'pageList' => $this->pageList, 'stylesheetList' => $this->stylesheetList->getObjects(), 'title' => $this->title, 'alias' => $this->alias, 'description' => $this->description, 'createMenuItem' => $this->createMenuItem, 'metaDescription' => $this->metaDescription, 'metaKeywords' => $this->metaKeywords, 'allowIndexing' => $this->allowIndexing, 'parentID' => $this->parentID, 'showOrder' => $this->showOrder, 'invisible' => $this->invisible, 'enableDelayedDeactivation' => $this->enableDelayedDeactivation, 'publicationDate' => $this->publicationDate, 'enableDelayedPublication' => $this->enableDelayedPublication, 'deactivationDate' => $this->deactivationDate, 'menuItemID' => $this->menuItemID, 'isCommentable' => $this->isCommentable, 'availableDuringOfflineMode' => $this->availableDuringOfflineMode, 'allowSubscribing' => $this->allowSubscribing, 'styleID' => $this->styleID, 'stylesheetIDs' => $this->stylesheetIDs, 'sidebarOrientation' => $this->sidebarOrientation));
 }
Beispiel #10
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     // save multilingual inputs
     $languageVariable = 'cms.page.title' . $this->pageID;
     if (I18nHandler::getInstance()->isPlainValue('title')) {
         I18nHandler::getInstance()->remove($languageVariable);
     } else {
         I18nHandler::getInstance()->save('title', $languageVariable, 'cms.page');
         $this->title = $languageVariable;
     }
     $languageVariable = 'cms.page.description' . $this->pageID;
     if (I18nHandler::getInstance()->isPlainValue('description')) {
         I18nHandler::getInstance()->remove($languageVariable);
     } else {
         I18nHandler::getInstance()->save('description', $languageVariable, 'cms.page');
         $this->description = $languageVariable;
     }
     $languageVariable = 'cms.page.metaDescription' . $this->pageID;
     if (I18nHandler::getInstance()->isPlainValue('metaDescription')) {
         I18nHandler::getInstance()->remove($languageVariable);
     } else {
         I18nHandler::getInstance()->save('metaDescription', $languageVariable, 'cms.page');
         $this->metaDescription = $languageVariable;
     }
     $languageVariable = 'cms.page.metaKeywords' . $this->pageID;
     if (I18nHandler::getInstance()->isPlainValue('metaKeywords')) {
         I18nHandler::getInstance()->remove($languageVariable);
     } else {
         I18nHandler::getInstance()->save('metaKeywords', $languageVariable, 'cms.page');
         $this->metaKeywords = $languageVariable;
     }
     $data = array('title' => $this->title, 'alias' => $this->alias, 'description' => $this->description, 'metaDescription' => $this->metaDescription, 'metaKeywords' => $this->metaKeywords, 'allowIndexing' => $this->allowIndexing, 'parentID' => $this->parentID ?: null, 'showOrder' => $this->showOrder, 'invisible' => $this->invisible, 'menuItemID' => $this->menuItemID ?: null, 'isCommentable' => $this->isCommentable, 'availableDuringOfflineMode' => $this->availableDuringOfflineMode, 'allowSubscribing' => $this->allowSubscribing, 'styleID' => $this->styleID ?: null, 'sidebarOrientation' => $this->sidebarOrientation);
     // publication
     if ($this->enableDelayedPublication) {
         $data['isPublished'] = 0;
         $data['publicationDate'] = @strtotime($this->publicationDate);
     } else {
         $data['isPublished'] = 1;
     }
     if ($this->enableDelayedDeactivation) {
         $data['isDisabled'] = 0;
         $data['deactivationDate'] = @strtotime($this->publicationDate);
     }
     $pageData = array('data' => $data, 'stylesheetIDs' => $this->stylesheetIDs);
     $this->objectAction = new PageAction(array($this->pageID), 'update', $pageData);
     $this->objectAction->executeAction();
     // save ACL
     ACLHandler::getInstance()->save($this->pageID, $this->objectTypeID);
     // create revision
     $objectAction = new PageAction(array($this->pageID), 'createRevision', array('action' => 'update'));
     $objectAction->executeAction();
     // update search index
     $objectAction = new PageAction(array($this->pageID), 'refreshSearchIndex');
     $objectAction->executeAction();
     $this->saved();
     WCF::getTPL()->assign('success', true);
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     ACLHandler::getInstance()->assignVariables($this->objectTypeID);
     I18nHandler::getInstance()->assignVariables();
     WCF::getTPL()->assign(array('action' => 'add', 'forceSelection' => $this->forceSelection, 'groupName' => $this->groupName, 'groupDescription' => $this->groupDescription, 'labelObjectTypeContainers' => $this->labelObjectTypeContainers, 'objectTypeID' => $this->objectTypeID, 'showOrder' => $this->showOrder));
 }
	/**
	 * @see	wcf\page\IForm::save()
	 */
	public function save() {
		parent::save();
		
		$this->objectAction = new CategoryAction(array(), 'create', array(
			'data' => array(
				'additionalData' => serialize($this->additionalData),
				'description' => $this->description,
				'isDisabled' => $this->isDisabled,
				'objectTypeID' => $this->objectType->objectTypeID,
				'parentCategoryID' => $this->parentCategoryID,
				'showOrder' => $this->showOrder > 0 ? $this->showOrder : null,
				'title' => $this->title
			)
		));
		$this->objectAction->executeAction();
		$returnValues = $this->objectAction->getReturnValues();
		
		if (($this->objectType->getProcessor()->hasDescription() && !I18nHandler::getInstance()->isPlainValue('description')) || !I18nHandler::getInstance()->isPlainValue('title')) {
			$categoryID = $returnValues['returnValues']->categoryID;
			
			$updateData = array();
			if ($this->objectType->getProcessor()->hasDescription() && !I18nHandler::getInstance()->isPlainValue('description')) {
				$updateData['description'] = $this->objectType->getProcessor()->getI18nLangVarPrefix().'.description.category'.$categoryID;
				I18nHandler::getInstance()->save('description', $updateData['description'], $this->objectType->getProcessor()->getDescriptionLangVarCategory(), $this->packageID);
			}
			if (!I18nHandler::getInstance()->isPlainValue('title')) {
				$updateData['title'] = $this->objectType->getProcessor()->getI18nLangVarPrefix().'.title.category'.$categoryID;
				I18nHandler::getInstance()->save('title', $updateData['title'], $this->objectType->getProcessor()->getTitleLangVarCategory(), $this->packageID);
			}
			
			// update description/title
			$editor = new CategoryEditor($returnValues['returnValues']);
			$editor->update($updateData);
		}
		
		// save acl
		if ($this->aclObjectTypeID) {
			ACLHandler::getInstance()->save($returnValues['returnValues']->categoryID, $this->aclObjectTypeID);
			ACLHandler::getInstance()->disableAssignVariables();
			CategoryPermissionHandler::getInstance()->resetCache();
		}
		
		// reload cache
		CategoryHandler::getInstance()->reloadCache();
		$this->readCategories();
		
		// reset values
		$this->parentCategoryID = 0;
		$this->showOrder = 0;
		
		$this->saved();
		
		// disable assignment of i18n values
		I18nHandler::getInstance()->disableAssignValueVariables();
		
		// show success message
		WCF::getTPL()->assign('success', true);
	}
 /**
  * @see	wcf\form\IForm::save()
  * @todo
  */
 public function save()
 {
     AbstractForm::save();
     $this->title = 'ict.project.project' . $this->projectObj->projectID;
     if (I18nHandler::getInstance()->isPlainValue('title')) {
         I18nHandler::getInstance()->remove($this->title, PackageCache::getInstance()->getPackageID('info.codingcorner.ict'));
         $this->title = I18nHandler::getInstance()->getValue('title');
     } else {
         I18nHandler::getInstance()->save('title', $this->title, 'ict.project', PackageCache::getInstance()->getPackageID('info.codingcorner.ict'));
     }
     $this->subTitle = 'ict.project.project' . $this->projectObj->projectID . '.subTitle';
     if (I18nHandler::getInstance()->isPlainValue('subTitle')) {
         I18nHandler::getInstance()->remove($this->subTitle, PackageCache::getInstance()->getPackageID('info.codingcorner.ict'));
         $this->subTitle = I18nHandler::getInstance()->getValue('subTitle');
     } else {
         I18nHandler::getInstance()->save('subTitle', $this->subTitle, 'ict.project', PackageCache::getInstance()->getPackageID('info.codingcorner.ict'));
     }
     $this->description = 'ict.project.project' . $this->projectObj->projectID . '.description';
     if (I18nHandler::getInstance()->isPlainValue('description')) {
         I18nHandler::getInstance()->remove($this->description, PackageCache::getInstance()->getPackageID('info.codingcorner.ict'));
         $this->description = I18nHandler::getInstance()->getValue('description');
     } else {
         I18nHandler::getInstance()->save('description', $this->description, 'ict.project', PackageCache::getInstance()->getPackageID('info.codingcorner.ict'));
     }
     // update project
     $this->objectAction = new ProjectAction(array($this->projectID), 'update', array('data' => array_merge($this->additionalFields, array('title' => $this->title, 'subTitle' => $this->subTitle, 'description' => $this->description, 'descriptionUseHtml' => $this->descriptionUseHtml ? 1 : 0, 'position' => $this->position, 'isInvisible' => $this->isInvisible ? 1 : 0, 'isClosed' => $this->isClosed ? 1 : 0, 'issuesPerPage' => $this->issuesPerPage, 'commentsPerPage' => $this->commentsPerPage, 'styleID' => $this->styleID ?: null))));
     $this->objectAction->executeAction();
     if (WCF::getSession()->getPermission('admin.project.canEditPermissions')) {
         ACLHandler::getInstance()->save($this->projectObj->projectID, $this->objectTypeID);
     }
     $this->saved();
     ACLHandler::getInstance()->disableAssignVariables();
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }