!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/var/softaculous/sitepad/editor/site-data/plugins/gosmtp/main/mailer/   drwxr-xr-x
Free 293.19 GB of 429.69 GB (68.23%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     sendinblue.php (4.83 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * Class GOSMTP_Mailer_Sendinblue.
 *
 * @since 1.0.0
 */
 
namespace GOSMTP\Mailer;
 
use 
GOSMTP\Mailer\Loader;

class 
Sendinblue extends Loader{

    var 
$title 'Sendinblue';
    
    var 
$mailer 'sendinblue';

    var 
$url 'https://api.sendinblue.com/v3/smtp/email';
    
    private 
$allowed_exts = [ 'xlsx''xls''ods''docx''docm''doc''csv''pdf''txt''gif''jpg''jpeg''png''tif''tiff''rtf''bmp''cgm''css''shtml''html''htm''zip''xml''ppt''pptx''tar''ez''ics''mobi''msg''pub''eps''odt''mp3''m4a''m4v''wma''ogg''flac''wav''aif''aifc''aiff''mp4''mov''avi''mkv''mpeg''mpg''wmv'];

    public function 
send(){
        global 
$phpmailer;

        
$phpmailer->isMail();

        if(
$phpmailer->preSend()){
            
$response $this->postSend();
             return 
$this->handle_response$response );
        }
        
        return 
$this->handle_response(new \WP_Error(400'Unable to send mail for some reason!', []));
    }

    public function 
postSend(){
        global 
$phpmailer;

        
$sender = [
            
'name' => $phpmailer->FromName,
            
'email' => $phpmailer->From
        
];

        
$body = [
            
'sender' => $sender,
            
'subject' => $phpmailer->Subject,
            
'to' => $this->filterRecipientsArray($phpmailer->getToAddresses()),
            
'cc' => $this->filterRecipientsArray($phpmailer->getCcAddresses()),
            
'bcc' => $this->filterRecipientsArray($phpmailer->getBccAddresses())
        ];
        
        
$body array_filter($body);
            
        
$content $phpmailer->Body;
        
        if(!empty(
$content)){
            if( 
is_array$content ) ){

                if(!empty( 
$content['text'])){
                    
$body['textContent'] = $content['text'];
                }

                if(!empty( 
$content['html'])){
                    
$body['htmlContent'] = $content['html'];
                }
            }else{
                if(
$phpmailer->ContentType === 'text/plain' ){
                    
$body['textContent'] = $content;
                }else{
                    
$body['htmlContent'] = $content;
                }
            }
        }

        
$body $this->set_replyto$phpmailer->getReplyToAddresses(), $body );

        
$attachments $phpmailer->getAttachments();
        
        if(!empty(
$attachments)){
            
$body['attachment'] = $this->getAttachments($attachments);
        }

        
$timeout = (int) ini_get'max_execution_time' );

        
$api_key $this->getOption('api_key'$this->mailer);

        
$headers = [ 'Api-Key' => $api_key,
            
'Content-Type' => 'application/json',
            
'Accept' => 'application/json'
        
];

        
$params = array(
            
'headers' => $headers,
            
'body' => json_encode($body),
            
'timeout' => $timeout $timeout 30
        
);

        
$response wp_safe_remote_post($this->url$params);

        if(
is_wp_error($response)){
            
$returnResponse = new \WP_Error($response->get_error_code(), $response->get_error_message(), $response->get_error_messages());
        }else{
            
$responseBody wp_remote_retrieve_body($response);
            
$responseCode wp_remote_retrieve_response_code($response);
            
$responseBody = \json_decode($responseBodytrue);
            
            
// TODO: check the responseCode is 200 is correct
            
if($responseCode == 201){
                
$returnResponse = [
                    
'status' => true,
                    
'code' => $responseCode,
                    
'messageId' => $responseBody['messageId'],
                    
'message' => __('Mail Sent successfully'),

                ];
                
            }else{
                
$error_text = [''];
                if(!empty( 
$responseBody['message'])){
                    
$error_text[] = $this->message_formatting$responseBody['message'] );
                }else{
                    
$error_text[] = $this->get_response_error_message($response);
                }
                
                
$error_msg implode'\r\n'array_map'esc_textarea'array_filter$error_text ) ) );
                
$returnResponse = new \WP_Error($responseCode$error_msg$responseBody);
            }
        }
        
        return 
$returnResponse;
    }

    public function 
set_replyto$emails,  $body) {
        
        
$data $this->filterRecipientsArray$emails );
        
        if(!empty( 
$data )){
            
$body['replyTo'] = $data[0];
        }
        
        return 
$body;
    }
    
    protected function 
filterRecipientsArray($args){
        
$recipients = [];
        foreach(
$args as $key => $recip){
            
            
$recip array_filter($recip);

            if(empty(
$recip) || ! filter_var$recip[0], FILTER_VALIDATE_EMAIL ) ){
                continue;
            }

            
$_recip = array(
                
'email' => $recip[0]
            );

            if(!empty(
$recip[1])){
                
$_recip['name'] = $recip[1];
            }
            
            
$recipients[] = $_recip;
        }

        return 
$recipients;
    }

    public function 
getAttachments($attachments = []){
        
$files = [];

        foreach(
$attachments as $attachment){
            if(
is_file($attachment[0]) && is_readable($attachment[0])){
                
$ext pathinfo($attachment[0], PATHINFO_EXTENSION);

                if(
in_array($ext$this->allowed_extstrue)){
                    
$files[] = [
                        
'name' => basename($attachment[0]),
                        
'content' => base64_encode(file_get_contents($attachment[0]))
                    ];
                }
            }
        }

        return 
$files;
    }
    
    public function 
load_field(){

        
$fields = array(
            
'api_key' => array(
                
'title' => __('API Key'),
                
'type' => 'password',
                
'desc' => __'Follow this link to get an API Key: <a href="https://account.sendinblue.com/advanced/api" target="_blank">Get v3 API Key.</a>' ),
            )
        );
        
        return 
$fields;
    }
}


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0043 ]--