aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-09-19 19:50:13 -0700
committerfriendica <info@friendica.com>2013-09-19 19:50:13 -0700
commit54abed8457c504e69e3d139238d2ff09b0ec6cc8 (patch)
treeac20175cdf23219c3d307d99fd37af00c802edb2 /include
parent9f237f7dba8f41fc243225d556a47164ee155635 (diff)
downloadvolse-hubzilla-54abed8457c504e69e3d139238d2ff09b0ec6cc8.tar.gz
volse-hubzilla-54abed8457c504e69e3d139238d2ff09b0ec6cc8.tar.bz2
volse-hubzilla-54abed8457c504e69e3d139238d2ff09b0ec6cc8.zip
provide a "safe search" backend and allow for self-censorship using nsfw or adult profile keywords. Eventually the directories will be forced to mark adult profiles and sync this knowledge between them. At the moment there's no way to do an unsafe search, but we really just need a checkbox and pass the value through directory to dirsearch on the back end, and some will want this as a pconfig.
Diffstat (limited to 'include')
-rwxr-xr-xinclude/text.php6
-rw-r--r--include/zot.php10
2 files changed, 16 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index e1f0a4e00..40df8bd89 100755
--- a/include/text.php
+++ b/include/text.php
@@ -1848,3 +1848,9 @@ function design_tools() {
}
+/* case insensitive in_array() */
+
+function in_arrayi($needle, $haystack) {
+ return in_array(strtolower($needle), array_map('strtolower', $haystack));
+}
+
diff --git a/include/zot.php b/include/zot.php
index c0b53bdc1..3929fa4c1 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1404,6 +1404,16 @@ function import_directory_profile($hash,$profile) {
$arr['xprof_keywords'] = implode(' ',$clean);
+ // Self censored, make it so
+ // These are not translated, so the German "erwachsenen" keyword will not censor the directory profile. Only the English form - "adult".
+
+ if(in_arrayi('nsfw',$clean) || in_arrayi('adult',$clean)) {
+ q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s' limit 1",
+ intval(XCHAN_FLAGS_CENSORED)
+ );
+ }
+
+
$r = q("select * from xprof where xprof_hash = '%s' limit 1",
dbesc($hash)
);