From fcc9b06bdbda4e251594e6c13cc3c481ef68d4a9 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 19 Dec 2012 23:17:31 +0100 Subject: [PATCH 1/4] Improved README that explains how to get the API key. --- fromgplus/README | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fromgplus/README b/fromgplus/README index db5bb38e..82a29f66 100644 --- a/fromgplus/README +++ b/fromgplus/README @@ -7,4 +7,9 @@ $a->config['fromgplus']['poll_interval'] = 10; You need an API key for "Simple API Access". -You get it via https://code.google.com/apis/console/ and then "API Access". +- You go to https://code.google.com/apis/console/ +- Then you go to "Services" and activate "Google+ API". +- After that you go to "API Access". +- At the bottom of the page you see "Simple API Access". + +The value after "API key:" is the key that you need. From 804bf0d980ca1f149bc74999418bf0c6b64605fc Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 21 Dec 2012 00:11:06 +0100 Subject: [PATCH 2/4] fromgplus: Option for enabling and disabling the new "share" element in postings. --- fromgplus/fromgplus.php | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index a6760ca5..400dd92a 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -327,22 +327,27 @@ function fromgplus_fetch($a, $uid) { case "activity": $post = fromgplus_html2bbcode($item->annotation)."\n"; - $post .= fromgplus_html2bbcode("♲"); - //$post .= html2bbcode("♻"); - //$post .= fromgplus_html2bbcode("◌"); - $post .= " [url=".$item->object->actor->url."]".$item->object->actor->displayName."[/url] \n"; - /*$post .= "[share author='".$item->object->actor->displayName. - "' profile='".$item->object->actor->url. - "' avatar='".$item->object->actor->image->url. - "' link='".$item->object->url."']\n";*/ + if (intval(get_config('system','new_share'))) { + $post .= "[share author='".$item->object->actor->displayName. + "' profile='".$item->object->actor->url. + "' avatar='".$item->object->actor->image->url. + "' link='".$item->object->url."']"; - $post .= fromgplus_html2bbcode($item->object->content); + $post .= fromgplus_html2bbcode($item->object->content); - if (is_array($item->object->attachments)) - $post .= "\n".trim(fromgplus_handleattachments($item)); + if (is_array($item->object->attachments)) + $post .= "\n".trim(fromgplus_handleattachments($item)); - //$post .= "[/share]"; + $post .= "[/share]"; + } else { + $post .= fromgplus_html2bbcode("♲"); + $post .= " [url=".$item->object->actor->url."]".$item->object->actor->displayName."[/url] \n"; + $post .= fromgplus_html2bbcode($item->object->content); + + if (is_array($item->object->attachments)) + $post .= "\n".trim(fromgplus_handleattachments($item)); + } if (isset($item->address)) $location = $item->address; From 168f675f273be26ca264f0f090eabe2918207b47 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 21 Dec 2012 02:11:49 +0100 Subject: [PATCH 3/4] The attribut value for the "share" attribut "author" is now escaped. --- fromgplus/fromgplus.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 400dd92a..f7841300 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -329,7 +329,7 @@ function fromgplus_fetch($a, $uid) { $post = fromgplus_html2bbcode($item->annotation)."\n"; if (intval(get_config('system','new_share'))) { - $post .= "[share author='".$item->object->actor->displayName. + $post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName). "' profile='".$item->object->actor->url. "' avatar='".$item->object->actor->image->url. "' link='".$item->object->url."']"; From e58decc5f2dc39ca20b5831779d3ac483c038deb Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 21 Dec 2012 14:57:45 +0100 Subject: [PATCH 4/4] privacy_image_cache: If the cached file would be too long then don't cache it. --- privacy_image_cache/privacy_image_cache.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/privacy_image_cache/privacy_image_cache.php b/privacy_image_cache/privacy_image_cache.php index a47f0e1a..3be42620 100644 --- a/privacy_image_cache/privacy_image_cache.php +++ b/privacy_image_cache/privacy_image_cache.php @@ -226,13 +226,21 @@ function privacy_image_cache_cachename($url, $writemode = false) { * @return boolean */ function privacy_image_cache_is_local_image($url) { - if ($url[0] == '/') return true; + if ($url[0] == '/') return true; + if (strtolower(substr($url, 0, 5)) == "data:") return true; + // Check if the cached path would be longer than 255 characters - apache doesn't like it + if (is_dir($_SERVER["DOCUMENT_ROOT"]."/privacy_image_cache")) { + $cachedurl = get_app()->get_baseurl()."/privacy_image_cache/". privacy_image_cache_cachename($url); + if (strlen($url) > 255) + return true; + } + // links normalised - bug #431 - $baseurl = normalise_link(get_app()->get_baseurl()); + $baseurl = normalise_link(get_app()->get_baseurl()); $url = normalise_link($url); - return (substr($url, 0, strlen($baseurl)) == $baseurl); + return (substr($url, 0, strlen($baseurl)) == $baseurl); } /**