Line 567 in a vanilla posting.php file.bruster42 wrote:Please help. I've created the tables, made all the SQL changes, now I'm starting on the file mods.
The first one in "posting.php" says FIND
if ( $error_msg == '' )
{
Problem is there are a number of these in this file. Which one do I modify? There's no "about line #" reference.
Thanks.
Bruce
Code: Select all
if ( $error_msg == '' )
{
Code: Select all
ORDER BY t.topic_last_post_id DESC
Code: Select all
AND p.post_flagged <> " . TRUE . "
Well all I can say Joe is that your mod has been so fantastic that it has been sweet music to my earsJoe Belmaati wrote:Can't remember the exact code segment, but normally I would never write code that runs more than one query. Does the function spamcheck() run a query? Logic would be that the spamwords table is read once and the result shoved into an array. The idea is then to read the array, not run another query. Anyhow, I think what spamcheck() does is to read the array for every field that is checked. That would make sense. BTW, I am also a self taught programmer. My real profession is being a musician![]()
Code: Select all
function spamcheck($param)
{
global $db;
if(@strpos(strtolower($param), '[url') !== false)
{
message_die(GENERAL_ERROR, 'No url allowed');
}
$sql = "SELECT * FROM " . SPAM_WORDS_TABLE;
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not get spam words from database', '', __LINE__, __FILE__, $sql);
}
$param = preg_replace("#\[.{12,16}\]#i", '', $param);
$param = preg_replace('/\[url\]|\[\/url\]/si', '', $param);
$param = preg_replace('#\[url=|\]|\[/url\]#si', '', $param);
if ($row = $db->sql_fetchrow($result))
{
do
{
if (preg_match('#\b(' . str_replace('\*', '\w*?', phpbb_preg_quote($row['spam_word'], '#')) . ')\b#i', $param))
{
message_die(GENERAL_ERROR, 'Not allowed');
}
}
while ($row = $db->sql_fetchrow($result));
}
}
Code: Select all
if($mode == 'register')
{
$check_fields = array($username, $email, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature);
array_map('spamcheck', $check_fields);
}