<commit_before><?php

### Controller file for depositors related actions rev 0.45

class DepositorController {
	private $_params;

	public function __construct($params) {
		$this->_params = $params;

		try {
			DB::init();
		} catch( Exception $e ) {
			$data['success'] = false;
			$data['errormsg'] = 'DB connection fault: '.$e->getMessage();
		}
	}

	public function createAction() {
		$query = "INSERT INTO `depositors` (`name`, `surname`, `mobile`, `telephone`, `email`, `state`, `hours no.`) ";
		$query .= "VALUES (:name, :surname, :mobile, :telephone, :email, :state, :hours)";
		$values =
			array(
				':name'        =>   ucfirst(strtolower($this->_params['name'])),
				':surname'     =>   ucfirst(strtolower($this->_params['surname'])),
				':mobile'      =>                      $this->_params['mobile'],
				':telephone'   =>                      $this->_params['telephone'],
				':email'       =>           strtolower($this->_params['email']),
				':state'       =>                      $this->_params['state'] === 'unactive' ? 'unactive' : 'active',
				':hours'       =>                      $this->_params['hours']
			)
		;

		if(DB::insert($query, $values) === true) {
			$data['success'] = true;
		} else {
			$data['success'] = false;
			return $data;
		}

		$query = "INSERT INTO `other_data` (`place of birth`, `date of birth`, `sex`, `adress`, `city`, `province`, `document`, `document type`, `profession`, `degree`, `channel`, `other associations`, `notes`) ";
		$query .= "VALUES (:birth_place, STR_TO_DATE(:birth_date, '%d/%m/%Y'), :sex, :adress, :city, :province, :document, :document_type, :profession, :degree, :info_from, :associations, :notes)";
		$values =
			@array(
				':birth_place'    =>   ucfirst(strtolower($this->_params['birth_place'])),
				':birth_date'     =>                      $this->_params['birth_date'],
				':sex'            =>                      $this->_params['sex'],
				':adress'         =>                      $this->_params['street'].' '.$this->_params['civic'],
				':city'           =>   ucfirst(strtolower($this->_params['city'])),
				':province'       =>           strtoupper($this->_params['province']),
				':document'       =>           strtoupper($this->_params['document']),
				':document_type'  =>                      $this->_params['document_type'],
				':profession'     =>   ucfirst(strtolower($this->_params['profession'])),
				':degree'         =>   ucfirst(strtolower($this->_params['degree'])),
				':info_from'      =>                      $this->_params['info_from'],
				':associations'   =>                      $this->_params['associations'],
				':notes'          =>                      $this->_params['notes']
			)
		;

		if(DB::insert($query, $values) === true) {
			$data['success'] = true;
		} else {
			$data['success'] = false;
		}

		return $data;
	}

	public function listAction() {
		$data = array();

		if (empty($this->_params['page'])) {<commit_msg>core:depo:insert index field added<commit_after><?php

### Controller file for depositors related actions rev 0.45

class DepositorController {
	private $_params;

	public function __construct($params) {
		$this->_params = $params;

		try {
			DB::init();
		} catch( Exception $e ) {
			$data['success'] = false;
			$data['errormsg'] = 'DB connection fault: '.$e->getMessage();
		}
	}

	public function createAction() {
		$query = "INSERT INTO `depositors` (`name`, `surname`, `mobile`, `telephone`, `email`, `state`, `hours no.`) ";
		$query .= "VALUES (:name, :surname, :mobile, :telephone, :email, :state, :hours)";
		$values =
			array(
				':name'        =>   ucfirst(strtolower($this->_params['name'])),
				':surname'     =>   ucfirst(strtolower($this->_params['surname'])),
				':mobile'      =>                      $this->_params['mobile'],
				':telephone'   =>                      $this->_params['telephone'],
				':email'       =>           strtolower($this->_params['email']),
				':state'       =>                      $this->_params['state'] === 'unactive' ? 'unactive' : 'active',
				':hours'       =>                      $this->_params['hours']
			)
		;

		if(DB::insert($query, $values) === true) {
			$data['success'] = true;
		} else {
			$data['success'] = false;
			return $data;
		}

		$query = "INSERT INTO `other_data` (`place of birth`, `date of birth`, `sex`, `adress`, `index`, `city`, `province`, `document`, `document type`, `profession`, `degree`, `channel`, `other associations`, `notes`) ";
		$query .= "VALUES (:birth_place, STR_TO_DATE(:birth_date, '%d/%m/%Y'), :sex, :adress, :index, :city, :province, :document, :document_type, :profession, :degree, :info_from, :associations, :notes)";
		$values =
			@array(
				':birth_place'    =>   ucfirst(strtolower($this->_params['birth_place'])),
				':birth_date'     =>                      $this->_params['birth_date'],
				':sex'            =>                      $this->_params['sex'],
				':adress'         =>                      $this->_params['street'].' '.$this->_params['civic'],
				':index'            =>                    $this->_params['index'],
				':city'           =>   ucfirst(strtolower($this->_params['city'])),
				':province'       =>           strtoupper($this->_params['province']),
				':document'       =>           strtoupper($this->_params['document']),
				':document_type'  =>                      $this->_params['document_type'],
				':profession'     =>   ucfirst(strtolower($this->_params['profession'])),
				':degree'         =>   ucfirst(strtolower($this->_params['degree'])),
				':info_from'      =>                      $this->_params['info_from'],
				':associations'   =>                      $this->_params['associations'],
				':notes'          =>                      $this->_params['notes']
			)
		;

		if(DB::insert($query, $values) === true) {
			$data['success'] = true;
		} else {
			$data['success'] = false;
		}

		return $data;
	}

	public function listAction() {
		$data = array();

		if (empty($this->_params['page'])) {
{'fraction_non_alphanumeric': 0.20562302445516553, 'fraction_numerical': 0.000998170021627017, 'mean_word_length': 2.5406360424028267, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 93, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2875894', 'n_tokens_mistral': 2140, 'n_tokens_neox': 1831, 'n_words': 343}