aboutsummaryrefslogtreecommitdiffstats
path: root/web/redirect.php
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2013-04-29 11:05:09 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-03-12 17:28:59 -0600
commitd33715066aab8bace17bb575a1787af40f86e67a (patch)
tree2b315dbdd7839a93b344a68cc1e4c23e4902ccb8 /web/redirect.php
parentAdd semi-colon. (diff)
downloadPhotoFloat-d33715066aab8bace17bb575a1787af40f86e67a.tar.xz
PhotoFloat-d33715066aab8bace17bb575a1787af40f86e67a.zip
Restructuring
Import flask app as well as new makefile and entirely new directory structure.
Diffstat (limited to 'web/redirect.php')
-rw-r--r--web/redirect.php38
1 files changed, 0 insertions, 38 deletions
diff --git a/web/redirect.php b/web/redirect.php
deleted file mode 100644
index 2a27cb2..0000000
--- a/web/redirect.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-function cachePath($path) {
- if ($path[0] == '/')
- $path = substr($path, 1);
- if ($path[strlen($path) - 1] == '/')
- $path = substr($path, 0, strlen($path) - 1);
- $path = str_replace('_-_', '-', str_replace('/', '-', str_replace(' ', '_', str_replace('(', '', str_replace(')', '', str_replace('#', '', str_replace('[', '', str_replace(']', '', str_replace('&', '', str_replace(',', '', str_replace('"', '', str_replace("'", '', strtolower($path)))))))))))));
- while (strpos($path, "--") !== false)
- $path = str_replace("--", "-", $path);
- while (strpos($path, "__") !== false)
- $path = str_replace("__", "_", $path);
- if (strlen(path) == 0)
- $path = "root";
-
- return $path;
-}
-
-$url = str_replace("\b", "", str_replace("\r", "", str_replace("\n", "", $_SERVER["SCRIPT_URL"])));
-if ($url[strlen($url) - 1] == '/')
- $url = substr($url, 0, strlen($url) - 1);
-
-if (strpos(strtolower($url), ".php") == strlen($url) - 4) {
- $url = substr($url, 0, strlen($url) - 4);
- $index = strrpos($url, "/");
- $redirect = "/#!/".cachePath(substr($url, 0, $index))."/".cachePath(substr($url, $index));
-} else if (strpos(strtolower($url), ".jpg") == strlen($url) - 4) {
- $index = strrpos($url, "/");
- $redirect = "/#!/".cachePath(substr($url, 0, $index))."/".cachePath(substr($url, $index));
-} else if (strpos($url, "/cache/") === 0 || strpos($url, "/albums/") === 0 || strpos($url, "/img/") === 0 || strpos($url, "/img/") === 0 || strpos($url, "/js/") === 0 || strpos($url, "/css/") === 0) {
- header("HTTP/1.1 404 Not Found");
- exit();
-} else
- $redirect = "/#!/".cachePath($url);
-
-header("HTTP/1.1 301 Moved Permanently");
-header("Location: $redirect");
-
-?>