/** * The $checking parameter tells if any Success output should be made or not. * Default : Visible. It's named $checking, because output shouldn't be made * while checking DB connection. So, if it's a call made while checking, * then the parameter $checking must be TRUE. * ---------- * We don't have a step2 function because there is no Step 3 */ public static function step1() { if (!is_writable(L_DIR)) { ser("Error", "Lobby Directory is not Writable. Please set <blockquote>" . L_DIR . "</blockquote> directory's permission to writable.<cl/><a href='install.php?step=1' class='button'>Check Again</a>"); return false; } elseif (\Lobby\FS::exists("/config.php")) { ser("config.php File Exists", "A config.php file already exitsts in <blockquote>" . L_DIR . "</blockquote> directory. Remove it and try again. <cl/><a href='install.php?step=1" . H::csrf('g') . "' class='button'>Check Again</a>"); return false; } else { return true; } }
/** * The $checking parameter tells if any Success output should be made or not. * Default : Visible. It's named $checking, because output shouldn't be made * while checking DB connection. So, if it's a call made while checking, * then the parameter $checking must be TRUE. * ---------- * We don't have a step2 function because there is no Step 3 */ public static function step1() { if (!is_writable(L_DIR)) { echo ser("Error", "Lobby Directory is not Writable. Please set <blockquote>" . L_DIR . "</blockquote> directory's permission to writable.<cl/><a href='install.php?step=1' class='btn'>Check Again</a>"); return false; } else { if (FS::exists("/config.php")) { echo ser("config.php File Exists", "A config.php file already exitsts in <blockquote>" . L_DIR . "</blockquote> directory. Remove it and try again. <cl/><a href='" . self::u("admin/install.php?step=1" . \CSRF::getParam()) . "' class='btn'>Check Again</a>"); return false; } else { return true; } } }
<?php require "../../../../load.php"; $file = \Request::postParam('cx74e9c6a45', ''); $appID = \Request::postParam('s7c8csw91', ''); if ($file != "" && CSRF::check()) { if ($appID !== "") { $App = new \Lobby\Apps($appID); if ($App->exists && $App->enabled) { $AppClass = $App->run(); $html = $AppClass->page("/ajax/{$file}"); if ($html === "auto") { $html = $AppClass->inc("/src/ajax/{$file}"); } echo $html; } } else { if (\Lobby\FS::exists($file)) { require_once \Lobby\FS::loc($file); } else { echo "fileNotFound"; } } }
<?php /** * Add the <head> files if it's not the install page */ if (!\Lobby::status("lobby.install")) { /** * Left Menu */ \Lobby\UI\Panel::addTopItem("lobbyHome", array("text" => "Home", "href" => L_URL, "position" => "left")); $adminArray = array("text" => "Admin", "href" => "/admin", "position" => "left"); $adminArray["subItems"] = array("app_manager" => array("text" => "Apps", "href" => "/admin/apps.php"), "lobby_store" => array("text" => "Lobby Store", "href" => "/admin/lobby-store.php"), "about" => array("text" => "Settings", "href" => "/admin/settings.php")); \Lobby\UI\Panel::addTopItem("lobbyAdmin", $adminArray); if (\Lobby\FS::exists("/upgrade.lobby")) { require_once L_DIR . "/includes/src/Update.php"; $l_info = json_decode(\Lobby\FS::get("/lobby.json")); if ($lobby_version != $l_info->version) { Lobby\DB::saveOption("lobby_latest_version", $l_info->version); Lobby\DB::saveOption("lobby_latest_version_release", $l_info->released); } \Lobby\Update::finish_software_update(); } } if (\Lobby::status("lobby.admin")) { /** * Add Admin Pages' stylesheet, script */ \Assets::js("admin", "/admin/js/admin.js"); /** * Add sidebar */
public static function finish_software_update($admin_previously_installed = false) { FS::write("/upgrade.lobby", "1", "w"); if ($admin_previously_installed) { FS::remove("/contents/modules/admin/disabled.txt"); } $latest_version = DB::getOption("lobby_latest_version"); self::log("Updated Lobby to version {$latest_version}"); /** * Remove Depreciated Files */ $deprecatedFilesInfoLoc = "/contents/update/removeFiles.php"; if (FS::exists($deprecatedFilesInfoLoc)) { $files = FS::get($deprecatedFilesInfoLoc); $files = explode("\n", $files); if (count($files) !== 0) { $files = array_filter($files); foreach ($files as $file) { $fileLoc = L_DIR . "/{$file}"; if (file_exists($fileLoc) && $fileLoc != L_DIR) { FS::remove($fileLoc); self::log("Removed Deprecated File: {$fileLoc}"); } } copy(FS::loc($deprecatedFilesInfoLoc), FS::loc("{$deprecatedFilesInfoLoc}.txt")); FS::remove($deprecatedFilesInfoLoc); self::log("Finished Removing Deprecated Files"); } } /** * Database Update */ if (FS::exists("/update/sqlExecute.sql")) { self::log("Upgrading Lobby Database"); $sqlCode = FS::get("/update/sqlExecute.sql"); $sql = \Lobby\DB::prepare($sqlCode); if (!$sql->execute()) { echo ser("Error", "Database Update Couldn't be made. <a href='update.php'>Try again</a>"); } else { FS::remove("/update/sqlExecute.sql"); } self::log("Updated Lobby Database"); } FS::remove("/upgrade.lobby"); self::log("Lobby is successfully Updated."); }
/** * Get the manifest info of app as array */ private function setInfo() { $manifest = FS::exists($this->dir . "/manifest.json") ? FS::get($this->dir . "/manifest.json") : false; if ($manifest) { $details = json_decode($manifest, true); $details = array_replace_recursive(self::$manifestConfig, $details); /** * Add extra info with the manifest info */ $details['id'] = $this->app; $details['dir'] = $this->dir; $details['url'] = Lobby::getURL() . "/app/{$this->app}"; $details['srcURL'] = Lobby::getURL() . "/contents/apps/{$this->app}"; $details['adminURL'] = Lobby::getURL() . "/admin/app/{$this->app}"; /** * Prefer SVG over PNG */ $details['logo'] = $details['logo'] !== false ? FS::exists($this->dir . "/src/image/logo.svg") ? self::$appsURL . "/{$this->app}/src/image/logo.svg" : self::$appsURL . "/{$this->app}/src/image/logo.png" : Themes::getThemeURL() . "/src/main/image/app-logo.png"; $details["latestVersion"] = isset(self::$appUpdates[$this->app]) ? self::$appUpdates[$this->app] : null; $details = \Hooks::applyFilters("app.manifest", $details); /** * Insert the info as a property */ $this->info = $details; /** * Whether app is enabled */ $this->enabled = in_array($this->app, self::getEnabledApps(), true); return $details; } else { return false; } }
public static function finish_software_update($admin_previously_installed = false) { if ($admin_previously_installed) { \Lobby\FS::remove("/contents/modules/admin/disabled.txt"); } $latest_version = getOption("lobby_latest_version"); \Lobby::log("Updated Lobby Software To version {$latest_version}"); /* Remove Depreciated Files */ if (\Lobby\FS::exists("/contents/update/removeFiles.php")) { $files = \Lobby\FS::get("/contents/update/removeFiles.php"); $files = explode("\n", $files); if (count($files) != 0) { foreach ($files as $file) { // iterate files $fileLoc = L_DIR . "/{$file}"; if (file_exists($fileLoc) && $fileLoc != L_DIR) { $type = filetype($fileLoc); if ($type == "file") { \Lobby\FS::remove($fileLoc); } else { if ($type == "dir") { rmdir($fileLoc); } } } } \Lobby\FS::remove(L_DIR . "/contents/update/removeFiles.php"); \Lobby::log("Removed Deprecated Files"); } } /** * Database Update */ if (\Lobby\FS::exists("/update/sqlExecute.sql")) { \Lobby::log("Upgrading Lobby Database"); $sqlCode = \Lobby\FS::get("/update/sqlExecute.sql"); $sql = \Lobby\DB::prepare($sqlCode); if (!$sql->execute()) { ser("Error", "Database Update Couldn't be made. <a href='update.php'>Try again</a>"); } else { \Lobby\FS::remove("/update/sqlExecute.sql"); } \Lobby::log("Updated Lobby Database"); } $oldVer = getOption("lobby_version"); saveOption("lobby_version", $latest_version); saveOption("lobby_version_release", getOption("lobby_latest_version_release")); \Lobby\FS::remove("/upgrade.lobby"); \Lobby::log("Lobby is successfully Updated."); }