mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 05:00:49 +08:00
medal management
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.6.0-beta12');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2020-06-23');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2021-06-23');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -2920,9 +2920,16 @@ function commenttable($rows, $type, $parent_id, $review = false)
|
||||
$count = 0;
|
||||
if ($Advertisement->enable_ad())
|
||||
$commentad = $Advertisement->get_ad('comment');
|
||||
|
||||
$uidArr = array_unique(array_column($rows, 'user'));
|
||||
$neededColumns = array('id', 'noad', 'class', 'enabled', 'privacy', 'avatar', 'signature', 'uploaded', 'downloaded', 'last_access', 'username', 'donor', 'leechwarn', 'warned', 'title');
|
||||
$userInfoArr = \App\Models\User::query()->with(['valid_medals'])->find($uidArr, $neededColumns)->keyBy('id');
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$userRow = get_user_row($row['user']);
|
||||
// $userRow = get_user_row($row['user']);
|
||||
$userInfo = $userInfoArr->get($row['user']);
|
||||
$userRow = $userInfo->toArray();
|
||||
if ($count>=1)
|
||||
{
|
||||
if ($Advertisement->enable_ad()){
|
||||
@@ -2931,7 +2938,7 @@ function commenttable($rows, $type, $parent_id, $review = false)
|
||||
}
|
||||
}
|
||||
print("<div style=\"margin-top: 8pt; margin-bottom: 8pt;\"><table id=\"cid".$row["id"]."\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td class=\"embedded\" width=\"99%\">#" . $row["id"] . " <font color=\"gray\">".$lang_functions['text_by']."</font>");
|
||||
print(get_username($row["user"],false,true,true,false,false,true));
|
||||
print(build_medal_image($userInfo->valid_medals, 20) . get_username($row["user"],false,true,true,false,false,true));
|
||||
print(" <font color=\"gray\">".$lang_functions['text_at']."</font>".gettime($row["added"]).
|
||||
($row["editedby"] && get_user_class() >= $commanage_class ? " - [<a href=\"comment.php?action=vieworiginal&cid=".$row['id']."&type=".$type."\">".$lang_functions['text_view_original']."</a>]" : "") . "</td><td class=\"embedded nowrap\" width=\"1%\"><a href=\"#top\"><img class=\"top\" src=\"pic/trans.gif\" alt=\"Top\" title=\"Top\" /></a> </td></tr></table></div>");
|
||||
$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars(trim($userRow["avatar"])) : "");
|
||||
@@ -5259,4 +5266,13 @@ function msgalert($url, $text, $bgcolor = "red")
|
||||
print("</td></tr></table></p><br />");
|
||||
}
|
||||
|
||||
function build_medal_image(\Illuminate\Support\Collection $medals, $maxHeight = 200): string
|
||||
{
|
||||
$medalImages = [];
|
||||
foreach ($medals as $medal) {
|
||||
$medalImages[] = sprintf('<img src="%s" title="%s" style="max-height: %spx"/>', $medal->image_large, $medal->name, $maxHeight);
|
||||
}
|
||||
return implode('', $medalImages);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user