<commit_before><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Listeners extends CI_Controller{
   
    function __construct(){
        parent::__construct();
    	$this->authentication->isLoggedIn(array(ACCOUNT_ADMIN));  
		$this->load->model(array('admin/listeners_model','admin/category_model', 'user_model'));
		$this->load->library(array('form_validation'));
	    }

    public function index(){
    	$categoryData = $this->category_model->getAllSubCategories();
    	$data['listeners'] = $this->listeners_model->getAllListeners();
    	$data['categories'] = $categoryData;
		$this->load->view('admin/listener_view', $data);	
	   }
	   
	   public function add(){
   		$data['successmsg'] = '';
   		$data['errmsg'] = '';
   		if($this->input->post('name')){
   			$this->form_validation->set_rules('qualification', 'Qualification', 'required');
   			$this->form_validation->set_rules('name', 'Name', 'required');
   			$this->form_validation->set_rules('priority', 'Priority', 'required');
   			$this->form_validation->set_rules('status', 'Status', 'required');
   			$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
   			$this->form_validation->set_rules('age', 'Age', 'required');
   			$this->form_validation->set_rules('gender', 'Gender', 'required');
   			$this->form_validation->set_rules('description', 'Description', 'required');
   			
   			if ($this->form_validation->run() == TRUE) {
   				$listData['qualification']  		= $this->security->xss_clean($this->input->post('qualification'));
   				$listData['name']       = $this->security->xss_clean($this->input->post('name'));
   				$listData['interests']       = $this->security->xss_clean($this->input->post('interests'));
   				$listData['tagline']       = $this->security->xss_clean($this->input->post('tagline'));
   				$listData['priority']       = $this->security->xss_clean($this->input->post('priority'));
   				$listData['status']	= $this->security->xss_clean($this->input->post('status'));
   				$listData['age']	= $this->security->xss_clean($this->input->post('age'));
   				$listData['gender']	= $this->security->xss_clean($this->input->post('gender'));
   				$listData['description']	= $this->security->xss_clean($this->input->post('description'));
   				$listData['mobile']	= $this->security->xss_clean($this->input->post('mobile'));
   				$user['email']	= $this->security->xss_clean($this->input->post('email'));
   				$user['contact_name']	= $listData['name'];
   				$user['password']	= $this->security->xss_clean($this->input->post('password'));
   				
   				if(!$user['password']){
   					unset($user['password']);
   				}else{
   					//$user['password'] = md5($user['password']);
   				}
   				
   
   				if(empty($data['errmsg'])){
   					$result = $this->user_model->addSystemUser($user);
   					if($result){
   						$listData['id'] = $result;
   						$this->listeners_model->addListener($listData);<commit_msg>buddy signup admin bug fixed<commit_after><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Listeners extends CI_Controller{
   
    function __construct(){
        parent::__construct();
    	$this->authentication->isLoggedIn(array(ACCOUNT_ADMIN));  
		$this->load->model(array('admin/listeners_model','admin/category_model', 'user_model'));
		$this->load->library(array('form_validation'));
	    }

    public function index(){
    	$categoryData = $this->category_model->getAllSubCategories();
    	$data['listeners'] = $this->listeners_model->getAllListeners();
    	$data['categories'] = $categoryData;
		$this->load->view('admin/listener_view', $data);	
	   }
	   
	   public function add(){
   		$data['successmsg'] = '';
   		$data['errmsg'] = '';
   		if($this->input->post('name')){
   			$this->form_validation->set_rules('qualification', 'Qualification', 'required');
   			$this->form_validation->set_rules('name', 'Name', 'required');
   			$this->form_validation->set_rules('priority', 'Priority', 'required');
   			$this->form_validation->set_rules('status', 'Status', 'required');
   			$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
   			$this->form_validation->set_rules('age', 'Age', 'required');
   			$this->form_validation->set_rules('gender', 'Gender', 'required');
   			$this->form_validation->set_rules('description', 'Description', 'required');
   			
   			if ($this->form_validation->run() == TRUE) {
   				$listData['qualification']  		= $this->security->xss_clean($this->input->post('qualification'));
   				$listData['name']       = $this->security->xss_clean($this->input->post('name'));
   				$listData['interests']       = $this->security->xss_clean($this->input->post('interests'));
   				$listData['tagline']       = $this->security->xss_clean($this->input->post('tagline'));
   				$listData['priority']       = $this->security->xss_clean($this->input->post('priority'));
   				$listData['status']	= $this->security->xss_clean($this->input->post('status'));
   				$listData['age']	= $this->security->xss_clean($this->input->post('age'));
   				$listData['gender']	= $this->security->xss_clean($this->input->post('gender'));
   				$listData['description']	= $this->security->xss_clean($this->input->post('description'));
   				$listData['mobile']	= $this->security->xss_clean($this->input->post('mobile'));   				
   				$user['email']	= $this->security->xss_clean($this->input->post('email'));
   				$user['contact_name']	= $listData['name'];
   				$user['password']	= $this->security->xss_clean($this->input->post('password'));
   				$user['user_type']	= 'Listener';
   				
   				if(!$user['password']){
   					unset($user['password']);
   				}
   				
   				if(isset($user['password']) && !empty($user['password'])){
   					$user['password'] = password_hash($user['password'], PASSWORD_DEFAULT);
   				}
   				
   
   				if(empty($data['errmsg'])){
   					$result = $this->user_model->addSystemUser($user);
   					if($result){
   						$listData['id'] = $result;
   						$this->listeners_model->addListener($listData);
{'fraction_non_alphanumeric': 0.2188365650969529, 'fraction_numerical': 0.00016294606485253382, 'mean_word_length': 4.1192660550458715, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 171, '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': '516933', 'n_tokens_mistral': 2189, 'n_tokens_neox': 2016, 'n_words': 209}