aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Dircensor.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2020-01-14 13:34:56 -0800
committerzotlabs <mike@macgirvin.com>2020-01-14 13:34:56 -0800
commit293d411efb28b8f20a0208e3c52883e9fbb8cea7 (patch)
treea8b0af66015815d56342daf8301ab5ae095eda0a /Zotlabs/Module/Dircensor.php
parent2a287e6def5ab54037222c963ab0875faf62fc1a (diff)
parentd96f4340e80207a29a5c1c49cae8c25e3934d5ae (diff)
downloadvolse-hubzilla-293d411efb28b8f20a0208e3c52883e9fbb8cea7.tar.gz
volse-hubzilla-293d411efb28b8f20a0208e3c52883e9fbb8cea7.tar.bz2
volse-hubzilla-293d411efb28b8f20a0208e3c52883e9fbb8cea7.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
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');
+
+ }
+
+}