Exemple #1
0
 public function makePanelItem($text, $href, $id, $extraClass = "")
 {
     if ($href == L_URL) {
         /**
          * Home button
          */
         $html = "<li class='item {$extraClass}' id='home'><a href='" . L_URL . "'></a></li>";
     } else {
         if ($href == "/admin") {
             /**
              * Admin button
              */
             $html = "<li class='item {$extraClass}' id='lobby'><a href='" . \Lobby::u($href) . "' class='parent'>Lobby</a></li>";
         } else {
             $html = '<li class="item ' . $extraClass . '" id="' . $id . '">';
             if ($href == "") {
                 $html .= $text;
             } else {
                 if ($href === "htmlContent") {
                     $html .= $text;
                 } else {
                     $html .= \Lobby::l($href, $text);
                 }
             }
             $html .= '</li>';
         }
     }
     return $html;
 }
Exemple #2
0
              <?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 
        echo $data['name'];
        ?>
</a>
                  </td>
                  <td><?php 
        echo $data['version'];
        ?>
</td>
                  <td><?php 
        echo $data['short_description'];
        ?>
</td>
                  <td style="//text-align:center;">
Exemple #3
0
 public function u($path = null, $src = false)
 {
     $path = ltrim($path, "/");
     return $path === null ? \Lobby::u() : ($src ? $this->srcURL : $this->url) . "/{$path}";
 }
Exemple #4
0
<?php

$notifications = Lobby\DB::getJSONOption("notify_items");
/**
 * If there is a update available either app or core, add a Notify item
 */
if (\Lobby\Update::isAvailable()) {
    $notifications["update"] = array("contents" => "New Updates Are Available", "icon" => "update", "iconURL" => null, "href" => \Lobby::u("/admin/update.php"));
}
echo json_encode($notifications);
Exemple #5
0
<?php

unset($_SESSION['kerala-it-exam-rid']);
unset($_SESSION['kerala-it-exam-qs']);
unset($_SESSION['kerala-it-exam-class']);
?>
<div class="contents">
  <h1>Please Wait....</h1>
  <p>I'm doing some ninja stuff. So, please wait for 2 seconds. :-)</p>
  <script>
  localStorage["end_time"] = "invalid"; // In case `delete` didn't work
  delete localStorage["end_time"];
  setTimeout(function(){
    window.location = "<?php 
echo \Lobby::u("/app/kerala-it-exam");
?>
";
  }, 50);
  </script>
</div>
Exemple #6
0
                     * 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>
                    <tr>
                      <td>Database Host</td>
                      <td>
                        <input type="text" name="dbhost" value="localhost">
                      </td>
                      <td>On Most Systems, It's localhost</td>
                    </tr>
                    <tr>
                      <td>Database Port</td>
                      <td>
                        <input type="text" name="dbport" value="3306">
Exemple #7
0
<html>
  <head>
    <?php 
\Hooks::doAction("head.begin");
\Response::head("Admin Login");
?>
  </head>
  <body>
    <?php 
\Hooks::doAction("body.begin");
?>
    <div id="workspace">
      <div class="contents">
        <h2>Log In</h2>
        <form method="POST" action="<?php 
echo \Lobby::u("/admin/login");
?>
">
          <label clear>
            <span clear>Username</span>
            <input clear type="text" name="username" value="<?php 
if (isset($_POST['username'])) {
    echo htmlspecialchars($_POST['username']);
}
?>
" />
          </label>
          <label clear>
            <span clear>Password</span>
            <input clear type="password" name="password" id="password" />
            <?php 
Exemple #8
0
 /**
  * A redirect function that support HTTP status code for redirection 
  * 302 = Moved Temporarily
  */
 public static function redirect($url, $status = 302)
 {
     $url = \Lobby::u($url);
     header("Location: {$url}", true, $status);
     exit;
 }
Exemple #9
0
  <head>
    <?php 
\Hooks::doAction("admin.head.begin");
\Response::head("Admin");
?>
  </head>
  <body>
    <?php 
