Linux cesa-www-main 6.1.0-49-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
Apache/2.4.68 (Debian)
Server IP : 10.218.0.2 & Your IP : 216.73.216.28
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
v3.cesa.co.za /
src /
EventBundle /
Services /
Delete
Unzip
Name
Size
Permission
Date
Action
.htaccess
237
B
-r-xr-xr-x
2026-08-17 03:12
MarketingAttendeeManager.php
11.91
KB
-rwxrwxr-x
2026-04-02 11:48
SchoolAttendeeManager.php
10.2
KB
-rwxrwxr-x
2026-04-02 11:48
SchoolWeeksCoursesDashboardService.php
19
KB
-rw-r--r--
2026-08-14 12:33
Save
Rename
<?php namespace App\EventBundle\Services; use Symfony\Component\DependencyInjection\ContainerInterface; use Monolog\Logger; use App\ContactBundle\Services\MessageManager; use App\EventBundle\Entity\SchoolAttendee; use App\CoreBundle\Services\Utils; /** * School Attendee List Old manager * * @author Otto Saayman <otto@igotafrica.com> * @package EventBundle * @subpackage SchoolAttendee * @version 0.0.1 */ final class SchoolAttendeeManager { /** * Service Container * @var object */ private $container = null; /** * Entity manager * @var object */ private $em; /** * Class construct * * @param ContainerInterface $container * @param Logger $logger * @return void */ public function __construct( ContainerInterface $container ) { $this->setContainer($container); $this->setEm($container->get('doctrine')->getManager('default')); return; } /** * Get Container * * @return ContainerInterface $container */ public function getContainer() { return $this->container; } /** * Set Container * * @param ContainerInterface $container * @return void */ public function setContainer($container) { $this->container = $container; } /** * Get Entity Manager * * @return string */ public function getEm() { return $this->em; } /** * Set Container * * @param string $em * @return void */ public function setEm($em) { $this->em = $em; } /** * Get a School Attendee * * @return SchoolAttendee */ public function find($id) { if (strlen($id) <= 0) { return null; } return $this->em->getRepository(SchoolAttendee::class)->find($id); } /** * Get a School Attendee by parameters * * @param array $params * @return SchoolAttendee */ public function findOneBy($params) { return $this->em->getRepository(SchoolAttendee::class)->findOneBy($params); } /** * Get a School Attendee by parameters * * @param array $params * @return array */ public function findBy($params) { return $this->em->getRepository(SchoolAttendee::class)->findBy($params); } /** * Get all School Attendees * * @return array */ public function findAll() { return $this->em->getRepository(SchoolAttendee::class)->findAll(); } /** * Get all School Attendee IDs * * @return array */ public function findAllIds() { return $this->em->getRepository(SchoolAttendee::class)->findAllIds(); } /** * Save a School Attendee * * @params SchoolAttendee $schoolAttendee * @return SchoolAttendee */ public function save(SchoolAttendee &$schoolAttendee) { $this->em->persist($schoolAttendee); $this->em->flush(); return $schoolAttendee; } /** * Save a School Attendee * * @return void */ public function mailChimpSynch($allMembers = array(), $audience = '', $tag = 'CESA SCE') { $errorLogManager = $this->getContainer()->get('error_log.manager'); $mcCreds = MessageManager::getMCCredentials(); $messageManager = $this->getContainer()->get('contact_message.manager'); if (strlen($audience) <= 0) { $audience = $mcCreds['main_audience']; } if (count($allMembers) <= 0) { $allMembers = $messageManager->getAllEMailsFromMailChimp($mcCreds['api_key'], $audience); } // var_dump($response); // echo '<br /><br />'; $toBeAdded = array(); $toBeUpdated = array(); $schoolAttendees = $this->findAllIds(); echo count($schoolAttendees) . ' school attendees found' . "\r\n"; $errorLogManager->error(count($schoolAttendees) . ' school attendees found', true); $alreadyAdded = []; foreach ($schoolAttendees as $schoolAttendeeId) { // if ($schoolAttendeeId['id'] != 38508) { // continue; // } $schoolAttendee = $this->find($schoolAttendeeId['id']); if (!is_object($schoolAttendee)) { echo 'Attendee not found: ' . $schoolAttendeeId['id'] . '<br />' . "\r\n"; $errorLogManager->error('School Attendee not found: ' . $schoolAttendeeId['id'], true); continue; } if ( is_null($schoolAttendee->getEmailAddress()) || strlen($schoolAttendee->getEmailAddress()) <= 0 || Utils::isEmailAddressValid($schoolAttendee->getEmailAddress()) == false || in_array($schoolAttendee->getEmailAddress(), $alreadyAdded) ) { // echo 'Attendee no e-mail address: ' . $schoolAttendeeId['id'] . '<br />' . "\r\n"; continue; } if ($schoolAttendee->isCancelled()) { // echo 'Attendee cancelled: ' . $schoolAttendeeId['id'] . '<br />' . "\r\n"; $errorLogManager->error('School Attendee cancelled: ' . $schoolAttendeeId['id'], true); continue; } $alreadyAdded[] = $schoolAttendee->getEmailAddress(); $subscribed = 'pending'; if (is_null($schoolAttendee->getSubscribed()) || strtolower($schoolAttendee->getSubscribed()) == 'y') { $subscribed = 'subscribed'; } // if (count($toBeAdded) > 10) { // continue; // } //check if attendee is in list $mustAdd = ''; foreach ($allMembers as $mailId => $member) { // Check of the subscriber has unsubscribed in MailChimp if (isset($member['status']) && $member['status'] == 'unsubscribed') { $mustAdd = 'Unsubscribed'; echo 'School attendee ' . $schoolAttendee->getEmailAddress() . ' is unsubscribed in MailChimp' . "\r\n"; continue; } if (trim(strtolower($member['email_address'])) == trim(strtolower($schoolAttendee->getEmailAddress()))) { $mustAdd = $mailId; // echo 'School attendee e-mail exists in MalChimp and ' . count($member['tags']) . ' is the tag' . "\r\n"; if (!is_countable($member['tags']) || count($member['tags']) <= 0) { continue; } foreach ($member['tags'] as $oneTag) { // var_dump($oneTag); // echo "\r\n" . ' tag!' . "\r\n"; if ($oneTag['name'] == $tag) { $mustAdd = 'no'; } } } } //foreach if ($mustAdd == '') { // $messageManager->addOneContactToMailChimp( // $mcCreds['api_key'], // $audience, // [ // 'email_address' => $schoolAttendee->getEmailAddress(), // 'status' => $subscribed, // 'merge_fields' => [ // 'FNAME' => $schoolAttendee->getContactFirstName(), // 'LNAME' => $schoolAttendee->getContactLastName() // ], // 'tags' => [$tag] // ] // ); // echo 'Added ' . $schoolAttendee->getEmailAddress() . ' - ' . count($toBeAdded) . '<br />' . "\r\n"; // exit; $toBeAdded[] = [ 'email_address' => $schoolAttendee->getEmailAddress(), 'status' => $subscribed, 'merge_fields' => [ 'FNAME' => $schoolAttendee->getContactFirstName(), 'LNAME' => $schoolAttendee->getContactLastName() ], 'tags' => [$tag] // 'tags' => [['name' => $tag, 'status' => 'active']] ]; // echo 'Added ' . $schoolAttendee->getEmailAddress() . ' - ' . count($toBeAdded) . '<br />' . "\r\n"; // $errorLogManager->error('Added: ' . count($toBeAdded), true); } elseif (!in_array($mustAdd, ['Unsubscribed', 'no'])) { $toBeUpdated[] = [ 'subscriber_id' => $mustAdd, 'email_address' => $schoolAttendee->getEmailAddress(), 'tags' => [['name' => $tag, 'status' => 'active']] ]; // echo $schoolAttendee->getEmailAddress() . ' - ' . $mustAdd . ' skipped<br />' . "\r\n"; // $errorLogManager->error('Skipped', true); } if (count($toBeUpdated) > 200) { $messageManager->updateTagsMailChimp($mcCreds['api_key'], $audience, $toBeUpdated); echo 'Updating school attendee tags' . "\r\n"; // var_dump($toBeUpdated); // echo "\r\n"; $toBeUpdated = array(); // exit; } if (count($toBeAdded) > 200) { $messageManager->addToMailChimp($mcCreds['api_key'], $audience, $toBeAdded); echo 'Adding school attendees to MailChimp' . "\r\n"; // var_dump($toBeAdded); // exit; $toBeAdded = array(); } } //foreach if (count($toBeAdded) > 0) { $messageManager->addToMailChimp($mcCreds['api_key'], $audience, $toBeAdded); echo "Adding school attendees to MailChimp \r\n"; var_dump($toBeAdded); echo "\r\n"; } if (count($toBeUpdated) > 0) { $messageManager->updateTagsMailChimp($mcCreds['api_key'], $audience, $toBeUpdated); echo "Updating school attendee tags to MailChimp \r\n"; var_dump($toBeUpdated); echo "\r\n"; } // exit; } }