Blocking Chinese Spam from gmail

Since May I've been getting a crazy amount of Chinese spam. About 40 messages a day. Although I would one day love to learn Chinese and find out how impressive I will be to my lover after taking their herbal viagra, right now I'm just trying to get my work done.

There are several articles out there claiming that:


can be used as a filter. I think this is old news as it doesn't seem to work anymore for any language.

So I googled the most common chinese characters and put together a filter like this:

Has words:

的 OR 是 OR 否 OR 要 OR 不

This catches them all nicely. Sorry Chinese spammers.


How to use theme_pager without a SQL query (and go to hell)

pager.inc is... ugly.  Let's get that out of the way.  I'm sure there are valiant souls out there who are not bitching about it, but trying to fix it.  I'm not one of those people right now, I've got my own battles, but if you happen to go up against it and want to create a pager for a data source which isn't a SQL database, here's what you need to do (mostly copied from pager_query):

Global variables (yes and it gets worse)

pager.inc makes extensive use of global variables to pass around the state of the pager.  You can see how these are defined in pager_query():

global $pager_page_array, $pager_total, $pager_total_items;

Honestly, don't ask me what these are.  Roughly, $pager_page_array is an array of different pagers on the page and what page they are at (I think).  $pager_total is the total number of pages for each pager, $pager_total_items is the number of items in the set.

These are all set in pager_query if you care to find out more.


Getting the current page

You'll need this of course to split your set up so you can show just what you need to show on that page.

Fortunately, this is pretty straightforward in a really obtuse way:

$page = isset($_GET['page']) ? $_GET['page']


Subscribe to hack