public static function run($contactId)
 {
     $db = DatabaseHelper::getInstance();
     try {
         $db->beginTransaction();
         if (!$db->deleteRideByContact($contactId)) {
             throw new Exception("Could not delete rides for contact {$contact}`Id");
         }
         if (!$db->deleteContact($contactId)) {
             throw new Exception("Could not delete contact {$contactId}");
         }
         $db->commit();
         AuthHandler::logout();
     } catch (Exception $e) {
         logException($e);
         $db->rollBack();
         throw $e;
     }
 }
Beispiel #2
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');