From d54042dd3898c5f4f0bc67df576484c6d25c86b2 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 28 Jan 2012 12:09:17 -0800 Subject: mime_content_type requires access to the file, not just the name --- include/attach.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/attach.php b/include/attach.php index 4001d2af1..6d611cec0 100755 --- a/include/attach.php +++ b/include/attach.php @@ -38,6 +38,7 @@ function z_mime_content_type($filename) { // audio/video 'mp3' => 'audio/mpeg', + 'wav' => 'audio/wav', 'qt' => 'video/quicktime', 'mov' => 'video/quicktime', 'ogg' => 'application/ogg', @@ -68,12 +69,13 @@ function z_mime_content_type($filename) { return $mime_types[$ext]; } } - elseif (function_exists('finfo_open')) { - $finfo = finfo_open(FILEINFO_MIME); - $mimetype = finfo_file($finfo, $filename); - finfo_close($finfo); - return $mimetype; - } +// can't use this because we're just passing a name, e.g. not a file that can be opened +// elseif (function_exists('finfo_open')) { +// $finfo = @finfo_open(FILEINFO_MIME); +// $mimetype = @finfo_file($finfo, $filename); +// @finfo_close($finfo); +// return $mimetype; +// } else { return 'application/octet-stream'; } -- cgit v1.2.3 From c76b224d8ac79d10ee68134d5585e0832e49a3c8 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 30 Jan 2012 15:13:24 -0800 Subject: prune old expired and deleted items --- include/expire.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/expire.php b/include/expire.php index 64dbe2536..7608b9054 100755 --- a/include/expire.php +++ b/include/expire.php @@ -29,6 +29,11 @@ function expire_run($argv, $argc){ $a->set_baseurl(get_config('system','url')); + // physically remove anything that has been deleted from more than two months + + $r = q("delete from item where deleted = 1 and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY"); + + logger('expire: start'); $r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0"); -- cgit v1.2.3 From 4993f4f1d63bd82a6964d6a55bb364d2c7514df4 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 30 Jan 2012 20:49:54 -0800 Subject: allow plugin to abort message posting, fix half-duplex D* relationship --- include/items.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index 62f1f2ce5..ba95919a6 100755 --- a/include/items.php +++ b/include/items.php @@ -814,6 +814,11 @@ function item_store($arr,$force_parent = false) { call_hooks('post_remote',$arr); + if(x($arr,'cancel')) { + logger('item_store: post cancelled by plugin.'); + return 0; + } + dbesc_array($arr); logger('item_store: ' . print_r($arr,true), LOGGER_DATA); -- cgit v1.2.3 From 86c0eac27d4ed2a454f752615a1b446cf2acd2b2 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 31 Jan 2012 20:03:46 -0800 Subject: transport for email contacts phase II --- include/delivery.php | 12 ++++++++++-- include/notifier.php | 6 ++++-- include/poller.php | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/delivery.php b/include/delivery.php index c05358868..71ce30023 100755 --- a/include/delivery.php +++ b/include/delivery.php @@ -373,7 +373,8 @@ function delivery_run($argv, $argc){ break; case NETWORK_MAIL : - + case NETWORK_MAIL2: + if(get_config('system','dfrn_only')) break; // WARNING: does not currently convert to RFC2047 header encodings, etc. @@ -413,7 +414,14 @@ function delivery_run($argv, $argc){ $reply_to = $r1[0]['reply_to']; $subject = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ; - $headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n"; + + // only expose our real email address to true friends + + if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked'])) + $headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n"; + else + $headers = 'From: ' . $local_user[0]['username'] . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; + if($reply_to) $headers .= 'Reply-to: ' . $reply_to . "\n"; $headers .= 'Message-id: <' . $it['uri'] . '>' . "\n"; diff --git a/include/notifier.php b/include/notifier.php index ead7aebad..53178ce53 100755 --- a/include/notifier.php +++ b/include/notifier.php @@ -584,6 +584,7 @@ function notifier_run($argv, $argc){ break; case NETWORK_MAIL: + case NETWORK_MAIL2: if(get_config('system','dfrn_only')) break; @@ -629,7 +630,7 @@ function notifier_run($argv, $argc){ // only expose our real email address to true friends - if($contact['rel'] == CONTACT_IS_FRIEND) + if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked'])) $headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n"; else $headers = 'From: ' . $local_user[0]['username'] . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; @@ -754,9 +755,10 @@ function notifier_run($argv, $argc){ ); $r2 = q("SELECT `id`, `name`,`network` FROM `contact` - WHERE `network` = '%s' AND `uid` = %d AND `blocked` = 0 AND `pending` = 0 + WHERE `network` in ( '%s', '%s') AND `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `rel` != %d order by rand() ", dbesc(NETWORK_DFRN), + dbesc(NETWORK_MAIL2), intval($owner['uid']), intval(CONTACT_IS_SHARING) ); diff --git a/include/poller.php b/include/poller.php index 89e4488b9..7d42c63b5 100755 --- a/include/poller.php +++ b/include/poller.php @@ -369,7 +369,7 @@ function poller_run($argv, $argc){ $xml = fetch_url($contact['poll']); } - elseif($contact['network'] === NETWORK_MAIL) { + elseif($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) { $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); if($mail_disabled) @@ -462,7 +462,7 @@ function poller_run($argv, $argc){ $datarray['contact-id'] = $contact['id']; if($datarray['parent-uri'] === $datarray['uri']) $datarray['private'] = 1; - if(! get_pconfig($importer_uid,'system','allow_public_email_replies')) { + if(($contact['network'] === NETWORK_MAIL) && (! get_pconfig($importer_uid,'system','allow_public_email_replies'))) { $datarray['private'] = 1; $datarray['allow_cid'] = '<' . $contact['id'] . '>'; } -- cgit v1.2.3 From 9fc36d3da4e85b4b25b7abe1917cb2188eea77ea Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 1 Feb 2012 17:09:53 -0800 Subject: improvements in d* markdown conversion --- include/bb2diaspora.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index d367b6716..9a29b05a2 100755 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -14,9 +14,17 @@ require_once('include/html2bbcode.php'); function diaspora2bb($s) { $s = html_entity_decode($s,ENT_COMPAT,'UTF-8'); + $s = str_replace("\r","\n",$s); $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s); + + $s = preg_replace('/\#([^\s\#])/','\\#$1',$s); + $s = Markdown($s); + + $s = str_replace('#','#',$s); + $s = str_replace("\n",'
',$s); + $s = html2bbcode($s); // $s = str_replace('*','*',$s); @@ -30,11 +38,6 @@ function diaspora2bb($s) { $s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s); $s = scale_diaspora_images($s); - // we seem to get a lot of text smushed together with links from Diaspora. - - $s = preg_replace('/[^ ]\[url\=(.*?)\]/',' [url=$1]' ,$s); - $s = preg_replace('/\[\/url\][^ ]/','[/url] ',$s); - return $s; } -- cgit v1.2.3 From 4cf6bd54693b460f3ac28d2760ff33b740493e39 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 2 Feb 2012 18:02:08 -0800 Subject: do an optimise after an expunge --- include/expire.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/expire.php b/include/expire.php index 7608b9054..5fa0ec758 100755 --- a/include/expire.php +++ b/include/expire.php @@ -29,10 +29,10 @@ function expire_run($argv, $argc){ $a->set_baseurl(get_config('system','url')); - // physically remove anything that has been deleted from more than two months + // physically remove anything that has been deleted for more than two months $r = q("delete from item where deleted = 1 and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY"); - + q("optimize table item"); logger('expire: start'); -- cgit v1.2.3 From 3d099bd99abe6431103112bfe1eafd96a61c6767 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 6 Feb 2012 01:08:00 -0800 Subject: beer --- include/text.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/text.php b/include/text.php index 5f4adb27c..70733bac5 100755 --- a/include/text.php +++ b/include/text.php @@ -679,6 +679,7 @@ function smilies($s) { $s = str_replace( array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', +// ':beer', ':homebrew', '~friendika', '~friendica', 'Diaspora*' ), array( '<3', @@ -702,6 +703,9 @@ function smilies($s) { 'O.o', '\\.../', '\\ooo/', +// ':beer', +// ':homebrew', + '~friendika ~friendika', '~friendica ~friendica', 'DiasporaDiaspora*', -- cgit v1.2.3 From 2b77002471fc9b2e1ad3e8dd69d373cc910e8834 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 6 Feb 2012 20:28:50 -0800 Subject: basic support for plaintext editor configuration (disable tinymce), currently only zero themes - and not all the post tools currently work (as some of them emit html). --- include/conversation.php | 176 ++++++++++++++++++++++++----------------------- 1 file changed, 90 insertions(+), 86 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 20c7b2a51..6defefc73 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -838,98 +838,102 @@ function status_editor($a,$x, $notes_cid = 0) { $geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : ''); - $tpl = get_markup_template('jot-header.tpl'); - - $a->page['htmlhead'] .= replace_macros($tpl, array( - '$newpost' => 'true', - '$baseurl' => $a->get_baseurl(), - '$geotag' => $geotag, - '$nickname' => $x['nickname'], - '$ispublic' => t('Visible to everybody'), - '$linkurl' => t('Please enter a link URL:'), - '$vidurl' => t("Please enter a video link/URL:"), - '$audurl' => t("Please enter an audio link/URL:"), - '$term' => t('Tag term:'), - '$whereareu' => t('Where are you right now?'), - '$title' => t('Enter a title for this item') - )); - - - $tpl = get_markup_template("jot.tpl"); - - $jotplugins = ''; - $jotnets = ''; + $plaintext = false; + if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) + $plaintext = true; - $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); + $tpl = get_markup_template('jot-header.tpl'); + + $a->page['htmlhead'] .= replace_macros($tpl, array( + '$newpost' => 'true', + '$baseurl' => $a->get_baseurl(), + '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), + '$geotag' => $geotag, + '$nickname' => $x['nickname'], + '$ispublic' => t('Visible to everybody'), + '$linkurl' => t('Please enter a link URL:'), + '$vidurl' => t("Please enter a video link/URL:"), + '$audurl' => t("Please enter an audio link/URL:"), + '$term' => t('Tag term:'), + '$whereareu' => t('Where are you right now?'), + '$title' => t('Enter a title for this item') + )); - $mail_enabled = false; - $pubmail_enabled = false; - if(($x['is_owner']) && (! $mail_disabled)) { - $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", - intval(local_user()) - ); - if(count($r)) { - $mail_enabled = true; - if(intval($r[0]['pubmail'])) - $pubmail_enabled = true; - } + $tpl = get_markup_template("jot.tpl"); + + $jotplugins = ''; + $jotnets = ''; + + $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); + + $mail_enabled = false; + $pubmail_enabled = false; + + if(($x['is_owner']) && (! $mail_disabled)) { + $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", + intval(local_user()) + ); + if(count($r)) { + $mail_enabled = true; + if(intval($r[0]['pubmail'])) + $pubmail_enabled = true; } + } - if($mail_enabled) { - $selected = (($pubmail_enabled) ? ' checked="checked" ' : ''); - $jotnets .= '
' - . t("Post to Email") . '
'; - } + if($mail_enabled) { + $selected = (($pubmail_enabled) ? ' checked="checked" ' : ''); + $jotnets .= '
' . t("Post to Email") . '
'; + } - call_hooks('jot_tool', $jotplugins); - call_hooks('jot_networks', $jotnets); - - if($notes_cid) - $jotnets .= ''; - - $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins)); - - $o .= replace_macros($tpl,array( - '$return_path' => $a->cmd, - '$action' => 'item', - '$share' => (($x['button']) ? $x['button'] : t('Share')), - '$upload' => t('Upload photo'), - '$shortupload' => t('upload photo'), - '$attach' => t('Attach file'), - '$shortattach' => t('attach file'), - '$weblink' => t('Insert web link'), - '$shortweblink' => t('web link'), - '$video' => t('Insert video link'), - '$shortvideo' => t('video link'), - '$audio' => t('Insert audio link'), - '$shortaudio' => t('audio link'), - '$setloc' => t('Set your location'), - '$shortsetloc' => t('set location'), - '$noloc' => t('Clear browser location'), - '$shortnoloc' => t('clear location'), - '$title' => "", - '$placeholdertitle' => t('Set title'), - '$wait' => t('Please wait'), - '$permset' => t('Permission settings'), - '$shortpermset' => t('permissions'), - '$ptyp' => (($notes_cid) ? 'note' : 'wall'), - '$content' => '', - '$post_id' => '', - '$baseurl' => $a->get_baseurl(), - '$defloc' => $x['default_location'], - '$visitor' => $x['visitor'], - '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']), - '$emailcc' => t('CC: email addresses'), - '$public' => t('Public post'), - '$jotnets' => $jotnets, - '$emtitle' => t('Example: bob@example.com, mary@example.com'), - '$lockstate' => $x['lockstate'], - '$acl' => $x['acl'], - '$bang' => $x['bang'], - '$profile_uid' => $x['profile_uid'], - '$preview' => t('Preview'), - )); + call_hooks('jot_tool', $jotplugins); + call_hooks('jot_networks', $jotnets); + + if($notes_cid) + $jotnets .= ''; + + $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins)); + + $o .= replace_macros($tpl,array( + '$return_path' => $a->cmd, + '$action' => 'item', + '$share' => (($x['button']) ? $x['button'] : t('Share')), + '$upload' => t('Upload photo'), + '$shortupload' => t('upload photo'), + '$attach' => t('Attach file'), + '$shortattach' => t('attach file'), + '$weblink' => t('Insert web link'), + '$shortweblink' => t('web link'), + '$video' => t('Insert video link'), + '$shortvideo' => t('video link'), + '$audio' => t('Insert audio link'), + '$shortaudio' => t('audio link'), + '$setloc' => t('Set your location'), + '$shortsetloc' => t('set location'), + '$noloc' => t('Clear browser location'), + '$shortnoloc' => t('clear location'), + '$title' => "", + '$placeholdertitle' => t('Set title'), + '$wait' => t('Please wait'), + '$permset' => t('Permission settings'), + '$shortpermset' => t('permissions'), + '$ptyp' => (($notes_cid) ? 'note' : 'wall'), + '$content' => '', + '$post_id' => '', + '$baseurl' => $a->get_baseurl(), + '$defloc' => $x['default_location'], + '$visitor' => $x['visitor'], + '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']), + '$emailcc' => t('CC: email addresses'), + '$public' => t('Public post'), + '$jotnets' => $jotnets, + '$emtitle' => t('Example: bob@example.com, mary@example.com'), + '$lockstate' => $x['lockstate'], + '$acl' => $x['acl'], + '$bang' => $x['bang'], + '$profile_uid' => $x['profile_uid'], + '$preview' => t('Preview'), + )); return $o; } -- cgit v1.2.3 From a869bd2fe56d1795ab1d8744796a6e908e5adc29 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 7 Feb 2012 02:16:28 -0800 Subject: don't link tags enclosed inside Diaspora links --- include/diaspora.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'include') diff --git a/include/diaspora.php b/include/diaspora.php index cded389c3..2a4c8b9da 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -673,6 +673,14 @@ function diaspora_post($importer,$xml) { if(strpos($tag,'#') === 0) { if(strpos($tag,'[url=')) continue; + + // don't link tags that are already embedded in links + + if(preg_match('/\[(.*?)' . preg_quote($tag) . '(.*?)\]/',$body)) + continue; + if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag) . '(.*?)\)/',$body)) + continue; + $basetag = str_replace('_',' ',substr($tag,1)); $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body); if(strlen($str_tags)) @@ -830,6 +838,15 @@ function diaspora_reshare($importer,$xml) { if(strpos($tag,'#') === 0) { if(strpos($tag,'[url=')) continue; + + // don't link tags that are already embedded in links + + if(preg_match('/\[(.*?)' . preg_quote($tag) . '(.*?)\]/',$body)) + continue; + if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag) . '(.*?)\)/',$body)) + continue; + + $basetag = str_replace('_',' ',substr($tag,1)); $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body); if(strlen($str_tags)) @@ -1062,6 +1079,15 @@ function diaspora_comment($importer,$xml,$msg) { if(strpos($tag,'#') === 0) { if(strpos($tag,'[url=')) continue; + + // don't link tags that are already embedded in links + + if(preg_match('/\[(.*?)' . preg_quote($tag) . '(.*?)\]/',$body)) + continue; + if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag) . '(.*?)\)/',$body)) + continue; + + $basetag = str_replace('_',' ',substr($tag,1)); $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body); if(strlen($str_tags)) -- cgit v1.2.3 From 8a3c1f79300152d9b65b419ee33d129829043126 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 7 Feb 2012 15:41:06 -0800 Subject: beer smilie --- include/text.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 70733bac5..8206ba7e9 100755 --- a/include/text.php +++ b/include/text.php @@ -679,7 +679,7 @@ function smilies($s) { $s = str_replace( array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', -// ':beer', ':homebrew', + ':beer', ':homebrew', '~friendika', '~friendica', 'Diaspora*' ), array( '<3', @@ -703,8 +703,8 @@ function smilies($s) { 'O.o', '\\.../', '\\ooo/', -// ':beer', -// ':homebrew', + ':beer', + ':homebrew', '~friendika ~friendika', '~friendica ~friendica', -- cgit v1.2.3 From c506bb42a93be7bfe3d2066e60d08b87ba3275af Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 7 Feb 2012 17:03:09 -0800 Subject: :coffee extended smilie --- 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 8206ba7e9..9aca14598 100755 --- a/include/text.php +++ b/include/text.php @@ -679,7 +679,7 @@ function smilies($s) { $s = str_replace( array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', - ':beer', ':homebrew', + ':beer', ':homebrew', ':coffee', '~friendika', '~friendica', 'Diaspora*' ), array( '<3', @@ -705,6 +705,7 @@ function smilies($s) { '\\ooo/', ':beer', ':homebrew', + ':coffee', '~friendika ~friendika', '~friendica ~friendica', -- cgit v1.2.3 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 ed38808aae6585bb6c31a18788f0290812bae2f8 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 10 Feb 2012 17:30:22 +0100 Subject: hidden jot in "display" to allow reshare --- include/conversation.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 6defefc73..947a9b040 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -494,7 +494,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { } $likebuttons = ''; - $shareable = ((($profile_owner == local_user()) && ($mode != 'display') && (! $item['private'])) ? true : false); + $shareable = ((($profile_owner == local_user()) && (! $item['private'])) ? true : false); //($mode != 'display') && if($page_writeable) { if($toplevelpost) { @@ -832,7 +832,7 @@ function format_like($cnt,$arr,$type,$id) { }} -function status_editor($a,$x, $notes_cid = 0) { +function status_editor($a,$x, $notes_cid = 0, $popup=false) { $o = ''; @@ -896,7 +896,7 @@ function status_editor($a,$x, $notes_cid = 0) { $o .= replace_macros($tpl,array( '$return_path' => $a->cmd, - '$action' => 'item', + '$action' => $a->get_baseurl().'/item', '$share' => (($x['button']) ? $x['button'] : t('Share')), '$upload' => t('Upload photo'), '$shortupload' => t('upload photo'), @@ -935,6 +935,12 @@ function status_editor($a,$x, $notes_cid = 0) { '$preview' => t('Preview'), )); + + if ($popup==true){ + $o = ''; + + } + return $o; } -- 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 From dc4420c5ec085f43bdab35d4eb06f024a3472740 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 13 Feb 2012 14:16:51 -0800 Subject: hr bbcode tag --- include/bbcode.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 118be1298..1df2ad725 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -173,6 +173,7 @@ upper-alpha;">$2' ,$Text); $Text = preg_replace("/\[table border=1\](.*?)\[\/table\]/sm", '$1
    ' ,$Text); $Text = preg_replace("/\[table border=0\](.*?)\[\/table\]/sm", '$1
    ' ,$Text); + $Text = str_replace('[hr]','
    ', $Text); // Check for font change text -- cgit v1.2.3 From 803a7425eaff955bd0001b46ee7f22c5d80acb89 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 13 Feb 2012 18:23:03 -0800 Subject: make hr bbtag shareable, stray quote in duepuntozero wall_item --- include/conversation.php | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index b44d4acd6..4eff0d088 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -609,7 +609,6 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { if ($tag!="") $tags[] = bbcode($tag); } - // Build the HTML $body = prepare_body($item,true); -- cgit v1.2.3 From e4b1c07727c2c96e1752668c09ab82015e209a1f Mon Sep 17 00:00:00 2001 From: Vasudev Kamath Date: Tue, 14 Feb 2012 23:10:11 +0530 Subject: cry, foot in mouth, cool, undecided and embarassed smiley's are mapped --- include/text.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 798e809d1..317028065 100755 --- a/include/text.php +++ b/include/text.php @@ -682,7 +682,7 @@ function smilies($s) { $a = get_app(); $s = str_replace( - array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ';)', ':-(', ':(', ':-P', ':P', ':-"', ':-"', ':-x', ':-X', ':-D', ':D', '8-|', '8-O', ':-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/', ":'(", ":-!", ":-/", ":-[", "8-)", ':beer', ':homebrew', ':coffee', '~friendika', '~friendica', 'Diaspora*' ), array( @@ -710,7 +710,12 @@ function smilies($s) { 'o.O', 'O.o', '\\.../', - '\\ooo/', + '\\ooo/', + ':\'(', + ':-!', + ':-/', + ':-[', + '8-)', ':beer', ':homebrew', -- cgit v1.2.3 From 134fdda75f5630efd4053469d1a41940c28a1dff Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 14 Feb 2012 15:31:08 -0800 Subject: refactor smilie code to allow for extensions and generation of a table of the entire list --- include/text.php | 71 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 317028065..082d907ff 100755 --- a/include/text.php +++ b/include/text.php @@ -678,21 +678,56 @@ function linkify($s) { */ if(! function_exists('smilies')) { -function smilies($s) { +function smilies($s, $sample = false) { $a = get_app(); - $s = str_replace( - array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ';)', ':-(', ':(', ':-P', ':P', ':-"', ':-"', ':-x', ':-X', ':-D', ':D', '8-|', '8-O', ':-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', ":'(", ":-!", ":-/", ":-[", "8-)", - ':beer', ':homebrew', ':coffee', - '~friendika', '~friendica', 'Diaspora*' ), - array( + $texts = array( + '<3', + '</3', + '<\\3', + ':-)', + ':)', + ';-)', + ';)', + ':-(', + ':(', + ':-P', + ':P', + ':-"', + ':-"', + ':-x', + ':-X', + ':-D', + ':D', + '8-|', + '8-O', + ':-O', + '\\o/', + 'o.O', + 'O.o', + '\\.../', + '\\ooo/', + ":'(", + ":-!", + ":-/", + ":-[", + "8-)", + ':beer', + ':homebrew', + ':coffee', + '~friendika', + '~friendica', + 'Diaspora*' + ); + + $icons = array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', - ';)', + ';)', ':-(', ':(', ':-P', @@ -702,7 +737,7 @@ function smilies($s) { ':-x', ':-X', ':-D', - ':D', + ':D', '8-|', '8-O', ':-O', @@ -715,19 +750,29 @@ function smilies($s) { ':-!', ':-/', ':-[', - '8-)', - + '8-)', ':beer', ':homebrew', ':coffee', - '~friendika ~friendika', '~friendica ~friendica', 'DiasporaDiaspora*', - ), $s); + ); + + $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s); + call_hooks('smilie', $params); - call_hooks('smilie', $s); + if($sample) { + $s = '
    '; + for($x = 0; $x < count($params['texts']); $x ++) { + $s .= '
    ' . $params['texts'][$x] . '
    ' . $params['icons'][$x] . '
    '; + } + } + else { + $s = str_replace($params['texts'],$params['icons'],$params['string']); + } + return $s; }} -- cgit v1.2.3 From f86593965389e2592ae41c7e7f5cb6dcfc7a660f Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 14 Feb 2012 18:07:13 -0800 Subject: localise links to private photos inside messages --- include/conversation.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 4eff0d088..8a0fd00fb 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -4,6 +4,28 @@ * Render actions localized */ function localize_item(&$item){ + + $Text = $item['body']; + $saved_image = ''; + $img_start = strpos($Text,'[img]data:'); + $img_end = strpos($Text,'[/img]'); + + if($img_start !== false && $img_end !== false && $img_end > $img_start) { + $start_fragment = substr($Text,0,$img_start); + $img_start += strlen('[img]'); + $saved_image = substr($Text,$img_start,$img_end - $img_start); + $end_fragment = substr($Text,$img_end + strlen('[/img]')); + $Text = $start_fragment . '[!#saved_image#!]' . $end_fragment; + $search = '/\[url\=(.*?)\]\[!#saved_image#!\]\[\/url\]' . '/is'; + $replace = '[url=' . z_path() . '/redir/' . $item['contact-id'] + . '?f=1&url=' . '$1' . '][!#saved_image#!][/url]' ; + + $Text = preg_replace($search,$replace,$Text); + + if(strlen($saved_image)) + $item['body'] = str_replace('[!#saved_image#!]', '[img]' . $saved_image . '[/img]',$Text); + } + $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; if ($item['verb']=== ACTIVITY_LIKE || $item['verb']=== ACTIVITY_DISLIKE){ -- cgit v1.2.3 From 03171fd7deeb8e564478273ebdbee77eeab4a6cd Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 14 Feb 2012 23:13:18 -0800 Subject: preliminary qcomment support, [nosmile] tag to disable smiley processing --- include/bb2diaspora.php | 2 +- include/bbcode.php | 5 ++++- include/conversation.php | 5 ++++- include/text.php | 5 ++++- 4 files changed, 13 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 9a29b05a2..c26b0c334 100755 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -212,7 +212,7 @@ function bb2diaspora($Text,$preserve_nl = false) { $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", 'http://vimeo.com/$1',$Text); - + $Text = str_replace('[nosmile]','',$Text); // oembed tag // $Text = oembed_bbcode2html($Text); diff --git a/include/bbcode.php b/include/bbcode.php index 1df2ad725..cae867eb8 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -174,7 +174,10 @@ upper-alpha;">$2' ,$Text); $Text = preg_replace("/\[table border=0\](.*?)\[\/table\]/sm", '$1
    ' ,$Text); $Text = str_replace('[hr]','
    ', $Text); - + + // This is actually executed in prepare_body() + + $Text = str_replace('[nosmile]','',$Text); // Check for font change text $Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm","$2",$Text); diff --git a/include/conversation.php b/include/conversation.php index 8a0fd00fb..2ea9b603f 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -522,6 +522,9 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { if ($shareable) $likebuttons['share'] = array( t('Share this'), t('share')); } +// $qcomment = array(':-)','LOL','ROTFL','[smile]'); + $qcomment = null; + if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) { $comment = replace_macros($cmnt_tpl,array( '$return_path' => '', @@ -529,6 +532,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'), '$id' => $item['item_id'], '$parent' => $item['parent'], + '$qcomment' => $qcomment, '$profile_uid' => $profile_owner, '$mylink' => $a->contact['url'], '$mytitle' => t('This is you'), @@ -634,7 +638,6 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { // Build the HTML $body = prepare_body($item,true); - $tmp_item = replace_macros($template,array( '$type' => implode("",array_slice(split("/",$item['verb']),-1)), diff --git a/include/text.php b/include/text.php index 082d907ff..0cd7f114e 100755 --- a/include/text.php +++ b/include/text.php @@ -878,7 +878,10 @@ function prepare_text($text) { require_once('include/bbcode.php'); - $s = smilies(bbcode($text)); + if(stristr($text,'[nosmile]')) + $s = bbcode($text); + else + $s = smilies(bbcode($text)); return $s; }} -- cgit v1.2.3 From fe3e8ee8547dbb7dab5b756056d688d2b8bfbd5f Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 15 Feb 2012 11:10:02 +0100 Subject: quattro: icons for attachments --- include/text.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 798e809d1..6beb5c9b2 100755 --- a/include/text.php +++ b/include/text.php @@ -799,10 +799,10 @@ function prepare_body($item,$attach = false) { case 'audio': case 'image': case 'text': - $icon = '
    '; + $icon = '
    '; break; default: - $icon = '
    '; + $icon = '
    '; break; } $title = ((strlen(trim($matches[4]))) ? escape_tags(trim($matches[4])) : escape_tags($matches[1])); -- cgit v1.2.3 From d05442610158eb21cd3e9b9b3cd8cd3e5d56c13c Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 15 Feb 2012 15:28:32 -0800 Subject: encode email headers on message deliveries --- include/delivery.php | 7 ++++--- include/notifier.php | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/delivery.php b/include/delivery.php index 71ce30023..03199b010 100755 --- a/include/delivery.php +++ b/include/delivery.php @@ -21,6 +21,7 @@ function delivery_run($argv, $argc){ require_once('include/items.php'); require_once('include/bbcode.php'); require_once('include/diaspora.php'); + require_once('include/email.php'); load_config('config'); load_config('system'); @@ -413,14 +414,14 @@ function delivery_run($argv, $argc){ if($r1 && $r1[0]['reply_to']) $reply_to = $r1[0]['reply_to']; - $subject = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ; + $subject = (($it['title']) ? email_header_encode($it['title'],'UTF-8') : t("\x28no subject\x29")) ; // only expose our real email address to true friends if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked'])) - $headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n"; + $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . $local_user[0]['email'] . '>' . "\n"; else - $headers = 'From: ' . $local_user[0]['username'] . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; + $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; if($reply_to) $headers .= 'Reply-to: ' . $reply_to . "\n"; diff --git a/include/notifier.php b/include/notifier.php index 53178ce53..70fd1d52c 100755 --- a/include/notifier.php +++ b/include/notifier.php @@ -35,7 +35,7 @@ function notifier_run($argv, $argc){ require_once("datetime.php"); require_once('include/items.php'); require_once('include/bbcode.php'); - + require_once('include/email.php'); load_config('config'); load_config('system'); @@ -626,14 +626,14 @@ function notifier_run($argv, $argc){ if($r1 && $r1[0]['reply_to']) $reply_to = $r1[0]['reply_to']; - $subject = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ; + $subject = (($it['title']) ? email_header_encode($it['title'],'UTF-8') : t("\x28no subject\x29")) ; // only expose our real email address to true friends if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked'])) - $headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n"; + $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . $local_user[0]['email'] . '>' . "\n"; else - $headers = 'From: ' . $local_user[0]['username'] . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; + $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; if($reply_to) $headers .= 'Reply-to: ' . $reply_to . "\n"; -- cgit v1.2.3 From b1d31aca519bf7ca99420ad99ccd9575cc24455f Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 15 Feb 2012 18:13:41 -0800 Subject: quick comments --- include/conversation.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 2ea9b603f..3d13a1179 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -522,8 +522,9 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { if ($shareable) $likebuttons['share'] = array( t('Share this'), t('share')); } -// $qcomment = array(':-)','LOL','ROTFL','[smile]'); - $qcomment = null; + + $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null); + $qcomment = (($qc) ? explode("\n",$qc) : null); if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) { $comment = replace_macros($cmnt_tpl,array( -- cgit v1.2.3 From ada2a555dce33692ee40b3fb81c93dbe276e73cd Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 15 Feb 2012 23:58:28 -0800 Subject: sql typo in auto-friend with D* --- include/auth.php | 2 +- include/diaspora.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/auth.php b/include/auth.php index fd1c63847..fc52684e6 100755 --- a/include/auth.php +++ b/include/auth.php @@ -165,7 +165,7 @@ else { } if((! $record) || (! count($record))) { - logger('authenticate: failed login attempt: ' . trim($_POST['username'])); + logger('authenticate: failed login attempt: ' . notags(trim($_POST['username']))); notice( t('Login failed.') . EOL ); goaway(z_root()); } diff --git a/include/diaspora.php b/include/diaspora.php index 2a4c8b9da..ba0112362 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -598,7 +598,7 @@ function diaspora_request($importer,$xml) { `uri-date` = '%s', `avatar-date` = '%s', `blocked` = 0, - `pending` = 0, + `pending` = 0 WHERE `id` = %d LIMIT 1 ", dbesc($photos[0]), -- cgit v1.2.3 From 1b445d511b729d114439935c1315f1f1ead7e1b2 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 16 Feb 2012 00:08:38 -0800 Subject: another sql typo --- include/diaspora.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/diaspora.php b/include/diaspora.php index ba0112362..a116e6a44 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -611,7 +611,7 @@ function diaspora_request($importer,$xml) { intval($contact_record['id']) ); - $u = q("select * from user where id = %d limit 1",intval($importer['uid'])); + $u = q("select * from user where uid = %d limit 1",intval($importer['uid'])); if($u) $ret = diaspora_share($u[0],$contact_record); } -- cgit v1.2.3 From 7dcef67492f713afcf4e3a9e5949f01416a6bcff Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 16 Feb 2012 15:15:28 -0800 Subject: facepalm smiley --- include/text.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/text.php b/include/text.php index 0d99e6f4a..8895f9813 100755 --- a/include/text.php +++ b/include/text.php @@ -715,6 +715,7 @@ function smilies($s, $sample = false) { ':beer', ':homebrew', ':coffee', + ':facepalm', '~friendika', '~friendica', 'Diaspora*' @@ -754,6 +755,7 @@ function smilies($s, $sample = false) { ':beer', ':homebrew', ':coffee', + ':facepalm', '~friendika ~friendika', '~friendica ~friendica', 'DiasporaDiaspora*', -- cgit v1.2.3 From 2abbd81ce1760cdfd4098ae1d5cda29e608eb021 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 16 Feb 2012 18:29:09 -0800 Subject: a few fixes for offsite community members --- include/delivery.php | 7 +++++++ include/items.php | 24 +++++++++++++++++++----- include/notifier.php | 10 +++++++++- 3 files changed, 35 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/delivery.php b/include/delivery.php index 03199b010..677d89388 100755 --- a/include/delivery.php +++ b/include/delivery.php @@ -312,6 +312,13 @@ function delivery_run($argv, $argc){ ); if(count($x)) { + if($owner['page-flags'] == PAGE_COMMUNITY && ! $x[0]['writable']) { + q("update contact set writable = 1 where id = %d limit 1", + intval($x[0]['id']) + ); + $x[0]['writable'] = 1; + } + require_once('library/simplepie/simplepie.inc'); logger('mod-delivery: local delivery'); local_delivery($x[0],$atom); diff --git a/include/items.php b/include/items.php index 5e3f9a60a..1bf73bc36 100755 --- a/include/items.php +++ b/include/items.php @@ -999,7 +999,16 @@ function tag_deliver($uid,$item_id) { // 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", + $c = q("select name, url, thumb from contact where self = 1 and uid = %d limit 1", + intval($u[0]['uid']) + ); + if(! count($c)) + return; + + q("update item set wall = 1, origin = 1, forum_mode = 1, `owner-name` = '%s', `owner-link` = '%s', `owner-avatar` = '%s' where id = %d limit 1", + dbesc($c[0]['name']), + dbesc($c[0]['url']), + dbesc($c[0]['thumb']), intval($item_id) ); @@ -1016,8 +1025,8 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { $a = get_app(); - if((! strlen($contact['issued-id'])) && (! $contact['duplex']) && (! ($owner['page-flags'] == PAGE_COMMUNITY))) - return 3; +// if((! strlen($contact['issued-id'])) && (! $contact['duplex']) && (! ($owner['page-flags'] == PAGE_COMMUNITY))) +// return 3; $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']); @@ -1068,7 +1077,9 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { $final_dfrn_id = ''; - if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))) { + if(($contact['duplex'] && strlen($contact['pubkey'])) + || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey'])) + || ($contact['rel'] == CONTACT_IS_SHARING && strlen($contact['pubkey']))) { openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']); openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']); } @@ -1111,7 +1122,10 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { if($dfrn_version >= 2.1) { - if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))) { + if(($contact['duplex'] && strlen($contact['pubkey'])) + || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey'])) + || ($contact['rel'] == CONTACT_IS_SHARING && strlen($contact['pubkey']))) { + openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']); } else { diff --git a/include/notifier.php b/include/notifier.php index 70fd1d52c..37bc6dae5 100755 --- a/include/notifier.php +++ b/include/notifier.php @@ -264,7 +264,7 @@ function notifier_run($argv, $argc){ $deny_people = expand_acl($parent['deny_cid']); $deny_groups = expand_groups(expand_acl($parent['deny_gid'])); - // if our parent is a forum, uplink to the origonal author causing + // if our parent is a forum, uplink to the origional author causing // a delivery fork if(intval($parent['forum_mode']) && (! $top_level) && ($cmd !== 'uplink')) { @@ -526,6 +526,14 @@ function notifier_run($argv, $argc){ ); if(count($x)) { + + if($owner['page-flags'] == PAGE_COMMUNITY && ! $x[0]['writable']) { + q("update contact set writable = 1 where id = %d limit 1", + intval($x[0]['id']) + ); + $x[0]['writable'] = 1; + } + require_once('library/simplepie/simplepie.inc'); logger('mod-delivery: local delivery'); local_delivery($x[0],$atom); -- cgit v1.2.3 From 48f5bd492de7acb021b9065beb2586391efb3c9e Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 16 Feb 2012 23:14:36 -0800 Subject: naked link with no protocol being passed from Diaspora --- include/oembed.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/oembed.php b/include/oembed.php index 118f7fa4a..af3413a25 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -12,6 +12,11 @@ function oembed_replacecb($matches){ function oembed_fetch_url($embedurl){ + if(! strpos('://',$embedurl)) { + // this may be wrong but it's already wrong, we can only guess + $embedurl = 'http://' . $embedurl; + } + $txt = Cache::get($embedurl); $noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm"); -- cgit v1.2.3 From 7bd43613faf2f5930e037311e91e9fb7bc0473ed Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 17 Feb 2012 15:34:05 +0100 Subject: oembed: revert changes from 48f5bd492d --- include/oembed.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include') diff --git a/include/oembed.php b/include/oembed.php index af3413a25..5c3c595f5 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -11,11 +11,6 @@ function oembed_replacecb($matches){ function oembed_fetch_url($embedurl){ - - if(! strpos('://',$embedurl)) { - // this may be wrong but it's already wrong, we can only guess - $embedurl = 'http://' . $embedurl; - } $txt = Cache::get($embedurl); -- cgit v1.2.3 From 4222f506a82c7b2a50b602c51a83a85e1912450c Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 17 Feb 2012 23:44:25 -0800 Subject: deprecating two-char smilies --- include/text.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 8895f9813..45881b9a6 100755 --- a/include/text.php +++ b/include/text.php @@ -686,19 +686,19 @@ function smilies($s, $sample = false) { '</3', '<\\3', ':-)', - ':)', +// ':)', ';-)', - ';)', +// ';)', ':-(', - ':(', +// ':(', ':-P', - ':P', +// ':P', ':-"', ':-"', ':-x', ':-X', ':-D', - ':D', +// ':D', '8-|', '8-O', ':-O', @@ -726,19 +726,19 @@ function smilies($s, $sample = false) { '</3', '<\\3', ':-)', - ':)', +// ':)', ';-)', - ';)', +// ';)', ':-(', - ':(', +// ':(', ':-P', - ':P', +// ':P', ':-\', ':-\', ':-x', ':-X', ':-D', - ':D', +// ':D', '8-|', '8-O', ':-O', -- cgit v1.2.3 From 1b9c03f6fc67e8230a06e6dddae59974c1f8ba56 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 18 Feb 2012 02:57:42 -0800 Subject: new notifications - implement storage --- include/diaspora.php | 1 + include/enotify.php | 31 +++++++++++++++++++++++++------ include/items.php | 5 +++++ 3 files changed, 31 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/diaspora.php b/include/diaspora.php index a116e6a44..a8e02e509 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1308,6 +1308,7 @@ function diaspora_conversation($importer,$xml,$msg) { 'language' => $importer['language'], 'to_name' => $importer['username'], 'to_email' => $importer['email'], + 'uid' =>$importer['importer_uid'], 'item' => array('subject' => $subject, 'body' => $body), 'source_name' => $person['name'], 'source_link' => $person['url'], diff --git a/include/enotify.php b/include/enotify.php index 6e7130bc8..ec26439dc 100755 --- a/include/enotify.php +++ b/include/enotify.php @@ -32,7 +32,7 @@ function notification($params) { $sitelink = t('Please visit %s to view and/or reply to your private messages.'); $tsitelink = sprintf( $sitelink, $siteurl . '/message' ); $hsitelink = sprintf( $sitelink, '' . $sitename . ''); - $itemlink = ''; + $itemlink = $siteurl . '/message'; } if($params['type'] == NOTIFY_COMMENT) { @@ -100,9 +100,27 @@ function notification($params) { } - // TODO - create notification entry in DB + // from here on everything is in the recipients language + push_lang($params['language']); + require_once('include/html2bbcode.php'); + + // create notification entry in DB + + $r = q("insert into notify (name,url,photo,date,msg,uid,link,type,verb,otype) + values('%s','%s','%s','%s','%s',%d,'%s',%d,'%s','%s')", + dbesc($params['source_name']), + dbesc($params['source_link']), + dbesc($params['source_photo']), + dbesc(datetime_convert()), + dbesc($preamble), + intval($params['uid']), + dbesc($itemlink), + intval($params['type']), + dbesc($params['verb']), + dbesc($params['otype']) + ); // send email notification if notification preferences permit @@ -111,7 +129,6 @@ function notification($params) { logger('notification: sending notification email'); - push_lang($params['language']); $textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r", "\\n"), "\n", $body))),ENT_QUOTES,'UTF-8')); @@ -126,7 +143,7 @@ function notification($params) { '$preamble' => $preamble, '$sitename' => $sitename, '$siteurl' => $siteurl, - '$source_name' => $parama['source_name'], + '$source_name' => $params['source_name'], '$source_link' => $params['source_link'], '$source_photo' => $params['source_photo'], '$username' => $params['to_name'], @@ -146,7 +163,7 @@ function notification($params) { '$preamble' => $preamble, '$sitename' => $sitename, '$siteurl' => $siteurl, - '$source_name' => $parama['source_name'], + '$source_name' => $params['source_name'], '$source_link' => $params['source_link'], '$source_photo' => $params['source_photo'], '$username' => $params['to_name'], @@ -171,8 +188,10 @@ function notification($params) { 'htmlVersion' => $email_html_body, 'textVersion' => $email_text_body )); - pop_lang(); } + + pop_lang(); + } require_once('include/email.php'); diff --git a/include/items.php b/include/items.php index 1bf73bc36..f4837449d 100755 --- a/include/items.php +++ b/include/items.php @@ -977,6 +977,7 @@ function tag_deliver($uid,$item_id) { 'language' => $u[0]['language'], 'to_name' => $u[0]['username'], 'to_email' => $u[0]['email'], + 'uid' => $u[0]['uid'], 'item' => $item, 'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'], 'source_name' => $item['author-name'], @@ -1848,6 +1849,7 @@ function local_delivery($importer,$data) { 'language' => $importer['language'], 'to_name' => $importer['username'], 'to_email' => $importer['email'], + 'uid' => $importer['importer_uid'], 'item' => $fsugg, 'link' => $a->get_baseurl() . '/notifications/intros', 'source_name' => $importer['name'], @@ -1899,6 +1901,7 @@ function local_delivery($importer,$data) { 'language' => $importer['language'], 'to_name' => $importer['username'], 'to_email' => $importer['email'], + 'uid' => $importer['importer_uid'], 'item' => $msg, 'source_name' => $msg['from-name'], 'source_link' => $importer['url'], @@ -2171,6 +2174,7 @@ function local_delivery($importer,$data) { 'language' => $importer['language'], 'to_name' => $importer['username'], 'to_email' => $importer['email'], + 'uid' => $importer['importer_uid'], 'item' => $datarray, 'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, 'source_name' => stripslashes($datarray['author-name']), @@ -2291,6 +2295,7 @@ function local_delivery($importer,$data) { 'language' => $importer['language'], 'to_name' => $importer['username'], 'to_email' => $importer['email'], + 'uid' => $importer['importer_uid'], 'item' => $datarray, 'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, 'source_name' => stripslashes($datarray['author-name']), -- cgit v1.2.3 From 5734d5f357742814b56d3d8e0e6daf2e86e793d0 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 18 Feb 2012 03:18:20 -0800 Subject: change notify messages for web --- include/enotify.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/enotify.php b/include/enotify.php index ec26439dc..a8e6e3de6 100755 --- a/include/enotify.php +++ b/include/enotify.php @@ -28,7 +28,7 @@ function notification($params) { $subject = sprintf( t('New mail received at %s'),$sitename); $preamble = sprintf( t('%s sent you a new private message at %s.'),$params['source_name'],$sitename); - + $epreamble = sprintf( t('%s sent you a private message.'),'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]'); $sitelink = t('Please visit %s to view and/or reply to your private messages.'); $tsitelink = sprintf( $sitelink, $siteurl . '/message' ); $hsitelink = sprintf( $sitelink, '' . $sitename . ''); @@ -39,6 +39,8 @@ function notification($params) { $subject = sprintf( t('%s commented on an item at %s'), $params['source_name'], $sitename); $preamble = sprintf( t('%s commented on an item/conversation you have been following.'), $params['source_name']); + $epreamble = sprintf( t('%s commented on an item/conversation you have been following.'), '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]'); + $sitelink = t('Please visit %s to view and/or reply to the conversation.'); $tsitelink = sprintf( $sitelink, $siteurl ); $hsitelink = sprintf( $sitelink, '' . $sitename . ''); @@ -47,7 +49,8 @@ function notification($params) { if($params['type'] == NOTIFY_WALL) { $preamble = $subject = sprintf( t('%s posted to your profile wall at %s') , $params['source_name'], $sitename); - + $epreamble = sprintf( t('%s posted to your profile wall') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]'); + $sitelink = t('Please visit %s to view and/or reply to the conversation.'); $tsitelink = sprintf( $sitelink, $siteurl ); $hsitelink = sprintf( $sitelink, '' . $sitename . ''); @@ -56,6 +59,7 @@ function notification($params) { if($params['type'] == NOTIFY_TAGSELF) { $preamble = $subject = sprintf( t('%s tagged you at %s') , $params['source_name'], $sitename); + $epreamble = sprintf( t('%s tagged you') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]'); $sitelink = t('Please visit %s to view and/or reply to the conversation.'); $tsitelink = sprintf( $sitelink, $siteurl ); @@ -65,6 +69,7 @@ function notification($params) { if($params['type'] == NOTIFY_TAGSHARE) { $preamble = $subject = sprintf( t('%s tagged your post at %s') , $params['source_name'], $sitename); + $epreamble = sprintf( t('%s tagged your post') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]'); $sitelink = t('Please visit %s to view and/or reply to the conversation.'); $tsitelink = sprintf( $sitelink, $siteurl ); @@ -75,6 +80,7 @@ function notification($params) { 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); + $epreamble = sprintf( t('You\'ve received an introduction from %s'), '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]'); $body = sprintf( t('You may visit their profile at %s'),$params['source_link']); $sitelink = t('Please visit %s to approve or reject the introduction.'); @@ -86,6 +92,9 @@ function notification($params) { if($params['type'] == NOTIFY_SUGGEST) { $subject = sprintf( t('Friend suggestion received at %s'), $sitename); $preamble = sprintf( t('You\'ve received a friend suggestion from \'%s\' at %s'), $params['source_name'], $sitename); + $epreamble = sprintf( t('You\'ve received a friend suggestion for %s from %s'), + '[url=' . $params['item']['url'] . ']' . $params['item']['name'] . '[/url]', + '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]'); $body = t('Name:') . ' ' . $params['item']['name'] . "\n"; $body .= t('Photo:') . ' ' . $params['item']['photo'] . "\n"; $body .= sprintf( t('You may visit their profile at %s'),$params['item']['url']); @@ -114,7 +123,7 @@ function notification($params) { dbesc($params['source_link']), dbesc($params['source_photo']), dbesc(datetime_convert()), - dbesc($preamble), + dbesc($epreamble), intval($params['uid']), dbesc($itemlink), intval($params['type']), -- cgit v1.2.3 From 49179f9033e875034bbf97cae64b58a4f0871c7f Mon Sep 17 00:00:00 2001 From: Simon L'nu Date: Sun, 19 Feb 2012 05:17:26 -0500 Subject: add :headdesk and fix doc/Pages.md to remove the absolute URL to / Signed-off-by: Simon L'nu --- include/text.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/text.php b/include/text.php index 45881b9a6..b9813cfa9 100755 --- a/include/text.php +++ b/include/text.php @@ -716,6 +716,7 @@ function smilies($s, $sample = false) { ':homebrew', ':coffee', ':facepalm', + ':headdesk', '~friendika', '~friendica', 'Diaspora*' @@ -756,6 +757,7 @@ function smilies($s, $sample = false) { ':homebrew', ':coffee', ':facepalm', + ':headdesk', '~friendika ~friendika', '~friendica ~friendica', 'DiasporaDiaspora*', -- cgit v1.2.3