/**
  * Installs user option categories.
  *
  * @param 	array		$category
  * @param	array		$categoryXML
  */
 protected function saveCategory($category, $categoryXML = null)
 {
     $icon = $menuIcon = '';
     if (isset($categoryXML['icon'])) {
         $icon = $categoryXML['icon'];
     }
     if (isset($categoryXML['menuicon'])) {
         $menuIcon = $categoryXML['menuicon'];
     }
     // use for create and update
     $data = array('parentCategoryName' => $category['parentCategoryName'], 'categoryIconS' => $menuIcon, 'categoryIconM' => $icon, 'permissions' => $category['permissions'], 'options' => $category['options']);
     // append show order if explicitly stated
     if ($category['showOrder'] !== null) {
         $data['showOrder'] = $category['showOrder'];
     }
     $userOptionCategory = UserOptionCategory::getCategoryByName($category['categoryName'], $this->installation->getPackageID());
     if ($userOptionCategory->categoryID) {
         $categoryEditor = new UserOptionCategoryEditor($userOptionCategory);
         $categoryEditor->update($data);
     } else {
         // append data fields for create
         $data['packageID'] = $this->installation->getPackageID();
         $data['categoryName'] = $category['categoryName'];
         UserOptionCategoryEditor::create($data);
     }
 }
 /**
  * @see	\wcf\system\package\plugin\AbstractOptionPackageInstallationPlugin::saveCategory()
  */
 protected function saveCategory($category, $categoryXML = null)
 {
     // use for create and update
     $data = array('parentCategoryName' => $category['parentCategoryName'], 'permissions' => $category['permissions'], 'options' => $category['options']);
     // append show order if explicitly stated
     if ($category['showOrder'] !== null) {
         $data['showOrder'] = $category['showOrder'];
     }
     $userOptionCategory = UserOptionCategory::getCategoryByName($category['categoryName']);
     if ($userOptionCategory !== null) {
         if ($userOptionCategory->packageID != $this->installation->getPackageID()) {
             throw new SystemException("Cannot override existing category '" . $category['categoryName'] . "'");
         }
         $categoryEditor = new UserOptionCategoryEditor($userOptionCategory);
         $categoryEditor->update($data);
     } else {
         // append data fields for create
         $data['packageID'] = $this->installation->getPackageID();
         $data['categoryName'] = $category['categoryName'];
         UserOptionCategoryEditor::create($data);
     }
 }
 /**
  * @see	\wcf\page\AbstractPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (!empty($_REQUEST['category'])) {
         $this->category = $_REQUEST['category'];
         // validate category
         if (UserOptionCategory::getCategoryByName('settings.' . $this->category) === null) {
             throw new IllegalLinkException();
         }
     }
     $this->optionHandler = new UserOptionHandler(false, '', 'settings.' . $this->category);
     $this->optionHandler->setUser(WCF::getUser());
     if ($this->category == 'general') {
         $this->availableContentLanguages = LanguageFactory::getInstance()->getContentLanguages();
         $this->availableLanguages = LanguageFactory::getInstance()->getLanguages();
         $this->availableStyles = StyleHandler::getInstance()->getAvailableStyles();
     }
 }