summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-08-21 15:42:11 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-08-21 15:42:11 -0400
commitb2664e1ae2e2cf66585cdd8696d88efdd053eb3b (patch)
tree3e406bc5502c0937f2cf81e0b4a6a1b714a1b403 /index.php
parentc78772b2748f70acc8158b665218fe53b277a031 (diff)
parent9f07921b45190b462e1a798622068e24ef31e124 (diff)
Merge branch '0.8.x' into 0.9.x
Conflicts: actions/updateprofile.php actions/userauthorization.php classes/User_group.php index.php install.php lib/accountsettingsaction.php lib/logingroupnav.php
Diffstat (limited to 'index.php')
-rw-r--r--index.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/index.php b/index.php
index 372a8536e..d8434a6cf 100644
--- a/index.php
+++ b/index.php
@@ -73,7 +73,7 @@ function handleError($error)
exit(-1);
}
-function checkMirror($action_obj)
+function checkMirror($action_obj, $args)
{
global $config;
@@ -121,6 +121,25 @@ function isLoginAction($action)
function main()
{
+ // fake HTTP redirects using lighttpd's 404 redirects
+ if (strpos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') !== false) {
+ $_lighty_url = $base_url.$_SERVER['REQUEST_URI'];
+ $_lighty_url = @parse_url($_lighty_url);
+
+ if ($_lighty_url['path'] != '/index.php' && $_lighty_url['path'] != '/') {
+ $_lighty_path = preg_replace('/^'.preg_quote(common_config('site','path')).'\//', '', substr($_lighty_url['path'], 1));
+ $_SERVER['QUERY_STRING'] = 'p='.$_lighty_path;
+ if ($_lighty_url['query'])
+ $_SERVER['QUERY_STRING'] .= '&'.$_lighty_url['query'];
+ parse_str($_lighty_url['query'], $_lighty_query);
+ foreach ($_lighty_query as $key => $val) {
+ $_GET[$key] = $_REQUEST[$key] = $val;
+ }
+ $_GET['p'] = $_REQUEST['p'] = $_lighty_path;
+ }
+ }
+ $_SERVER['REDIRECT_URL'] = preg_replace("/\?.+$/", "", $_SERVER['REQUEST_URI']);
+
// quick check for fancy URL auto-detection support in installer.
if (isset($_SERVER['REDIRECT_URL']) && (preg_replace("/^\/$/","",(dirname($_SERVER['REQUEST_URI']))) . '/check-fancy') === $_SERVER['REDIRECT_URL']) {
die("Fancy URL support detection succeeded. We suggest you enable this to get fancy (pretty) URLs.");
@@ -192,7 +211,7 @@ function main()
} else {
$action_obj = new $action_class();
- checkMirror($action_obj);
+ checkMirror($action_obj, $args);
try {
if ($action_obj->prepare($args)) {