Exemplo n.º 1
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     // set cookies
     if ($this->useCookies == 1) {
         UserAuthenticationFactory::getInstance()->getUserAuthentication()->storeAccessData($this->user, $this->username, $this->password);
     }
     $oldSessionID = WCF::getSession()->sessionID;
     // change user
     WCF::getSession()->changeUser($this->user);
     // get redirect url
     $this->checkURL();
     $this->saved();
     if (isset($_REQUEST['s']) && $_REQUEST['s'] == $oldSessionID && $oldSessionID != WCF::getSession()->sessionID) {
         // force instant redirect to avoid issues with non-cookie login and the already defined SID_ARG_* constants
         if (preg_match('~[?&]s=[a-f0-9]{40}~i', $this->url)) {
             $this->url = preg_replace('~([?&])s=[a-f0-9]{40}~i', '$1s=' . WCF::getSession()->sessionID, $this->url);
         } else {
             $this->url .= mb_strpos($this->url, '?') === false ? '?' : '&';
             $this->url .= 's=' . WCF::getSession()->sessionID;
         }
         HeaderUtil::redirect($this->url);
         exit;
     }
     // redirect to url
     WCF::getTPL()->assign('__hideUserMenu', true);
     HeaderUtil::delayedRedirect($this->url, WCF::getLanguage()->get('wcf.user.login.redirect'));
     exit;
 }
Exemplo n.º 2
0
 /**
  * @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));
 }
Exemplo n.º 3
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     $this->label = 'wcf.acp.label.label' . $this->labelObj->labelID;
     if (I18nHandler::getInstance()->isPlainValue('label')) {
         I18nHandler::getInstance()->remove($this->label);
         $this->label = I18nHandler::getInstance()->getValue('label');
     } else {
         I18nHandler::getInstance()->save('label', $this->label, 'wcf.acp.label', 1);
     }
     // update label
     $this->objectAction = new LabelAction(array($this->labelID), 'update', array('data' => array_merge($this->additionalFields, array('label' => $this->label, 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName, 'groupID' => $this->groupID))));
     $this->objectAction->executeAction();
     $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.label.objectType');
     foreach ($objectTypes as $objectType) {
         $objectType->getProcessor()->save();
     }
     $this->saved();
     // reset values if non-custom value was choosen
     if ($this->cssClassName != 'custom') {
         $this->customCssClassName = '';
     }
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }
Exemplo n.º 4
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     // update tag
     $this->objectAction = new TagAction(array($this->tagID), 'update', array('data' => array_merge($this->additionalFields, array('name' => $this->name))));
     $this->objectAction->executeAction();
     if ($this->tagObj->synonymFor === null) {
         // remove synonyms first
         $sql = "UPDATE\twcf" . WCF_N . "_tag\n\t\t\t\tSET\tsynonymFor = ?\n\t\t\t\tWHERE\tsynonymFor = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array(null, $this->tagID));
         $editor = new TagEditor($this->tagObj);
         foreach ($this->synonyms as $synonym) {
             if (empty($synonym)) {
                 continue;
             }
             // find existing tag
             $synonymObj = Tag::getTag($synonym, $this->tagObj->languageID);
             if ($synonymObj === null) {
                 $synonymAction = new TagAction(array(), 'create', array('data' => array('name' => $synonym, 'languageID' => $this->tagObj->languageID, 'synonymFor' => $this->tagID)));
                 $synonymAction->executeAction();
             } else {
                 $editor->addSynonym($synonymObj);
             }
         }
     }
     $this->saved();
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }
Exemplo n.º 5
0
 /**
  * @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));
 }
Exemplo n.º 6
0
	/**
	 * @see	wcf\form\IForm::save()
	 */
	public function save() {
		AbstractForm::save();
		
		$this->description = 'wcf.acp.cronjob.description.cronjob'.$this->cronjob->cronjobID;
		if (I18nHandler::getInstance()->isPlainValue('description')) {
			I18nHandler::getInstance()->remove($this->description, 1);
			$this->description = I18nHandler::getInstance()->getValue('description');
		}
		else {
			I18nHandler::getInstance()->save('description', $this->description, 'wcf.acp.cronjob', $this->cronjob->packageID);
		}
		
		// update cronjob
		$data = array(
			'className' => $this->className,
			'description' => $this->description,
			'startMinute' => $this->startMinute,
			'startHour' => $this->startHour,
			'startDom' => $this->startDom,
			'startMonth' => $this->startMonth,
			'startDow' => $this->startDow
		);
		
		$this->objectAction = new CronjobAction(array($this->cronjobID), 'update', array('data' => $data));
		$this->objectAction->executeAction();
		
		$this->saved();
		
		// show success
		WCF::getTPL()->assign(array(
			'success' => true
		));
	}
