本文整理汇总了PHP中wcf\form\AbstractForm类的典型用法代码示例。如果您正苦于以下问题:PHP AbstractForm类的具体用法?PHP AbstractForm怎么用?PHP AbstractForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbstractForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* @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;
}
示例2: save
/**
* @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));
}
示例3: save
/**
* @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));
}
示例4: save
/**
* @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));
}
示例5: save
/**
* @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));
}
示例6: save
/**
* @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
));
}
示例7: save
/**
* @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);
}
示例8: save
/**
* @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));
}
示例9: validate
/**
* @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');
}
}
示例10: save
/**
* @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);
}
示例11: save
/**
* @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);
}
示例12: save
/**
* @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));
}
示例13: save
/**
* @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);
}
示例14: save
/**
* @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);
}
示例15: save
/**
* @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);
}