예제 #1
0
<?php

include "env.php";
include APP_PATH . "/Bootstrap.php";
$contact = null;
// TODO: Is this page still relevant? Maybe use the token for quick authentication?
$contactId = Utils::getParam('c');
$identifier = Utils::getParam('i');
$contact = AuthHandler::authByVerification($contactId, $identifier);
if ($contact) {
    try {
        Service_DeleteUser::run(AuthHandler::getLoggedInUserId());
        GlobalMessage::setGlobalMessage(_('Contact successfully deleted.'), GlobalMessage::INFO);
    } catch (Exception $e) {
        GlobalMessage::setGlobalMessage(_('Deletion failed') . ': ' . _('Internal error.'), GlobalMessage::ERROR);
    }
} else {
    GlobalMessage::setGlobalMessage(_('Deletion failed') . ': ' . _('Authentication failed.'), GlobalMessage::ERROR);
}
AuthHandler::logout();
Utils::redirect('index.php');
예제 #2
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");
        }
    }
예제 #3
0
<?php

include "env.php";
include APP_PATH . "/Bootstrap.php";
$contact = null;
$ref = Utils::getParam('ref');
if (AuthHandler::isLoggedIn()) {
    AuthHandler::logout();
    info('Contact ' . AuthHandler::getLoggedInUserId() . ' logged out');
    GlobalMessage::setGlobalMessage(_('Goodbye!'));
} else {
    warn('User tried to logout without being logged in');
}
if ($ref) {
    // The redirect method is only redirecting to internal pages
    Utils::redirect($ref);
} else {
    Utils::redirect('index.php');
}