Exemplo n.º 1
0
        $funcToCall = "showTableGroups";
    } elseif (isset($_GET['uid'])) {
        $MailingList->getUser($_GET['uid']);
        $funcToCall = "showFormUser";
    } elseif (isset($_GET['gid'])) {
        $MailingList->getUsersAndGroup($_GET['gid']);
        $funcToCall = "showFormGroup";
    } else {
        $MailingList->getGroups();
        $funcToCall = "showTableGroups";
    }
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['action'])) {
        if ($_POST['action'] == "user" && !empty($_POST['mail'])) {
            if ($_POST['id'] > 0) {
                $res = $MailingList->editUser($_POST['id'], $_POST['mail'], $_POST['name']);
            } else {
                $res = $MailingList->addUser($_POST['mail'], $_POST['name']);
            }
            $MailingList->obj = null;
            $funcToCall = "showFormUser";
        } elseif ($_POST['action'] == "group" && !empty($_POST['name'])) {
            if ($_POST['id'] > 0) {
                $res = $MailingList->editList($_POST['id'], $_POST['name'], $_POST['users']);
            } else {
                $res = $MailingList->createList($_POST['name'], $_POST['users']);
            }
            $MailingList->obj = null;
            $MailingList->getUsers();
            $funcToCall = "showFormGroup";
        }