Exemplo n.º 7
0
	/**
	 * @see	wcf\form\IForm::save()
	 */
	public function save() {
		AbstractForm::save();
		
		// save menu item
		I18nHandler::getInstance()->save('pageMenuItem', $this->menuItem->menuItem, 'wcf.page');
		
		// save menu item link
		$this->menuItemLink = 'wcf.page.menuItemLink'.$this->menuItem->menuItemID;
		if (I18nHandler::getInstance()->isPlainValue('menuItemLink')) {
			I18nHandler::getInstance()->remove($this->menuItemLink);
			$this->menuItemLink= I18nHandler::getInstance()->getValue('menuItemLink');
		}
		else {
			I18nHandler::getInstance()->save('menuItemLink', $this->menuItemLink, 'wcf.page');
		}
		
		// save menu item
		$this->objectAction = new PageMenuItemAction(array($this->menuItem), 'update', array('data' => array(
			'isDisabled' => ($this->isDisabled) ? 1 : 0,
			'menuItemController' => $this->menuItemController,
			'menuItemLink' => $this->menuItemLink,
			'parentMenuItem' => ($this->menuItem->menuPosition == 'header' ? $this->parentMenuItem : ''),
			'showOrder' => $this->showOrder
		)));
		$this->objectAction->executeAction();
		
		$this->saved();
		
		WCF::getTPL()->assign('success', true);
	}
Exemplo n.º 8
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     if ($this->showButton) {
         $this->buttonLabel = 'wcf.bbcode.buttonLabel' . $this->bbcode->bbcodeID;
         if (I18nHandler::getInstance()->isPlainValue('buttonLabel')) {
             I18nHandler::getInstance()->remove($this->buttonLabel);
             $this->buttonLabel = I18nHandler::getInstance()->getValue('buttonLabel');
         } else {
             I18nHandler::getInstance()->save('buttonLabel', $this->buttonLabel, 'wcf.bbcode', 1);
         }
     }
     // update bbcode
     $this->objectAction = new BBCodeAction(array($this->bbcodeID), 'update', array('data' => array_merge($this->additionalFields, array('allowedChildren' => $this->allowedChildren, 'bbcodeTag' => $this->bbcodeTag, 'buttonLabel' => $this->buttonLabel, 'className' => $this->className, 'htmlClose' => $this->htmlClose, 'htmlOpen' => $this->htmlOpen, 'isSourceCode' => $this->isSourceCode ? 1 : 0, 'showButton' => $this->showButton ? 1 : 0, 'wysiwygIcon' => $this->wysiwygIcon))));
     $this->objectAction->executeAction();
     // clear existing attributes
     $sql = "DELETE FROM\twcf" . WCF_N . "_bbcode_attribute\n\t\t\tWHERE\t\tbbcodeID = ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array($this->bbcodeID));
     foreach ($this->attributes as $attribute) {
         $attributeAction = new BBCodeAttributeAction(array(), 'create', array('data' => array('bbcodeID' => $this->bbcodeID, 'attributeNo' => $attribute->attributeNo, 'attributeHtml' => $attribute->attributeHtml, 'validationPattern' => $attribute->validationPattern, 'required' => $attribute->required, 'useText' => $attribute->useText)));
         $attributeAction->executeAction();
     }
     $this->saved();
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }
 /**
  * @see	\wcf\form\IForm::validate()
  */
 public function validate()
 {
     AbstractForm::validate();
     if (empty($this->masterPassword)) {
         throw new UserInputException('masterPassword');
     }
     // check password security
     if (mb_strlen($this->masterPassword) < 12) {
         throw new UserInputException('masterPassword', 'notSecure');
     }
     // digits
     if (!Regex::compile('\\d')->match($this->masterPassword)) {
         throw new UserInputException('masterPassword', 'notSecure');
     }
     // latin characters (lower-case)
     if (!Regex::compile('[a-z]')->match($this->masterPassword)) {
         throw new UserInputException('masterPassword', 'notSecure');
     }
     // latin characters (upper-case)
     if (!Regex::compile('[A-Z]')->match($this->masterPassword)) {
         throw new UserInputException('masterPassword', 'notSecure');
     }
     // password equals username
     if ($this->masterPassword == WCF::getUser()->username) {
         throw new UserInputException('masterPassword', 'notSecure');
     }
     // confirm master password
     if (empty($this->confirmMasterPassword)) {
         throw new UserInputException('confirmMasterPassword');
     }
     if ($this->confirmMasterPassword != $this->masterPassword) {
         throw new UserInputException('confirmMasterPassword', 'notEqual');
     }
 }
