Example #1
0
 /**
  * Add routes
  */
 public function routes()
 {
     /**
      * Add the Login Page in /admin/login route
      */
     \Lobby\Router::route("/admin/login", function () {
         if (LS::userExists("admin") === false) {
             LS::register("admin", "admin", array("name" => "Admin", "created" => date("Y-m-d H:i:s")));
         }
         include __DIR__ . "/page/login.php";
     });
 }
Example #2
0
require_once __DIR__ . "/config.php";
/**
 * Add the Login Page in /admin/login route
 */
\Lobby\Router::route("/admin/login", function () {
    if (\Fr\LS::userExists("admin") === false) {
        \Fr\LS::register("admin", "admin", array("name" => "Admin", "created" => date("Y-m-d H:i:s")));
    }
    include __DIR__ . "/page/login.php";
});
/**
 * Add the Change Password Page in /admin/ChangePassword route
 */
\Lobby\Router::route("/admin/ChangePassword", function () {
    include __DIR__ . "/page/change_password.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 {
Example #3
0
 public function appAdminSetup()
 {
     Router::route("/admin/app/[:appID]?/[**:page]?", function ($request) {
         $appID = $request->appID;
         $page = $request->page === null ? "/" : "/{$request->page}";
         $App = new \Lobby\Apps($appID);
         if (!$App->exists) {
             ser();
             return null;
         }
         Hooks::addFilter("admin.view.sidebar", function ($links) use($appID, $App) {
             $links["/admin/app/{$appID}"] = $App->info["name"];
             return $links;
         });
         Hooks::addFilter("app.manifest", function ($info) {
             $info["adminURL"] = L_URL . "/admin/app/" . $info["id"];
             return $info;
         });
         $class = $App->getInstance();
         /**
          * Set the title
          */
         Response::setTitle($App->info["name"]);
         $pageResponse = $class->page($page);
         if ($pageResponse === "auto") {
             if ($page === "/") {
                 $page = "/index";
             }
             $html = $class->inc("/src/page/admin{$page}.php");
             if ($html) {
                 Response::setPage($html);
             } else {
                 ser();
             }
         } else {
             if ($pageResponse === null) {
                 ob_start();
                 echo ser("Error", "The app '<strong>{$AppID}</strong>' does not have an Admin Page. <a clear href='" . \Lobby::u("/app/{$AppID}") . "' class='btn green'>Go To App</a>");
                 $error = ob_get_contents();
                 ob_end_clean();
                 Response::setPage($error);
             } else {
                 Response::setPage($pageResponse);
             }
         }
     });
 }