]> git.mxchange.org Git - friendica.git/commitdiff
Wall message can now redirect to your own page if you are connected.
authorMichael Vogel <icarus@dabo.de>
Sun, 29 May 2016 19:29:26 +0000 (21:29 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 29 May 2016 19:29:26 +0000 (21:29 +0200)
include/identity.php
mod/message.php
view/templates/profile_vcard.tpl
view/theme/vier/templates/profile_vcard.tpl

index 888a09ee6ff88c945384a278a1a0c2b4af3f6dc8..3e1d831d5bc55f333f4af90b62abf4aa7b8992ff 100644 (file)
@@ -246,10 +246,23 @@ function profile_sidebar($profile, $block = 0) {
        else
                $subscribe_feed = false;
 
-       if(get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()))
+       if(get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user())) {
                $wallmessage = t('Message');
-       else
+
+               $r = q("SELECT `id` 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) {
+                       $message_path = preg_replace("=(.*)/profile/(.*)=ism", "$1/message/new/", get_my_url());
+                       $wallmessage_link = $message_path.base64_encode(get_my_url());
+               } else
+                       $wallmessage_link = "wallmessage/".$profile["nickname"];
+
+       } else {
                $wallmessage = false;
+               $wallmessage_link = false;
+       }
 
        // show edit profile to yourself
        if ($profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) {
@@ -386,6 +399,7 @@ function profile_sidebar($profile, $block = 0) {
                '$remoteconnect'  => $remoteconnect,
                '$subscribe_feed' => $subscribe_feed,
                '$wallmessage' => $wallmessage,
+               '$wallmessage_link' => $wallmessage_link,
                '$account_type' => $account_type,
                '$location' => $location,
                '$gender'   => $gender,
@@ -400,7 +414,6 @@ function profile_sidebar($profile, $block = 0) {
                '$contact_block' => $contact_block,
        ));
 
-
        $arr = array('profile' => &$profile, 'entry' => &$o);
 
        call_hooks('profile_sidebar', $arr);
index 2d194ed244618e29df2534d6490f8f3e6beda526..f0ab7d2ac907683519cfa1bd1a7bb1d12a8089bf 100644 (file)
@@ -305,15 +305,29 @@ function message_content(&$a) {
                $prename = $preurl = $preid = '';
 
                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($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)) {
                                $prename = $r[0]['name'];
                                $preurl = $r[0]['url'];
                                $preid = $r[0]['id'];
-                       }
+                               $preselect = array($preid);
+                       } else
+                               $preselect = false;
                }
 
                $prefill = (($preselect) ? $prename  : '');
@@ -342,7 +356,6 @@ function message_content(&$a) {
                        '$wait' => t('Please wait'),
                        '$submit' => t('Submit')
                ));
-
                return $o;
        }
 
index 0a3a13f9dc633ece2959c9f64518bdd9acb22635..0f1cf070c4fcbb07999c8deaaa5cbe569ba6041a 100644 (file)
@@ -54,7 +54,7 @@
                                {{/if}}
                        {{/if}}
                        {{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 $subscribe_feed}}
                                <li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>
index a3b08947d0502382530f1277c185e727b2b88971..2d7c72f8c89db2596e8ea2db7a5533249652dada 100644 (file)
@@ -65,7 +65,7 @@
                                {{/if}}
                        {{/if}}
                        {{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 $subscribe_feed}}
                                <li><a id="subscribe-feed-link" href="dfrn_poll/{{$profile.nickname}}">{{$subscribe_feed}}</a></li>