Example #1
0
 /**
  * Update The Lobby Core (Software)
  */
 public static function software()
 {
     if (\Lobby\Modules::exists("admin")) {
         $admin_previously_installed = true;
     }
     $oldVer = self::$version;
     $latest_version = DB::getOption("lobby_latest_version");
     $url = Server::download("lobby", $latest_version);
     $zipFile = L_DIR . "/contents/update/" . $latest_version . ".zip";
     self::zipFile($url, $zipFile);
     // Make the Zip Object
     $zip = new \ZipArchive();
     if ($zip->open($zipFile) != "true") {
         self::log("Unable to open downloaded Zip File.");
         echo ser("Error", "Unable to open Zip File.  <a href='update.php'>Try again</a>");
     }
     self::log("Upgrading Lobby Software From {$zipFile}");
     /**
      * Extract New Version
      */
     $zip->extractTo(L_DIR);
     $zip->close();
     FS::remove($zipFile);
     self::finish_software_update(isset($admin_previously_installed));
     return L_URL . "/admin/settings.php?updated=1&oldver={$oldVer}" . \CSRF::getParam();
 }
Example #2
0
 public function init()
 {
     if (\Lobby::status("lobby.assets-serve") === false) {
         $this->install();
         $this->routes();
         require_once $this->app->dir . "/src/inc/load.php";
         if (LS::$loggedIn) {
             /**
              * Logged In
              */
             Hooks::addAction("init", function () {
                 /**
                  * Add Change Password Item in Top Panel -> Admin before Log Out item
                  * This is done by first removing the Log Out item, adding the Change
                  * Password item and then adding back the Log Out item
                  */
                 \Lobby\UI\Panel::addTopItem('adminModule', array("text" => "<img src='" . $this->app->srcURL . "/src/image/logo.svg' style='width: 40px;height: 40px;' />", "href" => "/", "position" => "left", "subItems" => array("changePassword" => array("text" => "Change Password", "href" => "/app/admin/change-password"), 'LogOut' => array("text" => "Log Out", "href" => "/app/admin/logout"))));
             });
         } else {
             /**
              * If `indi` module is active, make the index page available to everyone
              */
             if (!Modules::exists("app_indi")) {
                 if (\Lobby::curPage() != "/admin/login" && !\Lobby::status("lobby.install")) {
                     \Response::redirect("/admin/login");
                 }
             } else {
                 Panel::removeTopItem("indiModule", "left");
                 if (\Lobby::curPage() != "/admin/login" && \Lobby::curPage() != "/admin/install.php" && substr(\Lobby::curPage(), 0, 6) == "/admin") {
                     \Response::redirect("/admin/login");
                 }
             }
             Hooks::addFilter("panel.left.items", function ($left) {
                 unset($left["lobbyAdmin"]);
                 if (Modules::exists("app_indi")) {
                     unset($left["indiModule"]);
                 }
                 return $left;
             });
             Assets::removeJS("notify");
             Assets::removeCSS("notify");
         }
     }
 }
Example #3
0
        } else {
            //$path = substr_replace($path, "$drive/", 0, 1);
            $path = str_replace('/', '\\', $path);
        }
    } else {
        if ($path == "/" || $path == "") {
            $path = "/";
        } else {
            $path = str_replace('\\', '/', $path);
        }
    }
    return $path;
}
// Folder path
define('FP_ROOT_PATH', makeOSPath('/'));
if (\Lobby\Modules::exists("indi")) {
    /**
     * If `indi` module is enabled, don't use FilePicker
     */
    return false;
    exit;
}
if (isset($_GET['img'])) {
    $img_path = FP_ROOT_PATH . base64_decode($_GET['img']);
    $img = getimagesize($img_path);
    if (is_array($img)) {
        $fp = fopen($img_path, 'rb');
        header('Content-Type: ' . $size['mime']);
        header('Content-Length: ' . filesize($img_path));
        fpassthru($fp);
        exit;
Example #4
0
<?php

/**
 * The online server of Lobby.
 * Default : http://lobby.subinsb.com/api
 */
define("L_SERVER", "http://lobby.subinsb.com/api");
/**
 * Make important locations and URLs as constants
 * to easily access them
 */
define("L_URL", \Lobby::$url);
define("APPS_URL", L_URL . "/contents/apps");
define("APPS_DIR", L_DIR . "/contents/apps");
/**
 * LOAD MODULES
 * ------------
 * It will : First, load the core modules
 * Then the custom modules
 */
require_once L_DIR . "/includes/src/Modules.php";
\Lobby\Modules::load();
Example #5
0
});
if (\Fr\LS::$loggedIn) {
    /**
     * Logged In
     */
    \Lobby::hook("init", function () {
        /**
         * Add Change Password Item in Top Panel -> Admin before Log Out item
         * This is done by first removing the Log Out item, adding the Change
         * Password item and then adding back the Log Out item
         */
        \Lobby\Panel::$top_items['left']['lobbyAdmin']['subItems']['ChangePassword'] = array("text" => "Change Password", "href" => "/admin/ChangePassword");
        \Lobby\Panel::$top_items['left']['lobbyAdmin']['subItems']['LogOut'] = array("text" => "Log Out", "href" => "/admin/login?logout");
    });
} else {
    /**
     * Not logged in
     */
    if (\Lobby\Modules::exists("indi") === false) {
        if (\Lobby::curPage() != "/admin/login" && !\Lobby::status("lobby.install")) {
            \Lobby::redirect("/admin/login");
        }
    } else {
        if (\Lobby::curPage() != "/admin/login" && \Lobby::curPage() != "/admin/install.php" && substr(\Lobby::curPage(), 0, 6) == "/admin") {
            \Lobby::redirect("/admin/login");
        }
    }
    \Lobby::hook("init", function () {
        unset(\Lobby\Panel::$top_items['left']['lobbyAdmin']);
    });
}
Example #6
0
  </head>
  <body>
    <?php 
