Bladeren bron

fixed Router UrlAction

Piotr Labudda 8 jaren geleden
bovenliggende
commit
08063c6376
1 gewijzigde bestanden met toevoegingen van 9 en 6 verwijderingen
  1. 9 6
      SE/se-lib/Router.php

+ 9 - 6
SE/se-lib/Router.php

@@ -43,15 +43,18 @@ class Router {
 		if ('UrlAction' === substr($route, 0, strlen('UrlAction'))) { // Use project/{$activeProject}/tools/{$routeName}.php
 			$routeClassName = substr($route, strlen('UrlAction') + 1);
 			$activeProjectPath = Config::getProjectPath();
-			$toolPath = "{$activeProjectPath}/tools/{$routeClassName}.php";
-			if (file_exists($toolPath)) {
-				require_once $toolPath;
-				if (!class_exists($routeClassName)) throw new HttpException("Not found class", 404);
-				$_routeInstances[$route] = new $routeClassName();
-				return $_routeInstances[$route];
+			if ($activeProjectPath) {
+				$toolPath = "{$activeProjectPath}/tools/{$routeClassName}.php";
+				if (file_exists($toolPath)) {
+					require_once $toolPath;
+					if (!class_exists($routeClassName)) throw new HttpException("Not found class", 404);
+					$_routeInstances[$route] = new $routeClassName();
+					return $_routeInstances[$route];
+				}
 			}
 		}
 
+		$routeClassName = "Route_{$route}";
 		if (Lib::tryLoadClass($routeClassName)) {
 			$_routeInstances[$route] = new $routeClassName();
 			return $_routeInstances[$route];