/** * Constructor. */ function InstallForm() { parent::Form('install/install.tpl'); // FIXME Move the below options to an external configuration file? $this->supportedLocales = AppLocale::getAllLocales(); $this->localesComplete = array(); foreach ($this->supportedLocales as $key => $name) { $this->localesComplete[$key] = AppLocale::isLocaleComplete($key); } $this->supportedClientCharsets = array('utf-8' => 'Unicode (UTF-8)', 'iso-8859-1' => 'Western (ISO-8859-1)'); $this->supportedConnectionCharsets = array('' => __('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)'); $this->supportedDatabaseCharsets = array('' => __('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)'); $this->supportedEncryptionAlgorithms = array('md5' => 'MD5'); if (function_exists('sha1')) { $this->supportedEncryptionAlgorithms['sha1'] = 'SHA1'; } $this->supportedDatabaseDrivers = array('mysql' => array('mysql', 'MySQL'), 'postgres' => array('pgsql', 'PostgreSQL'), 'oracle' => array('oci8', 'Oracle'), 'mssql' => array('mssql', 'MS SQL Server'), 'fbsql' => array('fbsql', 'FrontBase'), 'ibase' => array('ibase', 'Interbase'), 'firebird' => array('ibase', 'Firebird'), 'informix' => array('ifx', 'Informix'), 'sybase' => array('sybase', 'Sybase'), 'odbc' => array('odbc', 'ODBC')); // Validation checks for this form $this->addCheck(new FormValidatorInSet($this, 'locale', 'required', 'installer.form.localeRequired', array_keys($this->supportedLocales))); $this->addCheck(new FormValidatorCustom($this, 'locale', 'required', 'installer.form.localeRequired', array('AppLocale', 'isLocaleValid'))); $this->addCheck(new FormValidatorInSet($this, 'clientCharset', 'required', 'installer.form.clientCharsetRequired', array_keys($this->supportedClientCharsets))); $this->addCheck(new FormValidator($this, 'filesDir', 'required', 'installer.form.filesDirRequired')); $this->addCheck(new FormValidatorInSet($this, 'encryption', 'required', 'installer.form.encryptionRequired', array_keys($this->supportedEncryptionAlgorithms))); $this->addCheck(new FormValidator($this, 'adminUsername', 'required', 'installer.form.usernameRequired')); $this->addCheck(new FormValidatorAlphaNum($this, 'adminUsername', 'required', 'installer.form.usernameAlphaNumeric')); $this->addCheck(new FormValidatorLength($this, 'adminPassword', 'required', 'user.register.form.passwordLengthTooShort', '>=', INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH)); $this->addCheck(new FormValidator($this, 'adminPassword', 'required', 'installer.form.passwordRequired')); $this->addCheck(new FormValidatorCustom($this, 'adminPassword', 'required', 'installer.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'adminPassword2\');'), array(&$this))); $this->addCheck(new FormValidatorEmail($this, 'adminEmail', 'required', 'installer.form.emailRequired')); $this->addCheck(new FormValidatorInSet($this, 'databaseDriver', 'required', 'installer.form.databaseDriverRequired', array_keys($this->supportedDatabaseDrivers))); $this->addCheck(new FormValidator($this, 'databaseName', 'required', 'installer.form.databaseNameRequired')); $this->addCheck(new FormValidatorPost($this)); }
function AddEmailForm() { Form::Form('AddEmailForm'); CGlobal::$website_title = "Thêm Email list"; $this->link_css('style/manage_item.css'); $this->email_list = array('email_list' => ''); }
function ListModuleAdminForm() { Form::Form('ListModuleAdminForm'); CGlobal::$website_title = "Quản trị Modules"; $this->link_css('style/manage_content.css'); CGlobal::$website_title = "Quản trị Modules"; }
/** * Constructor */ function SubscriptionPolicyForm() { for ($i = SUBSCRIPTION_OPEN_ACCESS_DELAY_MIN; $i <= SUBSCRIPTION_OPEN_ACCESS_DELAY_MAX; $i++) { $this->validDuration[$i] = $i; } for ($i = SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_MONTHS_MIN; $i <= SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_MONTHS_MAX; $i++) { $this->validNumMonthsBeforeExpiry[$i] = $i; } for ($i = SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_WEEKS_MIN; $i <= SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_WEEKS_MAX; $i++) { $this->validNumWeeksBeforeExpiry[$i] = $i; } for ($i = SUBSCRIPTION_EXPIRY_REMINDER_AFTER_MONTHS_MIN; $i <= SUBSCRIPTION_EXPIRY_REMINDER_AFTER_MONTHS_MAX; $i++) { $this->validNumMonthsAfterExpiry[$i] = $i; } for ($i = SUBSCRIPTION_EXPIRY_REMINDER_AFTER_WEEKS_MIN; $i <= SUBSCRIPTION_EXPIRY_REMINDER_AFTER_WEEKS_MAX; $i++) { $this->validNumWeeksAfterExpiry[$i] = $i; } parent::Form('subscription/subscriptionPolicyForm.tpl'); // If provided, subscription contact email is valid $this->addCheck(new FormValidatorEmail($this, 'subscriptionEmail', 'optional', 'manager.subscriptionPolicies.subscriptionContactEmailValid')); // If provided delayed open access duration is valid value $this->addCheck(new FormValidatorInSet($this, 'delayedOpenAccessDuration', 'optional', 'manager.subscriptionPolicies.delayedOpenAccessDurationValid', array_keys($this->validDuration))); // If provided expiry reminder months before value is valid value $this->addCheck(new FormValidatorInSet($this, 'numMonthsBeforeSubscriptionExpiryReminder', 'optional', 'manager.subscriptionPolicies.numMonthsBeforeSubscriptionExpiryReminderValid', array_keys($this->validNumMonthsBeforeExpiry))); // If provided expiry reminder weeks before value is valid value $this->addCheck(new FormValidatorInSet($this, 'numWeeksBeforeSubscriptionExpiryReminder', 'optional', 'manager.subscriptionPolicies.numWeeksBeforeSubscriptionExpiryReminderValid', array_keys($this->validNumWeeksBeforeExpiry))); // If provided expiry reminder months after value is valid value $this->addCheck(new FormValidatorInSet($this, 'numMonthsAfterSubscriptionExpiryReminder', 'optional', 'manager.subscriptionPolicies.numMonthsAfterSubscriptionExpiryReminderValid', array_keys($this->validNumMonthsAfterExpiry))); // If provided expiry reminder weeks after value is valid value $this->addCheck(new FormValidatorInSet($this, 'numWeeksAfterSubscriptionExpiryReminder', 'optional', 'manager.subscriptionPolicies.numWeeksAfterSubscriptionExpiryReminderValid', array_keys($this->validNumWeeksAfterExpiry))); $this->addCheck(new FormValidatorPost($this)); }
function FormSiteUrls(&$template, $siteAdmin) { parent::Form($template); $this->siteAdmin = $siteAdmin; $o_site = new Site($siteAdmin); $this->a_urls = $o_site->getUrls(); }
/** * Constructor. */ function SubmissionMetadataForm($monographId) { parent::Form('controllers/modals/submissionMetadata/form/submissionMetadata.tpl'); $this->_monographId = (int) $monographId; // Validation checks for this form $this->addCheck(new FormValidatorPost($this)); }
/** * Constructor. * @param $filter Filter * @param $filterGroupSymbolic string * @param $title string * @param $description string */ function FilterForm(&$filter, $title, $description, $filterGroupSymbolic) { parent::Form('controllers/grid/filter/form/filterForm.tpl'); // Initialize internal state. $this->_filter =& $filter; $this->_title = $title; $this->_description = $description; $this->_filterGroupSymbolic = $filterGroupSymbolic; // Transport filter/template id. $this->readUserVars(array('filterId', 'filterTemplateId')); // Validation check common to all requests. $this->addCheck(new FormValidatorPost($this)); // Validation check for template selection. if (!is_null($filter) && !is_numeric($filter->getId())) { $this->addCheck(new FormValidator($this, 'filterTemplateId', 'required', 'manager.setup.filter.grid.filterTemplateRequired')); } // Add filter specific meta-data and checks. if (is_a($filter, 'Filter')) { $this->setData('filterSettings', $filter->getSettings()); foreach ($filter->getSettings() as $filterSetting) { // Add check corresponding to filter setting. $settingCheck =& $filterSetting->getCheck($this); if (!is_null($settingCheck)) { $this->addCheck($settingCheck); } } } }
function RegisterForm() { $this->link_css('style/register.css'); // $this->link_js('style/platform/js/register.js'); Form::Form('Register'); CGlobal::$website_title = " Sign up"; }
/** * Constructor * @param typeId int leave as default for new subscription type */ function SubscriptionTypeForm($typeId = null) { $this->validFormats = array(SUBSCRIPTION_TYPE_FORMAT_ONLINE => __('subscriptionTypes.format.online'), SUBSCRIPTION_TYPE_FORMAT_PRINT => __('subscriptionTypes.format.print'), SUBSCRIPTION_TYPE_FORMAT_PRINT_ONLINE => __('subscriptionTypes.format.printOnline')); $currencyDao = DAORegistry::getDAO('CurrencyDAO'); $currencies = $currencyDao->getCurrencies(); $this->validCurrencies = array(); while (list(, $currency) = each($currencies)) { $this->validCurrencies[$currency->getCodeAlpha()] = $currency->getName() . ' (' . $currency->getCodeAlpha() . ')'; } $this->typeId = isset($typeId) ? (int) $typeId : null; parent::Form('subscription/subscriptionTypeForm.tpl'); // Type name is provided $this->addCheck(new FormValidatorLocale($this, 'name', 'required', 'manager.subscriptionTypes.form.typeNameRequired')); // Cost is provided and is numeric and positive $this->addCheck(new FormValidator($this, 'cost', 'required', 'manager.subscriptionTypes.form.costRequired')); $this->addCheck(new FormValidatorCustom($this, 'cost', 'required', 'manager.subscriptionTypes.form.costNumeric', create_function('$cost', 'return (is_numeric($cost) && $cost >= 0);'))); // Currency is provided and is valid value $this->addCheck(new FormValidator($this, 'currency', 'required', 'manager.subscriptionTypes.form.currencyRequired')); $this->addCheck(new FormValidatorInSet($this, 'currency', 'required', 'manager.subscriptionTypes.form.currencyValid', array_keys($this->validCurrencies))); // Non-expiring flag is valid value $this->addCheck(new FormValidatorInSet($this, 'nonExpiring', 'optional', 'manager.subscriptionTypes.form.nonExpiringValid', array('0', '1'))); // Format is provided and is valid value $this->addCheck(new FormValidator($this, 'format', 'required', 'manager.subscriptionTypes.form.formatRequired')); $this->addCheck(new FormValidatorInSet($this, 'format', 'required', 'manager.subscriptionTypes.form.formatValid', array_keys($this->validFormats))); // Institutional flag is valid value $this->addCheck(new FormValidatorInSet($this, 'institutional', 'optional', 'manager.subscriptionTypes.form.institutionalValid', array('0', '1'))); // Membership flag is valid value $this->addCheck(new FormValidatorInSet($this, 'membership', 'optional', 'manager.subscriptionTypes.form.membershipValid', array('1'))); // Public flag is valid value $this->addCheck(new FormValidatorInSet($this, 'disable_public_display', 'optional', 'manager.subscriptionTypes.form.publicValid', array('1'))); $this->addCheck(new FormValidatorPost($this)); }
/** * Constructor */ function ScheduleForm() { parent::Form('manager/scheduler/scheduleForm.tpl'); $this->addCheck(new FormValidatorPost($this)); $this->schedConf =& Request::getSchedConf(); $this->publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO'); }
/** * Constructor. */ function InstallForm() { parent::Form('install/install.tpl'); // FIXME Move the below options to an external configuration file? $this->supportedLocales = Locale::getAllLocales(); $this->supportedClientCharsets = array('utf-8' => 'Unicode (UTF-8)', 'iso-8859-1' => 'Western (ISO-8859-1)'); $this->supportedConnectionCharsets = array('' => Locale::translate('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)'); $this->supportedDatabaseCharsets = array('' => Locale::translate('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)'); $this->supportedEncryptionAlgorithms = array('md5' => 'MD5'); if (function_exists('sha1')) { $this->supportedEncryptionAlgorithms['sha1'] = 'SHA1'; } $this->supportedDatabaseDrivers = array('mysql' => array('mysql', 'MySQL'), 'postgres' => array('pgsql', 'PostgreSQL'), 'oracle' => array('oci8', 'Oracle'), 'mssql' => array('mssql', 'MS SQL Server'), 'fbsql' => array('fbsql', 'FrontBase'), 'ibase' => array('ibase', 'Interbase'), 'firebird' => array('ibase', 'Firebird'), 'informix' => array('ifx', 'Informix'), 'sybase' => array('sybase', 'Sybase'), 'odbc' => array('odbc', 'ODBC')); // Validation checks for this form $this->addCheck(new FormValidatorInSet($this, 'locale', 'required', 'installer.form.localeRequired', array_keys($this->supportedLocales))); $this->addCheck(new FormValidatorCustom($this, 'locale', 'required', 'installer.form.localeRequired', array('Locale', 'isLocaleValid'))); $this->addCheck(new FormValidatorInSet($this, 'clientCharset', 'required', 'installer.form.clientCharsetRequired', array_keys($this->supportedClientCharsets))); $this->addCheck(new FormValidator($this, 'filesDir', 'required', 'installer.form.filesDirRequired')); $this->addCheck(new FormValidatorInSet($this, 'encryption', 'required', 'installer.form.encryptionRequired', array_keys($this->supportedEncryptionAlgorithms))); $this->addCheck(new FormValidator($this, 'adminUsername', 'required', 'installer.form.usernameRequired')); // Opatan Inc. : FormValidatorAlphaNum for username is removed // Opatan Inc. : Email Validator for admin username is added && email validator is removed $this->addCheck(new FormValidatorEmail($this, 'adminUsername', 'required', 'installer.form.adminEmailRequired')); $this->addCheck(new FormValidator($this, 'adminPassword', 'required', 'installer.form.passwordRequired')); $this->addCheck(new FormValidatorCustom($this, 'adminPassword', 'required', 'installer.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'adminPassword2\');'), array(&$this))); $this->addCheck(new FormValidatorInSet($this, 'databaseDriver', 'required', 'installer.form.databaseDriverRequired', array_keys($this->supportedDatabaseDrivers))); $this->addCheck(new FormValidator($this, 'databaseName', 'required', 'installer.form.databaseNameRequired')); $this->addCheck(new FormValidatorPost($this)); }
/** * Constructor. * @param $archiveId omit for a new archive */ function ArchiveForm($archiveId = null, $allowManagement = false) { parent::Form('admin/archiveForm.tpl'); $this->archiveId = isset($archiveId) ? (int) $archiveId : null; $this->allowManagement = $allowManagement; // Validation checks for this form $this->addCheck(new FormValidator($this, 'title', 'required', 'admin.archives.form.titleRequired')); $this->addCheck(new FormValidator($this, 'url', 'required', 'admin.archives.form.urlRequired')); $this->addCheck(new FormValidatorPost($this)); import('lib.pkp.classes.captcha.CaptchaManager'); $captchaManager = new CaptchaManager(); $this->captchaEnabled = $captchaManager->isEnabled(); if ($this->captchaEnabled && !Validation::isSiteAdmin()) { $this->addCheck(new FormValidatorCaptcha($this, 'captcha', 'captchaId', 'common.captchaField.badCaptcha')); } $this->harvesterPluginName = Request::getUserVar('harvesterPluginName'); if ($archiveId) { $archiveDao =& DAORegistry::getDAO('ArchiveDAO'); $this->archive =& $archiveDao->getArchive($this->archiveId, false); if (empty($this->harvesterPluginName) && $this->archive) { $this->harvesterPluginName = $this->archive->getHarvesterPluginName(); } } if (empty($this->harvesterPluginName)) { $site =& Request::getSite(); $this->harvesterPluginName = $site->getSetting('defaultHarvesterPlugin'); } $this->harvesters =& PluginRegistry::loadCategory('harvesters'); HookRegistry::call('ArchiveForm::ArchiveForm', array(&$this, $this->harvesterPluginName)); }
/** * Constructor. */ function RegistrationForm($site) { parent::Form('frontend/pages/userRegister.tpl'); // Validation checks for this form $this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.register.form.usernameExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByUsername'), array(), true)); $this->addCheck(new FormValidator($this, 'username', 'required', 'user.profile.form.usernameRequired')); $this->addCheck(new FormValidator($this, 'password', 'required', 'user.profile.form.passwordRequired')); $this->addCheck(new FormValidatorUsername($this, 'username', 'required', 'user.register.form.usernameAlphaNumeric')); $this->addCheck(new FormValidatorLength($this, 'password', 'required', 'user.register.form.passwordLengthRestriction', '>=', $site->getMinPasswordLength())); $this->addCheck(new FormValidatorCustom($this, 'password', 'required', 'user.register.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array(&$this))); $this->addCheck(new FormValidator($this, 'firstName', 'required', 'user.profile.form.firstNameRequired')); $this->addCheck(new FormValidator($this, 'lastName', 'required', 'user.profile.form.lastNameRequired')); $this->addCheck(new FormValidator($this, 'country', 'required', 'user.profile.form.countryRequired')); // Email checks $this->addCheck(new FormValidatorEmail($this, 'email', 'required', 'user.profile.form.emailRequired')); $this->addCheck(new FormValidatorCustom($this, 'email', 'required', 'user.register.form.emailExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByEmail'), array(), true)); $this->captchaEnabled = Config::getVar('captcha', 'captcha_on_register') && Config::getVar('captcha', 'recaptcha'); if ($this->captchaEnabled) { $this->addCheck(new FormValidatorReCaptcha($this, Request::getRemoteAddr(), 'common.captcha.error.invalid-input-response')); } $authDao = DAORegistry::getDAO('AuthSourceDAO'); $this->defaultAuth = $authDao->getDefaultPlugin(); if (isset($this->defaultAuth)) { $this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.register.form.usernameExists', create_function('$username,$form,$auth', 'return (!$auth->userExists($username) || $auth->authenticate($username, $form->getData(\'password\')));'), array(&$this, $this->defaultAuth))); } $this->addCheck(new FormValidatorPost($this)); $this->addCheck(new FormValidatorCSRF($this)); }
/** * Constructor. * @param $monograph Monograph * @param $stageId integer */ function StageParticipantForm(&$monograph, $stageId) { parent::Form('controllers/grid/users/stageParticipant/form/stageParticipantForm.tpl'); assert(is_a($monograph, 'Monograph')); $this->_monograph =& $monograph; $this->_stageId = (int) $stageId; }
/** * Constructor. */ function UserManagementForm($userId = null) { parent::Form('manager/people/userProfileForm.tpl'); if (!Validation::isJournalManager()) { $userId = null; } $this->userId = isset($userId) ? (int) $userId : null; $site =& Request::getSite(); // Validation checks for this form if ($userId == null) { $this->addCheck(new FormValidator($this, 'username', 'required', 'user.profile.form.usernameRequired')); $this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.register.form.usernameExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByUsername'), array($this->userId, true), true)); $this->addCheck(new FormValidatorAlphaNum($this, 'username', 'required', 'user.register.form.usernameAlphaNumeric')); if (!Config::getVar('security', 'implicit_auth')) { $this->addCheck(new FormValidator($this, 'password', 'required', 'user.profile.form.passwordRequired')); $this->addCheck(new FormValidatorLength($this, 'password', 'required', 'user.register.form.passwordLengthTooShort', '>=', $site->getMinPasswordLength())); $this->addCheck(new FormValidatorCustom($this, 'password', 'required', 'user.register.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array(&$this))); } } else { $this->addCheck(new FormValidatorLength($this, 'password', 'optional', 'user.register.form.passwordLengthTooShort', '>=', $site->getMinPasswordLength())); $this->addCheck(new FormValidatorCustom($this, 'password', 'optional', 'user.register.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array(&$this))); } $this->addCheck(new FormValidator($this, 'firstName', 'required', 'user.profile.form.firstNameRequired')); $this->addCheck(new FormValidator($this, 'lastName', 'required', 'user.profile.form.lastNameRequired')); $this->addCheck(new FormValidatorUrl($this, 'userUrl', 'optional', 'user.profile.form.urlInvalid')); $this->addCheck(new FormValidatorEmail($this, 'email', 'required', 'user.profile.form.emailRequired')); $this->addCheck(new FormValidatorCustom($this, 'email', 'required', 'user.register.form.emailExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByEmail'), array($this->userId, true), true)); $this->addCheck(new FormValidatorPost($this)); }
function FormSitePdfConfig(&$template, $siteAdmin, $pdfId = null) { parent::Form($template); $this->siteAdmin = $siteAdmin; $confpdf = new PdfConfigDb($siteAdmin); $this->tpl->assign('choix_pdf', $confpdf->getChoixPdf()); $this->tpl->assign('default_pdf', $confpdf->getDefaultPdf()); $this->tpl->assign('siteAdmin', $siteAdmin); $this->tpl->assign('pdfId', $pdfId); // case modify a pdf if (!is_null($pdfId)) { $o_pdf = $confpdf->getPdf($pdfId); $setDefault = getRequestVar("default", "false", "string"); if ($setDefault == "true") { $o_pdf->pdfParam = $confpdf->getDefaultPdf(); } $this->pdfId = $pdfId; $this->pdfName = $o_pdf->pdfName; $this->pdfParam = $o_pdf->pdfParam; $this->tpl->assign('pdf', $o_pdf); } else { // Add PDF : add a blank page //$paramPdf = array(array (PDF_KEY_FREE_PAGE, "false", "false")); $paramPdf = array(); $o_pdf = new PdfConfig("", $paramPdf, ""); $this->tpl->assign('pdf', $o_pdf); } }
/** * Constructor * @param $conferenceId int */ function StaticPagesSettingsForm(&$plugin, $conferenceId) { parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl'); $this->conferenceId = $conferenceId; $this->plugin =& $plugin; $this->addCheck(new FormValidatorPost($this)); }
function __construct() { $this->link_css('style/aznet/jquery.treeview.css'); $this->link_js('javascript/jquery/jquery.treeview.js'); $this->link_js('javascript/jquery/jquery.highlight-3.js'); Form::Form('SiteMapForm'); }
/** * Constructor * @param buyerUserId int */ function GiftIndividualSubscriptionForm($request, $buyerUserId = null) { parent::Form('subscription/giftIndividualSubscriptionForm.tpl'); $this->buyerUserId = isset($buyerUserId) ? (int) $buyerUserId : null; $this->request =& $request; $journal =& $this->request->getJournal(); $journalId = $journal->getId(); $subscriptionTypeDao =& DAORegistry::getDAO('SubscriptionTypeDAO'); $subscriptionTypes =& $subscriptionTypeDao->getSubscriptionTypesByInstitutional($journalId, false, false); $this->subscriptionTypes =& $subscriptionTypes->toArray(); // Require buyer and recipient names and emails $this->addCheck(new FormValidator($this, 'buyerFirstName', 'required', 'user.profile.form.firstNameRequired')); $this->addCheck(new FormValidator($this, 'buyerLastName', 'required', 'user.profile.form.lastNameRequired')); $this->addCheck(new FormValidatorEmail($this, 'buyerEmail', 'required', 'user.profile.form.emailRequired')); $this->addCheck(new FormValidatorCustom($this, 'buyerEmail', 'required', 'user.register.form.emailsDoNotMatch', create_function('$buyerEmail,$form', 'return $buyerEmail == $form->getData(\'confirmBuyerEmail\');'), array(&$this))); $this->addCheck(new FormValidator($this, 'recipientFirstName', 'required', 'user.profile.form.firstNameRequired')); $this->addCheck(new FormValidator($this, 'recipientLastName', 'required', 'user.profile.form.lastNameRequired')); $this->addCheck(new FormValidatorEmail($this, 'recipientEmail', 'required', 'user.profile.form.emailRequired')); $this->addCheck(new FormValidatorCustom($this, 'recipientEmail', 'required', 'user.register.form.emailsDoNotMatch', create_function('$recipientEmail,$form', 'return $recipientEmail == $form->getData(\'confirmRecipientEmail\');'), array(&$this))); // Require gift note title and note from buyer $this->addCheck(new FormValidator($this, 'giftNoteTitle', 'required', 'gifts.noteTitleRequired')); $this->addCheck(new FormValidator($this, 'giftNote', 'required', 'gifts.noteRequired')); // Ensure subscription type is valid $this->addCheck(new FormValidatorCustom($this, 'typeId', 'required', 'user.subscriptions.form.typeIdValid', create_function('$typeId, $journalId', '$subscriptionTypeDao =& DAORegistry::getDAO(\'SubscriptionTypeDAO\'); return ($subscriptionTypeDao->subscriptionTypeExistsByTypeId($typeId, $journalId) && $subscriptionTypeDao->getSubscriptionTypeInstitutional($typeId) == 0) && $subscriptionTypeDao->getSubscriptionTypeDisablePublicDisplay($typeId) == 0;'), array($journal->getId()))); // Ensure a locale is provided and valid $this->addCheck(new FormValidator($this, 'giftLocale', 'required', 'gifts.localeRequired'), create_function('$giftLocale, $availableLocales', 'return in_array($giftLocale, $availableLocales);'), array_keys($journal->getSupportedLocaleNames())); // Form was POSTed $this->addCheck(new FormValidatorPost($this)); }
/** * Constructor. * @param $monograph Monograph * @param $template string The template to display */ function EditorDecisionForm($monograph, $template) { parent::Form($template); $this->setMonograph($monograph); // Validation checks for this form $this->addCheck(new FormValidatorPost($this)); }
/** * Constructor. * @param $step the step number * @param $settings an associative array with the setting names as keys and associated types as values */ function JournalSetupForm($step, $settings) { parent::Form(sprintf('manager/setup/step%d.tpl', $step)); $this->addCheck(new FormValidatorPost($this)); $this->step = $step; $this->settings = $settings; }
/** * Constructor * @param registrationId int leave as default for new registration */ function RegistrationForm($registrationId = null, $userId = null) { $this->registrationId = isset($registrationId) ? (int) $registrationId : null; $this->userId = isset($userId) ? (int) $userId : null; $schedConf =& Request::getSchedConf(); parent::Form('registration/registrationForm.tpl'); // User is provided and valid $this->addCheck(new FormValidator($this, 'userId', 'required', 'manager.registration.form.userIdRequired')); $this->addCheck(new FormValidatorCustom($this, 'userId', 'required', 'manager.registration.form.userIdValid', create_function('$userId', '$userDao =& DAORegistry::getDAO(\'UserDAO\'); return $userDao->userExistsById($userId);'))); // Ensure that user does not already have a registration for this scheduled conference if ($this->registrationId == null) { $this->addCheck(new FormValidatorCustom($this, 'userId', 'required', 'manager.registration.form.registrationExists', array(DAORegistry::getDAO('RegistrationDAO'), 'registrationExistsByUser'), array($schedConf->getId()), true)); } else { $this->addCheck(new FormValidatorCustom($this, 'userId', 'required', 'manager.registration.form.registrationExists', create_function('$userId, $schedConfId, $registrationId', '$registrationDao =& DAORegistry::getDAO(\'RegistrationDAO\'); $checkId = $registrationDao->getRegistrationIdByUser($userId, $schedConfId); return ($checkId == 0 || $checkId == $registrationId) ? true : false;'), array($schedConf->getId(), $this->registrationId))); } // Registration type is provided and valid $this->addCheck(new FormValidator($this, 'typeId', 'required', 'manager.registration.form.typeIdRequired')); $this->addCheck(new FormValidatorCustom($this, 'typeId', 'required', 'manager.registration.form.typeIdValid', create_function('$typeId, $schedConfId', '$registrationTypeDao =& DAORegistry::getDAO(\'RegistrationTypeDAO\'); return $registrationTypeDao->registrationTypeExistsByTypeId($typeId, $schedConfId);'), array($schedConf->getId()))); // If provided, domain is valid $this->addCheck(new FormValidatorRegExp($this, 'domain', 'optional', 'manager.registration.form.domainValid', '/^' . '[A-Z0-9]+([\\-_\\.][A-Z0-9]+)*' . '\\.' . '[A-Z]{2,4}' . '$/i')); // If provided, IP range has IP address format; IP addresses may contain wildcards $this->addCheck(new FormValidatorRegExp($this, 'ipRange', 'optional', 'manager.registration.form.ipRangeValid', '/^' . '((([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2}|[' . REGISTRATION_IP_RANGE_WILDCARD . '])([.]([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2}|[' . REGISTRATION_IP_RANGE_WILDCARD . '])){3}((\\s)*[' . REGISTRATION_IP_RANGE_RANGE . '](\\s)*([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2}|[' . REGISTRATION_IP_RANGE_WILDCARD . '])([.]([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2}|[' . REGISTRATION_IP_RANGE_WILDCARD . '])){3}){0,1})|(([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2})([.]([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2})){3}([\\/](([3][0-2]{0,1})|([1-2]{0,1}[0-9])))))' . '((\\s)*' . REGISTRATION_IP_RANGE_SEPERATOR . '(\\s)*' . '((([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2}|[' . REGISTRATION_IP_RANGE_WILDCARD . '])([.]([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2}|[' . REGISTRATION_IP_RANGE_WILDCARD . '])){3}((\\s)*[' . REGISTRATION_IP_RANGE_RANGE . '](\\s)*([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2}|[' . REGISTRATION_IP_RANGE_WILDCARD . '])([.]([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2}|[' . REGISTRATION_IP_RANGE_WILDCARD . '])){3}){0,1})|(([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2})([.]([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-5]{2})){3}([\\/](([3][0-2]{0,1})|([1-2]{0,1}[0-9])))))' . ')*' . '$/i')); // Notify email flag is valid value $this->addCheck(new FormValidatorInSet($this, 'notifyEmail', 'optional', 'manager.registration.form.notifyEmailValid', array('1'))); $this->addCheck(new FormValidatorInSet($this, 'notifyPaymentEmail', 'optional', 'manager.registration.form.notifyEmailValid', array('1'))); $this->addCheck(new FormValidatorPost($this)); }
/** * Constructor. */ function CreateReviewerForm($sectionId) { parent::Form('sectionEditor/createReviewerForm.tpl'); $this->addCheck(new FormValidatorPost($this)); $site =& Request::getSite(); $this->sectionId = $sectionId; // Validation checks for this form $this->addCheck(new FormValidator($this, 'username', 'required', 'user.profile.form.usernameRequired')); $this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.register.form.usernameExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByUsername'), array(null, true), true)); $this->addCheck(new FormValidatorAlphaNum($this, 'username', 'required', 'user.register.form.usernameAlphaNumeric')); $this->addCheck(new FormValidator($this, 'firstName', 'required', 'user.profile.form.firstNameRequired')); $this->addCheck(new FormValidator($this, 'lastName', 'required', 'user.profile.form.lastNameRequired')); $this->addCheck(new FormValidatorUrl($this, 'userUrl', 'optional', 'user.profile.form.urlInvalid')); $this->addCheck(new FormValidatorEmail($this, 'email', 'required', 'user.profile.form.emailRequired')); $this->addCheck(new FormValidatorCustom($this, 'email', 'required', 'user.register.form.emailExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByEmail'), array(null, true), true)); $this->addCheck(new FormValidator($this, 'ercStatus', 'required', 'user.profile.form.ercStatusRequired')); $this->addCheck(new FormValidatorCustom($this, 'ercStatus', 'required', 'user.register.form.tooManyMembers', create_function('$ercStatus, $sectionId', ' $journal =& Request::getJournal(); if ($ercStatus == "Secretary"){ $sectionEditorsDao =& DAORegistry::getDAO(\'SectionEditorsDAO\'); $secretaries =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $sectionId); if (count($secretaries)>4) return true; else return false;} else { $ercReviewersDao =& DAORegistry::getDAO(\'ErcReviewersDAO\'); if ($ercStatus == "Chair") { $chairs =& $ercReviewersDao->getReviewersBySectionIdByStatus($journal->getId(), $sectionId, 1); if (count($chairs) != 0) return true; else return false;} elseif ($ercStatus == "Vice-Chair"){ $vicechairs =& $ercReviewersDao->getReviewersBySectionIdByStatus($journal->getId(), $sectionId, 2); if (count($vicechairs) != 0) return true; else return false;} elseif ($ercStatus == "Member"){ $members =& $ercReviewersDao->getReviewersBySectionId($journal->getId(), $sectionId); if (count($members) > 19) return true; else return false;} return false;}'), array($this->sectionId), true)); // Provide a default for sendNotify: If we're using one-click // reviewer access or email-based reviews, it's not necessary; // otherwise, it should default to on. $journal =& Request::getJournal(); $reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled'); $isEmailBasedReview = $journal->getSetting('mailSubmissionsToReviewers') == 1 ? true : false; $this->setData('sendNotify', $reviewerAccessKeysEnabled || $isEmailBasedReview ? false : true); }
function SearchSphinxForm() { Form::Form('SearchResultForm'); $this->link_css('style/listItem.css'); $keywords = AZLib::getParam('keywords'); if ($keywords != '') { CGlobal::$website_title = "{$keywords} - Tìm bởi " . WEB_NAME; CGlobal::$meta_desc = "Tìm kiếm nội dung liên quan tới {$keywords} - Tìm bởi " . WEB_NAME; } else { CGlobal::$website_title = "Trang tìm kiếm sản phẩm"; CGlobal::$meta_desc = "Trang tìm kiếm sản phẩm"; } $this->search_catid = (int) Url::get('search_catid', -1); if ($this->search_catid <= 0 || !isset(CGlobal::$allCategories[$this->search_catid]) || CGlobal::$allCategories[$this->search_catid]['status'] == 'HIDE') { $this->search_catid = 0; } if ($this->search_catid) { $curCategory = CGlobal::$allCategories[$this->search_catid]; if ($curCategory['parent_id'] && isset(CGlobal::$allCategories[$curCategory['parent_id']])) { $parent_cat = CGlobal::$allCategories[$curCategory['parent_id']]; $this->search_top_catid = $curCategory['parent_id']; $this->search_sec_catid = $this->search_catid; } else { $this->search_top_catid = $this->search_catid; } } }
/** * Constructor * @param $plugin object * @param $journalId int */ function SettingsForm(&$plugin, $journalId) { $this->journalId = $journalId; $this->plugin =& $plugin; parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl'); $this->addCheck(new FormValidatorPost($this)); }
/** * Constructor. */ function ReviewReminderForm($reviewAssignment) { parent::Form('controllers/grid/users/reviewer/form/reviewReminderForm.tpl'); $this->_reviewAssignment = $reviewAssignment; // Validation checks for this form $this->addCheck(new FormValidatorPost($this)); }
/** * Constructor * @param mixed $reviewAssignment ReviewAssignment * @param mixed $reviewRound ReviewRound * @param mixed $submission Submission */ function UnassignReviewerForm($reviewAssignment, $reviewRound, $submission) { $this->setReviewAssignment($reviewAssignment); $this->setReviewRound($reviewRound); $this->setSubmission($submission); parent::Form('controllers/grid/users/reviewer/form/unassignReviewerForm.tpl'); }
/** * Constructor. */ function NotificationMailingListForm() { parent::Form('notification/maillist.tpl'); // Validation checks for this form $this->addCheck(new FormValidatorPost($this)); $this->addCheck(new FormValidatorEmail($this, 'email', 'required', 'notification.mailList.emailInvalid')); }
/** * Constructor * @param $request PKPRequest * @param $userId int * @param $subscriptionId int */ function UserInstitutionalSubscriptionForm($request, $userId = null, $subscriptionId = null) { parent::Form('subscription/userInstitutionalSubscriptionForm.tpl'); $this->userId = isset($userId) ? (int) $userId : null; $this->subscription = null; $this->request =& $request; $subscriptionId = isset($subscriptionId) ? (int) $subscriptionId : null; if (isset($subscriptionId)) { $subscriptionDao = DAORegistry::getDAO('InstitutionalSubscriptionDAO'); if ($subscriptionDao->subscriptionExists($subscriptionId)) { $this->subscription =& $subscriptionDao->getSubscription($subscriptionId); } } $journal = $this->request->getJournal(); $journalId = $journal->getId(); $subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO'); $subscriptionTypes =& $subscriptionTypeDao->getSubscriptionTypesByInstitutional($journalId, true, false); $this->subscriptionTypes =& $subscriptionTypes->toArray(); // Ensure subscription type is valid $this->addCheck(new FormValidatorCustom($this, 'typeId', 'required', 'user.subscriptions.form.typeIdValid', create_function('$typeId, $journalId', '$subscriptionTypeDao = DAORegistry::getDAO(\'SubscriptionTypeDAO\'); return ($subscriptionTypeDao->subscriptionTypeExistsByTypeId($typeId, $journalId) && $subscriptionTypeDao->getSubscriptionTypeInstitutional($typeId) == 1) && $subscriptionTypeDao->getSubscriptionTypeDisablePublicDisplay($typeId) == 0;'), array($journal->getId()))); // Ensure institution name is provided $this->addCheck(new FormValidator($this, 'institutionName', 'required', 'user.subscriptions.form.institutionNameRequired')); // If provided, domain is valid $this->addCheck(new FormValidatorRegExp($this, 'domain', 'optional', 'user.subscriptions.form.domainValid', '/^' . '[A-Z0-9]+([\\-_\\.][A-Z0-9]+)*' . '\\.' . '[A-Z]{2,4}' . '$/i')); $this->addCheck(new FormValidatorPost($this)); $this->addCheck(new FormValidatorCSRF($this)); }
/** * Constructor * @param $typeId int Registration type to use */ function UserRegistrationForm($typeId) { $schedConf =& Request::getSchedConf(); $this->typeId = (int) $typeId; parent::Form('registration/userRegistrationForm.tpl'); $this->addCheck(new FormValidatorCustom($this, 'registrationTypeId', 'required', 'manager.registration.form.typeIdValid', create_function('$registrationTypeId, $schedConfId, $typeId', '$registrationTypeDao =& DAORegistry::getDAO(\'RegistrationTypeDAO\'); return $registrationTypeDao->openRegistrationTypeExistsByTypeId($typeId, $schedConfId);'), array($schedConf->getId(), $typeId))); import('captcha.CaptchaManager'); $captchaManager = new CaptchaManager(); $this->captchaEnabled = $captchaManager->isEnabled() && Config::getVar('captcha', 'captcha_on_register') ? true : false; $user =& Request::getUser(); if (!$user) { $site =& Request::getSite(); $this->addCheck(new FormValidator($this, 'username', 'required', 'user.profile.form.usernameRequired')); $this->addCheck(new FormValidator($this, 'password', 'required', 'user.profile.form.passwordRequired')); $this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.account.form.usernameExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByUsername'), array(), true)); $this->addCheck(new FormValidatorAlphaNum($this, 'username', 'required', 'user.account.form.usernameAlphaNumeric')); $this->addCheck(new FormValidatorLength($this, 'password', 'required', 'user.account.form.passwordLengthTooShort', '>=', $site->getMinPasswordLength())); $this->addCheck(new FormValidatorCustom($this, 'password', 'required', 'user.account.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array(&$this))); $this->addCheck(new FormValidator($this, 'firstName', 'required', 'user.profile.form.firstNameRequired')); $this->addCheck(new FormValidator($this, 'lastName', 'required', 'user.profile.form.lastNameRequired')); $this->addCheck(new FormValidatorEmail($this, 'email', 'required', 'user.profile.form.emailRequired')); $this->addCheck(new FormValidatorCustom($this, 'email', 'required', 'user.account.form.emailExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByEmail'), array(), true)); if ($this->captchaEnabled) { $this->addCheck(new FormValidatorCaptcha($this, 'captcha', 'captchaId', 'common.captchaField.badCaptcha')); } $authDao =& DAORegistry::getDAO('AuthSourceDAO'); $this->defaultAuth =& $authDao->getDefaultPlugin(); if (isset($this->defaultAuth)) { $this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.account.form.usernameExists', create_function('$username,$form,$auth', 'return (!$auth->userExists($username) || $auth->authenticate($username, $form->getData(\'password\')));'), array(&$this, $this->defaultAuth))); } } $this->addCheck(new FormValidatorPost($this)); }