/** * @see \cms\system\content\type\IContentType::readParameters() */ public function readParameters() { // register multilingual fields foreach ($this->multilingualFields as $field) { I18nHandler::getInstance()->register($field); } }
/** * @see \wcf\form\IForm::save() */ public function save() { \wcf\form\AbstractForm::save(); // save question message $this->questionMessage = 'wbb.post.butler.questionMessage' . $this->question->questionID; if (\wcf\system\language\I18nHandler::getInstance()->isPlainValue('questionMessage')) { \wcf\system\language\I18nHandler::getInstance()->remove($this->questionMessage, $this->questionID); $this->questionMessage = \wcf\system\language\I18nHandler::getInstance()->getValue('questionMessage'); } else { \wcf\system\language\I18nHandler::getInstance()->save('questionMessage', $this->questionMessage, 'wbb.post', \wcf\data\package\PackageCache::getInstance()->getPackageID('com.woltlab.wbb')); } $this->objectAction = new \wbb\data\post\butler\question\QuestionAction(array($this->question), 'update', array('data' => array_merge($this->additionalFields, array('questionTitle' => $this->questionTitle, 'questionMessage' => $this->questionMessage, 'prefixUserID' => $this->prefixUserID, 'prefixUsername' => $this->prefixUsername)))); $this->objectAction->executeAction(); // call saved event $this->saved(); // reload question object to update information $this->question = new \wbb\data\post\butler\question\Question($this->question->questionID); // show success \wcf\system\WCF::getTPL()->assign(array('success' => true)); }
/** * @see \wcf\form\IForm::validate() */ public function validate() { parent::validate(); // validate question if (!I18nHandler::getInstance()->validateValue('question')) { if (I18nHandler::getInstance()->isPlainValue('question')) { throw new UserInputException('question'); } else { throw new UserInputException('question', 'multilingual'); } } // validate answers if (!I18nHandler::getInstance()->validateValue('answers')) { if (I18nHandler::getInstance()->isPlainValue('answers')) { throw new UserInputException('answers'); } else { throw new UserInputException('answers', 'multilingual'); } } if (I18nHandler::getInstance()->isPlainValue('answers')) { $answers = explode("\n", StringUtil::unifyNewlines(I18nHandler::getInstance()->getValue('answers'))); foreach ($answers as $answer) { if (mb_substr($answer, 0, 1) == '~' && mb_substr($answer, -1, 1) == '~') { $regexLength = mb_strlen($answer) - 2; if (!$regexLength || !Regex::compile(mb_substr($answer, 1, $regexLength))->isValid()) { $this->invalidRegex = $answer; throw new UserInputException('answers', 'regexNotValid'); } } } } foreach (I18nHandler::getInstance()->getValues('answers') as $languageAnswers) { $answers = explode("\n", StringUtil::unifyNewlines($languageAnswers)); foreach ($answers as $answer) { if (mb_substr($answer, 0, 1) == '~' && mb_substr($answer, -1, 1) == '~') { $regexLength = mb_strlen($answer) - 2; if (!$regexLength || !Regex::compile(mb_substr($answer, 1, $regexLength))->isValid()) { $this->invalidRegex = $answer; throw new UserInputException('answers', 'regexNotValid'); } } } } }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(); WCF::getTPL()->assign(array('optionName' => $this->optionName, 'optionDescription' => $this->optionDescription, 'categoryName' => $this->categoryName, 'optionType' => $this->optionType, 'defaultValue' => $this->defaultValue, 'validationPattern' => $this->validationPattern, 'optionType' => $this->optionType, 'selectOptions' => $this->selectOptions, 'required' => $this->required, 'askDuringRegistration' => $this->askDuringRegistration, 'editable' => $this->editable, 'visible' => $this->visible, 'searchable' => $this->searchable, 'showOrder' => $this->showOrder, 'outputClass' => $this->outputClass, 'action' => 'add', 'availableCategories' => $this->availableCategories, 'availableOptionTypes' => self::$availableOptionTypes)); }
/** * @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); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(); if ($this->objectType->objectType == 'de.codequake.cms.content.type.poll') { PollManager::getInstance()->assignVariables(); } WCF::getTPL()->assign(array('action' => 'add', 'contentData' => $this->contentData, 'contentList' => $this->contentList, 'cssClasses' => $this->cssClasses, 'objectType' => $this->objectType, 'pageID' => $this->pageID, 'pageList' => $this->pageList, 'parentID' => $this->parentID, 'position' => $this->position, 'showOrder' => $this->showOrder)); }
private function saveI18nValue(DatabaseObject $object, $type, $columnName, $inContentData = false) { if (!I18nHandler::getInstance()->isPlainValue($columnName)) { I18nHandler::getInstance()->save($columnName, 'cms.' . $type . '.' . $columnName . $object->{$type . 'ID'}, 'cms.' . $type, PackageCache::getInstance()->getPackageID('de.codequake.cms')); $editorName = '\\cms\\data\\' . $type . '\\' . ucfirst($type) . 'Editor'; if ($object !== null) { $editor = new $editorName($object); if ($inContentData) { $tmpContentData = $object->contentData; if ($this->is_serialized($tmpContentData)) { $tmpContentData = unserialize($tmpContentData); $tmpContentData['text'] = 'cms.' . $type . '.' . $columnName . $object->{$type . 'ID'}; } else { if (is_array($tmpContentData)) { $tmpContentData['text'] = 'cms.' . $type . '.' . $columnName . $object->{$type . 'ID'}; } else { $tmpContentData = array(); $tmpContentData['text'] = 'cms.' . $type . '.' . $columnName . $object->{$type . 'ID'}; } } $tmpContentData = serialize($tmpContentData); $editor->update(array('contentData' => $tmpContentData)); } else { $editor->update(array($columnName => 'cms.' . $type . '.' . $columnName . $object->{$type . 'ID'})); } } } }
/** * @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)); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(); WCF::getTPL()->assign(array('action' => 'add', 'availableCssClassNames' => $this->availableCssClassNames, 'cssClassName' => $this->cssClassName, 'customCssClassName' => $this->customCssClassName, 'groupID' => $this->groupID, 'label' => $this->label, 'labelGroupList' => $this->labelGroupList)); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(!empty($_POST)); WCF::getTPL()->assign(array('bbcode' => $this->bbcode, 'action' => 'edit', 'nativeBBCode' => in_array($this->bbcode->bbcodeTag, self::$nativeBBCodes))); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(); WCF::getTPL()->assign(array('action' => 'add', 'categoryName' => $this->categoryName, 'showOrder' => $this->showOrder)); }
/** * @see wcf\form\IForm::save() */ public function save() { AbstractForm::save(); // save group $optionValues = $this->optionHandler->save(); $saveOptions = array(); if ($this->group->groupType == UserGroup::EVERYONE) { $saveOptions = $optionValues; } else { // get default group $defaultGroup = UserGroup::getGroupByType(UserGroup::EVERYONE); foreach ($this->optionHandler->getCategoryOptions() as $option) { $option = $option['object']; if ($optionValues[$option->optionID] != $defaultGroup->getGroupOption($option->optionName)) { $saveOptions[$option->optionID] = $optionValues[$option->optionID]; } } } $this->groupName = 'wcf.acp.group.group' . $this->group->groupID; if (I18nHandler::getInstance()->isPlainValue('groupName')) { I18nHandler::getInstance()->remove($this->groupName, 1); $this->groupName = I18nHandler::getInstance()->getValue('groupName'); } else { I18nHandler::getInstance()->save('groupName', $this->groupName, 'wcf.acp.group', 1); } $data = array('data' => array_merge(array('groupName' => $this->groupName), $this->additionalFields), 'options' => $saveOptions); $this->objectAction = new UserGroupAction(array($this->groupID), 'update', $data); $this->objectAction->executeAction(); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(!empty($_POST)); WCF::getTPL()->assign(array('action' => 'edit', 'categoryID' => $this->categoryID, 'category' => $this->category)); }
/** * @see \wcf\form\IForm::validate() */ public function validate() { parent::validate(); if (empty($this->noticeName)) { throw new UserInputException('noticeName'); } if (!I18nHandler::getInstance()->validateValue('notice')) { if (I18nHandler::getInstance()->isPlainValue('notice')) { throw new UserInputException('notice'); } else { throw new UserInputException('notice', 'multilingual'); } } // validate class name if (empty($this->cssClassName)) { throw new UserInputException('cssClassName'); } else { if (!in_array($this->cssClassName, $this->availableCssClassNames)) { throw new UserInputException('cssClassName', 'notValid'); } else { if ($this->cssClassName == 'custom') { if (empty($this->cssClassName)) { throw new UserInputException('cssClassName'); } if (!Regex::compile('^-?[_a-zA-Z]+[_a-zA-Z0-9-]+$')->match($this->customCssClassName)) { throw new UserInputException('cssClassName', 'notValid'); } } } } foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) { foreach ($groupedObjectTypes as $objectTypes) { if (is_array($objectTypes)) { foreach ($objectTypes as $objectType) { $objectType->getProcessor()->validate(); } } else { $objectTypes->getProcessor()->validate(); } } } }
/** * @see \wcf\form\IForm::validate() */ public function validate() { parent::validate(); // validate fields if (empty($this->questionTitle)) { throw new \wcf\system\exception\UserInputException('questionTitle'); } if (!\wcf\system\language\I18nHandler::getInstance()->validateValue('questionMessage', false, true)) { throw new \wcf\system\exception\UserInputException('questionMessage'); } $lines = explode("\n", \wcf\util\StringUtil::unifyNewlines($this->questionMessage)); foreach ($lines as $line) { if (!\wcf\system\Regex::compile($line)->isValid()) { throw new \wcf\system\exception\UserInputException('questionMessage', 'notValid'); } } // end foreach-loop }
/** * @see \wcf\form\IForm::validate() */ public function validate() { parent::validate(); // validate fields if (empty($this->answerTitle)) { throw new \wcf\system\exception\UserInputException('answerTitle'); } if (!\wcf\system\language\I18nHandler::getInstance()->validateValue('answerMessage', false, true)) { throw new \wcf\system\exception\UserInputException('answerMessage'); } }
/** * @see wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(); WCF::getTPL()->assign(array( 'groupName' => $this->groupName, 'optionTree' => $this->optionTree, 'action' => 'add' )); }
/** * @see wcf\system\option\IOptionType::validate() */ public function validate(Option $option, $newValue) { if (!I18nHandler::getInstance()->validateValue($option->optionName, $option->requireI18n, true)) { throw new UserInputException($option->optionName, 'validationFailed'); } }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(); WCF::getTPL()->assign(array('className' => $this->className, 'description' => $this->description, 'startMinute' => $this->startMinute, 'startHour' => $this->startHour, 'startDom' => $this->startDom, 'startMonth' => $this->startMonth, 'startDow' => $this->startDow, 'action' => 'add')); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(!empty($_POST)); WCF::getTPL()->assign(array('smiley' => $this->smiley, 'action' => 'edit')); }
/** * @see wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(!empty($_POST)); WCF::getTPL()->assign(array( 'action' => 'edit', 'menuItem' => $this->menuItem, 'menuItemID' => $this->menuItemID )); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(!empty($_POST)); WCF::getTPL()->assign(array('action' => 'edit', 'choosePageNodeList' => $this->choosePageNodeList, 'pageID' => $this->pageID, 'page' => $this->page)); }
/** * @see wcf\system\option\IOptionHandler::save() */ public function save($categoryName = null, $optionPrefix = null) { $saveOptions = array(); if ($this->supportI18n && ($categoryName === null || $optionPrefix === null)) { throw new SystemException("category name or option prefix missing"); } foreach ($this->options as $option) { // handle i18n support if ($this->supportI18n && $option->supportI18n) { if (I18nHandler::getInstance()->isPlainValue($option->optionName)) { I18nHandler::getInstance()->remove($optionPrefix . $option->optionID, $option->packageID); $saveOptions[$option->optionID] = I18nHandler::getInstance()->getValue($option->optionName); } else { I18nHandler::getInstance()->save($option->optionName, $optionPrefix . $option->optionID, $categoryName, $option->packageID); $saveOptions[$option->optionID] = $optionPrefix . $option->optionID; } } else { $saveOptions[$option->optionID] = $this->optionValues[$option->optionName]; } } return $saveOptions; }
/** * @see \wcf\form\IForm::save() */ public function save() { AbstractForm::save(); $this->objectAction = new NoticeAction(array($this->notice), 'update', array('data' => array_merge($this->additionalFields, array('cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName, 'isDisabled' => $this->isDisabled, 'isDismissible' => $this->isDismissible, 'notice' => I18nHandler::getInstance()->isPlainValue('notice') ? I18nHandler::getInstance()->getValue('notice') : 'wcf.notice.notice.notice' . $this->notice->noticeID, 'noticeName' => $this->noticeName, 'noticeUseHtml' => $this->noticeUseHtml, 'showOrder' => $this->showOrder)))); $this->objectAction->executeAction(); if (I18nHandler::getInstance()->isPlainValue('notice')) { if ($this->notice->notice == 'wcf.notice.notice.notice' . $this->notice->noticeID) { I18nHandler::getInstance()->remove($this->notice->notice); } } else { I18nHandler::getInstance()->save('notice', 'wcf.notice.notice.notice' . $this->notice->noticeID, 'wcf.notice', 1); } // transform conditions array into one-dimensional array $conditions = array(); foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) { foreach ($groupedObjectTypes as $objectTypes) { if (is_array($objectTypes)) { $conditions = array_merge($conditions, $objectTypes); } else { $conditions[] = $objectTypes; } } } ConditionHandler::getInstance()->updateConditions($this->notice->noticeID, $this->notice->getConditions(), $conditions); if ($this->resetIsDismissed) { $sql = "DELETE FROM\twcf" . WCF_N . "_notice_dismissed\n\t\t\t\tWHERE\t\tnoticeID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->notice->noticeID)); $this->resetIsDismissed = 0; UserStorageHandler::getInstance()->resetAll('dismissedNotices'); } $this->saved(); // reload notice object for proper 'isDismissible' value $this->notice = new Notice($this->noticeID); WCF::getTPL()->assign('success', true); }
/** * @see \wcf\form\IForm::save() */ public function save() { AbstractForm::save(); if (I18nHandler::getInstance()->isPlainValue('question')) { if ($this->captchaQuestion->question == 'wcf.captcha.question.question.question' . $this->captchaQuestion->questionID) { I18nHandler::getInstance()->remove($this->captchaQuestion->question); } } else { I18nHandler::getInstance()->save('question', 'wcf.captcha.question.question.question' . $this->captchaQuestion->questionID, 'wcf.captcha.question', 1); } if (I18nHandler::getInstance()->isPlainValue('answers')) { if ($this->captchaQuestion->answers == 'wcf.captcha.question.question.answers' . $this->captchaQuestion->questionID) { I18nHandler::getInstance()->remove($this->captchaQuestion->answers); } } else { I18nHandler::getInstance()->save('answers', 'wcf.captcha.question.question.answers' . $this->captchaQuestion->questionID, 'wcf.captcha.question', 1); } $this->objectAction = new CaptchaQuestionAction(array($this->captchaQuestion), 'update', array('data' => array_merge($this->additionalFields, array('answers' => I18nHandler::getInstance()->isPlainValue('answers') ? I18nHandler::getInstance()->getValue('answers') : 'wcf.captcha.question.question.answers' . $this->captchaQuestion->questionID, 'isDisabled' => $this->isDisabled, 'question' => I18nHandler::getInstance()->isPlainValue('question') ? I18nHandler::getInstance()->getValue('question') : 'wcf.captcha.question.question.question' . $this->captchaQuestion->questionID)))); $this->objectAction->executeAction(); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); $useRequestData = empty($_POST) ? false : true; I18nHandler::getInstance()->assignVariables($useRequestData); WCF::getTPL()->assign(array('action' => 'edit', 'subscriptionID' => $this->subscriptionID, 'subscription' => $this->subscription)); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(!empty($_POST)); WCF::getTPL()->assign('item', $this->item); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(); WCF::getTPL()->assign(array('action' => 'add', 'authorName' => $this->authorName, 'authorURL' => $this->authorURL, 'availableFontFamilies' => $this->availableFontFamilies, 'availableTemplateGroups' => $this->availableTemplateGroups, 'availableUnits' => $this->availableUnits, 'copyright' => $this->copyright, 'imagePath' => $this->imagePath, 'license' => $this->license, 'styleDate' => $this->styleDate, 'styleDescription' => $this->styleDescription, 'styleName' => $this->styleName, 'styleVersion' => $this->styleVersion, 'templateGroupID' => $this->templateGroupID, 'tmpHash' => $this->tmpHash, 'variables' => $this->variables)); }
/** * @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\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(); WCF::getTPL()->assign(array('action' => 'add', 'isDisabled' => $this->isDisabled, 'showOrder' => $this->showOrder, 'cost' => $this->cost, 'currency' => $this->currency, 'subscriptionLength' => $this->subscriptionLength, 'subscriptionLengthUnit' => $this->subscriptionLengthUnit, 'isRecurring' => $this->isRecurring, 'groupIDs' => $this->groupIDs, 'excludedSubscriptionIDs' => $this->excludedSubscriptionIDs, 'availableCurrencies' => $this->availableCurrencies, 'availableUserGroups' => $this->availableUserGroups, 'availableSubscriptions' => $this->availableSubscriptions)); }