New layout (Znote AAC AtomIO)

Layout is primarily changed to this because the old layout had obsolete javascript dependencies.
I still want to make another default layout eventually, which is mobile friendly.
This layout has a very nice character search widget though
that looks for names realtime and displays them in a list beside the search.
This commit is contained in:
Znote
2020-06-12 22:14:50 +02:00
parent e3c3b766be
commit 203fe3d5ae
71 changed files with 10152 additions and 0 deletions

58
layout/widgets/admin.php Normal file
View File

@@ -0,0 +1,58 @@
<div class="well myaccount_widget widget" id="loginContainer">
<div class="header">
Administration
</div>
<div class="body">
<ul class="linkbuttons">
<li>
<a href='admin.php'>Admin Page</a>
</li>
<li>
<a href='admin_news.php'>Admin News</a>
</li>
<li>
<a href='admin_gallery.php'>Admin Gallery</a>
</li>
<li>
<a href='admin_skills.php'>Admin Skills</a>
</li>
<li>
<a href='admin_reports.php'>Admin Reports</a>
</li>
<li>
<a href='admin_helpdesk.php'>Admin Helpdesk</a>
</li>
<li>
<a href='admin_shop.php'>Admin Shop</a>
</li>
<li>
<a href='admin_auction.php'>Admin Auction</a>
</li>
<?php
$new = 0;
$cat = 4; //Category ID for feedback section
$threads = mysql_select_multi("SELECT `id`, `player_id` FROM `znote_forum_threads` WHERE `forum_id`='$cat' AND `closed`='0';");
if ($threads !== false) {
$staffs = mysql_select_multi("SELECT `id` FROM `players` WHERE `group_id` > '1';");
foreach($threads as $thread) {
$response = false;
$posts = mysql_select_multi("SELECT `id`, `player_id` FROM `znote_forum_posts` WHERE `thread_id`='". $thread['id'] ."';");
if ($posts !== false) {
foreach($posts as $post) {
foreach ($staffs as $staff) {
if ($post['player_id'] == $staff['id']) $response = true;
}
}
}
if (!$response) $new++;
}
}
?>
<li>
<a href='forum.php?cat=4'>Feedback: [<?php echo $new; ?>] new</a>
</li>
</ul>
</div>
</div>

View File

@@ -0,0 +1,62 @@
<div class="well search_widget" id="searchContainer">
<div class="header">
Character search
</div>
<div class="body">
<div class="relative">
<div id="name_suggestion">
<div class="sname"><a href="characterprofile.php?name=Luxitur">Luxitur</a></div>
<div class="sname">
<a href="characterprofile.php?name=Luxitur">Luxitur</a>
</div>
</div>
</div>
<form class="searchForm" action="characterprofile.php" method="get">
<label for="src_name">Search: </label><input autocomplete="off" type="text" name="name" id="src_name" class="search" placeholder="Name . . .">
</form>
<?php
$cache = new Cache('engine/cache/characterNames');
if ($cache->hasExpired()) {
$names_sql = mysql_select_multi('SELECT `name` FROM `players` ORDER BY `name` ASC;');
$names = array();
foreach ($names_sql as $name) {
$names[] = $name['name'];
}
$cache->setContent($names);
$cache->save();
} else {
$names = $cache->load();
}
?>
<script type="text/javascript">
window.searchNames = <?php echo json_encode($names)?>;
$(function() {
if (window.searchNames.length > 0) {
$('#src_name').keyup(function(e) {
$('#name_suggestion').html('');
var search = $(this).val().toLowerCase();
var results = new Array();
if (search.length > 0) {
var i = 0;
for (i; i < window.searchNames.length && results.length < 10; i+=1) {
if (window.searchNames[i].toLowerCase().indexOf(search) > -1) {
results.push(window.searchNames[i]);
}
}
}
if (results.length > 0) {
i = 0;
var search_html = "";
for (i; i < results.length; i+=1) {
search_html += '<div class="sname"><a href="characterprofile.php?name='+results[i]+'">'+results[i]+'</a></div>';
}
$('#name_suggestion').addClass('show').html(search_html);
} else {
$('#name_suggestion.show').removeClass('show');
}
});
}
});
</script>
</div>
</div>

View File

@@ -0,0 +1,21 @@
<div class="well widget">
<div class="header">
View Highscores
</div>
<div class="body">
<form action="highscores.php" method="get">
<select name="type">
<option value="7">Experience</option>
<option value="5">Shielding</option>
<option value="3">Axe</option>
<option value="2">Sword</option>
<option value="1">Club</option>
<option value="4">Distance</option>
<option value="9">Fist</option>
<option value="6">Fish</option>
<option value="8">Magic</option>
</select>
<input type="submit" value="Fetch scoreboard">
</form>
</div>
</div>

