<?php require __DIR__ . "/../load.php"; unset($_SESSION['checkedForLatestVersion']); \Lobby\Server::check(); \Response::redirect("/admin/update.php");
</form> <?php echo Lobby::l("/admin/lobby-store.php", "New", "class='btn " . ($section === null ? "green" : "") . "'"); echo Lobby::l("/admin/lobby-store.php?section=popular", "Popular", "class='btn " . ($section === "popular" ? "green" : "") . "'"); ?> </div> <?php if ($q !== null) { $params = array("q" => $_GET['q']); } else { $params = array("get" => "popular"); } if ($p !== null) { $params["p"] = $p; } $server_response = \Lobby\Server::store($params); if ($server_response == false) { echo ser("Nothing Found", "Nothing was found that matches your criteria. Sorry..."); } else { echo "<div class='apps row'>"; foreach ($server_response['apps'] as $app) { $appImage = $app['image'] != "" ? $app['image'] : L_URL . "/includes/lib/lobby/image/blank.png"; $url = \Lobby::u("/admin/lobby-store.php?app={$app['id']}"); ?> <div class="app card col s12 m6 l6"> <div class="app-inner row"> <div class="lpane col s4 m5 l4"> <a href="<?php echo $url; ?> ">
/** * Update the App with the given ID */ public static function app($id) { if ($id == "") { echo ser("Error", "No App Mentioned to update."); } self::log("Installing Latest Version of App {$id}"); $url = Server::download("app", $id); $zipFile = L_DIR . "/contents/update/{$id}.zip"; self::zipFile($url, $zipFile); // Un Zip the file if (class_exists("ZipArchive")) { $zip = new \ZipArchive(); if ($zip->open($zipFile) != "true") { self::log("Unable to open Downloaded App ({$id}) File : {$zipFile}"); echo ser("Error", "Unable to open Downloaded App File."); } else { /** * Extract App */ $appDir = APPS_DIR . "/{$id}"; if (!file_exists($appDir)) { mkdir($appDir); } $zip->extractTo($appDir); $zip->close(); FS::remove($zipFile); self::log("Installed App {$id}"); return true; } } else { throw new \Exception("Unable to Install App, because <a href='" . L_SERVER . "/docs/quick#section-requirements' target='_blank'>PHP Zip Extension</a> is not installed"); } }
// Turn off output buffering ini_set('output_buffering', 'off'); // Turn off PHP output compression ini_set('zlib.output_compression', false); //Flush (send) the output buffer and turn off output buffering //ob_end_flush(); while (@ob_end_flush()) { } // Implicitly flush the buffer(s) ini_set('implicit_flush', true); ob_implicit_flush(true); if ($id == null || H::csrf() == false) { exit; } if ($type == "app") { $app = \Lobby\Server::Store(array("get" => "app", "id" => $id)); if ($app == "false") { echo "Error - App '<b>{$id}</b>' does not exist in Lobby."; exit; } $name = $app['name']; } else { $name = "Lobby {$id}"; } $GLOBALS['name'] = $name; ?> <p> Do NOT close this window. </p> <p> Downloading <b><?php
} else { if ($appID === null) { echo json_encode(array("statusID" => "error", "status" => "Invalid App ID")); } else { /** * A queue of App downloads */ $appInstallQueue = Lobby\DB::getJSONOption("lobby_app_downloads"); /** * If the $appID is in the queue, then give the download status of it * If the updated value is less than 20 seconds ago, then restart the download */ if (isset($appInstallQueue[$appID]) && $appInstallQueue[$appID]["updated"] > strtotime("-20 seconds")) { echo json_encode(array("statusID" => $appInstallQueue[$appID]["statusID"], "status" => $appInstallQueue[$appID]["status"])); } else { $appInfo = \Lobby\Server::store(array("get" => "app", "id" => $appID)); /** * App doesn't exist on Lobby Store */ if ($appInfo === "false") { echo json_encode(array("status" => "error", "error" => "App Doesn't Exist")); } else { $appName = $appInfo["name"]; $Process = new Process(Process::getPHPExecutable(), array("arguments" => array(L_DIR . "/admin/ajax/install-app-bg.php", \Lobby::getLID(), base64_encode(serialize($_SERVER)), $appID))); /** * Get the command used to execute install-app-bg.php */ $command = $Process->start(function () use($appID) { /** * This callback will close the connection between browser and server, * http://stackoverflow.com/q/36968552/1372424
echo \Lobby::u("/admin/lobby-store.php"); ?> "> <input type="text" placeholder="Type an app name" name="q" style="width:450px;"/> <button>Search</button> </form> <?php if (isset($_GET['q'])) { $request_data = array("q" => $_GET['q']); } else { $request_data = array("get" => "newApps"); } if (isset($_GET['p'])) { $request_data['p'] = $_GET['p']; } $server_response = \Lobby\Server::Store($request_data); if ($server_response == false) { ser("Nothing Found", "Nothing was found that matches your criteria. Sorry..."); } else { foreach ($server_response['apps'] as $app) { $appImage = $app['image'] != "" ? $app['image'] : L_URL . "/includes/lib/core/Img/blank.png"; $url = \Lobby::u("/admin/lobby-store.php?id={$app['id']}"); ?> <div class="app"> <a href="<?php echo $url; ?> "> <div class="outer"> <img class="image" src="<?php echo $appImage;
/** * Update the App with the given ID */ public static function app($id) { if ($id == "") { ser("Error", "No App Mentioned to update."); } \Lobby::log("Installing Latest Version of App {$id}"); $url = \Lobby\Server::download("app", $id); $zipFile = L_DIR . "/contents/update/{$id}.zip"; self::zipFile($url, $zipFile); // Un Zip the file $zip = new \ZipArchive(); if ($zip->open($zipFile) != "true") { \Lobby::log("Unable to open Downloaded App ({$id}) File : {$zipFile}"); ser("Error", "Unable to open Downloaded App File."); } else { /** * Extract App */ $zip->extractTo(APPS_DIR); $zip->close(); \Lobby\FS::remove($zipFile); \Lobby::log("Installed App {$id}"); return true; } }