diff options
author | Snap <snapwilliam@gmail.com> | 2015-04-16 14:51:26 -0700 |
---|---|---|
committer | Snap <snapwilliam@gmail.com> | 2015-04-16 14:51:26 -0700 |
commit | 5c7f2f17f9c471d306955df457c7cab4e5c6ed3b (patch) | |
tree | 0fe6d049f1af552af6a74d264a3f571cfdb1ee7c /includes/google-api-php-client-master/examples/templates | |
parent | d0b9b771a876922afdf00b2c55d5e1388a4ea2a3 (diff) | |
download | pathery-5c7f2f17f9c471d306955df457c7cab4e5c6ed3b.tar.xz |
Google's OpenID Connect method
$google_client_id & $google_client_secret must be added to db.inc.php!
Diffstat (limited to 'includes/google-api-php-client-master/examples/templates')
-rw-r--r-- | includes/google-api-php-client-master/examples/templates/base.php | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/includes/google-api-php-client-master/examples/templates/base.php b/includes/google-api-php-client-master/examples/templates/base.php new file mode 100644 index 0000000..34241e9 --- /dev/null +++ b/includes/google-api-php-client-master/examples/templates/base.php @@ -0,0 +1,90 @@ +<?php +/* Ad hoc functions to make the examples marginally prettier.*/ +function isWebRequest() +{ + return isset($_SERVER['HTTP_USER_AGENT']); +} + +function pageHeader($title) +{ + $ret = ""; + if (isWebRequest()) { + $ret .= "<!doctype html> + <html> + <head> + <title>" . $title . "</title> + <link href='styles/style.css' rel='stylesheet' type='text/css' /> + </head> + <body>\n"; + if ($_SERVER['PHP_SELF'] != "/index.php") { + $ret .= "<p><a href='index.php'>Back</a></p>"; + } + $ret .= "<header><h1>" . $title . "</h1></header>"; + } + return $ret; +} + + +function pageFooter($file = null) +{ + $ret = ""; + if (isWebRequest()) { + // Echo the code if in an example. + if ($file) { + $ret .= "<h3>Code:</h3>"; + $ret .= "<pre class='code'>"; + $ret .= htmlspecialchars(file_get_contents($file)); + $ret .= "</pre>"; + } + $ret .= "</html>"; + } + return $ret; +} + +function missingApiKeyWarning() +{ + $ret = ""; + if (isWebRequest()) { + $ret = " + <h3 class='warn'> + Warning: You need to set a Simple API Access key from the + <a href='http://developers.google.com/console'>Google API console</a> + </h3>"; + } else { + $ret = "Warning: You need to set a Simple API Access key from the Google API console:"; + $ret .= "\nhttp://developers.google.com/console\n"; + } + return $ret; +} + +function missingClientSecretsWarning() +{ + $ret = ""; + if (isWebRequest()) { + $ret = " + <h3 class='warn'> + Warning: You need to set Client ID, Client Secret and Redirect URI from the + <a href='http://developers.google.com/console'>Google API console</a> + </h3>"; + } else { + $ret = "Warning: You need to set Client ID, Client Secret and Redirect URI from the"; + $ret .= " Google API console:\nhttp://developers.google.com/console\n"; + } + return $ret; +} + +function missingServiceAccountDetailsWarning() +{ + $ret = ""; + if (isWebRequest()) { + $ret = " + <h3 class='warn'> + Warning: You need to set Client ID, Email address and the location of the Key from the + <a href='http://developers.google.com/console'>Google API console</a> + </h3>"; + } else { + $ret = "Warning: You need to set Client ID, Email address and the location of the Key from the"; + $ret .= " Google API console:\nhttp://developers.google.com/console\n"; + } + return $ret; +} |