Twitter, Statusnet: Supress profile link of user whose message was repeated
libertree: Design improvement of exported messages privacy_image_cache: quickfix for double encoded urlspull/62/head
parent
fe7c741eed
commit
471b5db36f
|
@ -176,6 +176,12 @@ function libertree_send(&$a,&$b) {
|
||||||
$body = str_ireplace("[quote", "\n\n[quote", $body);
|
$body = str_ireplace("[quote", "\n\n[quote", $body);
|
||||||
$body = str_ireplace("[/quote]", "[/quote]\n\n", $body);
|
$body = str_ireplace("[/quote]", "[/quote]\n\n", $body);
|
||||||
|
|
||||||
|
// Removal of tags and mentions
|
||||||
|
// #-tags
|
||||||
|
$body = preg_replace('/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $body);
|
||||||
|
// @-mentions
|
||||||
|
$body = preg_replace('/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $body);
|
||||||
|
|
||||||
// remove multiple newlines
|
// remove multiple newlines
|
||||||
do {
|
do {
|
||||||
$oldbody = $body;
|
$oldbody = $body;
|
||||||
|
|
|
@ -36,13 +36,15 @@ function privacy_image_cache_init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$urlhash = 'pic:' . sha1($_REQUEST['url']);
|
$urlhash = 'pic:' . sha1($_REQUEST['url']);
|
||||||
$r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $urlhash );
|
// Double encoded url - happens with Diaspora
|
||||||
|
$urlhash2 = 'pic:' . sha1(urldecode($_REQUEST['url']));
|
||||||
|
|
||||||
|
$r = q("SELECT * FROM `photo` WHERE `resource-id` in ('%s', '%s') LIMIT 1", $urlhash, $urlhash2);
|
||||||
if (count($r)) {
|
if (count($r)) {
|
||||||
$img_str = $r[0]['data'];
|
$img_str = $r[0]['data'];
|
||||||
$mime = $r[0]["desc"];
|
$mime = $r[0]["desc"];
|
||||||
if ($mime == "") $mime = "image/jpeg";
|
if ($mime == "") $mime = "image/jpeg";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
require_once("Photo.php");
|
require_once("Photo.php");
|
||||||
|
|
||||||
$img_str = fetch_url($_REQUEST['url'],true);
|
$img_str = fetch_url($_REQUEST['url'],true);
|
||||||
|
|
|
@ -457,6 +457,12 @@ function statusnet_post_hook(&$a,&$b) {
|
||||||
$tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
|
$tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
|
||||||
// @-mentions
|
// @-mentions
|
||||||
$tmp = preg_replace( '/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $tmp);
|
$tmp = preg_replace( '/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $tmp);
|
||||||
|
// recycle 1
|
||||||
|
$recycle = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8');
|
||||||
|
$tmp = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', $recycle.'$2', $tmp);
|
||||||
|
// recycle 2
|
||||||
|
//$recycle = html_entity_decode("♻ ", ENT_QUOTES, 'UTF-8');
|
||||||
|
//$tmp = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', 'RT @$2:', $tmp);
|
||||||
}
|
}
|
||||||
// preserve links to webpages
|
// preserve links to webpages
|
||||||
$tmp = preg_replace( '/\[url\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/url\]/i', '$2 $1', $tmp);
|
$tmp = preg_replace( '/\[url\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/url\]/i', '$2 $1', $tmp);
|
||||||
|
|
|
@ -323,6 +323,12 @@ function twitter_post_hook(&$a,&$b) {
|
||||||
$tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
|
$tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
|
||||||
// @-mentions
|
// @-mentions
|
||||||
$tmp = preg_replace( '/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $tmp);
|
$tmp = preg_replace( '/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $tmp);
|
||||||
|
// recycle 1
|
||||||
|
$recycle = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8');
|
||||||
|
$tmp = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', $recycle.'$2', $tmp);
|
||||||
|
// recycle 2
|
||||||
|
//$recycle = html_entity_decode("♻ ", ENT_QUOTES, 'UTF-8');
|
||||||
|
//$tmp = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', 'RT @$2:', $tmp);
|
||||||
}
|
}
|
||||||
$tmp = preg_replace( '/\[url\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/url\]/i', '$2 $1', $tmp);
|
$tmp = preg_replace( '/\[url\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/url\]/i', '$2 $1', $tmp);
|
||||||
$tmp = preg_replace( '/\[bookmark\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/bookmark\]/i', '$2 $1', $tmp);
|
$tmp = preg_replace( '/\[bookmark\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/bookmark\]/i', '$2 $1', $tmp);
|
||||||
|
|
Loading…
Reference in New Issue