v 1.3.0 - i18n

This commit is contained in:
Wruczek 2016-07-25 16:14:04 +02:00
parent d084b8a1e2
commit b2aaff63a2
22 changed files with 278 additions and 88 deletions

5
api/i18n.php Normal file
View File

@ -0,0 +1,5 @@
<?php
header('Content-Type:application/javascript');
require_once __DIR__ . "/../include/language.php";
?>
var textShowMore = "<?php json_encode(tl($lang["index"]["showmore"])); ?>", textShowLess = "<?php json_encode(tl($lang["index"]["showless"])); ?>", statusOnline = "<?php json_encode(tl($lang["serverstatus"]["online"])); ?>", statusOffline = "<?php json_encode(tl($lang["serverstatus"]["offline"])); ?>", statusUptime = "<?php json_encode(tl($lang["serverstatus"]["uptime"])); ?>", statusVersion = "<?php json_encode(tl($lang["serverstatus"]["version"])); ?>", statusAvgping = "<?php json_encode(tl($lang["serverstatus"]["avgping"])); ?>", statusAvgpl = "<?php json_encode(tl($lang["serverstatus"]["avgpl"])); ?>";

View File

@ -26,24 +26,24 @@ if (is_null($banlist)) {
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-ban" aria-hidden="true"></i> Lista banów</h3> <h3 class="panel-title"><i class="fa fa-ban" aria-hidden="true"></i> <?php tl($lang["banlist"]["title"]); ?></h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<?php if(empty($banlist[0])) { ?> <?php if(empty($banlist[0])) { ?>
<div class="alert alert-success"> <div class="alert alert-success">
<p class="text-center">BRAK ZBANOWANYCH UŻYTKOWNIKÓW</p> <p class="text-center"><?php tl($lang["banlist"]["emptylist"]); ?></p>
</div> </div>
<?php } else { ?> <?php } else { ?>
<div class="table-responsive"> <div class="table-responsive">
<table id="banlist" class="table table-striped table-bordered" cellspacing="0" width="100%"> <table id="banlist" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead> <thead>
<tr> <tr>
<th>Nick</th> <th><?php tl($lang["banlist"]["table"]["nickname"]); ?></th>
<th>Powód</th> <th><?php tl($lang["banlist"]["table"]["reason"]); ?></th>
<th>Zbanowany przez</th> <th><?php tl($lang["banlist"]["table"]["bannedby"]); ?></th>
<th>Data zbanowania</th> <th><?php tl($lang["banlist"]["table"]["bandate"]); ?></th>
<th>Wygasa</th> <th><?php tl($lang["banlist"]["table"]["expires"]); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -55,13 +55,14 @@ if (is_null($banlist)) {
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
Stan na <?php echo $banlist[1]; ?><!-- <span style="float: right">Podgląd odświerza się co 60 sekund</span> --> <?php tl($lang["banlist"]["lastupdate"], [$banlist[1]]); ?><!-- <span style="float: right">Podgląd odświerza się co 60 sekund</span> -->
</div> </div>
</div> </div>
<?php <?php
function getBanlist() { function getBanlist() {
global $lang;
try { try {
$tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients"); $tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients");
@ -82,10 +83,10 @@ function getBanlist() {
$duration = $ban['duration']; $duration = $ban['duration'];
if(empty($reason)) if(empty($reason))
$reason = "<b>(brak powodu)</b>"; $reason = "<b>" . translate($lang["banlist"]["table"]["emptyreason"]) . "</b>";
if($duration == 0) if($duration == 0)
$expires = "Ban permanentny"; $expires = translate($lang["banlist"]["table"]["permaban"]);
else else
$expires = date('d-m-Y H:i:s', $ban['created'] + $duration); $expires = date('d-m-Y H:i:s', $ban['created'] + $duration);
@ -97,7 +98,7 @@ function getBanlist() {
if($e->getCode() == 1281) { if($e->getCode() == 1281) {
return ''; return '';
} else { } else {
return '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd ' . $e->getCode() . ': ' . $e->getMessage() . '</p></div>'; return '<div class="alert alert-danger"><p class="text-center">' . translate($lang["general"]["scripterror"], [$e->getCode(), $e->getMessage()]) . '</p></div>';
} }
} }

View File

@ -1,65 +1,65 @@
<?php <?php
/* /*
Autor: Wruczek Author: Wruczek
Kontakt: Contact me:
TeamSpeak: ts.wruczek.top TeamSpeak: ts.wruczek.top
E-mail: wruczekk@gmail.com Email: wruczekk@gmail.com
Prześlij dotację: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9PL5J7ULZQYJQ Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9PL5J7ULZQYJQ
*/ */
/************* Konfiguracja generalna strony *************/ /************* General configuration *************/
$config["general"]["title"] = "TwojTS.PL"; // Tytuł strony - wyświetlany np. w menu i na pasku nawigacji $config["general"]["title"] = "BestTS.NET"; // Website title - displayed in the menu
$config["general"]["theme"] = "superhero"; // Motyw strony - http://bootswatch.com/ (ALPHA) $config["general"]["icon"] = "img/icon/icon-32.png"; // Website icon
$config["general"]["icon"] = "img/icon/icon-32.png"; // Ikona używana na pasku nawigacji $config["general"]["subtitle"] = " - Best TeamSpeak server!"; // Website subtitle
$config["general"]["subtitle"] = " - Najlepszy serwer Teamspeak!"; // Dodatkowy tekst dodawany do tytułu na pasku przeglądarki $config["general"]["desc"] = "Polski serwer TeamSpeak! Zapraszamy :)"; // Website description - displayed in Google search engine
$config["general"]["desc"] = "Polski serwer TeamSpeak! Zapraszamy :)"; // Opis strony - wyświetlany np. w wynikach wyszukiwarki Google $config["general"]["newsDir"] = "config/news"; // News folder (relative to project folder)
$config["general"]["newsDir"] = "config/news"; // Folder z newsami (relatywnie do głównego folderu)
$config["general"]["enablehta"] = false; // Właczenie / wyłączenie dodatkowych usprawnień strony w htaccess (zalecane, $config["general"]["enablehta"] = false; // Enable / Disable additional website features (recommended, but
// wymaga jednak aktualnej wersji Apache oraz włączenia htaccess oraz mod_rewrite) // you need to have up-to-date version of Apache and install mod_rewrite)
// After setting to true, go into .htaccess file and uncomment 19 line
/********* Konfiguracja serwera TeamSpeak *********/ /********* TeamSpeak configuration *********/
$config['teamspeak']['host'] = '127.0.0.1'; // Adres serwera TeamSpeak $config['teamspeak']['host'] = '127.0.0.1'; // TeamSpeak host address
$config['teamspeak']['login'] = 'serveradmin'; // Login konta Query $config['teamspeak']['login'] = 'serveradmin'; // Login
$config['teamspeak']['password'] = 'pa$$word'; // Hasło konta Query $config['teamspeak']['password'] = 'pa$$word'; // Password
$config['teamspeak']['server_port'] = 9987; // Port serwera TeamSpeak $config['teamspeak']['server_port'] = 9987; // TeamSpeak server port
$config['teamspeak']['query_port'] = 10011; // Port Query $config['teamspeak']['query_port'] = 10011; // Query port
$config['teamspeak']['displayip'] = 'ts.serwer.pl'; // IP wyświetlane na stronie i używane do połączeń $config['teamspeak']['displayip'] = 'ts.server.net'; // IP shown to users and used for connections
/************* Dodatkowe linki na pasku nawigacji *************/ /************* Additional navigation links - you can link to your stuff *************/
$config["navlinks"] = array( $config["navlinks"] = array(
// WZÓR: array("ikona", "tekst", "link") GDZIE ikona to nazwa ikony ze strony: http://fontawesome.io/icons/ // TEMPLATE: array("icon", "displayed text", "link"), ICON is an icon name from: http://fontawesome.io/icons/
array("fa-facebook-official", "Facebook", "https://facebook.com/najlepszytsXd"), array("fa-facebook-official", "Facebook", "https://facebook.com/bestteamspeakXd"),
array("fa-comments", "Forum", "forum"), array("fa-comments", "Forum", "forum"),
array("fa-shopping-cart", "Sklep", "sklep") array("fa-shopping-cart", "Shop", "shop")
); );
/************* Konfiguracja listy administratorow *************/ /************* Adminlist configuration *************/
// ID grup wyświetlanych na liście administracji. Kolejność grup decyduje o kolejności wyświetlania na stronie // ID of servergroups displayed as admins in Adminlist. Put it in the same way you want it to be displayed.
$config["adminlist"] = array(6, 17, 19); $config["adminlist"] = array(6, 17, 19);
/************* Konfiguracja panelu "kontakt" *************/ /************* Contact panel configuration *************/
// Ustaw $config['contact']['text'] = ''; by kompletnie wyłączyć wyświetlanie panelu // Set $config['contact']['text'] = ''; to hide this panel
$config['contact']['title'] = 'Kontakt z właścicielem'; $config['contact']['title'] = 'Contact the staff';
$config['contact']['text'] = ' $config['contact']['text'] = '
<ul class="list-unstyled"> <ul class="list-unstyled">
<li>TeamSpeak: <span class="pullright">kanał <a href="ts3server://ts.wruczek.top?channel=Kana%C5%82y%20publiczne%2FPogaduchy%2FPogaduchy%205">Pomoc</a></span></li> <li>TeamSpeak: <span class="pullright">channel <a href="ts3server://ts.wruczek.top?channel=Kana%C5%82y%20publiczne%2FPogaduchy%2FPogaduchy%205">Pomoc</a></span></li>
<li>Email: <span class="pullright"><a href="mailto:kontakt@email.com">konakt@email.com</a></span></li> <li>Email: <span class="pullright"><a href="mailto:kontakt@email.com">konakt@email.com</a></span></li>
<li>GaduGadu: <span class="pullright"><a href="gg:49568758">49568758 <img src="https://status.gadu-gadu.pl/users/status.asp?id=49568758&styl=1"></a></span></li> <li>GaduGadu: <span class="pullright"><a href="gg:123456789">123456789 <img src="https://status.gadu-gadu.pl/users/status.asp?id=49568758&styl=1"></a></span></li>
<li>Steam: <span class="pullright"><a href="http://steamcommunity.com/id/wruczek">Wruczek</a></span></li> <li>Steam: <span class="pullright"><a href="http://steamcommunity.com/id/wruczek">Wruczek</a></span></li>
</ul> </ul>
'; ';

View File

@ -0,0 +1,104 @@
<?php
/*
* The english language for ts-website
* @copy Wruczek <wruczekk@gmail.com>
*/
$lang = array();
/************* General *************/
$lang["general"]["langcode"] = "en_GB";
$lang["general"]["scripterror"] = "An error occured! {0}: {1}";
/************* Navbar *************/
$lang["navbar"]["navigation"] = "Navigation";
$lang["navbar"]["viewer"] = "Server Viewer";
$lang["navbar"]["bans"] = "Ban List";
$lang["navbar"]["rules"] = "Server Rules";
$lang["navbar"]["connect"] = "Connect to server";
$lang["navbar"]["connecttooltip"] = "Click to connect to {0}";
/************* Footer *************/
$lang["footer"]["website"] = "Website";
$lang["footer"]["css"] = "CSS thanks to courtesy of";
$lang["footer"]["background"] = "background";
/************* Server status *************/
$lang["serverstatus"]["title"] = "Server status";
$lang["serverstatus"]["address"] = "Address";
$lang["serverstatus"]["loading"] = "Loading...";
$lang["serverstatus"]["online"] = "Online";
$lang["serverstatus"]["offline"] = "Offline";
$lang["serverstatus"]["uptime"] = "Uptime";
$lang["serverstatus"]["version"] = "Version";
$lang["serverstatus"]["avgping"] = "Average ping";
$lang["serverstatus"]["avgpl"] = "Average packet loss";
/************* Admin list *************/
$lang["adminlist"]["title"] = "Adminlist";
$lang["adminlist"]["emptygroup"] = "This group is empty";
$lang["adminlist"]["status"]["online"] = "Online";
$lang["adminlist"]["status"]["away"] = "Away";
$lang["adminlist"]["status"]["offline"] = "Offline";
$lang["adminlist"]["lastupdate"] = "Last update: {0}";
/************* Server viewer promo box (under adminlist and contact) *************/
$lang["svpb"]["title"] = "Server Viewer";
$lang["svpb"]["takealook"] = "Take a look &raquo;";
/************************************/
/************* SUBPAGES *************/
/************************************/
/************* News - index.php *************/
$lang["index"]["title"] = "News";
$lang["index"]["showmore"] = "Read more";
$lang["index"]["showless"] = "Show less";
$lang["index"]["errortitle"] = "Error: news directory has not been found!";
$lang["index"]["errorsubtitle"] = "Please make sure that directory location set in <code>config/config.php</code> is valid.";
/************* Server viewer - viewer.php *************/
$lang["viewer"]["title"] = "Server Viewer";
$lang["viewer"]["lastupdate"] = "Last update: {0}";
/************* Ban List - bans.php *************/
$lang["banlist"]["title"] = "Ban List";
$lang["banlist"]["datatablesurl"] = "//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json";
$lang["banlist"]["emptylist"] = "BAN LIST IS EMPTY";
$lang["banlist"]["lastupdate"] = "Last update: {0}";
$lang["banlist"]["table"]["emptyreason"] = "(no reason set)";
$lang["banlist"]["table"]["permaban"] = "Never";
$lang["banlist"]["table"]["nickname"] = "Nick";
$lang["banlist"]["table"]["reason"] = "Reason";
$lang["banlist"]["table"]["bannedby"] = "Banned by";
$lang["banlist"]["table"]["bandate"] = "Ban date";
$lang["banlist"]["table"]["expires"] = "Expires";
/************* Rules - rules.php *************/
$lang["rules"]["title"] = "Server Rules";
$lang["rules"]["filenotfound"] = "Error: file <code>config/rules.md</code> has not been found!";
$lang["rules"]["readerror"] = "Error: cannot access the file <code>config/rules.md</code>!";

View File

@ -1,4 +1,4 @@
Readme od jQuery - do testów systemu jQuery Readme - system test
jQuery, 2016-06-24, 21:00 jQuery, 2016-06-24, 21:00
[jQuery](https://jquery.com/) — New Wave JavaScript [jQuery](https://jquery.com/) — New Wave JavaScript

View File

@ -1,4 +1,4 @@
Readme od Bootstrap - do testów systemu Bootstrap Readme - system test
Bootstrap, 2016-06-24, 21:00 Bootstrap, 2016-06-24, 21:00
# [Bootstrap](http://getbootstrap.com) # [Bootstrap](http://getbootstrap.com)

View File

@ -1,5 +1,9 @@
### Regulamin serwera ### Regulamin serwera
This is a dedicated file to keep your server rules. Its loaded and displayed on "rules.php" page. To change it, go to the <code>config</code> directory and edit file <code>rules.md</code>
<br>
Oto dedykowany plik na regulamin twojego Teamspeaka wyświetlany na podstronie "regulamin". Plik z regulaminem znajdziesz w folderze <code>config</code> pod nazwą <code>rules.md</code>. Edytuje się go podobnie jak newsy. Oto dedykowany plik na regulamin twojego Teamspeaka wyświetlany na podstronie "regulamin". Plik z regulaminem znajdziesz w folderze <code>config</code> pod nazwą <code>rules.md</code>. Edytuje się go podobnie jak newsy.
<br> <br>

1
css/flags/famfamfam-flags.min.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -60,3 +60,7 @@
margin-top: 14.5px; margin-top: 14.5px;
margin-bottom: 14.5px; margin-bottom: 14.5px;
} }
.navbar .dropdown-menu>li>a {
font-size: 14px;
}

View File

@ -40,6 +40,10 @@ a {
float: right float: right
} }
.serverstatus .fa {
margin: 0;
}
.serverstatus span { .serverstatus span {
float: right float: right
} }

View File

@ -13,7 +13,7 @@ body {
} }
.navbar-default { .navbar-default {
background-color: #004449 !important; background-color: #055157 !important;
} }
.btn-dark { .btn-dark {
@ -197,7 +197,7 @@ fieldset[disabled] .btn-link:focus {
.navbar-default .navbar-nav>li>a:hover, .navbar-default .navbar-nav>li>a:hover,
.navbar-default .navbar-nav>li>a:focus { .navbar-default .navbar-nav>li>a:focus {
background-color: #004449 background-color: #083d48
} }
.navbar-default .navbar-nav>.active>a, .navbar-default .navbar-nav>.active>a,

View File

@ -1,5 +1,4 @@
<?php <?php
$bansPage = true;
require_once __DIR__ . "/tsutils.php"; require_once __DIR__ . "/tsutils.php";
require_once __DIR__ . "/../lib/phpfastcache/autoload.php"; require_once __DIR__ . "/../lib/phpfastcache/autoload.php";
@ -25,6 +24,7 @@ if (is_null($adminlist)) {
function getAdminList() { function getAdminList() {
global $config; global $config;
global $lang;
$admingroups = $config["adminlist"]; $admingroups = $config["adminlist"];
$localIcons = array(100, 200, 300, 400, 500, 600); $localIcons = array(100, 200, 300, 400, 500, 600);
@ -60,7 +60,7 @@ function getAdminList() {
$clients = $group->clientList(); $clients = $group->clientList();
if(empty($clients)) { if(empty($clients)) {
$output .= '<p class="text-center"><i>Ta grupa jest pusta</i></p>'; $output .= '<p class="text-center"><i>' . translate($lang["adminlist"]["emptygroup"]) . '</i></p>';
continue; continue;
} }
@ -68,17 +68,17 @@ function getAdminList() {
$user = getClientByDbid($tsAdmin, $userInfo['cldbid']); $user = getClientByDbid($tsAdmin, $userInfo['cldbid']);
if(!$user) { if(!$user) {
$output .= '<p><span class="label label-primary iconspacer">' . $userInfo['client_nickname'] . '</span><span class="label label-danger pullright">Offline</span></p>'; $output .= '<p><span class="label label-primary iconspacer">' . $userInfo['client_nickname'] . '</span><span class="label label-danger pullright">' . translate($lang["adminlist"]["status"]["offline"]) . '</span></p>';
continue; continue;
} }
$output .= '<p><img src="lib/ts3phpframework/images/viewer/' . $user->getIcon() . '.png" alt="Status użytkownika">' . '<span class="label label-primary">' . $user . '</span>' . ($user['client_away'] ? '<span class="label label-warning pullright">Away</span>' : '<span class="label label-success pullright">Online</span>') . '</p>'; $output .= '<p><img src="lib/ts3phpframework/images/viewer/' . $user->getIcon() . '.png" alt="Status użytkownika">' . '<span class="label label-primary">' . $user . '</span>' . ($user['client_away'] ? '<span class="label label-warning pullright">' . translate($lang["adminlist"]["status"]["away"]) . '</span>' : '<span class="label label-success pullright">' . translate($lang["adminlist"]["status"]["online"]) . '</span>') . '</p>';
} }
} }
return $output; return $output;
} catch(TeamSpeak3_Exception $e) { } catch(TeamSpeak3_Exception $e) {
return '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd ' . $e->getCode() . ': ' . $e->getMessage() . '</p></div>'; return '<div class="alert alert-danger"><p class="text-center">' . translate($lang["general"]["scripterror"], [$e->getCode(), $e->getMessage()]) . '</p></div>';
} }
} }

View File

@ -7,10 +7,10 @@
<div class="footer"> <div class="footer">
<div class="container"> <div class="container">
<hr> <hr>
<p class="pull-left">&copy; <?php echo $config["general"]["title"]; ?> 2016</p> <p class="pull-left">&copy; <?php tl($config["general"]["title"]); ?> 2016</p>
<div class="pull-right"> <div class="pull-right">
<ul class="list-inline"> <ul class="list-inline">
<li><p><small>Strona &copy; <a href="http://wruczek.top">Wruczek</a> 2016 | <a href="https://github.com/Wruczek/ts-website">ts-website</a> v 1.2.4 | MIT License<br>CSS dzięki uprzejmości <a href="https://flamespersecond.de">NothingTV</a>, tło &copy; <a href="http://nabulsigraphix.wix.com/commissions">NabulsiGraphix</a></small></p></li> <li><p><small><?php tl($lang["footer"]["website"]); ?> &copy; <a href="http://wruczek.top">Wruczek</a> 2016 | <a href="https://github.com/Wruczek/ts-website">ts-website</a> v 1.3.0 | MIT License<br><?php tl($lang["footer"]["css"]); ?> <a href="https://flamespersecond.de">NothingTV</a>, <?php tl($lang["footer"]["background"]); ?> &copy; <a href="http://nabulsigraphix.wix.com/commissions">NabulsiGraphix</a></small></p></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -30,6 +30,8 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/Readmore.js/2.2.0/readmore.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Readmore.js/2.2.0/readmore.min.js"></script>
<?php if(isset($bansPage)) { ?> <?php if(isset($bansPage)) { ?>
<script>var datatablesUrl = "<?php tl($lang["banlist"]["datatablesurl"]); ?>";</script>
<!-- DataTables for Bootstrap --> <!-- DataTables for Bootstrap -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/jquery.dataTables.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/dataTables.bootstrap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/dataTables.bootstrap.min.js"></script>
@ -37,7 +39,9 @@
<?php } ?> <?php } ?>
<!-- Custom JS --> <!-- Custom JS -->
<script>var apiurl = "api/status<?php echo $config["general"]["enablehta"] ? "" : ".php" ?>";</script> <script>
var apiurl = "api/status<?php echo $config["general"]["enablehta"] ? "" : ".php"; ?>";
</script>
<script src="js/script.js"></script> <script src="js/script.js"></script>
<script src="js/status.js"></script> <script src="js/status.js"></script>

View File

@ -2,6 +2,7 @@
$start = microtime(true); $start = microtime(true);
require_once __DIR__ . "/../include/modulecheck.php"; require_once __DIR__ . "/../include/modulecheck.php";
require_once __DIR__ . "/../config/config.php"; require_once __DIR__ . "/../config/config.php";
require_once __DIR__ . "/../include/language.php";
require_once __DIR__ . "/../include/adminlist.php"; require_once __DIR__ . "/../include/adminlist.php";
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -21,7 +22,7 @@ require_once __DIR__ . "/../include/adminlist.php";
<link rel="shortcut icon" href="img/icon/icon-64.png"> <link rel="shortcut icon" href="img/icon/icon-64.png">
<!-- Bootswatch --> <!-- Bootswatch -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.6/<?php echo $config["general"]["theme"]; ?>/bootstrap.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.6/superhero/bootstrap.min.css" rel="stylesheet">
<link href="css/theme.css" rel="stylesheet"> <link href="css/theme.css" rel="stylesheet">
<!-- Font Awesome --> <!-- Font Awesome -->
@ -32,10 +33,14 @@ require_once __DIR__ . "/../include/adminlist.php";
<link href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/dataTables.bootstrap.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/dataTables.bootstrap.min.css" rel="stylesheet">
<?php } ?> <?php } ?>
<link href="css/flags/famfamfam-flags.min.css" rel="stylesheet">
<!-- Custom CSS --> <!-- Custom CSS -->
<link href="css/navbar.css" rel="stylesheet"> <link href="css/navbar.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet">
<script src="api/i18n.php"></script>
<!--[if IE]> <!--[if IE]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
@ -49,7 +54,7 @@ require_once __DIR__ . "/../include/adminlist.php";
<!-- Brand and toggle get grouped for better mobile display --> <!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Nawigacja</span> <span class="sr-only"><?php tl($lang["navbar"]["navigation"]); ?></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
@ -61,9 +66,9 @@ require_once __DIR__ . "/../include/adminlist.php";
<!-- Collect the nav links, forms, and other content for toggling --> <!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li><a href="viewer<?php echo $config["general"]["enablehta"] ? "" : ".php" ?>"><i class="fa fa-eye" aria-hidden="true"></i> Podgląd serwera</a></li> <li><a href="viewer<?php echo $config["general"]["enablehta"] ? "" : ".php" ?>"><i class="fa fa-eye" aria-hidden="true"></i> <?php tl($lang["navbar"]["viewer"]); ?></a></li>
<li><a href="bans<?php echo $config["general"]["enablehta"] ? "" : ".php" ?>"><i class="fa fa-ban" aria-hidden="true"></i> Lista banów</a></li> <li><a href="bans<?php echo $config["general"]["enablehta"] ? "" : ".php" ?>"><i class="fa fa-ban" aria-hidden="true"></i> <?php tl($lang["navbar"]["bans"]); ?></a></li>
<li><a href="rules<?php echo $config["general"]["enablehta"] ? "" : ".php" ?>"><i class="fa fa-book" aria-hidden="true"></i> Regulamin</a></li> <li><a href="rules<?php echo $config["general"]["enablehta"] ? "" : ".php" ?>"><i class="fa fa-book" aria-hidden="true"></i> <?php tl($lang["navbar"]["rules"]); ?></a></li>
<!-- Nie mam na to czasu <!-- Nie mam na to czasu
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-television" aria-hidden="true"></i></i>Ranking <span class="caret"></span></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-television" aria-hidden="true"></i></i>Ranking <span class="caret"></span></a>
@ -83,7 +88,16 @@ require_once __DIR__ . "/../include/adminlist.php";
<li><a href="<?php echo $link; ?>"><i class="fa <?php echo $icon; ?>" aria-hidden="true"></i> <?php echo $text; ?></a></li> <li><a href="<?php echo $link; ?>"><i class="fa <?php echo $icon; ?>" aria-hidden="true"></i> <?php echo $text; ?></a></li>
<?php } ?> <?php } ?>
<li data-toggle="tooltip" data-placement="bottom" title="Kliknij, by połączyć się z serwerem <?php echo $config['teamspeak']['displayip']; ?>"><a href="ts3server://<?php echo $config['teamspeak']['displayip']; ?>"><i class="fa fa-sign-in" aria-hidden="true"></i>Połącz z serwerem</a></li> <li data-toggle="tooltip" data-placement="bottom" title="<?php tl($lang["navbar"]["connecttooltip"], [$config['teamspeak']['displayip']]); ?>"><a href="ts3server://<?php echo $config['teamspeak']['displayip']; ?>"><i class="fa fa-sign-in" aria-hidden="true"></i><?php tl($lang["navbar"]["connect"]); ?></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="famfamfam-flags <?php echo $langcode == "en" ? "gb" : $langcode; ?>" aria-hidden="true"></i> Language <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="?lang=en"><i class="famfamfam-flags gb" aria-hidden="true"></i> English</a></li>
<li><a href="?lang=pl"><i class="famfamfam-flags pl" aria-hidden="true"></i> Polski</a></li>
<li><a href="?lang=de"><i class="famfamfam-flags de" aria-hidden="true"></i> Deutsch</a></li>
</ul>
</li>
</ul> </ul>
</div> </div>
<!-- /.navbar-collapse --> <!-- /.navbar-collapse -->
@ -97,14 +111,14 @@ require_once __DIR__ . "/../include/adminlist.php";
<div class="col-md-3 col-md-push-9"> <div class="col-md-3 col-md-push-9">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-bar-chart" aria-hidden="true"></i> Status serwera</div> <div class="panel-heading"><i class="fa fa-bar-chart" aria-hidden="true"></i> <?php tl($lang["serverstatus"]["title"]); ?></div>
<div class="panel-body"> <div class="panel-body">
<div class="serverstatus"> <div class="serverstatus">
<p><i class="fa fa-globe" aria-hidden="true"></i> Adres: <a href="ts3server://<?php echo $config['teamspeak']['displayip']; ?>"><?php echo $config['teamspeak']['displayip']; ?></a></p> <p><i class="fa fa-globe" aria-hidden="true"></i> <?php tl($lang["serverstatus"]["address"]); ?>: <a href="ts3server://<?php echo $config['teamspeak']['displayip']; ?>"><?php echo $config['teamspeak']['displayip']; ?></a></p>
<div id="serverstatus"> <div id="serverstatus">
<div class="text-center"> <div class="text-center">
<i class="fa fa-refresh fa-spin fa-3x fa-fw"></i> <i class="fa fa-refresh fa-spin fa-3x fa-fw"></i>
<span class="sr-only">Ładowanie...</span> <span class="sr-only"><?php tl($lang["serverstatus"]["loading"]); ?></span>
</div> </div>
</div> </div>
</div> </div>
@ -113,7 +127,7 @@ require_once __DIR__ . "/../include/adminlist.php";
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-shield" aria-hidden="true"></i> Status administracji <span class="pullright"><i class="fa fa-question-circle" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="Stan na <?php echo $adminlist[1]; ?>"></i></span></div> <div class="panel-heading"><i class="fa fa-shield" aria-hidden="true"></i> <?php tl($lang["adminlist"]["title"]); ?> <span class="pullright"><i class="fa fa-question-circle" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="<?php tl($lang["adminlist"]["lastupdate"], [$adminlist[1]]); ?>"></i></span></div>
<div class="panel-body adminlist"> <div class="panel-body adminlist">
<?php echo $adminlist[0]; ?> <?php echo $adminlist[0]; ?>
</div> </div>
@ -129,9 +143,9 @@ require_once __DIR__ . "/../include/adminlist.php";
<?php } ?> <?php } ?>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-eye" aria-hidden="true"></i> Podgląd serwera</div> <div class="panel-heading"><i class="fa fa-eye" aria-hidden="true"></i> <?php tl($lang["svpb"]["title"]); ?></div>
<div class="panel-body"> <div class="panel-body">
<a href="viewer<?php echo $config["general"]["enablehta"] ? "" : ".php" ?>" class="btn btn-primary btn-lg btn-block"><i class="fa fa-eye" aria-hidden="true"></i> Zobacz &raquo;</a> <a href="viewer<?php echo $config["general"]["enablehta"] ? "" : ".php" ?>" class="btn btn-primary btn-lg btn-block"><i class="fa fa-eye" aria-hidden="true"></i> <?php tl($lang["svpb"]["takealook"]); ?></a>
</div> </div>
</div> </div>
</div> </div>

