use wcf\data\page\Page;
use wcf\system\exception\IllegalLinkException;
use wcf\system\request\LinkHandler;
+use wcf\system\request\RequestHandler;
use wcf\system\WCF;
/**
public function readParameters() {
parent::readParameters();
- if (isset($_GET['languageID'])) $this->languageID = intval($_GET['languageID']);
- if (isset($_GET['pageID'])) $this->pageID = intval($_GET['pageID']);
+ $metaData = RequestHandler::getInstance()->getActiveRequest()->getMetaData();
+ if (isset($metaData['cms'], $metaData['cms']['pageID'])) {
+ $this->pageID = $metaData['cms']['pageID'];
+
+ if (isset($metaData['cms']['languageID'])) $this->languageID = $metaData['cms']['languageID'];
+ }
if ($this->pageID) {
$this->page = new Page($this->pageID);
'className' => CmsPage::class,
'controller' => 'cms',
'pageType' => 'page',
- 'languageID' => $matches['languageID'],
- 'pageID' => $matches['pageID']
+
+ // CMS page meta data
+ 'cmsPageID' => $matches['pageID'],
+ 'cmsPageLanguageID' => $matches['languageID']
];
}
else {
*/
protected $className = '';
+ /**
+ * request meta data
+ * @var string[]
+ */
+ protected $metaData;
+
/**
* page name
* @var string
* request object
* @var object
*/
- protected $requestObject = null;
+ protected $requestObject;
/**
* Creates a new request object.
*
- * @param string $className
- * @param string $pageName
- * @param string $pageType
+ * @param string $className fully qualified name
+ * @param string $pageName class name
+ * @param string $pageType can be 'action', 'form' or 'page'
+ * @param string[] $metaData additional meta data
*/
- public function __construct($className, $pageName, $pageType) {
+ public function __construct($className, $pageName, $pageType, array $metaData) {
$this->className = $className;
+ $this->metaData = $metaData;
$this->pageName = $pageName;
$this->pageType = $pageType;
}
return $this->className;
}
+ /**
+ * Returns request meta data.
+ *
+ * @return string[]
+ */
+ public function getMetaData() {
+ return $this->metaData;
+ }
+
/**
* Returns the page name of this request.
*
}
}
- $this->activeRequest = new Request($classData['className'], $classData['controller'], $classData['pageType']);
+ // handle CMS page meta data
+ $metaData = [];
+ if (isset($routeData['cmsPageID'])) {
+ $metaData['cms'] = [
+ 'pageID' => $routeData['cmsPageID'],
+ 'languageID' => $routeData['cmsPageLanguageID']
+ ];
+
+ unset($routeData['cmsPageID']);
+ unset($routeData['cmsPageLanguageID']);
+ }
+
+ $this->activeRequest = new Request($classData['className'], $classData['controller'], $classData['pageType'], $metaData);
}
catch (SystemException $e) {
- die("<pre>".$e->getMessage());
throw new IllegalLinkException();
}
}
/**
* Redirects to the actual URL, e.g. controller has been aliased or mistyped (boardlist instead of board-list).
*
- * @param array<string> $routeData
- * @param string $application
- * @param string $controller
+ * @param string[] $routeData
+ * @param string $application
+ * @param string $controller
*/
protected function redirect(array $routeData, $application, $controller = null) {
$routeData['application'] = $application;