当前位置: 首页>>代码示例>>PHP>>正文


PHP Lobby类代码示例

本文整理汇总了PHP中Lobby的典型用法代码示例。如果您正苦于以下问题:PHP Lobby类的具体用法?PHP Lobby怎么用?PHP Lobby使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Lobby类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDependencyVersion

 /**
  * Get Version of a component
  */
 public static function getDependencyVersion($dependency)
 {
     /**
      * If dependency is 'app/admin' etc.
      */
     if (strpos($dependency, "/") !== false) {
         list($dependency, $subDependency) = explode("/", $dependency);
     }
     switch ($dependency) {
         case "lobby":
             return \Lobby::getVersion();
             break;
         case "app":
             $App = new Apps($subDependency);
             return $App->exists ? $App->info["version"] : 0;
             break;
         case "curl":
             $curl = function_exists("curl_version") ? curl_version() : 0;
             return $curl === 0 ? 0 : $curl["version"];
             break;
         default:
             /**
              * phpversion() returns FALSE on failure
              */
             $v = phpversion($dependency);
             return $v ? $v : 0;
     }
 }
开发者ID:LobbyOS,项目名称:server,代码行数:31,代码来源:Need.php

示例2: makePanelItem

 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;
 }
开发者ID:LobbyOS,项目名称:server,代码行数:29,代码来源:Theme.php

示例3: init

 public function init()
 {
     if (!\Lobby::status("lobby.assets-serve")) {
         $this->addScript("filepicker.js");
         $this->addStyle("filepicker.css");
     }
 }
开发者ID:LobbyOS,项目名称:server,代码行数:7,代码来源:Module.php

示例4: loadTheme

 /**
  * Load a theme
  */
 public static function loadTheme()
 {
     require_once L_DIR . "/includes/src/UI/Theme.php";
     require_once THEME_DIR . "/Theme.php";
     $className = "\\Lobby\\UI\\Themes\\" . self::$theme;
     $GLOBALS["THEME_OBJ"] = new $className();
     $GLOBALS["THEME_OBJ"]->init();
     /**
      * Load Panel
      */
     if (\Lobby::status("lobby.admin")) {
         \Lobby::hook("admin.head.begin", function () {
             $GLOBALS["THEME_OBJ"]->panel(true);
             $GLOBALS["THEME_OBJ"]->addStyle("/style.css");
             $GLOBALS["THEME_OBJ"]->addStyle("/admin.style.css");
         });
         \Lobby::hook("admin.body.begin", function () {
             echo $GLOBALS["THEME_OBJ"]->inc("/Panel/load.admin.php");
         });
     } else {
         $GLOBALS["THEME_OBJ"]->addStyle("/style.css");
         \Lobby::hook("head.begin", function () {
             $GLOBALS["THEME_OBJ"]->panel(false);
         });
         \Lobby::hook("body.begin", function () {
             echo $GLOBALS["THEME_OBJ"]->inc("/Panel/load.php");
         });
     }
 }
开发者ID:saviobosco,项目名称:lobby,代码行数:32,代码来源:Themes.php

示例5: __constructStatic

 public static function __constructStatic()
 {
     /**
      * Get DB config
      */
     $config = \Lobby::config(true);
     if (is_array($config)) {
         /**
          * Make DB credentials variables from the config.php file
          */
         self::$prefix = $config['prefix'];
         self::$type = $config['type'];
         $options = array(\PDO::ATTR_PERSISTENT => true, \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION);
         try {
             if ($config['type'] === 'mysql') {
                 self::$dbh = new \PDO("mysql:dbname={$config['dbname']};host={$config['host']};port={$config['port']};charset=utf8;", $config['username'], $config['password'], $options);
                 /**
                  * Check if Lobby tables exist
                  */
                 $notable = false;
                 $tables = array("options", "data");
                 // The Tables of Lobby
                 foreach ($tables as $tableName) {
                     $results = self::$dbh->prepare("SHOW TABLES LIKE ?");
                     $results->execute(array(self::$prefix . $tableName));
                     if ($results->rowCount() == 0) {
                         $notable = true;
                     }
                 }
             } else {
                 if ($config['type'] === 'sqlite') {
                     self::$dbh = new \PDO("sqlite:" . \Lobby\FS::loc($config['path']), "", "", $options);
                     /**
                      * Enable Multithreading Read/Write
                      */
                     self::$dbh->exec("PRAGMA journal_mode=WAL;");
                     /**
                      * Check if Lobby tables exist
                      */
                     $sql = self::$dbh->query("SELECT COUNT(1) FROM `sqlite_master` WHERE `type` = 'table' AND (`name` = 'l_data' OR `name` = 'l_options')");
                     $notable = $sql->fetchColumn() === "2" ? false : true;
                 }
             }
             if ($notable === false) {
                 /* There are database tables */
                 parent::$installed = true;
             } else {
                 parent::log(array("fatal", "Tables required by Lobby was not found in the database. Check your <b>config.php</b> and database to fix the error. Or Install again by removing <b>config.php</b>."));
             }
         } catch (\PDOException $e) {
             parent::$installed = false;
             $error = $e->getMessage();
             parent::log(array("fatal", "Unable to connect to database server. Is the database credentials given in <b>config.php</b> correct ? <blockquote>{$error}</blockquote>"));
         }
     } else {
         self::$installed = false;
     }
 }
