} return false; } System::$BeforeLaunchEventHandler = function ($path) { if ($path[0] == "images" || $path[0] == "StyleSheet.css" || $path[0] == "Script.js" || $path[0] == "account" && ($path[1] == "login.page" || $path[1] == "register.page")) { return true; } // ensure our tenant has not expired yet $tenant = Tenant::GetByURL(System::$TenantName); if ($tenant == null || $tenant->IsExpired()) { $page = new ErrorPage(); $page->Message = "The specified tenant does not exist. Please contact the site administrator to resolve this problem."; $page->Render(); return false; } if (!IsConfigured() && $path[0] != "setup") { System::Redirect("~/setup"); return false; } if (!IsValidUserOrGuest()) { System::Redirect("~/account/login.page"); return false; } if (!IsAuthenticated() && IsModuleAuthenticationRequired($path[0])) { System::Redirect("~/account/login.page"); return false; } return true; }; System::$Modules[] = new Module("net.phoenixsns.Default", array(new ModulePage("", function ($path) { if (IsAuthenticated()) { $tenant = Tenant::GetCurrent();
$username = $_SESSION["Authentication.UserName"]; $password = $_SESSION["Authentication.Password"]; $user = User::GetByCredentials($username, $password); if ($user == null) { return false; } $_SESSION["Authentication.UserID"] = $user->ID; return true; } System::$BeforeLaunchEventHandler = function ($path) { if (!IsConfigured() && !($path[0] == "setup")) { System::Redirect("~/setup"); return true; } if (!IsAdministrator() && !($path[0] == "account" && ($path[1] == "login.page" || $path[1] == "resetPassword.page")) && !($path[0] == "setup") && !($path[0] == "favicon.ico")) { $path1 = implode("/", $path); $_SESSION["LoginRedirectURL"] = "~/" . $path1; System::Redirect("~/account/login.page"); return true; } return true; }; require "Tasks.inc.php"; System::$Modules[] = new Module("net.phoenixsns.TenantManager.Default", array(new ModulePage("", function ($page, $path) { $page = new DashboardPage(); $page->Render(); return true; }), new ModulePage("system-log", function ($page, $path) { global $MySQL; $page = new WebPage(); $page->Title = "System Log";