major cleanup of directory options

This commit is contained in:
friendica
2015-03-05 23:31:01 -08:00
parent bd4d2f3b44
commit f6da235a7d
5 changed files with 42 additions and 53 deletions

View File

@@ -80,6 +80,8 @@ function dir_sort_links() {
if ($observer)
$safe_mode = get_xconfig($observer,'directory','safe_mode');
else
$safe_mode = ((array_key_exists('safemode',$_SESSION)) ? intval($_SESSION['safemode']) : false);
if($safe_mode === false)
$safe_mode = 1;
@@ -96,7 +98,7 @@ function dir_sort_links() {
// Build urls without order and pubforums so it's easy to tack on the changed value
// Probably there's an easier way to do this
$current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : 'normal');
$current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : 'date');
$url = 'directory?f=';
$tmp = array_merge($_GET,$_POST);
@@ -107,6 +109,8 @@ function dir_sort_links() {
$tmp = array_merge($_GET,$_POST);
unset($tmp['pubforums']);
unset($tmp['global']);
unset($tmp['safe']);
unset($tmp['q']);
unset($tmp['f']);
$forumsurl = $url . http_build_query($tmp);
@@ -125,7 +129,10 @@ function dir_sort_links() {
'$forumsurl' => $forumsurl,
'$safemode' => t('Safe Mode'),
'$toggle' => $toggle,
'$globaldir' => $globaldir,
'$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'','',' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''),
'$pubforums' => array('pubforums', t('Public Forums Only'),(x($_REQUEST,'pubforums') ? $_REQUEST['pubforums'] : ''),'','',' onchange=\'window.location.href="' . $forumsurl . '&pubforums="+(this.checked ? 1 : 0)\''),
'$globaldir' => array('globaldir', t('This Website Only'), 1-intval($globaldir),'','',' onchange=\'window.location.href="' . $forumsurl . '&global="+(this.checked ? 0 : 1)\''),
'$localdir' => t('This Website Only'),
));
return $o;