本文整理汇总了PHP中Server::getServer方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::getServer方法的具体用法?PHP Server::getServer怎么用?PHP Server::getServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server::getServer方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PrintUploadedFileInfo
// | Boston, MA 02111-1307, USA gnu@gnu.org |
// | |
// +-------------------------------------------------------------------+
/**
* @package WiFiDogAuthServer
* @copyright 2004-2006 Technologies Coeus inc.
* @version Subversion $Id$
* @link http://www.wifidog.org/
*/
/**
* Load common include file
*/
require_once 'admin_common.php';
require_once 'classes/MainUI.php';
require_once 'classes/Server.php';
Security::requirePermission(Permission::P('SERVER_PERM_EDIT_SERVER_CONFIG'), Server::getServer());
$db = AbstractDb::getObject();
$html = '';
/** Affiche les informations sur le fichier envoy� par le client
*/
function PrintUploadedFileInfo($form_name_file)
{
$html .= "Nom du fichier envoy�:" . $_FILES[$form_name_file]['name'] . "<br>";
$html .= "Taille: " . $_FILES[$form_name_file]['size'] . " octets" . "<br>";
$html .= "Mime type: " . $_FILES[$form_name_file]['type'] . "<br>";
$html .= "Nom du fichier temporaire sur le serveur: " . $_FILES[$form_name_file]['tmp_name'] . "<br>";
$html .= "Erreurs au cours du transfert: " . $_FILES[$form_name_file]['error'] . "<br>";
}
$html .= "<fieldset class=\"pretty_fieldset\">";
$html .= "<legend>" . _("NoCat user database import") . "</legend>";
if (empty($_REQUEST['action'])) {
示例2: hookMenu
/** Menu hook function */
public static function hookMenu()
{
$items = array();
if ($networks = Security::getObjectsWithPermission(Permission::P('NETWORK_PERM_EDIT_NETWORK_CONFIG'))) {
foreach ($networks as $networkId => $network) {
$items[] = array('path' => 'network/network_' . $networkId . 'edit', 'title' => sprintf(_("Edit %s"), $network->getName()), 'url' => BASE_URL_PATH . htmlspecialchars("admin/generic_object_admin.php?object_class=Network&action=edit&object_id={$networkId}"));
}
}
if (Security::hasPermission(Permission::P('SERVER_PERM_ADD_NEW_NETWORK'), Server::getServer())) {
$items[] = array('path' => 'network/network_add_new', 'title' => sprintf(_("Add a new network on this server")), 'url' => BASE_URL_PATH . htmlspecialchars("admin/generic_object_admin.php?object_class=Network&action=new_ui"));
}
$items[] = array('path' => 'network', 'title' => _('Network administration'), 'type' => MENU_ITEM_GROUPING);
return $items;
}
示例3: hookMenu
/** Menu hook function */
public static function hookMenu()
{
$items = array();
$server = Server::getServer();
if (Security::hasPermission(Permission::P('SERVER_PERM_EDIT_ROLES'), $server)) {
$items[] = array('path' => 'server/roles', 'title' => _("User roles"), 'url' => BASE_URL_PATH . htmlspecialchars("admin/generic_object_admin.php?object_class=Role&action=list"));
}
return $items;
}
示例4: defined
require_once 'classes/Node.php';
require_once 'classes/User.php';
$smarty = SmartyWifidog::getObject();
// Init ALL smarty values
$smarty->assign('googleMapsEnabled', false);
// Get information about network
$network = Network::getCurrentNetwork();
/*
* Main content
*/
// Set section of Smarty template
$smarty->assign('sectionMAINCONTENT', true);
// Set Google maps information
$smarty->assign('googleMapsEnabled', defined('GMAPS_HOTSPOTS_MAP_ENABLED') && GMAPS_HOTSPOTS_MAP_ENABLED);
if (Server::getServer()->getUseGlobalUserAccounts()) {
$server = Server::getServer();
$smarty->assign('serverNumValidUsers', $server ? $server->getTotalNumValidUsers() : 0);
$smarty->assign('serverNumOnlineUsers', $server ? $server->getTotalNumOnlineUsers() : 0);
$smarty->assign('serverNumDeployedNodes', $server ? $server->getTotalNumDeployedNodes() : 0);
$smarty->assign('serverNumOnlineNodes', $server ? $server->getNumOnlineNodes() : 0);
$smarty->assign('serverNumNonMonitoredNodes', $server ? $server->getNumOnlineNodes(true) : 0);
// Compile HTML code
$html_body = $smarty->fetch("templates/sites/indexglobaluser.tpl");
} else {
$net = Network::getCurrentNetwork();
$smarty->assign('networkNumValidUsers', $net ? $net->getNumValidUsers() : 0);
// Compile HTML code
$html_body = $smarty->fetch("templates/sites/index.tpl");
}
/*
* Don't redirect on the index page
示例5: _printPlayers
private function _printPlayers()
{
$playerlist = array();
$nbplayers = 0;
$serverinfo = Server::getServer()->serverInfo;
foreach (Server::getPlayerList() as $curPlayer) {
//Gestion de la couleur en fonction de l'équipe
if ($serverinfo['g_gametype'] != '0') {
if ($curPlayer->team == 1) {
$color = "04";
} elseif ($curPlayer->team == 2) {
$color = "02";
} elseif ($curPlayer->team == 3) {
$color = "14";
}
} else {
$color = "08";
}
$playerlist[] = "" . $color . $curPlayer->name . "";
++$nbplayers;
}
if ($nbplayers > 0) {
LeelaBotIrc::sendMessage("" . LeelaBotIrc::rmColor($serverinfo['sv_hostname']) . " : " . join(', ', $playerlist));
} else {
LeelaBotIrc::sendMessage("" . LeelaBotIrc::rmColor($serverinfo['sv_hostname']) . " : No one.");
}
}
示例6: hookMenu
/** Menu hook function */
public static function hookMenu()
{
$items = array();
$network = Network::getCurrentNetwork();
$server = Server::getServer();
if (Security::hasAnyPermission(array(array(Permission::P('NETWORK_PERM_VIEW_ONLINE_USERS'), $network)))) {
$items[] = array('path' => 'users/online_users', 'title' => _("Online Users"), 'url' => BASE_URL_PATH . "admin/online_users.php");
}
if (Security::hasPermission(Permission::P('SERVER_PERM_EDIT_SERVER_CONFIG'), $server)) {
$items[] = array('path' => 'users/import_nocat', 'title' => _("Import NoCat user database"), 'url' => BASE_URL_PATH . "admin/import_user_database.php");
}
if (Security::getObjectsWithPermission(Permission::P('NETWORK_PERM_EDIT_ANY_USER'))) {
$items[] = array('path' => 'users/user_manager', 'title' => _("User manager"), 'url' => BASE_URL_PATH . "admin/user_log.php");
}
if (Security::getObjectsWithPermission(Permission::P('NETWORK_PERM_VIEW_STATISTICS'))) {
$items[] = array('path' => 'users/statistics', 'title' => _("Statistics"), 'url' => BASE_URL_PATH . "admin/stats.php");
}
$items[] = array('path' => 'users', 'title' => _('User administration'), 'type' => MENU_ITEM_GROUPING);
return $items;
}
示例7: __construct
/**
* Constructor
*
* @return void
*
* @access public
*/
private function __construct()
{
$db = AbstractDb::getObject();
// Init Smarty
$this->smarty = SmartyWifidog::getObject();
// Set default title
if (Server::getServer()->getUseGlobalUserAccounts()) {
$this->title = _("authentication server");
} else {
$this->title = Network::getCurrentNetwork()->getName() . ' ' . _("authentication server");
}
// Init the content array
$current_content_sql = "SELECT display_area FROM content_available_display_areas\n";
$rows = array();
$db->execSql($current_content_sql, $rows, false);
foreach ($rows as $row) {
$this->_contentDisplayArray[$row['display_area']] = '';
}
}
示例8: StatsShowAwards
public function StatsShowAwards($awards)
{
$buffer = array();
$serverinfo = Server::getServer()->serverInfo;
foreach ($awards as $award => $infos) {
if ($infos !== NULL) {
$player = Server::getPlayer($infos[0]);
if ($serverinfo['g_gametype'] != '0') {
if ($player->team == 1) {
$color = "04";
} elseif ($player->team == 2) {
$color = "02";
} elseif ($player->team == 3) {
$color = "14";
}
} else {
$color = "08";
}
$buffer[] = $infos[1] . " " . $award . ' : ' . $color . $player->name . "";
} else {
$buffer[] = $award . ' : nobody';
}
}
LeelaBotIrc::privmsg($this->config['MainChannel'], "Awards on " . LeelaBotIrc::rmColor($serverinfo['sv_hostname']) . " : " . join(' | ', $buffer));
}
示例9: getLoginUI
/**
* Get the login interface
* @param string $userData=null Array of contextual data optionally sent to the method.
* The function must still function if none of it is present.
*
* * This method understands:
* $userData['preSelectedUser'] An optional User object.
* @return HTML markup
*/
public static function getLoginUI($userData = null)
{
require_once 'classes/SmartyWifidog.php';
$networkUserData = null;
if (!empty($userData['preSelectedUser'])) {
$selectedUser = $userData['preSelectedUser'];
$networkUserData['preSelectedObject'] = $selectedUser;
} else {
$selectedUser = null;
}
$smarty = SmartyWiFiDog::getObject();
// Set network selector
$network_array = Network::getAllNetworks();
$default_network = Network::getDefaultNetwork();
foreach ($network_array as $network) {
if ($network->getName() == $default_network->getName()) {
$default_network_param = $network->getId();
}
}
if (Server::getServer()->getUseGlobalUserAccounts()) {
$smarty->assign('selectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='{$default_network_param}' />");
} else {
$smarty->assign('selectNetworkUI', Network::getSelectUI('auth_source', $networkUserData));
}
// Set user details
$smarty->assign('user_id', $selectedUser ? $selectedUser->getId() : "");
$smarty->assign('username', $selectedUser ? $selectedUser->getUsername() : "");
// Set error message
$smarty->assign('error', self::$_loginLastError);
// Check if one of the network allow signup
$network_array = Network::getAllNetworks();
$networksAllowingSignup = null;
foreach ($network_array as $network) {
if ($network->getAuthenticator()->isRegistrationPermitted()) {
$networksAllowingSignup[] = $network;
}
}
//pretty_print_r($networksAllowingSignup);
if (count($networksAllowingSignup) > 0) {
//FIXME: This is far from ideal, it assumes that all networks use the same signup URL, or that only one network allows signup.
$smarty->assign('signupUrl', $networksAllowingSignup[0]->getAuthenticator()->getSignupUrl());
}
// Compile HTML code
$html = self::ArrayToHiddenInput($_POST);
//This must remain BEFORE the actual form. It allws repeating the request if the login attempt is causes by a session timeout or insufficient permissions.
$html .= $smarty->fetch("templates/classes/Authenticator_getLoginForm.tpl");
return $html;
}
示例10: array
$sources = array();
// Preserve keys
$network_array = Network::getAllNetworks();
foreach ($network_array as $network) {
if ($network->getAuthenticator()->isRegistrationPermitted()) {
$sources[$network->getId()] = $network->getName();
}
}
if (isset($sources)) {
$smarty->assign('auth_sources', $sources);
}
// Pass the account_origin along, if it's set
if (isset($_REQUEST["auth_source"])) {
$smarty->assign('selected_auth_source', $_REQUEST["auth_source"]);
}
if (Server::getServer()->getUseGlobalUserAccounts()) {
$default_network_param = Network::getDefaultNetwork()->getId();
$smarty->assign('SelectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='{$default_network_param}' />");
} else {
$smarty->assign('SelectNetworkUI', Network::getSelectUI('auth_source'));
}
// Compile HTML code
$html_body = $smarty->fetch("templates/sites/lost_password.tpl");
/*
* Render output
*/
$ui = MainUI::getObject();
$ui->addContent('left_area_middle', $html);
$ui->addContent('main_area_middle', $html_body);
$ui->display();
/*
示例11: IrcStats
public function IrcStats($pseudo, $channel, $cmd, $message)
{
$server = LeelaBotIrc::nameOfServer($cmd[2], FALSE);
$actual = Server::getName();
if (isset($cmd[1])) {
if ($server !== false) {
Server::setServer($this->_main->servers[$server]);
$target = Server::searchPlayer(trim($cmd[1]));
if (!$target) {
LeelaBotIrc::sendMessage("Unknown player");
} elseif (is_array($target)) {
$players = array();
foreach ($target as $p) {
$players[] = Server::getPlayer($p)->name;
}
LeelaBotIrc::sendMessage("Multiple players found : " . join(', ', $players));
} else {
$buffer = array();
$_stats = Server::get('stats');
$_awards = Server::get('awards');
$player = Server::getPlayer($target);
if ($_stats[$player->id]['deaths'] != 0) {
$ratio = $_stats[$player->id]['kills'] / $_stats[$player->id]['deaths'];
} else {
$ratio = $_stats[$player->id]['kills'];
}
if (in_array('hits', $this->config['ShowStats'])) {
//Gestion des hits en fonction de la configuration du plugin de stats
$hits = "Hits : " . $_stats[$player->id]['hits'] . " - ";
}
if (Server::getServer()->serverInfo['g_gametype'] == 7) {
//Gestion des caps uniquement en CTF
$caps = " - Caps : " . $_stats[$player->id]['caps'];
}
LeelaBotIrc::sendMessage("Stats de " . $player->name . " : " . $hits . "Kills : " . $_stats[$player->id]['kills'] . " - Deaths : " . $_stats[$player->id]['deaths'] . " - Ratio : " . $ratio . $caps . " - Streaks : " . $_stats[$player->id]['streaks']);
}
Server::setServer($this->_main->servers[$actual]);
}
} else {
LeelaBotIrc::sendMessage("Player name missing");
}
}
示例12: hookMenu
/** Menu hook function */
public static function hookMenu()
{
$items = array();
$server = Server::getServer();
if (Security::hasAnyPermission(array(array(Permission::P('SERVER_PERM_EDIT_CONTENT_LIBRARY'), $server)))) {
$items[] = array('path' => 'server/content_library', 'title' => _("Reusable content library"), 'url' => BASE_URL_PATH . htmlspecialchars("admin/generic_object_admin.php?object_class=Content&action=list"));
}
return $items;
}
示例13: SrvEventHit
public function SrvEventHit($player, $shooter, $partOfBody, $weapon)
{
$shooter = Server::getPlayer($shooter);
$player = Server::getPlayer($player);
$gametype = Server::getServer()->serverInfo['g_gametype'];
if ($shooter->team == $player->team and !in_array($gametype, array(Server::GAME_FFA, Server::GAME_LMS))) {
$warns = $this->_addWarn($shooter->id, $player->id);
Rcon::say('Warning : $shooter has team hit $player ! (He has $warns warnings)', array('shooter' => $shooter->name, 'player' => $player->name, 'warns' => $warns));
Rcon::tell($player->id, 'Please type !fp if you want to forgive him.');
}
}