mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-31 04:13:49 +01:00
8chan: allow users to opt out of public ban system
This commit is contained in:
parent
143db01fb9
commit
3a48cbc790
17
inc/bans.php
17
inc/bans.php
@ -155,14 +155,27 @@ class Bans {
|
||||
}
|
||||
|
||||
static public function stream_json($out = false, $filter_ips = false, $filter_staff = false, $board_access = false) {
|
||||
global $config;
|
||||
global $config, $pdo;
|
||||
|
||||
|
||||
if ($board_access && $board_access[0] == '*') $board_access = false;
|
||||
|
||||
$query_addition = "";
|
||||
if ($board_access !== FALSE) {
|
||||
$query_addition .= "WHERE `public_bans` OR `public_bans` IS NULL";
|
||||
}
|
||||
if ($board_access) {
|
||||
$boards = implode(", ", array_map(array($pdo, "quote"), $board_access));
|
||||
$query_addition .= " OR `board` IN (".$boards.")";
|
||||
}
|
||||
|
||||
$query = query("SELECT ``bans``.*, `username`, `type` FROM ``bans``
|
||||
LEFT JOIN ``mods`` ON ``mods``.`id` = `creator`
|
||||
LEFT JOIN ``boards`` ON ``boards``.`uri` = ``bans``.`board`
|
||||
$query_addition
|
||||
ORDER BY `created` DESC") or error(db_error());
|
||||
$bans = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($board_access && $board_access[0] == '*') $board_access = false;
|
||||
|
||||
$out ? fputs($out, "[") : print("[");
|
||||
|
||||
|
@ -311,11 +311,12 @@ OEKAKI;
|
||||
if (!(strlen($subtitle) < 200))
|
||||
error('Invalid subtitle');
|
||||
|
||||
$query = prepare('UPDATE ``boards`` SET `title` = :title, `subtitle` = :subtitle, `indexed` = :indexed WHERE `uri` = :uri');
|
||||
$query = prepare('UPDATE ``boards`` SET `title` = :title, `subtitle` = :subtitle, `indexed` = :indexed, `public_bans` = :public_bans WHERE `uri` = :uri');
|
||||
$query->bindValue(':title', $title);
|
||||
$query->bindValue(':subtitle', $subtitle);
|
||||
$query->bindValue(':uri', $b);
|
||||
$query->bindValue(':indexed', !isset($_POST['meta_noindex']));
|
||||
$query->bindValue(':public_bans', isset($_POST['public_bans']));
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
|
||||
@ -367,6 +368,8 @@ EOT;
|
||||
|
||||
openBoard($b);
|
||||
|
||||
rebuildThemes('bans');
|
||||
|
||||
if ($config['cache']['enabled'])
|
||||
cache::delete('board_' . $board['uri']);
|
||||
cache::delete('all_boards');
|
||||
|
@ -32,7 +32,8 @@
|
||||
<tr><th>Poster ID's</th><td><input type="checkbox" name="poster_ids" {% if config.poster_ids %}checked{% endif %}></td></tr>
|
||||
<tr><th>Display SAGE! after saged posts</th><td><input type="checkbox" name="show_sages" {% if config.show_sages %}checked{% endif %}></td></tr>
|
||||
<tr><th>Automatically convert ... to …</th><td><input type="checkbox" name="auto_unicode" {% if config.auto_unicode %}checked{% endif %}></td></tr>
|
||||
<tr><th>No index<br><span class="unimportant">Hide from boards index<br/>and do not index in search engines</span></th><td><input type="checkbox" name="meta_noindex" {% if config.meta_noindex %}checked{% endif %}></td></tr>
|
||||
<tr><th>No index<br><span class="unimportant">Hide from boards index<br/>and do not index in search engines</span></th><td><input type="checkbox" name="meta_noindex" {% if not board_indexed %}checked{% endif %}></td></tr>
|
||||
<tr><th>Public bans<br><span class="unimportant">Displays your bans for the public</span></th><td><input type="checkbox" name="public_bans" {% if board.public_bans %}checked{% endif %}></td></tr>
|
||||
<tr><th>[code] tags</th><td><input type="checkbox" name="code_tags" {% if 'js/code_tags/run_prettify.js' in config.additional_javascript %}checked{% endif %}></td></tr>
|
||||
<tr><th>Oekaki</th><td><input type="checkbox" name="oekaki" {% if 'js/wpaint.js' in config.additional_javascript %}checked{% endif %}></td></tr>
|
||||
<tr><th>Format math between $$</th><td><input type="checkbox" name="katex" {% if config.katex %}checked{% endif %}></td></tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user