Changed mControl to ManiaControl
This commit is contained in:
parent
97f9a6019a
commit
5d166776f8
6
application/ManiaControl.bat
Normal file
6
application/ManiaControl.bat
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
REM Set the path to your php.exe here
|
||||||
|
set phpPath="D:\Programme\xampp\php\php.exe"
|
||||||
|
|
||||||
|
REM Start ManiaControl
|
||||||
|
START "" /B %phpPath% -f "ManiaControl.php" 2>&1
|
26
application/ManiaControl.php
Normal file
26
application/ManiaControl.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ManiaControl;
|
||||||
|
|
||||||
|
define('ManiaControlDir', __DIR__);
|
||||||
|
|
||||||
|
require_once __DIR__ . '/core/core.ManiaControl.php';
|
||||||
|
|
||||||
|
// Set process settings
|
||||||
|
ini_set('memory_limit', '128M');
|
||||||
|
if (function_exists('date_default_timezone_get') && function_exists('date_default_timezone_set')) {
|
||||||
|
date_default_timezone_set(@date_default_timezone_get());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error handling
|
||||||
|
ini_set('log_errors', 1);
|
||||||
|
ini_set('error_reporting', -1);
|
||||||
|
ini_set('error_log', 'ManiaControl_' . getmypid() . '.log');
|
||||||
|
|
||||||
|
// Start ManiaControl
|
||||||
|
error_log('Loading ManiaControl v' . ManiaControl::VERSION . '!');
|
||||||
|
|
||||||
|
$maniaControl = new ManiaControl();
|
||||||
|
$maniaControl->run(true);
|
||||||
|
|
||||||
|
?>
|
3
application/ManiaControl.sh
Normal file
3
application/ManiaControl.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
php ManiaControl.php 2>&1 &
|
||||||
|
echo $! > ManiaControl.pid
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Configure how mControl sends chat message -->
|
<!-- Configure how ManiaControl sends chat message -->
|
||||||
<chat-config>
|
<chat-config>
|
||||||
|
|
||||||
<!-- Set which codes should be used to compose chat messages -->
|
<!-- Set which codes should be used to compose chat messages -->
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Core configuration for mControl -->
|
<!-- Core configuration for ManiaControl -->
|
||||||
<core-config>
|
<core-config>
|
||||||
|
|
||||||
<!-- Connection timeout -->
|
<!-- Connection timeout -->
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Configure the mysql database used by mControl -->
|
<!-- Configure the mysql database used by ManiaControl -->
|
||||||
<database-config>
|
<database-config>
|
||||||
|
|
||||||
<!-- MySQL Server -->
|
<!-- MySQL Server -->
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Configure the United plugin -->
|
<!-- Configure the United plugin -->
|
||||||
<!-- Note: You should disable the config server.mControl.xml while using this plugin -->
|
<!-- Note: You should disable the config server.ManiaControl.xml while using this plugin -->
|
||||||
<united-config>
|
<united-config>
|
||||||
|
|
||||||
<!-- Enable the whole plugin -->
|
<!-- Enable the whole plugin -->
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class handling authentication levels
|
* Class handling authentication levels
|
||||||
@ -28,7 +28,7 @@ class Authentication {
|
|||||||
$this->mControl = $mControl;
|
$this->mControl = $mControl;
|
||||||
|
|
||||||
// Load config
|
// Load config
|
||||||
$this->config = Tools::loadConfig('authentication.mControl.xml');
|
$this->config = Tools::loadConfig('authentication.ManiaControl.xml');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for handling server callbacks
|
* Class for handling server callbacks
|
||||||
@ -11,15 +11,15 @@ class Callbacks {
|
|||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
// mControl callbacks
|
// ManiaControl callbacks
|
||||||
const CB_IC_1_SECOND = 'mControl.1Second';
|
const CB_IC_1_SECOND = 'ManiaControl.1Second';
|
||||||
const CB_IC_5_SECOND = 'mControl.5Second';
|
const CB_IC_5_SECOND = 'ManiaControl.5Second';
|
||||||
const CB_IC_1_MINUTE = 'mControl.1Minute';
|
const CB_IC_1_MINUTE = 'ManiaControl.1Minute';
|
||||||
const CB_IC_3_MINUTE = 'mControl.3Minute';
|
const CB_IC_3_MINUTE = 'ManiaControl.3Minute';
|
||||||
const CB_IC_ONINIT = 'mControl.OnInit';
|
const CB_IC_ONINIT = 'ManiaControl.OnInit';
|
||||||
const CB_IC_CLIENTUPDATED = 'mControl.ClientUpdated';
|
const CB_IC_CLIENTUPDATED = 'ManiaControl.ClientUpdated';
|
||||||
const CB_IC_BEGINMAP = 'mControl.BeginMap';
|
const CB_IC_BEGINMAP = 'ManiaControl.BeginMap';
|
||||||
const CB_IC_ENDMAP = 'mControl.EndMap';
|
const CB_IC_ENDMAP = 'ManiaControl.EndMap';
|
||||||
// ManiaPlanet callbacks
|
// ManiaPlanet callbacks
|
||||||
const CB_MP_SERVERSTART = 'ManiaPlanet.ServerStart';
|
const CB_MP_SERVERSTART = 'ManiaPlanet.ServerStart';
|
||||||
const CB_MP_SERVERSTOP = 'ManiaPlanet.ServerStop';
|
const CB_MP_SERVERSTOP = 'ManiaPlanet.ServerStop';
|
||||||
@ -92,7 +92,7 @@ class Callbacks {
|
|||||||
* Handles the given array of callbacks
|
* Handles the given array of callbacks
|
||||||
*/
|
*/
|
||||||
public function handleCallbacks() {
|
public function handleCallbacks() {
|
||||||
// Perform mControl callbacks
|
// Perform ManiaControl callbacks
|
||||||
if ($this->last1Second <= time() - 1) {
|
if ($this->last1Second <= time() - 1) {
|
||||||
$this->last1Second = time();
|
$this->last1Second = time();
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for chat methods
|
* Class for chat methods
|
||||||
@ -16,16 +16,16 @@ class Chat {
|
|||||||
|
|
||||||
private $config = null;
|
private $config = null;
|
||||||
|
|
||||||
private $prefix = 'mControl>';
|
private $prefix = 'ManiaControl>';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct mControl chat
|
* Construct ManiaControl chat
|
||||||
*/
|
*/
|
||||||
public function __construct($mControl) {
|
public function __construct($mControl) {
|
||||||
$this->mControl = $mControl;
|
$this->mControl = $mControl;
|
||||||
|
|
||||||
// Load config
|
// Load config
|
||||||
$this->config = Tools::loadConfig('chat.mControl.xml');
|
$this->config = Tools::loadConfig('chat.ManiaControl.xml');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for handling chat commands
|
* Class for handling chat commands
|
||||||
@ -31,7 +31,7 @@ class Commands {
|
|||||||
$this->mControl = $mControl;
|
$this->mControl = $mControl;
|
||||||
|
|
||||||
// Load config
|
// Load config
|
||||||
$this->config = Tools::loadConfig('commands.mControl.xml');
|
$this->config = Tools::loadConfig('commands.ManiaControl.xml');
|
||||||
|
|
||||||
// Register for callbacks
|
// Register for callbacks
|
||||||
$this->iControl->callbacks->registerCallbackHandler(Callbacks::CB_IC_5_SECOND, $this, 'each5Seconds');
|
$this->iControl->callbacks->registerCallbackHandler(Callbacks::CB_IC_5_SECOND, $this, 'each5Seconds');
|
||||||
@ -148,7 +148,7 @@ class Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send mControl version
|
* Send ManiaControl version
|
||||||
*/
|
*/
|
||||||
private function command_version($chat) {
|
private function command_version($chat) {
|
||||||
$login = $chat[1][1];
|
$login = $chat[1][1];
|
||||||
@ -157,7 +157,7 @@ class Commands {
|
|||||||
$this->iControl->authentication->sendNotAllowed($login);
|
$this->iControl->authentication->sendNotAllowed($login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!$this->iControl->chat->sendInformation('This server is using mControl v' . mControl::VERSION . '!', $login)) {
|
if (!$this->iControl->chat->sendInformation('This server is using ManiaControl v' . ManiaControl::VERSION . '!', $login)) {
|
||||||
trigger_error("Couldn't send version to '" . $login . "'. " . $this->iControl->getClientErrorText());
|
trigger_error("Couldn't send version to '" . $login . "'. " . $this->iControl->getClientErrorText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,7 +345,7 @@ class Commands {
|
|||||||
$this->iControl->authentication->sendNotAllowed($login);
|
$this->iControl->authentication->sendNotAllowed($login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->iControl->quit("mControl shutdown requested by '" . $login . "'");
|
$this->iControl->quit("ManiaControl shutdown requested by '" . $login . "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -504,24 +504,24 @@ class Commands {
|
|||||||
// TODO: show usage
|
// TODO: show usage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check if mControl can even write to the maps dir
|
// Check if ManiaControl can even write to the maps dir
|
||||||
if (!$this->iControl->client->query('GetMapsDirectory')) {
|
if (!$this->iControl->client->query('GetMapsDirectory')) {
|
||||||
trigger_error("Couldn't get map directory. " . $this->iControl->getClientErrorText());
|
trigger_error("Couldn't get map directory. " . $this->iControl->getClientErrorText());
|
||||||
$this->iControl->chat->sendError("mControl couldn't retrieve the maps directory.", $login);
|
$this->iControl->chat->sendError("ManiaControl couldn't retrieve the maps directory.", $login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$mapDir = $this->iControl->client->getResponse();
|
$mapDir = $this->iControl->client->getResponse();
|
||||||
if (!is_dir($mapDir)) {
|
if (!is_dir($mapDir)) {
|
||||||
trigger_error("mControl doesn't have have access to the maps directory in '" . $mapDir . "'.");
|
trigger_error("ManiaControl doesn't have have access to the maps directory in '" . $mapDir . "'.");
|
||||||
$this->iControl->chat->sendError("mControl doesn't have access to the maps directory.", $login);
|
$this->iControl->chat->sendError("ManiaControl doesn't have access to the maps directory.", $login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$dlDir = (string) $this->iControl->config->maps_dir;
|
$dlDir = (string) $this->iControl->config->maps_dir;
|
||||||
// Create mx directory if necessary
|
// Create mx directory if necessary
|
||||||
if (!is_dir($mapDir . $dlDir) && !mkdir($mapDir . $dlDir)) {
|
if (!is_dir($mapDir . $dlDir) && !mkdir($mapDir . $dlDir)) {
|
||||||
trigger_error("mControl doesn't have to rights to save maps in'" . $mapDir . $dlDir, "'.");
|
trigger_error("ManiaControl doesn't have to rights to save maps in'" . $mapDir . $dlDir, "'.");
|
||||||
$this->iControl->chat->sendError("mControl doesn't have to rights to save maps.", $login);
|
$this->iControl->chat->sendError("ManiaControl doesn't have to rights to save maps.", $login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$mapDir .= $dlDir . '/';
|
$mapDir .= $dlDir . '/';
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needed includes
|
* Needed includes
|
||||||
*/
|
*/
|
||||||
require_once __DIR__ . '/authentication.mControl.php';
|
require_once __DIR__ . '/authentication.ManiaControl.php';
|
||||||
require_once __DIR__ . '/callbacks.mControl.php';
|
require_once __DIR__ . '/callbacks.ManiaControl.php';
|
||||||
require_once __DIR__ . '/chat.mControl.php';
|
require_once __DIR__ . '/chat.ManiaControl.php';
|
||||||
require_once __DIR__ . '/commands.mControl.php';
|
require_once __DIR__ . '/commands.ManiaControl.php';
|
||||||
require_once __DIR__ . '/database.mControl.php';
|
require_once __DIR__ . '/database.ManiaControl.php';
|
||||||
require_once __DIR__ . '/server.mControl.php';
|
require_once __DIR__ . '/server.ManiaControl.php';
|
||||||
require_once __DIR__ . '/stats.mControl.php';
|
require_once __DIR__ . '/stats.ManiaControl.php';
|
||||||
require_once __DIR__ . '/tools.mControl.php';
|
require_once __DIR__ . '/tools.ManiaControl.php';
|
||||||
list($endiantest) = array_values(unpack('L1L', pack('V', 1)));
|
list($endiantest) = array_values(unpack('L1L', pack('V', 1)));
|
||||||
if ($endiantest == 1) {
|
if ($endiantest == 1) {
|
||||||
require_once __DIR__ . '/PhpRemote/GbxRemote.inc.php';
|
require_once __DIR__ . '/PhpRemote/GbxRemote.inc.php';
|
||||||
@ -22,11 +22,11 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mControl Server Controller for ManiaPlanet Server
|
* ManiaControl Server Controller for ManiaPlanet Server
|
||||||
*
|
*
|
||||||
* @author steeffeen
|
* @author steeffeen
|
||||||
*/
|
*/
|
||||||
class mControl {
|
class ManiaControl {
|
||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -67,11 +67,11 @@ class mControl {
|
|||||||
private $shutdownRequested = false;
|
private $shutdownRequested = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct mControl
|
* Construct ManiaControl
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
// Load core
|
// Load core
|
||||||
$this->config = Tools::loadConfig('core.mControl.xml');
|
$this->config = Tools::loadConfig('core.ManiaControl.xml');
|
||||||
$this->startTime = time();
|
$this->startTime = time();
|
||||||
|
|
||||||
// Load chat tool
|
// Load chat tool
|
||||||
@ -113,14 +113,14 @@ class mControl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quit mControl and log the given message
|
* Quit ManiaControl and log the given message
|
||||||
*/
|
*/
|
||||||
public function quit($message = false) {
|
public function quit($message = false) {
|
||||||
if ($this->shutdownRequested) return;
|
if ($this->shutdownRequested) return;
|
||||||
|
|
||||||
if ($this->client) {
|
if ($this->client) {
|
||||||
// Announce quit
|
// Announce quit
|
||||||
$this->chat->sendInformation('mControl shutting down.');
|
$this->chat->sendInformation('ManiaControl shutting down.');
|
||||||
|
|
||||||
// Hide manialinks
|
// Hide manialinks
|
||||||
$this->client->query('SendHideManialinkPage');
|
$this->client->query('SendHideManialinkPage');
|
||||||
@ -134,15 +134,15 @@ class mControl {
|
|||||||
// Shutdown
|
// Shutdown
|
||||||
if ($this->client) $this->client->Terminate();
|
if ($this->client) $this->client->Terminate();
|
||||||
|
|
||||||
error_log("Quitting mControl!");
|
error_log("Quitting ManiaControl!");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run mControl
|
* Run ManiaControl
|
||||||
*/
|
*/
|
||||||
public function run($debug = false) {
|
public function run($debug = false) {
|
||||||
error_log('Starting mControl v' . self::VERSION . '!');
|
error_log('Starting ManiaControl v' . self::VERSION . '!');
|
||||||
$this->debug = (bool) $debug;
|
$this->debug = (bool) $debug;
|
||||||
|
|
||||||
// Load plugins
|
// Load plugins
|
||||||
@ -154,9 +154,9 @@ class mControl {
|
|||||||
// Loading finished
|
// Loading finished
|
||||||
error_log("Loading completed!");
|
error_log("Loading completed!");
|
||||||
|
|
||||||
// Announce mControl
|
// Announce ManiaControl
|
||||||
if (!$this->chat->sendInformation('mControl v' . self::VERSION . ' successfully started!')) {
|
if (!$this->chat->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!')) {
|
||||||
trigger_error("Couldn't announce mControl. " . $this->iControl->getClientErrorText());
|
trigger_error("Couldn't announce ManiaControl. " . $this->iControl->getClientErrorText());
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnInit
|
// OnInit
|
||||||
@ -284,10 +284,10 @@ class mControl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load mControl plugins
|
* Load ManiaControl plugins
|
||||||
*/
|
*/
|
||||||
private function loadPlugins() {
|
private function loadPlugins() {
|
||||||
$pluginsConfig = Tools::loadConfig('plugins.mControl.xml');
|
$pluginsConfig = Tools::loadConfig('plugins.ManiaControl.xml');
|
||||||
if (!$pluginsConfig || !isset($pluginsConfig->plugin)) {
|
if (!$pluginsConfig || !isset($pluginsConfig->plugin)) {
|
||||||
trigger_error('Invalid plugins config.');
|
trigger_error('Invalid plugins config.');
|
||||||
return;
|
return;
|
||||||
@ -296,7 +296,7 @@ class mControl {
|
|||||||
// Load plugin classes
|
// Load plugin classes
|
||||||
$classes = get_declared_classes();
|
$classes = get_declared_classes();
|
||||||
foreach ($pluginsConfig->xpath('plugin') as $plugin) {
|
foreach ($pluginsConfig->xpath('plugin') as $plugin) {
|
||||||
$fileName = mControl . '/plugins/' . $plugin;
|
$fileName = ManiaControlDir . '/plugins/' . $plugin;
|
||||||
if (!file_exists($fileName)) {
|
if (!file_exists($fileName)) {
|
||||||
trigger_error("Couldn't load plugin '" . $plugin . "'! File doesn't exist. (/plugins/" . $plugin . ")");
|
trigger_error("Couldn't load plugin '" . $plugin . "'! File doesn't exist. (/plugins/" . $plugin . ")");
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for database connection
|
* Class for database connection
|
||||||
@ -35,8 +35,8 @@ class Database {
|
|||||||
$this->mControl = $mControl;
|
$this->mControl = $mControl;
|
||||||
|
|
||||||
// Load config
|
// Load config
|
||||||
$this->config = Tools::loadConfig('database.mControl.xml');
|
$this->config = Tools::loadConfig('database.ManiaControl.xml');
|
||||||
$this->iControl->checkConfig($this->config, array("host", "user"), 'database.mControl.xml');
|
$this->iControl->checkConfig($this->config, array("host", "user"), 'database.ManiaControl.xml');
|
||||||
|
|
||||||
// Get mysql server information
|
// Get mysql server information
|
||||||
$host = $this->config->xpath('host');
|
$host = $this->config->xpath('host');
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class providing information and commands for the connected maniaplanet server
|
* Class providing information and commands for the connected maniaplanet server
|
||||||
@ -31,7 +31,7 @@ class Server {
|
|||||||
$this->mControl = $mControl;
|
$this->mControl = $mControl;
|
||||||
|
|
||||||
// Load config
|
// Load config
|
||||||
$this->config = Tools::loadConfig('server.mControl.xml');
|
$this->config = Tools::loadConfig('server.ManiaControl.xml');
|
||||||
$this->iControl->checkConfig($this->config, array('host', 'port', 'login', 'pass'), 'server');
|
$this->iControl->checkConfig($this->config, array('host', 'port', 'login', 'pass'), 'server');
|
||||||
|
|
||||||
// Register for callbacks
|
// Register for callbacks
|
||||||
@ -60,7 +60,7 @@ class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if mControl has access to the given directory (server data directory if no param)
|
* Checks if ManiaControl has access to the given directory (server data directory if no param)
|
||||||
*
|
*
|
||||||
* @param string $directory
|
* @param string $directory
|
||||||
* @return bool
|
* @return bool
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stats class
|
* Stats class
|
||||||
@ -28,7 +28,7 @@ class Stats {
|
|||||||
$this->mControl = $mControl;
|
$this->mControl = $mControl;
|
||||||
|
|
||||||
// Load config
|
// Load config
|
||||||
$this->config = Tools::loadConfig('stats.mControl.xml');
|
$this->config = Tools::loadConfig('stats.ManiaControl.xml');
|
||||||
$this->loadSettings();
|
$this->loadSettings();
|
||||||
|
|
||||||
// Init database tables
|
// Init database tables
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for basic tools
|
* Class for basic tools
|
||||||
@ -90,7 +90,7 @@ class Tools {
|
|||||||
$query = 'GET ' . $urlData['path'] . ' HTTP/1.0' . PHP_EOL;
|
$query = 'GET ' . $urlData['path'] . ' HTTP/1.0' . PHP_EOL;
|
||||||
$query .= 'Host: ' . $urlData['host'] . PHP_EOL;
|
$query .= 'Host: ' . $urlData['host'] . PHP_EOL;
|
||||||
$query .= 'Content-Type: UTF-8' . PHP_EOL;
|
$query .= 'Content-Type: UTF-8' . PHP_EOL;
|
||||||
$query .= 'User-Agent: mControl v' . mControl::VERSION . PHP_EOL;
|
$query .= 'User-Agent: ManiaControl v' . ManiaControl::VERSION . PHP_EOL;
|
||||||
$query .= PHP_EOL;
|
$query .= PHP_EOL;
|
||||||
|
|
||||||
fwrite($fsock, $query);
|
fwrite($fsock, $query);
|
||||||
@ -205,7 +205,7 @@ class Tools {
|
|||||||
*/
|
*/
|
||||||
public static function loadConfig($fileName) {
|
public static function loadConfig($fileName) {
|
||||||
// Load config file from configs folder
|
// Load config file from configs folder
|
||||||
$fileLocation = mControl . '/configs/' . $fileName;
|
$fileLocation = ManiaControlDir . '/configs/' . $fileName;
|
||||||
if (!file_exists($fileLocation)) {
|
if (!file_exists($fileLocation)) {
|
||||||
trigger_error("Config file doesn't exist! (" . $fileName . ")", E_USER_ERROR);
|
trigger_error("Config file doesn't exist! (" . $fileName . ")", E_USER_ERROR);
|
||||||
}
|
}
|
@ -1,2 +0,0 @@
|
|||||||
REM set the path to your php.exe here
|
|
||||||
START "" /B "D:\Programme\xampp\php\php.exe" -f "mControl.php" 2>&1
|
|
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace mControl;
|
|
||||||
|
|
||||||
define('mControl', __DIR__);
|
|
||||||
|
|
||||||
require_once __DIR__ . '/core/core.mControl.php';
|
|
||||||
|
|
||||||
// Set process settings
|
|
||||||
ini_set('memory_limit', '128M');
|
|
||||||
if (function_exists('date_default_timezone_get') && function_exists('date_default_timezone_set')) {
|
|
||||||
date_default_timezone_set(@date_default_timezone_get());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error handling
|
|
||||||
ini_set('log_errors', 1);
|
|
||||||
ini_set('error_reporting', -1);
|
|
||||||
ini_set('error_log', 'iControl_' . getmypid() . '.log');
|
|
||||||
|
|
||||||
// Start mControl
|
|
||||||
error_log('Loading mControl v' . mControl::VERSION . '!');
|
|
||||||
|
|
||||||
$mControl = new mControl();
|
|
||||||
$iControl->run(true);
|
|
||||||
|
|
||||||
?>
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
php mControl.php 2>&1 &
|
|
||||||
echo $! > mControl.pid
|
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mControl Chatlog Plugin
|
* ManiaControl Chatlog Plugin
|
||||||
*
|
*
|
||||||
* @author steeffeen
|
* @author steeffeen
|
||||||
*/
|
*/
|
||||||
@ -51,7 +51,7 @@ class Plugin_Chatlog {
|
|||||||
|
|
||||||
// File name
|
// File name
|
||||||
$fileName = (string) $this->config->filename;
|
$fileName = (string) $this->config->filename;
|
||||||
$this->settings->fileName = mControl . '/' . $fileName;
|
$this->settings->fileName = ManiaControlDir . '/' . $fileName;
|
||||||
|
|
||||||
// log_server_messages
|
// log_server_messages
|
||||||
$log_server_messages = $this->config->xpath('log_server_messages');
|
$log_server_messages = $this->config->xpath('log_server_messages');
|
||||||
@ -77,7 +77,7 @@ class Plugin_Chatlog {
|
|||||||
* @param string $login
|
* @param string $login
|
||||||
*/
|
*/
|
||||||
private function logText($text, $login = null) {
|
private function logText($text, $login = null) {
|
||||||
$message = date(mControl::DATE) . '>> ' . ($login ? $login . ': ' : '') . $text . PHP_EOL;
|
$message = date(ManiaControl::DATE) . '>> ' . ($login ? $login . ': ' : '') . $text . PHP_EOL;
|
||||||
file_put_contents($this->settings->fileName, $message, FILE_APPEND);
|
file_put_contents($this->settings->fileName, $message, FILE_APPEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mControl Karma Plugin
|
* ManiaControl Karma Plugin
|
||||||
*
|
*
|
||||||
* @author : steeffeen
|
* @author : steeffeen
|
||||||
*/
|
*/
|
||||||
@ -72,7 +72,7 @@ class Plugin_Karma {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle OnInit mControl callback
|
* Handle OnInit ManiaControl callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
*/
|
*/
|
||||||
@ -82,7 +82,7 @@ class Plugin_Karma {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle mControl BeginMap callback
|
* Handle ManiaControl BeginMap callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
*/
|
*/
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mControl Obstacle Plugin
|
* ManiaControl Obstacle Plugin
|
||||||
*
|
*
|
||||||
* @author steeffeen
|
* @author steeffeen
|
||||||
*/
|
*/
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract mControl plugin class
|
* Abstract ManiaControl plugin class
|
||||||
*/
|
*/
|
||||||
abstract class Plugin_Name {
|
abstract class Plugin_Name {
|
||||||
/**
|
/**
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
// TODO: show mix of best and next records (depending on own one)
|
// TODO: show mix of best and next records (depending on own one)
|
||||||
// TODO: enable keep-alive
|
// TODO: enable keep-alive
|
||||||
@ -11,7 +11,7 @@ namespace mControl;
|
|||||||
// TODO: threaded requests
|
// TODO: threaded requests
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mControl Records Plugin
|
* ManiaControl Records Plugin
|
||||||
*
|
*
|
||||||
* @author steeffeen
|
* @author steeffeen
|
||||||
*/
|
*/
|
||||||
@ -123,7 +123,7 @@ class Plugin_Records {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle mControl init
|
* Handle ManiaControl init
|
||||||
*/
|
*/
|
||||||
public function handleOnInit($callback = null) {
|
public function handleOnInit($callback = null) {
|
||||||
// Let manialinks update
|
// Let manialinks update
|
||||||
@ -255,8 +255,8 @@ class Plugin_Records {
|
|||||||
$serverVersion = $this->iControl->server->getVersion();
|
$serverVersion = $this->iControl->server->getVersion();
|
||||||
$serverData['ServerVersion'] = $serverVersion['Version'];
|
$serverData['ServerVersion'] = $serverVersion['Version'];
|
||||||
$serverData['ServerBuild'] = $serverVersion['Build'];
|
$serverData['ServerBuild'] = $serverVersion['Build'];
|
||||||
$serverData['Tool'] = 'mControl';
|
$serverData['Tool'] = 'ManiaControl';
|
||||||
$serverData['Version'] = mControl::VERSION;
|
$serverData['Version'] = ManiaControl::VERSION;
|
||||||
$this->dedimaniaData['serverData'] = $serverData;
|
$this->dedimaniaData['serverData'] = $serverData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ class Plugin_Records {
|
|||||||
$header .= 'Accept-Encoding: gzip;' . PHP_EOL;
|
$header .= 'Accept-Encoding: gzip;' . PHP_EOL;
|
||||||
$header .= 'Content-Type: text/xml; charset=utf-8;' . PHP_EOL;
|
$header .= 'Content-Type: text/xml; charset=utf-8;' . PHP_EOL;
|
||||||
$header .= 'Keep-Alive: 300;' . PHP_EOL;
|
$header .= 'Keep-Alive: 300;' . PHP_EOL;
|
||||||
$header .= 'User-Agent: mControl v' . mControl::VERSION . ';' . PHP_EOL;
|
$header .= 'User-Agent: ManiaControl v' . ManiaControl::VERSION . ';' . PHP_EOL;
|
||||||
$this->dedimaniaData['header'] = $header;
|
$this->dedimaniaData['header'] = $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
// TODO: Jump message "now playing stadium"
|
// TODO: Jump message "now playing stadium"
|
||||||
// TODO: put inactive server in idle (keeping same map)
|
// TODO: put inactive server in idle (keeping same map)
|
||||||
@ -9,7 +9,7 @@ namespace mControl;
|
|||||||
// TODO: max players setting
|
// TODO: max players setting
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mControl United Plugin
|
* ManiaControl United Plugin
|
||||||
*
|
*
|
||||||
* @author steeffeen
|
* @author steeffeen
|
||||||
*/
|
*/
|
||||||
@ -78,7 +78,7 @@ class Plugin_United {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle mControl OnInit callback
|
* Handle ManiaControl OnInit callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
*/
|
*/
|
||||||
@ -303,7 +303,7 @@ class Plugin_United {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build manialink url
|
// Build manialink url
|
||||||
$manialink = 'mControl?favorite';
|
$manialink = 'iControl?favorite';
|
||||||
foreach ($serverLogins as $serverLogin) {
|
foreach ($serverLogins as $serverLogin) {
|
||||||
$manialink .= '&' . $serverLogin;
|
$manialink .= '&' . $serverLogin;
|
||||||
}
|
}
|
||||||
@ -478,9 +478,9 @@ class Plugin_United {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set api version
|
// Set api version
|
||||||
if (!$client->query('SetApiVersion', mControl::API_VERSION)) {
|
if (!$client->query('SetApiVersion', ManiaControl::API_VERSION)) {
|
||||||
trigger_error(
|
trigger_error(
|
||||||
"Couldn't set API version '" . mControl::API_VERSION . "'! This might cause problems. " .
|
"Couldn't set API version '" . ManiaControl::API_VERSION . "'! This might cause problems. " .
|
||||||
$this->iControl->getClientErrorText($client));
|
$this->iControl->getClientErrorText($client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user