Пример #1
0
	/**
	 * Returns the parent category of this category.
	 * 
	 * @return	wcf\data\category\Category
	 */
	public function getParentCategory() {
		if ($this->parentCategoryID && $this->parentCategory === null) {
			$this->parentCategory = CategoryHandler::getInstance()->getCategory($this->parentCategoryID);
		}
		
		return $this->parentCategory;
	}
Пример #2
0
	/**
	 * Creates a new CategoryNodeList instance.
	 * 
	 * @param	string		$objectType
	 * @param	integer		$parentCategoryID
	 * @param	boolean		$includeDisabledCategories
	 * @param	array<integer>	$excludedCategoryIDs
	 */
	public function __construct($objectType, $parentCategoryID = 0, $includeDisabledCategories = false, array $excludedCategoryIDs = array()) {
		if (empty($this->nodeClassName)) {
			$this->nodeClassName = str_replace('List', '', get_class($this));
			if (!class_exists($this->nodeClassName)) {
				throw new SystemException("Unknown category node class '".$this->nodeClassName."'.");
			}
		}
		
		$this->parentCategoryID = $parentCategoryID;
		
		// get parent category
		if (!$this->parentCategoryID) {
			// empty node
			$parentCategory = new Category(null, array(
				'categoryID' => 0,
				'objectTypeID' => CategoryHandler::getInstance()->getObjectTypeByName($objectType)->objectTypeID
			));
		}
		else {
			$parentCategory = CategoryHandler::getInstance()->getCategory($this->parentCategoryID);
			if ($parentCategory === null) {
				throw new SystemException("There is no category with id '".$this->parentCategoryID."'");
			}
		}
		
		parent::__construct(new $this->nodeClassName($parentCategory, $includeDisabledCategories, $excludedCategoryIDs), \RecursiveIteratorIterator::SELF_FIRST);
	}
	/**
	 * @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;
	}
Пример #4
0
 /**
  * @see	wcf\system\category\ICategoryType::afterDeletion()
  */
 public function afterDeletion(CategoryEditor $categoryEditor)
 {
     // move child categories to parent category
     foreach (CategoryHandler::getInstance()->getChildCategories($categoryEditor->getDecoratedObject()) as $category) {
         $__categoryEditor = new CategoryEditor($category);
         $__categoryEditor->update(array('parentCategoryID' => $categoryEditor->parentCategoryID));
     }
 }
Пример #5
0
 public function getCategories($id)
 {
     if ($this->categories === null) {
         $this->categories = array();
         foreach ($this->getCategoryIDs($id) as $categoryID) {
             $this->categories[$categoryID] = CategoryHandler::getInstance()->getCategory($categoryID);
         }
     }
 }
 public function get(UserOnline $user, $languageVariable = '')
 {
     if ($category = CategoryHandler::getInstance()->getCategory($user->objectID)) {
         $category = new NewsCategory($category);
         if ($category->getPermission('canView')) {
             return WCF::getLanguage()->getDynamicVariable($languageVariable, array('category' => $category));
         }
     }
     return '';
 }
Пример #7
0
 /**
  * @see	\wcf\system\SingletonFactory::init()
  */
 protected function init()
 {
     // get smiley cache
     $this->cachedSmilies = SmileyCacheBuilder::getInstance()->getData(array(), 'smilies');
     $smileyCategories = CategoryHandler::getInstance()->getCategories('com.woltlab.wcf.bbcode.smiley');
     $this->cachedCategories[null] = new SmileyCategory(new Category(null, array('categoryID' => null, 'parentCategoryID' => 0, 'title' => 'wcf.acp.smiley.categoryID.default', 'description' => '', 'showOrder' => -1, 'isDisabled' => 0)));
     foreach ($smileyCategories as $key => $smileyCategory) {
         $this->cachedCategories[$key] = new SmileyCategory($smileyCategory);
     }
 }
 /**
  * @see	\wcf\system\user\object\watch\IUserObjectWatch::validateObjectID()
  */
 public function validateObjectID($objectID)
 {
     $category = CategoryHandler::getInstance()->getCategory($objectID);
     if ($category === null) {
         throw new IllegalLinkException();
     }
     $category = new NewsCategory($category);
     if (!$category->isAccessible()) {
         throw new PermissionDeniedException();
     }
 }
