<commit_before><?php

class Account extends CI_Controller
{
	function __construct() {
		// Call the Controller constructor
		parent::__construct();
		session_start();
	}

	public function _remap($method, $params = array()) {
		// enforce access control to protected functions

		$protected = array('updatePasswordForm','updatePassword','index','logout');

		if (in_array($method,$protected) && !isset($_SESSION['user']))
			redirect('account/loginForm', 'refresh'); //Then we redirect to the index page again

		return call_user_func_array(array($this, $method), $params);
	}

	function _check_captcha() {
		$this->load->library('securimage/securimage');
		$securimage = new Securimage();

		if (!$securimage->check($this->input->post('captcha'))) {
			$this->form_validation->set_message('_check_captcha', 'The code you entered is invalid');
			return FALSE;
		} else {
			return TRUE;
		}
	}

	function index() {
		$this->load->view('account/loginForm');
	}

	function loginForm() {
		$this->load->view('account/loginForm');
	}

	function login() {
		$this->load->library('form_validation');
		$this->form_validation->set_rules('username', 'Username', 'required');
		$this->form_validation->set_rules('password', 'Password', '<PASSWORD>');

		if ($this->form_validation->run() == FALSE) {
			$this->load->view('account/loginForm');
		} else {
			$login = $this->input->post('username');
			$clearPassword = $this->input->post('password');

			$this->load->model('user_model');

			$user = $this->user_model->get($login);

			if (isset($user) && $user->comparePassword($clearPassword)) {
				$_SESSION['user'] = $user;
				$data['user']=$user;

				redirect('main/index', 'refresh'); //redirect to the main application page
			} else {
				$this->load->view('welcome');
			}
		}
	}

	function logout() {
		$user = $_SESSION['user'];
		$this->load->model('user_model');
		$this->user_model->updateStatus($user->id, User::OFFLINE);
		session_destroy();
		redirect('account/index', 'refresh'); //Then we redirect to the index page again
	}

	function newForm() {
		$this->load->view('account/newForm');
	}

	function createNew() {
		$this->load->library('form_validation');
<commit_msg>change a bit<commit_after><?php

class Account extends CI_Controller
{
	function __construct() {
		// Call the Controller constructor
		parent::__construct();
		session_start();
	}

	public function _remap($method, $params = array()) {
		// enforce access control to protected functions

		$protected = array('updatePasswordForm','updatePassword','index','logout');

		if (in_array($method,$protected) && !isset($_SESSION['user']))
			redirect('account/loginForm', 'refresh'); //Then we redirect to the index page again

		return call_user_func_array(array($this, $method), $params);
	}

	function _check_captcha() {
		$this->load->library('securimage/securimage');
		$securimage = new Securimage();

		if (!$securimage->check($this->input->post('captcha'))) {
			$this->form_validation->set_message('_check_captcha', 'The code you entered is invalid');
			return FALSE;
		} else {
			return TRUE;
		}
	}

	function index() {
		$this->load->view('account/loginForm');
	}

	function loginForm() {
		$this->load->view('account/loginForm');
	}

	function login() {
		$this->load->library('form_validation');
		$this->form_validation->set_rules('username', 'Username', 'required');
		$this->form_validation->set_rules('password', 'Password', '<PASSWORD>');

		if ($this->form_validation->run() == FALSE) {
			$this->load->view('account/loginForm');
		} else {
			$login = $this->input->post('username');
			$clearPassword = $this->input->post('password');

			$this->load->model('user_model');

			$user = $this->user_model->get($login);

			if (isset($user) && $user->comparePassword($clearPassword)) {
				$_SESSION['user'] = $user;
				$data['user']=$user;

				redirect('main/index', 'refresh'); //redirect to the main application page
			} else {
				redirect('account/loginForm', 'refresh');
			}
		}
	}

	function logout() {
		$user = $_SESSION['user'];
		$this->load->model('user_model');
		$this->user_model->updateStatus($user->id, User::OFFLINE);
		session_destroy();
		redirect('account/index', 'refresh'); //Then we redirect to the index page again
	}

	function newForm() {
		$this->load->view('account/newForm');
	}

	function createNew() {
		$this->load->library('form_validation');

{'fraction_non_alphanumeric': 0.1929664306919388, 'fraction_numerical': 0.0, 'mean_word_length': 4.847797062750334, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 85, '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': '1550931', 'n_tokens_mistral': 1527, 'n_tokens_neox': 1362, 'n_words': 263}