Exemple #1
0
 public function remove_word()
 {
     global $lang_admin_censoring;
     $id = intval(key($this->request->post('remove')));
     DB::for_table('censoring')->find_one($id)->delete();
     // Regenerate the censoring cache
     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
         require FEATHER_ROOT . 'include/cache.php';
     }
     generate_censoring_cache();
     redirect(get_link('admin/censoring/'), $lang_admin_censoring['Word removed redirect']);
 }
Exemple #2
0
    $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('LUNA_CACHE_FUNCTIONS_LOADED')) {
        require LUNA_ROOT . 'include/cache.php';
    }
    generate_censoring_cache();
    redirect('backstage/censoring.php');
} elseif (isset($_POST['remove'])) {
    confirm_referrer('backstage/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('LUNA_CACHE_FUNCTIONS_LOADED')) {
        require LUNA_ROOT . 'include/cache.php';
    }
    generate_censoring_cache();
    redirect('backstage/censoring.php');
}
$page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), __('Admin', 'luna'), __('Censoring', 'luna'));
$focus_element = array('censoring', 'new_search_for');
define('LUNA_ACTIVE_PAGE', 'admin');
require 'header.php';
load_admin_nav('content', 'censoring');
?>
<div class="row">
	<div class="col-sm-4">
		<form id="censoring" method="post" action="censoring.php">
			<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title"><?php 
_e('Add word', 'luna');
function censor_words($text)
{
    global $db;
    static $search_for, $replace_with;
    // If not already built in a previous call, build an array of censor words and their replacement text
    if (!isset($search_for)) {
        if (file_exists(FORUM_CACHE_DIR . 'cache_censoring.php')) {
            include FORUM_CACHE_DIR . 'cache_censoring.php';
        }
        if (!defined('PUN_CENSOR_LOADED')) {
            if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
                require PUN_ROOT . 'include/cache.php';
            }
            generate_censoring_cache();
            require FORUM_CACHE_DIR . 'cache_censoring.php';
        }
    }
    if (!empty($search_for)) {
        $text = substr(ucp_preg_replace($search_for, $replace_with, ' ' . $text . ' '), 1, -1);
    }
    return $text;
}
 /**
  * Regenerate FluxBB cache after conversion
  */
 function generate_cache()
 {
     // Load the cache script
     require_once PUN_ROOT . 'include/cache.php';
     // Generate cache
     generate_config_cache();
     generate_bans_cache();
     generate_quickjump_cache();
     generate_censoring_cache();
     generate_users_info_cache();
     clear_feed_cache();
 }