diff -r e3d7322305bf -r 5e1f1e916419 punbb/admin/censoring.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/punbb/admin/censoring.php Sat Apr 05 23:56:45 2008 -0400 @@ -0,0 +1,272 @@ + $_ ) +{ + $$key =& $GLOBALS[$key]; +} + +($hook = get_hook('acs_start')) ? eval($hook) : null; + +if (!$pun_user['is_admmod']) + message($lang_common['No permission']); + +// Load the admin.php language file +require PUN_ROOT.'lang/'.$pun_user['language'].'/admin.php'; +$GLOBALS['lang_admin'] = $lang_admin; + + +// Add a censor word +if (isset($_POST['add_word'])) +{ + $search_for = trim($_POST['new_search_for']); + $replace_with = trim($_POST['new_replace_with']); + + if ($search_for == '' || $replace_with == '') + message($lang_admin['Must enter text message']); + + ($hook = get_hook('acs_add_word_form_submitted')) ? eval($hook) : null; + + $query = array( + 'INSERT' => 'search_for, replace_with', + 'INTO' => 'censoring', + 'VALUES' => '\''.$pun_db->escape($search_for).'\', \''.$pun_db->escape($replace_with).'\'' + ); + + ($hook = get_hook('acs_qr_add_censor')) ? eval($hook) : null; + $pun_db->query_build($query) or error(__FILE__, __LINE__); + + // Regenerate the censor cache + require_once PUN_ROOT.'include/cache.php'; + generate_censors_cache(); + + pun_redirect(pun_link($pun_url['admin_censoring']), $lang_admin['Censor word added'].' '.$lang_admin['Redirect']); +} + + +// Update a censor word +else if (isset($_POST['update'])) +{ + $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($lang_admin['Must enter text message']); + + ($hook = get_hook('acs_update_form_submitted')) ? eval($hook) : null; + + $query = array( + 'UPDATE' => 'censoring', + 'SET' => 'search_for=\''.$pun_db->escape($search_for).'\', replace_with=\''.$pun_db->escape($replace_with).'\'', + 'WHERE' => 'id='.$id + ); + + ($hook = get_hook('acs_qr_update_censor')) ? eval($hook) : null; + $pun_db->query_build($query) or error(__FILE__, __LINE__); + + // Regenerate the censor cache + require_once PUN_ROOT.'include/cache.php'; + generate_censors_cache(); + + pun_redirect(pun_link($pun_url['admin_censoring']), $lang_admin['Censor word updated'].' '.$lang_admin['Redirect']); +} + + +// Remove a censor word +else if (isset($_POST['remove'])) +{ + $id = intval(key($_POST['remove'])); + + ($hook = get_hook('acs_remove_form_submitted')) ? eval($hook) : null; + + $query = array( + 'DELETE' => 'censoring', + 'WHERE' => 'id='.$id + ); + + ($hook = get_hook('acs_qr_delete_censor')) ? eval($hook) : null; + $pun_db->query_build($query) or error(__FILE__, __LINE__); + + // Regenerate the censor cache + require_once PUN_ROOT.'include/cache.php'; + generate_censors_cache(); + + pun_redirect(pun_link($pun_url['admin_censoring']), $lang_admin['Censor word removed'].' '.$lang_admin['Redirect']); +} + + +// Load the cached censors +if (file_exists(PUN_CACHE_DIR.'cache_censors.php')) + include PUN_CACHE_DIR.'cache_censors.php'; + +if (!defined('PUN_CENSORS_LOADED')) +{ + require_once PUN_ROOT.'include/cache.php'; + generate_censors_cache(); + require PUN_CACHE_DIR.'cache_censors.php'; +} + + +// Setup the form +$pun_page['part_count'] = $pun_page['fld_count'] = $pun_page['set_count'] = 0; + +// Setup breadcrumbs +$pun_page['crumbs'] = array( + array($pun_config['o_board_title'], pun_link($pun_url['index'])), + array($lang_admin['Forum administration'], pun_link($pun_url['admin_index'])), + $lang_admin['Censoring'] +); + +($hook = get_hook('acs_pre_header_load')) ? eval($hook) : null; + +define('PUN_PAGE_SECTION', 'options'); +define('PUN_PAGE', 'admin-censoring'); +require PUN_ROOT.'header.php'; + +?> +
+ + + +
+

{ }

+
+ +
+
+

+
+
+ + +
+ + +
+ +
+ +
+ +
+ +
+
+ +
+
+
+ +
+
+

+
+
+ + $cur_word) + { + + ?> +
+ + +
+ +
+ +
+ + +
+ +
+ +
+
+ +
+
+

+
+
+
+

+
+
+
+ +
+