diff options
author | Thomas Willingham <founder@kakste.com> | 2012-12-19 19:54:18 +0000 |
---|---|---|
committer | Thomas Willingham <founder@kakste.com> | 2012-12-19 19:54:18 +0000 |
commit | a2b30f9411f537d9eb15d697970d682869c76a0e (patch) | |
tree | b96702d7ece5d564aaf00cdd950270b0b67ac3e6 /include/directory.php | |
parent | 2cfd1a3f085e44d4513fd969bb01be74a59d5784 (diff) | |
parent | 44e70bdca367344c441b1e26e790ac0465953734 (diff) | |
download | volse-hubzilla-a2b30f9411f537d9eb15d697970d682869c76a0e.tar.gz volse-hubzilla-a2b30f9411f537d9eb15d697970d682869c76a0e.tar.bz2 volse-hubzilla-a2b30f9411f537d9eb15d697970d682869c76a0e.zip |
Merge remote-tracking branch 'upstream/master'
Conflicts:
view/tpl/nav.tpl
Diffstat (limited to 'include/directory.php')
-rw-r--r-- | include/directory.php | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/include/directory.php b/include/directory.php index f35cb4cb4..5b5698768 100644 --- a/include/directory.php +++ b/include/directory.php @@ -1,27 +1,56 @@ <?php require_once('boot.php'); +require_once('include/zot.php'); require_once('include/cli_startup.php'); +function find_upstream_directory($dirmode) { + return; +} + function directory_run($argv, $argc){ cli_startup(); - if(argc() != 2) + if($argc != 2) return; - $dir = get_config('system','directory_submit_url'); + $dirmode = get_config('system','directory_mode'); + if($dirmode === false) + $dirmode = DIRECTORY_MODE_NORMAL; - if(! strlen($dir)) + if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) { + // syncdirs(); return; + } - $arr = array('url' => argv(1)); + $x = q("select * from channel where channel_id = %d limit 1", + intval($argv[1]) + ); + if(! $x) + return; - call_hooks('globaldir_update', $arr); + $channel = $x[0]; - if(strlen($arr['url'])) - fetch_url($dir . '?url=' . bin2hex($arr['url'])); + // is channel profile visible to the public? + // FIXME - remove dir entry if permission is revoked + + if(! perm_is_allowed($channel['channel_id'],null,'view_profile')) + return; + + $directory = find_upstream_directory($dirmode); + + if($directory) { + $url = $directory['url']; + } + else { + $url = DIRECTORY_FALLBACK_MASTER . '/post'; + } + + $packet = zot_build_packet($channel,'refresh'); + $z = zot_zot($url,$packet); + + // re-queue if unsuccessful - return; } if (array_search(__file__,get_included_files())===0){ |