function stash_request($extra = null, $email = null) { $url = url_invoked(); if (!is_null($_SERVER['QUERY_STRING'])) { $url .= "?{$_SERVER['QUERY_STRING']}"; } $v = null; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $v = $_POST; } return stash_new_request($_SERVER['REQUEST_METHOD'], $url, $v, $extra, $email); }
function DoConfirmationEmail() { global $q_stash, $q_email, $q_name, $q_rememberme; if (is_null($q_stash)) { // create a default stashed request $template_data = array('reason_web' => "Log in", 'reason_email' => "Log in to Journalisted", 'reason_email_subject' => 'Log in to Journalisted'); $q_stash = stash_new_request("POST", "/login", null, rabx_serialise($template_data), null); } $token = auth_token_store('login', array('email' => $q_email, 'name' => $q_name, 'stash' => $q_stash)); db_commit(); /* send out a confirmation email */ $url = OPTION_BASE_URL . "/login?t={$token}"; $ex = stash_get_extra($q_stash); $values = rabx_unserialise($ex); $body = "Please click on the link below to confirm your email address.\n" . "{$values['reason_email']}\n" . "\n" . "{$url}\n" . "\n"; $subject = $values['reason_email_subject']; $from_name = "Journalisted"; $from_email = OPTION_TEAM_EMAIL; if (!OPTION_JL_BYPASS_LOGIN_EMAIL) { jl_send_text_email($q_email, $from_name, $from_email, $subject, $body); } return $url; }
function person_make_signon_url($data, $email, $method, $url, $params, $url_base = null) { if (!$url_base) { $url_base = OPTION_BASE_URL . "/"; } $st = stash_new_request($method, $url, $params, $data); /* XXX should combine this and the similar code in login.php. */ $token = auth_token_store('login', array('email' => $email, 'name' => null, 'stash' => $st, 'direct' => 1)); return $url_base . "L/{$token}"; }