private mail: if receiver is not in abook provide only his webbie to the form
This commit is contained in:
parent
ab59e41e1a
commit
c229223e01
43
mod/mail.php
43
mod/mail.php
@ -185,56 +185,41 @@ function mail_content(&$a) {
|
|||||||
|
|
||||||
$a->page['htmlhead'] .= $header;
|
$a->page['htmlhead'] .= $header;
|
||||||
|
|
||||||
$preselect = (isset($a->argv[2])?array($a->argv[2]):false);
|
$prename = '';
|
||||||
$prename = $preurl = $preid = '';
|
$preid = '';
|
||||||
|
|
||||||
if(x($_REQUEST,'hash')) {
|
if(x($_REQUEST,'hash')) {
|
||||||
|
|
||||||
$r = q("select abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash
|
$r = q("select abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash
|
||||||
where abook_channel = %d and abook_xchan = '%s' limit 1",
|
where abook_channel = %d and abook_xchan = '%s' limit 1",
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
dbesc($_REQUEST['hash'])
|
dbesc($_REQUEST['hash'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r) {
|
if(!$r) {
|
||||||
$prename = $r[0]['xchan_name'];
|
$r = q("select * from xchan where xchan_hash = '%s' and xchan_network = 'zot' limit 1",
|
||||||
$preurl = $r[0]['xchan_url'];
|
dbesc($_REQUEST['hash'])
|
||||||
$preid = $r[0]['abook_xchan'];
|
|
||||||
$preselect = array($preid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if($preselect) {
|
|
||||||
$r = q("select abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash
|
|
||||||
where abook_channel = %d and abook_id = %d limit 1",
|
|
||||||
intval(local_channel()),
|
|
||||||
intval(argv(2))
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
$prename = $r[0]['xchan_name'];
|
$prename = (($r[0]['abook_id']) ? $r[0]['xchan_name'] : $r[0]['xchan_addr']);
|
||||||
$preurl = $r[0]['xchan_url'];
|
$preurl = $r[0]['xchan_url'];
|
||||||
$preid = $r[0]['abook_xchan'];
|
$preid = (($r[0]['abook_id']) ? ($r[0]['xchan_hash']) : '');
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
notice( t('Requested channel is not in this network') . EOL );
|
||||||
}
|
}
|
||||||
|
|
||||||
$prefill = (($preselect) ? $prename : '');
|
|
||||||
|
|
||||||
if(! $prefill) {
|
|
||||||
if(array_key_exists('to',$_REQUEST))
|
|
||||||
$prefill = $_REQUEST['to'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// the ugly select box
|
|
||||||
|
|
||||||
//$select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10);
|
|
||||||
|
|
||||||
$tpl = get_markup_template('prv_message.tpl');
|
$tpl = get_markup_template('prv_message.tpl');
|
||||||
$o .= replace_macros($tpl,array(
|
$o .= replace_macros($tpl,array(
|
||||||
'$new' => true,
|
'$new' => true,
|
||||||
'$header' => t('Send Private Message'),
|
'$header' => t('Send Private Message'),
|
||||||
'$to' => t('To:'),
|
'$to' => t('To:'),
|
||||||
'$showinputs' => 'true',
|
'$showinputs' => 'true',
|
||||||
'$prefill' => $prefill,
|
'$prefill' => $prename,
|
||||||
'$autocomp' => $autocomp,
|
'$autocomp' => $autocomp,
|
||||||
'$preid' => $preid,
|
'$preid' => $preid,
|
||||||
'$subject' => t('Subject:'),
|
'$subject' => t('Subject:'),
|
||||||
@ -367,7 +352,7 @@ function mail_content(&$a) {
|
|||||||
'$subject' => t('Subject:'),
|
'$subject' => t('Subject:'),
|
||||||
'$subjtxt' => $message['title'],
|
'$subjtxt' => $message['title'],
|
||||||
'$readonly' => 'readonly="readonly"',
|
'$readonly' => 'readonly="readonly"',
|
||||||
'$yourmessage' => sprintf(t('Your message for %s'), $message[$recp]['xchan_name']),
|
'$yourmessage' => sprintf(t('Your message for %s (%s):'), $message[$recp]['xchan_name'], $message[$recp]['xchan_addr']),
|
||||||
'$text' => '',
|
'$text' => '',
|
||||||
'$select' => $select,
|
'$select' => $select,
|
||||||
'$parent' => $message['parent_mid'],
|
'$parent' => $message['parent_mid'],
|
||||||
|
Reference in New Issue
Block a user