Beispiel #1
0
 /**
  * Update The Lobby Core (Software)
  */
 public static function software()
 {
     if (\Lobby\Modules::exists("admin")) {
         $admin_previously_installed = true;
     }
     $oldVer = self::$version;
     $latest_version = DB::getOption("lobby_latest_version");
     $url = Server::download("lobby", $latest_version);
     $zipFile = L_DIR . "/contents/update/" . $latest_version . ".zip";
     self::zipFile($url, $zipFile);
     // Make the Zip Object
     $zip = new \ZipArchive();
     if ($zip->open($zipFile) != "true") {
         self::log("Unable to open downloaded Zip File.");
         echo ser("Error", "Unable to open Zip File.  <a href='update.php'>Try again</a>");
     }
     self::log("Upgrading Lobby Software From {$zipFile}");
     /**
      * Extract New Version
      */
     $zip->extractTo(L_DIR);
     $zip->close();
     FS::remove($zipFile);
     self::finish_software_update(isset($admin_previously_installed));
     return L_URL . "/admin/settings.php?updated=1&oldver={$oldVer}" . \CSRF::getParam();
 }
Beispiel #2
0
 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");
         }
     }
 }
Beispiel #3
0
        } else {
            //$path = substr_replace($path, "$drive/", 0, 1);
            $path = str_replace('/', '\\', $path);
        }
    } else {
        if ($path == "/" || $path == "") {
            $path = "/";
        } else {
            $path = str_replace('\\', '/', $path);
        }
    }
    return $path;
}
// Folder path
define('FP_ROOT_PATH', makeOSPath('/'));
if (\Lobby\Modules::exists("indi")) {
    /**
     * If `indi` module is enabled, don't use FilePicker
     */
    return false;
    exit;
}
if (isset($_GET['img'])) {
    $img_path = FP_ROOT_PATH . base64_decode($_GET['img']);
    $img = getimagesize($img_path);
    if (is_array($img)) {
        $fp = fopen($img_path, 'rb');
        header('Content-Type: ' . $size['mime']);
        header('Content-Length: ' . filesize($img_path));
        fpassthru($fp);
        exit;
Beispiel #4
0
});
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']);
    });
}
Beispiel #5
0
        <p>Welcome to the Admin panel of Lobby. You can manage your Lobby installation from here</p>
        <ul>
          <li><?php 
echo \Lobby::l("admin/about.php", "About");
?>
</li>
          <li><?php 
echo \Lobby::l("admin/apps.php", "Installed Apps");
?>
</li>
          <li><?php 
echo \Lobby::l("admin/lobby-store.php", "Lobby Store");
?>
</li>
          <?php 
if (\Lobby\Modules::exists("admin")) {
    ?>
            <li><?php 
    echo \Lobby::l("admin/login?logout=true", "Log Out");
    ?>
</li>
          <?php 
}
?>
        </ul>
        <p>Encoutered a problem or want to make a suggestion ? See our <a target="_blank" href="https://github.com/subins2000/lobby/issues">GitHub Repo</a></p>
      </div>
    </div>
  </body>
</html>
Beispiel #6
0
 public function init()
 {
     $appID = $this->app->getData("appID");
     $this->appAdminSetup();
     if ($appID === null) {
         return null;
     }
     $App = new Apps($appID);
     $App->run();
     Hooks::addAction("router.finish", function () {
         /**
          * Route App Pages (/app/{appname}/{page}) to according apps
          */
         Router::route("/?[*:page]?", function ($request) {
             $appID = Apps::getInfo("id");
             $page = $request->page === null ? "/" : "/{$request->page}";
             if (substr($page, 0, 6) == "/admin") {
                 return false;
             } else {
                 $App = new \Lobby\Apps($appID);
                 $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{$page}.php");
                     if ($html) {
                         Response::setPage($html);
                     } else {
                         ser();
                     }
                 } else {
                     if ($pageResponse === null) {
                         ser();
                     } else {
                         Response::setPage($pageResponse);
                     }
                 }
             }
         });
     });
     Router::route("/app/[:appID]?/[**:page]?", function ($request) {
         if ($request->appID === "admin") {
             Response::redirect("admin/app/admin/{$page}" . $request->page);
         }
         ser();
     });
     /**
      * Disable FilePicker Module
      */
     if (\Lobby\Modules::exists("filepicker")) {
         \Lobby\Modules::disableModule("filepicker");
     }
     Router::route("/includes/lib/modules?/[**:page]?", function ($request) {
         ser();
     });
     \Lobby\UI\Panel::addTopItem('indiModule', array("text" => "<img src='" . $this->app->srcURL . "/src/image/logo.svg' />", "href" => "/admin/app/indi", "position" => "left", "subItems" => array("appAdmin" => array("text" => "App Admin", "href" => "/admin/app/{$appID}"), "configIndi" => array("text" => "Configure Indi", "href" => "/admin/app/indi"))));
 }