diff options
author | Fabio Comuni <fabrix.xm@gmail.com> | 2011-10-26 12:15:38 +0200 |
---|---|---|
committer | Fabio Comuni <fabrix.xm@gmail.com> | 2011-10-26 12:15:38 +0200 |
commit | dc212de9606422be6e912a0bb7f3569192942938 (patch) | |
tree | 5a253e3b57d14751214513a029d84699f5ad5b21 /include | |
parent | bed0043b30c219a08aa0b352923299ea153d515c (diff) | |
parent | 6d6136cdb5a2149037c3cf315b3fa81a72bd7d55 (diff) | |
download | volse-hubzilla-dc212de9606422be6e912a0bb7f3569192942938.tar.gz volse-hubzilla-dc212de9606422be6e912a0bb7f3569192942938.tar.bz2 volse-hubzilla-dc212de9606422be6e912a0bb7f3569192942938.zip |
Merge remote-tracking branch 'friendika/master'
Diffstat (limited to 'include')
-rw-r--r-- | include/bb2diaspora.php | 4 | ||||
-rw-r--r-- | include/bbcode.php | 1 | ||||
-rw-r--r-- | include/diaspora.php | 7 | ||||
-rw-r--r-- | include/items.php | 2 | ||||
-rw-r--r-- | include/network.php | 2 | ||||
-rw-r--r-- | include/text.php | 2 |
6 files changed, 14 insertions, 4 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index e2711755b..f7398067b 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -11,8 +11,12 @@ function diaspora2bb($s) { $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s); $s = Markdown($s); $s = html2bbcode($s); + $s = str_replace('*','*',$s); $s = preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]',$s); + $s = preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]',$s); $s = preg_replace("/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]',$s); + $s = preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]',$s); + $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url]$2$3$4[/url]',$s); return $s; } diff --git a/include/bbcode.php b/include/bbcode.php index d7b64c0cf..4d6eafafa 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -57,6 +57,7 @@ function bbcode($Text,$preserve_nl = false) { // Perform URL Search + $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1<a href="$2" target="external-link">$2</a>', $Text); $Text = preg_replace_callback("/\[bookmark\=([^\]]*)\].*?\[\/bookmark\]/ism",'tryoembed',$Text); diff --git a/include/diaspora.php b/include/diaspora.php index 2379ae8e3..ad5e2adb2 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -92,12 +92,14 @@ function find_diaspora_person_by_handle($handle) { dbesc($handle) ); if(count($r)) { + logger('find_diaspora_person_by handle: in cache ' . print_r($r,true), LOGGER_DEBUG); // update record occasionally so it doesn't get stale $d = strtotime($r[0]['updated'] . ' +00:00'); if($d > strtotime('now - 14 days')) return $r[0]; $update = true; } + logger('find_diaspora_person_by_handle: refresh',LOGGER_DEBUG); require_once('include/Scrape.php'); $r = probe_url($handle, PROBE_DIASPORA); if((count($r)) && ($r['network'] === NETWORK_DIASPORA)) { @@ -947,7 +949,10 @@ function diaspora_comment($importer,$xml,$msg) { $datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']); $datarray['body'] = $body; $datarray['tag'] = $str_tags; - $datarray['app'] = 'Diaspora'; + + // We can't be certain what the original app is if the message is relayed. + if(($parent_item['origin']) && (! $parent_author_signature)) + $datarray['app'] = 'Diaspora'; $message_id = item_store($datarray); diff --git a/include/items.php b/include/items.php index 4e7674a2e..1b4b52491 100644 --- a/include/items.php +++ b/include/items.php @@ -1264,7 +1264,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) } if($deleted && is_array($contact)) { $r = q("SELECT `item`.*, `contact`.`self` FROM `item` left join `contact` on `item`.`contact-id` = `contact`.id` - WHERE `uri` = '%s' AND `uid` = %d AND `contact-id` = %d LIMIT 1", + WHERE `uri` = '%s' AND `item`.`uid` = %d AND `contact-id` = %d LIMIT 1", dbesc($uri), intval($importer['uid']), intval($contact['id']) diff --git a/include/network.php b/include/network.php index c6f5fd909..a9ee3f0a5 100644 --- a/include/network.php +++ b/include/network.php @@ -732,7 +732,6 @@ function add_fcontact($arr,$update = false) { dbesc($arr['notify']), dbesc($arr['poll']), dbesc($arr['confirm']), - dbesc($arr['network']), dbesc($arr['alias']), dbesc($arr['pubkey']), dbesc(datetime_convert()), @@ -760,5 +759,6 @@ function add_fcontact($arr,$update = false) { dbesc(datetime_convert()) ); } + return $r; } diff --git a/include/text.php b/include/text.php index a9763fd21..e0f38a3a0 100644 --- a/include/text.php +++ b/include/text.php @@ -481,7 +481,7 @@ function get_tags($s) { // Otherwise pull out single word tags. These can be @nickname, @first_last // and #hash tags. - if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) { + if(preg_match_all('/([@#][^ \x0D\x0A,;:?]+)([ \x0D\x0A,;:?]|$)/',$s,$match)) { foreach($match[1] as $mtch) { if(strstr($mtch,"]")) { // we might be inside a bbcode color tag - leave it alone |