summaryrefslogtreecommitdiffstats
path: root/examples/server
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2006-04-24 18:47:34 +0000
committertailor <cygnus@janrain.com>2006-04-24 18:47:34 +0000
commit33ccbf7820fe29b2ceea4d2926454ed6889a3ae6 (patch)
tree3f01f49f1a9772a75c428c40a7c06eb1751d078d /examples/server
parent5b023df13d6f7230268473a5b451ff4a630abe89 (diff)
downloadphp-openid-33ccbf7820fe29b2ceea4d2926454ed6889a3ae6.zip
php-openid-33ccbf7820fe29b2ceea4d2926454ed6889a3ae6.tar.gz
php-openid-33ccbf7820fe29b2ceea4d2926454ed6889a3ae6.tar.bz2
[project @ Added support to server config generator to download config]
Diffstat (limited to 'examples/server')
-rw-r--r--examples/server/setup.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/examples/server/setup.php b/examples/server/setup.php
index b531f2e..79eaabc 100644
--- a/examples/server/setup.php
+++ b/examples/server/setup.php
@@ -36,7 +36,7 @@ if (!check_session() ||
isset($_GET['add_openid'])) {
render_form();
} else {
- print generate_config();
+ print generate_config(isset($_GET['download']));
}
/**
@@ -501,7 +501,13 @@ function init_session() {
}
}
-function generate_config() {
+function generate_config($download = false) {
+
+ if ($download) {
+ // Emit headers to force browser download.
+ header("Content-type: text/plain");
+ header("Content-disposition: attachment; filename=config.php");
+ } else {
?>
<html>
<body>
@@ -513,10 +519,17 @@ Put the following text into <strong><? print dirname(__FILE__); print DIRECTORY_
</p>
<p>
-<a href="setup.php?clear=1">Back to form</a>
+<a href="setup.php?clear=1">Back to form</a> (resets settings)
+</p>
+
+<p>
+<a href="setup.php?download=1">Download this configuration</a>
</p>
<pre style="border: 1px solid gray; background: #eee; padding: 5px;">
+<?
+}
+?>
<? if ($_SESSION['include_path']) { ?>
/**
* Set any extra include paths needed to use the library
@@ -661,9 +674,13 @@ foreach ($_SESSION['trust_roots'] as $url) {
?>
);
+<?
+ if (!$download) {
+?>
</pre>
</body>
</html>
<?
+ }
} // end function generate_config ()
?>