20
layout/widgets/houses.php Normal file
View File

@@ -0,0 +1,20 @@
<div class="well widget">
<div class="header">
Town list / houses
</div>
<div class="body">
<form action="houses.php" method="<?php if ($config['ServerEngine'] !== 'TFS_10') echo "post"; else echo "get" ;?>">
<select name="<?php if ($config['ServerEngine'] !== 'TFS_10') echo "selected"; else echo "id" ;?>">
<?php
foreach ($config['towns'] as $id => $name)
echo '<option value="'. $id .'">'. $name .'</option>';
?>
</select>
<?php
/* Form file */
if ($config['ServerEngine'] !== 'TFS_10') Token::create();
?>
<input type="submit" value="Fetch houses">
</form>
</div>
</div>

31
layout/widgets/login.php Normal file
View File

@@ -0,0 +1,31 @@
<div class="well loginContainer widget" id="loginContainer">
<div class="header">
Login / Register
</div>
<div class="body">
<form class="loginForm" action="login.php" method="post">
<div class="well">
<label for="login_username">Userame:</label> <input type="text" name="username" id="login_username">
</div>
<div class="well">
<label for="login_password">Password:</label> <input type="password" name="password" id="login_password">
</div>
<?php if ($config['twoFactorAuthenticator']): ?>
<div class="well">
<label for="login_password">Token:</label> <input type="password" name="authcode">
</div>
<?php endif; ?>
<div class="well">
<input type="submit" value="Log in" class="submitButton">
</div>
<?php
/* Form file */
Token::create();
?>
<center>
<h3><a href="register.php">New account</a></h3>
<p>Lost <a href="recovery.php?mode=username">username</a> or <a href="recovery.php?mode=password">password</a>?</p>
</center>
</form>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<div class="well myaccount_widget widget" id="loginContainer">
<div class="header">
Welcome, <?php if ($config['ServerEngine'] !== 'OTHIRE') echo $user_data['name']; else echo $user_data['id'];?>.
</div>
<div class="body">
<ul class="linkbuttons">
<li>
<a href='myaccount.php'>My Account</a>
</li>
<li>
<a href='createcharacter.php'>Create Character</a>
</li>
<li>
<a href='changepassword.php'>Change Password</a>
</li>
<li>
<a href='settings.php'>Settings</a>
</li>
<li>
<a href='logout.php'>Logout</a>
</li>
</ul>
</div>
</div>

View File

@@ -0,0 +1,34 @@
<div class="well widget">
<div class="header">
Server Information
</div>
<div class="body">
<ul>
<?php
$status = true;
if ($config['status']['status_check']) {
@$sock = fsockopen ($config['status']['status_ip'], $config['status']['status_port'], $errno, $errstr, 1);
if(!$sock) {
echo "<span style='color:red;font-weight:bold;'><center>Server Offline!</center></span><br/>";
$status = false;
}
else {
$info = chr(6).chr(0).chr(255).chr(255).'info';
fwrite($sock, $info);
$data='';
while (!feof($sock))$data .= fgets($sock, 1024);
fclose($sock);
echo "<span style='color:green;font-weight:bold;'><center>Server Online!</center></span><br />";
}
}
if ($status) {
?>
<li><a href="onlinelist.php">Players online:
<?php echo user_count_online(); ?></a></li>
<?php
}
?>
<li>Registered accounts: <?php echo user_count_accounts();?></li>
</ul>
</div>
</div>

View File

@@ -0,0 +1,27 @@
<div class="well widget">
<div class="header">
Top 5 players
</div>
<div class="body">
<table>
<?php
$cache = new Cache('engine/cache/topPlayer');
if ($cache->hasExpired()) {
$players = mysql_select_multi('SELECT `name`, `level`, `experience` FROM `players` WHERE `group_id` < ' . $config['highscore']['ignoreGroupId'] . ' ORDER BY `level` DESC, `experience` DESC LIMIT 5;');
$cache->setContent($players);
$cache->save();
} else {
$players = $cache->load();
}
if ($players) {
foreach($players as $count => $player) {
$nr = $count+1;
echo "<tr><td>{$nr}</td><td><a href='characterprofile.php?name={$player['name']}'>{$player['name']}</a> ({$player['level']}).</td></tr>";
}
}
?>
</table>
</div>
</div>

11
layout/widgets/vote.php Normal file
View File

@@ -0,0 +1,11 @@
<div class="well vote_widget" id="loginContainer">
<div class="header">
Vote for us!
</div>
<div class="body">
<form type="submit" action="voting.php" method="GET">
Get points by voting at OTServers.eu
<input type="submit" value="Vote">
</form>
</div>
</div>