| Server IP : 195.134.90.114 / Your IP : 216.73.217.33 Web Server : Apache/2.4.58 System : Linux nepub 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/public_html/plugins/generic/formHoneypot/ |
Upload File : |
<?php
/**
* @file plugins/generic/formHoneypot/FormHoneypotSettingsForm.inc.php
*
* Copyright (c) University of Pittsburgh
* Distributed under the GNU GPL v2 or later. For full terms see the LICENSE file.
*
* @class FormHoneypotSettingsForm
* @ingroup plugins_generic_formHoneypot
*
* @brief Form for journal managers to modify Form Honeypot plugin settings
*/
import('lib.pkp.classes.form.Form');
class FormHoneypotSettingsForm extends Form {
/** @var $contextId int */
var $_contextId;
/** @var $plugin object */
var $_plugin;
/**
* Constructor
* @param $plugin object
* @param $journalId int
*/
function __construct($plugin, $contextId) {
$this->_contextId = $contextId;
$this->_plugin = $plugin;
if (method_exists($plugin, 'getTemplateResource')) {
// OJS 3.1.2 and later
parent::__construct($plugin->getTemplateResource('settingsForm.tpl'));
} else {
// OJS 3.1.1 and earlier
parent::__construct($plugin->getTemplatePath() . 'settingsForm.tpl');
}
$this->addCheck(new FormValidatorCustom($this, 'formHoneypotMinimumTime', FORM_VALIDATOR_OPTIONAL_VALUE, 'plugins.generic.formHoneypot.manager.settings.minimumTimeNumber', function ($s) {return ($s === "0" || $s > 0);}));
$this->addCheck(new FormValidatorCustom($this, 'formHoneypotMaximimTime', FORM_VALIDATOR_OPTIONAL_VALUE, 'plugins.generic.formHoneypot.manager.settings.maximumTimeNumber', function ($s) {return ($s === "0" || $s > 0);}));
$this->addCheck(new FormValidatorPost($this));
$this->addCheck(new FormValidatorCSRF($this));
}
/**
* Initialize form data.
*/
function initData() {
$plugin = $this->_plugin;
foreach (array_keys($this->_plugin->settingNames) as $k) {
$this->setData($k, $plugin->getSetting($this->_contextId, $k));
}
}
/**
* Fetch the form.
* @copydoc Form::fetch()
*/
function fetch($request, $template = null, $display = false) {
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('pluginName', $this->_plugin->getName());
return parent::fetch($request, $template = null, $display = false);
}
/**
* Assign form data to user-submitted data.
*/
function readInputData() {
$this->readUserVars(array_keys($this->_plugin->settingNames));
}
/**
* Save settings.
*/
function execute(...$functionArgs) {
$contextId = $this->_contextId;
foreach ($this->_plugin->settingNames as $k => $v) {
$this->_plugin->updateSetting($contextId, $k, $this->getData($k), $v);
}
}
}
?>