public function init() { if (\Lobby::status("lobby.assets-serve") === false) { $this->install(); $this->routes(); require_once $this->app->dir . "/src/inc/load.php"; if (LS::$loggedIn) { /** * Logged In */ Hooks::addAction("init", function () { /** * Add Change Password Item in Top Panel -> Admin before Log Out item * This is done by first removing the Log Out item, adding the Change * Password item and then adding back the Log Out item */ \Lobby\UI\Panel::addTopItem('adminModule', array("text" => "<img src='" . $this->app->srcURL . "/src/image/logo.svg' style='width: 40px;height: 40px;' />", "href" => "/", "position" => "left", "subItems" => array("changePassword" => array("text" => "Change Password", "href" => "/app/admin/change-password"), 'LogOut' => array("text" => "Log Out", "href" => "/app/admin/logout")))); }); } else { /** * If `indi` module is active, make the index page available to everyone */ if (!Modules::exists("app_indi")) { if (\Lobby::curPage() != "/admin/login" && !\Lobby::status("lobby.install")) { \Response::redirect("/admin/login"); } } else { Panel::removeTopItem("indiModule", "left"); if (\Lobby::curPage() != "/admin/login" && \Lobby::curPage() != "/admin/install.php" && substr(\Lobby::curPage(), 0, 6) == "/admin") { \Response::redirect("/admin/login"); } } Hooks::addFilter("panel.left.items", function ($left) { unset($left["lobbyAdmin"]); if (Modules::exists("app_indi")) { unset($left["indiModule"]); } return $left; }); Assets::removeJS("notify"); Assets::removeCSS("notify"); } } }
<?php $this->addStyle("admin.css"); $this->addStyle("jquery.fancybox.css"); $this->addScript("jquery.fancybox.js"); $this->addScript("chart.min.js"); $this->addScript("admin.js"); ?> <div class='leftpane'> <center> <h3>logSys<br/><span style='font-size: 12px;'><?php echo $this->manifest['version']; ?> <a style='display: block;' href='http://subinsb.com/php-logsys?utm_source=lobby_logsys.admin' target='_blank'>Documentation</a></span></h3> </center> <div> <?php $links = array("/admin" => "Home", "/admin/users" => "Users", "/admin/tokens" => "Tokens", "/admin/stats" => "Stats", "/admin/config" => "Settings"); foreach ($links as $link => $name) { echo $this->l($link, $name, \Lobby::curPage() == "/app/fr-logsys{$link}" ? "class='active'" : ""); } ?> </div> </div> <div class='rightpane'>
<div class="sidebar"> <div style="height:32px;text-align:center;margin-top:10px;"> <a target="_blank" href="http://lobby.subinsb.com" style="color:white;">Lobby <?php echo getOption("lobby_version"); ?> </a> </div> <?php $links = array("/admin" => "Dashboard", "/admin/apps.php" => "Apps", "/admin/lobby-store.php" => "Lobby Store", "/admin/modules.php" => "Modules", "/admin/about.php" => "About"); $curPage = \Lobby::curPage(); foreach ($links as $link => $text) { if ($link == $curPage || $curPage == "/admin/update.php" && $text == "About") { echo \Lobby::l($link, $text, "class='link active'"); } else { echo \Lobby::l($link, $text, "class='link'"); } } ?> </div>
<?php if (\Lobby::curPage() != "/includes/serve.php") { require_once __DIR__ . "/install.php"; require_once __DIR__ . "/module.php"; }
}); if (\Fr\LS::$loggedIn) { /** * Logged In */ \Lobby::hook("init", function () { /** * Add Change Password Item in Top Panel -> Admin before Log Out item * This is done by first removing the Log Out item, adding the Change * Password item and then adding back the Log Out item */ \Lobby\Panel::$top_items['left']['lobbyAdmin']['subItems']['ChangePassword'] = array("text" => "Change Password", "href" => "/admin/ChangePassword"); \Lobby\Panel::$top_items['left']['lobbyAdmin']['subItems']['LogOut'] = array("text" => "Log Out", "href" => "/admin/login?logout"); }); } else { /** * Not logged in */ if (\Lobby\Modules::exists("indi") === false) { if (\Lobby::curPage() != "/admin/login" && !\Lobby::status("lobby.install")) { \Lobby::redirect("/admin/login"); } } else { if (\Lobby::curPage() != "/admin/login" && \Lobby::curPage() != "/admin/install.php" && substr(\Lobby::curPage(), 0, 6) == "/admin") { \Lobby::redirect("/admin/login"); } } \Lobby::hook("init", function () { unset(\Lobby\Panel::$top_items['left']['lobbyAdmin']); }); }
/** * Get status */ public static function status($val) { $status = ""; if (self::$status != null) { $status = self::$status; } else { self::$statuses[] = function ($path) { if ($path == "/admin/install.php") { $status = "lobby.install"; } elseif (substr($path, 0, 6) == "/admin") { $status = "lobby.admin"; } elseif ($path == "/includes/serve.php") { $status = "lobby.serve"; } return isset($status) ? $status : false; }; foreach (self::$statuses as $func) { $return = $func(\Lobby::curPage()); if ($return != false) { $status = $return; } } self::$status = $status; } return $status == $val; }
} } if (isset($GLOBALS['initError'])) { echo "<html><head>"; \Lobby::$js = array(); \Lobby::head(); echo "</head><body><div class='workspace'><div class='contents'>"; ser($GLOBALS['initError'][0], $GLOBALS['initError'][1]); echo "</div></div></body></html>"; exit; } \Lobby::curPage(true); /** * Add the <head> files if it's not the install page */ if (\Lobby::curPage() != "/admin/install.php") { /** * Styles */ \Lobby::addStyle("jqueryui", "/includes/lib/jquery/jquery-ui.css"); // jQuery UI /** * Scripts */ \Lobby::addScript("jquery", "/includes/lib/jquery/jquery.js"); \Lobby::addScript("jqueryui", "/includes/lib/jquery/jquery-ui.js"); // jQuery UI \Lobby::addScript("main", "/includes/lib/core/JS/main.js"); /** * Left Menu */