Esempio n. 1
0
                    if ($page == "/") {
                        $page = "/index";
                    }
                    $GLOBALS['workspaceHTML'] = $class->inc("/src/Page{$page}.php");
                } else {
                    $GLOBALS['workspaceHTML'] = $page_response;
                }
                if ($GLOBALS['workspaceHTML'] === false || $GLOBALS['workspaceHTML'] == null) {
                    ob_start();
                    ser("Error", "The app '<strong>{$AppID}</strong>' does not have an Admin Page");
                    $error = ob_get_contents();
                    ob_end_clean();
                    $GLOBALS['workspaceHTML'] = "<div class='contents'>" . $error . "</div>";
                }
            }
        });
    }
    public static function statusRoutes()
    {
        /**
         * The default 404 page
         */
        self::$router->onHttpError(function ($code, $router) {
            if ($code == 404) {
                ser();
            }
        });
    }
}
\Lobby\Router::init();
Esempio n. 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 {
Esempio n. 3
0
<?php

require_once __DIR__ . "/load.php";
$GLOBALS['workspaceHTML'] = "";
/**
 * Dispatch the Routes
 */
\Lobby\Router::dispatch();
if (!isset($GLOBALS['route_active'])) {
    if ($GLOBALS['workspaceHTML'] != "" || is_array($GLOBALS['workspaceHTML'])) {
        require_once L_DIR . "/includes/lib/core/Inc/page.php";
    } else {
        ser();
    }
}
Esempio n. 4
0
<?php

/**
 *
 * index.php file for LobbyOS
 *
 * A localhost/Web OS For Web Apps: http://lobby.subinsb.com
 *
 * @category   lobby
 * @package    lobby
 * @author     The LobbyOS developer community
 * @license    Apache License
 * @version    0.2.1
 */
require_once __DIR__ . "/load.php";
use Lobby\Router;
/**
 * Dispatch the Routes
 */
Router::dispatch();
if (!Router::$routeActive) {
    if (\Response::hasContent()) {
        \Response::send();
    } else {
        if (Router::pathExists()) {
            return false;
        } else {
            \Response::showError();
        }
    }
}
Esempio n. 5
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";
     });
 }
Esempio n. 6
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);
             }
         }
     });
 }