diff --git a/.htaccess b/.htaccess index d8b93ba..72c0dc4 100644 --- a/.htaccess +++ b/.htaccess @@ -3,4 +3,4 @@ RewriteEngine on -RewriteRule ^([^.]+)/?$ index.php?action=$1 [L,NC] +RewriteRule ^([^./]+)/?$ index.php?action=$1 [L,NC] diff --git a/css/frs.css b/css/frs.css index c81cc11..4c5b9bc 100644 --- a/css/frs.css +++ b/css/frs.css @@ -66,6 +66,24 @@ } .mdl-layout a { - color: inherit !important; - text-decoration: inherit !important; -} \ No newline at end of file + color: inherit !important; + text-decoration: inherit !important; +} + +.mdl-list__item-avatar { + background-color: transparent !important; + color: rgb(117, 117, 117) !important; +} + +.frs-selector li { + transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1); + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.frs-selector li:hover { + background-color: rgb(238, 238, 238); + cursor: pointer; +} diff --git a/index.php b/index.php index 69f617b..f24f568 100644 --- a/index.php +++ b/index.php @@ -39,22 +39,70 @@ if (isset($_GET['code']) && $_GET['code']) { exit(0); } -if (isset($_SESSION['access_token']) && $_SESSION['access_token']) { +$tpl_done = false; + +// route pages that work with and without login +if (isset($_GET['action'])) { + switch ($_GET['action']) { + case 'faq': + $tpl = $m->loadTemplate('faq_html'); + $tpl_done = true; + break; + } +} + +if (!$tpl_done && isset($_SESSION['access_token']) && $_SESSION['access_token']) { // Authenticated - $client->setAccessToken($_SESSION['access_token']); + try { + $created = $_SESSION['access_token']['created']; + $expires = $_SESSION['access_token']['expires_in']; + $expire_stamp = intval($created) + intval($expires); + $data['session_created'] = $created; + $data['session_expires'] = $expires; + $data['session_time_left'] = ($expire_stamp) - time(); + $client->setAccessToken($_SESSION['access_token']); + } catch (Exception $e) { + print_r($e); + $_SESSION['access_token'] = $client->refreshToken(null); + print_r($_SESSION['access_token']); + } $data['auth_needed'] = false; - $oauth = new Google_Service_Oauth2($client); - $userdata = $oauth->userinfo->get(); - $data['user']['name_first'] = $userdata->givenName; - $data['userdata'] = print_r($userdata, true); + try { + $oauth = new Google_Service_Oauth2($client); + $userdata = $oauth->userinfo->get(); + } catch (Exception $e) { + print_r($e); + die(); + } + $data['user'] = array( + 'name_first' => $userdata->givenName, + 'name_last' => $userdata->familyName, + 'name' => $userdata->name, + 'picture' => $userdata->picture, + 'email' => $userdata->email, + 'gender' => $userdata->gender, + ); + // Check $userdata->verifiedEmail and deny if not verified. + if (!$userdata->verifiedEmail) { + $tpl = $m->loadTemplate('notverified_html'); + $tpl_done = true; + } - // TODO: Check $userdata->verifiedEmail and deny if not verified. - - $tpl = $m->loadTemplate('loggedin_html'); -} else { + switch ($_GET['action']) { + case 'faq': + $tpl = $m->loadTemplate('faq_html'); + break; + default: + if (!$tpl_done) { + $tpl = $m->loadTemplate('loggedin_html'); + $tpl_done = true; + } + break; + } +} elseif (!$tpl_done) { // Not authenticated $data['auth_needed'] = true; $data['auth_url'] = $client->createAuthUrl(); diff --git a/templates/faq_html.mustache b/templates/faq_html.mustache new file mode 100644 index 0000000..1940fe0 --- /dev/null +++ b/templates/faq_html.mustache @@ -0,0 +1,21 @@ +{{> html_head}} +{{> mdl_head}} +{{> mdl_content_head}} + +
+Your data won't be stored on our servers. It is solely used to compose the mail. +After the mail is sent, your data is deleted from our servers. +
+ + +{{> mdl_content_foot}} +{{> mdl_foot}} +{{> html_foot}} diff --git a/templates/index_html.mustache b/templates/index_html.mustache index 8f0db43..dee56d2 100644 --- a/templates/index_html.mustache +++ b/templates/index_html.mustache @@ -3,215 +3,54 @@ {{> mdl_content_head}}+Some time ago, Google introduced features to highlight special items from your +mails, like hotel reservations, event tickets, car rentals and more. +
+ ++Later, they added features to Google Now on Android smartphones so that you +get notified when to leave to catch your flight or event … or how to get to +your booked hotel and when the checkin opens. +
+ ++And recently, they even added a feature to Google Search, that shows your +booked items when you search for similar things. All that from a mail in your +inbox. +
+ +
+A nice overview with sample images can be found on Google's Developer pages:
+https://developers.google.com/gmail/markup/.
+
+But while the needed data is easy to be added to confirmation mails, many +companies didn't do this yet. And sometimes, you don't even get any confirmation +by email. To make those things show up in Google Now, I made this tool. +
+ + ++After login with your Google account, you can select a type of reservation, +fill in all your details and send it to the mail address of your account. +We will add all the neccessary markup to the mail so that Google Now can +recognise it. This will make the events/reservations show up when you need +them. +
+ + -{{/ auth_needed}} - -{{# userdata}} --
{{userdata}}- -{{/ userdata}} - -
- Hello, world! ({{action}}) -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
-- Hello, world! -
{{> mdl_content_foot}} {{> mdl_foot}} diff --git a/templates/loggedin_html.mustache b/templates/loggedin_html.mustache index 5322f86..8808f36 100644 --- a/templates/loggedin_html.mustache +++ b/templates/loggedin_html.mustache @@ -3,19 +3,62 @@ {{> mdl_content_head}}-
{{userdata}}- -{{/ userdata}} +
- Welcome, to the Fake Reservation System. Where you can book travels you'll never attend. +
+ To use this system, you must verify your Google email address first! +
+ +
+ You can find more information at this address:
+ https://support.google.com/accounts/answer/63950.
+