diff options
author | Mario <mario@mariovavti.com> | 2023-05-17 13:28:23 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-05-17 13:28:23 +0000 |
commit | 65d98af24c3c7b784f7e2c95998df65901011ce3 (patch) | |
tree | d7d6a60698d7a0c3704ea55cb71c543285186b17 /Zotlabs/Module/Dircensor.php | |
parent | a57739c462a7991bf2130e8eca0c383eb276f0cd (diff) | |
parent | 62d35627f35537d0056482047e74a27ad837c3cf (diff) | |
download | volse-hubzilla-65d98af24c3c7b784f7e2c95998df65901011ce3.tar.gz volse-hubzilla-65d98af24c3c7b784f7e2c95998df65901011ce3.tar.bz2 volse-hubzilla-65d98af24c3c7b784f7e2c95998df65901011ce3.zip |
Merge branch '8.4RC'8.4
Diffstat (limited to 'Zotlabs/Module/Dircensor.php')
-rw-r--r-- | Zotlabs/Module/Dircensor.php | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/Zotlabs/Module/Dircensor.php b/Zotlabs/Module/Dircensor.php index 0fa65e948..4ce3a81c4 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 { @@ -15,11 +16,12 @@ class Dircensor extends Controller { $dirmode = intval(get_config('system','directory_mode')); - if (! ($dirmode == DIRECTORY_MODE_PRIMARY || $dirmode == DIRECTORY_MODE_STANDALONE)) { + if(!in_array($dirmode, [DIRECTORY_MODE_PRIMARY, DIRECTORY_MODE_SECONDARY, DIRECTORY_MODE_STANDALONE])) { return; } $xchan = argv(1); + if(! $xchan) { return; } @@ -32,19 +34,43 @@ class Dircensor extends Controller { return; } - $val = (($r[0]['xchan_censored']) ? 0 : 1); + $severity = intval($_REQUEST['severity'] ?? 0); + $flag = DIRECTORY_FLAG_OK; + + if ($severity === 1) { + $flag = DIRECTORY_FLAG_UNSAFE; + } + + if ($severity === 2) { + $flag = DIRECTORY_FLAG_HIDDEN; + } + + Libzotdir::update($xchan, $r[0]['xchan_url'], true, $flag); - q("update xchan set xchan_censored = $val where xchan_hash = '%s'", + q("UPDATE xchan SET xchan_censored = %d WHERE xchan_hash = '%s'", + intval($flag), dbesc($xchan) ); - if($val) { + q("UPDATE xtag SET xtag_flags = %d WHERE xtag_hash = '%s'", + intval($flag), + dbesc($xchan) + ); + + if($flag) { info( t('Entry censored') . EOL); } else { - info( t('Entry uncensored') . EOL); + info( t('Entry OK') . EOL); } - + + if (isset($_REQUEST['aj'])) { + json_return_and_die([ + 'success' => 1, + 'flag' => $flag + ]); + } + goaway(z_root() . '/directory'); } |