\Hooks::doAction("admin.body.begin");
?>
    <div id="workspace">
      <div class="contents">
        <h1>Modules</h1>
        <p>Modules extend the functionality of Lobby. This page shows the modules that are installed in Lobby. <a target="_blank" href="<?php 
echo L_SERVER;
?>
/mods">Read more about Modules</a></p>
        <?php 
$core_modules = \Lobby\Modules::get("core");
$custom_modules = \Lobby\Modules::get("custom");
$app_modules = \Lobby\Modules::get("app");
echo "<h3>Custom Modules</h3>";
echo "Manually installed modules are 'custom modules'";
if (count($custom_modules) == 0) {
    echo ser("No Custom Modules", "No custom modules are enabled or installed", false);
} else {
    echo "<ul>";
    foreach ($custom_modules as $module) {
        echo "<li data-loc='{$module['location']}'>{$module['id']}</li>";
    }
    echo "</ul><p>To disable a <b>custom module</b>, create a 'disabled.txt' file in the module directory</p>";
}
echo "<h3>App Modules</h3>";
echo "<p>The modules loaded by Apps</p>";
if (count($app_modules) == 0) {
    echo ser("No App Modules", "No app's modules are enabled or installed", false);
Example #7
0
        <p>Welcome to the Admin panel of Lobby. You can manage your Lobby installation from here</p>
        <ul>
          <li><?php 
echo \Lobby::l("admin/about.php", "About");
?>
</li>
          <li><?php 
echo \Lobby::l("admin/apps.php", "Installed Apps");
?>
</li>
          <li><?php 
echo \Lobby::l("admin/lobby-store.php", "Lobby Store");
?>
</li>
          <?php 
if (\Lobby\Modules::exists("admin")) {
    ?>
            <li><?php 
    echo \Lobby::l("admin/login?logout=true", "Log Out");
    ?>
</li>
          <?php 
}
?>
        </ul>
        <p>Encoutered a problem or want to make a suggestion ? See our <a target="_blank" href="https://github.com/subins2000/lobby/issues">GitHub Repo</a></p>
      </div>
    </div>
  </body>
</html>
Example #8
0
    {
        $location = L_DIR . $location;
        $modules = array_diff(scandir($location), array('..', '.'));
        $validModules = array();
        foreach ($modules as $module) {
            $loc = "{$location}/{$module}";
            if (self::valid($module, $loc)) {
                $validModules[$module] = $loc;
            }
        }
        return $validModules;
    }
    public static function load()
    {
        foreach (self::$modules as $module => $loc) {
            if (file_exists("{$loc}/load.php")) {
                require_once "{$loc}/load.php";
            }
        }
    }
    public static function exists($module)
    {
        if (isset(self::$modules[$module]) !== false) {
            return true;
        } else {
            return false;
        }
    }
}
\Lobby\Modules::init();
Example #9
0
 public function init()
 {
     $appID = $this->app->getData("appID");
     $this->appAdminSetup();
     if ($appID === null) {
         return null;
     }
     $App = new Apps($appID);
     $App->run();
     Hooks::addAction("router.finish", function () {
         /**
          * Route App Pages (/app/{appname}/{page}) to according apps
          */
         Router::route("/?[*:page]?", function ($request) {
             $appID = Apps::getInfo("id");
             $page = $request->page === null ? "/" : "/{$request->page}";
             if (substr($page, 0, 6) == "/admin") {
                 return false;
             } else {
                 $App = new \Lobby\Apps($appID);
                 $class = $App->getInstance();
                 /**
                  * Set the title
                  */
                 Response::setTitle($App->info["name"]);
                 $pageResponse = $class->page($page);
                 if ($pageResponse === "auto") {
                     if ($page === "/") {
                         $page = "/index";
                     }
                     $html = $class->inc("/src/page{$page}.php");
                     if ($html) {
                         Response::setPage($html);
                     } else {
                         ser();
                     }
                 } else {
                     if ($pageResponse === null) {
                         ser();
                     } else {
                         Response::setPage($pageResponse);
                     }
                 }
             }
         });
     });
     Router::route("/app/[:appID]?/[**:page]?", function ($request) {
         if ($request->appID === "admin") {
             Response::redirect("admin/app/admin/{$page}" . $request->page);
         }
         ser();
     });
     /**
      * Disable FilePicker Module
      */
     if (\Lobby\Modules::exists("filepicker")) {
         \Lobby\Modules::disableModule("filepicker");
     }
     Router::route("/includes/lib/modules?/[**:page]?", function ($request) {
         ser();
     });
     \Lobby\UI\Panel::addTopItem('indiModule', array("text" => "<img src='" . $this->app->srcURL . "/src/image/logo.svg' />", "href" => "/admin/app/indi", "position" => "left", "subItems" => array("appAdmin" => array("text" => "App Admin", "href" => "/admin/app/{$appID}"), "configIndi" => array("text" => "Configure Indi", "href" => "/admin/app/indi"))));
 }