diff options
-rw-r--r-- | app/Core/Base.php | 10 | ||||
-rw-r--r-- | app/Core/Plugin/Loader.php | 3 | ||||
-rw-r--r-- | app/Core/Router.php | 6 | ||||
-rw-r--r-- | index.php | 6 |
4 files changed, 19 insertions, 6 deletions
diff --git a/app/Core/Base.php b/app/Core/Base.php index c542cd47..74f29508 100644 --- a/app/Core/Base.php +++ b/app/Core/Base.php @@ -49,10 +49,6 @@ use Pimple\Container; * @property \Kanboard\Model\File $file * @property \Kanboard\Model\LastLogin $lastLogin * @property \Kanboard\Model\Link $link - * @property \Kanboard\Model\UserNotification $userNotification - * @property \Kanboard\Model\UserNotificationType $userNotificationType - * @property \Kanboard\Model\UserNotificationFilter $userNotificationFilter - * @property \Kanboard\Model\UserUnreadNotification $userUnreadNotification * @property \Kanboard\Model\OverdueNotification $overdueNotification * @property \Kanboard\Model\Project $project * @property \Kanboard\Model\ProjectActivity $projectActivity @@ -71,6 +67,7 @@ use Pimple\Container; * @property \Kanboard\Model\TaskCreation $taskCreation * @property \Kanboard\Model\TaskDuplication $taskDuplication * @property \Kanboard\Model\TaskExport $taskExport + * @property \Kanboard\Model\TaskImport $taskImport * @property \Kanboard\Model\TaskFinder $taskFinder * @property \Kanboard\Model\TaskFilter $taskFilter * @property \Kanboard\Model\TaskLink $taskLink @@ -81,6 +78,11 @@ use Pimple\Container; * @property \Kanboard\Model\TaskValidator $taskValidator * @property \Kanboard\Model\Transition $transition * @property \Kanboard\Model\User $user + * @property \Kanboard\Model\UserImport $userImport + * @property \Kanboard\Model\UserNotification $userNotification + * @property \Kanboard\Model\UserNotificationType $userNotificationType + * @property \Kanboard\Model\UserNotificationFilter $userNotificationFilter + * @property \Kanboard\Model\UserUnreadNotification $userUnreadNotification * @property \Kanboard\Model\UserSession $userSession * @property \Kanboard\Model\Webhook $webhook * @property \Psr\Log\LoggerInterface $logger diff --git a/app/Core/Plugin/Loader.php b/app/Core/Plugin/Loader.php index e68ba8e6..4769e5cb 100644 --- a/app/Core/Plugin/Loader.php +++ b/app/Core/Plugin/Loader.php @@ -4,6 +4,7 @@ namespace Kanboard\Core\Plugin; use DirectoryIterator; use PDOException; +use RuntimeException; use Kanboard\Core\Tool; /** @@ -111,7 +112,7 @@ class Loader extends \Kanboard\Core\Base } catch (PDOException $e) { $this->db->cancelTransaction(); $this->db->getDriver()->enableForeignKeys(); - die('Unable to migrate schema for the plugin: '.$plugin.' => '.$e->getMessage()); + throw new RuntimeException('Unable to migrate schema for the plugin: '.$plugin.' => '.$e->getMessage()); } } diff --git a/app/Core/Router.php b/app/Core/Router.php index f4453c71..843f5139 100644 --- a/app/Core/Router.php +++ b/app/Core/Router.php @@ -2,6 +2,8 @@ namespace Kanboard\Core; +use RuntimeException; + /** * Router class * @@ -216,6 +218,10 @@ class Router extends Base $class = '\Kanboard\\'; $class .= empty($plugin) ? 'Controller\\'.ucfirst($this->controller) : 'Plugin\\'.ucfirst($plugin).'\Controller\\'.ucfirst($this->controller); + if (! class_exists($class) || ! method_exists($class, $this->action)) { + throw new RuntimeException('Controller or method not found for the given url!'); + } + $instance = new $class($this->container); $instance->beforeAction($this->controller, $this->action); $instance->{$this->action}(); @@ -2,4 +2,8 @@ require __DIR__.'/app/common.php'; -$container['router']->dispatch($_SERVER['REQUEST_URI'], isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''); +try { + $container['router']->dispatch($_SERVER['REQUEST_URI'], isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''); +} catch (Exception $e) { + echo 'Internal Error: '.$e->getMessage(); +} |