Posts Tagged with "phpbb"

More on Software

February 28th, 2007 at 3:32 pm by Mark
Tags: , , , , , , , ,

     (“Mark, why so much work talk?”  Because it’s easier to work and laugh than to think about things that are bothering me.  And besides, I’ve only rarely spoken about what I actually do for a living, anyway.) 

     A few days ago, Swankpad’s forum got weird.  Something happened and every post title was set to the same value.  Today, I found out for certain that exactly what code modification was causing it.
     Instead of adding code for upgrades and Mods to phpBB, it’s preferable to use a Patch File for software upgrades, and a neat little thing called EasyMOD to add in any future mods.  EasyMOD is great, and generally makes fewer mistakes than going through many thousands of lines of code to make changes (although, an uninstall feature would be nice!).

     There was a new mod called Akismet Spam Butcher for phpBB that I decided to install last week, just for the heck it — too many spammers.  Though the plugin doesn’t actually *do* anything, it was more of a proof-of-concept for using Akismet with phpBB.  I wanted to see how well it worked in adding Spam flags to the database — which is all it does at present.
     (In all honesty, if you can keep people from registering, that alleviates the spam issue altogether.  😉 )

      Anyway … Take a look at this SQL statement, from phpBB with Akismet Spam Butcher added via EasyMOD:

$sql  = ($mode != “editpost”) ? “INSERT INTO ” . TOPICS_TABLE . ” (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote, topic_spam) VALUES (‘$post_subject’, ” . $userdata[‘user_id’] . “, $current_time, $forum_id, ” . TOPIC_UNLOCKED . “, $topic_type, $topic_vote, $post_spam)” : “UPDATE ” . TOPICS_TABLE . ” SET topic_title = ‘$post_subject’, topic_type = $topic_type ” . (($post_data[‘edit_vote’] || !empty($poll_title)) ? “, topic_vote = ” . $topic_vote : “”) . ” , topic_spam = $post_spamWHERE topic_id = $topic_id”;

     Sometimes it’s just glaringly obvious where the problem is.

     One Edit, and every post in entire bloody forum gets the post title you edited.

     (Hint:  “$topic_spam = 0”)

     *shakes head*

#—–[ IN-LINE FIND ]———————————
# Yes, we’re still working within the same FIND
# Note that the space here is important, you will need to be sure there is
# a space between what’s there and what we’ll add next
#
 WHERE topic_id = $topic_id”;
#
#—–[ IN-LINE BEFORE, ADD ]————————
#
, topic_spam = $post_spam

     Looks like EasyMOD was the culprit… but then again, I probably would’ve done the syntax a little differently due to the spaces.

     Removing the Spam Butcher anyway … I found a more elegant solution. 😉