Skip to content

Commit

Permalink
Merge pull request #4 from LickABrick/master
Browse files Browse the repository at this point in the history
Update base to 1.3.23
  • Loading branch information
JVMerkle authored May 11, 2023
2 parents cebee01 + bbc0686 commit 3d060b2
Show file tree
Hide file tree
Showing 96 changed files with 3,677 additions and 1,504 deletions.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report--de-.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug report [DE]
about: Melde uns dein Problem, um zur Verbesserung beizutragen.
title: ''
labels: ''
assignees: ''

---

Beschreibung | unterhalb ausfüllen
-- | --
Ranksystem Version | 1.3._XX_
Nutzt du TeamSpeak oder TeaSpeak? |
Link zu deiner Ranksystem Statistik Seite | _optional_
Pastebin Link zu deiner Ranksystem Log *¹ |

---

### 1) Was hast du getan?


### 2) Was war deine Erwartung?


### 3) Was ist stattdessen passiert?


---

#### *¹ Ranksystem Log - HOW-TO
- Wechsel den Log-Level zu `6 - Debug` (-> Webinterface -> Anderes -> Log-Level).
- Wechsel die Sprache zu `EN english` (-> Webinterface -> Anderes -> Sprache).
- Starte den Ranksystem Bot neu und lasse ihn für mind. 10 Minuten laufen (-> Webinterface -> Start / Stop Bot -> Bot neu starten).
- Kopiere einen Auszug aus der Ranksystem Log, welche mindestens auch den letzten Neustart enthält (-> Webinterface -> Start / Stop Bot -> unten).
- Bitte nutze https://pastebin.com/ um die Log zu teilen.
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report--en-.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report [EN]
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---


Description | Fill out below
-- | --
Ranksystem Version | 1.3._XX_
Are you using TeamSpeak or TeaSpeak? |
Link to your Ranksystem Stats page | _optional_
Pastebin Link to your Ranksystem Log *¹ |

---

### 1) What did you do?


### 2) What result did you get?


### 3) What result did you expect?


---

#### *¹ Ranksystem Log - HOW-TO
- Change the Log-Level to `6 - Debug` (-> Webinterface -> Other -> Log-Level).
- Change the default language to `EN english` (-> Webinterface -> Other -> Language).
- Restart the Ranksystem Bot and let it run for at least 10 minutes (-> Webinterface -> Start / Stop bot -> Restart bot).
- Add a Ranksystem-Log extract which contains all since the last restart (-> Webinterface -> Start / Stop bot -> at bottom).
- Please use https://pastebin.com/ for sharing the log.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request--de-.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Feature request [DE]
about: Schlage eine Idee für das Projekt vor
title: ''
labels: Feature request
assignees: ''

---

Unterscheide, ob es sich um ein bestehendes oder ein neues Feature handelt....

**Vorhandenes Feature**

***1) Ich beziehe mich auf das folgende bestehende Feature:*****

***2) Was möchtest du hinzufügen oder ändern?*****

***3) Was wäre der Vorteil?*****
_Bitte schlage die Funktion nur vor, wenn du denkst, dass auch andere davon profitieren würden._

**Neue Funktion**

***1) Was sollte dieses Feature tun?*****

***2) Wo soll es sich befinden? *****
_In welchem bestehenden Teil des Ranksystems würdest du diese neue Funktion hinzufügen?_

***3) Was wäre der Nutzen?*****
_Bitte schlage die Funktion nur vor, wenn du denkst, dass auch andere davon profitieren würden._
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request--en-.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Feature request [EN]
about: Suggest an idea for this project
title: ''
labels: Feature request
assignees: ''

---

Distinguish whether it refers to an existing or new feature..

**Existing Feature**

***1) I am referring to the following existing feature:***

***2) What do you want to add or change on it?***

***3) What would be the benefit?***
_Please only report this feature, when you think also other people would have a benefit of it._

**New Feature**

***1) What should this feature do?***

***2) Where should it be located?***
_On which existing part of the Ranksystem you would add this new feature?_

***3) What would be the benefit?***
_Please only report this feature, when you think also other people would have a benefit of it._
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4-apache
FROM php:8.2-apache

RUN apt-get update && \
apt-get install -y libcap2-bin tini libzip-dev && \
Expand Down
98 changes: 95 additions & 3 deletions api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
require_once('../other/config.php');

start_session($cfg);
$lang = set_language(get_language());

error_reporting(E_ALL);
ini_set("log_errors", 1);
set_error_handler("php_error_handling");
ini_set("error_log", $cfg['logs_path'].'ranksystem.log');
ini_set("error_log", $GLOBALS['logfile']);

