Ejemplo n.º 1
0
function handle_verify_user_request()
{
    if (isset($_POST['unverify_user'])) {
        echo "<div class='content_box'>\n";
        echo "  <h3>" . _("Results") . "</h3>\n";
        $uid = post('uid');
        try {
            $verified = get_verified_for_user($uid);
            if (!$verified) {
                echo "<p>User {$uid} was not already verified.  Any more?</p>\n";
            } else {
                if (unverify_user($uid) == 1) {
                    echo "<p>Unverified user {$uid}.  Any more?</p>\n";
                } else {
                    throw new Error("Unknown Error", "This shouldn't happen.  Please report it.");
                }
            }
        } catch (Exception $e) {
            echo "<p>{$e->getMessage()}.  Try again?</p>\n";
        }
    } else {
        if (isset($_POST['verify_user'])) {
            echo "<div class='content_box'>\n";
            echo "  <h3>" . _("Results") . "</h3>\n";
            $uid = post('uid');
            try {
                $verified = get_verified_for_user($uid);
                if ($verified) {
                    echo "<p>User {$uid} was already verified.  Any more?</p>\n";
                } else {
                    if (verify_user($uid) == 1) {
                        echo "<p>Verified user {$uid}.  Any more?</p>\n";
                    } else {
                        throw new Error("Unknown Error", "This shouldn't happen.  Please report it.");
                    }
                }
            } catch (Exception $e) {
                echo "<p>{$e->getMessage()}.  Try again?</p>\n";
            }
        }
    }
}
Ejemplo n.º 2
0
function docs()
{
    if (isset($_POST['action'])) {
        $action = post('action');
        if ($action == 'verify') {
            verify_user(post('uid'));
        } else {
            if ($action == 'unverify') {
                unverify_user(post('uid'));
            } else {
                throw new Error("unknown action", "unknown action: {$action}");
            }
        }
    }
    show_docs_form();
    if (isset($_GET['uid'])) {
        show_user_documents_for_user(get('uid'));
    } else {
        if (isset($_GET['verified_with_no_docs'])) {
            show_user_verified_with_no_documents();
        } else {
            show_user_documents();
        }
    }
    echo "<div class='content_box'>\n";
    echo "<h3>Upload Docs for Users</h3>\n";
    echo "<p><a href=\"?page=identity\">Upload more docs</a></p>\n";
    echo "</div>\n";
}