use wcf\page\CmsPage;
use wcf\system\cache\builder\RoutingCacheBuilder;
use wcf\system\exception\SystemException;
+use wcf\system\language\LanguageFactory;
use wcf\system\SingletonFactory;
use wcf\system\WCF;
use wcf\system\WCFACP;
// lookup custom urls first
if (isset($this->customUrls['lookup'][$application], $this->customUrls['lookup'][$application][$controller])) {
$controller = $this->customUrls['lookup'][$application][$controller];
+ if (preg_match('~^(?P<controller>__WCF_CMS__\d+)(?:-(?P<languageID>\d+))?$~', $controller, $matches)) {
+ if ($matches['languageID'] && $matches['languageID'] != LanguageFactory::getInstance()->getDefaultLanguageID()) {
+ return false;
+ }
+ else {
+ $controller = $matches['controller'];
+ }
+ }
+
if (strpos($controller, '__WCF_CMS__') !== false) {
// remove language id component
$controller = preg_replace('~\-\d+$~', '', $controller);
// force a redirect
HeaderUtil::redirect($data['redirect'], true, false);
}
- else if ($data['application'] !== $application) {
+ else if (!empty($data['application']) && $data['application'] !== $application) {
HeaderUtil::redirect(
LinkHandler::getInstance()->getLink(
ControllerMap::getInstance()->resolve($data['application'], $data['controller'], false)['controller'],