Skip some unneccessary intermediate pages
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
define("SITE_ROOT", realpath(dirname(__file__)));
|
||||
require_once SITE_ROOT . "/lib/init.php";
|
||||
|
||||
if (!$S->isAnonymous() && $S->user->isAllowed())
|
||||
{
|
||||
http::redirect("/crashes.php");
|
||||
}
|
||||
|
||||
Layout::header();
|
||||
?>
|
||||
|
||||
|
||||
@@ -31,6 +31,27 @@
|
||||
|
||||
class Layout
|
||||
{
|
||||
|
||||
function getLoginGateway()
|
||||
{
|
||||
$assoc_handle_expires = (int)Option::get('assoc_handle_expires');
|
||||
$now = time();
|
||||
|
||||
$assoc_handle = Option::get("assoc_handle");
|
||||
|
||||
if (!$assoc_handle || $assoc_handle_expires < $now)
|
||||
{
|
||||
$assoc_handle_expires = time() + 604800;
|
||||
$assoc_handle = GoogleOpenID::getAssociationHandle();
|
||||
if ($assoc_handle)
|
||||
{
|
||||
Option::update("assoc_handle_expires", $assoc_handle_expires);
|
||||
Option::update("assoc_handle", $assoc_handle);
|
||||
}
|
||||
}
|
||||
|
||||
return GoogleOpenID::createRequest(URL_ROOT . "/process_login.php", $handle, true);
|
||||
}
|
||||
|
||||
function since($since)
|
||||
{
|
||||
@@ -67,7 +88,7 @@ class Layout
|
||||
{
|
||||
$item = new stdClass;
|
||||
$item->label = "Login";
|
||||
$item->link = "/login.php";
|
||||
$item->link = self::getLoginGateway()->getRequestURL();
|
||||
$menu[] = $item;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -69,7 +69,7 @@ if (!DBH::$db->connect($DB_NAME, $DB_HOST, $DB_USER, $DB_PASS)) {
|
||||
die();
|
||||
}
|
||||
|
||||
//Option::init();
|
||||
Option::init();
|
||||
|
||||
$S = new Session();
|
||||
if (!defined('NO_SESSION') && PHP_SAPI != "cli") {
|
||||
|
||||
@@ -2,24 +2,8 @@
|
||||
|
||||
define("SITE_ROOT", realpath(dirname(__file__)));
|
||||
require_once SITE_ROOT . "/lib/init.php";
|
||||
$assoc_handle_expires = (int)Option::get('assoc_handle_expires');
|
||||
$now = time();
|
||||
|
||||
$assoc_handle = Option::get("assoc_handle");
|
||||
|
||||
if (!$assoc_handle || $assoc_handle_expires < $now)
|
||||
{
|
||||
$assoc_handle_expires = time() + 604800;
|
||||
$assoc_handle = GoogleOpenID::getAssociationHandle();
|
||||
if ($assoc_handle)
|
||||
{
|
||||
Option::update("assoc_handle_expires", $assoc_handle_expires);
|
||||
Option::update("assoc_handle", $assoc_handle);
|
||||
}
|
||||
}
|
||||
|
||||
$google_gateway = GoogleOpenID::createRequest(URL_ROOT . "/process_login.php", $handle, true);
|
||||
|
||||
$google_gateway = Layout::getLoginGateway();
|
||||
Layout::header();
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user