use wcf\data\user\group\UserGroup;
use wcf\data\user\UserList;
use wcf\system\cache\CacheHandler;
+use wcf\system\request\IRouteController;
use wcf\system\user\storage\UserStorageHandler;
use wcf\system\WCF;
use wcf\util\StringUtil;
* @subpackage data.user
* @category Community Framework
*/
-final class User extends DatabaseObject {
+final class User extends DatabaseObject implements IRouteController {
/**
* @see wcf\data\DatabaseObject::$databaseTableName
*/
public static function getDatabaseTableAlias() {
return 'user_table';
}
+
+ /**
+ * @see wcf\system\request\IRouteController::getID()
+ */
+ public function getID() {
+ return $this->userID;
+ }
+
+ /**
+ * @see wcf\system\request\IRouteController::getTitle()
+ */
+ public function getTitle() {
+ return $this->username;
+ }
}
// build route
if ($controller !== null) {
// handle object
- if (isset($parameters['object']) && $parameters['object'] instanceof \wcf\system\request\IRouteController) {
- $parameters['id'] = $parameters['object']->getID();
+ if (isset($parameters['object'])) {
+ if (!($parameters['object'] instanceof \wcf\system\request\IRouteController) && $parameters['object'] instanceof \wcf\data\DatabaseObjectDecorator && $parameters['object']->getDecoratedObject() instanceof \wcf\system\request\IRouteController) {
+ $parameters['object'] = $parameters['object']->getDecoratedObject();
+ }
- // remove illegal characters
- $parameters['title'] = preg_replace('/[\x0-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/', '-', $parameters['object']->getTitle());
+ if ($parameters['object'] instanceof \wcf\system\request\IRouteController) {
+ $parameters['id'] = $parameters['object']->getID();
+ $parameters['title'] = $parameters['object']->getTitle();
+ }
unset($parameters['object']);
}
+ if (isset($parameters['title'])) {
+ // remove illegal characters
+ $parameters['title'] = trim(preg_replace('/[\x0-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/', '-', $parameters['title']), '-');
+ }
+
$parameters['controller'] = $controller;
$routeURL = RouteHandler::getInstance()->buildRoute($parameters);
if (!$isRaw && !empty($url)) {