aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/dir_fns.php18
-rw-r--r--mod/directory.php5
-rw-r--r--view/tpl/safesearch.tpl2
3 files changed, 24 insertions, 1 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index e234ae0fa..319be25c4 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -20,7 +20,25 @@ function dir_sort_links() {
return $o;
}
+function dir_safe_mode(&$a) {
+ $observer = get_observer_hash();
+
+// if ($observer)
+ $safe_mode = get_xconfig($observer,'directory','safe_mode');
+ if($safe_mode == 0)
+ $toggle = t('Enable Safe Search');
+ else
+ $toggle = t('Disable Safe Search');
+ $o = replace_macros(get_markup_template('safesearch.tpl'), array(
+ '$toggle' => $toggle,
+ ));
+
+ return $o;
+}
+if($safe_mode == 1)
+ set_xconfig($observer,'directory','safe_mode', '0');
+
function sync_directories($dirmode) {
if($dirmode == DIRECTORY_MODE_STANDALONE || $dirmode == DIRECTORY_MODE_NORMAL)
diff --git a/mod/directory.php b/mod/directory.php
index 18085e83e..61a40f8d4 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -14,8 +14,9 @@ function directory_aside(&$a) {
require_once('include/contact_widgets.php');
$a->set_widget('find_people',findpeople_widget());
}
+ $a->set_widget('safe_search',dir_safe_mode());
$a->set_widget('dir_sort_order',dir_sort_links());
-
+
}
@@ -93,7 +94,9 @@ function directory_content(&$a) {
$numtags = get_config('system','directorytags');
$kw = ((intval($numtags)) ? $numtags : 24);
+// $query = $url . '?f=&kw=' . $kw . (($safe_mode != 1) ? '&safe=' . $safe_mode : '');
$query = $url . '?f=&kw=' . $kw . (($safe_mode != 1) ? '&safe=' . $safe_mode : '');
+logger('query: ' . $query);
if($search)
$query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search);
if(strpos($search,'@'))
diff --git a/view/tpl/safesearch.tpl b/view/tpl/safesearch.tpl
new file mode 100644
index 000000000..92c3db2a5
--- /dev/null
+++ b/view/tpl/safesearch.tpl
@@ -0,0 +1,2 @@
+<h1>Safe Mode</h1>
+<a href="toggle_safesearch">{{$toggle}}</a>