<optiontype>textarea</optiontype>
</option>
+ <option name="url_legacy_mode">
+ <categoryname>general.page.seo</categoryname>
+ <optiontype>boolean</optiontype>
+ <defaultvalue>0</defaultvalue>
+ <enableoptions><![CDATA[url_omit_index_php]]></enableoptions>
+ </option>
<option name="url_omit_index_php">
<categoryname>general.page.seo</categoryname>
<optiontype>boolean</optiontype>
var SECURITY_TOKEN = '{@SECURITY_TOKEN}';
var LANGUAGE_ID = {@$__wcf->getLanguage()->languageID};
var TIME_NOW = {@TIME_NOW};
+ var URL_LEGACY_MODE = {if URL_LEGACY_MODE}true{else}false{/if};
//]]>
</script>
{if JQUERY_SOURCE == 'google'}
var SECURITY_TOKEN = '{@SECURITY_TOKEN}';
var LANGUAGE_ID = {@$__wcf->getLanguage()->languageID};
var TIME_NOW = {@TIME_NOW};
+ var URL_LEGACY_MODE = {if URL_LEGACY_MODE}true{else}false{/if};
//]]>
</script>
<script data-relocate="true" src="{@$__wcf->getPath()}js/3rdParty/jquery.min.js?v={@$__wcfVersion}"></script>
autoAbortPrevious: false
}, options);
+ if (!URL_LEGACY_MODE) {
+ this.options.url = this.options.url.replace(/^index\.php\/(.*?)\/\?/, '?$1/&');
+ }
+
this.confirmationDialog = null;
this.loading = null;
this._showLoadingOverlayOnce = false;
<?php
namespace wcf\system\request;
-use wcf\system\application\AbstractApplication;
use wcf\system\application\ApplicationHandler;
use wcf\system\exception\AJAXException;
use wcf\system\exception\IllegalLinkException;
// build URL, e.g. http://example.net/forum/
$url = FileUtil::addTrailingSlash(RouteHandler::getProtocol() . $applicationObject->domainName . RouteHandler::getPath());
- // add path info, e.g. index.php/Board/2/
- $pathInfo = RouteHandler::getPathInfo();
- if (!empty($pathInfo)) {
- $url .= 'index.php' . $pathInfo;
+ if (URL_LEGACY_MODE) {
+ // add path info, e.g. index.php/Board/2/
+ $pathInfo = RouteHandler::getPathInfo();
+ if (!empty($pathInfo)) {
+ $url .= 'index.php' . $pathInfo;
+ }
}
// query string, e.g. ?foo=bar
}
}
- if (!empty($link) && ($this->isACP() || !URL_OMIT_INDEX_PHP)) {
- $link = 'index.php/' . $link;
+ if (URL_LEGACY_MODE) {
+ if (!empty($link) && ($this->isACP() || !URL_OMIT_INDEX_PHP)) {
+ $link = 'index.php/' . $link;
+ }
+ }
+ else {
+ if (!empty($link)) {
+ $link = '?' . $link;
+ }
}
if (!empty($components)) {
- $link .= '?' . http_build_query($components, '', '&');
+ if (strpos($link, '?') === false) $link .= '?';
+ $link .= http_build_query($components, '', '&');
}
return $link;
* current path info component
* @var string
*/
- protected static $pathInfo = '';
+ protected static $pathInfo = null;
/**
* HTTP protocol, either 'http://' or 'https://'
* @return string
*/
public static function getPathInfo() {
- if (empty(self::$pathInfo)) {
- if (isset($_SERVER['PATH_INFO'])) {
- self::$pathInfo = $_SERVER['PATH_INFO'];
+ if (self::$pathInfo === null) {
+ self::$pathInfo = '';
+
+ // WCF 2.0: index.php/Foo/Bar/
+ if (URL_LEGACY_MODE) {
+ if (isset($_SERVER['PATH_INFO'])) {
+ self::$pathInfo = $_SERVER['PATH_INFO'];
+ }
+ else if (isset($_SERVER['ORIG_PATH_INFO'])) {
+ self::$pathInfo = $_SERVER['ORIG_PATH_INFO'];
+
+ // in some configurations ORIG_PATH_INFO contains the path to the file
+ // if the intended PATH_INFO component is empty
+ if (!empty(self::$pathInfo)) {
+ if (isset($_SERVER['SCRIPT_NAME']) && (self::$pathInfo == $_SERVER['SCRIPT_NAME'])) {
+ self::$pathInfo = '';
+ }
+
+ if (isset($_SERVER['PHP_SELF']) && (self::$pathInfo == $_SERVER['PHP_SELF'])) {
+ self::$pathInfo = '';
+ }
+
+ if (isset($_SERVER['SCRIPT_URL']) && (self::$pathInfo == $_SERVER['SCRIPT_URL'])) {
+ self::$pathInfo = '';
+ }
+ }
+ }
}
- else if (isset($_SERVER['ORIG_PATH_INFO'])) {
- self::$pathInfo = $_SERVER['ORIG_PATH_INFO'];
-
- // in some configurations ORIG_PATH_INFO contains the path to the file
- // if the intended PATH_INFO component is empty
- if (!empty(self::$pathInfo)) {
- if (isset($_SERVER['SCRIPT_NAME']) && (self::$pathInfo == $_SERVER['SCRIPT_NAME'])) {
- self::$pathInfo = '';
+ else {
+ // WCF 2.1: ?Foo/Bar/
+ if (!empty($_SERVER['QUERY_STRING'])) {
+ $pos = mb_strpos($_SERVER['QUERY_STRING'], '&');
+ $route = '';
+ if ($pos === false) {
+ $route = $_SERVER['QUERY_STRING'];
}
-
- if (isset($_SERVER['PHP_SELF']) && (self::$pathInfo == $_SERVER['PHP_SELF'])) {
- self::$pathInfo = '';
+ else {
+ $route = mb_substr($_SERVER['QUERY_STRING'], 0, $pos);
}
- if (isset($_SERVER['SCRIPT_URL']) && (self::$pathInfo == $_SERVER['SCRIPT_URL'])) {
- self::$pathInfo = '';
+ if (mb_strpos($route, '=') === false) {
+ self::$pathInfo = $route;
}
}
}
<item name="wcf.acp.option.module_cookie_policy_page.description"><![CDATA[Weist Besucher beim ersten Aufruf der Seite gemäß EU-Richtlinie 2009/136/EG auf den Einsatz von Cookies hin.]]></item>
<item name="wcf.acp.option.url_omit_index_php"><![CDATA[„index.php“ aus URLs entfernen]]></item>
<item name="wcf.acp.option.url_omit_index_php.description"><![CDATA[TODO]]></item>
+ <item name="wcf.acp.option.url_legacy_mode"><![CDATA[Kompatibilitätsmodus für Links aktivieren]]></item>
+ <item name="wcf.acp.option.url_legacy_mode.description"><![CDATA[Die Aktivierung dieses Modus erzwingt die URL-Struktur von WoltLab Community Framework 2.0 und sollte nur aus Kompatibilitätsgründen zur Beibehaltung der Link-Gültigkeit aktiviert werden:
+<ul class="nativeList">
+ <li>WCF 2.0: „index.php/Thread/123-Title/“</li>
+ <li>WCF 2.1+: „?Thread/123-Title/“</li>
+</ul>]]></item>
<item name="wcf.acp.option.module_ad"><![CDATA[Werbung]]></item>
<item name="wcf.acp.option.captcha_type"><![CDATA[Captcha-Art]]></item>
<item name="wcf.acp.option.register_use_captcha"><![CDATA[Captcha in Registrierung aktivieren]]></item>
<item name="wcf.acp.option.module_cookie_policy_page.description"><![CDATA[TODO: Weist Besucher beim ersten Aufruf der Seite gemäß EU-Richtlinie 2009/136/EG auf den Einsatz von Cookies hin.]]></item>
<item name="wcf.acp.option.url_omit_index_php"><![CDATA[TODO: „index.php“ aus URLs entfernen]]></item>
<item name="wcf.acp.option.url_omit_index_php.description"><![CDATA[TODO]]></item>
+ <item name="wcf.acp.option.url_legacy_mode"><![CDATA[Enable link compatibility mode]]></item>
+ <item name="wcf.acp.option.url_legacy_mode.description"><![CDATA[Enabling this option forces the system to use WoltLab Community Framework 2.0-compilant URLs and should only be used to ensure compatibility with legacy URLs:
+<ul class="nativeList">
+ <li>WCF 2.0: „index.php/Thread/123-Title/“</li>
+ <li>WCF 2.1+: „?Thread/123-Title/“</li>
+</ul>]]></item>
<item name="wcf.acp.option.module_ad"><![CDATA[Ads]]></item>
<item name="wcf.acp.option.captcha_type"><![CDATA[Captcha Type]]></item>
<item name="wcf.acp.option.register_use_captcha"><![CDATA[Enable Captcha protection during registration]]></item>