<commit_before><?php

/**
 * BackendBlogAddCategory
 *
 * This is the add-action, it will display a form to create a new post
 *
 * @package		backend
 * @subpackage	blog
 *
 * @author 		<NAME> <<EMAIL>>
 * @author		<NAME> <<EMAIL>>
 * @since		2.0
 */
class BackendBlogAdd extends BackendBaseActionAdd
{
	/**
	 * The categories
	 *
	 * @var	array
	 */
	private $categories = array();


	/**
	 * The users
	 *
	 * @var	array
	 */
	private $users = array();


	/**
	 * Execute the action
	 *
	 * @return	void
	 */
	public function execute()
	{
		// call parent, this will probably add some general CSS/JS or other required files
		parent::execute();

		// get categories
		$this->categories = BackendBlogModel::getCategories();

		// get users
		$this->users = BackendUsersModel::getUsers();

		// load the form
		$this->loadForm();

		// validate the form
		$this->validateForm();

		// parse
		$this->parse();

		// display the page
		$this->display();
	}


	/**
	 * Load the form
	 *
	 * @return	void
	 */
	private function loadForm()
	{
		// get default category id
		$defaultCategoryId = BackendModel::getSetting('blog', 'default_category', 1);

		// create form
		$this->frm = new BackendForm('add');

		// set hidden values
		$rbtHiddenValues[] = array('label' => BL::getLabel('Hidden'), 'value' => 'Y');
		$rbtHiddenValues[] = array('label' => BL::getLabel('Published'), 'value' => 'N');

		// create elements
		$this->frm->addTextField('title');
		$this->frm->addEditorField('text');
		$this->frm->addEditorField('introduction');
		$this->frm->addRadioButton('hidden', $rbtHiddenValues, 'N');
		$this->frm->addCheckBox('allow_comments');
		$this->frm->addDropDown('category_id', $this->categories, $defaultCategoryId);
		$this->frm->addDropDown('user_id', $this->users, BackendAuthentication::getUser()->getUserId());<commit_msg>allow_comments checkbox now gets its value from the module setting of the same name<commit_after><?php

/**
 * BackendBlogAddCategory
 *
 * This is the add-action, it will display a form to create a new post
 *
 * @package		backend
 * @subpackage	blog
 *
 * @author 		<NAME> <<EMAIL>>
 * @author		<NAME> <<EMAIL>>
 * @since		2.0
 */
class BackendBlogAdd extends BackendBaseActionAdd
{
	/**
	 * The categories
	 *
	 * @var	array
	 */
	private $categories = array();


	/**
	 * The users
	 *
	 * @var	array
	 */
	private $users = array();


	/**
	 * Execute the action
	 *
	 * @return	void
	 */
	public function execute()
	{
		// call parent, this will probably add some general CSS/JS or other required files
		parent::execute();

		// get categories
		$this->categories = BackendBlogModel::getCategories();

		// get users
		$this->users = BackendUsersModel::getUsers();

		// load the form
		$this->loadForm();

		// validate the form
		$this->validateForm();

		// parse
		$this->parse();

		// display the page
		$this->display();
	}


	/**
	 * Load the form
	 *
	 * @return	void
	 */
	private function loadForm()
	{
		// get default category id
		$defaultCategoryId = BackendModel::getSetting('blog', 'default_category', 1);

		// create form
		$this->frm = new BackendForm('add');

		// set hidden values
		$rbtHiddenValues[] = array('label' => BL::getLabel('Hidden'), 'value' => 'Y');
		$rbtHiddenValues[] = array('label' => BL::getLabel('Published'), 'value' => 'N');

		// create elements
		$this->frm->addTextField('title');
		$this->frm->addEditorField('text');
		$this->frm->addEditorField('introduction');
		$this->frm->addRadioButton('hidden', $rbtHiddenValues, 'N');
		$this->frm->addCheckBox('allow_comments', BackendModel::getSetting('blog', 'allow_comments', false));
		$this->frm->addDropDown('category_id', $this->categories, $defaultCategoryId);
		$this->frm->addDropDown('user_id', $this->users, BackendAuthentication::getUser()->getUserId());
{'fraction_non_alphanumeric': 0.17609897341405634, 'fraction_numerical': 0.0015793629902605948, 'mean_word_length': 3.779874213836478, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 71, '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': '4732732', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1213, 'n_words': 293}