aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Dircensor.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2023-04-26 23:01:56 +0200
committerMario Vavti <mario@mariovavti.com>2023-04-26 23:01:56 +0200
commitbdb25315b6f01f1963b21f6e0c0bd5ec2959c62e (patch)
treee530ef64610ff7f978c36c4fe7a636c8f478c456 /Zotlabs/Module/Dircensor.php
parent60f0739c3e8158bdcb373c3607ef2e8e8fcb4e08 (diff)
downloadvolse-hubzilla-bdb25315b6f01f1963b21f6e0c0bd5ec2959c62e.tar.gz
volse-hubzilla-bdb25315b6f01f1963b21f6e0c0bd5ec2959c62e.tar.bz2
volse-hubzilla-bdb25315b6f01f1963b21f6e0c0bd5ec2959c62e.zip
initial commit for directory flags federation
Diffstat (limited to 'Zotlabs/Module/Dircensor.php')
-rw-r--r--Zotlabs/Module/Dircensor.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/Zotlabs/Module/Dircensor.php b/Zotlabs/Module/Dircensor.php
index 309b14346..90759e58d 100644
--- a/Zotlabs/Module/Dircensor.php
+++ b/Zotlabs/Module/Dircensor.php
@@ -4,6 +4,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
+use Zotlabs\Lib\Libzotdir;
class Dircensor extends Controller {
@@ -20,6 +21,7 @@ class Dircensor extends Controller {
}
$xchan = argv(1);
+
if(! $xchan) {
return;
}
@@ -33,25 +35,28 @@ class Dircensor extends Controller {
}
$severity = intval($_REQUEST['severity'] ?? 0);
+ $flag = DIRECTORY_FLAG_OK;
- if ($severity < 0) {
- $severity = 0;
+ if ($severity === 1) {
+ $flag = DIRECTORY_FLAG_UNSAFE;
}
- if ($severity > 2) {
- $severity = 2;
+ if ($severity === 2) {
+ $flag = DIRECTORY_FLAG_HIDDEN;
}
+hz_syslog('flag: '. print_r($flag, true));
+ Libzotdir::update($xchan, $r[0]['xchan_url'], true, $flag);
q("update xchan set xchan_censored = %d where xchan_hash = '%s'",
- intval($severity),
+ intval($flag),
dbesc($xchan)
);
- if($severity) {
+ if($flag) {
info( t('Entry censored') . EOL);
}
else {
- info( t('Entry uncensored') . EOL);
+ info( t('Entry OK') . EOL);
}
goaway(z_root() . '/directory');