diff options
author | Paolo T <tuscanhobbit@users.noreply.github.com> | 2015-03-22 16:34:40 +0100 |
---|---|---|
committer | Paolo T <tuscanhobbit@users.noreply.github.com> | 2015-03-22 16:34:40 +0100 |
commit | 82fb1ca0caaae72b77b641d22e51d5ae1b188183 (patch) | |
tree | a2ecee4e65bc80300c62b5b327965b8118117ad3 /mod/directory.php | |
parent | ff5c3b009fa25e87e294cd458d3de4b677270c64 (diff) | |
parent | e345d6793d5f6910dd230f661ca5d1a837b1b504 (diff) | |
download | volse-hubzilla-82fb1ca0caaae72b77b641d22e51d5ae1b188183.tar.gz volse-hubzilla-82fb1ca0caaae72b77b641d22e51d5ae1b188183.tar.bz2 volse-hubzilla-82fb1ca0caaae72b77b641d22e51d5ae1b188183.zip |
Merge pull request #8 from friendica/master
merging red master into nuvola.red
Diffstat (limited to 'mod/directory.php')
-rw-r--r-- | mod/directory.php | 61 |
1 files changed, 40 insertions, 21 deletions
diff --git a/mod/directory.php b/mod/directory.php index 329e255cf..274584862 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -14,6 +14,31 @@ function directory_init(&$a) { dbesc($_GET['ignore']) ); } + + $observer = get_observer_hash(); + $global_changed = false; + $safe_changed = false; + + if(array_key_exists('global',$_REQUEST)) { + $globaldir = intval($_REQUEST['global']); + $global_changed = true; + } + if($global_changed) { + $_SESSION['globaldir'] = $globaldir; + if($observer) + set_xconfig($observer,'directory','globaldir',$globaldir); + } + + if(array_key_exists('safe',$_REQUEST)) { + $safemode = intval($_REQUEST['safe']); + $safe_changed = true; + } + if($safe_changed) { + $_SESSION['safemode'] = $safemode; + if($observer) + set_xconfig($observer,'directory','safe_mode',$safemode); + } + } function directory_content(&$a) { @@ -23,24 +48,16 @@ function directory_content(&$a) { return; } - $safe_mode = 1; - $observer = get_observer_hash(); - - if($observer) { - $safe_mode = get_xconfig($observer,'directory','safe_mode'); - } - if($safe_mode === false) - $safe_mode = 1; - else - $safe_mode = intval($safe_mode); - if(x($_REQUEST,'safe')) - $safe_mode = (intval($_REQUEST['safe'])); + $globaldir = get_globaldir_setting($observer); + $safe_mode = get_safemode_setting($observer); $pubforums = null; if(array_key_exists('pubforums',$_REQUEST)) $pubforums = intval($_REQUEST['pubforums']); + if(! $pubforums) + $pubforums = null; $o = ''; nav_set_selected('directory'); @@ -92,6 +109,9 @@ function directory_content(&$a) { $url = $directory['url'] . '/dirsearch'; } + $token = get_config('system','realm_token'); + + logger('mod_directory: URL = ' . $url, LOGGER_DEBUG); $contacts = array(); @@ -106,16 +126,20 @@ function directory_content(&$a) { } } - - if($url) { // We might want to make the tagadelic count (&kw=) configurable or turn it off completely. $numtags = get_config('system','directorytags'); - $kw = ((intval($numtags)) ? $numtags : 24); + $kw = ((intval($numtags)) ? $numtags : 50); $query = $url . '?f=&kw=' . $kw . (($safe_mode != 1) ? '&safe=' . $safe_mode : ''); + if($token) + $query .= '&t=' . $token; + + if(! $globaldir) + $query .= '&hub=' . get_app()->get_hostname(); + if($search) $query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search); if(strpos($search,'@')) @@ -127,15 +151,10 @@ function directory_content(&$a) { if(! is_null($pubforums)) $query .= '&pubforums=' . intval($pubforums); - if(! is_null($pubforums)) - $query .= '&pubforums=' . intval($pubforums); - - $sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : 'normal'); + $sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : 'date'); if($sort_order) $query .= '&order=' . urlencode($sort_order); - - if($a->pager['page'] != 1) $query .= '&p=' . $a->pager['page']; |