aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-12-26 19:39:37 -0800
committerfriendica <info@friendica.com>2012-12-26 19:39:37 -0800
commita2c6f8c965a70caf26d4f4df846a8eb665e57d54 (patch)
treeb326c6805c1fe2c995f51762e9040150b2081719 /include
parentd80f299dd426a4f20ce25d1798184ca7de27a8b3 (diff)
downloadvolse-hubzilla-a2c6f8c965a70caf26d4f4df846a8eb665e57d54.tar.gz
volse-hubzilla-a2c6f8c965a70caf26d4f4df846a8eb665e57d54.tar.bz2
volse-hubzilla-a2c6f8c965a70caf26d4f4df846a8eb665e57d54.zip
master/standalone directory profile update
Diffstat (limited to 'include')
-rw-r--r--include/dir_fns.php51
-rw-r--r--include/directory.php2
-rw-r--r--include/zot.php1
3 files changed, 53 insertions, 1 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 683ed9e5b..2ed9b0280 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -1,6 +1,57 @@
<?php
+require_once('include/permissions.php');
+
function find_upstream_directory($dirmode) {
return '';
}
+function syncdirs($uid) {
+
+ $p = q("select channel.channel_hash, profile.* from profile left join channel on channel_id = uid where uid = %d and is_default = 1",
+ intval($uid)
+ );
+
+ $profile = array();
+
+ if($p) {
+ $hash = $p[0]['channel_hash'];
+
+ $profile['description'] = $p[0]['pdesc'];
+ $profile['birthday'] = $p[0]['dob'];
+ $profile['gender'] = $p[0]['gender'];
+ $profile['marital'] = $p[0]['marital'];
+ $profile['sexual'] = $p[0]['sexual'];
+ $profile['locale'] = $p[0]['locality'];
+ $profile['region'] = $p[0]['region'];
+ $profile['postcode'] = $p[0]['postal_code'];
+ $profile['country'] = $p[0]['country_name'];
+ if($p[0]['keywords']) {
+ $tags = array();
+ $k = explode(' ',$p[0]['keywords']);
+ if($k)
+ foreach($k as $kk)
+ if(trim($kk))
+ $tags[] = trim($kk);
+ if($tags)
+ $profile['keywords'] = $tags;
+ }
+
+ if(perm_is_allowed($uid,'','view_profile')) {
+ import_directory_profile($hash,$profile);
+
+ }
+ else {
+ // they may have made it private
+ $r = q("delete from xprof where xprof_hash = '%s' limit 1",
+ dbesc($hash)
+ );
+ $r = q("delete from xtag where xtag_hash = '%s'",
+ dbesc($hash)
+ );
+ }
+ }
+
+ // TODO send refresh zots to downstream directory servers
+}
+
diff --git a/include/directory.php b/include/directory.php
index 105686ca7..d1862cb57 100644
--- a/include/directory.php
+++ b/include/directory.php
@@ -17,7 +17,7 @@ function directory_run($argv, $argc){
$dirmode = DIRECTORY_MODE_NORMAL;
if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
- // syncdirs();
+ syncdirs($argv[1]);
return;
}
diff --git a/include/zot.php b/include/zot.php
index f4568fc2f..4d3817a4f 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1055,6 +1055,7 @@ function import_directory_profile($hash,$profile) {
dbesc($arr['xprof_country'])
);
}
+
return;
}