From c9e5609cbfd89db35b536a22eb2ce6cbf7992783 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 25 Apr 2012 05:41:32 -0700 Subject: bug #307, explaining decentralised private photos is impossible. --- mod/message.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index 260f4bb14..dbca45930 100644 --- a/mod/message.php +++ b/mod/message.php @@ -313,6 +313,29 @@ function message_content(&$a) { $from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id']; $sparkle = ' sparkle'; } + + + $Text = $message['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/' . $message['contact-id'] + . '?f=1&url=' . '$1' . '][!#saved_image#!][/url]' ; + + $Text = preg_replace($search,$replace,$Text); + + if(strlen($saved_image)) + $message['body'] = str_replace('[!#saved_image#!]', '[img]' . $saved_image . '[/img]',$Text); + } + $mails[] = array( 'id' => $message['id'], 'from_name' => template_escape($message['from-name']), -- cgit v1.2.3 From 49ccefd6c7add622ba84c72769a68d08ef043ef5 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 5 May 2012 17:53:23 -0700 Subject: bad sql left after the mailbox in/out merge --- mod/message.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index dbca45930..aa8851e46 100644 --- a/mod/message.php +++ b/mod/message.php @@ -198,7 +198,7 @@ function message_content(&$a) { $o .= $header; $r = q("SELECT count(*) AS `total` FROM `mail` - WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `created` DESC", + WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC", intval(local_user()), dbesc($myprofile) ); -- cgit v1.2.3 From 851264161f1b0e638a818a0ebfa80feeb46dfa44 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 6 May 2012 19:55:39 -0700 Subject: mail autcomplete testing --- mod/message.php | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index aa8851e46..70b85b84c 100644 --- a/mod/message.php +++ b/mod/message.php @@ -4,20 +4,7 @@ require_once('include/acl_selectors.php'); require_once('include/message.php'); function message_init(&$a) { - $tabs = array( - /* - array( - 'label' => t('All'), - 'url'=> $a->get_baseurl(true) . '/message', - 'sel'=> ($a->argc == 1), - ), - array( - 'label' => t('Sent'), - 'url' => $a->get_baseurl(true) . '/message/sent', - 'sel'=> ($a->argv[1] == 'sent'), - ), - */ - ); + $tabs = array(); $new = array( 'label' => t('New Message'), 'url' => $a->get_baseurl(true) . '/message/new', @@ -29,6 +16,20 @@ function message_init(&$a) { '$tabs'=>$tabs, '$new'=>$new, )); + $base = $a->get_baseurl(); + + $a->page['htmlhead'] .= ''; + $a->page['htmlhead'] .= <<< EOT + + +EOT; } @@ -171,7 +172,9 @@ function message_content(&$a) { $preselect = (isset($a->argv[2])?array($a->argv[2]):false); - $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10); +// $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10); + $select = ''; + $tpl = get_markup_template('prv_message.tpl'); $o .= replace_macros($tpl,array( '$header' => t('Send Private Message'), -- cgit v1.2.3 From b74a776162b86b6257acf0406e7df4da236c8f09 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 6 May 2012 20:06:39 -0700 Subject: I'll leave the private mail recipient autocomplete partially done. Need a good UI/JS person to finish it off. --- mod/message.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index 70b85b84c..6fa128808 100644 --- a/mod/message.php +++ b/mod/message.php @@ -23,7 +23,7 @@ function message_init(&$a) { @@ -95,10 +99,6 @@ function message_content(&$a) { $myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname']; - - - - $tpl = get_markup_template('mail_head.tpl'); $header = replace_macros($tpl, array( '$messages' => t('Messages'), @@ -173,27 +173,34 @@ function message_content(&$a) { $preselect = (isset($a->argv[2])?array($a->argv[2]):false); - if(defined('EMAIL_AUTOCOMP')) { - // here's where we want to do contact autocomplete - // just figure out how to make it do the right thing - // pictures would be nice, but that didn't work when I tried. - // It sort of barely works, but needs help - // (the json backend is found in mod/acl.php) + $prename = $preurl = $preid = ''; - $select = ''; - } - else { + if($preselect) { + $r = q("select name, url, id from contact where uid = %d and id = %d limit 1", + intval(local_user()), + intval($a->argv[2]) + ); + if(count($r)) { + $prename = $r[0]['name']; + $preurl = $r[0]['url']; + $preid = $r[0]['id']; + } + } - // the ugly select box + $prefill = (($preselect) ? $prename . ' [' . $preurl . ']' : ''); - $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10); - } + // the ugly select box + + $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10); $tpl = get_markup_template('prv_message.tpl'); $o .= replace_macros($tpl,array( '$header' => t('Send Private Message'), '$to' => t('To:'), + '$prefill' => $prefill, + '$autocomp' => $autocomp, + '$preid' => $preid, '$subject' => t('Subject:'), '$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''), '$text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''), -- cgit v1.2.3 From 547007e1993a21347db327f5c030dd1dac60f28f Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 10 May 2012 19:29:01 -0700 Subject: add photos to PM autocomplete, improved appearance --- mod/message.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index 8cfa0256c..29a2fa253 100644 --- a/mod/message.php +++ b/mod/message.php @@ -18,7 +18,7 @@ function message_init(&$a) { )); $base = $a->get_baseurl(); - $a->page['htmlhead'] .= ''; + $a->page['htmlhead'] .= ''; $a->page['htmlhead'] .= <<< EOT