Пример #9
0
 public function readData()
 {
     parent::readData();
     $this->title = WCF::getLanguage()->get('cms.page.news');
     $this->items = new NewsFeedList($this->objectIDs);
     $this->items->sqlLimit = $this->itemsPerPage;
     $this->items->readObjects();
     if (count($this->objectIDs) === 1) {
         $this->title = CategoryHandler::getInstance()->getCategory(reset($this->objectIDs))->getTitle();
     }
 }
Пример #10
0
 /**
  * @see	wcf\data\DatabaseObjectDecorator::__construct()
  */
 public function __construct(DatabaseObject $object, $inludeDisabledCategories = false, array $excludedCategoryIDs = array())
 {
     parent::__construct($object);
     $this->inludeDisabledCategories = $inludeDisabledCategories;
     $this->excludedCategoryIDs = $excludedCategoryIDs;
     $className = get_called_class();
     foreach (CategoryHandler::getInstance()->getChildCategories($this->getDecoratedObject()) as $category) {
         if ($this->fulfillsConditions($category)) {
             $this->childCategories[] = new $className($category, $inludeDisabledCategories, $excludedCategoryIDs);
         }
     }
 }
Пример #11
0
 /**
  * @see	\wcf\system\category\ICategoryType::afterDeletion()
  */
 public function afterDeletion(CategoryEditor $categoryEditor)
 {
     $categoryIDs = array_keys(CategoryHandler::getInstance()->getChildCategories($categoryEditor->categoryID));
     if (!empty($categoryIDs)) {
         // move child categories to parent category
         $conditionBuilder = new PreparedStatementConditionBuilder();
         $conditionBuilder->add("categoryID IN (?)", array($categoryIDs));
         $sql = "UPDATE\twcf" . WCF_N . "_category\n\t\t\t\tSET\tparentCategoryID = ?\n\t\t\t\t" . $conditionBuilder;
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array_merge(array($categoryEditor->parentCategoryID), $conditionBuilder->getParameters()));
     }
 }
 /**
  * Returns picture list.
  * 
  * @return	array
  */
 public function getPictureList()
 {
     if (isset($this->parameters['categoryID'])) {
         $category = CategoryHandler::getInstance()->getCategory($this->parameters['categoryID']);
         $categoryIDs = array($category->categoryID);
         foreach ($category->getChildCategories() as $childCategory) {
             $categoryIDs[] = $childCategory->categoryID;
         }
         // fetch news pictures
         $pictureList = new GroupedNewsPictureList();
         $pictureList->getConditionBuilder()->add('news_picture.categoryID IN (?)', array($categoryIDs));
         $pictureList->readObjects();
         // assign variables
         WCF::getTPL()->assign(array('categoryID' => $this->parameters['categoryID'], 'category' => $category, 'childCategories' => $category->getChildCategories(), 'pictures' => $pictureList->getObjects()));
         return array('categoryID' => $this->parameters['categoryID'], 'template' => WCF::getTPL()->fetch('groupedPictureList', 'news'));
     } else {
         $categoryID = 0;
         // get first category
         $categories = CategoryHandler::getInstance()->getCategories('de.voolia.news.picture.category');
         while (!empty($categories)) {
             $tCategory = array_shift($categories);
             if ($tCategory->parentCategoryID == 0) {
                 $categoryID = $tCategory->categoryID;
                 $category = $tCategory;
                 break;
             }
         }
         if ($categoryID) {
             // fetch category node tree
             $categoryTree = new NewsPictureCategoryNodeTree('de.voolia.news.picture.category');
             $categoryList = $categoryTree->getIterator();
             $categoryList->setMaxDepth(0);
             $categoryIDs = array($categoryID);
             foreach ($category->getChildCategories() as $childCategory) {
                 $categoryIDs[] = $childCategory->categoryID;
             }
             $pictureList = new GroupedNewsPictureList();
             $pictureList->getConditionBuilder()->add('news_picture.categoryID IN (?)', array($categoryIDs));
             $pictureList->readObjects();
             // assign variables
             WCF::getTPL()->assign(array('categoryID' => $categoryID, 'categoryList' => $categoryList, 'pictures' => $pictureList->getObjects()));
         }
         // fetch aleady selected/uploaded picture
         if ($this->parameters['pictureID']) {
             $picture = new NewsPicture($this->parameters['pictureID']);
             if ($picture->pictureID) {
                 WCF::getTPL()->assign('picture', $picture);
             }
         }
         return array('categoryID' => $categoryID, 'template' => WCF::getTPL()->fetch('pictureListInspector', 'news'));
     }
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     $this->title = WCF::getLanguage()->get('news.header.menu.news');
     // read the news entries
     $this->items = new NewsFeedList($this->objectIDs);
     $this->items->sqlLimit = $this->itemsPerPage;
     $this->items->readObjects();
     // set the page title
     if (count($this->objectIDs) === 1) {
         $this->title = CategoryHandler::getInstance()->getCategory(reset($this->objectIDs))->getTitle();
     }
 }
 /**
  * @see	\wcf\data\category\CategoryNodeTree::buildTree()
  */
 protected function buildTree()
 {
     $categoryList = new CategoryList();
     $categoryList->getConditionBuilder()->add('category.objectTypeID = ?', array(CategoryHandler::getInstance()->getObjectTypeByName($this->objectType)->objectTypeID));
     $categoryList->readObjects();
     foreach ($categoryList as $category) {
         if (!isset($this->categoryStructureCache[$category->parentCategoryID])) {
             $this->categoryStructureCache[$category->parentCategoryID] = array();
         }
         $this->categoryStructureCache[$category->parentCategoryID][] = $category->categoryID;
         $this->categoryCache[$category->categoryID] = $category;
     }
     parent::buildTree();
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // read the entries
     $this->items = new FeedEntryList($this->objectIDs);
     $this->items->sqlLimit = 20;
     $this->items->readObjects();
     // set title
     if (count($this->objectIDs) === 1) {
         $this->title = CategoryHandler::getInstance()->getCategory(reset($this->objectIDs))->getTitle() . ' - ' . WCF::getLanguage()->get('filebase.header.menu.filebase');
     } else {
         $this->title = WCF::getLanguage()->get('filebase.header.menu.filebase');
     }
 }
 /**
  * Returns a list with category ids of accessible linklist categories.
  * 
  * @param	array		$permissions
  * @return	array<integer>
  */
 public static function getAccessibleCategoryIDs(array $permissions = array('canViewCategory'))
 {
     $categoryIDs = array();
     foreach (CategoryHandler::getInstance()->getCategories('de.incendium.linklist.category') as $category) {
         $result = true;
         $category = new LinklistCategory($category);
         foreach ($permissions as $permission) {
             $result = $result && $category->getPermission($permission);
         }
         if ($result) {
             $categoryIDs[] = $category->categoryID;
         }
     }
     return $categoryIDs;
 }
 /**
  * @param string[] $permissions
  * @return int[]
  */
 public static function getAccessibleCategoryIDs($permissions = array('canViewCategory'))
 {
     $categoryIDs = array();
     foreach (CategoryHandler::getInstance()->getCategories(self::OBJECT_TYPE_NAME) as $category) {
         $result = true;
         $category = new self($category);
         foreach ($permissions as $permission) {
             $result = $result && $category->getPermission($permission);
         }
         if ($result) {
             $categoryIDs[] = $category->categoryID;
         }
     }
     return $categoryIDs;
 }
