aboutsummaryrefslogtreecommitdiffstats
path: root/include/dir_fns.php
diff options
context:
space:
mode:
authorPaolo T <tuscanhobbit@users.noreply.github.com>2013-10-25 00:09:42 -0700
committerPaolo T <tuscanhobbit@users.noreply.github.com>2013-10-25 00:09:42 -0700
commitb23f3fc03b6bc751aab67fe2258a21f7c65bab8e (patch)
tree84c997aa781afa566536ca5f66eb8f90ef468476 /include/dir_fns.php
parentd30f718e0836a031e43d5403480aa049561e736e (diff)
parent0b0bd3c20765d267ec6d7cc261c7713917a22582 (diff)
downloadvolse-hubzilla-b23f3fc03b6bc751aab67fe2258a21f7c65bab8e.tar.gz
volse-hubzilla-b23f3fc03b6bc751aab67fe2258a21f7c65bab8e.tar.bz2
volse-hubzilla-b23f3fc03b6bc751aab67fe2258a21f7c65bab8e.zip
Merge pull request #3 from friendica/master
Align to main project HEAD
Diffstat (limited to 'include/dir_fns.php')
-rw-r--r--include/dir_fns.php28
1 files changed, 24 insertions, 4 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 585121434..e234ae0fa 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -3,9 +3,23 @@
require_once('include/permissions.php');
function find_upstream_directory($dirmode) {
+ $preferred = get_config('system','directory_server');
+ if($preferred)
+ return array('url' => $preferred);
return '';
}
+function dir_sort_links() {
+
+ $o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
+ '$header' => t('Sort Options'),
+ '$normal' => t('Alphabetic'),
+ '$reverse' => t('Reverse Alphabetic'),
+ '$date' => t('Newest to Oldest')
+ ));
+ return $o;
+}
+
function sync_directories($dirmode) {
@@ -71,7 +85,7 @@ function sync_directories($dirmode) {
if(is_array($t['flags']) && in_array('deleted',$t['flags']))
$ud_flags |= UPDATE_FLAGS_DELETED;
$z = q("insert into updates ( ud_hash, ud_guid, ud_date, ud_flags, ud_addr )
- values ( '%s', '%s', '%s', '%d, '%s' ) ",
+ values ( '%s', '%s', '%s', %d, '%s' ) ",
dbesc($t['hash']),
dbesc($t['transaction_id']),
dbesc($t['timestamp']),
@@ -89,18 +103,22 @@ function update_directory_entry($ud) {
logger('update_directory_entry: ' . print_r($ud,true), LOGGER_DATA);
if($ud['ud_addr'] && (! ($ud['ud_flags'] & UPDATE_FLAGS_DELETED))) {
+ $success = false;
$x = zot_finger($ud['ud_addr'],'');
if($x['success']) {
$j = json_decode($x['body'],true);
+ if($j)
+ $success = true;
$y = import_xchan($j,0);
}
- else {
+ if(! $success) {
$r = q("update updates set ud_last = '%s' where ud_addr = '%s'",
dbesc(datetime_convert()),
dbesc($ud['ud_addr'])
);
}
}
+
}
@@ -111,7 +129,7 @@ function syncdirs($uid) {
logger('syncdirs', LOGGER_DEBUG);
- $p = q("select channel.channel_hash, channel_timezone, profile.* from profile left join channel on channel_id = uid where uid = %d and is_default = 1",
+ $p = q("select channel.channel_hash, channel_address, channel_timezone, profile.* from profile left join channel on channel_id = uid where uid = %d and is_default = 1",
intval($uid)
);
@@ -182,6 +200,8 @@ function syncdirs($uid) {
}
}
- // TODO send refresh zots to downstream directory servers
+ $ud_hash = random_string();
+ update_modtime($ud_hash,$hash,$p[0]['channel_address'] . '@' . get_app()->get_hostname(),1);
+
}