use Friendica\App;
use Friendica\Content\Nav;
+use Friendica\Content\Pager;
use Friendica\Content\Smilies;
use Friendica\Content\Text\BBCode;
use Friendica\Core\ACL;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Mail;
+use Friendica\Module\Login;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Temporal;
'$baseurl' => System::baseUrl(true),
'$base' => $base
]);
-
- $end_tpl = get_markup_template('message-end.tpl');
- $a->page['end'] .= replace_macros($end_tpl, [
- '$baseurl' => System::baseUrl(true),
- '$base' => $base
- ]);
}
function message_post(App $a)
$a->argc = 2;
$a->argv[1] = 'new';
} else {
- goaway($a->cmd . '/' . $ret);
+ $a->internalRedirect($a->cmd . '/' . $ret);
}
}
if (!local_user()) {
notice(L10n::t('Permission denied.') . EOL);
- return;
+ return Login::form();
}
$myprofile = System::baseUrl() . '/profile/' . $a->user['nickname'];
// Now check how the user responded to the confirmation query
if (!empty($_REQUEST['canceled'])) {
- goaway($_SESSION['return_url']);
+ $a->internalRedirect('message');
}
$cmd = $a->argv[1];
if ($cmd === 'drop') {
+ $message = DBA::selectFirst('mail', ['convid'], ['id' => $a->argv[2], 'uid' => local_user()]);
+ if(!DBA::isResult($message)){
+ info(L10n::t('Conversation not found.') . EOL);
+ $a->internalRedirect('message');
+ }
+
if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
info(L10n::t('Message deleted.') . EOL);
}
- //goaway(System::baseUrl(true) . '/message' );
- goaway($_SESSION['return_url']);
+ $conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
+ if(!DBA::isResult($conversation)){
+ info(L10n::t('Conversation removed.') . EOL);
+ $a->internalRedirect('message');
+ }
+
+ $a->internalRedirect('message/' . $conversation['id'] );
} else {
$r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[2]),
info(L10n::t('Conversation removed.') . EOL);
}
}
- //goaway(System::baseUrl(true) . '/message' );
- goaway($_SESSION['return_url']);
+ $a->internalRedirect('message');
}
}
'$linkurl' => L10n::t('Please enter a link URL:')
]);
- $tpl = get_markup_template('msg-end.tpl');
- $a->page['end'] .= replace_macros($tpl, [
- '$baseurl' => System::baseUrl(true),
- '$nickname' => $a->user['nickname'],
- '$linkurl' => L10n::t('Please enter a link URL:')
- ]);
-
$preselect = isset($a->argv[2]) ? [$a->argv[2]] : [];
$prename = $preurl = $preid = '';
}
- $_SESSION['return_url'] = $a->query_string;
+ $_SESSION['return_path'] = $a->query_string;
if ($a->argc == 1) {
$o .= $header;
+ $total = 0;
$r = q("SELECT count(*) AS `total`, ANY_VALUE(`created`) AS `created` FROM `mail`
WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC",
intval(local_user())
);
-
if (DBA::isResult($r)) {
- $a->set_pager_total($r[0]['total']);
+ $total = $r[0]['total'];
}
- $r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);
+ $pager = new Pager($a->query_string, $total);
+
+ $r = get_messages(local_user(), $pager->getStart(), $pager->getItemsPerPage());
if (!DBA::isResult($r)) {
info(L10n::t('No messages.') . EOL);
$o .= render_messages($r, 'mail_list.tpl');
- $o .= paginate($a);
+ $o .= $pager->renderFull();
return $o;
}
'$linkurl' => L10n::t('Please enter a link URL:')
]);
- $tpl = get_markup_template('msg-end.tpl');
- $a->page['end'] .= replace_macros($tpl, [
- '$baseurl' => System::baseUrl(true),
- '$nickname' => $a->user['nickname'],
- '$linkurl' => L10n::t('Please enter a link URL:')
- ]);
-
$mails = [];
$seen = 0;
$unknown = false;
'$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' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB),
'$subject' => $subject_e,