47
include/language.php Normal file
View File

@ -0,0 +1,47 @@
<?php
session_start();
header('Cache-control: private');
if (isset($_GET['lang'])) {
$langcode = $_GET['lang'];
$_SESSION['lang'] = $langcode;
setcookie('lang', $langcode, time() + (3600 * 24 * 60));
} else if (isset($_SESSION['lang'])) {
$langcode = $_SESSION['lang'];
} else if (isset($_COOKIE['lang'])) {
$langcode = $_COOKIE['lang'];
} else if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$langcode = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
} else {
$langcode = "en";
}
if(!file_exists(getLanguagePath($langcode)))
$langcode = "en";
require_once getLanguagePath($langcode);
function getLanguagePath($langcode) {
return __DIR__ . '/../config/languages/lang.' . $langcode . '.php';
}
function tl($pattern, $args = null) {
echo translate($pattern, $args);
}
function translate($pattern, $args = null) {
if(!$args) {
return $pattern;
}
$size = count($args);
for ($i = 0; $i < $size; $i++) {
$pattern = str_ireplace('{' . $i . '}', $args[$i], $pattern);
}
return $pattern;
}

View File

@ -40,19 +40,19 @@ function isPHPVersionSupported() {
} }
if (!isPHPVersionSupported()) { if (!isPHPVersionSupported()) {
$title = 'Niewspierana wersja PHP'; $title = 'Unsupported PHP version';
$text = '<p>Posiadasz starą, niewspieraną wersję PHP.</p><p>Twoja wersja PHP: <b>' . phpversion() . '</b>, minimalna wymagana wersja PHP: <b>5.3.0</b>.</p><p>Zaktualizuj PHP i spróbuj ponownie.</p>'; $text = '<p>You are using old, unsupported PHP version.</p><p>Your PHP version: <b>' . phpversion() . '</b>, required PHP version: <b>5.3.0</b>.</p><p>Please update your PHP installation and try again.</p>';
die(showError($title, $text)); die(showError($title, $text));
} }
if(!file_exists(__DIR__ . "/../config/config.php")) { if(!file_exists(__DIR__ . "/../config/config.php")) {
$title = 'Brak pliku config.php'; $title = 'config.php does not exists';
$text = '<p>Przejdź do folderu <code>config</code> i zmień nazwę pliku z <code>config.template.php</code> na <code>config.php</code>.</p> $text = '<p>Please go into the directory <code>config</code> and rename <code>config.template.php</code> to <code>config.php</code>.</p>
<p>Skonfiguruj stronę według własnych potrzeb.</p>'; <p>Edit the new file and tweak it to suite your needs.</p>';
die(showError($title, $text)); die(showError($title, $text));
} }
@ -101,7 +101,7 @@ function showError($title, $text) { ?>
<?php echo $text; ?> <?php echo $text; ?>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
Strona &copy; <a href="http://wruczek.top">Wruczek</a> 2016 | <a href="https://github.com/Wruczek/ts-website">ts-website</a> v 1.2.4 | MIT License Strona &copy; <a href="http://wruczek.top">Wruczek</a> 2016 | <a href="https://github.com/Wruczek/ts-website">ts-website</a> v 1.3.0 | MIT License
</div> </div>
</div> </div>

View File

@ -2,7 +2,7 @@ $(document).ready(function () {
$('#banlist').dataTable({ $('#banlist').dataTable({
"order": [], "order": [],
"language": { "language": {
"url": "//cdn.datatables.net/plug-ins/1.10.12/i18n/Polish.json" "url": datatablesUrl
} }
}); });
}); });

