Server IP : 103.191.208.50 / Your IP : 216.73.216.53 Web Server : LiteSpeed System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64 User : celkcksm ( 1031) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, popen, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/celkcksm/ecampus.ncriptech.com/application/controllers/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /** * */ class Notifications extends BaseAdminController { function __construct() { parent::__construct(); } function index(){ if(session_userdata('isAdminLoggedin')){ $this->data['page_title']='Mails & Notifications'; $this->theme->title($this->data['page_title'])->load('mails/vw_mails_notifications', $this->data); }else{ redirect($this->data['base_url']); } } public function onSearchmail(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $page = 1; $list=array(); $total = $this->sm->_get_notification(null,null,TRUE,FALSE); $param['column_order'] = array( null, 'notify_type_data' ); //$param['inst_id']=$this->data['userdata']->user_id; $param['column_search'] = array('notify_type_data'); $param['order'] = array('notify_id' => 'DESC'); $posts=$this->input->post(); if(isset($posts['start'])){ $page=$posts['start']; } $pages = ceil($total/$posts['length']); $start = ($page-1)*$posts['length']; if($start < 0) $start = 0; $param['length']=$posts['length']; $param['start']=$start; $_list = $this->sm->_get_notification($posts,$param,FALSE,FALSE); if(!empty($_list)){ foreach ($_list as $key => $value) { $list[]=array( 'notify_id'=>$value->notify_id, 'notify_has_attachment'=>$value->notify_has_attachment, 'notify_type_data'=>$value->notify_type_data, 'notify_type'=>$value->notify_type, 'notify_status'=>$value->notify_status, 'notify_value'=>$value->notify_value, 'notify_date'=>date('d-M-y',strtotime($value->notify_date)) ); } } $this->data['list']=$list; $this->data['page']=$page; $this->data['total_page']=$pages; $return['html']=$this->theme->view('_pages/mails/vw_mails_notifications_list', $this->data,true); json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function onSendNotificationMail(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $stu_id=post_data('stu_id'); $mail_subject=post_data('mail_subject'); $mail_content=$this->input->post('mail_content'); $student_id=decode_data($stu_id); $student_data=$this->um->get_user(array('stu_id'=>$student_id),'student'); // print_obj($to_mail);die; if(!empty($student_data) && !empty($mail_subject) && !empty($mail_content)){ if($student_data->stu_mid_name!=''){ $student_name=$student_data->stu_first_name.' '.$student_data->stu_mid_name.' '.$student_data->stu_last_name; }else{ $student_name=$student_data->stu_first_name.' '.$student_data->stu_last_name; } if($this->data['userdata']->user_type=='institute'){ $parent_inst_id=$this->data['userdata']->user_id; }else if($this->data['userdata']->user_type=='institute_branch'){ $parent_inst_id=$this->data['userdata']->branch_parent_inst_id; } $mail_data['inst_id']=$this->data['userdata']->user_id; $mail_data['mail_from']='webmaster'; $mail_data['to_email']=$student_data->stu_email; $mail_data['mail_from_name']=$this->data['profile_name']; $mail_data['mail_subject']=$mail_subject; $mail_data['mail_type']='text'; $mail_data['mail_custom_type']='custom'; $mail_data['mail_data']=$mail_content; $mail_data['mail_log']='true'; $mail_data['log_type']='Student Mail Log'; $mail_data['inst_parent_id']=$parent_inst_id; $mail_data['notify_type']='stu_application_complete'; $mail_data['notify_type_data']=$student_name; $mail_data['notify_type_id']=$student_data->stu_user_id; $mail_data['notify_has_attachment']='no'; $mail_data['notify_status']='unread'; //$mail_msg=$this->onSendMail($mail_data); // SMTP configuration $config = array( 'protocol' => 'smtp', 'smtp_host' => 'smtp.hostinger.com', // Replace with your SMTP server 'smtp_port' => 465, // Adjust if necessary 'smtp_user' => 'info@firstkliq.com', // Replace with your SMTP username 'smtp_pass' => 'iVyVYWxA3As7v7T$', // Replace with your SMTP password 'smpt_crypto'=>'SSL', 'mailtype' => 'text', 'charset' => 'utf-8', 'newline' => "\r\n", 'wordwrap' => TRUE ); // Initialize the email library with the configuration $this->email->initialize($config); // Set email parameters $this->email->from('info@firstkliq.com', 'AMS'); $this->email->to($student_data->stu_email); $this->email->subject($mail_subject); $this->email->message($mail_content); // Send the email if ($this->email->send()) { $return['success']= 'Email sent successfully.'; } else { $return['error']= 'Failed to send email.'. $this->email->print_debugger(); } //$return['success']=$mail_msg; }else{ $return['error']='Mail can not be sent'; } json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } }