Пример #1
0
$_SERVER["SERVER_NAME"] = "server.lobby.sim";
$_SERVER["REQUEST_URI"] = "/df/dsfe/";
require __DIR__ . "/../../load.php";
$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();
Пример #2
0
                           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)) {
                               ser("App Exists", "Hmmm... Looks like the App ID you submitted already exists either on App Center Or in the App Queue. " . \Lobby::l("/apps/{$app_info['id']}", "See Existing App"));