header("Content-Type: application/json; charset=UTF-8");

Expand Down Expand Up @@ -48,7 +49,93 @@
$order = (isset($_GET['order']) && strtolower($_GET['order']) == 'desc') ? 'DESC' : 'ASC';
$part = (isset($_GET['part']) && is_numeric($_GET['part']) && $_GET['part'] > 0) ? (($_GET['part'] - 1) * $limit) : 0;

if (isset($_GET['groups'])) {
if (isset($_GET['bot'])) {
if(!isset($_GET['check']) && !isset($_GET['restart']) && !isset($_GET['start']) && !isset($_GET['stop'])) {
$json = array(
"usage" => array(
"_desc" => array(
"0" => "You are able to use bot commands with this function (start, stop, ..).",
"1" => "Use the Parameter, which are described below!",
"2" => "",
"3" => "Return values are:",
"4" => "- 'rc'",
"5" => "- 'msg'",
"6" => "- 'ranksystemlog'",
"7" => "",
"8" => "# RC",
"9" => "The return Code of the transaction (i.e. start process):",
"10" => "0 - EXIT_SUCCESS",
"11" => "1 - EXIT_FAILURE",
"12" => "",
"13" => "# MSG",
"14" => "An additional message of the process. In case of EXIT_FAILURE, you will receive here an error message.",
"15" => "",
"16" => "# RANKSYSTEMLOG",
"17" => "A short log extract of the last rows of the Ranksystem logfile to get more information about the Bot itself.",
),
"check" => array(
"desc" => "Check the Ranksystem Bot is running. If not, it will be started with this.",
"usage" => "Use \$_GET parameter 'check' without any value",
"example" => "/api/?bot&check"
),
"restart" => array(
"desc" => "Restarts the Ranksystem Bot.",
"usage" => "Use \$_GET parameter 'restart' without any value",
"example" => "/api/?bot&restart"
),
"start" => array(
"desc" => "Starts the Ranksystem Bot.",
"usage" => "Use \$_GET parameter 'start' without any value",
"example" => "/api/?bot&start"
),
"stop" => array(
"desc" => "Stops the Ranksystem Bot",
"usage" => "Use \$_GET parameter 'stop' without any value",
"example" => "/api/?bot&stop"
)
)
);
} else {
$check_permission = 0;
foreach($cfg['stats_api_keys'] as $apikey => $desc) {
if (hash_equals($apikey, $_GET['apikey']) && $desc['perm_bot'] == 1) {
$check_permission = 1;
break;
}
}
if ($check_permission == 1) {
if(isset($_GET['check'])) {
$result = bot_check();
} elseif(isset($_GET['restart'])) {
$result = bot_restart();
} elseif(isset($_GET['start'])) {
$result = bot_start();
} elseif(isset($_GET['stop'])) {
$result = bot_stop();
}
if(isset($result['log']) && $result['log'] != NULL) {
$ranksystemlog = $result['log'];
} else {
$ranksystemlog = "NULL";
}
$json = array(
"rc" => $result['rc'],
"msg" => $result['msg'],
"ranksystemlog" => $ranksystemlog
);
} else {
$json = array(
"Error" => array(
"invalid" => array(
"permissions" => "API Key is not permitted to start/stop the Ranksystem Bot"
)
)
);
echo json_encode($json);
exit;
}
}
} elseif (isset($_GET['groups'])) {
$sgidname = $all = '----------_none_selected_----------';
$sgid = -1;
if(isset($_GET['all'])) $all = 1;
Expand Down Expand Up @@ -463,6 +550,11 @@
} else {
$json = array(
"usage" => array(
"bot" => array(
"desc" => "Use this to trigger Bot commands as starting or stopping the Ranksystem Bot.",
"usage" => "Use \$_GET parameter 'bot'",
"example" => "/api/?bot"
),
"groups" => array(
"desc" => "Get details about the TeamSpeak servergroups",
"usage" => "Use \$_GET parameter 'groups'",
Expand Down Expand Up @@ -493,4 +585,4 @@
}

echo json_encode($json);
?>
?>
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ volumes:

services:
ranksystem:
hostname: ranksystem
image: jvmerkle/ts3-ranksystem
restart: always
stop_signal: SIGTERM
Expand All @@ -28,6 +29,7 @@ services:
- DB_PASSWORD=ts3_ranksystem

ranksystem-db:
hostname: ranksystem-db
image: mariadb
restart: always
volumes:
Expand Down
Loading

0 comments on commit 3d060b2

Please sign in to comment.