/** * Set the field values * * @param array $values * @param array $filters * @param \Phire\Auth\Auth $auth * @param \Phire\Table\UserTypes $type * @param \Phire\Model\User $user * @return \Pop\Form\Form */ public function setFieldValues(array $values = null, $filters = null, $auth = null, $type = null, $user = null) { parent::setFieldValues($values, $filters); if ($_POST) { // Authenticate and get the auth result $auth->authenticate($this->username, $this->password); $result = $auth->getAuthResult($type, $this->username); if (null !== $result) { $user->login($this->username, $type, false); if ($auth->getResult() == \Pop\Auth\Auth::PASSWORD_INCORRECT) { $this->getElement('password')->addValidator(new Validator\NotEqual($this->password, $result)); } else { $this->getElement('username')->addValidator(new Validator\NotEqual($this->username, $result)); } } // Check the user's allowed sites if (strtolower($type->type) != 'user') { $u = Table\Users::findBy(array('username' => $this->username)); if (isset($u->id)) { $siteIds = unserialize($u->site_ids); $site = Table\Sites::findBy(array('document_root' => $_SERVER['DOCUMENT_ROOT'])); $siteId = isset($site->id) ? $site->id : '0'; if (!in_array($siteId, $siteIds)) { $this->getElement('username')->addValidator(new Validator\NotEqual($this->username, $this->i18n->__('That user is not allowed on this site.'))); } } } } return $this; }
/** {@inheritdoc} */ public function setData($data) { if (empty($data['OriginalId'])) { throw new \LogicException('OriginalId not set or empty'); } return parent::setData($data); }
/** {@inheritdoc} */ public function init() { parent::init(); $displayBlacklistedSoftware = new \Zend\Form\Element\Checkbox('displayBlacklistedSoftware'); $displayBlacklistedSoftware->setLabel('Display ignored software'); $this->get('Preferences')->add($displayBlacklistedSoftware); }
/** {@inheritdoc} */ public function setData($data) { $data['Preferences']['lockValidity'] = $this->localize($data['Preferences']['lockValidity'], 'integer'); $data['Preferences']['sessionValidity'] = $this->localize($data['Preferences']['sessionValidity'], 'integer'); $data['Preferences']['sessionCleanupInterval'] = $this->localize($data['Preferences']['sessionCleanupInterval'], 'integer'); return parent::setData($data); }
/** * @see Page::show() */ public function show() { // enable menu item if (!empty($this->activeMenuItem)) { WCFACP::getMenu()->setActiveMenuItem($this->activeMenuItem); } parent::show(); }
public function init() { $this->setName('usuario'); $this->addElement('hidden', 'id', array('label' => 'id', 'value' => '', 'validators' => array(), 'required' => false)); $this->addElement('text', 'email', array('label' => 'email', 'maxlength' => '100', 'class' => 'text text-email required', 'value' => '', 'validators' => array(array('StringLength', false, array(0, 200))), 'required' => true)); $this->addElement('text', 'senha', array('label' => 'senha', 'maxlength' => '32', 'class' => 'text text-senha required', 'value' => '', 'validators' => array(array('StringLength', false, array(0, 32))), 'required' => true)); parent::init(); }
/** {@inheritdoc} */ public function setData($data) { $data['Preferences']['scannersPerSubnet'] = $this->localize($data['Preferences']['scannersPerSubnet'], 'integer'); $data['Preferences']['scannerMinDays'] = $this->localize($data['Preferences']['scannerMinDays'], 'integer'); $data['Preferences']['scannerMaxDays'] = $this->localize($data['Preferences']['scannerMaxDays'], 'integer'); $data['Preferences']['scanArpDelay'] = $this->localize($data['Preferences']['scanArpDelay'], 'integer'); return parent::setData($data); }
public function __construct() { parent::__construct(); $this->add(array('name' => 'option_id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'choice_id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'product_id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'override_name', 'attributes' => array('type' => 'text'), 'options' => array('label' => 'Name'))); }
public function __construct() { parent::__construct(); $this->labelWidth = 3; $this->controlWidth = 9; $this->compact = true; $this->addText('name', 'Name')->addText('host', 'Hostname')->addText('port', 'Port')->addText('ssl', 'SSL')->addText('username', 'Username')->addPassword('password', 'Password')->addButton('submit', 'Submit', 'btn-primary'); }
public function __construct() { parent::__construct(); $this->add(array('name' => 'spec_id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'product_id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'label', 'options' => array('label' => 'Label'))); $this->add(array('name' => 'value', 'options' => array('label' => 'Value'))); }
public function __construct() { parent::__construct(); $this->add(array('name' => 'document_id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'product_id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'label', 'options' => array('label' => 'Label'))); $this->add(array('name' => 'file_name', 'options' => array('label' => 'FileName'))); }
public function init() { $this->setName('tributo'); $this->addElement('hidden', 'id', array('label' => 'id', 'value' => '', 'validators' => array(), 'required' => false)); $this->addElement('text', 'nome', array('label' => 'nome', 'maxlength' => '45', 'class' => 'text text-nome required', 'value' => '', 'validators' => array(array('StringLength', false, array(0, 45))), 'required' => true)); $this->addElement('text', 'imposto', array('label' => 'imposto', 'maxlength' => '13', 'class' => 'text required', 'value' => '', 'validators' => array(array('StringLength', false, array(0, 13))), 'required' => true)); parent::init(); }
public function __construct() { parent::__construct(); $this->compact = true; $this->labelWidth = 4; $this->controlWidth = 8; $this->addText('domain_name', 'Domain Name')->addText('domain_name_short', 'Short Domain Name')->addText('domain_controller', 'Domain Controller')->addText('ldap_port', 'LDAP Port Number')->addText('user', 'Username')->addPassword('password', 'Password')->addText('use_start_tls', 'Use Start TLS')->addText('baseDn', 'Base DN')->addButton('submit', 'Submit', 'btn-primary'); }
/** * @see Form::save() */ public function save() { AbstractForm::save(); $this->source->update($this->name, $this->sourceDirectory, $this->buildDirectory, $this->scm, $this->url, $this->username, $this->password, null, $this->trustServerCert, $this->enableCheckout); // call saved event $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
/** * @see Form::save() */ public function save() { AbstractForm::save(); // update $this->suspension->update($this->title, $this->points, $this->suspension->suspensions == 0 ? $this->suspensionType : $this->suspension->suspensionType, $this->suspension->suspensions == 0 ? $this->suspensionTypeObject->getData() : unserialize($this->suspension->suspensionData), $this->expiresHour * 3600 + $this->expiresDay * 86400 + $this->expiresWeek * 86400 * 7); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
public function __construct() { parent::__construct(); $this->add(array('name' => 'product_id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'quantity', 'attributes' => array('type' => 'text', 'class' => 'span1'), 'options' => array('label' => 'Quantity'))); $this->add(array('name' => 'price', 'attributes' => array('type' => 'text', 'class' => 'span1'), 'options' => array('label' => 'Price'))); $this->add(array('name' => 'retail', 'attributes' => array('type' => 'text', 'class' => 'span1'), 'options' => array('label' => 'Retail'))); $this->add(array('name' => 'enabled', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('type' => 'select', 'options' => array(1 => 'Yes', 0 => 'No')), 'options' => array('label' => 'Enabled'))); }
/** * @see Form::save() */ public function save() { AbstractForm::save(); // save rule $this->rule->update($this->title, $this->logicalOperator, $this->ruleConditions, $this->ruleAction, $this->ruleDestination, intval(!$this->enabled)); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
/** * Constructor method to instantiate the form object * * @param string $action * @param string $method * @return self */ public function __construct($action = null, $method = 'post') { parent::__construct($action, $method, null, ' '); $this->initFieldsValues = array('name' => array('type' => 'text', 'label' => $this->i18n->__('Name & Order'), 'required' => true, 'attributes' => array('size' => 40, 'style' => 'width: 376px;')), 'order' => array('type' => 'text', 'attributes' => array('size' => 3), 'value' => 0), 'dynamic' => array('type' => 'radio', 'label' => $this->i18n->__('Dynamic') . '?', 'value' => array('0' => $this->i18n->__('No'), '1' => $this->i18n->__('Yes')), 'marked' => '0'), 'id' => array('type' => 'hidden', 'value' => 0), 'update_value' => array('type' => 'hidden', 'value' => 0), 'submit' => array('type' => 'submit', 'label' => ' ', 'value' => $this->i18n->__('SAVE'), 'attributes' => array('class' => 'save-btn', 'style' => 'width: 190px;')), 'update' => array('type' => 'button', 'value' => $this->i18n->__('UPDATE'), 'attributes' => array('onclick' => "return phire.updateForm('#field-group-form', false);", 'class' => 'update-btn', 'style' => 'width: 190px;'))); if (strpos($_SERVER['REQUEST_URI'], '/edit/') !== false) { $this->initFieldsValues['name']['attributes']['onkeyup'] = "phire.updateTitle('#field-group-title', this);"; } $this->setAttributes('id', 'field-group-form'); }
/** * @see Form::save() */ public function save() { AbstractForm::save(); // save server $this->entry->update($this->kind, $this->rulesetTable, $this->rulesetColumn, $this->rulesetColumnTime); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
/** * @see Form::validate() */ public function save() { AbstractForm::save(); // update $this->rank->update($this->title, $this->image, $this->groupID, $this->neededPoints, $this->gender, $this->repeatImage); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
public function __construct(Smarty $smarty, Context $context, TranslatorInterface $translator, CustomerLoginFormatter $formatter, array $urls) { parent::__construct($smarty, $translator, $formatter); $this->context = $context; $this->translator = $translator; $this->formatter = $formatter; $this->urls = $urls; $this->constraintTranslator = new ValidateConstraintTranslator($this->translator); }
/** * @see Form::save() */ public function save() { AbstractForm::save(); // update item $this->contestRatingoption->update($this->classID, $this->topic, $this->text, $this->languageID); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
public function __construct() { parent::__construct(); $this->add(array('name' => 'product_id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'name', 'attributes' => array('type' => 'text'), 'options' => array('label' => 'Name'))); $this->add(array('name' => 'description', 'attributes' => array('type' => 'textarea'), 'options' => array('label' => 'Description'))); $this->add(array('name' => 'item_number', 'attributes' => array('type' => 'text'), 'options' => array('label' => 'Item Number'))); $this->add(array('name' => 'product_type_id', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('type' => 'select', 'options' => array('1' => 'Shell', '2' => 'Product')), 'options' => array('label' => 'Product Type'))); }
/** * @see Form::save() */ public function save() { AbstractForm::save(); // save server $this->updateServer->update($this->server, $this->htUsername, $this->htPassword); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
/** * Set the field values * * @param array $values * @param array $filters * @param \Pop\Config $config * @return \Pop\Form\Form */ public function setFieldValues(array $values = null, $filters = null, $config = null) { parent::setFieldValues($values, $filters); if ($this->id != 0) { if (null !== $this->getElement('email2')) { $this->getElement('email2')->setRequired(false); } if (null !== $this->getElement('password1') && null === $this->reset_pwd) { $this->getElement('password1')->setRequired(false); $this->getElement('password2')->setRequired(false); } } // Add validators for checking dupe usernames // and matching the emails and passwords if ($_POST && isset($_POST['id'])) { if (isset($this->fields['username'])) { $username = $this->username; $usernameField = 'username'; } else { $username = $this->email1; $usernameField = 'email1'; } $user = Table\Users::findBy(array('username' => $username)); if (isset($user->id) && $this->id != $user->id) { $this->getElement($usernameField)->addValidator(new Validator\NotEqual($username, $this->i18n->__('That user already exists.'))); } $email = Table\Users::findBy(array('email' => $this->email1)); if (isset($email->id) && $this->id != $email->id) { $this->getElement('email1')->addValidator(new Validator\NotEqual($this->email1, $this->i18n->__('That email already exists.'))); } if (null !== $this->getElement('email2')) { $this->getElement('email2')->addValidator(new Validator\Equal($this->email1, $this->i18n->__('The emails do not match.'))); } // If the password fields are set, check them for a match if (isset($this->password2)) { $this->getElement('password2')->addValidator(new Validator\Equal($this->password1, $this->i18n->__('The passwords do not match.'))); } if ($this->reset_pwd) { $user = Table\Users::findById($this->id); if (isset($user->id)) { $curPassword = $user->password; $type = Table\UserTypes::findById($user->type_id); if (isset($type->id)) { $encOptions = $config->encryptionOptions->asArray(); $auth = new \Pop\Auth\Adapter\Table('Phire\\Table\\Users'); $result = $auth->authenticate($this->username, $this->password2, $type->password_encryption, $encOptions); if ($result != \Pop\Auth\Auth::PASSWORD_INCORRECT) { $this->getElement('password2')->addValidator(new Validator\Equal($curPassword, $this->i18n->__('The new password cannot be the same.'))); } } } } } $this->checkFiles(); return $this; }
/** * @see Form::save() */ public function save() { AbstractForm::save(); // update item $this->helpItem->update($this->topic, $this->text, $this->parentItem, $this->refererPattern, $this->showOrder, $this->isDisabled, $this->languageID); HelpItemEditor::clearCache(); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
/** * @see Form::save() */ public function save() { AbstractForm::save(); // save sponsortalk $this->entry->update($this->message); $this->saved(); // forward HeaderUtil::redirect('index.php?page=ContestSponsortalk&contestID=' . $this->entry->contestID . '&sponsortalkID=' . $this->entry->sponsortalkID . SID_ARG_2ND_NOT_ENCODED . '#sponsortalk' . $this->entry->sponsortalkID); exit; }
/** * @see Form::save() */ public function save() { AbstractForm::save(); // save entry $this->entry->update($this->entry->contestID, $this->entry->userID, $this->entry->groupID, $this->state); $this->saved(); // forward HeaderUtil::redirect('index.php?page=ContestSponsor&contestID=' . $this->entry->contestID . SID_ARG_2ND_NOT_ENCODED . '#entry' . $this->entry->sponsorID); exit; }
/** * @see Form::save() */ public function save() { AbstractForm::save(); // save price $this->entry->update($this->subject, $this->text, $this->secretMessage, $this->state, $this->attachmentListEditor); $this->saved(); // forward HeaderUtil::redirect('index.php?page=ContestPrice&contestID=' . $this->entry->contestID . '&priceID=' . $this->entry->priceID . SID_ARG_2ND_NOT_ENCODED . '#priceObj' . $this->entry->priceID); exit; }
public function __construct() { parent::__construct(); $this->add(array('name' => 'uom_code', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'product_id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'quantity', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'distributor_item_number', 'attributes' => array('type' => 'text', 'class' => 'span1'), 'options' => array('label' => 'Dist Item#'))); $this->add(array('name' => 'distributor_uom_code', 'attributes' => array('type' => 'text'), 'options' => array('label' => 'Dist UOM'))); $this->add(array('name' => 'cost', 'attributes' => array('type' => 'text'), 'options' => array('label' => 'Cost'))); }