Пример #1
0
 /**
  * 
  * @return string The global message, or false if no such exists.
  */
 public static function getGlobalMessage()
 {
     if (AuthHandler::isSessionExisting() && isset($_SESSION[AuthHandler::SESSION_KEY_GLOBAL_MESSAGE])) {
         return $_SESSION[AuthHandler::SESSION_KEY_GLOBAL_MESSAGE];
     }
     return false;
 }
Пример #2
0
<?php

include "env.php";
include APP_PATH . "/Bootstrap.php";
$feedbackOptions = array(1 => _("Report a bug"), 2 => _("Ask a question"), 3 => _("Request a feature"), 4 => _("Contact"), 5 => _("Other"));
// This is a post - form submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (!AuthHandler::isSessionExisting()) {
        // Try to discard bots by dropping requests with no session
        die;
    }
    extract($_POST);
    if (!Utils::isEmptyString($feedback)) {
        $mailHelper = new MailHelper();
        $wantToStr = isset($wantTo) && isset($feedbackOptions[$wantTo]) ? $feedbackOptions[$wantTo] : _("Other");
        $params = array('wantTo' => $wantToStr, 'feedback' => $feedback, 'email' => $email);
        $body = $mailHelper->render('views/feedbackMail.php', $params);
        $to = getConfiguration('feedback.mail');
        $toName = getConfiguration('feedback.to.name');
        $from = getConfiguration('feedback.from');
        $fromName = getConfiguration('feedback.from.name');
        $replyTo = Utils::isEmptyString($email) ? null : Utils::buildEmail($email);
        Utils::sendMail($to, $toName, $from, 'Carpool feedback', 'New carpool feedback', $body, $replyTo, $replyTo);
        GlobalMessage::setGlobalMessage(_('Thanks for the feedback!'));
    } else {
        GlobalMessage::setGlobalMessage(_('Please write something.'), GlobalMessage::ERROR);
    }
    // Get after post
    Utils::redirect('feedback.php');
} else {
    AuthHandler::putUserToken();
Пример #3
0
<?php

include "../env.php";
include APP_PATH . "/Bootstrap.php";
if (ENV !== ENV_DEVELOPMENT && (!Utils::IsXhrRequest() || !AuthHandler::isSessionExisting())) {
    die;
}
$contactId = AuthHandler::getLoggedInUserId();
if (!$contactId) {
    warn("Toggle activate command sent while no user is logged in");
    die;
}
try {
    $server = DatabaseHelper::getInstance();
    $ride = $server->getRideProvidedByContactId($contactId);
    if (!$ride) {
        throw new Exception("No ride found for contact {$contactId}");
    }
    $rideId = $ride['Id'];
    if ($ride['Active'] == RIDE_ACTIVE) {
        // Hidden status is always status + 2
        $newStatus = RIDE_INACTIVE;
        $msg = _("Ride de-activated. From now on, this ride will not appear in the search results.");
    } else {
        if ($ride['Active'] == RIDE_INACTIVE) {
            $newStatus = RIDE_ACTIVE;
            $msg = _("Ride activated. You are back in business!");
        } else {
            throw new Exception("Illegal status");
        }
    }