开发者ID:LobbyOS,项目名称:server,代码行数:58,代码来源:DB.php

示例6: lookForLobby

 static function lookForLobby()
 {
     $database = DB::getInstance();
     if (self::isUserInLobby()) {
         return Lobby::viewLobby();
     } else {
         return ['loadview' => 'loadingpage', 'randomTip' => self::getRandomTip()];
     }
 }
开发者ID:Carl-the-menace,项目名称:RoadToDevGlobal,代码行数:9,代码来源:LobbyLoader.class.php

示例7: __constructStatic

 public static function __constructStatic()
 {
     if (!isset($_COOKIE['csrfToken'])) {
         self::$token = Helper::randStr(10);
         setcookie("csrfToken", self::$token, 0, "/", Lobby::getHostname());
     } else {
         self::$token = $_COOKIE['csrfToken'];
     }
 }
开发者ID:LobbyOS,项目名称:server,代码行数:9,代码来源:CSRF.php

示例8: MasterAdd

 public function MasterAdd($id, $name, $description, $password)
 {
     $random_salt = \Lobby::randStr(15);
     $hashed = hash("sha512", $this->master_salt . $password . $random_salt);
     if (!$this->MasterExists($id)) {
         saveData("master_" . $id . "_name", $name);
         saveData("master_" . $id . "_description", $description);
         saveData("master_" . $id . "_password", $hashed);
         saveData("master_" . $id . "_password_salt", $random_salt);
         saveData("master_" . $id . "_items", '');
         \H::saveJSONData("keyrings", array($id => 1));
         return true;
     } else {
         return false;
     }
 }
开发者ID:saviobosco,项目名称:lobby,代码行数:16,代码来源:App.php

示例9: init

 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");
         }
     }
 }
开发者ID:LobbyOS,项目名称:server,代码行数:44,代码来源:Module.php

示例10: init

 public static function init()
 {
     $root = L_DIR;
     $config = \Lobby::config(true);
     if (is_array($config)) {
         /**
          * Make DB credentials variables from the config.php file
          */
         self::$prefix = $config['prefix'];
         $options = array(\PDO::ATTR_PERSISTENT => true, \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION);
         try {
             self::$dbh = new \PDO("mysql:dbname={$config['dbname']};host={$config['host']};port={$config['port']}", $config['username'], $config['password'], $options);
             $notable = false;
             $tables = array("options", "data");
             // The Tables of Lobby
             foreach ($tables as $tableName) {
                 $results = self::$dbh->prepare("SHOW TABLES LIKE ?");
                 $results->execute(array(self::$prefix . $tableName));
                 if ($results->rowCount() == 0) {
                     $notable = true;
                 }
             }
             if ($notable === false) {
                 /* There are database tables */
                 parent::$installed = true;
             } else {
                 self::$error = "Lobby Tables Not Found";
                 self::log("Lobby Tables not found in database. Install Again.");
             }
         } catch (\PDOException $e) {
             parent::$installed = false;
             $error = $e->getMessage();
             self::$error = $error;
             $GLOBALS['initError'] = array("Couldn't Connect To Database", "Unable to connect to database server. Is the credentials given in <b>config.php</b> correct ? <blockquote>" . $error . "</blockquote>");
             self::log("Unable to connect to database server : " . $error);
         }
     } else {
         self::$installed = false;
     }
 }
开发者ID:anandubajith,项目名称:lobby,代码行数:40,代码来源:Database.php

示例11: check

 /**
  * Get updates
  */
 public static function check()
 {
     $apps = array_keys(\Lobby\Apps::getApps());
     $response = \Lobby::loadURL(L_SERVER . "/updates", array("apps" => implode(",", $apps)), "POST");
     if ($response) {
         $response = json_decode($response, true);
         if (is_array($response)) {
             saveOption("lobby_latest_version", $response['version']);
             saveOption("lobby_latest_version_release", $response['released']);
             if (isset($response['apps']) && count($response['apps']) != 0) {
                 $AppUpdates = array();
                 foreach ($response['apps'] as $appID => $version) {
                     $App = new \Lobby\Apps($appID);
                     if ($App->info['version'] != $version) {
                         $AppUpdates[$appID] = $version;
                     }
                 }
                 saveOption("app_updates", json_encode($AppUpdates));
             }
         }
     }
 }
