Example #1
0
 /**
  * Define some pages by default
  */
 public static function defaults()
 {
     /**
      * Route App Pages (/app/{appname}/{page}) to according apps
      */
     self::route("/app/[:appID]?/[**:page]?", function ($request) {
         $AppID = $request->appID;
         $page = $request->page != "" ? "/{$request->page}" : "/";
         /**
          * Check if App exists
          */
         $App = new \Lobby\Apps($AppID);
         if ($App->exists && $App->enabled) {
             $class = $App->run();
             $AppInfo = $App->info;
             /**
              * Set the title
              */
             Response::setTitle($AppInfo['name']);
             /**
              * Add the App item to the navbar
              */
             \Lobby\UI\Panel::addTopItem("lobbyApp{$AppID}", array("text" => $AppInfo['name'], "href" => $AppInfo['url'], "subItems" => array("app_admin" => array("text" => "Admin", "href" => "/admin/apps.php?app={$AppID}"), "app_disable" => array("text" => "Disable", "href" => "/admin/apps.php?action=disable&app={$AppID}" . \CSRF::getParam()), "app_remove" => array("text" => "Remove", "href" => "/admin/apps.php?action=remove&app={$AppID}" . \CSRF::getParam())), "position" => "left"));
             $pageResponse = $class->page($page);
             if ($pageResponse === "auto") {
                 if ($page === "/") {
                     $page = "/index";
                 }
                 if (is_dir($class->fs->loc("src/page{$page}"))) {
                     $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);
                 }
             }
         } else {
             echo ser();
         }
     });
     /**
      * Dashboard Page
      * The main Page. Add CSS & JS accordingly
      */
     self::route("/", function () {
         Response::setTitle("Dashboard");
         \Lobby\UI\Themes::loadDashboard("head");
         Response::loadPage("/includes/lib/lobby/inc/dashboard.php");
     });
 }
Example #2
0
    <div class="workspace">
      <div class="contents">
        <?php 
