/**
  * 接收到数据
  * @param $client_id
  * @param $data
  * @return unknown_type
  */
 function onRecive($client_id, $data)
 {
     $this->log($data);
     $request = $this->request($data);
     $response = new Response();
     $response->head['Date'] = gmdate("D, d M Y H:i:s T");
     $response->head['Server'] = 'Swoole';
     //        $response->head['KeepAlive'] = 'off';
     //        $response->head['Connection'] = 'close';
     // $response->head['Content-type'] = 'application/json';
     //$response->body = $request->get['callback'].'('.json_encode(array('successful'=>true)).')';
     //$response->head['Content-Length'] = strlen($response->body);
     $out = $response->head();
     //$out .= $response->body;
     $this->server->send($client_id, $out);
     for ($i = 0; $i < 10; $i++) {
         $this->server->send($client_id, '<script language="javascript">alert("msg on");</script>');
         sleep(1);
     }
     //处理data的完整性
     $this->server->close($client_id);
 }
Example #2
0
$appID = \Request::get('app');
if ($appID !== null) {
    $app = \Lobby\Server::store(array("get" => "app", "id" => $appID));
    if ($app) {
        $page_title = $app['name'] . " | Lobby Store";
    }
}
?>
<html>
  <head>
    <?php 
\Assets::css("apps-grid", "/admin/css/apps-grid.css");
\Assets::css("lobby-store", "/admin/css/lobby-store.css");
\Assets::js("lobby-store", "/admin/js/lobby-store.js");
\Hooks::doAction("admin.head.begin");
\Response::head($page_title);
?>
  </head>
  <body>
    <?php 
\Hooks::doAction("admin.body.begin");
?>
    <div id="workspace">
      <div class="contents">
        <?php 
if ($appID !== null) {
    if ($app === false) {
        echo ser("404 - App Not Found", "App was not found in Lobby Store.");
    } else {
        $appImage = $app['image'] != "" ? $app['image'] : L_URL . "/includes/lib/lobby/image/blank.png";
        $c = $app['category'];
Example #3
0
<html>
  <head>
    <?php 
if (\Lobby::status("lobby.admin")) {
    \Hooks::doAction("admin.head.begin");
} else {
    \Hooks::doAction("head.begin");
}
\Response::head();
if (\Lobby::status("lobby.admin")) {
    \Hooks::doAction("admin.head.end");
} else {
    \Hooks::doAction("head.end");
}
?>
  </head>
  <body>
    <?php 
if (\Lobby::status("lobby.admin")) {
    \Hooks::doAction("admin.body.begin");
} else {
    \Hooks::doAction("body.begin");
}
?>
    <div id="workspace">
      <?php 
echo \Response::getPageContent();
?>
    </div>
  </body>
</html>
Example #4
0
<?php

require "../load.php";
?>
<html>
  <head>
    <?php 
\Hooks::doAction("admin.head.begin");
\Response::head("Modules");
?>
  </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 {
Example #5
0
            $error = array("Username / Password Wrong", "The username or password you submitted was wrong.");
        } else {
            if (is_array($login) && $login['status'] == "blocked") {
                $error = array("Account Blocked", "Too many login attempts. You can attempt login again after " . $login['minutes'] . " minutes (" . $login['seconds'] . " seconds)");
            } else {
                \Response::redirect("/admin");
            }
        }
    }
}
?>
<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>
Example #6
0
                Response::redirect("/admin/apps.php?app={$appID}&action=enable&show=1" . CSRF::getParam());
            } else {
                Response::redirect("/admin/apps.php?app={$appID}&action=enable-fail&show=1" . CSRF::getParam());
            }
        }
    }
}
?>
<html>
  <head>
    <?php 
\Assets::js("admin.apps.js", "/admin/js/apps.js");
\Assets::css("apps-grid", "/admin/css/apps-grid.css");
\Assets::css("apps", "/admin/css/apps.css");
\Hooks::doAction("admin.head.begin");
\Response::head("App Manager");
?>
  </head>
  <body>
    <?php 
\Hooks::doAction("admin.body.begin");
?>
    <div id="workspace">
      <div class="contents">
        <?php 
if ($appID !== null) {
    ?>
          <h2><?php 
    echo "<a href='" . Lobby::u("/admin/apps.php?app={$App->info['id']}") . "'>" . $App->info['name'] . "</a>";
    ?>
</h2>
Example #7
0
require "../load.php";
$install_step = Request::get('step');
?>
<!DOCTYPE html>
<html>
  <head>
    <?php 
\Lobby\UI\Themes::loadTheme();
\Hooks::doAction("head.begin");
/**
 * Install Head
 */
\Assets::css("install", "/admin/css/install.css");
\Assets::js("install", "/admin/js/install.js");
\Response::head("Install");
\Hooks::doAction("head.end");
?>
  </head>
  <body id="workspace">
     <div class="contents" id="<?php 
$steps = array("1", "2", "3", "4");
if (in_array($install_step, $steps)) {
    echo "step{$install_step}";
}
?>
">
        <h1 style="text-align: center;">
          <?php 
echo \Lobby::l(L_URL, "Install Lobby");
?>
Example #8
0
<?php

require "../load.php";
?>
<!DOCTYPE html>
<html>
  <head>
    <?php 
\Hooks::doAction("admin.head.begin");
\Assets::js("admin.apps.js", "/admin/js/install-app.js");
\Response::head("Install App");
?>
  </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 {
Example #9
0
<?php

require "../load.php";
?>
<html>
  <head>
    <?php 
\Hooks::doAction("admin.head.begin");
\Response::head("Change Settings");
?>
  </head>
  <body>
    <?php 
\Hooks::doAction("admin.body.begin");
?>
    <div id="workspace">
      <div class="contents">
        <?php 
if (isset($_GET['updated']) && CSRF::check()) {
    echo sss("Updated", "Lobby was successfully updated to Version <b>" . \Lobby::$version . "</b> from the old " . htmlspecialchars($_GET['oldver']) . " version.");
}
if (isset($_POST['update_settings']) && \CSRF::check()) {
    /**
     * Sadly, PHP supports GMT+ and not UTC+
     */
    $time_zone = $_POST['timezone'];
    if ($time_zone === "") {
        Lobby\DB::saveOption("lobby_timezone", "UTC");
        \Lobby\Time::loadConfig();
    } else {
        if (@date_default_timezone_set($time_zone)) {
Example #10
0
<?php

require "../load.php";
use Lobby\Update;
?>
<!DOCTYPE html>
<html>
  <head>
    <?php 
\Hooks::doAction("admin.head.begin");
\Response::head("Update");
?>
  </head>
  <body>
    <?php 
\Hooks::doAction("admin.body.begin");
?>
    <div id="workspace">
      <div class="contents">
        <h1>Update</h1>
        <p>Lobby and apps can be updated automatically.</p>
        <a class='btn blue' href='check-updates.php'>Check For Updates</a>
        <a href="<?php 
echo L_SERVER;
?>
/docs/update" target="_blank" class="btn pink">Help</a>
        <?php 
$action = Request::postParam("action");
$step = Request::get("step");
if ($action === null && $step === null) {
    if (Update::isCoreAvailable()) {