Exemplo n.º 10
0
 /**
  * @see wcf\page\IPage::show()
  */
 public function show()
 {
     // set active acp menu item
     if (!empty($this->activeMenuItem)) {
         ACPMenu::getInstance()->setActiveMenuItem($this->activeMenuItem);
     }
     parent::show();
 }
Exemplo n.º 11
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\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     I18nHandler::getInstance()->save('categoryName', 'wcf.user.option.category.' . $this->category->categoryName, 'wcf.user.option');
     $this->objectAction = new UserOptionCategoryAction(array($this->category), 'update', array('data' => array_merge($this->additionalFields, array('showOrder' => $this->showOrder))));
     $this->objectAction->executeAction();
     $this->saved();
     WCF::getTPL()->assign('success', true);
 }
Exemplo n.º 13
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     $this->objectAction = new TemplateAction(array($this->template), 'update', array('data' => array_merge($this->additionalFields, array('templateName' => $this->tplName, 'templateGroupID' => $this->templateGroupID, 'lastModificationTime' => TIME_NOW)), 'source' => $this->templateSource));
     $this->objectAction->executeAction();
     $this->saved();
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }
Exemplo n.º 14
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     WCF::getSession()->register('disclaimerAccepted', true);
     $this->saved();
     WCF::getSession()->update();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Register'));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     // save server
     $this->objectAction = new LanguageServerAction(array($this->languageServerID), 'update', array('data' => array_merge($this->additionalFields, array('serverURL' => $this->server))));
     $this->objectAction->executeAction();
     $this->saved();
     // show success message
     WCF::getTPL()->assign('success', true);
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     // save server
     $this->objectAction = new PackageUpdateServerAction(array($this->packageUpdateServerID), 'update', array('data' => array_merge($this->additionalFields, array('serverURL' => $this->serverURL, 'loginUsername' => $this->loginUsername, 'loginPassword' => $this->loginPassword))));
     $this->objectAction->executeAction();
     $this->saved();
     // show success message
     WCF::getTPL()->assign('success', true);
 }
Exemplo n.º 17
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     I18nHandler::getInstance()->save('optionName', 'wcf.user.option.' . $this->userOption->optionName, 'wcf.user.option');
     I18nHandler::getInstance()->save('optionDescription', 'wcf.user.option.' . $this->userOption->optionName . '.description', 'wcf.user.option');
     $this->objectAction = new UserOptionAction(array($this->userOption), 'update', array('data' => array_merge($this->additionalFields, array('categoryName' => $this->categoryName, 'optionType' => $this->optionType, 'defaultValue' => $this->defaultValue, 'showOrder' => $this->showOrder, 'outputClass' => $this->outputClass, 'validationPattern' => $this->validationPattern, 'selectOptions' => $this->selectOptions, 'required' => $this->required, 'askDuringRegistration' => $this->askDuringRegistration, 'searchable' => $this->searchable, 'editable' => $this->editable, 'visible' => $this->visible))));
     $this->objectAction->executeAction();
     $this->saved();
     WCF::getTPL()->assign('success', true);
 }
Exemplo n.º 18
0
 /**
  * @see	\wcf\form\IForm::validate()
  */
 public function validate()
 {
     if (WCF::getUser()->disableSignature) {
         throw new PermissionDeniedException();
     }
     AbstractForm::validate();
     if (!empty($this->text)) {
         $this->validateText();
     }
 }
