Example #1
0
function sendEmail($recipient, $content, $subject = 'Notification', $includeStandardFooter = true)
{
    $subject = 'lanlist.org - ' . $subject;
    if (empty($content)) {
        throw new Exception('Cannot send a blank email');
    }
    $content = wordwrap($content);
    if ($includeStandardFooter) {
        $content .= "\n\n- lanlist.org";
    }
    ErrorHandler::getInstance()->beLazy();
    require_once 'Mail.php';
    require_once 'Mail/smtp.php';
    $host = 'ssl://smtp.gmail.com';
    $username = 'xconspirisist@lanlist.org';
    $password = 'ionicflame312';
    $smtp = new Mail_smtp(array('host' => $host, 'port' => 465, 'auth' => true, 'username' => $username, 'password' => $password));
    $headers = array('From' => '"lanlist.org" <mailer@lanlist.org>', 'To' => '<' . $recipient . '>', 'Subject' => $subject, 'Content-Type' => 'text/html');
    $smtp->send('<' . $recipient . '>', $headers, $content);
    ErrorHandler::getInstance()->beGreedy();
    Logger::messageDebug('Sending email to ' . $recipient . ', subject: ' . $subject);
    $sql = 'INSERT INTO email_log (subject, emailAddress, sent) VALUES (:subject, :emailAddress, now())';
    $stmt = DatabaseFactory::getInstance()->prepare($sql);
    $stmt->bindValue(':emailAddress', $recipient);
    $stmt->bindValue(':subject', $subject);
    $stmt->execute();
}
Example #2
0
 public function process()
 {
     global $db;
     $sql = 'INSERT INTO venues (title, lat, lng, organizer, country) VALUES (:title, :lat, :lng, :organizer, :country) ';
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':title', $this->getElementValue('title'));
     $stmt->bindValue(':lat', $this->getElementValue('lat'));
     $stmt->bindValue(':lng', $this->getElementValue('lng'));
     $stmt->bindValue(':country', $this->getElementValue('country'));
     if (Session::hasPriv('NEW_VENUE')) {
         $stmt->bindValue(':organizer', $this->getElementValue('organizer'));
     } else {
         $stmt->bindValue('organizer', Session::getUser()->getData('organization'));
     }
     $stmt->execute();
     Logger::messageDebug('Venue ' . $this->getElementValue('title') . ' created by: ' . Session::getUser()->getUsername(), LocalEventType::CREATE_VENUE);
     redirect('account.php', 'Venue created.');
 }
Example #3
0
 public function process()
 {
     global $db;
     $sql = 'INSERT INTO events (title, dateStart, dateFinish, organizer, venue, published, website, createdDate, createdBy) VALUES (:title, :dateStart, :dateFinish, :organizer, :venue, :published, :website, :createdDate, :createdBy)';
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':title', $this->getElementValue('title'));
     $stmt->bindValue(':dateStart', $this->getElementValue('dateStart'));
     $stmt->bindValue(':dateFinish', $this->getElementValue('dateFinish'));
     $stmt->bindValue(':website', $this->getElementValue('eventWebsite'));
     $stmt->bindValue(':createdDate', date(DATE_ATOM));
     $stmt->bindValue(':createdBy', Session::getUser()->getId());
     if (Session::getUser()->hasPriv('CREATE_EVENTS')) {
         $this->addElement(Element::factory('html', 'msg', null, 'Hi superuser.'));
         $stmt->bindValue(':organizer', $this->getElementValue('organizer'));
         $stmt->bindValue(':published', 1);
         $stmt->bindValue(':venue', $this->getElementValue('venue'));
     } else {
         if (Session::getUser()->getData('organization') != null) {
             $stmt->bindValue(':venue', $this->getElementValue('venue'));
             $organizer = fetchOrganizer(Session::getUser()->getData('organization'));
             if ($organizer['published']) {
                 $this->addElement(Element::factory('html', 'msg', null, 'You are authorized to create public events for your organization.'));
                 $stmt->bindValue(':organizer', $organizer['id']);
                 $stmt->bindValue(':published', 1);
             } else {
                 $this->addElement(Element::factory('html', 'msg', null, 'Your event will be linked to your organization, but will not be public until your organization has been approved.'));
                 $stmt->bindValue(':organizer', $organizer['id']);
                 $stmt->bindValue(':published', 0);
             }
         } else {
             $this->addElement(Element::factory('html', 'msg', null, 'You can create events, but they will not appear in public lists until approved.'));
             $stmt->bindValue(':organizer', '');
             $stmt->bindValue(':published', 0);
             $stmt->bindValue(':venue', '');
         }
     }
     $stmt->execute();
     $eventId = $db->lastInsertId();
     Logger::messageDebug('Event ' . $this->getElementValue('title') . ' created by: ' . Session::getUser()->getUsername(), LocalEventType::CREATE_EVENT);
     redirect('viewEvent.php?id=' . $eventId, 'Event created.');
 }
 public function process()
 {
     global $db;
     $sql = 'UPDATE organizers SET published = :published, title = :title, websiteUrl = :websiteUrl, assumedStale = :assumedStale, steamGroupUrl = :steamGroupUrl, blurb = :blurb WHERE id = :id LIMIT 1';
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':id', $this->getElementValue('id'));
     $stmt->bindValue(':title', $this->getElementValue('title'));
     $stmt->bindValue(':websiteUrl', $this->getElementValue('websiteUrl'));
     $stmt->bindValue(':assumedStale', $this->getElementValue('assumedStale'));
     $stmt->bindValue(':steamGroupUrl', $this->getElementValue('steamGroupUrl'));
     $stmt->bindValue(':blurb', $this->getElementValue('blurb'));
     if (Session::getUser()->hasPriv('PUBLISH_ORGANIZERS')) {
         $stmt->bindValue(':published', $this->getElementValue('published'));
     } else {
         $stmt->bindValue(':published', 0);
     }
     $stmt->execute();
     $this->getElement('banner')->savePng();
     Logger::messageDebug('Organizer ' . $this->getElementValue('title') . ' (' . $this->getElementValue('id') . ') edited by: ' . Session::getUser()->getUsername(), LocalEventType::EDIT_ORGANIZER);
     redirect('viewOrganizer.php?id=' . $this->getElementValue('id'), 'Organizer updated.');
 }