Пример #18
0
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['id'])) {
         $this->categoryID = intval($_REQUEST['id']);
     }
     $this->category = CategoryHandler::getInstance()->getCategory($this->categoryID);
     if ($this->category === null) {
         throw new IllegalLinkException();
     }
     $this->category = new NewsCategory($this->category);
     if (!$this->category->isAccessible()) {
         throw new PermissionDeniedException();
     }
 }
 public function __construct(array $categoryIDs)
 {
     parent::__construct();
     if (!empty($categoryIDs)) {
         $this->getConditionBuilder()->add('news_to_category.categoryID IN (?)', array($categoryIDs));
         $this->getConditionBuilder()->add('news.newsID = news_to_category.newsID');
     } else {
         $this->getConditionBuilder()->add('1=0');
     }
     foreach ($categoryIDs as $categoryID) {
         $category = new NewsCategory(CategoryHandler::getInstance()->getCategory($categoryID));
         if (!$category->getPermission('canViewDelayedNews')) {
             $this->getConditionBuilder()->add('news.isDisabled = ?', array(0));
         }
     }
 }
Пример #20
0
 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['id'])) {
         $this->categoryID = intval($_REQUEST['id']);
         $this->category = CategoryHandler::getInstance()->getCategory($this->categoryID);
         if ($this->category === null) {
             throw new IllegalLinkException();
         }
     } else {
         // load first category
         $categories = CategoryHandler::getInstance()->getCategories('de.codequake.cms.file');
         $this->category = array_shift($categories);
         $this->categoryID = $this->category->categoryID;
     }
 }
 /**
  * @see	\wcf\system\option\IOptionType::validate()
  */
 public function validate(Option $option, $newValue)
 {
     if (!is_array($newValue)) {
         $newValue = array();
     }
     $newValue = ArrayUtil::toIntegerArray($newValue);
     foreach ($newValue as $categoryID) {
         $category = CategoryHandler::getInstance()->getCategory($categoryID);
         if ($category === null) {
             throw new UserInputException($option->optionName, 'validationFailed');
         }
         if ($category->getObjectType()->objectType != $this->objectType) {
             throw new UserInputException($option->optionName, 'validationFailed');
         }
     }
 }
 public function getNotifications()
 {
     if ($this->notifications === null) {
         $this->notifications = 0;
         if (WCF::getUser()->userID) {
             // load storage data
             UserStorageHandler::getInstance()->loadStorage(array(WCF::getUser()->userID));
             // get ids
             $data = UserStorageHandler::getInstance()->getStorage(array(WCF::getUser()->userID), 'cmsUnreadNews');
             // cache does not exist or is outdated
             if ($data[WCF::getUser()->userID] === null) {
                 $categoryIDs = NewsCategory::getAccessibleCategoryIDs();
                 // removed ignored boards
                 foreach ($categoryIDs as $key => $categoryID) {
                     $category = CategoryHandler::getInstance()->getCategory($categoryID);
                 }
                 if (!empty($categoryIDs)) {
                     $conditionBuilder = new PreparedStatementConditionBuilder();
                     $conditionBuilder->add("news.lastChangeTime > ?", array(VisitTracker::getInstance()->getVisitTime('de.codequake.cms.news')));
                     $conditionBuilder->add("news.newsID IN (SELECT newsID FROM cms" . WCF_N . "_news_to_category WHERE categoryID IN (?))", array($categoryIDs));
                     $conditionBuilder->add("news.isDeleted = 0 AND news.isDisabled = 0");
                     $conditionBuilder->add("tracked_visit.visitTime IS NULL");
                     // apply language filter
                     if (LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
                         $conditionBuilder->add('(news.languageID IN (?) OR news.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
                     }
                     $sql = "SELECT\t\tCOUNT(*) AS count\n\t\t\t\t\t\t\tFROM\t\tcms" . WCF_N . "_news news\n\t\t\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_tracked_visit tracked_visit\n\t\t\t\t\t\t\tON\t\t(tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('de.codequake.cms.news') . " AND tracked_visit.objectID = news.newsID AND tracked_visit.userID = " . WCF::getUser()->userID . ")\n\t\t\t\t\t\t\t" . $conditionBuilder;
                     $statement = WCF::getDB()->prepareStatement($sql);
                     $statement->execute($conditionBuilder->getParameters());
                     $row = $statement->fetchArray();
                     $this->notifications = $row['count'];
                 }
                 // update storage data
                 UserStorageHandler::getInstance()->update(WCF::getUser()->userID, 'cmsUnreadNews', $this->notifications);
             } else {
                 $this->notifications = $data[WCF::getUser()->userID];
             }
         }
     }
     return $this->notifications;
 }
 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     $categories = CategoryHandler::getInstance()->getCategories('de.voolia.news.picture.category');
     if (isset($_REQUEST['id'])) {
         $this->categoryID = intval($_REQUEST['id']);
         $this->category = CategoryHandler::getInstance()->getCategory($this->categoryID);
     } else {
         while (!empty($categories) && !$this->categoryID) {
             $category = array_shift($categories);
             if ($category->parentCategoryID == 0) {
                 $this->categoryID = $category->categoryID;
                 $this->category = $category;
             }
         }
     }
     // check category
     if (!empty($categories) && ($this->category === null || $this->category->parentCategoryID != 0)) {
         throw new IllegalLinkException();
     }
 }