Exemplo n.º 19
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     $data = array('title' => $this->title, 'less' => $this->less);
     $this->objectAction = new StylesheetAction(array($this->stylesheet), 'update', array('data' => $data));
     $this->objectAction->executeAction();
     $this->saved();
     // show success message
     WCF::getTPL()->assign('success', true);
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     // update media-provider
     $this->objectAction = new BBCodeMediaProviderAction(array($this->providerID), 'update', array('data' => array_merge($this->additionalFields, array('title' => $this->title, 'regex' => $this->regex, 'html' => $this->html))));
     $this->objectAction->executeAction();
     $this->saved();
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }
Exemplo n.º 21
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     $editor = new LanguageEditor($this->language);
     $editor->update(array('countryCode' => mb_strtolower($this->countryCode), 'languageName' => $this->languageName, 'languageCode' => mb_strtolower($this->languageCode)));
     LanguageFactory::getInstance()->clearCache();
     $this->saved();
     // show success message
     WCF::getTPL()->assign('success', true);
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     $this->objectAction = new UserGroupAssignmentAction(array($this->assignment), 'update', array('data' => array_merge($this->additionalFields, array('groupID' => $this->groupID, 'isDisabled' => $this->isDisabled, 'title' => $this->title))));
     $returnValues = $this->objectAction->executeAction();
     // transform conditions array into one-dimensional array
     $conditions = array();
     foreach ($this->conditions as $groupedObjectTypes) {
         $conditions = array_merge($conditions, $groupedObjectTypes);
     }
     ConditionHandler::getInstance()->updateConditions($this->assignment->assignmentID, $this->assignment->getConditions(), $conditions);
     $this->saved();
     WCF::getTPL()->assign('success', true);
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     // generate activation code
     $activationCode = UserRegistrationUtil::getActivationCode();
     // save user
     $this->objectAction = new UserAction(array($this->user), 'update', array('data' => array_merge($this->additionalFields, array('reactivationCode' => $activationCode))));
     $this->objectAction->executeAction();
     // send activation mail
     $messageData = array('username' => $this->user->username, 'userID' => $this->user->userID, 'activationCode' => $activationCode);
     $mail = new Mail(array($this->user->username => $this->user->newEmail), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail', $messageData));
     $mail->send();
     $this->saved();
     // forward to index page
     HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink(), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation'), 10);
     exit;
 }