if (H::input("id") == null) {
    ser("Error", "No App is mentioned. Install Apps from <a href='lobby-store.php'>Lobby Store</a>");
}
if (H::input("action") == "enable" && H::csrf()) {
    $App = new \Lobby\Apps($_GET['id']);
    if (!$App->exists) {
        ser("Error", "App is not installed");
    }
    $App->enableApp();
    sss("Enabled", "The App <b>{$_GET['id']}</b> is enabled. The author says thanks.<a href='" . $App->info['URL'] . "' class='button green'>Open App</a>");
}
if (H::input("action") == "remove" && H::csrf()) {
    $App = new \Lobby\Apps($_GET['id']);
    if (!$App->exists) {
        ser("Error", "App is not installed");
    }
    $App->removeApp();
    sss("Removed", "The App <b>{$_GET['id']}</b> was successfully removed.");
}
$id = H::input("id");
if ($id != null && H::input("action") == null && H::csrf()) {
    ?>
          <h1>Install App</h1>
          <iframe src="<?php 
    echo L_URL . "/admin/download.php?type=app&id={$id}" . H::csrf("g");
    ?>
" style="border: 0;width: 100%;height: 200px;"></iframe>
        <?php 
Example #3
0
<?php

require "../../../../load.php";
$file = \Request::postParam('cx74e9c6a45', '');
$appID = \Request::postParam('s7c8csw91', '');
if ($file != "" && CSRF::check()) {
    if ($appID !== "") {
        $App = new \Lobby\Apps($appID);
        if ($App->exists && $App->enabled) {
            $AppClass = $App->run();
            $html = $AppClass->page("/ajax/{$file}");
            if ($html === "auto") {
                $html = $AppClass->inc("/src/ajax/{$file}");
            }
            echo $html;
        }
    } else {
        if (\Lobby\FS::exists($file)) {
            require_once \Lobby\FS::loc($file);
        } else {
            echo "fileNotFound";
        }
    }
}
Example #4
0
}
if (count($Apps) != 0) {
    ?>
          <table style="width: 100%;margin-top:5px">
            <thead>
              <tr>
                <td>Name</td>
                <td>Version</td>
                <td>Description</td>
                <td>Actions</td>
              </tr>
            </thead>
            <tbody>
              <?php 
    foreach ($Apps as $app => $null) {
        $App = new \Lobby\Apps($app);
        $data = $App->info;
        $appImage = !isset($data['image']) ? L_URL . "/includes/lib/core/Img/blank.png" : $data['image'];
        $enabled = $App->isEnabled();
        ?>
                <tr <?php 
        if (!$enabled) {
            echo 'style="background: #EEE;"';
        }
        ?>
>
                  <td>
                    <a href="<?php 
        echo \Lobby::u("/admin/app/{$app}");
        ?>
"><?php 
Example #5
0
 /**
  * Define some pages by default
  */
 public static function defaults()
 {
     /**
      * Route App Pages (/app/{appname}/{page}) to according apps
      */
     self::route("/app/[:appID]?/[**:page]?", function ($request) {
         $AppID = $request->appID;
         $GLOBALS['AppID'] = $AppID;
         $page = $request->page != "" ? "/{$request->page}" : "/";
         /**
          * Check if App exists
          */
         $App = new \Lobby\Apps($AppID);
         if ($App->exists && $App->isEnabled() && substr($page, 0, 7) != "/Admin/") {
             $class = $App->run();
             $AppInfo = $App->info;
             /**
              * Set the title
              */
             \Lobby::setTitle($AppInfo['name']);
             /**
              * Add the App item to the navbar
              */
             \Lobby\UI\Panel::addTopItem("lobbyApp{$AppID}", array("text" => $AppInfo['name'], "href" => APP_URL, "position" => "left"));
             $page_response = $class->page($page);
             if ($page_response == "auto") {
                 if ($page == "/") {
                     $page = "/index";
                 }
                 $GLOBALS['workspaceHTML'] = $class->inc("/src/Page{$page}.php");
             } else {
                 $GLOBALS['workspaceHTML'] = $page_response;
             }
             if ($GLOBALS['workspaceHTML'] == null) {
                 ser();
             }
         } else {
             ser();
         }
     });
     /**
      * Dashboard Page
      * The main Page. Add CSS & JS accordingly
      */
     self::route("/", function () {
         \Lobby::setTitle("Dashboard");
         \Lobby\UI\Themes::loadDashboard("head");
         $GLOBALS['workspaceHTML'] = array("/includes/lib/core/Inc/dashboard.php");
     });
     /**
      * Administration
      */
     self::route("/admin/app/[:appID]?/[**:page]?", function ($request) {
         $AppID = $request->appID;
         $GLOBALS['AppID'] = $AppID;
         $page = $request->page != "" ? "/Admin/{$request->page}" : "/Admin/index";
         /**
          * Check if App exists
          */
         $App = new \Lobby\Apps($AppID);
         if ($App->exists && $App->isEnabled()) {
             /**
              * Redirect /src/ files to App's Source in /contents folder
              */
             $class = $App->run();
             $AppInfo = $App->info;
             /**
              * Set the title
              */
             \Lobby::setTitle($AppInfo['name']);
             /**
              * Add the App item to the navbar
              */
             \Lobby\UI\Panel::addTopItem("lobbyApp{$AppID}", array("text" => "Admin > " . $AppInfo['name'], "href" => "/admin/app/{$AppID}", "position" => "left"));
             $page_response = $class->page($page);
             if ($page_response == "auto") {
                 if ($page == "/") {
                     $page = "/index";
                 }
                 $GLOBALS['workspaceHTML'] = $class->inc("/src/Page{$page}.php");
             } else {
                 $GLOBALS['workspaceHTML'] = $page_response;
             }
             if ($GLOBALS['workspaceHTML'] === false || $GLOBALS['workspaceHTML'] == null) {
                 ob_start();
                 ser("Error", "The app '<strong>{$AppID}</strong>' does not have an Admin Page");
                 $error = ob_get_contents();
                 ob_end_clean();
                 $GLOBALS['workspaceHTML'] = "<div class='contents'>" . $error . "</div>";
             }
         }
     });
 }
Example #6
0
<?php

$_SERVER["HTTP_HOST"] = "server.lobby.sim";
$_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
Example #7
0
            } elseif (\Lobby\Install::checkDatabaseConnection() !== false) {
                /**
                 * Make the Config File
                 */
                \Lobby\Install::makeConfigFile();
                /**
                 * Create Tables
                 */
                if (\Lobby\Install::makeDatabase($prefix)) {
                    sss("Success", "Database Tables and configuration file was successfully created.");
                    /**
                     * Enable app lEdit
                     */
                    \Lobby::$installed = true;
                    \Lobby\DB::init();
                    $App = new \Lobby\Apps("ledit");
                    $App->enableApp();
                    echo '<cl/><a href="?step=3" class="button">Proceed</a>';
                } else {
                    ser("Unable To Create Database Tables", "Are there any tables with the same name ? Or Does the user have the permissions to create tables ?<cl/>The <b>config.php</b> file is created. To try again, remove the <b>config.php</b> file and click the button. <cl/>" . \Lobby::l("/admin/install.php?step=2", "Try Again", "class='button'"));
                }
            }
        } else {
            ?>
              <h2 style="margin-top: -20px;">Database Configuration</h2>
              <form action="<?php 
            \Lobby::u();
            ?>
" method="POST">
                 <table>
                  <tbody>
Example #8
0
<?php

require "../../../../load.php";
$app = Request::postParam('appID');
$key = Request::postParam('key');
$val = Request::postParam('value');
if ($app !== null && $key !== null && $val !== null && CSRF::check()) {
    $App = new Lobby\Apps($app);
    if (!$App->exists) {
        die("bad");
    }
    var_dump($key);
    if (!$App->getInstance()->saveData($key, $val)) {
        die("bad");
    }
} else {
    echo "fieldsMissing";
}
Example #9
0
<?php

require "../../../../load.php";
if (isset($_POST['s7c8csw91']) && isset($_POST['cx74e9c6a45']) && H::csrf()) {
    $AppID = $_POST['s7c8csw91'];
    // App ID
    $AjaxFile = urldecode($_POST['cx74e9c6a45']);
    // Ajax File Location
    $App = new \Lobby\Apps($AppID);
    if ($App->exists && $App->isEnabled()) {
        if ($AjaxFile == "") {
            ser();
        } else {
            $AppClass = $App->run();
            $html = $AppClass->page("/Ajax/{$AjaxFile}");
            if ($html == "auto") {
                $html = $AppClass->inc("/src/Ajax/{$AjaxFile}");
            }
            echo $html;
        }
    }
}
Example #10
0
  </head>
  <body>
    <?php 
\Hooks::doAction("admin.body.begin");
?>
    <div id="workspace">
      <div class="contents">
        <?php 
$appID = Request::get("app");
$action = Request::get("action");
/**
 * Whether this is a request to show a message
 */
$show = Request::get("show") !== null;
$displayID = htmlspecialchars($appID);
$App = new \Lobby\Apps($appID);
if ($appID === null) {
    echo ser("Error", "No App is mentioned. Install Apps from <a href='lobby-store.php'>Lobby Store</a>");
} else {
    if (!$App->exists) {
        echo ser("Error", "App is not installed");
    } else {
        if ($action === "enable" && CSRF::check()) {
            $App->enableApp();
            echo sss("Enabled", "The App <b>{$displayID}</b> is enabled. The author says thanks. <cl/><a href='" . $App->info['url'] . "' class='btn green'>Open App</a>");
        } else {
            if ($action === "remove" && CSRF::check()) {
                $App->removeApp();
                echo sss("Removed", "The App <b>{$displayID}</b> was successfully removed.");
            } else {
                if ($action === "clear-data" && CSRF::check()) {
Example #11
0
        $this->removeData("appID");
    } else {
        $this->saveData("appID", $appID);
    }
    echo sss("Saved", "Settings has been saved.");
}
$appID = $this->getData("appID");
?>
  <form action="<?php 
echo Lobby::u("/admin/app/indi");
?>
" method="POST">
    <label>
      <span>App ID</span>
      <select name="appID">
        <option value="">Choose App:</option>
        <?php 
foreach (Lobby\Apps::getEnabledApps() as $app) {
    echo "<option value='{$app}' " . ($appID === $app ? "selected='selected'" : "") . ">{$app}</option>";
}
?>
      </select>
    </label>
    <?php 
echo CSRF::getInput();
?>
    <cl/>
    <button class="btn green">Save</button>
  </form>
</div>