Пример #24
0
	/**
	 * @see	wcf\page\IPage::readData()
	 */
	public function readData() {
		$this->objectType = CategoryHandler::getInstance()->getObjectTypeByName($this->objectTypeName);
		if ($this->objectType === null) {
			throw new SystemException("Unknown category object type with name '".$this->objectTypeName."'");
		}
		
		// check permissions
		$this->checkCategoryPermissions();
		
		$this->readCategories();
		
		// note that the implementation of wcf\system\category\ICategoryType
		// needs to support a object type of the pseudo definition
		// 'com.woltlab.wcf.collapsibleContent.acp' which has to be registered
		// during package installation as a 'com.woltlab.wcf.collapsibleContent'
		// object type if you want to support collapsible categories in the
		// acp; the pseudo object type is used to distinguish between
		// collapsible categories in the frontend and the acp
		$collapsibleObjectTypeName = $this->objectType->getProcessor()->getObjectTypeName('com.woltlab.wcf.collapsibleContent.acp');
		if ($collapsibleObjectTypeName) {
			$this->collapsibleObjectTypeID = UserCollapsibleContentHandler::getInstance()->getObjectTypeID($collapsibleObjectTypeName);
			// get ids of collapsed category
			if ($this->collapsibleObjectTypeID !== null) {
				$this->collapsedCategoryIDs = UserCollapsibleContentHandler::getInstance()->getCollapsedContent($this->collapsibleObjectTypeID);
				$this->collapsedCategoryIDs = array_flip($this->collapsedCategoryIDs);
			}
		}
		
		parent::readData();
	}
