<commit_before><?php

/**
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * @version 1.0 Alpha
 *
 */

if (!defined('ELK'))
	die('No access...');

/**
 * ManageBBC controller handles administration options for BBC tags.
 */
class ManageBBC_Controller extends Action_Controller
{
	/**
	 * BBC settings form
	 * @var Settings_Form
	 */
	protected $_bbcSettings;

	public function action_index()
	{
		isAllowedTo('admin_forum');

		// We're working with them settings here.
		require_once(SUBSDIR . '/Settings.class.php');

		$subActions = array(
			'display' => array ($this, 'action_bbcSettings_display'));

		$action = new Action();
		$action->initialize($subActions);
		$action->dispatch('display');
	}

	/**
	 * Administration page in Posts and Topics > BBC.
	 * This method handles displaying and changing which BBC tags are enabled on the forum.
	 *
	 * requires the admin_forum permission.
	 * Accessed from ?action=admin;area=postsettings;sa=bbc.
	 *
	 * @uses Admin template, edit_bbc_settings sub-template.
	 */
	public function action_bbcSettings_display()
	{
		global $context, $txt, $modSettings, $scripturl;

		// initialize the form
		$this->_initBBCSettingsForm();

		$config_vars = $this->_bbcSettings->settings();

		// Make sure a nifty javascript will enable/disable checkboxes, according to BBC globally set or not.
		addInlineJavascript('
			toggleBBCDisabled(\'disabledBBC\', ' . (empty($modSettings['enableBBC']) ? 'true' : 'false') . ');', true);

		call_integration_hook('integrate_modify_bbc_settings', array(&$config_vars));

		// We'll need this forprepare_db() and save_db()
		require_once(SUBSDIR . '/Settings.class.php');

		// Make sure we check the right tags!<commit_msg>! consistent layout and use of permissions with Action controller<commit_after><?php

/**
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * @version 1.0 Alpha
 *
 */

if (!defined('ELK'))
	die('No access...');

/**
 * ManageBBC controller handles administration options for BBC tags.
 */
class ManageBBC_Controller extends Action_Controller
{
	/**
	 * BBC settings form
	 * @var Settings_Form
	 */
	protected $_bbcSettings;

	public function action_index()
	{
		global $context, $txt;

		// We're working with them settings here.
		require_once(SUBSDIR . '/Settings.class.php');

		$subActions = array(
			'display' => array(
				'controller' => $this,
				'function' => 'action_bbcSettings_display',
				'permission' => 'admin_forum')
		);

		// Only one option I'm afraid
		$subAction = 'display';
		$context['sub_action'] = $subAction;
		$context['page_title'] = $txt['manageposts_bbc_settings_title'];

		// Initiate and call
		$action = new Action();
		$action->initialize($subActions, 'display');
		$action->dispatch($subAction);
	}

	/**
	 * Administration page in Posts and Topics > BBC.
	 * This method handles displaying and changing which BBC tags are enabled on the forum.
	 *
	 * requires the admin_forum permission.
	 * Accessed from ?action=admin;area=postsettings;sa=bbc.
	 *
	 * @uses Admin template, edit_bbc_settings sub-template.
	 */
	public function action_bbcSettings_display()
	{
		global $context, $txt, $modSettings, $scripturl;

		// initialize the form
		$this->_initBBCSettingsForm();

		$config_vars = $this->_bbcSettings->settings();

		// Make sure a nifty javascript will enable/disable checkboxes, according to BBC globally set or not.
		addInlineJavascript('
			toggleBBCDisabled(\'disabledBBC\', ' . (empty($modSettings['enableBBC']) ? 'true' : 'false') . ');', true);

		call_integration_hook('integrate_modify_bbc_settings', array(&$config_vars));

		// We'll need this forprepare_db() and save_db()
		require_once(SUBSDIR . '/Settings.class.php');

		// Make sure we check the right tags!
{'fraction_non_alphanumeric': 0.13597951344430217, 'fraction_numerical': 0.0015364916773367477, 'mean_word_length': 4.1192660550458715, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '4213957', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1178, 'n_words': 319}