aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-12-13 16:34:08 -0800
committerzotlabs <mike@macgirvin.com>2016-12-13 16:34:08 -0800
commitc4a9b61da6a86ca58a850967a81d7e4b39a482f6 (patch)
treef9f8fc3b33a6444994a0a1cb55f7f3e057618a1a
parent23823811e9fcef166f961e5202bab56fc444dae0 (diff)
downloadvolse-hubzilla-c4a9b61da6a86ca58a850967a81d7e4b39a482f6.tar.gz
volse-hubzilla-c4a9b61da6a86ca58a850967a81d7e4b39a482f6.tar.bz2
volse-hubzilla-c4a9b61da6a86ca58a850967a81d7e4b39a482f6.zip
restructuring include/message for mail preview
-rw-r--r--include/message.php76
1 files changed, 44 insertions, 32 deletions
diff --git a/include/message.php b/include/message.php
index 7cbea3c6b..95d8d9720 100644
--- a/include/message.php
+++ b/include/message.php
@@ -8,7 +8,7 @@ require_once('include/attach.php');
// send a private message
-function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='',$expires = ''){
+function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $replyto = '', $expires = NULL_DATE) {
$ret = array('success' => false);
$is_reply = false;
@@ -16,6 +16,49 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$a = get_app();
$observer_hash = get_observer_hash();
+ if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",((strpos($body,'[/crypt]')) ? $_POST['media_str'] : $body),$match))
+ $attaches = $match[1];
+
+ $attachments = '';
+
+ if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
+ $attachments = array();
+ foreach($match[2] as $mtch) {
+ $hash = substr($mtch,0,strpos($mtch,','));
+ $rev = intval(substr($mtch,strpos($mtch,',')));
+ $r = attach_by_hash_nodata($hash,get_observer_hash(),$rev);
+ if($r['success']) {
+ $attachments[] = array(
+ 'href' => z_root() . '/attach/' . $r['data']['hash'],
+ 'length' => $r['data']['filesize'],
+ 'type' => $r['data']['filetype'],
+ 'title' => urlencode($r['data']['filename']),
+ 'revision' => $r['data']['revision']
+ );
+ }
+ $body = trim(str_replace($match[1],'',$body));
+ }
+ }
+
+ $jattach = (($attachments) ? json_encode($attachments) : '');
+
+
+ if($preview) {
+
+
+
+
+
+
+
+
+
+
+ }
+
+
+
+
if(! $recipient) {
$ret['message'] = t('No recipient provided.');
return $ret;
@@ -24,12 +67,6 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
if(! strlen($subject))
$subject = t('[no subject]');
-// if(! $expires)
-// $expires = NULL_DATE;
-// else
-// $expires = datetime_convert(date_default_timezone_get(),'UTC',$expires);
-
-
if($uid) {
$r = q("select * from channel where channel_id = %d limit 1",
intval($uid)
@@ -156,31 +193,6 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$match = false;
- if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",((strpos($body,'[/crypt]')) ? $_POST['media_str'] : $body),$match))
- $attaches = $match[1];
-
- $attachments = '';
-
- if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
- $attachments = array();
- foreach($match[2] as $mtch) {
- $hash = substr($mtch,0,strpos($mtch,','));
- $rev = intval(substr($mtch,strpos($mtch,',')));
- $r = attach_by_hash_nodata($hash,get_observer_hash(),$rev);
- if($r['success']) {
- $attachments[] = array(
- 'href' => z_root() . '/attach/' . $r['data']['hash'],
- 'length' => $r['data']['filesize'],
- 'type' => $r['data']['filetype'],
- 'title' => urlencode($r['data']['filename']),
- 'revision' => $r['data']['revision']
- );
- }
- $body = trim(str_replace($match[1],'',$body));
- }
- }
-
- $jattach = (($attachments) ? json_encode($attachments) : '');
if($subject)
$subject = str_rot47(base64url_encode($subject));