Beispiel #1
0
                $q->execute($user);
                if ($subscribe) {
                    $q = db()->prepare("INSERT INTO pending_subscriptions SET user_id=?,created_at=NOW(),is_subscribe=1");
                    $q->execute(array($user['id']));
                    $messages[] = t("You will be added manually to the :mailing_list soon.", array(':mailing_list' => "<a href=\"http://groups.google.com/group/" . htmlspecialchars(get_site_config('google_groups_announce')) . "\" target=\"_blank\">" . t("Announcements Mailing List") . "</a>"));
                }
                // try sending email
                if ($user_instance->getEmail()) {
                    $user['email'] = $user_instance->getEmail();
                    send_user_email($user, "signup", array("email" => $user['email'], "name" => $name ? $name : $user['email'], "announcements" => "http://groups.google.com/group/" . htmlspecialchars(get_site_config('google_groups_announce')), "url" => absolute_url(url_for("unsubscribe", array('email' => $user['email'], 'hash' => md5(get_site_config('unsubscribe_salt') . $user['email'])))), "wizard_currencies" => absolute_url(url_for("wizard_currencies")), "wizard_addresses" => absolute_url(url_for("wizard_accounts_addresses")), "wizard_accounts" => absolute_url(url_for("wizard_accounts")), "wizard_notifications" => absolute_url(url_for("wizard_notifications")), "reports" => absolute_url(url_for("profile")), "premium" => absolute_url(url_for("premium"))));
                }
                // create default summary pages and cryptocurrencies and graphs contents
                reset_user_settings($user['id']);
                // success!
                // issue #62: rather than requiring another step to login, just log the user in now.
                \Users\User::forceLogin(db(), $user['id']);
                complete_login($user, $autologin);
                $messages[] = t("New account creation successful.");
                // redirect
                set_temporary_messages($messages);
                redirect(url_for(get_site_config('premium_welcome') ? "welcome" : get_site_config('signup_login'), array("pause" => true)));
            }
        } catch (Exception $e) {
            if (!$e instanceof EscapedException) {
                $e = new EscapedException(htmlspecialchars($e->getMessage()), (int) $e->getCode(), $e);
            }
            $errors[] = $e->getMessage();
        }
    }
}
require __DIR__ . "/../layout/templates.php";