diff options
Diffstat (limited to 'Zotlabs/Module/Dircensor.php')
-rw-r--r-- | Zotlabs/Module/Dircensor.php | 19 |
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'); |