$r = $sql->fetch(\PDO::FETCH_ASSOC); $lg = new LobbyGit($appID, $r["git_url"], $r["cloud_id"]); $lg->logo($r['logo']); } } else { if ($what === "download") { $sql = \Lobby\DB::getDBH()->prepare("SELECT `git_url`, `cloud_id` FROM `apps` WHERE `id` = ?"); $sql->execute(array($appID)); if ($sql->rowCount() === 0) { echo "error : app doesn't exist"; } else { require_once __DIR__ . "/../inc/LobbyGit.php"; $r = $sql->fetch(\PDO::FETCH_ASSOC); $sql = \Lobby\DB::getDBH()->prepare("UPDATE `apps` SET `downloads` = `downloads` + 1 WHERE `id` = ?"); $sql->execute(array($appID)); $lg = new LobbyGit($appID, $r["git_url"], $r["cloud_id"]); $this->download("lobby-app-{$appID}.zip", $lg->download()); } } } } else { if ($node === "ping") { echo "pong"; } else { if ($node === "apps") { $get = Request::get("get"); $p = Request::get("p"); $q = Request::get("q"); $lobby_web = Request::get("lobby_web") != null; if ($p === null) { $start = 0;
$App = new \Lobby\Apps("lobby-server"); $App->run(); require APPS_DIR . "/lobby-server/src/inc/LobbyGit.php"; /** * Argument 1 has the App ID */ if (isset($argv[1])) { $sql = \Lobby\DB::getDBH()->prepare("SELECT `id`, `git_url` FROM `apps` WHERE `id` = ?"); $sql->execute(array($argv[1])); if ($sql->rowCount() !== 0) { $r = $sql->fetch(\PDO::FETCH_ASSOC); $LG = new \LobbyGit($r['id'], $r['git_url']); if ($LG->update()) { echo "{$r['id']} updated\r\n"; } else { echo "{$r['id']} failed to update\r\n"; } } } else { $sql = \Lobby\DB::getDBH()->prepare("SELECT `id`, `git_url` FROM `apps` ORDER BY `downloads` DESC"); $sql->execute(); while ($r = $sql->fetch()) { echo "{$r['id']} updating...\n"; /** * Constructing will update app if it hasn't been updated in a day */ $LG = new \LobbyGit($r['id'], $r['git_url']); $LG->register(); echo "{$r['id']} updated.\n"; } }
$sql->execute(array(\Fr\LS2::$user, $path[3])); if ($sql->rowCount() == "0") { ser(); } else { $app_edit = true; $result = $sql->fetch(\PDO::FETCH_ASSOC); $app_info = $result; $AppID = $app_info['id']; } } ?> <div class="contents"> <?php if ($app_edit && isset($_GET['update']) && !isset($_GET['app-updated'])) { require_once $this->dir . "/src/inc/LobbyGit.php"; $lg = new \LobbyGit($AppID, $app_info['git_url']); $lg->update(); Response::redirect("/me/app/{$AppID}?app-updated"); } if (isset($_POST['app_name'])) { $app_info_required = array("id" => $app_edit ? $path[3] : \Request::get("app_id"), "name" => \Request::get("app_name"), "git_url" => \Request::get("app_src"), "description" => \Request::get("app_description"), "category" => \Request::get("app_category"), "sub_category" => \Request::get("app_sub_category"), "app_page" => \Request::get("app_page")); $app_info = array_merge($app_info, $app_info_required); $app_info["lobby_web"] = isset($_POST["app_lobby_web"]) ? "1" : "0"; $app_info["logo"] = isset($_POST["app_logo"]) ? "1" : "0"; } if (isset($_POST['app_name']) && CSRF::check() && array_search(null, $app_info_required) === false) { $apps_sql = \Lobby\DB::getDBH()->prepare("SELECT COUNT(1) FROM `apps` WHERE `id` = ?"); $apps_sql->execute(array($app_info['id'])); $queue_sql = \Lobby\DB::getDBH()->prepare("SELECT COUNT(1) FROM `apps_queue` WHERE `id` = ?"); $queue_sql->execute(array($app_info['id'])); if ($app_edit != true && ($queue_sql->fetchColumn() != 0 || $apps_sql->fetchColumn() != 0)) {