!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/picomail.picotech.app/public_html/app/Jobs/   drwxr-xr-x
Free 28.58 GB of 117.98 GB (24.23%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     CampaignCreateChunk.php (8.5 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\Jobs;

use 
App\Models\Campaign;
use 
App\Models\Contact;
use 
Illuminate\Bus\Queueable;
use 
Illuminate\Contracts\Queue\ShouldBeUnique;
use 
Illuminate\Contracts\Queue\ShouldQueue;
use 
Illuminate\Foundation\Bus\Dispatchable;
use 
Illuminate\Queue\InteractsWithQueue;
use 
Illuminate\Queue\SerializesModels;
use 
Illuminate\Support\Carbon;
use 
Illuminate\Support\Facades\Log;
use 
Illuminate\Support\Str;

class 
CampaignCreateChunk implements ShouldQueue
{
    use 
DispatchableInteractsWithQueueQueueableSerializesModels;

    private 
$daily_sent_limit;
    private 
$send_speed;
    private 
$campaign_running_date;
    private 
$user;
    private 
$offset;
    private 
$take_count 5000;
    private 
$message;
    private 
$to_email;
    private 
$from_email;
    private 
$email_queue;

    
/**
     * Create a new job instance.
     *
     * @return void
     */
    
public function __construct($message$dailySentLimit$campaignRunningDate$sendSpeed$user$offset)
    {
        
$this->message $message;
        
$this->daily_sent_limit $dailySentLimit;
        
$this->campaign_running_date $campaignRunningDate;
        
$this->send_speed $sendSpeed;
        
$this->user $user;
        
$this->offset $offset;
        
$numberArray json_decode($message->emails);
        
$this->to_email $numberArray->to ?? [];
        
$this->from_email $numberArray->from ?? [];
        
$this->email_queue = [];
    }

    
/**
     * Execute the job.
     *
     * @return void
     */
    
public function handle()
    {

        
$toEmails  array_slice($this->to_email$this->offset, ($this->daily_sent_limit));

        if (
$toEmails) {
            
$generatedToEmails = [];
            
$contacts Contact::where('customer_id'$this->user->id)->whereIn('email'$toEmails)->where('label','!=','wrong_number')->orderBy('email')->get()->unique('email');

            foreach (
$contacts as $contact) {

                
$templates $this->message->campaign_tempate()->first();

                
$templateValue=self::generateTemplate($contact,$templates);

                if (!
in_array($contact->email$generatedToEmails)) {
                    
$this->email_queue[] = [
                        
'domain_id' => $this->message->domain_id,
                        
'message_id' => $this->message->id,
                        
'campaign_id' => $this->message->campaign_id,
                        
'from' => $this->from_email,
                        
'to' => $contact->email,
                        
'schedule_datetime' => null,
                        
'body' => null,
                        
'template' =>json_encode($templateValue),
                        
'reply_to'=>$this->message->reply_to,
                        
'from_name'=>$this->message->from_name,
                        
'subject'=>$this->message->subject,
                        
'created_at' => now(),
                        
'updated_at' => now(),
                    ];
                    
$generatedToEmails[] = $contact->email;
                }
            }

            foreach (
array_chunk($this->email_queue$this->take_count) as $key => $daily_email_queues) {
                
$final_email_queue = [];

                foreach (
$daily_email_queues as $queue) {
                    
$final_email_queue[] = [
                        
'random_ref_key' => Str::random(),
                        
'domain_id' => $queue['domain_id'],
                        
'message_id' => $queue['message_id'],
                        
'campaign_id' => $queue['campaign_id'],
                        
'from' => $queue['from'],
                        
'to' => $queue['to'],
                        
'schedule_datetime' => $this->campaign_running_date->addMinutes(ceil($this->send_speed))->toDateTimeString(),
                        
'body' => $queue['body'],
                        
'template' => $queue['template'],
                        
'reply_to' => $queue['reply_to'],
                        
'from_name' => $queue['from_name'],
                        
'subject' => $queue['subject'],
                        
'created_at' => now(),
                        
'updated_at' => now(),
                        
'type'=> 'sent',
                    ];
                }
                if (
$final_email_queue) {
                    
$this->user->email_queues()->createMany($final_email_queue);
                    
$this->user->message_logs()->createMany($final_email_queue);
                }
            }
        }

    }


    public function 
failed(\Exception $exception)
    {
        
Campaign::where('id',$this->message->campaign_id)->update(['import_fail_message'=>substr($exception->getMessage(), 0191)]);
    }

    public static function 
generateTemplate($contact,$templates){
        
$tempData=json_decode($templates->value);
        if(!isset(
$tempData->campaign_title) || !isset($tempData->campaign_description) || !isset($tempData->unsubscribe_link)){
            return 
$templates;
        }
        
$campaign_title $tempData->campaign_title;
        
$campaign_description $tempData->campaign_description;
        
$campaign_unsubscribe $tempData->unsubscribe_link;
        if (
$contact->first_name) {
            
$campaign_title str_replace('{first_name}'$contact->first_name$campaign_title);
            
$campaign_description str_replace('{first_name}'$contact->first_name$campaign_description);
        } else {
            
$campaign_title str_replace('{first_name}'' '$campaign_title);
            
$campaign_description str_replace('{first_name}'' '$campaign_description);
        }
        if (
$contact->last_name) {
            
$campaign_title str_replace('{last_name}'$contact->last_name$campaign_title);
            
$campaign_description str_replace('{last_name}'$contact->last_name$campaign_description);
        } else {
            
$campaign_title str_replace('{last_name}'' '$campaign_title);
            
$campaign_description str_replace('{last_name}'' '$campaign_description);
        }
        if (
$contact->address) {
            
$campaign_title str_replace('{address}'$contact->address$campaign_title);
            
$campaign_description str_replace('{address}'$contact->address$campaign_description);
        } else {
            
$campaign_title str_replace('{address}'' '$campaign_title);
            
$campaign_description str_replace('{address}'' '$campaign_description);
        }
        if (
$contact->city) {
            
$campaign_title str_replace('{city}'$contact->city$campaign_title);
            
$campaign_description str_replace('{city}'$contact->city$campaign_description);
        } else {
            
$campaign_title str_replace('{city}'' '$campaign_title);
            
$campaign_description str_replace('{city}'' '$campaign_description);
        }
        if (
$contact->state) {
            
$campaign_title str_replace('{state}'$contact->state$campaign_title);
            
$campaign_description str_replace('{state}'$contact->state$campaign_description);
        } else {
            
$campaign_title str_replace('{state}'' '$campaign_title);
            
$campaign_description str_replace('{state}'' '$campaign_description);
        }
        if (
$contact->zip_code) {
            
$campaign_title str_replace('{zip_code}'$contact->zip_code$campaign_title);
            
$campaign_description str_replace('{zip_code}'$contact->zip_code$campaign_description);
        } else {
            
$campaign_title str_replace('{zip_code}'' '$campaign_title);
            
$campaign_description str_replace('{zip_code}'' '$campaign_description);
        }
        if (
$contact->email) {
            
$campaign_title str_replace('{email}'$contact->email$campaign_title);
            
$campaign_description str_replace('{email}'$contact->email$campaign_description);
            
$campaign_unsubscribe str_replace('{email}'$contact->email$campaign_unsubscribe);
        } else {
            
$campaign_title str_replace('{email}'' '$campaign_title);
            
$campaign_description str_replace('{email}'' '$campaign_description);
            
$campaign_unsubscribe str_replace('{email}'' '$campaign_unsubscribe);
        }
        
$templateValue = [];

        foreach (
json_decode($templates->value) as $key => $template){
            
$templateValue[$key] = $template;
            
$templateValue['campaign_title'] = $campaign_title;
            
$templateValue['campaign_description'] = $campaign_description;
            
$templateValue['unsubscribe_link'] = $campaign_unsubscribe;
        }
        return 
$templateValue;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0038 ]--