Exemple #1
0
            BootstrapSkin::displayAlertBox("I don't know what type of target you want to ban! You'll need to choose from email address, IP, or requested name.", "alert-error", "", false, false);
            BootstrapSkin::displayInternalFooter();
            die;
    }
    if (count(Ban::getActiveBans($_POST['target'])) > 0) {
        BootstrapSkin::displayAlertBox("This target is already banned!", "alert-error", "", false, false);
        BootstrapSkin::displayInternalFooter();
        die;
    }
    $database = gGetDb();
    $ban = new Ban();
    $currentUsername = User::getCurrent()->getUsername();
    $database->transactionally(function () use($database, $ban, $duration, $currentUsername) {
        $ban->setDatabase($database);
        $ban->setActive(1);
        $ban->setType($_POST['type']);
        $ban->setTarget($_POST['target']);
        $ban->setUser($currentUsername);
        $ban->setReason($_POST['banreason']);
        $ban->setDuration($duration);
        $ban->save();
        Logger::banned($database, $ban, $_POST['banreason']);
    });
    $smarty->assign("ban", $ban);
    BootstrapSkin::displayAlertBox($smarty->fetch("bans/bancomplete.tpl"), "alert-info", "", false, false);
    Notification::banned($ban);
    BootstrapSkin::displayInternalFooter();
    die;
} elseif ($action == "unban") {
    global $smarty;
    if (!isset($_GET['id']) || $_GET['id'] == "") {