libraries/ManiaLib/Utils/URI.php
protected static function getRequestURI()
    {
        if (isset($_SERVER['REQUEST_URI'])) {
            $uri = $_SERVER['REQUEST_URI'];
        } else {
            if (isset($_SERVER['argv'])) {
                $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['argv'][0];
            } elseif (isset($_SERVER['QUERY_STRING'])) {
                $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];
            } else {
                $uri = $_SERVER['SCRIPT_NAME'];
            }
        }
        // Prevent multiple slashes to avoid cross site requests
        $uri = '/' . ltrim($uri, '/');

        return $uri;
    }
protected static function getRequestURI()
    {
        if (isset($_SERVER['REQUEST_URI'])) {
            $uri = $_SERVER['REQUEST_URI'];
        } else {
            if (isset($_SERVER['argv'])) {
                $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['argv'][0];
            } elseif (isset($_SERVER['QUERY_STRING'])) {
                $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];
            } else {
                $uri = $_SERVER['SCRIPT_NAME'];
            }
        }
        // Prevent multiple slashes to avoid cross site requests
        $uri = '/' . ltrim($uri, '/');

        return $uri;
    }
Since $_SERVER['REQUEST_URI'] is only available on Apache, we
generate an equivalent using other environment variables.

@see http://code.google.com/p/oauth2-php
@author Originally written by Naitik Shah <naitik@facebook.com>.
@author Update to draft v10 by Edison Wong <hswong3i@pantarei-design.com>