Subversion Repositories oidplus

Rev

Rev 1246 | Rev 1261 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1246 Rev 1247
Line 2131... Line 2131...
2131
 
2131
 
2132
                return $res;
2132
                return $res;
2133
        }
2133
        }
2134
 
2134
 
2135
        /**
2135
        /**
-
 
2136
         * @param string|null $goto
2136
         * @return false|string
2137
         * @return false|string
2137
         * @throws OIDplusException
2138
         * @throws OIDplusException
2138
         */
2139
         */
2139
        public static function canonicalURL() {
2140
        public static function canonicalURL(string $goto=null) {
2140
                // First part: OIDplus system URL (or canonical system URL)
2141
                // First part: OIDplus system URL (or canonical system URL)
2141
                $sysurl = OIDplus::getSystemUrl(self::PATH_ABSOLUTE_CANONICAL);
2142
                $sysurl = OIDplus::getSystemUrl(self::PATH_ABSOLUTE_CANONICAL);
2142
 
2143
 
2143
                // Second part: Directory
2144
                // Second part: Directory
2144
                $basedir = realpath(__DIR__.'/../../');
2145
                $basedir = realpath(__DIR__.'/../../');
Line 2151... Line 2152...
2151
                // Third part: File name
2152
                // Third part: File name
2152
                $tmp = explode('/',$_SERVER['SCRIPT_NAME']);
2153
                $tmp = explode('/',$_SERVER['SCRIPT_NAME']);
2153
                $tmp = end($tmp);
2154
                $tmp = end($tmp);
2154
 
2155
 
2155
                // Fourth part: Query string (ordered)
2156
                // Fourth part: Query string (ordered)
-
 
2157
                $url = [];
-
 
2158
                parse_str($_SERVER['QUERY_STRING'], $url);
-
 
2159
                if ($goto !== null) $url['goto'] = $goto;
-
 
2160
                ksort($url);
2156
                $tmp2 = getSortedQuery();
2161
                $tmp2 = http_build_query($url);
2157
                if ($tmp2 != '') $tmp2 = '?'.$tmp2;
2162
                if ($tmp2 != '') $tmp2 = '?'.$tmp2;
2158
 
2163
 
2159
                return $sysurl.$res.$tmp.$tmp2;
2164
                return $sysurl.$res.$tmp.$tmp2;
2160
        }
2165
        }
2161
 
2166