From 5b558b6df693bf4a048d5d74ce84a0fed30615d1 Mon Sep 17 00:00:00 2001 From: daisuke Date: Sat, 27 Mar 2021 12:04:26 -0600 Subject: [PATCH] Timeline bugfixes --- include/functions.php | 11 ++++++++--- js/scripts.js | 8 ++++++++ layout/footer.php | 4 ++++ layout/header.php | 9 +++++++-- modules/timeline.php | 12 +++++++----- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/include/functions.php b/include/functions.php index e49f361..891f9d3 100644 --- a/include/functions.php +++ b/include/functions.php @@ -553,7 +553,7 @@ function timeline($query) { $notes = ""; $hq = array(); - $hq['limit'] = 30; + $hq['limit'] = 10; $hq['only_media'] = ($query['text'] == "off" ? 'true' : 'false'); if ($query['next']){ $hq['max_id'] = $query['next']; @@ -858,7 +858,7 @@ function getnotif($id = false, $max = false) { if (!isset($post["type"])){ break; } - $user = "" . emojify($post['account']['display_name'], $post['account']['emojis'], 10) . ""; + $user = "" . (empty($post['account']['display_name']) ? $post['account']['acct'] : emojify($post['account']['display_name'], $post['account']['emojis'], 10)) . ""; $preview = ""; $buttons = ""; $media = ""; @@ -964,6 +964,7 @@ function getnotif($id = false, $max = false) { function processText($elem) { global $user_settings; + global $logedin; require_once "vendor/simple_html_dom.php"; $content = trim(html_entity_decode($elem['content'],ENT_QUOTES)); $content = preg_replace("/<(?=[^>]*(?:<|$))/","<",$content); @@ -1007,7 +1008,11 @@ function processText($elem) { //$result = preg_replace("/(?$1", $result); $result = emojify($result, $elem['emojis']); - $result = preg_replace("/#([A-Za-z0-9\/\.]*)/", "#$1", $result); + if ($logedin){ + $result = preg_replace("/#([A-Za-z0-9\/\.]*)/", "#$1", $result); + } else { + $result = preg_replace("/#([A-Za-z0-9\/\.]*)/", "#$1", $result); + } return $result; } diff --git a/js/scripts.js b/js/scripts.js index 4fd2326..4c6f394 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -462,6 +462,9 @@ $('body').on('click', '.loadmore', function() { }); function newPosts() { + + var url = window.location.href; + var thread = getUrlParameter('thread'); if (typeof thread !== 'undefined') { return false; @@ -485,6 +488,11 @@ function newPosts() { } $.get("index.php?ajax=1&since=" + id + "" + pageMode, function(data) { + + if (window.location.href !== url){ + return false; + } + if (data) { var scroll = $(window).scrollTop(); if (scroll > 1000) { diff --git a/layout/footer.php b/layout/footer.php index 9502df5..7f18b46 100644 --- a/layout/footer.php +++ b/layout/footer.php @@ -38,6 +38,10 @@ $query = http_build_query(array_filter(array( return false; } $.get("action.php?a=true¬es=" + thread, function(data) { + thread = getUrlParameter('thread'); + if (typeof thread == 'undefined') { + return false; + } $( ".post_notes" ).html(data); }); }, 15000); diff --git a/layout/header.php b/layout/header.php index e766e5d..7cf98cf 100644 --- a/layout/header.php +++ b/layout/header.php @@ -84,7 +84,7 @@ if ($logedin) {
- + " style="font-family: 'patua', serif; font-weight:bold; color:white; font-size:20px; text-decoration:none" > @@ -114,8 +114,13 @@ if ($logedin) { - + + + + "' class='fontello topicon' style='text-decoration:none; display:inline; font-size:20px;'> + + diff --git a/modules/timeline.php b/modules/timeline.php index 18db713..8326bf4 100644 --- a/modules/timeline.php +++ b/modules/timeline.php @@ -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'] .= "