mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-29 18:59:21 +02:00
forum.php Added player outfit avatars and in-game position. Fix #256
This commit is contained in:
parent
fbca1b876b
commit
b252bca43a
@ -632,6 +632,8 @@
|
|||||||
// How to design/display hidden/closed/sticky threads.
|
// How to design/display hidden/closed/sticky threads.
|
||||||
$config['forum'] = array(
|
$config['forum'] = array(
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
'outfit_avatars' => true, // Show character outfit as forum avatar?
|
||||||
|
'player_position' => true, // Tutor, Community manager, God etc..?
|
||||||
'guildboard' => true,
|
'guildboard' => true,
|
||||||
'level' => 5,
|
'level' => 5,
|
||||||
'cooldownPost' => 1,//60,
|
'cooldownPost' => 1,//60,
|
||||||
|
77
forum.php
77
forum.php
@ -7,11 +7,15 @@ if (!$config['forum']['enabled']) admin_only($user_data);
|
|||||||
--- Znote AAC forum ---
|
--- Znote AAC forum ---
|
||||||
-------------------------------
|
-------------------------------
|
||||||
Created by Znote.
|
Created by Znote.
|
||||||
Version 1.2.
|
Version 1.3.
|
||||||
|
|
||||||
Changelog (1.0 --> 1.2):
|
Changelog (1.0 --> 1.2):
|
||||||
- Updated to the new date/clock time system
|
- Updated to the new date/clock time system
|
||||||
- Bootstrap design support.
|
- Bootstrap design support.
|
||||||
|
|
||||||
|
Changelog (1.2 --> 1.3):
|
||||||
|
- Show character outfit as avatar
|
||||||
|
- Show in-game position
|
||||||
*/
|
*/
|
||||||
// BBCODE support:
|
// BBCODE support:
|
||||||
function TransformToBBCode($string) {
|
function TransformToBBCode($string) {
|
||||||
@ -530,22 +534,35 @@ if (!empty($_GET)) {
|
|||||||
|
|
||||||
|
|
||||||
if ($access) {
|
if ($access) {
|
||||||
|
$threadPlayer = ($config['forum']['outfit_avatars'] || $config['forum']['player_position']) ? mysql_select_single("SELECT `id`, `group_id`, `sex`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons` FROM `players` WHERE `id`='".$threadData['player_id']."';") : false;
|
||||||
?>
|
?>
|
||||||
<font>LinkMap: <a href="forum.php">Forum</a> - <a href="?cat=<?php echo $getCat; ?>"><?php echo $getForum; ?></a></font><br>
|
<font>LinkMap: <a href="forum.php">Forum</a> - <a href="?cat=<?php echo $getCat; ?>"><?php echo $getForum; ?></a></font><br>
|
||||||
<font size="5" id="ThreadTitle">Viewing thread: <?php echo "<a href='?forum=". $getForum ."&cat=". $getCat ."&thread=". $threadData['id'] ."'>". $threadData['title'] ."</a>"; ?></font>
|
<font size="5" id="ThreadTitle">Viewing thread: <?php echo "<a href='?forum=". $getForum ."&cat=". $getCat ."&thread=". $threadData['id'] ."'>". $threadData['title'] ."</a>"; ?></font>
|
||||||
<table class="znoteTable ThreadTable table table-striped">
|
<table class="znoteTable ThreadTable table table-striped">
|
||||||
<tr class="yellow">
|
<tr class="yellow">
|
||||||
<th>
|
<th<?php if ($threadPlayer !== false) echo ' colspan="2"'; ?>>
|
||||||
<?php
|
<?php
|
||||||
echo getClock($threadData['created'], true);
|
echo getClock($threadData['created'], true);
|
||||||
?>
|
if ($threadPlayer === false): ?>
|
||||||
- Created by:
|
- Created by:
|
||||||
<?php
|
<?php
|
||||||
echo "<a href='characterprofile.php?name=". $threadData['player_name'] ."'>". $threadData['player_name'] ."</a>";
|
echo "<a href='characterprofile.php?name=". $threadData['player_name'] ."'>". $threadData['player_name'] ."</a>";
|
||||||
?>
|
endif;
|
||||||
|
?>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<?php if ($threadPlayer !== false): ?>
|
||||||
|
<td class="avatar">
|
||||||
|
<a href='characterprofile.php?name=<?php echo $threadData['player_name']; ?>'><?php echo $threadData['player_name']; ?></a>
|
||||||
|
<?php if ($config['forum']['outfit_avatars']): ?>
|
||||||
|
<br><img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $threadPlayer['looktype']; ?>&addons=<?php echo $threadPlayer['lookaddons']; ?>&head=<?php echo $threadPlayer['lookhead']; ?>&body=<?php echo $threadPlayer['lookbody']; ?>&legs=<?php echo $threadPlayer['looklegs']; ?>&feet=<?php echo $threadPlayer['lookfeet']; ?>" alt="img">
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($config['forum']['player_position']): ?>
|
||||||
|
<br><span><?php echo group_id_to_name($threadPlayer['group_id']); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<?php endif; ?>
|
||||||
<td>
|
<td>
|
||||||
<p><?php echo nl2br(TransformToBBCode($threadData['text'])); ?></p>
|
<p><?php echo nl2br(TransformToBBCode($threadData['text'])); ?></p>
|
||||||
</td>
|
</td>
|
||||||
@ -619,23 +636,49 @@ if (!empty($_GET)) {
|
|||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
// Display replies... (copy table above and edit each post)
|
// Display replies... (copy table above and edit each post)
|
||||||
$posts = mysql_select_multi("SELECT `id`, `player_name`, `text`, `created`, `updated` FROM `znote_forum_posts` WHERE `thread_id`='". $threadData['id'] ."' ORDER BY `created`;");
|
$posts = mysql_select_multi("SELECT `id`, `player_id`, `player_name`, `text`, `created`, `updated` FROM `znote_forum_posts` WHERE `thread_id`='". $threadData['id'] ."' ORDER BY `created`;");
|
||||||
if ($posts !== false) {
|
if ($posts !== false) {
|
||||||
|
// Load extra data (like outfit avatars?)
|
||||||
|
$players = array();
|
||||||
|
$extra = false;
|
||||||
|
if ($config['forum']['outfit_avatars'] || $config['forum']['player_position']) {
|
||||||
|
$extra = true;
|
||||||
|
|
||||||
|
foreach($posts as $post)
|
||||||
|
if (!isset($players[$post['player_id']]))
|
||||||
|
$players[$post['player_id']] = array();
|
||||||
|
|
||||||
|
$sql_players = mysql_select_multi("SELECT `id`, `group_id`, `sex`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons` FROM `players` WHERE `id` IN (".implode(',', array_keys($players)).");");
|
||||||
|
|
||||||
|
foreach ($sql_players as $player)
|
||||||
|
$players[$player['id']] = $player;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
foreach($posts as $post) {
|
foreach($posts as $post) {
|
||||||
?>
|
?>
|
||||||
<table class="znoteTable ThreadTable table table-striped">
|
<table class="znoteTable ThreadTable table table-striped">
|
||||||
<tr class="yellow">
|
<tr class="yellow">
|
||||||
<th>
|
<th<?php if ($extra) echo ' colspan="2"'; ?>>
|
||||||
<?php
|
<?php echo getClock($post['created'], true);
|
||||||
echo getClock($post['created'], true);
|
if (!$extra): ?>
|
||||||
?>
|
- Posted by:
|
||||||
- Posted by:
|
<?php echo "<a href='characterprofile.php?name=". $post['player_name'] ."'>". $post['player_name'] ."</a>";
|
||||||
<?php
|
endif; ?>
|
||||||
echo "<a href='characterprofile.php?name=". $post['player_name'] ."'>". $post['player_name'] ."</a>";
|
|
||||||
?>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<?php if ($extra): ?>
|
||||||
|
<td class="avatar">
|
||||||
|
<a href='characterprofile.php?name=<?php echo $post['player_name']; ?>'><?php echo $post['player_name']; ?></a>
|
||||||
|
<?php if ($config['forum']['outfit_avatars']): ?>
|
||||||
|
<br><img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $players[$post['player_id']]['looktype']; ?>&addons=<?php echo $players[$post['player_id']]['lookaddons']; ?>&head=<?php echo $players[$post['player_id']]['lookhead']; ?>&body=<?php echo $players[$post['player_id']]['lookbody']; ?>&legs=<?php echo $players[$post['player_id']]['looklegs']; ?>&feet=<?php echo $players[$post['player_id']]['lookfeet']; ?>" alt="img">
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($config['forum']['player_position']): ?>
|
||||||
|
<br><span><?php echo group_id_to_name($players[$post['player_id']]['group_id']); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<?php endif; ?>
|
||||||
<td>
|
<td>
|
||||||
<p><?php echo nl2br(TransformToBBCode($post['text'])); ?></p>
|
<p><?php echo nl2br(TransformToBBCode($post['text'])); ?></p>
|
||||||
</td>
|
</td>
|
||||||
|
@ -619,20 +619,26 @@ hr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#percent {
|
#percent {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-left:175px;
|
margin-left:175px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#bar {
|
#bar {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
background-color: green;
|
background-color: green;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ThreadTable td {
|
.ThreadTable td {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ThreadTable td.avatar {
|
||||||
|
min-width: 100px;
|
||||||
|
vertical-align: top;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
#ThreadTitle {
|
#ThreadTitle {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user