commit 30f7180020e0376277ef466e096e255a499d0892
parent 156c50e583877031faab5cf148fe5eb9d4937097
Author: MTRNord <mtrnord1@gmail.com>
Date: Tue, 3 Feb 2015 13:04:24 +0100
try to fix forwarding
Diffstat:
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/api.php b/api.php
@@ -1,6 +1,18 @@
<?php
header("Cache-Control: no-cache, must-revalidate, no-store");
-
+###############################
+# include files from root dir #
+###############################
+$root_1 = realpath($_SERVER["DOCUMENT_ROOT"]);
+$currentdir = getcwd();
+$root_2 = str_replace($root_1, '', $currentdir);
+$root_3 = explode("/", $root_2);
+if ($root_3[1] == 'core') {
+ echo $root_3[1];
+ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
+}else{
+ $root = $root_1 . '/' . $root_3[1];
+}
$check = !file_exists('core/config/connect.db.inc.php');
echo $check;
if (!file_exists('core/config/connect.db.inc.php')) {
@@ -10,7 +22,7 @@ if (!file_exists('core/config/connect.db.inc.php')) {
$request = $_SERVER['REQUEST_URI'];
$Api = substr($request, strrpos($request, 'v1/') + 3);
header("HTTP/1.1 301 Moved Permanently");
- header("Location:api/v1/api.php/$Api");
+ header("Location:$root/api/v1/api.php/$Api");
}
?>
\ No newline at end of file