aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-09-02 22:08:01 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-09-02 22:08:01 +0000
commit107a3162c218a22b22a85f13ef3618998ab2b092 (patch)
tree230b6fcd08440e98c4d956106ac35fae48df1a4c /phpBB/includes/functions.php
parent19469ed26e583137e72ac10759b8a0a3c0b2cb1d (diff)
downloadforums-107a3162c218a22b22a85f13ef3618998ab2b092.tar
forums-107a3162c218a22b22a85f13ef3618998ab2b092.tar.gz
forums-107a3162c218a22b22a85f13ef3618998ab2b092.tar.bz2
forums-107a3162c218a22b22a85f13ef3618998ab2b092.tar.xz
forums-107a3162c218a22b22a85f13ef3618998ab2b092.zip
Fix for bug #457835
git-svn-id: file:///svn/phpbb/trunk@973 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php65
1 files changed, 60 insertions, 5 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index d283b8c07e..f5f995c792 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -581,7 +581,7 @@ function sync($type, $id)
for($i = 0; $i < count($rowset); $i++)
{
- sync($row[$i]['forum_id'], "forum");
+ sync("forum", $row[$i]['forum_id']);
}
break;
@@ -596,7 +596,7 @@ function sync($type, $id)
for($i = 0; $i < count($rowset); $i++)
{
- sync($row[$i]['topic_id'], "topic");
+ sync("topic", $row[$i]['topic_id']);
}
break;
@@ -610,7 +610,15 @@ function sync($type, $id)
{
message_die(GENERAL_ERROR, "Could not get post ID", "Error", __LINE__, __FILE__, $sql);
}
- $last_post = ( $row = $db->sql_fetchrow($result) ) ? $row['last_post'] : 0;
+
+ if( $row = $db->sql_fetchrow($result) )
+ {
+ $last_post = $row['last_post'];
+ }
+ else
+ {
+ $last_post = 0;
+ }
$sql = "SELECT COUNT(post_id) AS total
FROM " . POSTS_TABLE . "
@@ -647,7 +655,15 @@ function sync($type, $id)
{
message_die(GENERAL_ERROR, "Could not get post ID", "Error", __LINE__, __FILE__, $sql);
}
- $last_post = ( $row = $db->sql_fetchrow($result) ) ? $row['last_post'] : 0;
+
+ if( $row = $db->sql_fetchrow($result) )
+ {
+ $last_post = $row['last_post'];
+ }
+ else
+ {
+ $last_post = 0;
+ }
$sql = "SELECT COUNT(post_id) AS total
FROM " . POSTS_TABLE . "
@@ -860,4 +876,43 @@ function smiley_sort($a, $b)
}
return (strlen($a['code']) > strlen($b['code'])) ? -1 : 1;
}
-?>
+
+//
+// Obtain list of naughty words and build preg style
+// replacement arrays for use by the calling script,
+// note that the vars are passed as references this just makes
+// it easier to return both sets of arrays
+//
+function obtain_word_list(&$orig_word, &$replacement_word)
+{
+ global $db;
+
+ //
+ // Define censored word matches
+ //
+ $sql = "SELECT word, replacement
+ FROM " . WORDS_TABLE;
+ if( !$words_result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get censored words from database.", "", __LINE__, __FILE__, $sql);
+ }
+ else
+ {
+ $word_list = $db->sql_fetchrowset($words_result);
+
+ $orig_word = array();
+ $replacement_word = array();
+
+ for($i = 0; $i < count($word_list); $i++)
+ {
+ $word = str_replace("\*", "\w*?", preg_quote($word_list[$i]['word']));
+
+ $orig_word[] = "/\b(" . $word . ")\b/i";
+ $replacement_word[] = $word_list[$i]['replacement'];
+ }
+ }
+
+ return(TRUE);
+}
+
+?> \ No newline at end of file