View File

@ -5,6 +5,6 @@ $(function () {
$('.news-body').readmore({ $('.news-body').readmore({
speed: 500, speed: 500,
collapsedHeight: 300, collapsedHeight: 300,
moreLink: '<button type="button" class="btn btn-dark">Pokaż wiecej</button>', moreLink: '<button type="button" class="btn btn-dark"><i class="fa fa-plus-circle" aria-hidden="true"></i> ' + textShowMore + '</button>',
lessLink: '<button type="button" class="btn btn-dark">Pokaż mniej</button>' lessLink: '<button type="button" class="btn btn-dark"><i class="fa fa-minus-circle" aria-hidden="true"></i> ' + textShowLess + '</button>'
}); });

View File

@ -28,19 +28,19 @@ function checkStatus() {
var averagePing = Math.round(json.averagePing * 100) / 100; var averagePing = Math.round(json.averagePing * 100) / 100;
result = result =
'<p><i class="fa fa-power-off" aria-hidden="true"></i> Online: <span class="label label-success">' + clientsonline + ' / ' + maxclients + ' (' + clientsprecent + '%)</span></p>' + '<p><i class="fa fa-power-off" aria-hidden="true"></i> ' + statusOnline + ': <span class="label label-success">' + clientsonline + ' / ' + maxclients + ' (' + clientsprecent + '%)</span></p>' +
'<p><i class="fa fa-clock-o" aria-hidden="true"></i> Uptime: <span class="label label-success">' + uptime + '</span></p>' + '<p><i class="fa fa-clock-o" aria-hidden="true"></i> ' + statusUptime + ': <span class="label label-success">' + uptime + '</span></p>' +
'<p><i class="fa fa-info-circle" aria-hidden="true"></i> Wersja: <span class="label label-success">' + version + ' @ ' + platform + '</span></p>' + '<p><i class="fa fa-info-circle" aria-hidden="true"></i> ' + statusVersion + ': <span class="label label-success">' + version + ' @ ' + platform + '</span></p>' +
'<p><i class="fa fa-signal" aria-hidden="true"></i> Średni ping: <span class="label label-success">' + averagePing + ' ms</span></p>' + '<p><i class="fa fa-signal" aria-hidden="true"></i> ' + statusAvgping + ': <span class="label label-success">' + averagePing + ' ms</span></p>' +
'<p><i class="fa fa-bolt" aria-hidden="true"></i> Średni packet loss: <span class="label label-success">' + averagePacketloss + '%</span></p>'; '<p><i class="fa fa-bolt" aria-hidden="true"></i> ' + statusAvgpl + ': <span class="label label-success">' + averagePacketloss + '%</span></p>';
} else { } else {
result = '<p><i class="fa fa-power-off" aria-hidden="true"></i> Online: <span class="label label-danger">Offline</span></p>'; result = '<p><i class="fa fa-power-off" aria-hidden="true"></i> Online: <span class="label label-danger">' + statusOffline + '</span></p>';
} }
$("#serverstatus").html(result); $("#serverstatus").html(result);
}, },
error: function (result) { error: function (result) {
$("#serverstatus").html('<p><i class="fa fa-power-off" aria-hidden="true"></i> Online: <span class="label label-danger">ERROR</span></p>'); $("#serverstatus").html('<p><i class="fa fa-power-off" aria-hidden="true"></i> ' + statusOnline + ': <span class="label label-danger">ERROR</span></p>');
} }
}) })
} }

