/** * Standard import function. * * @param object The DB connection to import from * @param string The table prefix the target prefix is using * @param PATH The base directory we are importing from */ function import_wordfilter($db, $table_prefix, $file_base) { $rows = $db->query('SELECT value FROM ' . $table_prefix . 'setting WHERE ' . db_string_equal_to('varname', 'censorwords')); $censorwords = $rows[0]['value']; foreach (explode(' ', $censorwords) as $word) { if ($word != '') { add_wordfilter_word($word); } } }
/** * Standard import function. * * @param object The DB connection to import from * @param string The table prefix the target prefix is using * @param PATH The base directory we are importing from */ function import_wordfilter($db, $table_prefix, $file_base) { require $file_base . '/config.php'; $filter = constant('BAD_WORD_FILTER'); if ($filter == 'Array') { return; } $rows = explode(' ', $filter); foreach ($rows as $row) { $pos = strpos($row, '='); if ($pos === false) { add_wordfilter_word($row); } else { add_wordfilter_word(substr($row, 0, $pos), substr($row, $pos + 1)); } } }
/** * Standard import function. * * @param object The DB connection to import from * @param string The table prefix the target prefix is using * @param PATH The base directory we are importing from */ function import_wordfilter($db, $table_prefix, $file_base) { $rows = $db->query('SELECT * FROM ' . $table_prefix . 'settings WHERE ' . db_string_equal_to('variable', 'censor_vulgar') . ' OR ' . db_string_equal_to('variable', 'censor_proper')); $censor_vulgar = array(); $censor_proper = array(); foreach ($rows as $row) { if ($row['variable'] == 'censor_vulgar') { $censor_vulgar = preg_split('/[\\n\\r]+/', $row['value']); } else { $censor_proper = preg_split('/[\\n\\r]+/', $row['value']); } } foreach ($censor_vulgar as $key => $row) { add_wordfilter_word($censor_vulgar[$key], array_key_exists($key, $censor_proper) ? $censor_proper[$key] : ''); } }
/** * Standard import function. * * @param object The DB connection to import from * @param string The table prefix the target prefix is using * @param PATH The base directory we are importing from */ function import_wordfilter($db, $table_prefix, $file_base) { $rows = $db->query('SELECT * FROM ' . $table_prefix . 'registry WHERE ' . db_string_equal_to('name', 'censor_words_from') . ' OR ' . db_string_equal_to('name', 'censor_words_to')); $censor_words_from = isset($rows[0]['regval']) && $rows[0]['regval'] != '' ? $rows[0]['regval'] : ''; $censor_words_to = isset($rows[1]['regval']) && $rows[1]['regval'] != '' ? $rows[1]['regval'] : ''; $censor_words_from_array = explode('|', $censor_words_from); $censor_words_to_array = explode('|', $censor_words_to); foreach ($censor_words_from_array as $key => $row) { add_wordfilter_word($censor_words_from_array[$key], isset($censor_words_to_array[$key]) && $censor_words_to_array[$key] != '' ? $censor_words_to_array[$key] : ''); } }
/** * Standard import function. * * @param object The DB connection to import from * @param string The table prefix the target prefix is using * @param PATH The base directory we are importing from */ function import_wordfilter($db, $table_prefix, $file_base) { require_code('word_filter'); $rows = $db->query('SELECT word FROM ' . $table_prefix . 'wordfilter', NULL, NULL, true); if (is_null($rows)) { return; } foreach ($rows as $row) { add_wordfilter_word($row['word'], array_key_exists('w_replacement', $row) ? $row['w_replacement'] : '', array_key_exists('w_substr', $row) ? $row['w_substr'] : 0); } }
/** * Standard import function. * * @param object The DB connection to import from * @param string The table prefix the target prefix is using * @param PATH The base directory we are importing from */ function import_wordfilter($db, $table_prefix, $file_base) { $rows = $db->query('SELECT * FROM ' . $table_prefix . 'words'); foreach ($rows as $row) { add_wordfilter_word($row['word'], $row['replacement']); } }
/** * Standard import function. * * @param object The DB connection to import from * @param string The table prefix the target prefix is using * @param PATH The base directory we are importing from */ function import_wordfilter($db, $table_prefix, $old_base_dir) { require_code('word_filter'); $rows = $db->query('SELECT * FROM ' . $table_prefix . 'words'); foreach ($rows as $row) { add_wordfilter_word($row['word'], $row['replacement']); } }
/** * Standard import function. * * @param object The DB connection to import from * @param string The table prefix the target prefix is using * @param PATH The base directory we are importing from */ function import_wordfilter($db, $table_prefix, $file_base) { $rows = $db->query('SELECT * FROM ' . $table_prefix . 'badwords'); $rows = remove_duplicate_rows($rows, 'type'); foreach ($rows as $row) { add_wordfilter_word($row['type'], $row['swop'], $row['m_exact']); } }
/** * Standard import function. * * @param object The DB connection to import from * @param string The table prefix the target prefix is using * @param PATH The base directory we are importing from */ function import_wordfilter($db, $table_prefix, $file_base) { $rows = $db->query_select('badwords'); foreach ($rows as $row) { add_wordfilter_word($row['badword'], $row['replacement']); } }