diff options
Diffstat (limited to '')
| -rw-r--r-- | app/controller/root.control.php | 43 | 
1 files changed, 26 insertions, 17 deletions
diff --git a/app/controller/root.control.php b/app/controller/root.control.php index 06abf27..2c60faf 100644 --- a/app/controller/root.control.php +++ b/app/controller/root.control.php @@ -2,6 +2,7 @@  require_once "class/controller.class.php";  require_once "controller/sysconf.control.php"; +require_once "controller/except.control.php";  require_once "controller/auth.control.php";  /* @@ -15,32 +16,40 @@ class Root extends Controller       */      function handle($argv)      { -        /* TODO -- Catch app exceptions here and display a special view to communicate them to user */          /* TODO -- Authentication (login / logout / register) MVC */          $argv = $this->normalizeArgv($argv); -        /* First, make sure the system configuration file has been included */ -        if (!$this->scrottConfExists()) +        try          { -            $ctrl = new Sysconf(); -            $ctrl->handle($argv); -        } +            /* First, make sure the system configuration file has been included */ +            if (!$this->scrottConfExists()) +            { +                $ctrl = new Sysconf(); +                $ctrl->handle($argv); +            } -        /* TODO */ -        /* TODO -- only auth if logged out */ -        else if (!$this->getCurrentUser()) -        { -            $ctrl = new Auth(); -            $ctrl->handle($argv); +            /* TODO */ +            /* TODO -- only auth if logged out */ +            else if (!$this->getCurrentUser()) +            { +                $ctrl = new Auth(); +                $ctrl->handle($argv); +            } + +            else +            { +                echo "logged in as:!"; +                echo "<pre>"; +                var_dump($this->getCurrentUser()); +                echo "</pre>"; +            }          } -        else +        catch (Exception $e)          { -            echo "logged in as:!"; -            echo "<pre>"; -            var_dump($this->getCurrentUser()); -            echo "</pre>"; +            $ctrl = new Except(); +            $ctrl->handle($e->getMessage());          }      }  | 
