if(preg_match("/\[img\](.*?)\[\/img\]/is",$b['body'],$matches))
$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
$body = $b['body'];
if (strpos($body, "[bookmark") !== false) {
'access_token' => $fb_token,
'message' => $msg
);
- if(isset($image)) {
+ if(trim($image) != "") {
$postvars['picture'] = $image;
}
- if(isset($link)) {
+ if(trim($link) != "") {
$postvars['link'] = $link;
// The following doesn't work - why?
$postvars['source'] = $link;
}
}
- if(isset($linkname))
+ if(trim($linkname) != "")
$postvars['name'] = $linkname;
}
if (privacy_image_cache_is_local_image($matches[2]))
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];
}
/**
$msg = implode(' ', $e);
$msg .= '... ' . $shortlink;
}
+
+ $msg = trim($msg);
+
// and now dent it :-)
if(strlen($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) {
logger('Send to StatusNet failed: "' . $result->error . '"');
}