\Hooks::doAction("admin.body.begin");
?>
    <div id="workspace">
      <div class="contents">
        <h1>Admin</h1>
        <?php 
if (\Lobby\Update::isAvailable()) {
    echo sss("Updates Available", "Some updates are available for you to update. Yay!<cl/><a class='btn blue' href='" . \Lobby::u("/admin/update.php") . "'>See Updates</a>");
}
?>
        <p>Manage your Lobby installation.</p>
        <?php 
echo \Lobby::l("admin/settings.php", "Settings", "class='btn red'") . "&nbsp;";
echo \Lobby::l("admin/apps.php", "Apps", "class='btn green'") . "&nbsp;";
echo \Lobby::l("admin/lobby-store.php", "Lobby Store", "class='btn pink'") . "&nbsp;";
if (\Lobby\Modules::exists("admin")) {
    echo \Lobby::l("admin/login?logout=true", "Log Out", "class='btn'");
}
?>
        <h2>About</h2>
        <p>You are using <b>Lobby <?php 
echo \Lobby::getVersion();
?>
Exemple #10
0
              <div class="app col s12 m6 l4">
                <div class="app-inner card row">
                  <div class="lpane col s4 m5 l5">
                    <a href="<?php 
            echo \Lobby::u("/admin/apps.php?app={$app}");
            ?>
">
                      <img src="<?php 
            echo $App->info["logo"];
            ?>
" />
                    </a>
                  </div>
                  <div class="rpane col s8 m6 l7">
                    <a href="<?php 
            echo \Lobby::u("/admin/apps.php?app={$app}");
            ?>
" class="name truncate" title="<?php 
            echo $App->info["name"];
            ?>
"><?php 
            echo $App->info["name"];
            ?>
