appnet/statusnet/twitter: Better detection for removable links.
This commit is contained in:
parent
31ab2a3cbf
commit
24de6d38a9
|
@ -968,16 +968,12 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
|
||||||
|
|
||||||
if (sizeof($links)) {
|
if (sizeof($links)) {
|
||||||
$link = array_pop($links);
|
$link = array_pop($links);
|
||||||
$url = "[url=".$link."]".$link."[/url]";
|
$url = str_replace(array('/', '.'), array('\/', '\.'), $link);
|
||||||
|
|
||||||
$removedlink = trim(str_replace($url, "", $postarray['body']));
|
|
||||||
|
|
||||||
|
$removedlink = preg_replace("/\[url\=".$url."\](.*?)\[\/url\]/ism", '', $postarray['body']);
|
||||||
if (($removedlink == "") OR strstr($postarray['body'], $removedlink))
|
if (($removedlink == "") OR strstr($postarray['body'], $removedlink))
|
||||||
$postarray['body'] = $removedlink;
|
$postarray['body'] = $removedlink;
|
||||||
|
|
||||||
if (($removedlink == "") OR strstr("[url]".$postarray['body']."[/url]", $removedlink))
|
|
||||||
$postarray['body'] = $removedlink;
|
|
||||||
|
|
||||||
$page_info = add_page_info($link, false, $photo["url"]);
|
$page_info = add_page_info($link, false, $photo["url"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1538,7 +1538,7 @@ function statusnet_convertmsg($a, $body, $no_tags = false) {
|
||||||
if (($footerlink != "") AND (trim($footer) != "")) {
|
if (($footerlink != "") AND (trim($footer) != "")) {
|
||||||
$removedlink = trim(str_replace($footerlink, "", $body));
|
$removedlink = trim(str_replace($footerlink, "", $body));
|
||||||
|
|
||||||
if (strstr($body, $removedlink))
|
if (($removedlink == "") OR strstr($body, $removedlink))
|
||||||
$body = $removedlink;
|
$body = $removedlink;
|
||||||
|
|
||||||
$body .= $footer;
|
$body .= $footer;
|
||||||
|
|
|
@ -1142,7 +1142,7 @@ function twitter_expand_entities($a, $body, $item, $no_tags = false, $picture) {
|
||||||
if (($footerlink != "") AND (trim($footer) != "")) {
|
if (($footerlink != "") AND (trim($footer) != "")) {
|
||||||
$removedlink = trim(str_replace($footerlink, "", $body));
|
$removedlink = trim(str_replace($footerlink, "", $body));
|
||||||
|
|
||||||
if (strstr($body, $removedlink))
|
if (($removedlink == "") OR strstr($body, $removedlink))
|
||||||
$body = $removedlink;
|
$body = $removedlink;
|
||||||
|
|
||||||
$body .= $footer;
|
$body .= $footer;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user