/**
  * 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;
 }
 /**
  * @see    \wcf\form\IForm::validate()
  */
 public function validate()
 {
     parent::validate();
     $this->validateUsername();
     // validate category ids
     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 LinklistCategory($category);
         if (!$category->isAccessible() || !$category->getPermission('canUseCategory')) {
             throw new UserInputException('categoryIDs');
         }
     }
     // validate teaser
     if (empty($this->teaser)) {
         throw new UserInputException('teaser');
     }
     if (mb_strlen($this->teaser) > LINKLIST_MAX_TEASER_LENGTH) {
         throw new UserInputException('teaser', 'tooLong');
     }
     // search for censored words
     if (ENABLE_CENSORSHIP) {
         $result = Censorship::getInstance()->test($this->teaser);
         if ($result) {
             WCF::getTPL()->assign('censoredWords', $result);
             throw new UserInputException('teaser', 'censoredWordsFound');
         }
     }
     // validate website
     if (empty($this->website)) {
         throw new UserInputException('website');
     }
     if (!empty($this->website)) {
         if (!preg_match('~^(https?|ftps?)://~', $this->website)) {
             $this->website = 'http://' . $this->website;
         }
         if (filter_var($this->website, FILTER_VALIDATE_URL) === false) {
             throw new UserInputException('website', 'invalid');
         }
     }
 }