Skip to content

Commit

Permalink
push big update
Browse files Browse the repository at this point in the history
this is my vesion of BannerTS3 by xman8830 https://github.com/xman8830/BannerTS3
  • Loading branch information
LukasWestholt committed May 8, 2020
1 parent 517d154 commit b990ebd
Show file tree
Hide file tree
Showing 33 changed files with 333 additions and 532 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 xman8830
Copyright (c) 2020 LukasWestholt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Empty file added cache/ipdata
Empty file.
Empty file added cache/server
Empty file.
4 changes: 4 additions & 0 deletions cache/weathericons/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Not Found
The requested URL <?php echo $_SERVER["REQUEST_URI"];?> was not found on this server.

<?php echo $_SERVER["SERVER_SOFTWARE"];?> Server at <?php echo $_SERVER["HTTP_HOST"]; ?> Port 80
390 changes: 0 additions & 390 deletions class/banner.class.php

This file was deleted.

3 changes: 3 additions & 0 deletions class/index.php
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Not Found
The requested URL <?php echo $_SERVER["REQUEST_URI"];?> was not found on this server.

<?php echo $_SERVER["SERVER_SOFTWARE"];?> Server at <?php echo $_SERVER["HTTP_HOST"]; ?> Port 80
163 changes: 61 additions & 102 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,173 +4,132 @@
# Created by xman8830 #
# #
########################################
date_default_timezone_set('Europe/Warsaw');//Time zone/Strefa czasowa
$config['cache_name'] = 'EDIT_ME'; //Name cache/Nazwa cache
$config['apikey'] = ''; //weather Api key https://xman8830.ovh/contact

########################################
# #
# Version by Lukas Westholt #
# #
########################################
date_default_timezone_set('Europe/Berlin');//Time zone
$config['cache_name'] = 'server'; //Name cache
$config['ipinfo_token'] = ''; //https://ipinfo.io/account
$config['apikey_openweathermap'] = ''; //https://openweathermap.org/api
$config['ts3']['host'] = ''; //Host IP
$config['ts3']['login_port'] = '9987'; //Port Server/Port serwera
$config['ts3']['query_port'] = '10011'; //Port Query
$config['ts3']['login'] = 'serveradmin'; //Login Query
$config['ts3']['password'] = ''; //Password Query/Hasło Query
$config['ts3']['login_port'] = ''; //Port Server
$config['ts3']['query_port'] = ''; //Port Query
$config['ts3']['login'] = ''; //Login Query
$config['ts3']['password'] = ''; //Password Query

$config['settings'] = 'auto'; // "auto" - refresh website or "bot" - screen bot refresh
$config['settings'] = 'auto'; // "auto" - refresh website or "bot" - screen bot refresh

