Exemple #1
0
    $query = "SELECT * FROM emailtemplate WHERE active = 0";
    $statement = gGetDb()->prepare($query);
    $statement->execute();
    $inactiverows = $statement->fetchAll(PDO::FETCH_CLASS, "EmailTemplate");
    $smarty->assign('inactiveemails', $inactiverows);
    if (count($inactiverows) > 0) {
        $smarty->assign('displayinactive', true);
    } else {
        $smarty->assign('displayinactive', false);
    }
    $smarty->display("email-management/main.tpl");
    BootstrapSkin::displayInternalFooter();
    die;
} elseif ($action == "oauthdetach") {
    if ($enforceOAuth) {
        BootstrapSkin::displayAccessDenied();
        BootstrapSkin::displayInternalFooter();
        die;
    }
    global $baseurl;
    $currentUser = User::getCurrent();
    $currentUser->detachAccount();
    header("Location: {$baseurl}/acc.php?action=logout");
} elseif ($action == "oauthattach") {
    $database = gGetDb();
    $database->transactionally(function () use($database) {
        try {
            global $oauthConsumerToken, $oauthSecretToken, $oauthBaseUrl, $oauthBaseUrlInternal;
            $user = User::getCurrent();
            // Get a request token for OAuth
            $util = new OAuthUtility($oauthConsumerToken, $oauthSecretToken, $oauthBaseUrl, $oauthBaseUrlInternal);