Timeline bugfixes

This commit is contained in:
daisuke
2021-03-27 12:04:26 -06:00
parent ed37590c5f
commit 5b558b6df6
5 changed files with 34 additions and 10 deletions

View File

@ -138,7 +138,7 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
continue;
}
$post['name'] = emojify($elem['reblog']['account']['display_name'], $elem['reblog']['account']['emojis'], 20);
$post['name'] = (empty($elem['reblog']['account']['display_name']) ? $elem['reblog']['account']['acct'] : emojify($elem['reblog']['account']['display_name'], $elem['reblog']['account']['emojis'], 20));
$post['uid'] = $elem['reblog']['account']['id'];
$post['acct'] = '';//$elem['reblog']['account']['acct'];
$post['handle'] = explode("@",$elem['reblog']['account']['acct'])[0];
@ -148,7 +148,7 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
$elem = $elem['reblog'];
}
else {
$post['name'] = emojify($elem['account']['display_name'], $elem['account']['emojis'], 20);
$post['name'] = (empty($elem['account']['display_name']) ? $elem['account']['acct'] : emojify($elem['account']['display_name'], $elem['account']['emojis'], 20));
$post['uid'] = $elem['account']['id'];
$post['acct'] = "(@".$elem['account']['acct'].")";
$post['handle'] = explode("@",$elem['account']['acct'])[0];
@ -268,7 +268,8 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
/* if the post is marked as sensitive and nsfw hiding isn't turned off, we'll blur the image */
if ($elem['sensitive'] == true && $user_settings['explicit'] != 'off') {
$post['media'] .= " <div style='overflow:hidden; float:left; margin:2px;background-color:#".(($class != "") || ($elem['sensitive'] == true && $user_settings['explicit'] != 'off') ? averageColor($file['url']) : "000")."!important; ".($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;")."' $class>
//$post['media'] .= " <div style='overflow:hidden; float:left; margin:2px;background-color:#".(($class != "") || ($elem['sensitive'] == true && $user_settings['explicit'] != 'off') ? averageColor($file['url']) : "000")."!important; ".($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;")."' $class>
$post['media'] .= " <div style='overflow:hidden; float:left; margin:2px;background-color:#".(($class != "") || ($elem['sensitive'] == true && $user_settings['explicit'] != 'off') ? "000" : "000")."!important; ".($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;")."' $class>
<div class='toggleblur' style='height:25px;'>&#xe81b; Blur</div>
<a target='_blank' href='" . $file['url'] . "' onClick='return false;' style='width:100%;' class='blur'>
<noscript><img src='" . $file['url'] . "' style='width:100%;'></noscript>
@ -282,11 +283,12 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
else {
/* If the post was sensitive and wasn't caught by the nsfw filter and
didn't got blurred, then the image will be shown normally */
$post['media'] .= "<div style='margin:0px; ".($images == 3 && $m == 3 ? "width:100% !important;" : "")."background-color:#".($class != "" ? averageColor($file['url']) : "000").";' $class><a target='_blank' href='" . $file['url'] . "' onClick='return false;' class='open-lightbox'><img " . ($e < 2 ? "src='" . $file['url'] . "'" : "data-src='" . $file['url'] . "'") . " class='lazyload' style='" . ($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;") . " vertical-align:middle;'><noscript><img src='" . $file['url'] . "' style='width:100%;'></noscript></a></div>";
$post['media'] .= "<div style='margin:0px; ".($images == 3 && $m == 3 ? "width:100% !important;" : "")."background-color:#".($class != "" ? "000" : "000").";' $class><a target='_blank' href='" . $file['url'] . "' onClick='return false;' class='open-lightbox'><img " . ($e < 2 ? "src='" . $file['url'] . "'" : "data-src='" . $file['url'] . "'") . " class='lazyload' style='" . ($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;") . " vertical-align:middle;'><noscript><img src='" . $file['url'] . "' style='width:100%;'></noscript></a></div>";
// $post['media'] .= "<div style='margin:0px; ".($images == 3 && $m == 3 ? "width:100% !important;" : "")."background-color:#".($class != "" ? averageColor($file['url']) : "000").";' $class><a target='_blank' href='" . $file['url'] . "' onClick='return false;' class='open-lightbox'><img " . ($e < 2 ? "src='" . $file['url'] . "'" : "data-src='" . $file['url'] . "'") . " class='lazyload' style='" . ($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;") . " vertical-align:middle;'><noscript><img src='" . $file['url'] . "' style='width:100%;'></noscript></a></div>";
}
} else {
$post['media'] .= "<center><table><tr><td><a href='".$file['url']."' download><img src='img/doc.png' width=40 border=0></a></td><td><a href='".$file['url']."' target='_blank'>".$file['description']."</a></td></tr></table></center>";
$post['media'] .= "<center><table><tr><td><a href='".$file['remote_url']."' download><img src='img/doc.png' width=40 border=0></a></td><td><a href='".$file['url']."' target='_blank'>".$file['description']."</a></td></tr></table></center>";
}
$m++;