diff -r 000000000000 -r f9ffdbd96607 punbb/admin_censoring.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/punbb/admin_censoring.php Wed Jul 11 21:01:48 2007 -0400 @@ -0,0 +1,167 @@ + PUN_MOD) + message($lang_common['No permission']); + + +// Add a censor word +if (isset($_POST['add_word'])) +{ + confirm_referrer('admin_censoring.php'); + + $search_for = trim($_POST['new_search_for']); + $replace_with = trim($_POST['new_replace_with']); + + if ($search_for == '' || $replace_with == '') + message('You must enter both a word to censor and text to replace it with.'); + + $db->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()); + + redirect('admin_censoring.php', 'Censor word added. Redirecting …'); +} + + +// Update a censor word +else if (isset($_POST['update'])) +{ + confirm_referrer('admin_censoring.php'); + + $id = intval(key($_POST['update'])); + + $search_for = trim($_POST['search_for'][$id]); + $replace_with = trim($_POST['replace_with'][$id]); + + if ($search_for == '' || $replace_with == '') + message('You must enter both text to search for and text to replace with.'); + + $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()); + + redirect('admin_censoring.php', 'Censor word updated. Redirecting …'); +} + + +// 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()); + + redirect('admin_censoring.php', 'Censor word removed. Redirecting …'); +} + + +$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Censoring'; +$focus_element = array('censoring', 'new_search_for'); +require PUN_ROOT.'header.php'; + +generate_admin_menu('censoring'); + +?> +
+

Censoring

+
+
+
+
+ Add word +
+

Enter a word that you want to censor and the replacement text for this word. Wildcards are accepted (i.e. *some* would match somewhere and lonesome). Censor words also affect usernames. New users will not be able to register with usernames containing any censored words. The search is case insensitive. Censor words must be enabled in Options for this to have any effect.

+ + + + + + + + + + + + + + + +
Censored wordReplacement textAction
+
+
+
+
+
+ Edit/remove words +
+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"; + +?> + +
Censored wordReplacement textActions
 
+No censor words in list.

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