Example #5
0
 public function process()
 {
     global $db;
     $sql = 'UPDATE events SET title = :title, venue = :venue, dateStart = :dateStart, dateFinish = :dateFinish, priceOnDoor = :priceOnDoor, priceInAdv = :priceInAdv, website = :website, showers = :showers, sleeping = :sleeping, currency = :currency, smoking = :smoking, alcohol = :alcohol, numberOfSeats = :numberOfSeats, networkMbps = :networkMbps, internetMbps = :internetMbps, blurb = :blurb, organizer = :organizer WHERE id = :id';
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':id', $this->getElementValue('id'));
     $stmt->bindValue(':title', $this->getElementValue('title'));
     $stmt->bindValue(':dateStart', $this->getElementValue('dateStart'));
     $stmt->bindValue(':dateFinish', $this->getElementValue('dateFinish'));
     $stmt->bindValue(':priceOnDoor', $this->getElementvalue('priceOnDoor'));
     $stmt->bindValue(':priceInAdv', $this->getElementvalue('priceInAdv'));
     $stmt->bindValue(':currency', $this->getElementvalue('currency'));
     $stmt->bindValue(':website', $this->getElementvalue('website'));
     $stmt->bindValue(':showers', $this->getElementvalue('showers'));
     $stmt->bindValue(':sleeping', $this->getElementvalue('sleeping'));
     $stmt->bindValue(':alcohol', $this->getElementValue('alcohol'));
     $stmt->bindValue(':smoking', $this->getElementValue('smoking'));
     $stmt->bindValue(':networkMbps', $this->getElementValue('networkMbps'));
     $stmt->bindValue(':internetMbps', $this->getElementValue('internetMbps'));
     $stmt->bindValue(':numberOfSeats', $this->getElementValue('numberOfSeats'));
     $stmt->bindValue(':blurb', $this->getElementValue('blurb'));
     $stmt->bindValue(':venue', $this->getElementValue('venue'));
     if (Session::getUser()->hasPriv('MODERATE_EVENTS')) {
         $stmt->bindValue(':organizer', $this->getElementvalue('organizer'));
     } else {
         $event = $this->getEvent();
         $stmt->bindValue(':organizer', $event['organizer']);
     }
     $stmt->execute();
     Logger::messageDebug('Event ' . $this->getElementValue('title') . ' (' . $this->getElementValue('id') . ') edited by: ' . Session::getUser()->getUsername(), LocalEventType::EDIT_EVENT);
     redirect('viewEvent.php?id=' . $this->getElementValue('id'), 'Event updated.');
 }