public static function __constructStatic() { if (!isset($_COOKIE['csrfToken'])) { self::$token = Helper::randStr(10); setcookie("csrfToken", self::$token, 0, "/", Lobby::getHostname()); } else { self::$token = $_COOKIE['csrfToken']; } }
public function page($p) { /** * Clean up Assets */ \Assets::removeCSS(array("theme.hine-/src/dashboard/css/scrollbar.css", "theme.hine-/src/dashboard/css/jquery.contextmenu.css", "theme.hine-/src/dashboard/css/dashboard.css", "theme.hine-/src/main/lib/jquery-ui/jquery-ui.css")); \Assets::js("jqueryui", ""); \Assets::removeJS(array("theme.hine-/src/dashboard/js/scrollbar.js", "theme.hine-/src/dashboard/js/jquery.contextmenu.js", "theme.hine-/src/dashboard/js/dashboard.js", "app")); /** * Mobile */ Hooks::addAction("head.end", function () { echo '<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" async="async" defer="defer">'; echo '<meta name="viewport" content="width=device-width, initial-scale=1">'; if (\Lobby::getHostname() != "server.lo" . "bby.sim") { echo '<script>if (window.location.protocol != "https:") window.location.href = "https:" + window.location.href.substring(window.location.protocol.length);</script>'; } }); /** * */ Hooks::addAction("panel.end", function () { echo '<a href="#" data-activates="lobby-nav" id="lobby-nav-btn"><i class="material-icons">menu</i></a>'; echo '<ul class="side-nav" id="lobby-nav"> <li><a href="/">Lobby</a></li> <li><a href="/apps">Apps</a></li> <li><a href="/download">Download</a></li> <li><a href="/web-readme">Demo</a></li> <li><a href="/docs">Documentation</a></li> </ul>'; echo '<script>lobby.load(function(){$("#lobby-nav-btn").sideNav({menuWidth: 200});});</script>'; }); /** * Add notifications */ \Lobby\UI\Panel::addNotifyItem("lobby-0-6-released", array("contents" => "Lobby " . $this->lobby_version . " Released", "href" => $this->lobby_annoucement, "icon" => "update")); \Lobby\UI\Panel::addNotifyItem("z-new-game", array("contents" => "New Site Compressor!", "href" => "https://lobby.subinsb.com/apps/site-compressor", "icon" => "new")); $path = explode("/", $p); if ($path[1] === "docs") { $doc = isset($path[2]) ? str_replace("/", ".", substr_replace($p, "", 0, 6)) : "index"; $this->menu_items(); \Assets::removeJS("theme.hine-/src/main/js/init.js"); return $this->inc("/src/page/docs.php", array("doc" => $doc)); } elseif ($path[1] === "mods") { $mod = isset($path[2]) ? str_replace("/", ".", substr_replace($p, "", 0, 6)) : "index"; $this->menu_items(); \Assets::removeJS("theme.hine-/src/main/js/init.js"); return $this->inc("/src/page/mods.php", array("doc" => $mod)); } else { if ($path[1] == "api") { $node = isset($path[2]) ? $path[2] : "index"; return $this->inc("/src/page/api.php", array("node" => $node, "path" => $path)); } else { if ($path[1] == "me") { $this->menu_items(); $node = isset($path[2]) ? $path[2] : "index"; return $this->inc("/src/page/me.php", array("node" => $node, "path" => $path)); } else { if ($path[1] == "apps") { $this->menu_items(); $node = isset($path[2]) ? $path[2] : "index"; return $this->inc("/src/page/apps.php", array("node" => $node)); } else { if ($path[1] == "u") { $this->menu_items(); $node = isset($path[2]) ? $path[2] : "index"; return $this->inc("/src/page/u.php", array("user" => $node)); } else { $this->menu_items(); return "auto"; } } } } } }