</a>
                    <div class="actions">
                      <?php 
            if ($App->hasUpdate()) {
                echo "<cl/>" . \Lobby::l("/admin/update.php", "Update", "class='btn orange'");
            } else {
                if ($App->enabled) {
                    echo \Lobby::l("/admin/apps.php?app={$app}&action=disable" . CSRF::getParam(), "Disable", "class='btn'");
Exemple #11
0
  <p>Make a standalone Lobby app.</p>
  <h2>Config</h2>
  <?php 
$appID = Request::postParam("appID");
if ($appID !== null && CSRF::check()) {
    if ($appID === "") {
        $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();
Exemple #12
0
<?php

$GLOBALS['AppID'] = $AppID;
?>
<html>
  <head>
    <?php 
\Lobby::doHook("head.begin");
?>
    <script>
      window.tmp = {};window.lobbyExtra = {};<?php 
if (isset($AppID)) {
    echo 'lobbyExtra["app"] = { id: "' . $AppID . '", url: "' . APP_URL . '", src: "' . \Lobby::u("/contents/apps/{$AppID}") . '" };';
}
?>
</script>
    <?php 
\Lobby::head();
\Lobby::doHook("head.end");
?>
  </head>
  <body>
    <?php 
\Lobby::doHook("body.begin");
?>
    <div class="workspace" <?php 
if (isset($AppID)) {
    echo 'id="' . $AppID . '"';
}
?>
>
Exemple #13
0
 public function appAdminSetup()
 {
     Router::route("/admin/app/[:appID]?/[**:page]?", function ($request) {
         $appID = $request->appID;
         $page = $request->page === null ? "/" : "/{$request->page}";
         $App = new \Lobby\Apps($appID);
         if (!$App->exists) {
             ser();
             return null;
         }
         Hooks::addFilter("admin.view.sidebar", function ($links) use($appID, $App) {
             $links["/admin/app/{$appID}"] = $App->info["name"];
             return $links;
         });
         Hooks::addFilter("app.manifest", function ($info) {
             $info["adminURL"] = L_URL . "/admin/app/" . $info["id"];
             return $info;
         });
         $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/admin{$page}.php");
             if ($html) {
                 Response::setPage($html);
             } else {
                 ser();
             }
         } else {
             if ($pageResponse === null) {
                 ob_start();
                 echo ser("Error", "The app '<strong>{$AppID}</strong>' does not have an Admin Page. <a clear href='" . \Lobby::u("/app/{$AppID}") . "' class='btn green'>Go To App</a>");
                 $error = ob_get_contents();
                 ob_end_clean();
                 Response::setPage($error);
             } else {
                 Response::setPage($pageResponse);
             }
         }
     });
 }
Exemple #14
0
<div class="contents">
  <h1>CSS Compressor</h1>
  <p>Paste your CSS code in the textbox below and COMPRESS !</p>
  <form action="<?php 
echo \Lobby::u();
?>
" method="POST">
    <center>
      <textarea name="code"></textarea></textarea><cl/>
      <button style="font-size: 18px;">Compress</button>
    </center>
  </form>
  <?php 
if (isset($_POST['code'])) {
    include APP_DIR . "/src/load.php";
    $code = $_POST['code'];
    $cmp = $SC->_compressor("css", $code);
    $cmp = htmlspecialchars($cmp);
    ?>
    <h2>Compressed Code</h2>
    <p>Here is the compressed code. Hurray!</p>
    <textarea><?php 
    echo $cmp;
    ?>
</textarea>
  <?php 
}
?>
  <style>
    textarea{height: 200px;width: 600px;}
  </style>
Exemple #15
0
 function getAuthorName($id = 1)
 {
     $sql = \Lobby\DB::getDBH()->prepare("SELECT `name` FROM `users` WHERE `id` = ?");
     $sql->execute(array($id));
     return $sql->fetchColumn();
 }
 function getRating($id)
 {
     $GLOBALS['star']->id = "app-{$id}";
     return $GLOBALS['star']->getRating("", "rate_value");
 }
 $i = 0;
 foreach ($results as $r) {
     $response['apps'][$i] = $r;
     $response['apps'][$i]['author'] = getAuthorName($r['author']);
     $response['apps'][$i]['author_page'] = \Lobby::u("/u/{$r['author']}");
     $response['apps'][$i]['description'] = $Parsedown->text(htmlspecialchars($r['description']));
     $response['apps'][$i]['image'] = L_URL . "/api/app/{$r['id']}/logo";
     $response['apps'][$i]['permalink'] = L_URL . "/apps/{$r['id']}";
     $response['apps'][$i]['rating'] = getRating($r['id']) . "/5";
     $response['apps'][$i]['requires'] = json_decode($r['requires'], true);
     /**
      * If `lobby` param is not present then,
      * client is using Lobby < 0.6
      */
     if (!isset($_POST["lobby"])) {
         $response['apps'][$i]['requires']["lobby"] = array(">=", "0.6");
     }
     /**
      * Recommended : Singular word
      * For versions >=0.7
Exemple #16
0
    if ($q !== null) {
        $params = array("q" => $_GET['q']);
    } else {
        $params = array("get" => "popular");
    }
    if ($p !== null) {
        $params["p"] = $p;
    }
    $server_response = \Lobby\Server::store($params);
    if ($server_response == false) {
        echo ser("Nothing Found", "Nothing was found that matches your criteria. Sorry...");
    } else {
        echo "<div class='apps row'>";
        foreach ($server_response['apps'] as $app) {
            $appImage = $app['image'] != "" ? $app['image'] : L_URL . "/includes/lib/lobby/image/blank.png";
            $url = \Lobby::u("/admin/lobby-store.php?app={$app['id']}");
            ?>
                <div class="app card col s12 m6 l6">
                  <div class="app-inner row">
                    <div class="lpane col s4 m5 l4">
                      <a href="<?php 
            echo $url;
            ?>
">
                        <img src="<?php 
            echo $appImage;
            ?>
" />
                      </a>
                    </div>
                    <div class="rpane col s8 m6 l8">
Exemple #17
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);
                 }
             }
         }
     }
 }