X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fmessage.php;h=d0a583967b047c3a61a6261f5dd10f9f6657693c;hb=761bdafa34bfdf1b2b43a3f06ae092e0925898ac;hp=61af60530249c1df6b8e8d8658ccc392f407661c;hpb=4f2ae8868431952bd3acda1537ee899740cbf205;p=friendica.git diff --git a/mod/message.php b/mod/message.php index 61af605302..d0a583967b 100644 --- a/mod/message.php +++ b/mod/message.php @@ -11,10 +11,10 @@ use Friendica\Core\ACL; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Mail; use Friendica\Util\DateTimeFormat; +use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Temporal; require_once 'include/conversation.php'; @@ -92,7 +92,7 @@ function message_post(App $a) $a->argc = 2; $a->argv[1] = 'new'; } else { - goaway($_SESSION['return_url']); + goaway($a->cmd . '/' . $ret); } } @@ -109,8 +109,23 @@ function message_content(App $a) $myprofile = System::baseUrl() . '/profile/' . $a->user['nickname']; $tpl = get_markup_template('mail_head.tpl'); + if ($a->argc > 1 && $a->argv[1] == 'new') { + $button = [ + 'label' => L10n::t('Discard'), + 'url' => '/message', + 'sel' => 'close', + ]; + } else { + $button = [ + 'label' => L10n::t('New Message'), + 'url' => '/message/new', + 'sel' => 'new', + 'accesskey' => 'm', + ]; + } $header = replace_macros($tpl, [ '$messages' => L10n::t('Messages'), + '$button' => $button, ]); if (($a->argc == 3) && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) { @@ -161,7 +176,7 @@ function message_content(App $a) intval($a->argv[2]), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::isResult($r)) { $parent = $r[0]['parent-uri']; $convid = $r[0]['convid']; @@ -200,21 +215,21 @@ function message_content(App $a) intval(local_user()), intval($a->argv[2]) ); - if (!DBM::is_result($r)) { + if (!DBA::isResult($r)) { $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1", intval(local_user()), - dbesc(normalise_link(base64_decode($a->argv[2]))) + DBA::escape(normalise_link(base64_decode($a->argv[2]))) ); } - if (!DBM::is_result($r)) { + if (!DBA::isResult($r)) { $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1", intval(local_user()), - dbesc(base64_decode($a->argv[2])) + DBA::escape(base64_decode($a->argv[2])) ); } - if (DBM::is_result($r)) { + if (DBA::isResult($r)) { $prename = $r[0]['name']; $preurl = $r[0]['url']; $preid = $r[0]['id']; @@ -265,13 +280,13 @@ function message_content(App $a) intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::isResult($r)) { $a->set_pager_total($r[0]['total']); } $r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']); - if (!DBM::is_result($r)) { + if (!DBA::isResult($r)) { info(L10n::t('No messages.') . EOL); return $o; } @@ -293,14 +308,14 @@ function message_content(App $a) intval(local_user()), intval($a->argv[1]) ); - if (DBM::is_result($r)) { + if (DBA::isResult($r)) { $contact_id = $r[0]['contact-id']; $convid = $r[0]['convid']; - $sql_extra = sprintf(" and `mail`.`parent-uri` = '%s' ", dbesc($r[0]['parent-uri'])); + $sql_extra = sprintf(" and `mail`.`parent-uri` = '%s' ", DBA::escape($r[0]['parent-uri'])); if ($convid) $sql_extra = sprintf(" and ( `mail`.`parent-uri` = '%s' OR `mail`.`convid` = '%d' ) ", - dbesc($r[0]['parent-uri']), + DBA::escape($r[0]['parent-uri']), intval($convid) ); @@ -312,13 +327,13 @@ function message_content(App $a) } else { $messages = false; } - if (!DBM::is_result($messages)) { + if (!DBA::isResult($messages)) { notice(L10n::t('Message not available.') . EOL); return $o; } $r = q("UPDATE `mail` SET `seen` = 1 WHERE `parent-uri` = '%s' AND `uid` = %d", - dbesc($r[0]['parent-uri']), + DBA::escape($r[0]['parent-uri']), intval(local_user()) ); @@ -374,7 +389,7 @@ function message_content(App $a) 'from_url' => $from_url, 'from_addr' => $contact['addr'], 'sparkle' => $sparkle, - 'from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB), + 'from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB), 'subject' => $subject_e, 'body' => $body_e, 'delete' => L10n::t('Delete message'), @@ -473,9 +488,9 @@ function render_messages(array $msg, $t) '$id' => $rr['id'], '$from_name' => $participants, '$from_url' => Contact::magicLink($rr['url']), - '$from_addr' => $contact['addr'], + '$from_addr' => defaults($contact, 'addr', ''), '$sparkle' => ' sparkle', - '$from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB), + '$from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB), '$subject' => $subject_e, '$delete' => L10n::t('Delete conversation'), '$body' => $body_e,