Пример #25
0
	/**
	 * @see	wcf\data\ISortableAction::validateUpdatePosition()
	 */
	public function validateUpdatePosition() {
		// validate 'structure' parameter
		if (!isset($this->parameters['data']['structure']) || !is_array($this->parameters['data']['structure'])) {
			throw new UserInputException('structure');
		}
		
		// validate given category ids
		foreach ($this->parameters['data']['structure'] as $parentCategoryID => $categoryIDs) {
			if ($parentCategoryID) {
				// validate category
				$category = CategoryHandler::getInstance()->getCategory($parentCategoryID);
				if ($category === null) {
					throw new UserInputException('structure');
				}
				
				// validate permissions
				if (!$category->getProcessor()->canEditCategory()) {
					throw new PermissionDeniedException();
				}
				
				$this->objects[$category->categoryID] = new $this->className($category);
			}
			
			foreach ($categoryIDs as $categoryID) {
				// validate category
				$category = CategoryHandler::getInstance()->getCategory($categoryID);
				if ($category === null) {
					throw new UserInputException('structure');
				}
				
				// validate permissions
				if (!$category->getProcessor()->canEditCategory()) {
					throw new PermissionDeniedException();
				}
				
				$this->objects[$category->categoryID] = new $this->className($category);
			}
		}
	}
