Example #1
0
 public function page($p)
 {
     /**
      * Clean up Assets
      */
     \Assets::removeCSS(array("theme.hine-/src/dashboard/css/scrollbar.css", "theme.hine-/src/dashboard/css/jquery.contextmenu.css", "theme.hine-/src/dashboard/css/dashboard.css", "theme.hine-/src/main/lib/jquery-ui/jquery-ui.css"));
     \Assets::js("jqueryui", "");
     \Assets::removeJS(array("theme.hine-/src/dashboard/js/scrollbar.js", "theme.hine-/src/dashboard/js/jquery.contextmenu.js", "theme.hine-/src/dashboard/js/dashboard.js", "app"));
     /**
      * Mobile
      */
     Hooks::addAction("head.end", function () {
         echo '<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" async="async" defer="defer">';
         echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
         if (\Lobby::getHostname() != "server.lo" . "bby.sim") {
             echo '<script>if (window.location.protocol != "https:") window.location.href = "https:" + window.location.href.substring(window.location.protocol.length);</script>';
         }
     });
     /**
      * 
      */
     Hooks::addAction("panel.end", function () {
         echo '<a href="#" data-activates="lobby-nav" id="lobby-nav-btn"><i class="material-icons">menu</i></a>';
         echo '<ul class="side-nav" id="lobby-nav">
     <li><a href="/">Lobby</a></li>
     <li><a href="/apps">Apps</a></li>
     <li><a href="/download">Download</a></li>
     <li><a href="/web-readme">Demo</a></li>
     <li><a href="/docs">Documentation</a></li>
   </ul>';
         echo '<script>lobby.load(function(){$("#lobby-nav-btn").sideNav({menuWidth: 200});});</script>';
     });
     /**
      * Add notifications
      */
     \Lobby\UI\Panel::addNotifyItem("lobby-0-6-released", array("contents" => "Lobby " . $this->lobby_version . " Released", "href" => $this->lobby_annoucement, "icon" => "update"));
     \Lobby\UI\Panel::addNotifyItem("z-new-game", array("contents" => "New Site Compressor!", "href" => "https://lobby.subinsb.com/apps/site-compressor", "icon" => "new"));
     $path = explode("/", $p);
     if ($path[1] === "docs") {
         $doc = isset($path[2]) ? str_replace("/", ".", substr_replace($p, "", 0, 6)) : "index";
         $this->menu_items();
         \Assets::removeJS("theme.hine-/src/main/js/init.js");
         return $this->inc("/src/page/docs.php", array("doc" => $doc));
     } elseif ($path[1] === "mods") {
         $mod = isset($path[2]) ? str_replace("/", ".", substr_replace($p, "", 0, 6)) : "index";
         $this->menu_items();
         \Assets::removeJS("theme.hine-/src/main/js/init.js");
         return $this->inc("/src/page/mods.php", array("doc" => $mod));
     } else {
         if ($path[1] == "api") {
             $node = isset($path[2]) ? $path[2] : "index";
             return $this->inc("/src/page/api.php", array("node" => $node, "path" => $path));
         } else {
             if ($path[1] == "me") {
                 $this->menu_items();
                 $node = isset($path[2]) ? $path[2] : "index";
                 return $this->inc("/src/page/me.php", array("node" => $node, "path" => $path));
             } else {
                 if ($path[1] == "apps") {
                     $this->menu_items();
                     $node = isset($path[2]) ? $path[2] : "index";
                     return $this->inc("/src/page/apps.php", array("node" => $node));
                 } else {
                     if ($path[1] == "u") {
                         $this->menu_items();
                         $node = isset($path[2]) ? $path[2] : "index";
                         return $this->inc("/src/page/u.php", array("user" => $node));
                     } else {
                         $this->menu_items();
                         return "auto";
                     }
                 }
             }
         }
     }
 }
Example #2
0
 /**
  * Push a notify item
  */
 public function addNotifyItem($id, $info)
 {
     if (!isset($info["href"])) {
         $info["href"] = $this->url;
     }
     return \Lobby\UI\Panel::addNotifyItem("app_{$this->id}_{$id}", $info);
 }
Example #3
0
 /**
  * Get updates
  */
 public static function check()
 {
     $url = self::$apiURL . "/lobby/updates";
     $apps = Apps::getApps();
     try {
         $response = \Requests::post($url, array(), self::makeData(array("apps" => implode(",", $apps))))->body;
     } catch (\Requests_Exception $error) {
         \Lobby::log("Checkup with server failed ({$url}) : {$error}");
         $response = false;
     }
     if ($response) {
         $response = json_decode($response, true);
         if (is_array($response)) {
             DB::saveOption("lobby_latest_version", $response['version']);
             DB::saveOption("lobby_latest_version_release", $response['released']);
             DB::saveOption("lobby_latest_version_release_notes", $response['release_notes']);
             if (isset($response['apps']) && count($response['apps']) != 0) {
                 $AppUpdates = array();
                 foreach ($response['apps'] as $appID => $version) {
                     $App = new \Lobby\Apps($appID);
                     if ($App->hasUpdate($version)) {
                         $AppUpdates[$appID] = $version;
                     }
                 }
                 DB::saveOption("app_updates", json_encode($AppUpdates));
             }
             if (isset($response["notify"])) {
                 foreach ($response["notify"]["items"] as $itemID => $item) {
                     if (isset($item["href"])) {
                         $item["href"] = \Lobby::u($item["href"]);
                     }
                     Panel::addNotifyItem("lobby_server_msg_" . $itemID, $item);
                 }
                 foreach ($response["notify"]["remove_items"] as $itemID) {
                     Panel::removeNotifyItem("lobby_server_msg_" . $itemID);
                 }
             }
         }
     }
 }