aboutsummaryrefslogtreecommitdiffstats
path: root/include/dir_fns.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/dir_fns.php')
-rw-r--r--include/dir_fns.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 585121434..adbcb6e3c 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,12 +103,15 @@ 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'])