View File

@ -7,17 +7,17 @@ $parsedown = new Parsedown();
$path = __DIR__ . "/config/rules.md"; $path = __DIR__ . "/config/rules.md";
if(!file_exists($path)) { if(!file_exists($path)) {
echo '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd: plik z regulaminem nie został odnaleziony</div>'; echo '<div class="alert alert-danger"><p class="text-center">' . translate($lang["rules"]["filenotfound"]) . '</div>';
} else { } else {
$file = readFileContent($path); $file = readFileContent($path);
if(!$file) { if(!$file) {
echo '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd: nie można odczytać pliku z regulaminem</div>'; echo '<div class="alert alert-danger"><p class="text-center">' . translate($lang["rules"]["readerror"]) . '</div>';
} else { } else {
?> ?>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-book" aria-hidden="true"></i> Regulamin serwera</h3> <h3 class="panel-title"><i class="fa fa-book" aria-hidden="true"></i> <?php tl($lang["rules"]["title"]); ?></h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<?php echo $parsedown->text($file); ?> <?php echo $parsedown->text($file); ?>

View File

@ -22,11 +22,13 @@ if (is_null($tsviewer)) {
// print_r ($tsviewer); // print_r ($tsviewer);
function getViewer() { function getViewer() {
global $lang;
try { try {
$tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients"); $tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients");
return $tsAdmin->getViewer(new TeamSpeak3_Viewer_Html("lib/ts3phpframework/images/viewer/", "lib/ts3phpframework/images/flags/", "data:image")); return $tsAdmin->getViewer(new TeamSpeak3_Viewer_Html("lib/ts3phpframework/images/viewer/", "lib/ts3phpframework/images/flags/", "data:image"));
} catch(TeamSpeak3_Exception $e) { } catch(TeamSpeak3_Exception $e) {
return '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd ' . $e->getCode() . ': ' . $e->getMessage() . '</p></div>'; return '<div class="alert alert-danger"><p class="text-center">' . translate($lang["general"]["scripterror"], [$e->getCode(), $e->getMessage()]) . '</p></div>';
} }
} }
@ -34,13 +36,13 @@ function getViewer() {
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-eye" aria-hidden="true"></i> Podgląd serwera</h3> <h3 class="panel-title"><i class="fa fa-eye" aria-hidden="true"></i> <?php tl($lang["viewer"]["title"]); ?></h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<?php echo $tsviewer[0]; ?> <?php echo $tsviewer[0]; ?>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
Stan na <?php echo $tsviewer[1]; ?><!-- <span style="float: right">Podgląd odświerza się co 30 sekund</span> --> <?php tl($lang["viewer"]["lastupdate"], [$tsviewer[1]]); ?><!-- <span style="float: right">Podgląd odświerza się co 30 sekund</span> -->
</div> </div>
</div> </div>