summaryrefslogtreecommitdiff
path: root/manager/library/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'manager/library/helpers')
-rw-r--r--manager/library/helpers/GetEnv.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/manager/library/helpers/GetEnv.php b/manager/library/helpers/GetEnv.php
new file mode 100644
index 0000000..3ac374d
--- /dev/null
+++ b/manager/library/helpers/GetEnv.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * @author markus
+ * $Id: GetEnv.php 6 2009-11-18 14:52:50Z markus $
+ */
+class GetEnv {
+ /**
+ * Get an environment variable with all the REDIRECT_ prefixes stripped off
+ */
+ public static function getEnvVar($var)
+ {
+ // Find out how deep the redirect goes
+ reset($_SERVER);
+ $key = key($_SERVER);
+ $redirectLevel = substr_count($key, 'REDIRECT_');
+
+ $result = '';
+ $prefix = '';
+ for ($i = 0; $i < $redirectLevel + 1; $i++) {
+ if (isset($_SERVER[$prefix . $var])) {
+ $result = $_SERVER[$prefix . $var];
+ }
+ $prefix .= 'REDIRECT_';
+ }
+ return $result;
+ }
+}
+
+?> \ No newline at end of file