aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Dircensor.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-11-05 08:46:42 +0000
committerMario <mario@mariovavti.com>2020-11-05 08:46:42 +0000
commitbafbf0416462c6f18c3fb6c8c06a063c8d6fdae6 (patch)
tree8929845be585b09d0f420621281c5531e1efad3e /Zotlabs/Module/Dircensor.php
parent6f93d9848c43019d43ea76c27d42d657ba031cd7 (diff)
parentfdefa101d84dc2a9424eaedbdb003a4c30ec5d01 (diff)
downloadvolse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.tar.gz
volse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.tar.bz2
volse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.zip
Merge branch '5.0RC'5.0
Diffstat (limited to 'Zotlabs/Module/Dircensor.php')
-rw-r--r--Zotlabs/Module/Dircensor.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/Zotlabs/Module/Dircensor.php b/Zotlabs/Module/Dircensor.php
new file mode 100644
index 000000000..0fa65e948
--- /dev/null
+++ b/Zotlabs/Module/Dircensor.php
@@ -0,0 +1,52 @@
+<?php
+
+namespace Zotlabs\Module;
+
+use App;
+use Zotlabs\Web\Controller;
+
+
+class Dircensor extends Controller {
+
+ function get() {
+ if(! is_site_admin()) {
+ return;
+ }
+
+ $dirmode = intval(get_config('system','directory_mode'));
+
+ if (! ($dirmode == DIRECTORY_MODE_PRIMARY || $dirmode == DIRECTORY_MODE_STANDALONE)) {
+ return;
+ }
+
+ $xchan = argv(1);
+ if(! $xchan) {
+ return;
+ }
+
+ $r = q("select * from xchan where xchan_hash = '%s'",
+ dbesc($xchan)
+ );
+
+ if(! $r) {
+ return;
+ }
+
+ $val = (($r[0]['xchan_censored']) ? 0 : 1);
+
+ q("update xchan set xchan_censored = $val where xchan_hash = '%s'",
+ dbesc($xchan)
+ );
+
+ if($val) {
+ info( t('Entry censored') . EOL);
+ }
+ else {
+ info( t('Entry uncensored') . EOL);
+ }
+
+ goaway(z_root() . '/directory');
+
+ }
+
+}