Uname:Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64

403WebShell
403Webshell
Server IP : 188.114.97.2  /  Your IP : 104.23.243.201
Web Server : Apache/2.4.59 (Debian)
System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : edlftp ( 1002)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/git/sms.edl.codes.solutions/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/git/sms.edl.codes.solutions/application/models/Email_model.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Email_model extends CI_Model {

	function __construct()
    {
        parent::__construct();
				$this->load->helper('generator');
				$this->load->database();
    }

	function account_opening_email($lang = '',$account_type = '' , $name='', $email = '', $password = '',$user_id='')
	{
		$system_name	=	$this->db->get_where('settings' , array('type' => 'system_name'))->row()->description;

		$data = array(
			"name" => $name,
			"user" => $email,
			"password" => $password,
			"system_name" => $system_name
		);

		if($account_type == "admin" || $account_type == "teacher"){
			$sub = "Account Creation";
			$body = $this->load->view('email/'.$lang.'/teacher/account_creation.php',$data,TRUE);
		}
		$email_msg 	= mb_convert_encoding($body,"UTF-8");
		$email_sub		=	$sub;
		$email_to		=	$email;

		$this->log_message($user_id,$email,$email_sub,$email_msg,"1");
		$this->do_email($email_msg , $email_sub , $email_to);
		return true;
	}

	function password_reset_email($lang = '',$account_type = '' , $name='', $email = '', $password = '',$user_id='')
	{
		$system_name	=	$this->db->get_where('settings' , array('type' => 'system_name'))->row()->description;

		$data = array(
			"name" => $name,
			"user" => $email,
			"password" => $password,
			"system_name" => $system_name
		);


		$sub = "Password Reset";
		if($lang != "en" || $lang != "fr" || $lang != "nl"){
			$lang = "en";
		}
		$body = $this->load->view('email/'.$lang.'/general/reset.php',$data,TRUE);

		$email_msg 	= mb_convert_encoding($body,"UTF-8");
		$email_sub		=	$sub;
		$email_to		=	$email;

		$this->do_email($email_msg , $email_sub , $email_to);
		return true;

	}

	function password_notification_email($lang = '', $password = '' , $name = '' , $email = '',$user_id='')
	{
		$system_name	=	$this->db->get_where('settings' , array('type' => 'system_name'))->row()->description;

		$data = array(
			"name" => $name,
			"user" => $email,
			"password" => $password,
			"system_name" => $system_name
		);

		//return 'email/'.$lang.'/general/reset.php';
		$sub = "Password Notification";
		$body = $this->load->view('email/'.$lang.'/general/reset.php',$data,TRUE);

		$email_msg 	= mb_convert_encoding($body,"UTF-8");
		$email_sub		=	$sub;
		$email_to		=	$email;

		$this->do_email($email_msg , $email_sub , $email_to);
		return true;
	}


	function invoice_request_email($lang = '', $link = '' , $name = '' , $email = '',$user_id='')
	{
		$system_name	=	$this->db->get_where('settings' , array('type' => 'system_name'))->row()->description;

		$data = array(
			"name" => $name,
			"user" => $email,
			"paymentLink" => $link,
			"system_name" => $system_name
		);

		//return 'email/'.$lang.'/invoice/request.php';
		$sub = "Payment Notification";
		$body = $this->load->view('email/'.$lang.'/invoice/request.php',$data,TRUE);

		$email_msg 	= mb_convert_encoding($body,"UTF-8");
		$email_sub		=	$sub;
		$email_to		=	$email;

		$this->do_email($email_msg , $email_sub , $email_to);
		return true;
	}
	function invoice_request_email_custom($lang = '', $link = '' , $name = '' , $email = '',$message = '',$user_id='')
	{
		$system_name	=	$this->db->get_where('settings' , array('type' => 'system_name'))->row()->description;

		$data = array(
			"name" => $name,
			"user" => $email,
			"paymentLink" => $link,
			"system_name" => $system_name,
			"message" => $message
		);

		//return 'email/'.$lang.'/invoice/request.php';
		$sub = "re-registration proposal";
		$body = $this->load->view('email/'.$lang.'/invoice/request_custom.php',$data,TRUE);

		$email_msg 	= mb_convert_encoding($body,"UTF-8");
		$email_sub		=	$sub;
		$email_to		=	$email;

		$this->do_email($email_msg , $email_sub , $email_to);
		return true;
	}

	function invoice_success_email($lang = '',$token = '', $id = '', $name = '' , $email = '',$user_id='')
	{
		$system_name	=	$this->db->get_where('settings' , array('type' => 'system_name'))->row()->description;

		$data = array(
			"name" => $name,
			"user" => $email,
			"id" => $id,
			"token" => $token,
			"system_name" => $system_name
		);

		//return 'email/'.$lang.'/invoice/request.php';
		$sub = "Payment Notification";
		$body = $this->load->view('email/'.$lang.'/invoice/success.php',$data,TRUE);

		$email_msg 	= mb_convert_encoding($body,"UTF-8");
		$email_sub		=	$sub;
		$email_to		=	$email;

		$this->do_email($email_msg , $email_sub , $email_to);
		return true;
	}

	function invoice_email($lang = '',$token = '', $id = '', $name = '' , $email = '',$user_id='')
	{
		$system_name	=	$this->db->get_where('settings' , array('type' => 'system_name'))->row()->description;

		$data = array(
			"name" => $name,
			"user" => $email,
			"id" => $id,
			"token" => $token,
			"system_name" => $system_name
		);

		//return 'email/'.$lang.'/invoice/request.php';
		$sub = "Payment Notification";
		$body = $this->load->view('email/'.$lang.'/invoice/invoice.php',$data,TRUE);

		$email_msg 	= mb_convert_encoding($body,"UTF-8");
		$email_sub		=	$sub;
		$email_to		=	$email;

		$this->do_email($email_msg , $email_sub , $email_to);
		return true;
	}

	function credit_note_email($lang = '',$token = '', $id = '', $name = '' , $email = '',$user_id='')
	{
		$system_name	=	$this->db->get_where('settings' , array('type' => 'system_name'))->row()->description;

		$data = array(
			"name" => $name,
			"user" => $email,
			"id" => $id,
			"token" => $token,
			"system_name" => $system_name
		);

		//return 'email/'.$lang.'/invoice/request.php';
		$sub = "Payment Notification";
		$body = $this->load->view('email/'.$lang.'/invoice/credit_note.php',$data,TRUE);

		$email_msg 	= mb_convert_encoding($body,"UTF-8");
		$email_sub		=	$sub;
		$email_to		=	$email;

		$this->do_email($email_msg , $email_sub , $email_to);
		return true;
	}

	function contact_message_email($email_from, $email_to, $email_message) {
		$email_sub = "Message from School Website";
		$this->do_email($email_message, $email_sub, $email_to, $email_from);
	}

	/***custom email sender****/
	function do_email($msg=NULL, $sub=NULL, $to=NULL, $from=NULL)
	{
		$domain = substr($to, strpos($to, '@') + 1);
		if($domain == "ecoledelangues.be" ){
			return false;
			//prevent lost mails
		}
		$config = array();

        $config['useragent']	= "CodeIgniter";
        $config['mailpath']		= "/usr/bin/sendmail"; // or "/usr/sbin/sendmail"
      //  $config['protocol']		= "smtp";
        $config['smtp_host']	= "localhost";
        $config['smtp_port']	= "25";
        $config['mailtype']		= 'html';
        $config['charset']		= 'utf-8';
        $config['newline']		= "\r\n";
        $config['wordwrap']		= TRUE;

        $this->load->library('email');

        $this->email->initialize($config);

		$system_name	=	$this->db->get_where('settings' , array('type' => 'system_name'))->row()->description;
		if($from == NULL)
			$from		=	$this->db->get_where('settings' , array('type' => 'system_email'))->row()->description;

		$this->email->from($from, $system_name);
		$this->email->from($from, $system_name);
		$this->email->to($to);
		$this->email->subject($sub);

		$footer = "<br /><br /><br /><br /><br /><br /><br />";
		$footer = $footer ."<center><div class='col-sm-6 float-left'><img src='http://formationlangues.be/wp-content/uploads/2019/03/logo_newsletter_02-min.png'/></div>";
		$footer = $footer ."<div class='col-sm-6 float-right'><p>[email protected]</p><p>EcoleDeLangues.be</p><p>56, rue Henri Chomé | 1030 Bruxelles</p></div></center>";

		$msg	=	$msg.$footer;//"<br /><br /><br /><br /><br /><br /><br /><hr /><center><a href=\"http://codes.solutions/\"> 2019 SMS | Beta 1.3. Improved by Codes.Solutions</a></center>";
		$this->email->message($msg);

		$this->email->send();

		//echo $this->email->print_debugger();
	}

	function log_message($user,$mail,$subject,$text,$type){
		$date_otd = date('Y-m-d');
		$sql = array(
			'User_ID' => $user,
			'User_Email' => $mail,
			'Message_Subject' => $subject,
			'Message_Text' => $text,
			'Message_date' => $date_otd
		);
		$this->db->insert('message_message',$sql);
		$id_msg = $this->db->insert_id();

		$sql2 = array(
			'Type_ID' => $type,
			'Message_ID' => $id_msg
		);

		$this->db->insert('message',$sql2);
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit