Notes to Myself

The Humble var_dump

June 3, 2008

There are a several of plugins available for Habari to deal with spam. Most people seem to prefer the ones that use outside services such as Aksimet and Defensio. I don't like relying on outside services so I rely on the simple spamchecker plugin that comes with Habari and the simple blacklist checker.

The concept behind the simple blacklist plugin is simple. Give it a list of terms or ip addresses to search for in a comment. If the comment contains any of these, discard it. Sad to say, it wasn't working, though. I looked through the code and could find nothing wrong, so submitted a bug report for it and let it go.

The problem kept irking me, though, because every day I would have to manually moderate comments that contained text that I had in the blacklist, so I went back to debugging the plugin myself. I began by using var_dump(), the PHP function that will print any variable you give it. In particular, I used var_dump to see the contents of the blacklist.

It was empty. Obviously, not good. You can't compare against something that doesn't exist. I looked at the code and found this:

$blacklist= explode( "\n", Options::get('SimpleBlacklist:blacklist') );

I looked in the database options and found this:

simpleblacklist:blacklist

Note the capitalization differences. Changing the Options::get() statement to use 'simpleblacklist' solved the problem. The simpleblacklist plugin began quietly discarding comments that contained blacklisted terms. My life has become much easier without having to rely on an outside service. All thanks to the humble var_dump().

Filed under , , and

The GPL and the Ethics of Control

May 30, 2008

Licensing of software is an important, fascinating, and very difficult to understand subject. Developers, some of the people who are affected the most by licensing issues, have the most difficult time understanding the different types of license that are available. I know I do....

Read more
Filed under and

Coding, Community, and the Habari Cabal

May 24, 2008

I've been blogging for over two years now. Like most people, I started on a service, Blogger in my case. It didn't take me long to want more control than Blogger would give me, so I began looking around and found WordPress. For most of the time since then, WordPress has served me well. I built Shards of Consciousness...

Read more
Filed under , and

markUp - A New Habari Plugin

May 20, 2008

jQuery is a popular Javascript library that sees a lot of use in web programming. It simplifies many scripting tasks and is easily extensible with plugins. ...

Read more

Keep Your Database Purring

May 17, 2008

When we're blogging, one of the things we don't tend to think about is the state of our database. As with the oil in our car, as long as it works, we tend to ignore it....

Read more
Filed under and

A Stretch Too Far

May 16, 2008

A team from the London School of Hygiene and Tropical Medicine is reporting that people who are obese are one of the driving forces behind global warming....

Read more

Blissfully Ignorant Of Email Problems

May 13, 2008

Has your email ever become eerily silent? As in empty. You're not getting any. That happened to me recently. I was getting messages in some accounts, so I just thought I wasn't getting any mail --- until my wife sent me a message and I didn't get it. I use Thunderbird for a client, so usually I just click the ...

Read more
Filed under and

Use PHP to Inject Code into Javascript

May 8, 2008

Recently Habari updated it's administrative code to use a new interface. The new interface relies much more heavily on javascript than the old one did, which allows it to pull off some pretty snifty tricks. One of these is on the entries page, where a list of all the posts you have written is displayed. ...

Read more

The Positronic Brain Is On It's Way

May 1, 2008

If you've read any Isaac Asimov or seen the movie Bicentennial Man, you've heard the term positronic brain. The positronic brain was the factor that gave Asimov's robots their consciousness and decision-making abilities....

Read more

Meta SEO

April 30, 2008

The three plugins I had written - MetaDescription, MetaTitle, and MetaKeywords - are no longer available from this site, nor are they supported....

Read more
Filed under , and

Subscribe

More Posts

Recent Comments

Tags