]> git.mxchange.org Git - friendica.git/commitdiff
The global contact for server users is now stored directly
authorMichael Vogel <icarus@dabo.de>
Thu, 5 May 2016 10:02:51 +0000 (12:02 +0200)
committerMichael Vogel <icarus@dabo.de>
Thu, 5 May 2016 10:02:51 +0000 (12:02 +0200)
include/dfrn.php
mod/noscrape.php
mod/profiles.php
mod/settings.php

index daa1aae25c8bad2aba9144ac73194cad73b7748f..f1b325b5719c6b27fc94ecb59fc646cd8d8c8de4 100644 (file)
@@ -492,12 +492,12 @@ class dfrn {
 
                // Is the profile hidden or shouldn't be published in the net? Then add the "hide" element
                $r = q("SELECT `id` FROM `profile` INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
-                               WHERE `hidewall` OR NOT `net-publish` AND `user`.`uid` = %d",
+                               WHERE (`hidewall` OR NOT `net-publish`) AND `user`.`uid` = %d",
                        intval($owner['uid']));
                if ($r)
                        xml::add_element($doc, $author, "dfrn:hide", "true");
 
-               // The following fields will only be generated if this isn't for a public feed
+               // The following fields will only be generated if the data isn't meant for a public feed
                if ($public)
                        return $author;
 
index 42931cf382bbab2319ce1b21c23443879300e523..2a04605469b845745755b2bce39eb3a5f9472972 100644 (file)
@@ -15,11 +15,11 @@ function noscrape_init(&$a) {
 
        profile_load($a,$which,$profile);
 
-       if(!$a->profile['net-publish']) {
+       if (!$a->profile['net-publish'] OR $a->profile['hidewall']) {
                header('Content-type: application/json; charset=utf-8');
                $json_info = array("hide" => true);
                echo json_encode($json_info);
-               killme();
+               exit;
        }
 
        $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
index 39382fbdd5b6c14b671289b60680151c51531776..4ab35455ce564c24699adfd684895ec084370ad7 100644 (file)
@@ -484,7 +484,7 @@ function profiles_post(&$a) {
                if($is_default) {
                        $location = formatted_location(array("locality" => $locality, "region" => $region, "country-name" => $country_name));
 
-                       $r = q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` = 1 AND `uid` = %d",
+                       q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
                                dbesc($about),
                                dbesc($location),
                                dbesc($pub_keywords),
@@ -492,6 +492,17 @@ function profiles_post(&$a) {
                                intval(local_user())
                        );
 
+                       $r = q("SELECT `avatar`, `notify`, `url` FROM `contact` WHERE `self` AND `uid` = %d",
+                               intval(local_user()));
+
+                       $gcontact = array("name" => $name, "location" => $location, "about" => $about,
+                                       "gender" => $gender, "keywords" => $pub_keywords, "birthday" => $dob,
+                                       "photo" => $r[0]["avatar"], "notify" => $r[0]["notify"],
+                                       "generation" => 1, "network" => NETWORK_DFRN,
+                                       "url" => $r[0]["url"], "updated" => datetime_convert());
+
+                       update_gcontact($gcontact);
+
                        // Update global directory in background
                        $url = $_SESSION['my_url'];
                        if($url && strlen(get_config('system','directory')))
index 1a7905ef6455a9fe45809c01c72cc675b02e95cb..682bee3756e647c6521c732c725f7103005de65e 100644 (file)
@@ -620,9 +620,12 @@ function settings_post(&$a) {
 
        $r = q("SELECT `url` FROM `contact` WHERE `self` AND `uid` = %d", intval(local_user()));
        if ($r) {
+               $nickname = $a->user['nickname'];
+               $addr = $nickname.'@'.str_replace(array("http://", "https://"), "", App::get_baseurl());
                $gcontact = array("name" => $username, "generation" => 1, "hide" => ($hidewall OR !$net_publish),
+                               "nick" => $nickname, "addr" => $addr,
+                               "connect" => $addr, "server_url" => App::get_baseurl(),
                                "network" => NETWORK_DFRN, "url" => $r[0]["url"], "updated" => datetime_convert());
-
                update_gcontact($gcontact);
        }
 
@@ -637,7 +640,7 @@ function settings_post(&$a) {
 
        }
 
-       goaway('settings' );
+       goaway('settings');
        return; // NOTREACHED
 }
 
@@ -1287,7 +1290,7 @@ function settings_content(&$a) {
                '$notify7'  => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
                '$notify8'  => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''),
 
-        '$desktop_notifications' => array('desktop_notifications', t('Activate desktop notifications') , false, t('Show desktop popup on new notifications')),
+               '$desktop_notifications' => array('desktop_notifications', t('Activate desktop notifications') , false, t('Show desktop popup on new notifications')),
 
                '$email_textonly' => array('email_textonly', t('Text-only notification emails'),
                                                                        get_pconfig(local_user(),'system','email_textonly'),