Reorder action switches a bit.
This commit is contained in:
parent
594b4a85d4
commit
fbb0753c11
45
index.php
45
index.php
@ -18,19 +18,12 @@ $client->addScope(Google_Service_Oauth2::USERINFO_EMAIL);
|
|||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
if (isset($_GET['action']) && $_GET['action'] == 'logout') {
|
$action = '';
|
||||||
// Delete session and redirect to self
|
if (isset($_GET['action'])) {
|
||||||
#$client->setAccessToken($_SESSION['access_token']);
|
$action = $_GET['action'];
|
||||||
#$client->revokeToken(); // removed granted permissions from account
|
|
||||||
$_SESSION = array();
|
|
||||||
if (ini_get('session.use_cookies')) {
|
|
||||||
$params = session_get_cookie_params();
|
|
||||||
setcookie(session_name(), '', time()-42000, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
|
|
||||||
}
|
|
||||||
session_destroy();
|
|
||||||
header('Location: ' . $client->getRedirectUri());
|
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
|
$data['action'] = $action;
|
||||||
|
$data['action_uc'] = ucwords($action);
|
||||||
|
|
||||||
if (isset($_GET['code']) && $_GET['code']) {
|
if (isset($_GET['code']) && $_GET['code']) {
|
||||||
// Validate OAuth2 result, set access token and redirect to self
|
// Validate OAuth2 result, set access token and redirect to self
|
||||||
@ -43,8 +36,19 @@ if (isset($_GET['code']) && $_GET['code']) {
|
|||||||
$tpl_done = false;
|
$tpl_done = false;
|
||||||
|
|
||||||
// route pages that work with and without login
|
// route pages that work with and without login
|
||||||
if (isset($_GET['action'])) {
|
switch ($action) {
|
||||||
switch ($_GET['action']) {
|
case 'logout':
|
||||||
|
// Delete session and redirect to self
|
||||||
|
#$client->setAccessToken($_SESSION['access_token']);
|
||||||
|
#$client->revokeToken(); // removed granted permissions from account
|
||||||
|
$_SESSION = array();
|
||||||
|
if (ini_get('session.use_cookies')) {
|
||||||
|
$params = session_get_cookie_params();
|
||||||
|
setcookie(session_name(), '', time()-42000, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
|
||||||
|
}
|
||||||
|
session_destroy();
|
||||||
|
header('Location: ' . $client->getRedirectUri());
|
||||||
|
exit(0);
|
||||||
case 'faq':
|
case 'faq':
|
||||||
$ho->setTemplate('faq_html');
|
$ho->setTemplate('faq_html');
|
||||||
$tpl_done = true;
|
$tpl_done = true;
|
||||||
@ -56,7 +60,6 @@ if (isset($_GET['action'])) {
|
|||||||
$_SESSION[$skey] = $_POST;
|
$_SESSION[$skey] = $_POST;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!$tpl_done && isset($_SESSION['access_token']) && $_SESSION['access_token']) {
|
if (!$tpl_done && isset($_SESSION['access_token']) && $_SESSION['access_token']) {
|
||||||
// Authenticated
|
// Authenticated
|
||||||
@ -95,17 +98,13 @@ if (!$tpl_done && isset($_SESSION['access_token']) && $_SESSION['access_token'])
|
|||||||
$ho->setTemplate('notverified_html');
|
$ho->setTemplate('notverified_html');
|
||||||
$tpl_done = true;
|
$tpl_done = true;
|
||||||
} else {
|
} else {
|
||||||
switch ($_GET['action']) {
|
switch ($action) {
|
||||||
case 'send':
|
case 'send':
|
||||||
echo 'This would send the mail...';
|
echo 'This would send the mail...';
|
||||||
$mo = new MailOutput(dirname(__FILE__) . '/templates');
|
$mo = new MailOutput(dirname(__FILE__) . '/templates');
|
||||||
$mo->setTemplate('mail_' . $form_type);
|
$mo->setTemplate('mail_' . $form_type);
|
||||||
$action = $form_type;
|
$skey = 'form_' . $form_type;
|
||||||
$skey = 'form_' . $action;
|
$fd = new FieldDefinition($form_type);
|
||||||
$data['action'] = $action;
|
|
||||||
$data['action_uc'] = ucwords($action);
|
|
||||||
|
|
||||||
$fd = new FieldDefinition($action);
|
|
||||||
$fd->setFieldValues($_SESSION[$skey]);
|
$fd->setFieldValues($_SESSION[$skey]);
|
||||||
$fieldData = $fd->getFieldData();
|
$fieldData = $fd->getFieldData();
|
||||||
$fields = $fieldData['fields'];
|
$fields = $fieldData['fields'];
|
||||||
@ -164,7 +163,5 @@ if (!$tpl_done && isset($_SESSION['access_token']) && $_SESSION['access_token'])
|
|||||||
$ho->setTemplate('index_html');
|
$ho->setTemplate('index_html');
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['action'] = $_GET['action'];
|
|
||||||
|
|
||||||
$ho->setTemplateVars($data);
|
$ho->setTemplateVars($data);
|
||||||
$ho->sendOutputToStdout();
|
$ho->sendOutputToStdout();
|
||||||
|
Reference in New Issue
Block a user