Merge pull request #87 from annando/master

bugfixing in the "privacy_image_cache" and support for "share" in fromgplus
This commit is contained in:
friendica 2012-12-22 23:05:19 -08:00
commit fc4bb9ee70
3 changed files with 34 additions and 16 deletions

View file

@ -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.

View file

@ -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='".str_replace("'", "'",$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;

View file

@ -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);
}
/**