- $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]] : false;
-
- $prename = $preurl = $preid = '';
-
- 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 (!DBM::is_result($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])))
- );
- }
-
- if (!DBM::is_result($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]))
- );
- }
-
- if (DBM::is_result($r)) {
- $prename = $r[0]['name'];
- $preurl = $r[0]['url'];
- $preid = $r[0]['id'];
- $preselect = [$preid];
- } else {
- $preselect = false;
- }
- }
-
- $prefill = $preselect ? $prename : '';
-
- // 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, [
- '$header' => L10n::t('Send Private Message'),
- '$to' => L10n::t('To:'),
- '$showinputs' => 'true',
- '$prefill' => $prefill,
- '$autocomp' => $autocomp,
- '$preid' => $preid,
- '$subject' => L10n::t('Subject:'),
- '$subjtxt' => x($_REQUEST, 'subject') ? strip_tags($_REQUEST['subject']) : '',
- '$text' => x($_REQUEST, 'body') ? escape_tags(htmlspecialchars($_REQUEST['body'])) : '',
- '$readonly' => '',
- '$yourmessage' => L10n::t('Your message:'),
- '$select' => $select,
- '$parent' => '',
- '$upload' => L10n::t('Upload photo'),
- '$insert' => L10n::t('Insert web link'),
- '$wait' => L10n::t('Please wait'),
- '$submit' => L10n::t('Submit')
+ $recipientId = DI::args()->getArgv()[2] ?? null;
+
+ $select = ACL::getMessageContactSelectHTML($recipientId);
+
+ $tpl = Renderer::getMarkupTemplate('prv_message.tpl');
+ $o .= Renderer::replaceMacros($tpl, [
+ '$header' => DI::l10n()->t('Send Private Message'),
+ '$to' => DI::l10n()->t('To:'),
+ '$subject' => DI::l10n()->t('Subject:'),
+ '$subjtxt' => $_REQUEST['subject'] ?? '',
+ '$text' => $_REQUEST['body'] ?? '',
+ '$readonly' => '',
+ '$yourmessage'=> DI::l10n()->t('Your message:'),
+ '$select' => $select,
+ '$parent' => '',
+ '$upload' => DI::l10n()->t('Upload photo'),
+ '$insert' => DI::l10n()->t('Insert web link'),
+ '$wait' => DI::l10n()->t('Please wait'),
+ '$submit' => DI::l10n()->t('Submit')