From 584ea1b23c540cdd781f52eeecd6ad893f63c1a8 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 10 Sep 2009 12:13:43 -0400 Subject: Revert "If a shortened URL begins with http://, don't include it in the shortened url. Saves 7 characters, which is pretty awesome for 140 character max length notices." This reverts commit e2848eb8621dd645fa68cb1641c0af1df5530408. Downstream consumers of our notices (such as Friendfeed, Facebook, etc) don't have sophisticated URL detection, so a notice that reads: "check out ur1.ca/1" won't be linked. So the http:// prefix is mandatory. --- lib/util.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index 3e95d2bea..256acf199 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1414,9 +1414,6 @@ function common_shorten_url($long_url) curl_close($curlh); - if(substr($short_url,0,7)=='http://'){ - $short_url = substr($short_url,7); - } return $short_url; } -- cgit v1.2.3-54-g00ecf From 2a56245614f90221946ab918e820f6546133a212 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 10 Sep 2009 21:13:30 -0400 Subject: Re-use enclosure decision logic to decide if a link gets a paperclip/lightbox popup. --- lib/util.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index 256acf199..292045928 100644 --- a/lib/util.php +++ b/lib/util.php @@ -552,12 +552,13 @@ function common_linkify($url) { } if (!empty($f)) { - if (isset($f->filename)) { + if ($f->isEnclosure()) { $is_attachment = true; $attachment_id = $f->id; - } else { // if it has OEmbed info, it's an attachment, too + } else { $foe = File_oembed::staticGet('file_id', $f->id); if (!empty($foe)) { + // if it has OEmbed info, it's an attachment, too $is_attachment = true; $attachment_id = $f->id; -- cgit v1.2.3-54-g00ecf From 292bb7c4d8ca469447385e29a80f125e03284d70 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 10 Sep 2009 21:19:38 -0400 Subject: Allow @ signs in the path, querystring, and fragment parts of URLs --- lib/util.php | 6 +++--- tests/URLDetectionTest.php | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index 292045928..b831859e9 100644 --- a/lib/util.php +++ b/lib/util.php @@ -442,9 +442,9 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) { ')'. '(?:'. '(?:\:\d+)?'. //:port - '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"]*)?'. // /path - '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\/]*)?'. // ?query string - '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\/\?\#]*)?'. // #fragment + '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@]*)?'. // /path + '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@\/]*)?'. // ?query string + '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\@/\?\#]*)?'. // #fragment ')(?http://www.somesite.com/xyz/35637563@N00/52803365/ link'), array('http://127.0.0.1', 'http://127.0.0.1'), array('127.0.0.1', -- cgit v1.2.3-54-g00ecf From 20997619b353faa94591800fbfc02bc19a4cdce3 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Sun, 13 Sep 2009 01:24:57 -0400 Subject: When viewing a page in https, all links to non-actions (links to CSS, JS, etc) should be https. Fixes the mixed content warnings that browsers display. Fixes http://status.net/trac/ticket/1552 --- lib/util.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index b831859e9..5b57b79b5 100644 --- a/lib/util.php +++ b/lib/util.php @@ -750,8 +750,18 @@ function common_local_url($action, $args=null, $params=null, $fragment=null) return $url; } -function common_path($relative, $ssl=false) +function common_path($relative, $ssl=null) { + if($ssl==null) { + //ssl was not specifically requested + if( $_SERVER['HTTPS'] && $_SERVER['HTTPS']!="off" ) { + //currently in https, so stay in https + $ssl=true; + } else { + //not in https, so stay not in https + $ssl=false; + } + } $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : ''; if (($ssl && (common_config('site', 'ssl') === 'sometimes')) -- cgit v1.2.3-54-g00ecf From bef4a8b6ba9e19f2ec629031444279ca76f17bcf Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 23 Sep 2009 09:34:55 -0400 Subject: Revert "When viewing a page in https, all links to non-actions (links to CSS, JS, etc) should be https. Fixes the mixed content warnings that browsers display." This reverts commit 20997619b353faa94591800fbfc02bc19a4cdce3. The commit doesn't take into account having different servers (theme server, avatar server) and being able to set HTTPS for some but not all. --- lib/util.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index 5b57b79b5..b831859e9 100644 --- a/lib/util.php +++ b/lib/util.php @@ -750,18 +750,8 @@ function common_local_url($action, $args=null, $params=null, $fragment=null) return $url; } -function common_path($relative, $ssl=null) +function common_path($relative, $ssl=false) { - if($ssl==null) { - //ssl was not specifically requested - if( $_SERVER['HTTPS'] && $_SERVER['HTTPS']!="off" ) { - //currently in https, so stay in https - $ssl=true; - } else { - //not in https, so stay not in https - $ssl=false; - } - } $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : ''; if (($ssl && (common_config('site', 'ssl') === 'sometimes')) -- cgit v1.2.3-54-g00ecf