v 1.3.0 - i18n
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$bansPage = true;
|
||||
require_once __DIR__ . "/tsutils.php";
|
||||
require_once __DIR__ . "/../lib/phpfastcache/autoload.php";
|
||||
|
||||
@ -25,6 +24,7 @@ if (is_null($adminlist)) {
|
||||
|
||||
function getAdminList() {
|
||||
global $config;
|
||||
global $lang;
|
||||
|
||||
$admingroups = $config["adminlist"];
|
||||
$localIcons = array(100, 200, 300, 400, 500, 600);
|
||||
@ -60,7 +60,7 @@ function getAdminList() {
|
||||
$clients = $group->clientList();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -68,17 +68,17 @@ function getAdminList() {
|
||||
$user = getClientByDbid($tsAdmin, $userInfo['cldbid']);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
$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;
|
||||
} 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>';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,10 +7,10 @@
|
||||
<div class="footer">
|
||||
<div class="container">
|
||||
<hr>
|
||||
<p class="pull-left">© <?php echo $config["general"]["title"]; ?> 2016</p>
|
||||
<p class="pull-left">© <?php tl($config["general"]["title"]); ?> 2016</p>
|
||||
<div class="pull-right">
|
||||
<ul class="list-inline">
|
||||
<li><p><small>Strona © <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 © <a href="http://nabulsigraphix.wix.com/commissions">NabulsiGraphix</a></small></p></li>
|
||||
<li><p><small><?php tl($lang["footer"]["website"]); ?> © <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"]); ?> © <a href="http://nabulsigraphix.wix.com/commissions">NabulsiGraphix</a></small></p></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -30,6 +30,8 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Readmore.js/2.2.0/readmore.min.js"></script>
|
||||
|
||||
<?php if(isset($bansPage)) { ?>
|
||||
<script>var datatablesUrl = "<?php tl($lang["banlist"]["datatablesurl"]); ?>";</script>
|
||||
|
||||
<!-- 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/dataTables.bootstrap.min.js"></script>
|
||||
@ -37,7 +39,9 @@
|
||||
<?php } ?>
|
||||
|
||||
<!-- 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/status.js"></script>
|
||||
|
@ -2,6 +2,7 @@
|
||||
$start = microtime(true);
|
||||
require_once __DIR__ . "/../include/modulecheck.php";
|
||||
require_once __DIR__ . "/../config/config.php";
|
||||
require_once __DIR__ . "/../include/language.php";
|
||||
require_once __DIR__ . "/../include/adminlist.php";
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
@ -21,7 +22,7 @@ require_once __DIR__ . "/../include/adminlist.php";
|
||||
<link rel="shortcut icon" href="img/icon/icon-64.png">
|
||||
|
||||
<!-- 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">
|
||||
|
||||
<!-- 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">
|
||||
<?php } ?>
|
||||
|
||||
<link href="css/flags/famfamfam-flags.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom CSS -->
|
||||
<link href="css/navbar.css" rel="stylesheet">
|
||||
<link href="css/style.css" rel="stylesheet">
|
||||
|
||||
<script src="api/i18n.php"></script>
|
||||
|
||||
<!--[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/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 -->
|
||||
<div class="navbar-header">
|
||||
<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>
|
||||
@ -61,9 +66,9 @@ require_once __DIR__ . "/../include/adminlist.php";
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<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="bans<?php echo $config["general"]["enablehta"] ? "" : ".php" ?>"><i class="fa fa-ban" aria-hidden="true"></i> Lista banów</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="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> <?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> <?php tl($lang["navbar"]["rules"]); ?></a></li>
|
||||
<!-- Nie mam na to czasu
|
||||
<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>
|
||||
@ -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>
|
||||
<?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>
|
||||
</div>
|
||||
<!-- /.navbar-collapse -->
|
||||
@ -97,14 +111,14 @@ require_once __DIR__ . "/../include/adminlist.php";
|
||||
|
||||
<div class="col-md-3 col-md-push-9">
|
||||
<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="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 class="text-center">
|
||||
<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>
|
||||
@ -113,7 +127,7 @@ require_once __DIR__ . "/../include/adminlist.php";
|
||||
|
||||
|
||||
<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">
|
||||
<?php echo $adminlist[0]; ?>
|
||||
</div>
|
||||
@ -129,9 +143,9 @@ require_once __DIR__ . "/../include/adminlist.php";
|
||||
<?php } ?>
|
||||
|
||||
<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">
|
||||
<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 »</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>
|
||||
|
47
include/language.php
Normal file
47
include/language.php
Normal 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;
|
||||
}
|
@ -40,19 +40,19 @@ function 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));
|
||||
}
|
||||
|
||||
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>
|
||||
<p>Skonfiguruj stronę według własnych potrzeb.</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>Edit the new file and tweak it to suite your needs.</p>';
|
||||
|
||||
die(showError($title, $text));
|
||||
}
|
||||
@ -101,7 +101,7 @@ function showError($title, $text) { ?>
|
||||
<?php echo $text; ?>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
Strona © <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 © <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>
|
||||
|
||||
|
Reference in New Issue
Block a user