Added dedicated rules page

This commit is contained in:
Wruczek 2016-07-01 04:35:15 +02:00
parent 1305489f26
commit 28e1ee34fe
5 changed files with 83 additions and 1 deletions

35
config/rules.md Normal file
View File

@ -0,0 +1,35 @@
### Regulamin serwera
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>
### 1. Definicje
1. Teamspeak - oprogramowanie służące do komunikacji...
2. ...
### 2. Postanowienia ogólne
1. Serwer Teamspeak pod adresem "127.0.0.1" jest...
2. ...
### 3. Tytuł
1. Lista
- Sublista
- Sublista
- Sublista
2. Lista
3. Lista
### 4. Tytuł
- Lista
- Lista
- Lista
### 5. Tabela kar
Przewinienie | Kara
------------ | -------------
Wulgarny nick | Kick z serwera
Wulgarna nazwa kanału | Usunięcie z kanału
Wyzywanie użytkowników | Ban do 7 dni
Zniewaga administracji | Ban permanentny

View File

@ -7,7 +7,7 @@
<p class="pull-left">&copy; <?php echo $config["general"]["title"]; ?> 2016</p>
<div class="pull-right">
<ul class="list-inline">
<li>Strona &copy; <a href="http://wruczek.top">Wruczek</a> 2016 | <a href="https://github.com/Wruczek/ts-website">ts-website</a> v 1.2.2 | MIT License</li>
<li>Strona &copy; <a href="http://wruczek.top">Wruczek</a> 2016 | <a href="https://github.com/Wruczek/ts-website">ts-website</a> v 1.2.3 | MIT License</li>
</ul>
</div>
</footer>

View File

@ -60,6 +60,7 @@ require_once __DIR__ . "/../include/adminlist.php";
<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>
<!-- 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>

View File

@ -869,6 +869,9 @@ class Parsedown
'element' => array(
'name' => 'table',
'handler' => 'elements',
'attributes' => array(
'class' => 'table table-bordered table-hover table-responsive'
),
),
);

43
rules.php Normal file
View File

@ -0,0 +1,43 @@
<?php
require_once __DIR__ . "/include/header.php";
require_once __DIR__ . "/lib/parsedown/parsedown.php";
$parsedown = new Parsedown();
$path = __DIR__ . "/config/rules.md";
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>';
} else {
$file = readFileContent($path);
if(!$file) {
echo '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd: nie można odczytać pliku z regulaminem</div>';
} else {
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-book" aria-hidden="true"></i> Regulamin serwera</h3>
</div>
<div class="panel-body">
<?php echo $parsedown->text($file); ?>
</div>
</div>
<?php
}}
// *******
// METHODS
// *******
function readFileContent($file) {
$fopen = @fopen($file, "r");
if(!$fopen) return false;
$text = fread($fopen,filesize($file));
fclose($fopen);
return $text;
}
require_once __DIR__ . "/include/footer.php";
?>