Dashboard"); require "view/dashboard.php"; return; } switch ($argv[0]) { case "logout": /* logout user */ user::setCurrent(); location("/"); break; case "admin": /* check permissions */ if ($user->admin == 0) location("/"); setPageName("Administration"); require "view/administration.php"; break; case "deleteaccount": setPageName("Leaving Scrott"); require "view/deleteaccount.php"; break; case "groups": setPageName("Groups"); require "view/groups.php"; break; case "pads": setPageName("Pads"); require "view/pads.php"; break; default: /* view object */ if (table::isGUID($argv[0])) { /* check permissions */ if (!$user->canAccess(new obj($argv[0]))) { /* TODO - use notice modal instead of an exception */ throw new Exception("You do not have access permission for the requested object"); } /* setup page */ switch (obj::typeOf($argv[0])) { case "group": $obj = new group($argv[0]); setPageObj($obj); setPageName($obj->name); require "view/group.php"; break; case "pad": $obj = new pad($argv[0]); setPageObj($obj); setPageName($obj->name); if (isset($argv[1]) && $argv[1] == "closed") require "view/pad_closed.php"; else require "view/pad.php"; break; } } /* page not found */ else { header("HTTP/1.1 404 Not Found"); require "view/404.php"; } } } catch (Exception $e) { require "view/except.php"; } } $tokens = explode("/", $_SERVER['PATH_INFO']); main(array_values(array_filter($tokens))); ?>