Fix permalink custom stati

Related to #137 

Here is one avenue of attack I've taken on fixing permalinks with custom stati (my new word of choice for the plural of status). It relies on two extra post meta fields, but it simulates the way wp core handles permalinks (in a very weird way...). This is just one idea, and I'll continue working on this if it seems a little too wonky. 

It can also be [cleaned up](https://f.cloud.github.com/assets/1888152/102802/110b43ee-693c-11e2-9a93-3338c9fd1556.png). Those $wpdb calls can be axed in a few places and shifted to the bottom. I'll update this again with a few readability/good practices fixes, but I figure I'd push it out so you could take a look at it before I hit the sack for a few.