public static function getAdvancedForm() { $form = new \Ip\Form(); $form->addClass('ipsConfigForm'); $form->addClass('ipsConfigFormAdvanced'); $form->addClass('hidden'); $form->setAjaxSubmit(0); $field = new \Ip\Form\Field\Checkbox(array('name' => 'automaticCron', 'value' => ipGetOption('Config.automaticCron', 1), 'label' => __('Execute cron automatically', 'Ip-admin', false), 'hint' => __('ImpressPages execute cron once every hour on randomly selected visitor page load. I you have setup cron manually, you can disable automatic cron functionality.', 'Ip-admin'))); $field->addClass('ipsAutoSave'); $field->addAttribute('data-fieldid', $field->getName()); $field->addAttribute('id', $field->getName()); $field->addAttribute('data-fieldname', $field->getName()); $form->addField($field); $field = new \Ip\Form\Field\Text(array('name' => 'cronPassword', 'value' => ipGetOption('Config.cronPassword', 1), 'label' => __('Cron password', 'Ip-admin', false), 'hint' => __('Protect cron from being abusively executed by the strangers.', 'Ip-admin', false), 'note' => '<span class="ipsUrlLabel">' . __('Cron URL: ', 'Ip-admin') . '</span><a target="_blank" class="ipsUrl"></a>')); $field->addClass('ipsAutoSave'); $field->addAttribute('data-fieldid', $field->getName()); $field->addAttribute('id', $field->getName()); $field->addAttribute('data-fieldname', $field->getName()); $form->addField($field); $field = new \Ip\Form\Field\Checkbox(array('name' => 'removeOldEmails', 'value' => ipGetOption('Config.removeOldEmails', 0), 'label' => __('Remove old emails from the log', 'Ip-admin', false))); $field->addClass('ipsAutoSave'); $field->addAttribute('data-fieldid', $field->getName()); $field->addAttribute('id', $field->getName()); $field->addAttribute('data-fieldname', $field->getName()); $form->addField($field); $field = new \Ip\Form\Field\Text(array('name' => 'removeOldEmailsDays', 'value' => ipGetOption('Config.removeOldEmailsDays', 720), 'label' => __('Days to keep emails', 'Ip-admin', false), 'hint' => __('Meaningful only if "Remove old emails" is on.', 'Ip-admin', false))); $field->addClass('ipsAutoSave'); $field->addAttribute('data-fieldid', $field->getName()); $field->addAttribute('id', $field->getName()); $field->addAttribute('data-fieldname', $field->getName()); $form->addField($field); $field = new \Ip\Form\Field\Checkbox(array('name' => 'removeOldRevisions', 'value' => ipGetOption('Config.removeOldRevisions', 0), 'label' => __('Remove old page revisions', 'Ip-admin', false))); $field->addClass('ipsAutoSave'); $field->addAttribute('data-fieldid', $field->getName()); $field->addAttribute('id', $field->getName()); $field->addAttribute('data-fieldname', $field->getName()); $form->addField($field); $field = new \Ip\Form\Field\Text(array('name' => 'removeOldRevisionsDays', 'value' => ipGetOption('Config.removeOldRevisionsDays', 720), 'label' => __('Days to keep revisions', 'Ip-admin', false), 'hint' => __('Meaningful only if "Remove old page revisions" is on.', 'Ip-admin', false))); $field->addClass('ipsAutoSave'); $field->addAttribute('data-fieldid', $field->getName()); $field->addAttribute('id', $field->getName()); $field->addAttribute('data-fieldname', $field->getName()); $form->addField($field); $field = new \Ip\Form\Field\Checkbox(array('name' => 'allowAnonymousUploads', 'value' => ipGetOption('Config.allowAnonymousUploads', 1), 'label' => __('Allow anonymous uploads', 'Ip-admin', false), 'hint' => __('Disabling this feature will prevent users from uploading files to your website. E.g. in contact forms.', 'Ip-admin'))); $field->addClass('ipsAutoSave'); $field->addAttribute('data-fieldid', $field->getName()); $field->addAttribute('id', $field->getName()); $field->addAttribute('data-fieldname', $field->getName()); $form->addField($field); $field = new \Ip\Form\Field\Checkbox(array('name' => 'trailingSlash', 'value' => ipGetOption('Config.trailingSlash', 1), 'label' => __('Add trailing slash at the end of page URL', 'Ip-admin', false), 'hint' => __('This won\'t change existing URLs. Only new and updated pages will get slash at the end.', 'Ip-admin'))); $field->addClass('ipsAutoSave'); $field->addAttribute('data-fieldid', $field->getName()); $field->addAttribute('id', $field->getName()); $field->addAttribute('data-fieldname', $field->getName()); $form->addField($field); return $form; }
public static function createForm() { $form = new \Ip\Form(); // Password input $field = new \Ip\Form\Field\Password(array('layout' => \Ip\Form\Field::LAYOUT_NO_LABEL, 'name' => 'pagePassword', 'label' => __('Password', 'PagePassword', false), 'validators' => array('Required'))); $field->addAttribute('id', 'auth_password'); $field->addClass('auth_password'); $form->addField($field); // Submit Button $field = new \Ip\Form\Field\Submit(array('value' => __('Authenticate', 'PagePassword', false))); $field->addAttribute('id', 'auth_submit'); $field->addClass('auth_submit'); $form->addField($field); $form->addAttribute('id', 'auth_form'); $form->addClass('auth_form'); $curUrl = \Ip\Internal\UrlHelper::getCurrentUrl(); $form->setAction($curUrl); $form->setAjaxSubmit(false); return $form; }
public static function createForm() { $userId = Null; $userName = ''; $userMail = ''; $vCode = md5(uniqid(rand(), true)); $pageId = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $pageId = 'http://' . parse_url($pageId, PHP_URL_HOST) . parse_url($pageId, PHP_URL_PATH); if (ipUser()->isLoggedIn()) { $userData = ipUser()->data(); $userId = $userData['id']; $userName = $userData['username']; $userMail = $userData['email']; } $form = new \Ip\Form(); $form->addClass('commentForm'); $field = new \Ip\Form\Field\Text(array('name' => 'name', 'label' => __('Name', 'Comments'), 'validators' => array('Required'), 'value' => $userName)); $form->addField($field); $field = new \Ip\Form\Field\Email(array('name' => 'email', 'label' => __('Email', 'Comments'), 'validators' => array('Required'), 'value' => $userMail)); $form->addField($field); $field = new \Ip\Form\Field\Text(array('name' => 'link', 'label' => __('Website', 'Comments'))); $form->addField($field); $field = new \Ip\Form\Field\Textarea(array('name' => 'text', 'label' => __('Comment', 'Comments'), 'validators' => array('Required'))); $fileValLimits = new ValidateLimits(); $field->addValidator($fileValLimits); $form->addField($field); $field = new \Ip\Form\Field\Hidden(array('name' => 'id', 'value' => $userId)); $form->addField($field); $field = new \Ip\Form\Field\Hidden(array('name' => 'ip', 'value' => $_SERVER['REMOTE_ADDR'])); $form->addField($field); if (ipGetOption('Comments.requireEmailConfirmation') == 'Yes') { $aprFree = 0; } else { $aprFree = 1; } $field = new \Ip\Form\Field\Hidden(array('name' => 'approved', 'value' => !empty($userId) ? '1' : $aprFree)); $form->addField($field); $field = new \Ip\Form\Field\Hidden(array('name' => 'verification_code', 'value' => $vCode)); $form->addField($field); $field = new \Ip\Form\Field\Hidden(array('name' => 'session_id', 'value' => session_id())); $form->addField($field); $field = new \Ip\Form\Field\Hidden(array('name' => 'zone_name', 'value' => $pageId)); $form->addField($field); $field = new \Ip\Form\Field\Hidden(array('name' => 'language_id', 'value' => ipContent()->getCurrentLanguage()->getId())); $form->addField($field); $field = new \Ip\Form\Field\Hidden(array('name' => 'wgetId', 'value' => isset($_COOKIE['widGetId']) ? $_COOKIE['widGetId'] : '')); $form->addField($field); //FIXED NOW 05/26/15 if (ipGetOption('Comments.requireAdminPermission') == 'Yes') { $aFree = 0; } else { $aFree = 1; } $field = new \Ip\Form\Field\Hidden(array('name' => 'active', 'value' => $aFree)); $form->addField($field); $field = new \Ip\Form\Field\Hidden(array('name' => 'sa', 'value' => 'Comments.save')); $form->addField($field); $field = new \Ip\Form\Field\Submit(array('value' => __('Send', 'Comments'))); $field->addAttribute('onsubmit', 'parent.scrollTo(0, 0); return true'); $form->addField($field); //$form->addField(new \Ip\Form\Field\Submit(array('value' => __('Send', 'Comments')))); return $form; }
public static function getPasswordResetForm2() { //create form object $form = new \Ip\Form(); //add text field to form object $field = new \Ip\Form\Field\Hidden(array('name' => 'sa', 'value' => 'Admin.passwordResetAjax2')); $form->addfield($field); //add text field to form object $field = new \Ip\Form\Field\Hidden(array('name' => 'secret', 'value' => ipRequest()->getQuery('secret', ''))); $form->addfield($field); //add text field to form object $field = new \Ip\Form\Field\Hidden(array('name' => 'userId', 'value' => ipRequest()->getQuery('id', ''))); $form->addfield($field); //add text field to form object $field = new \Ip\Form\Field\Blank(array('name' => 'global_error')); $form->addfield($field); //add text field to form object $field = new \Ip\Form\Field\Password(array('name' => 'password', 'label' => __('New password', 'Ip-admin', false))); $field->addValidator('Required'); $form->addField($field); //add text field to form object $field = new \Ip\Form\Field\Submit(array('value' => __('Save', 'Ip-admin', false))); $field->addClass('ipsLoginButton'); $form->addField($field); $form->addClass('ipsPasswordResetForm2'); return $form; }
public function searchForm($searchVariables) { $form = new \Ip\Form(); $form->setMethod('get'); $form->addAttribute('autocomplete', 'off'); $form->removeCsrfCheck(); foreach ($this->subgridConfig->fields() as $key => $fieldData) { if (isset($fieldData['allowSearch']) && !$fieldData['allowSearch']) { continue; } if (!empty($fieldData['type']) && $fieldData['type'] == 'Tab') { //tabs (fieldsets) $title = ''; if (!empty($fieldData['label'])) { $title = $fieldData['label']; } if ($key == 0) { $fieldsets = $form->getFieldsets(); $fieldset = $fieldsets[0]; $fieldset->setLabel($title); } else { $fieldset = new \Ip\Form\Fieldset($title); $form->addFieldset($fieldset); } $fieldset->addAttribute('id', 'autoGridTabId' . rand(0, 100000000000)); if ($key == 0) { $fieldset->addAttribute('class', 'tab-pane active'); } else { $fieldset->addAttribute('class', 'tab-pane'); } } else { $fieldObject = $this->subgridConfig->fieldObject($fieldData); $field = $fieldObject->searchField($searchVariables); if ($field) { $form->addField($field); } } } $field = new \Ip\Form\Field\Hidden(array('name' => 'method', 'value' => 'search')); $form->addField($field); $field = new \Ip\Form\Field\HiddenSubmit(); $form->addField($field); if (count($form->getFieldsets()) > 1) { $form->addClass('tab-content'); } return $form; }