From: Michael J. Rubinsky Date: Thu, 1 Jul 2010 17:48:36 +0000 (-0400) Subject: correctly display retweets X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9e6807a6def87b4278d2ec8a3236c024f46780c7;p=horde.git correctly display retweets --- diff --git a/horde/lib/Block/twitter_timeline.php b/horde/lib/Block/twitter_timeline.php index 7fcbe02c9..788375ec6 100644 --- a/horde/lib/Block/twitter_timeline.php +++ b/horde/lib/Block/twitter_timeline.php @@ -148,21 +148,38 @@ class Horde_Block_Horde_twitter_timeline extends Horde_Block /* links */ $body = Horde_Text_Filter::filter($tweet->text, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)); $body = preg_replace("/[@]+([A-Za-z0-9-_]+)/", "\\0", $body); - $profileLink = Horde::externalUrl('http://twitter.com/' . htmlspecialchars($tweet->user->screen_name), true); + + /* If this is a retweet, use the original author's profile info */ + if (!empty($tweet->retweeted_status)) { + $tweetObj = $tweet->retweeted_status; + } else { + $tweetObj = $tweet; + } + + /* These are all referencing the *original* tweet */ + $profileLink = Horde::externalUrl('http://twitter.com/' . htmlspecialchars($tweetObj->user->screen_name), true); + $profileImg = $tweetObj->user->profile_image_url; + $authorName = htmlspecialchars($tweetObj->user->screen_name, ENT_COMPAT, Horde_Nls::getCharset()); + $authorFullname = htmlspecialchars($tweetObj->user->name, ENT_COMPAT, Horde_Nls::getCharset()); + $createdAt = $tweetObj->created_at; + $appText = Horde_Text_Filter::filter($tweet->source, 'xss', array()); $html .= '
'; $html .= '
' . $profileLink - . '' . htmlspecialchars($tweet->user->screen_name) . '' - . '
' . $profileLink . htmlspecialchars($tweet->user->screen_name, ENT_COMPAT, Horde_Nls::getCharset()) . '
'; + . '' . $authorName . '' + . '
' . $profileLink . $authorName . '
'; $html .= '
'; $html .= $body; - $html .= '
' . sprintf(_("Posted %s via %s"), Horde_Date_Utils::relativeDateTime(strtotime($tweet->created_at), $GLOBALS['prefs']->getValue('date_format')), $appText) . '
'; -// if (!empty($tweet->retweeted_status)) { -// $html .= '
' . sprintf(_("Retweeted by %s"), $tweet->user->screen_name) . '
'; -// } + $html .= '
' . sprintf(_("Posted %s via %s"), Horde_Date_Utils::relativeDateTime(strtotime($createdAt), $GLOBALS['prefs']->getValue('date_format')), $appText) . '
'; + + /* Specify the retweeted status */ + if (!empty($tweet->retweeted_status)) { + $html .= '
' . sprintf(_("Retweeted by %s"), Horde::externalUrl('http://twitter.com/' . htmlspecialchars($tweet->user->screen_name), true)) . htmlspecialchars($tweet->user->screen_name) . '
'; + } + $html .= '
' . Horde::link('#', '', '', '', 'Horde.twitter.buildReply(\'' . $tweet->id . '\', \'' . $tweet->user->screen_name . '\', \'' . $tweet->user->name . '\')') . _("Reply") . ''; $html .= ' | ' . Horde::link('#', '', '', '', 'Horde.twitter.retweet(\'' . $tweet->id . '\')') . _("Retweet") . ''; - $html .= '
 
'; + $html .= '
 
'; } $html .= ''; $endpoint = Horde::url('services/twitter.php', true); diff --git a/horde/themes/facebook.css b/horde/themes/facebook.css index e388b3dfc..9c161fccb 100644 --- a/horde/themes/facebook.css +++ b/horde/themes/facebook.css @@ -124,7 +124,7 @@ width: 50px; } .fbstreambody { - padding: 0 0 0 60px; + padding: 0 0 0 70px; min-height: 60px; } .fbstreaminfo {