Пример #26
0
 /**
  * Returns the categories of this news entry. 
  * 
  * @return	array<\news\data\category\NewsCategory>
  */
 public function getCategories()
 {
     if ($this->categories === null) {
         $this->categories = array();
         if (!empty($this->categoryIDs)) {
             foreach ($this->categoryIDs as $categoryID) {
                 $this->categories[$categoryID] = new NewsCategory(CategoryHandler::getInstance()->getCategory($categoryID));
             }
         } else {
             $sql = "SELECT\tcategoryID\n\t\t\t\t\tFROM\tnews" . WCF_N . "_news_to_category\n\t\t\t\t\tWHERE\tnewsID = ?";
             $statement = WCF::getDB()->prepareStatement($sql);
             $statement->execute(array($this->newsID));
             while ($row = $statement->fetchArray()) {
                 $this->categories[$row['categoryID']] = new NewsCategory(CategoryHandler::getInstance()->getCategory($row['categoryID']));
             }
         }
     }
     return $this->categories;
 }
Пример #27
0
	/**
	 * @see	wcf\acp\form\AbstractCategoryAddForm::validateParentCategory()
	 */
	protected function validateParentCategory() {
		parent::validateParentCategory();
		
		// check if new parent category is no child category of the category
		$childCategories = CategoryHandler::getInstance()->getChildCategories($this->category);
		if (isset($childCategories[$this->parentCategoryID])) {
			throw new UserInputException('parentCategoryID', 'invalid');
		}
	}
Пример #28
0
 /**
  * Returns the category node for the category with the given id.
  * 
  * @param	integer		$categoryID
  * @return	\wcf\data\category\CategoryNode
  */
 protected function getNode($categoryID)
 {
     if (!$categoryID) {
         $category = new Category(null, array('categoryID' => 0, 'objectTypeID' => CategoryHandler::getInstance()->getObjectTypeByName($this->objectType)->objectTypeID));
     } else {
         $category = $this->getCategory($categoryID);
     }
     // decorate category if necessary
     $decoratorClassName = call_user_func(array($this->nodeClassName, 'getBaseClass'));
     if ($decoratorClassName != 'wcf\\data\\category\\Category') {
         $category = new $decoratorClassName($category);
     }
     return new $this->nodeClassName($category);
 }
Пример #29
0
 public function validate()
 {
     parent::validate();
     // categories
     if (empty($this->categoryIDs)) {
         throw new UserInputException('categoryIDs');
     }
     foreach ($this->categoryIDs as $categoryID) {
         $category = CategoryHandler::getInstance()->getCategory($categoryID);
         if ($category === null) {
             throw new UserInputException('categoryIDs');
         }
         $category = new NewsCategory($category);
         if (!$category->isAccessible() || !$category->getPermission('canAddNews')) {
             throw new UserInputException('categoryIDs');
         }
     }
     if (MODULE_POLL && WCF::getSession()->getPermission('user.cms.news.canStartPoll')) {
         PollManager::getInstance()->validate();
     }
 }
 /**
  * Validates the tags.
  */
 protected function validateTags()
 {
     // check whether the user can/must set tags because of the category selection.
     $canSetTags = true;
     $canCreateNewsWithoutTags = true;
     foreach ($this->categoryIDs as $categoryID) {
         $category = CategoryHandler::getInstance()->getCategory($categoryID);
         $category = new NewsCategory($category);
         // check permissions
         if (!$category->getPermission('canSetTags')) {
             $canSetTags = false;
         }
         if (!$category->getPermission('canCreateNewsWithoutTags')) {
             $canCreateNewsWithoutTags = false;
         }
         // we have everything we need :-)
         if (!$canSetTags && !$canCreateNewsWithoutTags) {
             break;
         }
     }
     if (empty($this->tags)) {
         if ($canSetTags && !$canCreateNewsWithoutTags) {
             throw new UserInputException('tags', 'empty');
         }
     } else {
         if (!$canSetTags) {
             // user can't set tags => ignore them
             $this->tags = array();
         }
     }
 }