Exemplo n.º 24
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     $this->smileyTitle = 'wcf.smiley.title' . $this->smiley->smileyID;
     if (I18nHandler::getInstance()->isPlainValue('smileyTitle')) {
         I18nHandler::getInstance()->remove($this->smileyTitle);
         $this->smileyTitle = I18nHandler::getInstance()->getValue('smileyTitle');
     } else {
         I18nHandler::getInstance()->save('smileyTitle', $this->smileyTitle, 'wcf.smiley', 1);
     }
     // update bbcode
     $this->objectAction = new SmileyAction(array($this->smileyID), 'update', array('data' => array_merge($this->additionalFields, array('smileyTitle' => $this->smileyTitle, 'smileyCode' => $this->smileyCode, 'aliases' => $this->aliases, 'smileyPath' => $this->smileyPath, 'showOrder' => $this->showOrder, 'categoryID' => $this->categoryID ?: null)), 'fileLocation' => $this->uploadedFilename ? WCF_DIR . 'images/smilies/' . $this->uploadedFilename : ''));
     $this->objectAction->executeAction();
     $this->uploadedFilename = '';
     $this->saved();
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }
Exemplo n.º 25
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     if ($this->objectType->objectType == 'de.codequake.cms.content.type.poll') {
         $this->contentData['pollID'] = PollManager::getInstance()->save($this->contentID);
     }
     // save multilingual inputs
     $languageVariable = 'cms.content.title' . $this->contentID;
     if (I18nHandler::getInstance()->isPlainValue('title')) {
         I18nHandler::getInstance()->remove($languageVariable);
     } else {
         I18nHandler::getInstance()->save('title', $languageVariable, 'cms.content', PACKAGE_ID);
         $this->title = $languageVariable;
     }
     foreach ($this->objectType->getProcessor()->multilingualFields as $field) {
         $languageVariable = 'cms.content.' . $field . $this->contentID;
         if (I18nHandler::getInstance()->isPlainValue($field)) {
             I18nHandler::getInstance()->remove($languageVariable);
         } else {
             I18nHandler::getInstance()->save($field, $languageVariable, 'cms.content', PACKAGE_ID);
             $this->contentData[$field] = $languageVariable;
         }
     }
     $data = array('title' => $this->title, 'pageID' => $this->pageID, 'parentID' => $this->parentID ?: null, 'cssClasses' => $this->cssClasses, 'showOrder' => $this->showOrder, 'position' => $this->position, 'contentData' => $this->contentData, 'contentTypeID' => $this->objectType->objectTypeID);
     $this->objectAction = new ContentAction(array($this->contentID), 'update', array('data' => $data));
     $this->objectAction->executeAction();
     // create revision
     if ($this->pageID == $this->content->pageID) {
         $objectAction = new PageAction(array($this->pageID), 'createRevision', array('action' => 'content.update'));
         $objectAction->executeAction();
     } else {
         $objectAction = new PageAction(array($this->pageID), 'createRevision', array('action' => 'content.create'));
         $objectAction->executeAction();
         $objectAction = new PageAction(array($this->content->pageID), 'createRevision', array('action' => 'content.delete'));
         $objectAction->executeAction();
     }
     // update search index
     $objectAction = new PageAction(array($this->pageID), 'refreshSearchIndex');
     $objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('ContentList', array('application' => 'cms', 'pageID' => $this->pageID)));
 }
 /**
  * @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));
 }
Exemplo n.º 27
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     $this->rankTitle = 'wcf.user.rank.userRank' . $this->rank->rankID;
     if (I18nHandler::getInstance()->isPlainValue('rankTitle')) {
         I18nHandler::getInstance()->remove($this->rankTitle);
         $this->rankTitle = I18nHandler::getInstance()->getValue('rankTitle');
     } else {
         I18nHandler::getInstance()->save('rankTitle', $this->rankTitle, 'wcf.user', 1);
     }
     // update label
     $this->objectAction = new UserRankAction(array($this->rank), 'update', array('data' => array_merge($this->additionalFields, array('rankTitle' => $this->rankTitle, 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName, 'groupID' => $this->groupID, 'requiredPoints' => $this->requiredPoints, 'rankImage' => $this->rankImage, 'repeatImage' => $this->repeatImage, 'requiredGender' => $this->requiredGender))));
     $this->objectAction->executeAction();
     $this->saved();
     // reset values if non-custom value was choosen
     if ($this->cssClassName != 'custom') {
         $this->customCssClassName = '';
     }
     // show success
     WCF::getTPL()->assign(array('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);
 }
Exemplo n.º 29
0
	/**
	 * @see	wcf\form\IForm::validate()
	 */
	public function validate() {
		AbstractForm::validate();
		
		// action
		if (!in_array($this->action, $this->availableActions)) {
			throw new UserInputException('action');
		}
		
		// assign to group
		if ($this->action == 'assignToGroup') {
			if (empty($this->assignToGroupIDArray)) {
				throw new UserInputException('assignToGroupIDArray');
			}
		}
		
		// send mail
		if ($this->action == 'sendMail') {
			if (empty($this->subject)) {
				throw new UserInputException('subject');
			}
			
			if (empty($this->text)) {
				throw new UserInputException('text');
			}
			
			if (empty($this->from)) {
				throw new UserInputException('from');
			}
		}
	}
 /**
  * @see	\wcf\form\IForm::validate()
  */
 public function validate()
 {
     parent::validate();
     if (empty($this->title)) {
         throw new UserInputException('title');
     }
     if (strlen($this->title) > 255) {
         throw new UserInputException('title', 'tooLong');
     }
     if (!isset($this->userGroups[$this->groupID])) {
         throw new UserInputException('groupID', 'notValid');
     }
     $hasData = false;
     foreach ($this->conditions as $conditions) {
         foreach ($conditions as $condition) {
             $condition->getProcessor()->validate();
             if (!$hasData && $condition->getProcessor()->getData() !== null) {
                 $hasData = true;
             }
         }
     }
     if (!$hasData) {
         throw new UserInputException('conditions');
     }
 }