From 171249966e68d12a4e2e485d26007de8372e8235 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 9 Feb 2012 14:06:17 -0800 Subject: add tag notifications to enotify --- include/enotify.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include') diff --git a/include/enotify.php b/include/enotify.php index 9df9b57e5..6e7130bc8 100755 --- a/include/enotify.php +++ b/include/enotify.php @@ -54,6 +54,24 @@ function notification($params) { $itemlink = $params['link']; } + if($params['type'] == NOTIFY_TAGSELF) { + $preamble = $subject = sprintf( t('%s tagged you at %s') , $params['source_name'], $sitename); + + $sitelink = t('Please visit %s to view and/or reply to the conversation.'); + $tsitelink = sprintf( $sitelink, $siteurl ); + $hsitelink = sprintf( $sitelink, '' . $sitename . ''); + $itemlink = $params['link']; + } + + if($params['type'] == NOTIFY_TAGSHARE) { + $preamble = $subject = sprintf( t('%s tagged your post at %s') , $params['source_name'], $sitename); + + $sitelink = t('Please visit %s to view and/or reply to the conversation.'); + $tsitelink = sprintf( $sitelink, $siteurl ); + $hsitelink = sprintf( $sitelink, '' . $sitename . ''); + $itemlink = $params['link']; + } + if($params['type'] == NOTIFY_INTRO) { $subject = sprintf( t('Introduction received at %s'), $sitename); $preamble = sprintf( t('You\'ve received an introduction from \'%s\' at %s'), $params['source_name'], $sitename); -- cgit v1.2.3 From ec26f88be9876b75044c37219018bf1337f8d61e Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 9 Feb 2012 15:02:59 -0800 Subject: render_location hook --- include/conversation.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 6defefc73..9df7b20e9 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -262,15 +262,10 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { else $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']); - $location = (($item['location']) ? '' . $item['location'] . '' : ''); - $coord = (($item['coord']) ? '' . $item['coord'] . '' : ''); - if($coord) { - if($location) - $location .= '
(' . $coord . ')'; - else - $location = '' . $coord . ''; - } + $locate = array('location' => $item_location, 'coord' => $item['coord'], 'html' => ''); + call_hooks('render_location',$locate); + $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate)); localize_item($item); if($mode === 'network-new') @@ -1008,3 +1003,17 @@ function find_thread_parent_index($arr,$x) { return $k; return false; } + +function render_location_google($item) { + $location = ''; + $location = (($item['location']) ? '' . $item['location'] . '' : ''); + $coord = (($item['coord']) ? '' . $item['coord'] . '' : ''); + if($coord) { + if($location) + $location .= '
(' . $coord . ')'; + else + $location = '' . $coord . ''; + } + return $location; +} + -- cgit v1.2.3 From 7b0a005441a6abc3d4c327965e86ac82d2ec4db3 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 9 Feb 2012 15:58:26 -0800 Subject: edit post not working after plaintext editor fixes, missing some recent editor template changes --- include/items.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index ba95919a6..9f2cc491b 100755 --- a/include/items.php +++ b/include/items.php @@ -1486,7 +1486,8 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) if(count($r)) { if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) { - $r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($datarray['title']), dbesc($datarray['body']), dbesc(datetime_convert('UTC','UTC',$datarray['edited'])), dbesc($item_id), @@ -1616,7 +1617,8 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) if(count($r)) { if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) { - $r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($datarray['title']), dbesc($datarray['body']), dbesc(datetime_convert('UTC','UTC',$datarray['edited'])), dbesc($item_id), @@ -2167,7 +2169,8 @@ function local_delivery($importer,$data) { if(count($r)) { if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) { - $r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($datarray['title']), dbesc($datarray['body']), dbesc(datetime_convert('UTC','UTC',$datarray['edited'])), dbesc($item_id), @@ -2309,7 +2312,8 @@ function local_delivery($importer,$data) { if(count($r)) { if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) { - $r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($datarray['title']), dbesc($datarray['body']), dbesc(datetime_convert('UTC','UTC',$datarray['edited'])), dbesc($item_id), @@ -2805,7 +2809,7 @@ function drop_item($id,$interactive = true) { // delete the item - $r = q("UPDATE `item` SET `deleted` = 1, `body` = '', `edited` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1", + $r = q("UPDATE `item` SET `deleted` = 1, `title` = '', `body` = '', `edited` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), dbesc(datetime_convert()), intval($item['id']) @@ -2838,7 +2842,7 @@ function drop_item($id,$interactive = true) { // If it's the parent of a comment thread, kill all the kids if($item['uri'] == $item['parent-uri']) { - $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s', `body` = '' + $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s', `body` = '' , `title` = '' WHERE `parent-uri` = '%s' AND `uid` = %d ", dbesc(datetime_convert()), dbesc(datetime_convert()), -- cgit v1.2.3 From 5859f9dcf68c2ca6ad355c16e7fbf5080eea9e75 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 9 Feb 2012 18:09:28 -0800 Subject: add render_location hook to both sets of conversations --- include/conversation.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 9df7b20e9..35abb29ca 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -262,7 +262,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { else $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']); - $locate = array('location' => $item_location, 'coord' => $item['coord'], 'html' => ''); + $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => ''); call_hooks('render_location',$locate); $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate)); @@ -589,16 +589,10 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : ''); $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : ''); - $location = (($item['location']) ? '' . $item['location'] . '' : ''); - $coord = (($item['coord']) ? '' . $item['coord'] . '' : ''); - if($coord) { - if($location) - $location .= '
(' . $coord . ')'; - else - $location = '' . $coord . ''; - } + $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => ''); + call_hooks('render_location',$locate); + + $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate)); $indent = (($toplevelpost) ? '' : ' comment'); -- cgit v1.2.3 From ffe7d8b1e9964e28b50ccce49d74836067c099c1 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 9 Feb 2012 21:18:50 -0800 Subject: item tag notifications --- include/items.php | 64 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 23 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 9f2cc491b..fd90494b1 100755 --- a/include/items.php +++ b/include/items.php @@ -905,7 +905,7 @@ function item_store($arr,$force_parent = false) { ); } - tgroup_deliver($arr['uid'],$current_post); + tag_deliver($arr['uid'],$current_post); return $current_post; } @@ -923,22 +923,22 @@ function get_item_contact($item,$contacts) { } -function tgroup_deliver($uid,$item_id) { +function tag_deliver($uid,$item_id) { - - // setup a second delivery chain for forum/community posts if appropriate + // look for mention tags and setup a second delivery chain for forum/community posts if appropriate $a = get_app(); - $deliver_to_tgroup = false; + $mention = false; - $u = q("select * from user where uid = %d and `page-flags` = %d limit 1", - intval($uid), - intval(PAGE_COMMUNITY) + $u = q("select uid, nickname, language, username, email, `page-flags`, `notify-flags` from user where uid = %d limit 1", + intval($uid) ); if(! count($u)) return; + $community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false); + $i = q("select * from item where id = %d and uid = %d limit 1", intval($item_id), intval($uid) @@ -948,13 +948,6 @@ function tgroup_deliver($uid,$item_id) { $item = $i[0]; - // prevent delivery looping - only proceed - // if the message originated elsewhere and is a top-level post - - if(($item['wall']) || ($item['origin']) || ($item['id'] != $item['parent'])) - return; - - $link = normalise_link($a->get_baseurl() . '/profile/' . $u[0]['nickname']); // Diaspora uses their own hardwired link URL in @-tags @@ -966,24 +959,49 @@ function tgroup_deliver($uid,$item_id) { if($cnt) { foreach($matches as $mtch) { if(link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) { - $deliver_to_tgroup = true; - logger('tgroup_deliver: local group mention found: ' . $mtch[2]); + $mention = true; + logger('tag_deliver: mention found: ' . $mtch[2]); } } } - if(! $deliver_to_tgroup) + if(! $mention) + return; + + if(! $community_page) { + require_once('include/enotify.php'); + notification(array( + 'type' => NOTIFY_TAGSELF, + 'notify_flags' => $u[0]['notify-flags'], + 'language' => $u[0]['language'], + 'to_name' => $u[0]['username'], + 'to_email' => $u[0]['email'], + 'item' => $item, + 'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'], + 'source_name' => $item['author-name'], + 'source_link' => $item['author-link'], + 'source_photo' => $item['author-avatar'], + 'verb' => ACTIVITY_TAG, + 'otype' => 'item' + )); return; + } + else { + // prevent delivery looping - only proceed + // if the message originated elsewhere and is a top-level post - // now change this copy of the post to a forum head message and deliver to all the tgroup members + if(($item['wall']) || ($item['origin']) || ($item['id'] != $item['parent'])) + return; + // now change this copy of the post to a forum head message and deliver to all the tgroup members - q("update item set wall = 1, origin = 1, forum_mode = 1 where id = %d limit 1", - intval($item_id) - ); - proc_run('php','include/notifier.php','tgroup',$item_id); + q("update item set wall = 1, origin = 1, forum_mode = 1 where id = %d limit 1", + intval($item_id) + ); + proc_run('php','include/notifier.php','tgroup',$item_id); + } } -- cgit v1.2.3 From 2f2e331c33535d8ae1a8c9d95d03a39b5c8a5885 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 9 Feb 2012 22:44:59 -0800 Subject: bug #274 --- include/plugin.php | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/plugin.php b/include/plugin.php index fe325ac3b..85b51edff 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -56,25 +56,29 @@ function reload_plugins() { if(count($parr)) { foreach($parr as $pl) { $pl = trim($pl); + + $fname = 'addon/' . $pl . '/' . $pl . '.php'; - $t = filemtime('addon/' . $pl . '/' . $pl . '.php'); - foreach($installed as $i) { - if(($i['name'] == $pl) && ($i['timestamp'] != $t)) { - logger('Reloading plugin: ' . $i['name']); - @include_once('addon/' . $pl . '/' . $pl . '.php'); - - if(function_exists($pl . '_uninstall')) { - $func = $pl . '_uninstall'; - $func(); - } - if(function_exists($pl . '_install')) { - $func = $pl . '_install'; - $func(); + if(file_exists($fname)) { + $t = @filemtime($fname); + foreach($installed as $i) { + if(($i['name'] == $pl) && ($i['timestamp'] != $t)) { + logger('Reloading plugin: ' . $i['name']); + @include_once($fname); + + if(function_exists($pl . '_uninstall')) { + $func = $pl . '_uninstall'; + $func(); + } + if(function_exists($pl . '_install')) { + $func = $pl . '_install'; + $func(); + } + q("UPDATE `addon` SET `timestamp` = %d WHERE `id` = %d LIMIT 1", + intval($t), + intval($i['id']) + ); } - q("UPDATE `addon` SET `timestamp` = %d WHERE `id` = %d LIMIT 1", - intval($t), - intval($i['id']) - ); } } } -- cgit v1.2.3 From b346f4464c230af4636c61397decd03eadb18e9a Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 10 Feb 2012 00:08:23 -0800 Subject: send notify emails to community pages as well as people --- include/items.php | 62 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 30 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index fd90494b1..3c30e99aa 100755 --- a/include/items.php +++ b/include/items.php @@ -968,40 +968,42 @@ function tag_deliver($uid,$item_id) { if(! $mention) return; - if(! $community_page) { - require_once('include/enotify.php'); - notification(array( - 'type' => NOTIFY_TAGSELF, - 'notify_flags' => $u[0]['notify-flags'], - 'language' => $u[0]['language'], - 'to_name' => $u[0]['username'], - 'to_email' => $u[0]['email'], - 'item' => $item, - 'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'], - 'source_name' => $item['author-name'], - 'source_link' => $item['author-link'], - 'source_photo' => $item['author-avatar'], - 'verb' => ACTIVITY_TAG, - 'otype' => 'item' - )); + // send a notification + + require_once('include/enotify.php'); + notification(array( + 'type' => NOTIFY_TAGSELF, + 'notify_flags' => $u[0]['notify-flags'], + 'language' => $u[0]['language'], + 'to_name' => $u[0]['username'], + 'to_email' => $u[0]['email'], + 'item' => $item, + 'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'], + 'source_name' => $item['author-name'], + 'source_link' => $item['author-link'], + 'source_photo' => $item['author-avatar'], + 'verb' => ACTIVITY_TAG, + 'otype' => 'item' + )); + if(! $community_page) return; - } - else { - // prevent delivery looping - only proceed - // if the message originated elsewhere and is a top-level post - if(($item['wall']) || ($item['origin']) || ($item['id'] != $item['parent'])) - return; + // tgroup delivery - setup a second delivery chain + // prevent delivery looping - only proceed + // if the message originated elsewhere and is a top-level post - // now change this copy of the post to a forum head message and deliver to all the tgroup members + if(($item['wall']) || ($item['origin']) || ($item['id'] != $item['parent'])) + return; + // now change this copy of the post to a forum head message and deliver to all the tgroup members - q("update item set wall = 1, origin = 1, forum_mode = 1 where id = %d limit 1", - intval($item_id) - ); - proc_run('php','include/notifier.php','tgroup',$item_id); - } + q("update item set wall = 1, origin = 1, forum_mode = 1 where id = %d limit 1", + intval($item_id) + ); + + proc_run('php','include/notifier.php','tgroup',$item_id); + } @@ -1065,7 +1067,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { $final_dfrn_id = ''; - if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) { + if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))) { openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']); openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']); } @@ -1108,7 +1110,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { if($dfrn_version >= 2.1) { - if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) { + if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))) { openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']); } else { -- cgit v1.2.3 From d79c3351ea6692478a490f4225ea1009863dd65f Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 10 Feb 2012 13:43:35 -0800 Subject: db installation sync --- include/items.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index 3c30e99aa..5e3f9a60a 100755 --- a/include/items.php +++ b/include/items.php @@ -985,6 +985,7 @@ function tag_deliver($uid,$item_id) { 'verb' => ACTIVITY_TAG, 'otype' => 'item' )); + if(! $community_page) return; -- cgit v1.2.3 From 75a62db9c5e59adbd1d8dc2d5e0ba3544df3a15e Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 11 Feb 2012 01:24:29 -0800 Subject: show tags (pub_keywords) in advanced profile --- include/profile_advanced.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/profile_advanced.php b/include/profile_advanced.php index ccecb95de..004a58524 100755 --- a/include/profile_advanced.php +++ b/include/profile_advanced.php @@ -44,6 +44,8 @@ function advanced_profile(&$a) { if($a->profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) ); + if($a->profile['pub_keywords']) $profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']); + if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']); if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']); -- cgit v1.2.3 From bb19c8ba4ea279265ad146f69949a62b4024c2ab Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 11 Feb 2012 21:46:48 -0800 Subject: kissing smilie may need escaping (thanks - Abinoam) --- include/text.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 9aca14598..9e67d36a9 100755 --- a/include/text.php +++ b/include/text.php @@ -678,7 +678,7 @@ function smilies($s) { $a = get_app(); $s = str_replace( - array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', + array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', ':beer', ':homebrew', ':coffee', '~friendika', '~friendica', 'Diaspora*' ), array( @@ -693,6 +693,7 @@ function smilies($s) { ':-P', ':P', ':-\', + ':-\', ':-x', ':-X', ':-D', -- cgit v1.2.3 From 8b101c6cb865c24cefd610e01ad628abd1152217 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 11 Feb 2012 23:49:05 -0800 Subject: do not display contact_block if config for num shown is 0 --- include/text.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 9e67d36a9..63846fb10 100755 --- a/include/text.php +++ b/include/text.php @@ -538,8 +538,10 @@ function contact_block() { $a = get_app(); $shown = get_pconfig($a->profile['uid'],'system','display_friend_count'); - if(! $shown) + if($shown === false) $shown = 24; + if($shown == 0) + return; if((! is_array($a->profile)) || ($a->profile['hide-friends'])) return $o; -- cgit v1.2.3 From cbf53beec12bf835177695fef9cd6a33ce9d1629 Mon Sep 17 00:00:00 2001 From: Vasudev Kamath Date: Sun, 12 Feb 2012 15:06:12 +0530 Subject: ;) :D and :-O are also enabled for wink laugh and surprised smiley's --- include/text.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 9e67d36a9..68170e988 100755 --- a/include/text.php +++ b/include/text.php @@ -678,9 +678,9 @@ function smilies($s) { $a = get_app(); $s = str_replace( - array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', + array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ';)', ':-(', ':(', ':-P', ':P', ':-"', ':-"', ':-x', ':-X', ':-D', ':D', '8-|', '8-O', ':-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', ':beer', ':homebrew', ':coffee', - '~friendika', '~friendica', 'Diaspora*' ), + '~friendika', '~friendica', 'Diaspora*' ), array( '<3', '</3', @@ -688,6 +688,7 @@ function smilies($s) { ':-)', ':)', ';-)', + ';)', ':-(', ':(', ':-P', @@ -697,13 +698,16 @@ function smilies($s) { ':-x', ':-X', ':-D', + ':D', '8-|', '8-O', + ':-O', '\\o/', 'o.O', 'O.o', '\\.../', - '\\ooo/', + '\\ooo/', + ':beer', ':homebrew', ':coffee', -- cgit v1.2.3 From 5107ee52d3e9c743e977b2e651c8846dfa4ada38 Mon Sep 17 00:00:00 2001 From: "Abinoam P. Marques Jr" Date: Sun, 12 Feb 2012 06:13:49 -0800 Subject: Regexp fix for [LIST=i], [list=i], [LIST=I] and [LIST=i] bbcodes --- include/bbcode.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 6b733c8f4..7825914b5 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -124,10 +124,14 @@ function bbcode($Text,$preserve_nl = false) { $Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '
    $1
' ,$Text); $Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '
    $1
' ,$Text); $Text = preg_replace("/\[list=1\](.*?)\[\/list\]/ism", '
    $1
' ,$Text); - $Text = preg_replace("/\[list=i\](.*?)\[\/list\]/sm",'
    $1
' ,$Text); - $Text = preg_replace("/\[list=I\](.*?)\[\/list\]/sm", '
    $1
' ,$Text); - $Text = preg_replace("/\[list=a\](.*?)\[\/list\]/sm", '
    $1
' ,$Text); - $Text = preg_replace("/\[list=A\](.*?)\[\/list\]/sm", '
    $1
' ,$Text); + $Text = preg_replace("/\[list=((?-i)i)\](.*?)\[\/list\]/ism",'
    $2
' ,$Text); + $Text = preg_replace("/\[list=((?-i)I)\](.*?)\[\/list\]/ism", '
    $2
' ,$Text); + $Text = preg_replace("/\[list=((?-i)a)\](.*?)\[\/list\]/ism", '
    $2
' ,$Text); + $Text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '
    $2
' ,$Text); $Text = preg_replace("/\[li\](.*?)\[\/li\]/sm", '
  • $1
  • ' ,$Text); $Text = preg_replace("/\[td\](.*?)\[\/td\]/sm", '$1' ,$Text); -- cgit v1.2.3 From 5479142efca1fff08f2d60dc5a723b5d0842548b Mon Sep 17 00:00:00 2001 From: "Abinoam P. Marques Jr" Date: Sun, 12 Feb 2012 06:21:01 -0800 Subject: Added support for [ul] standard unordered list bbcode. --- include/bbcode.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 7825914b5..5d9665be5 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -115,13 +115,15 @@ function bbcode($Text,$preserve_nl = false) { // Check for list text - if(stristr($Text,'[/list]')) + if(stristr($Text,'[/(list|ul|ol)]')) $Text = str_replace("[*]", "
  • ", $Text); if(stristr($Text,'[/list]')) $Text = str_replace("[*]", "
  • ", $Text); $Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '
      $1
    ' ,$Text); + $Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '
      $1
    ' +,$Text); $Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '
      $1
    ' ,$Text); $Text = preg_replace("/\[list=1\](.*?)\[\/list\]/ism", '
      $1
    ' ,$Text); $Text = preg_replace("/\[list=((?-i)i)\](.*?)\[\/list\]/ism",'
      Date: Sun, 12 Feb 2012 12:00:23 -0800 Subject: Added support for [ol] standard ordered list bbcode. --- include/bbcode.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 5d9665be5..7133a1a34 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -126,6 +126,8 @@ function bbcode($Text,$preserve_nl = false) { ,$Text); $Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '
        $1
      ' ,$Text); $Text = preg_replace("/\[list=1\](.*?)\[\/list\]/ism", '
        $1
      ' ,$Text); + $Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '
        $1
      ' +,$Text); $Text = preg_replace("/\[list=((?-i)i)\](.*?)\[\/list\]/ism",'
        $2
      ' ,$Text); $Text = preg_replace("/\[list=((?-i)I)\](.*?)\[\/list\]/ism", '
        Date: Sun, 12 Feb 2012 14:35:29 -0800 Subject: Added support to [noparse], [nobb] and [pre] as bbcode escape tags. --- include/bbcode.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 7133a1a34..3534a7315 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -24,13 +24,40 @@ function tryoembed($match){ } +// [noparse][i]italic[/i][/noparse] turns into +// [noparse][ i ]italic[ /i ][/noparse], +// to hide them from parser. + +function bb_spacefy($st) { + $whole_match = $st[0]; + $captured = $st[1]; + $spacefied = preg_replace("/\[(.*?)\]/", "[ $1 ]", $captured); + $new_str = str_replace($captured, $spacefied, $whole_match); + return $new_str; +} + +// The previously spacefied [noparse][ i ]italic[ /i ][/noparse], +// now turns back and the [noparse] tags are trimed +// returning [i]italic[/i] +function bb_unspacefy_and_trim($st) { + $whole_match = $st[0]; + $captured = $st[1]; + $unspacefied = preg_replace("/\[ (.*?)\ ]/", "[$1]", $captured); + return $unspacefied; +} // BBcode 2 HTML was written by WAY2WEB.net // extended to work with Mistpark/Friendica - Mike Macgirvin function bbcode($Text,$preserve_nl = false) { + // Hide all [noparse] contained bbtags spacefying them + + $Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_spacefy',$Text); + $Text = preg_replace_callback("/\[nobb\](.*?)\[\/nobb\]/ism", 'bb_spacefy',$Text); + $Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_spacefy',$Text); + // Extract a single private image which uses data url's since preg has issues with // large data sizes. Stash it away while we do bbcode conversion, and then put it back @@ -227,6 +254,13 @@ upper-alpha;">$2
      ' ,$Text); $Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text); } + // Unhide all [noparse] contained bbtags unspacefying them + // and triming the [noparse] tag. + + $Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_unspacefy_and_trim',$Text); + $Text = preg_replace_callback("/\[nobb\](.*?)\[\/nobb\]/ism", 'bb_unspacefy_and_trim',$Text); + $Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_unspacefy_and_trim',$Text); + // fix any escaped ampersands that may have been converted into links $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text); if(strlen($saved_image)) -- cgit v1.2.3 From 74b529bda2fb024815299db094ac8313a9d9d809 Mon Sep 17 00:00:00 2001 From: "Abinoam P. Marques Jr" Date: Sun, 12 Feb 2012 14:59:07 -0800 Subject: BBCode [size=50] --> font-size: 50px (with the unit px). This [size=number] without unit is kind of a standard. It was being rendered like "font-size: 50" and that's not valid CSS style. --- include/bbcode.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 3534a7315..fa5b7e080 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -138,6 +138,8 @@ function bbcode($Text,$preserve_nl = false) { $Text = preg_replace("(\[color=(.*?)\](.*?)\[\/color\])ism","$2",$Text); // Check for sized text + // [size=50] --> font-size: 50px (with the unit). + $Text = preg_replace("(\[size=(\d*?)\](.*?)\[\/size\])ism","$2",$Text); $Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])ism","$2",$Text); // Check for list text -- cgit v1.2.3 From 3a07973ffae4e0f9c576d343eafee30401d92449 Mon Sep 17 00:00:00 2001 From: "Abinoam P. Marques Jr" Date: Sun, 12 Feb 2012 15:51:17 -0800 Subject: Added [center] bbcode support. --- include/bbcode.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index fa5b7e080..20418f940 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -142,6 +142,9 @@ function bbcode($Text,$preserve_nl = false) { $Text = preg_replace("(\[size=(\d*?)\](.*?)\[\/size\])ism","$2",$Text); $Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])ism","$2",$Text); + // Check for centered text + $Text = preg_replace("(\[center\](.*?)\[\/center\])ism","
      $1
      ",$Text); + // Check for list text if(stristr($Text,'[/(list|ul|ol)]')) -- cgit v1.2.3 From 10e66d293df695e37be05200ab130f1fc988880b Mon Sep 17 00:00:00 2001 From: "Abinoam P. Marques Jr" Date: Sun, 12 Feb 2012 16:18:58 -0800 Subject: Added [quote=Name] bbcode support. --- include/bbcode.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 20418f940..5eacb256b 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -197,7 +197,13 @@ upper-alpha;">$2
    ' ,$Text); $QuoteLayout = '
    $1
    '; // Check for [quote] text $Text = preg_replace("/\[quote\](.*?)\[\/quote\]/ism","$QuoteLayout", $Text); - + + // Check for [quote=Author] text + $t_wrote = t("wrote"); + $Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism", + "
    $1 wrote: $2
    ", + $Text); + // [img=widthxheight]image source[/img] $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '', $Text); -- cgit v1.2.3 From e575a3a02c324d65e6849ffd3f8cf68e7318f748 Mon Sep 17 00:00:00 2001 From: "Abinoam P. Marques Jr" Date: Sun, 12 Feb 2012 17:10:06 -0800 Subject: Fixed bbcode [li] and [*] handling. --- include/bbcode.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 5eacb256b..1d11f687d 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -146,12 +146,8 @@ function bbcode($Text,$preserve_nl = false) { $Text = preg_replace("(\[center\](.*?)\[\/center\])ism","
    $1
    ",$Text); // Check for list text - - if(stristr($Text,'[/(list|ul|ol)]')) - $Text = str_replace("[*]", "
  • ", $Text); - - if(stristr($Text,'[/list]')) - $Text = str_replace("[*]", "
  • ", $Text); + $Text = str_replace("[*]", "
  • ", $Text); + $Text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '
  • $1
  • ' ,$Text); $Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '
      $1
    ' ,$Text); $Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '
      $1
    ' @@ -168,7 +164,6 @@ upper-roman;">$2' ,$Text); lower-alpha;">$2' ,$Text); $Text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '
      $2
    ' ,$Text); - $Text = preg_replace("/\[li\](.*?)\[\/li\]/sm", '
  • $1
  • ' ,$Text); $Text = preg_replace("/\[td\](.*?)\[\/td\]/sm", '$1' ,$Text); $Text = preg_replace("/\[tr\](.*?)\[\/tr\]/sm", '$1' ,$Text); -- cgit v1.2.3 From 3e85c1d3304c51489249ce2a284910885a1a3c73 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 12 Feb 2012 17:15:09 -0800 Subject: make 'x minutes ago' fully translateable with argument ordering. string update. --- include/bbcode.php | 2 +- include/datetime.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 6b733c8f4..e93cbf7d7 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -11,7 +11,7 @@ function stripcode_br_cb($s) { function tryoembed($match){ $url = ((count($match)==2)?$match[1]:$match[2]); - logger("tryoembed: $url"); +// logger("tryoembed: $url"); $o = oembed_fetch_url($url); diff --git a/include/datetime.php b/include/datetime.php index d44e995cf..6d395fe3f 100755 --- a/include/datetime.php +++ b/include/datetime.php @@ -260,10 +260,11 @@ function relative_date($posted_date) { ); foreach ($a as $secs => $str) { - $d = $etime / $secs; - if ($d >= 1) { - $r = round($d); - return $r . ' ' . (($r == 1) ? $str[0] : $str[1]) . t(' ago'); + $d = $etime / $secs; + if ($d >= 1) { + $r = round($d); + // translators - e.g. 22 hours ago, 1 minute ago + return sprintf( t('%1$d %2$s ago'),$r, (($r == 1) ? $str[0] : $str[1])); } } }} -- cgit v1.2.3 From 135005571f4cfe3170b2f2ce0ea94b39a75c111a Mon Sep 17 00:00:00 2001 From: "Abinoam P. Marques Jr" Date: Sun, 12 Feb 2012 17:27:08 -0800 Subject: Added [th] bbcode tag support. --- include/bbcode.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 1d11f687d..9c70cb494 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -165,6 +165,7 @@ lower-alpha;">$2' ,$Text); $Text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '
      $2
    ' ,$Text); + $Text = preg_replace("/\[th\](.*?)\[\/th\]/sm", '$1' ,$Text); $Text = preg_replace("/\[td\](.*?)\[\/td\]/sm", '$1' ,$Text); $Text = preg_replace("/\[tr\](.*?)\[\/tr\]/sm", '$1' ,$Text); $Text = preg_replace("/\[table\](.*?)\[\/table\]/sm", '$1
    ' ,$Text); -- cgit v1.2.3 From 85c831bcbf6f4cc2793d91e4e3fb3da5828a3f60 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 12 Feb 2012 20:56:44 -0800 Subject: finish translation of 'xxxxx wrote:' --- include/bbcode.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index a4a651027..118be1298 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -195,9 +195,11 @@ upper-alpha;">$2' ,$Text); $Text = preg_replace("/\[quote\](.*?)\[\/quote\]/ism","$QuoteLayout", $Text); // Check for [quote=Author] text - $t_wrote = t("wrote"); + + $t_wrote = t('$1 wrote:'); + $Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism", - "
    $1 wrote: $2
    ", + "
    " . $t_wrote . " $2
    ", $Text); // [img=widthxheight]image source[/img] -- cgit v1.2.3