GRAYBYTE WORDPRESS FILE MANAGER1179

Server IP : 198.54.121.189 / Your IP : 216.73.216.224
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/public_html/Barga/application/modules/settings/controllers/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/public_html/Barga/application/modules/settings/controllers//Settings.php
<?php
class Settings extends Basecontroller
{
	public function __construct()
	{
		parent::__construct();
		$this->load->model('Settings_model', 'Settings');
		$this->controller_name = "settings";
		$this->folder = "settings";
		$this->per_page = PER_PAGE;
		if(!$this->session->userdata('is_login')) { redirect('sessions','refresh'); } //Checked is logined in or not
    }

	public function index()
	{
		redirect('dashboard');
    }
	
	public function generalSettings()
	{	
		if(checkModuleAccessByUser(userInfo('user_role_id'), 6, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data['title'] = "General Settings";
		$data['settings_data'] = $this->Settings->getGeneralSettings($conditions = array());
		$this->template->admin('general_settings', $data);
	}
	
	public function ajaxGeneralSettings()
	{
		$conditions =  array();
		$setting_name = trim($this->input->post('setting_name'));
		$setting_description = trim($this->input->post('setting_description'));
		
        if(!empty($setting_name)){
            $conditions['search']['setting_name'] = $setting_name;
        }
		
		if(!empty($setting_description)){
            $conditions['search']['setting_description'] = $setting_description;
        }
		
		$data['settings_data'] = $this->Settings->getGeneralSettings($conditions);
		$api_log_html = $this->load->view('ajax_general_settings', $data, true);
		echo $api_log_html;exit;	
		
	}
	
	public function settingGeneralForm($setting_id)
	{
		if($setting_id == "" || $setting_id == 0 || !is_numeric($setting_id)){redirect('errors/invalidRequest');} // Check passing argument
		if(checkModuleAccessByUser(userInfo('user_role_id'), 6, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data['title'] = "General Setting Form";
		$data['setting_id'] = $setting_id;
		$data['settings_data'] = $this->Settings->getGeneralSettingValue($setting_id);
		if($this->input->post()) {
			$this->form_validation->set_rules('setting_description', 'Setting Description', 'trim|required');
			$this->form_validation->set_rules('setting_value', 'Setting Value', 'trim|required');
			if ($this->form_validation->run() === TRUE) {
				$setting_description = $this->input->post('setting_description');
				$setting_value = trim($this->input->post('setting_value'));
				$this->db->where('setting_id', $setting_id);
				$this->db->update(TABLE_SETTINGS, array('setting_description' => $setting_description, 'setting_value' => $setting_value, 'dom' => date('Y-m-d H:i:s')));
				if($setting_id == 24) {
					$this->db->query("ALTER TABLE ".TABLE_MEMBERS." CHANGE `member_status` `member_status` TINYINT(4) NOT NULL DEFAULT '".$setting_value."' COMMENT '1 for active, 2 for inactive';");
				}
				$this->session->set_flashdata('msg_success', getMessage("record_updated", 3));
				redirect($this->controller_name.'/settingGeneralForm/'.$setting_id);
			}
		}
		$this->template->admin('setting_general_form', $data);
	}
	
	public function setApiKey()
	{
		if(checkModuleAccessByUser(userInfo('user_role_id'), 21, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data['title'] = "API Key";
		$data['api_key'] = $this->Settings->getApiKey(1); // id
		if($this->input->post()) {
			$rand_key = randomString(API_KEY_LEN, 'lower');
			$id = $this->Settings->saveApiKey(array('key' => $rand_key, 'ip_addresses' => getUserIP(), 'date_created' => date('Y-m-d H:i:s')), 1);
			$this->session->set_flashdata('msg_success', getMessage("record_updated", 3));
			redirect($this->controller_name.'/setApiKey');
		}
		$this->template->admin('setting_set_api_key', $data);
	}
	
	public function apiLogList()
	{
		if(checkModuleAccessByUser(userInfo('user_role_id'), 10, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data = array();
        $total_record = count($this->Settings->getApiLogs());
        //pagination configuration
        $config['target']      = '#data_list';
        $config['base_url']    = base_url().$this->controller_name.'/ajaxApiLogList';
        $config['total_rows']  = $total_record;
        $config['per_page']    = $this->per_page;
        $config['link_func']   = 'searchFilter';
        $this->ajax_pagination->initialize($config);
        
        //get the degree type data
        $data['api_logs'] = $this->Settings->getApiLogs(array('limit'=>$this->per_page));
        $data['title'] = "API Log";
		$data['total_record'] = $total_record;
		$this->template->admin('api_logs', $data);	
	}
	
	public function ajaxApiLogList()
	{
        $conditions = array();
        //calc offset number
        $page = $this->input->post('page');
        if(!$page) $offset = 0;
        else $offset = $page;
        
        //set conditions for search
        $api_key = $this->input->post('api_key');
		
        if(!empty($api_key)){
            $conditions['search']['api_key'] = $api_key;
        }
		
        //total rows count
        $total_record = count($this->Settings->getApiLogs($conditions));
        
        //pagination configuration
        $config['target']      = '#data_list';
        $config['base_url']    = base_url().$this->controller_name.'/ajaxApiLogList';
        $config['total_rows']  = $total_record;
        $config['per_page']    = $this->per_page;
        $config['link_func']   = 'searchFilter';
        $this->ajax_pagination->initialize($config);
        
        //set start and limit
        $conditions['start'] = $offset;
        $conditions['limit'] = $this->per_page;
        
        //get posts data
        $data['api_logs'] = $this->Settings->getApiLogs($conditions);
        
        $data['title'] = "API Log";
		$data['total_record'] = $total_record;
		$data['sl_no'] = $page;
		//load the view
		$api_log_html = $this->load->view('ajax_api_logs', $data, true);
		echo $api_log_html;exit;
    }
	
	public function systemMessages()
	{	
		if(checkModuleAccessByUser(userInfo('user_role_id'), 6, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data = array();
        $total_record = count($this->Settings->getSystemMessages());
        //pagination configuration
        $config['target']      = '#data_list';
        $config['base_url']    = base_url().$this->controller_name.'/ajaxSystemMessages';
        $config['total_rows']  = $total_record;
        $config['per_page']    = $this->per_page;
        $config['link_func']   = 'searchFilter';
        $this->ajax_pagination->initialize($config);
        
        //get the degree type data
        $data['system_messages'] = $this->Settings->getSystemMessages(array('limit'=>$this->per_page));
        $data['title'] = "System Messages";
		$data['total_record'] = $total_record;
		$this->template->admin('system_messages', $data);
	}
	
	public function ajaxSystemMessages()
	{
        $conditions = array();
        //calc offset number
        $page = $this->input->post('page');
        if(!$page) $offset = 0;
        else $offset = $page;
        
        //set conditions for search
        $message_code = trim($this->input->post('message_code'));
		$app_message = trim($this->input->post('app_message'));
		$web_frontend_message = trim($this->input->post('web_frontend_message'));
		$web_backend_message = trim($this->input->post('web_backend_message'));
		
        if(!empty($message_code)){
            $conditions['search']['message_code'] = $message_code;
        }
		
		if(!empty($app_message)){
            $conditions['search']['app_message'] = $app_message;
        }
		
		if(!empty($web_frontend_message)){
            $conditions['search']['web_frontend_message'] = $web_frontend_message;
        }
		
		if(!empty($web_backend_message)){
            $conditions['search']['web_backend_message'] = $web_backend_message;
        }
		
        //total rows count
        $total_record = count($this->Settings->getSystemMessages($conditions));
        
        //pagination configuration
        $config['target']      = '#data_list';
        $config['base_url']    = base_url().$this->controller_name.'/ajaxSystemMessages';
        $config['total_rows']  = $total_record;
        $config['per_page']    = $this->per_page;
        $config['link_func']   = 'searchFilter';
        $this->ajax_pagination->initialize($config);
        
        //set start and limit
        $conditions['start'] = $offset;
        $conditions['limit'] = $this->per_page;
        
        //get posts data
        $data['system_messages'] = $this->Settings->getSystemMessages($conditions);
        
        $data['title'] = "System Messages";
		$data['total_record'] = $total_record;
		$data['sl_no'] = $page;
		//load the view
		$system_messages_html = $this->load->view('ajax_system_messages', $data, true);
		echo $system_messages_html;exit;
    }
	
	public function systemMessageForm($message_id)
	{
		if($message_id == "" || $message_id == 0 || !is_numeric($message_id)){redirect('errors/invalidRequest');} // Check passing argument
		if(checkModuleAccessByUser(userInfo('user_role_id'), 6, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data['title'] = "System Message Form";
		$data['message_id'] = $message_id;
		$data['message_data'] = $this->Settings->getSystmeMessageValue($message_id);
		if($this->input->post()) {
			$this->form_validation->set_rules('app_message', 'App Message', 'trim|required');
			$this->form_validation->set_rules('web_frontend_message', 'Frontend Message', 'trim|required');
			$this->form_validation->set_rules('web_backend_message', 'Backend Message', 'trim|required');
			//$this->form_validation->set_rules('push_message', 'Push Message', 'trim|required');
			$this->form_validation->set_rules('message_title', 'Message Title', 'trim|required');
			if ($this->form_validation->run() === TRUE) {
				$app_message = $this->input->post('app_message');
				$web_frontend_message = $this->input->post('web_frontend_message');
				$web_backend_message = $this->input->post('web_backend_message');
				$push_message = $this->input->post('push_message');
				$message_title = $this->input->post('message_title');
				$this->db->where('message_id', $message_id);
				$this->db->update(TABLE_MESSAGES, array('app_message' => $app_message, 'web_frontend_message' => $web_frontend_message, 'web_backend_message' => $web_backend_message, 'push_message' => $push_message, 'message_title' => $message_title));
				$this->session->set_flashdata('msg_success', getMessage("record_updated", 3));
				redirect($this->controller_name.'/systemMessageForm/'.$message_id);
			}
		}
		$this->template->admin('system_message_form', $data);
	}
	
	public function systemEmailTemplates()
	{	
		if(checkModuleAccessByUser(userInfo('user_role_id'), 6, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data['title'] = "System Email Templates";
		$data['system_email_templates'] = $this->Settings->getSystemEmailTemplates();
		$this->template->admin('system_email_templates', $data);
	}
	
	public function systemEmailTemplateForm($email_template_id)
	{
		if($email_template_id == "" || $email_template_id == 0 || !is_numeric($email_template_id)){redirect('errors/invalidRequest');} // Check passing argument
		if(checkModuleAccessByUser(userInfo('user_role_id'), 6, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data['title'] = "System Email Template Form";
		$data['email_template_id'] = $email_template_id;
		$data['email_tpl_data'] = $this->Settings->getSystmeEmailTemplateValue($email_template_id);
		if($this->input->post()) {
			$this->form_validation->set_rules('email_template_subject', 'Email Subject', 'trim|required');
			$this->form_validation->set_rules('email_template_body', 'Email Body', 'trim|required');
			if ($this->form_validation->run() === TRUE) {
				$email_template_subject = $this->input->post('email_template_subject');
				$email_template_body = $this->input->post('email_template_body');
				$this->db->where('email_template_id', $email_template_id);
				$this->db->update(TABLE_EMAIL_TEMPLATES, array('email_template_subject' => $email_template_subject, 'email_template_body' => $email_template_body));
				$this->session->set_flashdata('msg_success', getMessage("record_updated", 3));
				redirect($this->controller_name.'/systemEmailTemplateForm/'.$email_template_id);
			}
		}
		$this->template->admin('system_email_template_form', $data);
				
	}
	
	public function systemSmsTemplates()
	{
		if(checkModuleAccessByUser(userInfo('user_role_id'), 6, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data['title'] = "System Sms Templates";
		$data['system_sms_templates'] = $this->Settings->getSystemSmsTemplates();
		$this->template->admin('system_sms_templates', $data);	
	}
	
	public function systemSmsTemplateForm($sms_template_id)
	{
		if($sms_template_id == "" || $sms_template_id == 0 || !is_numeric($sms_template_id)){redirect('errors/invalidRequest');} // Check passing argument
		if(checkModuleAccessByUser(userInfo('user_role_id'), 6, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data['title'] = "System Sms Template Form";
		$data['sms_template_id'] = $sms_template_id;
		$data['sms_tpl_data'] = $this->Settings->getSystmeSmsTemplateValue($sms_template_id);
		if($this->input->post()) {
			$this->form_validation->set_rules('sms_template_body', 'Sms Message', 'trim|required');
			if ($this->form_validation->run() === TRUE) {
				$sms_template_body = $this->input->post('sms_template_body');
				$this->db->where('sms_template_id', $sms_template_id);
				$this->db->update(TABLE_SMS_TEMPLATES, array('sms_template_body' => $sms_template_body));
				$this->session->set_flashdata('msg_success', getMessage("record_updated", 3));
				redirect($this->controller_name.'/systemSmsTemplateForm/'.$sms_template_id);
			}
		}
		$this->template->admin('system_sms_template_form', $data);
				
	}
	
	public function ajaxgetBankInfoByIFSCCode()
	{
		if ($this->input->is_ajax_request()) {
			$ifsc_code = $this->input->post('ifsc_code');
			if(!empty($ifsc_code)) {
				$bank_data = getBankInfoByIFSCCode($ifsc_code);
				if($bank_data == "Not Found") {
					$bank_info['branch_name'] = "";
					$bank_info['address'] = "";
					$bank_info['contact'] = "";
					$bank_info['city_name'] = "";
					$bank_info['district_name'] = "";
					$bank_info['state_name'] = "";
					$bank_info['bank_name'] = "";
					$bank_info['ifsc_code'] = "";
					$response_data = array('msg' => getMessage("success", 3), 'status' => 1, 'bank_info' => $bank_info);
				} else {
					$bank_info['branch_name'] = $bank_data->BRANCH;
					$bank_info['address'] = $bank_data->ADDRESS;
					$bank_info['contact'] = $bank_data->CONTACT;
					$bank_info['city_name'] = $bank_data->CITY;
					$bank_info['district_name'] = $bank_data->DISTRICT;
					$bank_info['state_name'] = $bank_data->STATE;
					$bank_info['bank_name'] = $bank_data->BANK;
					$bank_info['ifsc_code'] = $bank_data->IFSC;
					$response_data = array('msg' => getMessage("success", 3), 'status' => 1, 'bank_info' => $bank_info);
				}
			} else {
				$response_data = array('msg' => getMessage("failed", 3), 'status' => 0, 'bank_info' => '');
			}
		} else {
			$response_data = array('msg' => getMessage("no_direct_script_access", 3), 'status' => 0, 'bank_info' => '');
		}
		echo json_encode($response_data);exit;
	}

	public function appCurrentStatus()
	{
		if(checkModuleAccessByUser(userInfo('user_role_id'), 53, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data['title'] = "App Flash Message";
		$data['app_current_status_list'] = $this->Settings->getAppCurrentStatusList();
		$data['modal_image_zoom'] = $this->load->view('includes/modal_image_zoom', array(), true);
		$this->template->admin('app_current_status', $data);
	}
	
	public function appCurrentStatusForm($app_current_status_id = 0)
	{
		if(checkModuleAccessByUser(userInfo('user_role_id'), 53, "module_view") == 0){ redirect('errors/noPermission');} // Check user access permission
		$data['title'] = "App Flash Message Form";
		$data['app_current_status_id'] = $app_current_status_id;
		if($app_current_status_id > 0) { $data['app_current_status_data'] = $this->Settings->getAppCurrentStatusInfo($app_current_status_id);} // Bank Details Id
		if($this->input->post()) {
			$this->form_validation->set_rules('status_message', 'App Message', 'trim|required');
			if(($_FILES['image_name']['name']) == '' && $app_current_status_id == 0) {
				$this->form_validation->set_rules('image_name', 'Screen Image', 'trim|required');
			}
			
			if ($this->form_validation->run() === TRUE) {
				$status_message = trim($this->input->post('status_message'));
				$is_visible = trim($this->input->post('is_visible'));
				$is_screen_lock = trim($this->input->post('is_screen_lock'));
				$data_array['status_message'] = $status_message;
				
				/*** upload app screen image start ***/
				if(($_FILES['image_name']['name']) != '') {
					$screen_image = $this->Settings->getAppScreenImage($app_current_status_id);
					if(!empty($screen_image) && file_exists(APP_SCREEN_IMAGE_PATH.$screen_image)) { unlink(APP_SCREEN_IMAGE_PATH.$screen_image); }
					$new_screen_image = uploadAppStatusFileCustom(APP_SCREEN_IMAGE_PATH, "image_name", array("jpeg", "jpg", "png"), "app_screen_img");
					//echo $new_screen_image;exit;
					$data_array['image_name'] = $new_screen_image;
				}
				/*** upload app screen image end ***/
				$data_array['is_visible'] = $is_visible;
				$data_array['is_screen_lock'] = $is_screen_lock;
				$id = $this->Settings->saveAppCurrentStatus($data_array, $app_current_status_id);
				$this->session->set_flashdata('msg_success', getMessage("record_updated", 3));
				redirect($this->controller_name.'/appCurrentStatusForm/'.$app_current_status_id);
			}
		}
		$data['modal_image_zoom'] = $this->load->view('includes/modal_image_zoom', array(), true);
		$this->template->admin('app_current_status_form', $data);
	}
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 27 2024 00:19:25
giriqfky / giriqfky
0755
Settings.php
17.708 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF