Merge pull request #2544 from annando/issue-1769
Issue 1769: Some enhancements for sending wall mails
This commit is contained in:
commit
2d280f55ac
|
@ -246,10 +246,30 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
else
|
else
|
||||||
$subscribe_feed = false;
|
$subscribe_feed = false;
|
||||||
|
|
||||||
if(get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()))
|
if (remote_user() OR (get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()))) {
|
||||||
$wallmessage = t('Message');
|
$wallmessage = t('Message');
|
||||||
else
|
$wallmessage_link = "wallmessage/".$profile["nickname"];
|
||||||
|
|
||||||
|
if (remote_user()) {
|
||||||
|
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `id` = '%s' AND `rel` = %d",
|
||||||
|
intval($profile['uid']),
|
||||||
|
intval(remote_user()),
|
||||||
|
intval(CONTACT_IS_FRIEND));
|
||||||
|
} else {
|
||||||
|
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `rel` = %d",
|
||||||
|
intval($profile['uid']),
|
||||||
|
dbesc(normalise_link(get_my_url())),
|
||||||
|
intval(CONTACT_IS_FRIEND));
|
||||||
|
}
|
||||||
|
if ($r) {
|
||||||
|
$remote_url = $r[0]["url"];
|
||||||
|
$message_path = preg_replace("=(.*)/profile/(.*)=ism", "$1/message/new/", $remote_url);
|
||||||
|
$wallmessage_link = $message_path.base64_encode($profile["addr"]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$wallmessage = false;
|
$wallmessage = false;
|
||||||
|
$wallmessage_link = false;
|
||||||
|
}
|
||||||
|
|
||||||
// show edit profile to yourself
|
// show edit profile to yourself
|
||||||
if ($profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) {
|
if ($profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) {
|
||||||
|
@ -386,6 +406,7 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
'$remoteconnect' => $remoteconnect,
|
'$remoteconnect' => $remoteconnect,
|
||||||
'$subscribe_feed' => $subscribe_feed,
|
'$subscribe_feed' => $subscribe_feed,
|
||||||
'$wallmessage' => $wallmessage,
|
'$wallmessage' => $wallmessage,
|
||||||
|
'$wallmessage_link' => $wallmessage_link,
|
||||||
'$account_type' => $account_type,
|
'$account_type' => $account_type,
|
||||||
'$location' => $location,
|
'$location' => $location,
|
||||||
'$gender' => $gender,
|
'$gender' => $gender,
|
||||||
|
@ -400,7 +421,6 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
'$contact_block' => $contact_block,
|
'$contact_block' => $contact_block,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
$arr = array('profile' => &$profile, 'entry' => &$o);
|
$arr = array('profile' => &$profile, 'entry' => &$o);
|
||||||
|
|
||||||
call_hooks('profile_sidebar', $arr);
|
call_hooks('profile_sidebar', $arr);
|
||||||
|
|
|
@ -305,15 +305,29 @@ function message_content(&$a) {
|
||||||
$prename = $preurl = $preid = '';
|
$prename = $preurl = $preid = '';
|
||||||
|
|
||||||
if($preselect) {
|
if($preselect) {
|
||||||
$r = q("select name, url, id from contact where uid = %d and id = %d limit 1",
|
$r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
intval($a->argv[2])
|
intval($a->argv[2])
|
||||||
);
|
);
|
||||||
|
if(!$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(!$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(count($r)) {
|
if(count($r)) {
|
||||||
$prename = $r[0]['name'];
|
$prename = $r[0]['name'];
|
||||||
$preurl = $r[0]['url'];
|
$preurl = $r[0]['url'];
|
||||||
$preid = $r[0]['id'];
|
$preid = $r[0]['id'];
|
||||||
}
|
$preselect = array($preid);
|
||||||
|
} else
|
||||||
|
$preselect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$prefill = (($preselect) ? $prename : '');
|
$prefill = (($preselect) ? $prename : '');
|
||||||
|
@ -342,7 +356,6 @@ function message_content(&$a) {
|
||||||
'$wait' => t('Please wait'),
|
'$wait' => t('Please wait'),
|
||||||
'$submit' => t('Submit')
|
'$submit' => t('Submit')
|
||||||
));
|
));
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,9 +459,11 @@ function message_content(&$a) {
|
||||||
if($message['from-url'] == $myprofile) {
|
if($message['from-url'] == $myprofile) {
|
||||||
$from_url = $myprofile;
|
$from_url = $myprofile;
|
||||||
$sparkle = '';
|
$sparkle = '';
|
||||||
}
|
} elseif ($message['contact-id'] != 0) {
|
||||||
else {
|
$from_url = 'redir/'.$message['contact-id'];
|
||||||
$from_url = 'redir/' . $message['contact-id'];
|
$sparkle = ' sparkle';
|
||||||
|
} else {
|
||||||
|
$from_url = $message['from-url']."?zrl=".urlencode($myprofile);
|
||||||
$sparkle = ' sparkle';
|
$sparkle = ' sparkle';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,8 +477,7 @@ function message_content(&$a) {
|
||||||
$subject_e = template_escape($message['title']);
|
$subject_e = template_escape($message['title']);
|
||||||
$body_e = template_escape(Smilies::replace(bbcode($message['body'])));
|
$body_e = template_escape(Smilies::replace(bbcode($message['body'])));
|
||||||
$to_name_e = template_escape($message['name']);
|
$to_name_e = template_escape($message['name']);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$from_name_e = $message['from-name'];
|
$from_name_e = $message['from-name'];
|
||||||
$subject_e = $message['title'];
|
$subject_e = $message['title'];
|
||||||
$body_e = Smilies::replace(bbcode($message['body']));
|
$body_e = Smilies::replace(bbcode($message['body']));
|
||||||
|
|
|
@ -68,7 +68,7 @@ function wallmessage_post(&$a) {
|
||||||
info( t('Message sent.') . EOL );
|
info( t('Message sent.') . EOL );
|
||||||
}
|
}
|
||||||
|
|
||||||
// goaway($a->get_baseurl() . '/profile/' . $user['nickname']);
|
goaway('profile/'.$user['nickname']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $wallmessage}}
|
{{if $wallmessage}}
|
||||||
<li><a id="wallmessage-link" href="wallmessage/{{$profile.nickname}}">{{$wallmessage}}</a></li>
|
<li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $subscribe_feed}}
|
{{if $subscribe_feed}}
|
||||||
<li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
|
<li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<li><a id="dfrn-request-link" href="dfrn_request/{{$profile.nickname}}">{{$connect}}</a></li>
|
<li><a id="dfrn-request-link" href="dfrn_request/{{$profile.nickname}}">{{$connect}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $wallmessage}}
|
{{if $wallmessage}}
|
||||||
<li><a id="wallmessage-link" href="wallmessage/{{$profile.nickname}}">{{$wallmessage}}</a></li>
|
<li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $wallmessage}}
|
{{if $wallmessage}}
|
||||||
<li><a id="wallmessage-link" href="wallmessage/{{$profile.nickname}}">{{$wallmessage}}</a></li>
|
<li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $subscribe_feed}}
|
{{if $subscribe_feed}}
|
||||||
<li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
|
<li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $wallmessage}}
|
{{if $wallmessage}}
|
||||||
<div id="wallmessage-link-botton">
|
<div id="wallmessage-link-botton">
|
||||||
<a id="wallmessage-link" class="btn btn-labeled btn-primary btn-sm" onclick="addToModal('wallmessage/{{$profile.nickname}}')">
|
<a id="wallmessage-link" class="btn btn-labeled btn-primary btn-sm" onclick="addToModal('{{$wallmessage_link}}')">
|
||||||
<span class=""><i class="fa fa-envelope"></i></span>
|
<span class=""><i class="fa fa-envelope"></i></span>
|
||||||
<span class="">{{$wallmessage}}</span>
|
<span class="">{{$wallmessage}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<li><a id="dfrn-request-link" href="dfrn_request/{{$profile.nickname}}">{{$connect}}</a></li>
|
<li><a id="dfrn-request-link" href="dfrn_request/{{$profile.nickname}}">{{$connect}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $wallmessage}}
|
{{if $wallmessage}}
|
||||||
<li><a id="wallmessage-link" href="wallmessage/{{$profile.nickname}}">{{$wallmessage}}</a></li>
|
<li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<li><a id="dfrn-request-link" href="dfrn_request/{{$profile.nickname}}">{{$connect}}</a></li>
|
<li><a id="dfrn-request-link" href="dfrn_request/{{$profile.nickname}}">{{$connect}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $wallmessage}}
|
{{if $wallmessage}}
|
||||||
<li><a id="wallmessage-link" href="wallmessage/{{$profile.nickname}}">{{$wallmessage}}</a></li>
|
<li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $subscribe_feed}}
|
{{if $subscribe_feed}}
|
||||||
<li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
|
<li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $wallmessage}}
|
{{if $wallmessage}}
|
||||||
<li><a id="wallmessage-link" href="wallmessage/{{$profile.nickname}}">{{$wallmessage}}</a></li>
|
<li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $subscribe_feed}}
|
{{if $subscribe_feed}}
|
||||||
<li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
|
<li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $wallmessage}}
|
{{if $wallmessage}}
|
||||||
<li><a id="wallmessage-link" href="wallmessage/{{$profile.nickname}}">{{$wallmessage}}</a></li>
|
<li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $subscribe_feed}}
|
{{if $subscribe_feed}}
|
||||||
<li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
|
<li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
|
||||||
|
|
Loading…
Reference in a new issue