$config['banner']['format'] = 'png'; //Format png/jpg
$config['banner']['background'] = 'img/banner.png'; //link to background png/jpg/Link do tła png/jpg
$admingroups = array(14,13,15); //id admins groups/Id grup administracyjnych
$config['img']['found_nick'] = 'Nieznajomy';// Nick if not found nick/Nick jeżeli nie znajdzie go
$config['lang'] = 'PL';//Language PL/EN/Język PL/EN
$config['banner']['background'] = 'img/banner.png'; //link to background png/jpg
$admingroups = array(6); //id admins groups
$config['img']['found_nick'] = 'unknown';// Nick if not found nick
$config['lang'] = 'DE';//Language PL/EN/DE
$weather = array(
'status' => false,
'icon' => array (//Icon weather/Ikona pogody
'status' => true,
'icon' => array (//Icon weather
'status' => true,
'x' => 1300,
'y' => 100
'y' => 80
),
'description' => array (//Details weather/Szczegóły pogody
'status' => false,
'description' => array (//Details weather
'status' => true,
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
'size' => 34,
'x' => 100,
'y' => 100
'size' => 20,
'x' => "right;-10",
'y' => 230
),
'temp' => array (//Temperature/Temperatura
'temp' => array (//Temperature
'status' => true,
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
'size' => 33,
'x' => 1330,
'y' => 210
'x' => "right;-10",
'y' => 190
),
'city' => array (//City/Miasto
'city' => array (//City
'status' => true,
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
'size' => 34,
'x' => 1270,
'y' => 40
'x' => "right;-10",
'y' => 50
)
);
/*
Variables/Zmienne:
[nick] - Nick
[adminsOnline] - Admins Online/Admini online
[channel] - Online channels/Dostępne kanały
[uptime] - Time on days of enabled server/Czas w dniach włączonego serwera
[visit] - Server visits/Odwiedzin Serwera
[max] - The maximum number of slots/Maksymalna ilość slotów
[online] - User online/Osób online
[ping] - Ping
[time] - Time/Czas
[date] - Date/Data
[nameday] - Name day/Imieniny
##########################################
THIS COPY/TO KOPIUJ
$img[] = array (
'x' => 100,//Width/Szerokość
'y' => 100,//Height/Wysokość
'size' => 20,//Size/Wielkość
'text' => 'It Works',//Content/Zawarość
'font' => '/fonts/Ubuntu-l.ttf',//Font/Czcionka
'color' => '#fff',//Color/Kolor
);
##########################################
*/


$img[] = array (
'x' => 173,
'y' => 40,
'x' => 20,
'y' => 50,
'size' => 34,
'text' => 'Admini online: [adminsOnline]',
'text' => 'Admin online: [adminsOnline]',
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
);

$img[] = array (
'x' => 173,
'y' => 80,
'size' => 34,
'text' => 'Nick [nick]',
'x' => "center",
'y' => "center",
'size' => 50,
'text' => 'Hallo [nick]!',
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
);

$img[] = array (
'x' => 173,
'y' => 120,
'size' => 34,
'text' => 'online: [online]/[max]',
'x' => "center",
'y' => "center;50",
'size' => 40,
'text' => 'Jetzt online: [online]/[max]',
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
);

$img[] = array (
'x' => 173,
'y' => 160,
'size' => 34,
'text' => 'Godzina: [time]',
'x' => "right;-10",
'y' => "bottom;60",
'size' => 80,
'text' => '[time]',
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
);
);

$img[] = array (
'x' => 173,
'y' => 200,
'x' => "right;-30",
'y' => "bottom;-80",
'size' => 34,
'text' => 'Data: [date]',
'text' => '[date]',
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
);

$img[] = array (
'x' => 173,
'y' => 240,
'size' => 34,
'text' => 'Kanały: [channel]',
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
);

$img[] = array (
'x' => 173,
'y' => 280,
'size' => 34,
'text' => 'uptime: [uptime] dni',
'x' => 20,
'y' => "bottom;20",
'size' => 30,
'text' => 'Up: [uptime] T.',
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
);
$img[] = array (
'x' => 173,
'y' => 320,
'x' => "center;-30",
'y' => "bottom;20",
'size' => 34,
'text' => 'Odwiedzin: [visit]',
'text' => 'Du bist hier auf dem Server zum [visit]. Mal',
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
);

$img[] = array (
'x' => 173,
'y' => 360,
'x' => "center",
'y' => 50,
'size' => 34,
'text' => 'Ping: [ping]',
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
);

$img[] = array (
'x' => 430,
'y' => 400,
'size' => 34,
'text' => 'Imieniny: [nameday]',
'font' => '/fonts/Ubuntu-l.ttf',
'color' => '#fff',
);




?>
5 changes: 4 additions & 1 deletion core.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
require_once __DIR__ . "/class/ts3admin.class.php";
require_once __DIR__ . "/config.php";
$files = array_diff(scandir('cache'), array(
'..',
Expand All @@ -8,6 +7,10 @@
'thumbs'
));
$ip = getenv('HTTP_CLIENT_IP') ?: getenv('HTTP_X_FORWARDED_FOR') ?: getenv('HTTP_X_FORWARDED') ?: getenv('HTTP_FORWARDED_FOR') ?: getenv('HTTP_FORWARDED') ?: getenv('REMOTE_ADDR');
$host = gethostname();
$ip2 = gethostbyname($host);
echo $ip2 . PHP_EOL;
echo $ip . PHP_EOL;
if ($ip == $_SERVER['SERVER_ADDR']) {
if (!empty($config['cache_name']) or $config['cache_name'] != '') {
if (!in_array($config['cache_name'], $files)) {
Expand Down
67 changes: 67 additions & 0 deletions debug.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
require_once __DIR__ . "/config.php";
$ip = getenv('HTTP_CLIENT_IP') ?: getenv('HTTP_X_FORWARDED_FOR') ?: getenv('HTTP_X_FORWARDED') ?: getenv('HTTP_FORWARDED_FOR') ?: getenv('HTTP_FORWARDED') ?: getenv('REMOTE_ADDR');
$adminonline = 0;
$nick = $config['img']['found_nick'];
if ($config['settings'] == 'auto') {
require_once __DIR__ . "/class/ts3admin.class.php";
$files = array_diff(scandir('cache'), array('..', '.', 'fulls', 'thumbs'));
if (!empty($config['cache_name']) or $config['cache_name'] != '') {
if (!in_array($config['cache_name'] ,$files)) {
if(touch('./cache/'.$config['cache_name'])) {
if(chmod('./cache/'.$config['cache_name'], 0777)) {
$cache = 'success';
} else {
alert ('The folder and the cache file were created, no access rights were granted');
exit;
}
} else {
alert ('Not created <b>cache</b>');
exit;
}
} else {
$srv = '';
if (!file_exists('cache/'.$config['cache_name']) || filemtime('cache/'.$config['cache_name']) + 1 * 30 < time()) {;
$query = new ts3admin($config['ts3']['host'], $config['ts3']['query_port'], 2);
$query->connect();
$query->login($config['ts3']['login'],$config['ts3']['password']);
$query->selectServer($config['ts3']['login_port']);
$srv = [];
$srv['server'] = $query->getElement('data', $query->serverInfo());
$srv['groups'] = $query->getElement('data', $query->serverGroupList());
$srv['clients'] = $query->getElement('data', $query->clientList('-uid -away -voice -times -groups -info -icon -country -ip'));
$srv['channel'] = $query->getElement('data', $query->channelList());
$srv['banlist'] = $query->getElement('data', $query->banList());

@file_put_contents('cache/'.$config['cache_name'], json_encode($srv));
} else {
$srv = file_get_contents('cache/'.$config['cache_name']);
$srv = json_decode($srv, true);
}

}
} else {
alert ('cache name not found in config.php');
exit;
}
} elseif ($config['settings'] == 'bot') {
$ts3 = file_get_contents('cache/'.$config['cache_name']);
$srv = json_decode($ts3, true);
}
if ($weather['status']) {
//$json = file_get_contents('https://api.xman8830.ovh/weather?key='.$config['apikey'].'&ip=' . $ip);
//$data = json_decode($json, true);
//$weathericonfile = 'weathericon/' . $data['icon'] . '.png';
}
foreach ($srv['clients'] as $client) {
$groups = explode(',', $client['client_servergroups']);
echo $groups;
if ($client["connection_client_ip"] == $ip) {
$nick = $client['client_nickname'];
}
foreach ($admingroups as $group) {
if (in_array($group, $groups)) {
$adminonline++;
}
}
}
3 changes: 3 additions & 0 deletions fonts/index.php
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Not Found
The requested URL <?php echo $_SERVER["REQUEST_URI"];?> was not found on this server.

<?php echo $_SERVER["SERVER_SOFTWARE"];?> Server at <?php echo $_SERVER["HTTP_HOST"]; ?> Port 80
3 changes: 3 additions & 0 deletions img/index.php
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Not Found
The requested URL <?php echo $_SERVER["REQUEST_URI"];?> was not found on this server.

<?php echo $_SERVER["SERVER_SOFTWARE"];?> Server at <?php echo $_SERVER["HTTP_HOST"]; ?> Port 80
Loading

0 comments on commit b990ebd

Please sign in to comment.