From 3b06ee0d381dc1be5f40ca98ad4278046d869d21 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:57:39 +0100 Subject: checked in initial customized verison for Archlinux32 --- admin_censoring.php | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 admin_censoring.php (limited to 'admin_censoring.php') diff --git a/admin_censoring.php b/admin_censoring.php new file mode 100644 index 0000000..94a4f0a --- /dev/null +++ b/admin_censoring.php @@ -0,0 +1,168 @@ +query('INSERT INTO '.$db->prefix.'censoring (search_for, replace_with) VALUES (\''.$db->escape($search_for).'\', \''.$db->escape($replace_with).'\')') or error('Unable to add censor word', __FILE__, __LINE__, $db->error()); + + // Regenerate the censoring cache + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) + require PUN_ROOT.'include/cache.php'; + + generate_censoring_cache(); + + redirect('admin_censoring.php', $lang_admin_censoring['Word added redirect']); +} + +// Update a censor word +else if (isset($_POST['update'])) +{ + confirm_referrer('admin_censoring.php'); + + $id = intval(key($_POST['update'])); + + $search_for = pun_trim($_POST['search_for'][$id]); + $replace_with = pun_trim($_POST['replace_with'][$id]); + + if ($search_for == '') + message($lang_admin_censoring['Must enter word message']); + + $db->query('UPDATE '.$db->prefix.'censoring SET search_for=\''.$db->escape($search_for).'\', replace_with=\''.$db->escape($replace_with).'\' WHERE id='.$id) or error('Unable to update censor word', __FILE__, __LINE__, $db->error()); + + // Regenerate the censoring cache + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) + require PUN_ROOT.'include/cache.php'; + + generate_censoring_cache(); + + redirect('admin_censoring.php', $lang_admin_censoring['Word updated redirect']); +} + +// Remove a censor word +else if (isset($_POST['remove'])) +{ + confirm_referrer('admin_censoring.php'); + + $id = intval(key($_POST['remove'])); + + $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error()); + + // Regenerate the censoring cache + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) + require PUN_ROOT.'include/cache.php'; + + generate_censoring_cache(); + + redirect('admin_censoring.php', $lang_admin_censoring['Word removed redirect']); +} + +$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Censoring']); +$focus_element = array('censoring', 'new_search_for'); +define('PUN_ACTIVE_PAGE', 'admin'); +require PUN_ROOT.'header.php'; + +generate_admin_menu('censoring'); + +?> +
+

+
+
+
+
+ +
+

'.$lang_admin_common['Options'].'') : sprintf($lang_admin_censoring['Censoring disabled'], ''.$lang_admin_common['Options'].'')) ?>

+ + + + + + + + + + + + + + + +
+
+
+
+
+
+ +
+query('SELECT id, search_for, replace_with FROM '.$db->prefix.'censoring ORDER BY id') or error('Unable to fetch censor word list', __FILE__, __LINE__, $db->error()); +if ($db->num_rows($result)) +{ + +?> + + + + + + + + + +fetch_assoc($result)) + echo "\t\t\t\t\t\t\t\t".''."\n"; + +?> + +
 
+'.$lang_admin_censoring['No words in list'].'

'."\n"; + +?> +
+
+
+
+
+
+
+ +