summaryrefslogtreecommitdiffstats
path: root/examples/consumer
diff options
context:
space:
mode:
authorPhilipp Söhnlein <me@philipp-soehnlein.de>2011-01-16 14:50:56 +0100
committerPhilipp Söhnlein <me@philipp-soehnlein.de>2011-01-16 14:50:56 +0100
commitd088a90c3b6f483ab07d772efcf8190306dd6d94 (patch)
treeffc307c1d6657ec61fa55d32bb0c741cd109119b /examples/consumer
parentc78da981c1bb7d1d80f098245c8dd43a9d126ac0 (diff)
downloadphp-openid-d088a90c3b6f483ab07d772efcf8190306dd6d94.zip
php-openid-d088a90c3b6f483ab07d772efcf8190306dd6d94.tar.gz
php-openid-d088a90c3b6f483ab07d772efcf8190306dd6d94.tar.bz2
Made some hardcoded tmp paths dynamic by using sys_get_temp_dir. If function is not available the old mechanisms are used.
Diffstat (limited to 'examples/consumer')
-rw-r--r--examples/consumer/common.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/examples/consumer/common.php b/examples/consumer/common.php
index 67f4273..fddc1c3 100644
--- a/examples/consumer/common.php
+++ b/examples/consumer/common.php
@@ -50,7 +50,25 @@ function &getStore() {
* created elsewhere. After you're done playing with the example
* script, you'll have to remove this directory manually.
*/
- $store_path = "/tmp/_php_consumer_test";
+ $store_path = null;
+ if (function_exists('sys_get_temp_dir')) {
+ $store_path = sys_get_temp_dir();
+ }
+ else {
+ if (strpos(PHP_OS, 'WIN') === 0) {
+ $store_path = $_ENV['TMP'];
+ if (!isset($store_path)) {
+ $dir = 'C:\Windows\Temp';
+ }
+ }
+ else {
+ $store_path = @$_ENV['TMPDIR'];
+ if (!isset($store_path)) {
+ $store_path = '/tmp';
+ }
+ }
+ }
+ $store_path .= DIRECTORY_SEPARATOR . '_php_consumer_test';
if (!file_exists($store_path) &&
!mkdir($store_path)) {