mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-25 16:00:22 +01:00
[#184] Added config+functionality for removing clean status local+global if a post is edited. Fixed an issue where marking a post clean wouldn't trigger template reconstruction.
This commit is contained in:
parent
9c5ec12aaa
commit
bac2307140
@ -1382,8 +1382,15 @@
|
||||
$config['mod']['flood'] = &$config['mod']['bypass_filters'];
|
||||
// Raw HTML posting
|
||||
$config['mod']['rawhtml'] = ADMIN;
|
||||
// Clean/Unclean posts
|
||||
|
||||
// Clean System
|
||||
// Post edits remove local clean?
|
||||
$config['clean']['edits_remove_local'] = true;
|
||||
// Post edits remove global clean?
|
||||
$config['clean']['edits_remove_global'] = true;
|
||||
// Mark post clean for board rule
|
||||
$config['mod']['clean'] = JANITOR;
|
||||
// Mark post clean for global rule
|
||||
$config['mod']['clean_global'] = MOD;
|
||||
|
||||
/* Administration */
|
||||
|
@ -1606,6 +1606,35 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
|
||||
}
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
if( $config['clean']['edits_remove_local'] || $config['clean']['edits_remove_global'] ) {
|
||||
|
||||
$query_global = "`clean_global` = :clean";
|
||||
$query_global_mod = "`clean_global_mod_id` = :mod";
|
||||
$query_local = "`clean_local` = :clean";
|
||||
$query_local_mod = "`clean_local_mod_id` = :mod";
|
||||
|
||||
if( $config['clean']['edits_remove_local'] && $config['clean']['edits_remove_global'] ) {
|
||||
$query = prepare("UPDATE `post_clean` SET {$query_global}, {$query_global_mod}, {$query_local}, {$query_local_mod} WHERE `board_id` = :board AND `post_id` = :post");
|
||||
}
|
||||
else if( $config['clean']['edits_remove_global'] ) {
|
||||
$query = prepare("UPDATE `post_clean` SET {$query_global}, {$query_global_mod} WHERE `board_id` = :board AND `post_id` = :post");
|
||||
}
|
||||
else {
|
||||
$query = prepare("UPDATE `post_clean` SET {$query_local}, {$query_local_mod} WHERE `board_id` = :board AND `post_id` = :post");
|
||||
}
|
||||
|
||||
$query->bindValue( ':clean', false );
|
||||
$query->bindValue( ':mod', NULL );
|
||||
$query->bindValue( ':board', $board );
|
||||
$query->bindValue( ':post', $postID );
|
||||
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
// Finally, run a query to tidy up our records.
|
||||
$cleanup = prepare("DELETE FROM `post_clean` WHERE `clean_local` = FALSE AND `clean_global` = FALSE");
|
||||
$query->execute() or error(db_error($query));
|
||||
}
|
||||
|
||||
if ($edit_raw_html) {
|
||||
modLog("Edited raw HTML of post #{$postID}");
|
||||
} else {
|
||||
@ -2958,6 +2987,8 @@ function mod_report_clean( $global_reports, $board, $unclean, $post, $global, $l
|
||||
$log_action = ($unclean ? "Closed" : "Re-opened" );
|
||||
$log_scope = ($local && $global ? "local and global" : ($local ? "local" : "global" ) );
|
||||
modLog( "{$log_action} reports for post #{$post} in {$log_scope}.", $board);
|
||||
|
||||
rebuildPost( $post );
|
||||
}
|
||||
|
||||
// Redirect
|
||||
|
Loading…
Reference in New Issue
Block a user