开发者ID:saviobosco,项目名称:lobby,代码行数:25,代码来源:Server.php

示例12:

            \Lobby::ser("Output Path problem", "The path you gave as output doesn't exist or permission is not acceptable. Make sure it's an existing directory with Read & Write permission", false);
        } else {
            if (!ctype_alnum(str_replace(" ", "", $name))) {
                \Lobby::ser("Invalid Name", "Only alphanumeric characters are allowed for Site Name", false);
            } else {
                if (array_search($theme, $this->themes) === false) {
                    \Lobby::ser("Invalid Theme", "The theme you selected doesn't exist", false);
                } else {
                    // Everything's great
                    $this->addSite($name, $output, $theme);
                    \Lobby::sss("Site added", "The site was added successfully");
                }
            }
        }
    } else {
        \Lobby::ser("Fill Up", "Please fill the form completely", false);
    }
}
?>
  <form action="" method="POST">
    <label>
      <div>Site Name</div>
      <input type="text" name="site" />
    </label><cl/>
    <label>
      <div>Output Location</div>
      <input type="text" name="output" title="Where the generated site should be extracted" />
    </label><cl/>
    <label>
      <div>Empty Output location</div>
      <input type="checkbox" name="empty" title="Should the contents of output directory be removed before generating the site everytime" />
开发者ID:LobbyOS,项目名称:app-sige,代码行数:31,代码来源:new.php

示例13: User

require_once 'includes/header.php';
$uid = $_SESSION['id'];
$lid = $_GET['id'];
$request = $_GET['request'];
$team = $_GET['team'];
$class = $_GET['class'];
$ready = $_GET['ready'];
$lat = $_GET['latitude'];
$lon = $_GET['longitude'];
$fid = $_GET['fid'];
$message = $_GET['message'];
if ($uid) {
    $user = new User($uid);
}
if ($lid) {
    $lobby = new Lobby($lid);
}
if ($uid && $lid) {
    $id = getLPid($uid, $lid);
}
if ($uid && $lid) {
    switch ($request) {
        case "userready":
            $status = readystatus($id, true);
            $leader = $lobby->lobbyLeader();
            $array = array('ready' => $status, 'leader' => $leader);
            echo json_encode($array);
            break;
        case "changeTeam":
            if (isset($team) && freeslots($lid, $team) > 0) {
                joinTeam($id, $team);
开发者ID:marat1803,项目名称:tf2matchmaking,代码行数:31,代码来源:api.php

示例14: array

<?php

if (!\Lobby::status("lobby.serve")) {
    /**
     * For enabling access by \Lobby\Panel
     */
    require __DIR__ . "/class.panel.php";
    /**
     * Panel UI
     */
    if (!\Lobby::status("lobby.install")) {
        \Lobby::addScript("superfish", "/includes/lib/modules/panel/lib/superfish.js");
        \Lobby::addStyle("panel", "/includes/lib/modules/panel/lib/panel.css");
        \Lobby::addScript("panel", "/includes/lib/modules/panel/lib/panel.js");
    }
    if (\Lobby::$config['server_check'] === true) {
        /**
         * Default Items provided by the module
         */
        \Lobby\Panel::addTopItem("netStatus", array("html" => "<span id='net' title='Online'></span>", "position" => "right"));
        \Lobby::addScript("panel-item-connection", "/includes/lib/modules/panel/connection/connection.js");
    }
    \Lobby::hook("body.begin", function () {
        include __DIR__ . "/panel.ui.php";
    });
    \Lobby::hook("admin.body.begin", function () {
        include __DIR__ . "/panel.ui.php";
    });
}
开发者ID:anandubajith,项目名称:lobby,代码行数:29,代码来源:load.php

示例15: foreach

<div class="contents">
  <h2>sige</h2>
  <p>Manage Pages of site <strong><?php 
echo $name;
?>
</strong></p>
  <p>
    <?php 
echo \Lobby::l("{$su}/edit", "New Page", "class='button'");
$pages = $this->getPages($name);
if (count($pages) == 0) {
    \Lobby::ser("No Pages", "No pages has been created.");
    echo '<p><strong>Note that a page called "index" should be created in the site.</strong></p>';
} else {
    echo "<h3>Pages</h3>";
    foreach ($pages as $id => $page) {
        echo \Lobby::l("{$su}/edit?id={$id}", "{$id}", "class='button'") . "<cl/>";
    }
}
?>
  </p>
</div>
开发者ID:LobbyOS,项目名称:app-sige,代码行数:22,代码来源:pages.php


注:本文中的Lobby类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。