From b5d0315d55b6488d9493dd49bd35a2fe1b1492c7 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 26 Mar 2012 17:57:27 -0700 Subject: preparation for some possibly killer features --- mod/message.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index 0907abd77..8991f643d 100755 --- a/mod/message.php +++ b/mod/message.php @@ -15,6 +15,13 @@ function message_post(&$a) { $body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : ''); $recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 ); + // Work around doubled linefeeds in Tinymce 3.5b2 + + $plaintext = intval(get_pconfig(local_user(),'system','plaintext')); + if(! $plaintext) { + $body = str_replace("\r\n","\n",$body); + $body = str_replace("\n\n","\n",$body); + } $ret = send_message($recipient, $body, $subject, $replyto); $norecip = false; -- cgit v1.2.3 From 50711040cbf3686f427e5ad8d0582674ef45a12b Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 28 Mar 2012 15:31:58 +0200 Subject: message: remove tabs, move new message link to aside, all message with gmail-style --- mod/message.php | 115 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 74 insertions(+), 41 deletions(-) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index 8991f643d..949e5616c 100755 --- a/mod/message.php +++ b/mod/message.php @@ -3,6 +3,35 @@ 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'), + ), + */ + ); + $new = array( + 'label' => t('New Message'), + 'url' => $a->get_baseurl(true) . '/message/new', + 'sel'=> ($a->argv[1] == 'new'), + ); + + $tpl = get_markup_template('message_side.tpl'); + $a->page['aside'] = replace_macros($tpl, array( + '$tabs'=>$tabs, + '$new'=>$new, + )); + +} + function message_post(&$a) { if(! local_user()) { @@ -66,25 +95,7 @@ function message_content(&$a) { $myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname']; - $tabs = array( - array( - 'label' => t('Inbox'), - 'url'=> $a->get_baseurl(true) . '/message', - 'sel'=> (($a->argc == 1) ? 'active' : ''), - ), - array( - 'label' => t('Outbox'), - 'url' => $a->get_baseurl(true) . '/message/sent', - 'sel'=> (($a->argv[1] == 'sent') ? 'active' : ''), - ), - array( - 'label' => t('New Message'), - 'url' => $a->get_baseurl(true) . '/message/new', - 'sel'=> (($a->argv[1] == 'new') ? 'active' : ''), - ), - ); - $tpl = get_markup_template('common_tabs.tpl'); - $tab_content = replace_macros($tpl, array('$tabs'=>$tabs)); + $tpl = get_markup_template('mail_head.tpl'); @@ -186,9 +197,9 @@ function message_content(&$a) { $o .= $header; if($a->argc == 2) - $eq = '='; // I'm not going to bother escaping this. + $eq = sprintf( "AND `from-url` = '%s'", dbesc($myprofile)); else - $eq = '!='; // or this. + $eq = ''; $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", @@ -199,11 +210,12 @@ function message_content(&$a) { $a->set_pager_total($r[0]['total']); $r = q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`, - `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network` + `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`, + count( * ) as count FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` - WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", + WHERE `mail`.`uid` = %d $eq GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", intval(local_user()), - dbesc($myprofile), + // intval($a->pager['start']), intval($a->pager['itemspage']) ); @@ -214,9 +226,15 @@ function message_content(&$a) { $tpl = get_markup_template('mail_list.tpl'); foreach($r as $rr) { + if ($rr['from-url'] == $myprofile){ + $partecipants = sprintf( t("You and %s"), $rr['name']); + } else { + $partecipants = sprintf( t("%s and You"), $rr['from-name']); + } + $o .= replace_macros($tpl, array( '$id' => $rr['id'], - '$from_name' =>$rr['from-name'], + '$from_name' => $partecipants, '$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl(true) . '/redir/' . $rr['contact-id'] : $rr['url']), '$sparkle' => ' sparkle', '$from_photo' => $rr['thumb'], @@ -224,7 +242,9 @@ function message_content(&$a) { '$delete' => t('Delete conversation'), '$body' => template_escape($rr['body']), '$to_name' => template_escape($rr['name']), - '$date' => datetime_convert('UTC',date_default_timezone_get(),$rr['mailcreated'], t('D, d M Y - g:i A')) + '$date' => datetime_convert('UTC',date_default_timezone_get(),$rr['mailcreated'], t('D, d M Y - g:i A')), + '$seen' => $rr['mailseen'], + '$count' => sprintf( tt('%d message', '%d messages', $rr['count']), $rr['count']), )); } $o .= paginate($a); @@ -278,7 +298,8 @@ function message_content(&$a) { )); - $tpl = get_markup_template('mail_conv.tpl'); + $mails = array(); + $seen = 0; foreach($messages as $message) { if($message['from-url'] == $myprofile) { $from_url = $myprofile; @@ -288,24 +309,35 @@ function message_content(&$a) { $from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id']; $sparkle = ' sparkle'; } - $o .= replace_macros($tpl, array( - '$id' => $message['id'], - '$from_name' => template_escape($message['from-name']), - '$from_url' => $from_url, - '$sparkle' => $sparkle, - '$from_photo' => $message['from-photo'], - '$subject' => template_escape($message['title']), - '$body' => template_escape(smilies(bbcode($message['body']))), - '$delete' => t('Delete message'), - '$to_name' => template_escape($message['name']), - '$date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A') - )); + $mails[] = array( + 'id' => $message['id'], + 'from_name' => template_escape($message['from-name']), + 'from_url' => $from_url, + 'sparkle' => $sparkle, + 'from_photo' => $message['from-photo'], + 'subject' => template_escape($message['title']), + 'body' => template_escape(smilies(bbcode($message['body']))), + 'delete' => t('Delete message'), + 'to_name' => template_escape($message['name']), + 'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'), + ); + $seen = $message['seen']; } $select = $message['name'] . ''; $parent = ''; - $tpl = get_markup_template('prv_message.tpl'); - $o .= replace_macros($tpl,array( + + + $tpl = get_markup_template('mail_display.tpl'); + $o = replace_macros($tpl, array( + '$thread_id' => $a->argv[1], + '$thread_subject' => $message['title'], + '$thread_seen' => $seen, + '$delete' => t('Delete conversation'), + + '$mails' => $mails, + + // reply '$header' => t('Send Reply'), '$to' => t('To:'), '$subject' => t('Subject:'), @@ -318,6 +350,7 @@ function message_content(&$a) { '$upload' => t('Upload photo'), '$insert' => t('Insert web link'), '$wait' => t('Please wait') + )); return $o; -- cgit v1.2.3 From ea10bba14711d26dfbefcd83659bb60ae6587e26 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 31 Mar 2012 20:08:32 -0700 Subject: fix "between yourself and You" in mail list --- mod/message.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index 949e5616c..c347468d1 100755 --- a/mod/message.php +++ b/mod/message.php @@ -192,15 +192,12 @@ function message_content(&$a) { return $o; } - if(($a->argc == 1) || ($a->argc == 2 && $a->argv[1] === 'sent')) { + if($a->argc == 1) { + + // list messages $o .= $header; - if($a->argc == 2) - $eq = sprintf( "AND `from-url` = '%s'", dbesc($myprofile)); - else - $eq = ''; - $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", intval(local_user()), @@ -213,7 +210,7 @@ function message_content(&$a) { `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`, count( * ) as count FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` - WHERE `mail`.`uid` = %d $eq GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", + WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", intval(local_user()), // intval($a->pager['start']), @@ -226,7 +223,7 @@ function message_content(&$a) { $tpl = get_markup_template('mail_list.tpl'); foreach($r as $rr) { - if ($rr['from-url'] == $myprofile){ + if (link_compare($rr['from-url'],$myprofile)){ $partecipants = sprintf( t("You and %s"), $rr['name']); } else { $partecipants = sprintf( t("%s and You"), $rr['from-name']); -- cgit v1.2.3 From 5c2fdc795fc5273176a7f81d989ad06e16945f1c Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 1 Apr 2012 00:59:35 -0700 Subject: send unverified private mail using zrl --- mod/message.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index c347468d1..1369fde2e 100755 --- a/mod/message.php +++ b/mod/message.php @@ -223,9 +223,13 @@ function message_content(&$a) { $tpl = get_markup_template('mail_list.tpl'); foreach($r as $rr) { - if (link_compare($rr['from-url'],$myprofile)){ + if($rr['unknown']) { + $partecipants = sprintf( t("Unknown sender - %s"),$rr['from-name']); + } + elseif (link_compare($rr['from-url'],$myprofile)){ $partecipants = sprintf( t("You and %s"), $rr['name']); - } else { + } + else { $partecipants = sprintf( t("%s and You"), $rr['from-name']); } @@ -234,7 +238,7 @@ function message_content(&$a) { '$from_name' => $partecipants, '$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl(true) . '/redir/' . $rr['contact-id'] : $rr['url']), '$sparkle' => ' sparkle', - '$from_photo' => $rr['thumb'], + '$from_photo' => (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']), '$subject' => template_escape((($rr['mailseen']) ? $rr['title'] : '' . $rr['title'] . '')), '$delete' => t('Delete conversation'), '$body' => template_escape($rr['body']), @@ -297,7 +301,11 @@ function message_content(&$a) { $mails = array(); $seen = 0; + $unknown = false; + foreach($messages as $message) { + if($message['unknown']) + $unknown = true; if($message['from-url'] == $myprofile) { $from_url = $myprofile; $sparkle = ''; @@ -323,7 +331,7 @@ function message_content(&$a) { } $select = $message['name'] . ''; $parent = ''; - + $tpl = get_markup_template('mail_display.tpl'); $o = replace_macros($tpl, array( @@ -331,7 +339,8 @@ function message_content(&$a) { '$thread_subject' => $message['title'], '$thread_seen' => $seen, '$delete' => t('Delete conversation'), - + '$canreply' => (($unknown) ? false : '1'), + '$unknown_text' => t("No secure communications available. You may be able to respond from the sender's profile page."), '$mails' => $mails, // reply -- cgit v1.2.3