From 06880da7b69517836911dff4bb06f3e608a8a1ca Mon Sep 17 00:00:00 2001
From: AleaJactaEst
Date: Tue, 9 Oct 2018 18:03:04 +0200
Subject: [PATCH] update server to use new functionnality openal-manager
---
server/common/rootweb/opennelmanager.php | 49 +++--
.../common/rootweb/opennelmanager_admin.php | 170 +++++++++++++++++
.../common/rootweb/opennelmanager_config.php | 158 ++++++++++++++++
.../common/rootweb/opennelmanager_filter.php | 163 +++++++++++++++++
server/common/rootweb/opennelmanager_info.php | 158 ++++++++++++++++
server/common/rootweb/opennelmanager_log.php | 42 +++--
.../common/rootweb/opennelmanager_player.php | 171 ++++++++++++++++++
server/debian/common/khaganat.cfg | 20 ++
8 files changed, 898 insertions(+), 33 deletions(-)
create mode 100644 server/common/rootweb/opennelmanager_admin.php
create mode 100644 server/common/rootweb/opennelmanager_config.php
create mode 100644 server/common/rootweb/opennelmanager_filter.php
create mode 100644 server/common/rootweb/opennelmanager_info.php
create mode 100644 server/common/rootweb/opennelmanager_player.php
diff --git a/server/common/rootweb/opennelmanager.php b/server/common/rootweb/opennelmanager.php
index 206c87f..696db7a 100644
--- a/server/common/rootweb/opennelmanager.php
+++ b/server/common/rootweb/opennelmanager.php
@@ -67,8 +67,8 @@ table, th, td {
xhr.open("POST", url, true);
xhr.setRequestHeader("content-type", "application/json");
xhr.onreadystatechange = function () {
- console.log(xhr.readyState);
- console.log(xhr.status);
+ console.log(xhr.readyState);
+ console.log(xhr.status);
if (xhr.readyState === 4 && xhr.status === 200) {
//var json = JSON.parse(xhr.responseText);
console.log(xhr.responseText);
@@ -86,8 +86,8 @@ table, th, td {
xhr.open("POST", url, true);
xhr.setRequestHeader("content-type", "application/json");
xhr.onreadystatechange = function () {
- console.log(xhr.readyState);
- console.log(xhr.status);
+ console.log(xhr.readyState);
+ console.log(xhr.status);
if (xhr.readyState === 4 && xhr.status === 200) {
//var json = JSON.parse(xhr.responseText);
console.log(xhr.responseText);
@@ -149,7 +149,7 @@ table, th, td {
function get_port($filecfg)
{
- // $ini_array = parse_ini_file($filecfg);
+ // $ini_array = parse_ini_file($filecfg);
// return "${ini_array['port']}";
$fp = fopen($filecfg, "r");
@@ -163,7 +163,7 @@ function get_port($filecfg)
}
}
fclose($fp);
- }
+ }
return "8000";
}
@@ -178,7 +178,7 @@ if (file_exists('/home/gameserver/opennelmanager.flag')) {
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute
$result=curl_exec($ch);
// Closing
@@ -188,23 +188,40 @@ if (file_exists('/home/gameserver/opennelmanager.flag')) {
$total=count($data);
echo 'Number command:'.$total.'
';
echo "
";
- echo "Command | Start | Stop | State | Log |
";
+ echo "Command | Start | Stop | State | Num. launch | Last line log | Detail |
";
ksort($data);
foreach ($data as $key => $value)
{
- if ( $value == 'started' ) {
- $fond = "bgcolor=\"SpringGreen \"";
- } else {
- $fond = "bgcolor=\"Tomato\"";
- }
- list($type, $command) = explode(':', $key, 2);
- echo "$command | | | $value | log |
";
+ list($val1, $val2) = explode(':', $value, 2);
+ $state=$value['state'];
+ $number_launch=$value['number_launch'];
+ $number_launch=$value['number_launch'];
+ $last_line=$value['last_line'];
+ $filter=$value['filter'];
+ $egs=$value['egs'];
+ $extra="";
+ if ( $state == 'started' ) {
+ $fond = "bgcolor=\"SpringGreen \"";
+ } else {
+ $fond = "bgcolor=\"Tomato\"";
+ }
+ if ( $filter == 'True' ) {
+ $extra="$extra filter";
+ }
+ if ( $egs == 'True' ) {
+ $extra="$extra player";
+ $extra="$extra admin";
+ }
+ list($type, $command) = explode(':', $key, 2);
+ echo "$command | | ";
+ echo " | $state | <";
+ echo "td align=\"right\">$number_launch$last_line | ";
+ echo "log config info $extra |
";
}
echo "
";
} else {
echo "OpenNelManager not used";
}
-
} else {
echo "OpenNelManager not actiavted";
}
diff --git a/server/common/rootweb/opennelmanager_admin.php b/server/common/rootweb/opennelmanager_admin.php
new file mode 100644
index 0000000..a8ad93a
--- /dev/null
+++ b/server/common/rootweb/opennelmanager_admin.php
@@ -0,0 +1,170 @@
+
+
+
+ Test Khanat Config
+
+
+
+
+
+
+
+
+
+ Home
+ OpenNelManager";
+} else {
+ echo "opennelmanager not used";
+}
+?>
+ Administration
+ phpmyadmin
+ patch
+
+ KHANAT SERVER DOCKER (TEST ENVIRONMENT - ADMIN COMMAND)
+
+
+";
+ echo "Line | ";
+ foreach ($data as $key => $value)
+ {
+ foreach ($value as $key2 => $value2)
+ {
+ echo "$key2 | ";
+ }
+ break;
+ }
+ echo "
";
+ foreach ($data as $key => $value)
+ {
+ echo "$key | ";
+ foreach ($value as $key2 => $value2)
+ {
+ echo "$value2 | ";
+ }
+ }
+ echo "";
+} else {
+ echo "OpenNelManager not enabled";
+}
+?>
+
+
+ Command line :
+
+ curl -XGET --header "content-type: application/json" -d ''
+
+
+
+
+
diff --git a/server/common/rootweb/opennelmanager_config.php b/server/common/rootweb/opennelmanager_config.php
new file mode 100644
index 0000000..ec6a2a3
--- /dev/null
+++ b/server/common/rootweb/opennelmanager_config.php
@@ -0,0 +1,158 @@
+
+
+
+ Test Khanat Config
+
+
+
+
+
+
+
+
+
+ Home
+ OpenNelManager";
+} else {
+ echo "opennelmanager not used";
+}
+?>
+ Administration
+ phpmyadmin
+ patch
+
+ KHANAT SERVER DOCKER (TEST ENVIRONMENT - CONFIG)
+
+
+";
+ echo "
Key | Value |
";
+ ksort($data);
+ foreach ($data as $key => $value)
+ {
+ echo "$key | $value | ";
+ }
+ echo "";
+
+} else {
+ echo "OpenNelManager not enabled";
+}
+?>
+
+
+ Command line :
+
+ curl -XGET --header "content-type: application/json" -d ''
+
+
+
+
+
diff --git a/server/common/rootweb/opennelmanager_filter.php b/server/common/rootweb/opennelmanager_filter.php
new file mode 100644
index 0000000..4241383
--- /dev/null
+++ b/server/common/rootweb/opennelmanager_filter.php
@@ -0,0 +1,163 @@
+
+
+
+ Test Khanat Config
+
+
+
+
+
+
+
+
+
+ Home
+ OpenNelManager";
+} else {
+ echo "opennelmanager not used";
+}
+?>
+ Administration
+ phpmyadmin
+ patch
+
+ KHANAT SERVER DOCKER (TEST ENVIRONMENT - FILTER)
+
+
+ $value)
+ {
+ echo "$key
";
+ echo "";
+ echo "Key | Value |
";
+ foreach ($value as $key2 => $value2)
+ {
+ echo "$key2 | $value2 | ";
+ }
+ echo "
";
+ echo "";
+ }
+
+} else {
+ echo "OpenNelManager not enabled";
+}
+?>
+
+
+ Command line :
+
+ curl -XGET --header "content-type: application/json" -d ''
+
+
+
+
+
diff --git a/server/common/rootweb/opennelmanager_info.php b/server/common/rootweb/opennelmanager_info.php
new file mode 100644
index 0000000..db8766f
--- /dev/null
+++ b/server/common/rootweb/opennelmanager_info.php
@@ -0,0 +1,158 @@
+
+
+
+ Test Khanat Config
+
+
+
+
+
+
+
+
+
+ Home
+ OpenNelManager";
+} else {
+ echo "opennelmanager not used";
+}
+?>
+ Administration
+ phpmyadmin
+ patch
+
+ KHANAT SERVER DOCKER (TEST ENVIRONMENT - INFO)
+
+
+";
+ echo "
Key | Value |
";
+ ksort($data);
+ foreach ($data as $key => $value)
+ {
+ echo "$key | $value | ";
+ }
+ echo "";
+
+} else {
+ echo "OpenNelManager not enabled";
+}
+?>
+
+
+ Command line :
+
+ curl -XGET --header "content-type: application/json" -d ''
+
+
+
+
+
diff --git a/server/common/rootweb/opennelmanager_log.php b/server/common/rootweb/opennelmanager_log.php
index ae63491..4807589 100644
--- a/server/common/rootweb/opennelmanager_log.php
+++ b/server/common/rootweb/opennelmanager_log.php
@@ -68,8 +68,8 @@ table, th, td {
xhr.open("POST", url, true);
xhr.setRequestHeader("content-type", "application/json");
xhr.onreadystatechange = function () {
- console.log(xhr.readyState);
- console.log(xhr.status);
+ console.log(xhr.readyState);
+ console.log(xhr.status);
if (xhr.readyState === 4 && xhr.status === 200) {
//var json = JSON.parse(xhr.responseText);
console.log(xhr.responseText);
@@ -108,7 +108,7 @@ if (file_exists('/home/gameserver/opennelmanager.flag')) {
function get_port($filecfg)
{
- // $ini_array = parse_ini_file($filecfg);
+ // $ini_array = parse_ini_file($filecfg);
// return "${ini_array['port']}";
$fp = fopen($filecfg, "r");
@@ -122,7 +122,7 @@ function get_port($filecfg)
}
}
fclose($fp);
- }
+ }
return "8000";
}
@@ -136,17 +136,17 @@ if (file_exists($cfgfile)) {
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\", \"first-line\": 0}";
- $headers = array(
- "GET /STDOUT HTTP/1.0",
- 'Content-type: application/json',
+ $headers = array(
+ "GET /STDOUT HTTP/1.0",
+ 'Content-type: application/json',
'Content-Length: ' . strlen($data)
- );
+ );
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Execute
$result=curl_exec($ch);
@@ -202,7 +202,7 @@ if (file_exists($cfgfile)) {
}
}
echo "
$key | $date | $hour | $timezone | $type | $addr | $program $line | $msg |
";
-
+
}
echo "";
@@ -210,17 +210,25 @@ if (file_exists($cfgfile)) {
echo "OpenNelManager not enabled";
}
?>
-
- Send to STDIN:
-
-
-
Command line :
curl -XGET --header "content-type: application/json" -d ''
+
+
+
+ Send to STDIN:
+
+
+
+ Command line :
+
+ curl -XPOST --header "content-type: application/json" -d ''
+
+
+