save() public method

public save ( )
Exemplo n.º 1
0
    if (!gb::$errors) {
        try {
            if (!git::commit('gitblog created', trim($_POST['name']) . ' <' . trim($_POST['email']) . '>')) {
                gb::$errors[] = 'failed to commit creation';
            }
        } catch (Exception $e) {
            gb::$errors[] = 'failed to commit creation: ' . nl2br(h(strval($e)));
        }
    }
    # -------------------------------------------------------------------------
    # create admin account
    if (!gb::$errors) {
        $_POST['email'] = trim($_POST['email']);
        $passhash = GBUser::passhash($_POST['email'], $_POST['passphrase']);
        $u = new GBUser(trim($_POST['name']), $_POST['email'], $passhash, true);
        $u->save();
        # issues git add, that's why we do this after init
    }
    # -------------------------------------------------------------------------
    # send the client along
    if (!gb::$errors) {
        header('Location: ' . gb::$site_url);
        exit(0);
    }
}
# ------------------------------------------------------------------------------------------------
# Perform a few sanity checks
#else {
#
#}
# ------------------------------------------------------------------------------------------------