mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-22 08:03:45 +00:00
Fixed problems with images where the address contains special chars
This commit is contained in:
parent
129fff8fc1
commit
56fd821c7e
4 changed files with 16 additions and 5 deletions
|
@ -1004,6 +1004,10 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
if(preg_match("/\[img\](.*?)\[\/img\]/is",$b['body'],$matches))
|
if(preg_match("/\[img\](.*?)\[\/img\]/is",$b['body'],$matches))
|
||||||
$image = $matches[1];
|
$image = $matches[1];
|
||||||
|
|
||||||
|
// When saved into the database the content is sent through htmlspecialchars
|
||||||
|
// That means that we have to decode all image-urls
|
||||||
|
$image = htmlspecialchars_decode($image);
|
||||||
|
|
||||||
// Checking for a bookmark element
|
// Checking for a bookmark element
|
||||||
$body = $b['body'];
|
$body = $b['body'];
|
||||||
if (strpos($body, "[bookmark") !== false) {
|
if (strpos($body, "[bookmark") !== false) {
|
||||||
|
@ -1110,10 +1114,10 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
'access_token' => $fb_token,
|
'access_token' => $fb_token,
|
||||||
'message' => $msg
|
'message' => $msg
|
||||||
);
|
);
|
||||||
if(isset($image)) {
|
if(trim($image) != "") {
|
||||||
$postvars['picture'] = $image;
|
$postvars['picture'] = $image;
|
||||||
}
|
}
|
||||||
if(isset($link)) {
|
if(trim($link) != "") {
|
||||||
$postvars['link'] = $link;
|
$postvars['link'] = $link;
|
||||||
|
|
||||||
// The following doesn't work - why?
|
// The following doesn't work - why?
|
||||||
|
@ -1121,7 +1125,7 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
$postvars['source'] = $link;
|
$postvars['source'] = $link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isset($linkname))
|
if(trim($linkname) != "")
|
||||||
$postvars['name'] = $linkname;
|
$postvars['name'] = $linkname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ function privacy_image_cache_img_cb($matches) {
|
||||||
if (privacy_image_cache_is_local_image($matches[2]))
|
if (privacy_image_cache_is_local_image($matches[2]))
|
||||||
return $matches[1] . $matches[2] . $matches[3];
|
return $matches[1] . $matches[2] . $matches[3];
|
||||||
|
|
||||||
return $matches[1] . get_app()->get_baseurl() . "/privacy_image_cache/?url=" . escape_tags(addslashes(rawurlencode($matches[2]))) . $matches[3];
|
return $matches[1] . get_app()->get_baseurl() . "/privacy_image_cache/?url=" . addslashes(rawurlencode(htmlspecialchars_decode($matches[2]))) . $matches[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -503,10 +503,14 @@ function statusnet_post_hook(&$a,&$b) {
|
||||||
$msg = implode(' ', $e);
|
$msg = implode(' ', $e);
|
||||||
$msg .= '... ' . $shortlink;
|
$msg .= '... ' . $shortlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$msg = trim($msg);
|
||||||
|
|
||||||
// and now dent it :-)
|
// and now dent it :-)
|
||||||
if(strlen($msg)) {
|
if(strlen($msg)) {
|
||||||
$result = $dent->post('statuses/update', array('status' => $msg));
|
$result = $dent->post('statuses/update', array('status' => $msg));
|
||||||
logger('statusnet_post send, result: ' . print_r($result, true), LOGGER_DEBUG);
|
logger('statusnet_post send, result: ' . print_r($result, true).
|
||||||
|
"\nmessage: ".$msg, LOGGER_DEBUG."\nOriginal post: ".print_r($b));
|
||||||
if ($result->error) {
|
if ($result->error) {
|
||||||
logger('Send to StatusNet failed: "' . $result->error . '"');
|
logger('Send to StatusNet failed: "' . $result->error . '"');
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,6 +367,9 @@ function twitter_post_hook(&$a,&$b) {
|
||||||
$msg = implode(' ', $e);
|
$msg = implode(' ', $e);
|
||||||
$msg .= '... ' . $shortlink;
|
$msg .= '... ' . $shortlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$msg = trim($msg);
|
||||||
|
|
||||||
// and now tweet it :-)
|
// and now tweet it :-)
|
||||||
if(strlen($msg)) {
|
if(strlen($msg)) {
|
||||||
$result = $tweet->post('statuses/update', array('status' => $msg));
|
$result = $tweet->post('statuses/update', array('status' => $msg));
|
||||||
|
|
Loading…
Reference in a new issue