From 9ec395b07a8418e4540089d1c83653bee8dd40dd Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 25 Feb 2011 13:22:13 -0800 Subject: [PATCH 1/3] Workaround for reply timeline since_id issue: save the notice.created value into reply.modified, so we can key off it as expected. As a hack this removes the mysql_timestamp bit from the field settings on reply.modified so that our value actually gets saved. This *should* work ok as long as system timezone is set correctly, which we now set to UTC to match when connecting. --- classes/Notice.php | 2 ++ classes/statusnet.ini | 3 ++- plugins/TwitterBridge/twitterimport.php | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/Notice.php b/classes/Notice.php index c9cca8a969..a26a6f0f0d 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -1072,6 +1072,7 @@ class Notice extends Memcached_DataObject $reply->notice_id = $this->id; $reply->profile_id = $profile->id; + $reply->modified = $this->created; common_log(LOG_INFO, __METHOD__ . ": saving reply: notice $this->id to profile $profile->id"); @@ -1132,6 +1133,7 @@ class Notice extends Memcached_DataObject $reply->notice_id = $this->id; $reply->profile_id = $mentioned->id; + $reply->modified = $this->created; $id = $reply->insert(); diff --git a/classes/statusnet.ini b/classes/statusnet.ini index ef631e28d3..1916c25139 100644 --- a/classes/statusnet.ini +++ b/classes/statusnet.ini @@ -502,7 +502,8 @@ uri = U [reply] notice_id = 129 profile_id = 129 -modified = 384 +modified = 142 +;modified = 384 ; skipping the mysql_timestamp mode so we can override its setting replied_id = 1 [reply__keys] diff --git a/plugins/TwitterBridge/twitterimport.php b/plugins/TwitterBridge/twitterimport.php index 5ddf5380d7..0eacfcd62c 100644 --- a/plugins/TwitterBridge/twitterimport.php +++ b/plugins/TwitterBridge/twitterimport.php @@ -675,6 +675,7 @@ class TwitterImport $reply = new Reply(); $reply->notice_id = $notice->id; $reply->profile_id = $user->id; + $reply->modified = $notice->created; common_log(LOG_INFO, __METHOD__ . ": saving reply: notice {$notice->id} to profile {$user->id}"); $id = $reply->insert(); } From e00483d703d1c61770f3467eb290380f0988b593 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 25 Feb 2011 15:38:24 -0800 Subject: [PATCH 2/3] Test case for ticket #2248: flickr URLs with @ in the path get misinterpreted as mailto --- tests/URLDetectionTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/URLDetectionTest.php b/tests/URLDetectionTest.php index eac7ba3f5c..dc017ac616 100644 --- a/tests/URLDetectionTest.php +++ b/tests/URLDetectionTest.php @@ -20,6 +20,8 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase public function testProduction($content, $expected) { $rendered = common_render_text($content); + // hack! + $rendered = preg_replace('/id="attachment-\d+"/', 'id="attachment-XXX"', $rendered); $this->assertEquals($expected, $rendered); } @@ -269,7 +271,13 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase array('file.html', 'file.html'), array('file.php', - 'file.php') + 'file.php'), + + // scheme-less HTTP URLs with @ in the path: http://status.net/open-source/issues/2248 + array('http://flickr.com/photos/34807140@N05/3838905434', + 'http://flickr.com/photos/34807140@N05/3838905434'), + array('flickr.com/photos/34807140@N05/3838905434', + 'flickr.com/photos/34807140@N05/3838905434'), ); } } From 6a6584741f3d91bff2461421ef220b2bcae7847d Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 25 Feb 2011 15:46:35 -0800 Subject: [PATCH 3/3] Fix for ticket #2248: flickr etc URLs that contain @ in the paths etc no longer accidentally trip the mailto: thingy --- lib/util.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/util.php b/lib/util.php index 85f49e4c59..8dd22de592 100644 --- a/lib/util.php +++ b/lib/util.php @@ -922,11 +922,11 @@ function common_linkify($url) { // functions $url = htmlspecialchars_decode($url); - if(strpos($url, '@') !== false && strpos($url, ':') === false) { - //url is an email address without the mailto: protocol - $canon = "mailto:$url"; - $longurl = "mailto:$url"; - }else{ + if (strpos($url, '@') !== false && strpos($url, ':') === false && Validate::email($url)) { + //url is an email address without the mailto: protocol + $canon = "mailto:$url"; + $longurl = "mailto:$url"; + } else { $canon = File_redirection::_canonUrl($url);