<commit_before><?php
namespace wcf\acp\form;
use wcf\data\option\OptionAction;
use wcf\system\option\OptionHandler;
use wcf\system\WCF;

/**
 * Shows the option edit form.
 * 
 * @author      <NAME>
 * @copyright	2001-2019 WoltLab GmbH
 * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package     WoltLabSuite\Core\Acp\Form
 * 
 * @property OptionHandler $optionHandler
 */
class FirstTimeSetupForm extends AbstractOptionListForm {
	/**
	 * @inheritDoc
	 */
	public $activeMenuItem = 'wcf.acp.menu.link.configuration';
	
	/**
	 * @inheritDoc
	 */
	public $neededPermissions = ['admin.configuration.canEditOption'];
	
	/**
	 * list of options
	 * @var array
	 */
	public $options = [];
	
	/**
	 * @var string[]
	 */
	public $optionNames = [
		'page_title',
		'timezone',
		'mail_from_name',
		'mail_from_address',
		'mail_admin_address',
		'image_allow_external_source',
		'module_contact_form',
		'log_ip_address',
		'package_server_auth_code',
	];
	
	/**
	 * @inheritDoc
	 */
	protected function initOptionHandler() {
		parent::initOptionHandler();
		
		$this->optionHandler->filterOptions($this->optionNames);
	}
	
	/**
	 * @inheritDoc
	 */
	public function readData() {
		parent::readData();
		
		foreach ($this->optionNames as $optionName) {
			$this->options[] = $this->optionHandler->getSingleOption($optionName);
		}
	}
	
	/**
	 * @inheritDoc
	 */
	public function save() {
		parent::save();
		
		$saveOptions = $this->optionHandler->save('wcf.acp.option', 'wcf.acp.option.option');
		$this->objectAction = new OptionAction([], 'updateAll', ['data' => $saveOptions]);
		$this->objectAction->executeAction();
		$this->saved();
		
		WCF::getTPL()->assign('success', true);
	}
	
	/**
	 * @inheritDoc
	 */
	public function assignVariables() {
		parent::assignVariables();
		
		WCF::getTPL()->assign([
			'options' => $this->options,
			'optionNames' => $this->optionNames,
		]);
	}
}
<commit_msg>Add reCAPTCHA key fields to first setup form<commit_after><?php
namespace wcf\acp\form;
use wcf\data\option\OptionAction;
use wcf\system\option\OptionHandler;
use wcf\system\WCF;

/**
 * Shows the option edit form.
 * 
 * @author      <NAME>
 * @copyright	2001-2019 WoltLab GmbH
 * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package     WoltLabSuite\Core\Acp\Form
 * 
 * @property OptionHandler $optionHandler
 */
class FirstTimeSetupForm extends AbstractOptionListForm {
	/**
	 * @inheritDoc
	 */
	public $activeMenuItem = 'wcf.acp.menu.link.configuration';
	
	/**
	 * @inheritDoc
	 */
	public $neededPermissions = ['admin.configuration.canEditOption'];
	
	/**
	 * list of options
	 * @var array
	 */
	public $options = [];
	
	/**
	 * @var string[]
	 */
	public $optionNames = [
		'page_title',
		'timezone',
		'mail_from_name',
		'mail_from_address',
		'mail_admin_address',
		'image_allow_external_source',
		'module_contact_form',
		'log_ip_address',
		'package_server_auth_code',
		'recaptcha_publickey',
		'recaptcha_privatekey'
	];
	
	/**
	 * @inheritDoc
	 */
	protected function initOptionHandler() {
		parent::initOptionHandler();
		
		$this->optionHandler->filterOptions($this->optionNames);
	}
	
	/**
	 * @inheritDoc
	 */
	public function readData() {
		parent::readData();
		
		foreach ($this->optionNames as $optionName) {
			$this->options[] = $this->optionHandler->getSingleOption($optionName);
		}
	}
	
	/**
	 * @inheritDoc
	 */
	public function save() {
		parent::save();
		
		$saveOptions = $this->optionHandler->save('wcf.acp.option', 'wcf.acp.option.option');
		$this->objectAction = new OptionAction([], 'updateAll', ['data' => $saveOptions]);
		$this->objectAction->executeAction();
		$this->saved();
		
		WCF::getTPL()->assign('success', true);
	}
	
	/**
	 * @inheritDoc
	 */
	public function assignVariables() {
		parent::assignVariables();
		
		WCF::getTPL()->assign([
			'options' => $this->options,
			'optionNames' => $this->optionNames,
		]);
	}
}

{'fraction_non_alphanumeric': 0.16871396339934822, 'fraction_numerical': 0.004011030333416896, 'mean_word_length': 3.877750611246944, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4044031', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1300, 'n_words': 227}