aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-24 16:36:27 -0800
committerfriendica <info@friendica.com>2015-02-24 16:36:27 -0800
commit08f054130f5a57e2928e129131e7609271ec7f40 (patch)
treee4eb2166044c05f750c78fc30742835ae5294f44 /include
parent11df605c2e065e123e58bd73525e7ca2113f40b8 (diff)
downloadvolse-hubzilla-08f054130f5a57e2928e129131e7609271ec7f40.tar.gz
volse-hubzilla-08f054130f5a57e2928e129131e7609271ec7f40.tar.bz2
volse-hubzilla-08f054130f5a57e2928e129131e7609271ec7f40.zip
require access token to view, query, or join directories in private realms, if the realm is so configured.
Diffstat (limited to 'include')
-rw-r--r--include/dir_fns.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 686c5140f..37a7c04e7 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -48,7 +48,7 @@ function check_upstream_directory() {
if($directory) {
$h = parse_url($directory);
if($h) {
- $x = zot_finger('sys@' . $h['host']);
+ $x = zot_finger('[system]@' . $h['host']);
if($x['success']) {
$j = json_decode($x['body'],true);
if(array_key_exists('site',$j) && array_key_exists('directory_mode',$j['site'])) {
@@ -166,20 +166,23 @@ function sync_directories($dirmode) {
// FIXME - what to do if we're in a different realm?
if((! $r) && (z_root() != DIRECTORY_FALLBACK_MASTER)) {
- $r = array(
+ $r = array();
+ $r[] = array(
'site_url' => DIRECTORY_FALLBACK_MASTER,
'site_flags' => DIRECTORY_MODE_PRIMARY,
'site_update' => NULL_DATE,
'site_directory' => DIRECTORY_FALLBACK_MASTER . '/dirsearch',
- 'site_realm' => DIRECTORY_REALM
+ 'site_realm' => DIRECTORY_REALM,
+ 'site_valid' => 1
);
- $x = q("insert into site ( site_url, site_flags, site_update, site_directory, site_realm )
+ $x = q("insert into site ( site_url, site_flags, site_update, site_directory, site_realm, site_valid )
values ( '%s', %d', '%s', '%s', '%s' ) ",
dbesc($r[0]['site_url']),
intval($r[0]['site_flags']),
dbesc($r[0]['site_update']),
dbesc($r[0]['site_directory']),
- dbesc($r[0]['site_realm'])
+ dbesc($r[0]['site_realm']),
+ intval($r[0]['site_valid'])
);
$r = q("select * from site where (site_flags & %d) > 0 and site_url != '%s'",
@@ -201,8 +204,11 @@ function sync_directories($dirmode) {
// It will take about a month for a new directory to obtain the full current repertoire of channels.
// FIXME - go back and pick up earlier ratings if this is a new directory server. These do not get refreshed.
+ $token = get_config('system','realm_token');
+
+
$syncdate = (($rr['site_sync'] === NULL_DATE) ? datetime_convert('UTC','UTC','now - 2 days') : $rr['site_sync']);
- $x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($syncdate));
+ $x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($syncdate) . (($token) ? '&t=' . $token : ''));
if(! $x['success'])
continue;