function censor_words($text)
{
    global $forum_db, $forum_censors;
    $return = ($hook = get_hook('fn_censor_words_start')) ? eval($hook) : null;
    if ($return != null) {
        return $return;
    }
    // If not already loaded in a previous call, load the cached censors
    if (!defined('FORUM_CENSORS_LOADED')) {
        if (file_exists(FORUM_CACHE_DIR . 'cache_censors.php')) {
            include FORUM_CACHE_DIR . 'cache_censors.php';
        }
        if (!defined('FORUM_CENSORS_LOADED')) {
            if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
                require FORUM_ROOT . 'include/cache.php';
            }
            generate_censors_cache();
            require FORUM_CACHE_DIR . 'cache_censors.php';
        }
    }
    // Check Unicode support
    $unicode = defined('FORUM_SUPPORT_PCRE_UNICODE');
    return isset($forum_censors) ? censor_words_do($forum_censors, $text, $unicode) : $text;
}
Example #2
0
            }
            generate_censors_cache();
            ($hook = get_hook('acs_remove_pre_redirect')) ? eval($hook) : null;
            redirect(forum_link($forum_url['admin_censoring']), $lang_admin_censoring['Censor word removed'] . ' ' . $lang_admin_common['Redirect']);
        }
    }
}
// Load the cached censors
if (file_exists(FORUM_CACHE_DIR . 'cache_censors.php')) {
    include FORUM_CACHE_DIR . 'cache_censors.php';
}
if (!defined('FORUM_CENSORS_LOADED')) {
    if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
        require FORUM_ROOT . 'include/cache.php';
    }
    generate_censors_cache();
    require FORUM_CACHE_DIR . 'cache_censors.php';
}
// Setup the form
$forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
// Setup breadcrumbs
$forum_page['crumbs'] = array(array($forum_config['o_board_title'], forum_link($forum_url['index'])), array($lang_admin_common['Forum administration'], forum_link($forum_url['admin_index'])));
if ($forum_user['g_id'] == FORUM_ADMIN) {
    $forum_page['crumbs'][] = array($lang_admin_common['Settings'], forum_link($forum_url['admin_settings_setup']));
}
$forum_page['crumbs'][] = array($lang_admin_common['Censoring'], forum_link($forum_url['admin_censoring']));
($hook = get_hook('acs_pre_header_load')) ? eval($hook) : null;
define('FORUM_PAGE_SECTION', 'settings');
define('FORUM_PAGE', 'admin-censoring');
require FORUM_ROOT . 'header.php';
// START SUBST - <!-- forum_main -->
Example #3
0
function censor_words($text)
{
    global $forum_db;
    static $search_for, $replace_with;
    $return = ($hook = get_hook('fn_censor_words_start')) ? eval($hook) : null;
    if ($return != null) {
        return $return;
    }
    // If not already loaded in a previous call, load the cached censors
    if (!defined('FORUM_CENSORS_LOADED')) {
        if (file_exists(FORUM_CACHE_DIR . 'cache_censors.php')) {
            include FORUM_CACHE_DIR . 'cache_censors.php';
        }
        if (!defined('FORUM_CENSORS_LOADED')) {
            if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
                require FORUM_ROOT . 'include/cache.php';
            }
            generate_censors_cache();
            require FORUM_CACHE_DIR . 'cache_censors.php';
        }
        $search_for = array();
        $replace_with = array();
        foreach ($forum_censors as $censor_key => $cur_word) {
            $search_for[$censor_key] = '/(?<=\\W)(' . str_replace('\\*', '\\w*?', preg_quote($cur_word['search_for'], '/')) . ')(?=\\W)/iu';
            $replace_with[$censor_key] = $cur_word['replace_with'];
            ($hook = get_hook('fn_censor_words_setup_regex')) ? eval($hook) : null;
        }
    }
    if (!empty($search_for)) {
        $text = utf8_substr(preg_replace($search_for, $replace_with, ' ' . $text . ' '), 1, -1);
    }
    return $text;
}