Movable Type

January 03, 2007

Comment spam and MT

Movable Type does not deal with comment spam terribly well.

It has, in a twisted way, an unbeatable spam prevention system. Once spam gets beyond a certain threshold, it consumes all server resources, which prevents further abuse by spammers by bringing all server activity to a halt.

In truth, it is not the most elegant system.

mt-comments.cgi and trackback have been disabled to prevent such abuses in future.

Webkittyn has, rather brilliantly, suggested that all MT users move to the haloscan comment system, by signing up there, and modifying their individual entry archive templates as suggested by haloscan (instructions here).

Scrawled illegibly by Meathe at 04:26 PM

Movable Type

December 15, 2005

Moveable type, typekey and comments

IMAGinES, a fellow MT-er chanced upon this place in a google query for a MT problem. (I think). The disclaimer: I am not an MT guru. MT is something I have had the occasion poke at once or twice. I take no responsibility for bad stuff that may happen following these steps (conversely, credit is always good).

Unfortunately, my blog is on 3.16, not 3.2, which gives slightly different error messages, so I can't recreate it (I'm also lazy and don't want to set up a 3.2 test box). It seems like the message is given when the signature can't be validated. The code tries to validate the typekey token and timestamp (and a few other things which would seem ok).

Things to check:
Weblog config/Preferences: Triple check the TypeKey Token. Make sure it is correct and that there are no whitespace characters at the end of the line.
mtconfig.cgi (was mt.cfg prior to 3.2): Make sure you're using the setting "TypeKeyVersion 1.1" (I think this will be the case if its a clean install, it may not be if its an upgrade).

If its neither of these, then the most likely cause is a bad timestamp on your host. Time in unix (linux, etc) should always be set to GMT. If you have shell access, the following commands should output GMT identically (if you type fast enough so the seconds don't tick over)

date -u
perl -e 'use POSIX; print strftime("%a %h %d %H:%M:%S UTC %Y\n", gmtime(time))'

If you don't have shell access, you'll need your host to verify this.

Good luck.

Scrawled illegibly by Meathe at 10:54 AM

Movable Type

October 20, 2005

Many, many thanks

go out to Webkittyn, who let me in on the secret of getting rid of comment spam. From around 35 per day, for the last week it has dropped to zero.

Aparently, the spammers focus on the word "Posted" to locate the comment links. Changing this renders them impotent.

Thanks you!

Scrawled illegibly by Meathe at 09:58 AM

Movable Type

August 23, 2005

Movable Traps 3.2b

A few problems that I've hit in the last couple of days, and a few suggestions about how to best work around them with few(er) hair tearing moments. File extensions, archive problems and Typekey login problems for comments will be tackled.

Your mileage may vary.

1. File extensions: You can change them from html to php, and many people do. This is wonderful, except where the html page sticks around. Often, the default page is index.html. This is especially problematic when you're updating templates and wondering why nothing seems to work.

Try manually typing in yoururl/index.htm and yoururl/index.php to check this. Remove the html file if this is indeed causing you problems.

2. No way to leave comments (Archive mapping problem): This may not happen for all installations. Under Settings/Publishing/Archive mapping, it will show you what arhcive files will be generated.

archiveentry1.png

In this case, under individual entry, Category Archive and Individual entry archive are being generated in the same place with the same name. Not so good. Individual Entry is selected as preferred, so you might imagine it's the active one of the two. Unfortunately, this isn't the case and it means that it is generated first, and subsequently clobbered by the Category Archive.

There were fairly minimal visual differences between the two templates in this case - with the exception that Category Archives don't allow you to leave a comment. Clicking on the "Comments" link was meant to take you to the Individual Entry where you could post a comment, but as that had been overwritten with the Category archive... Like a circle in a spiral, like a wheel within a wheel. It was impossible to leave comments.

Solution: Delete the Category archive entry from under "Archive Type: Individual" and rebuild.

3. MT3.2b & Typekey Version 1.1: If, after logging in on the Typekey server and returning to the comments page, you are greeted with "Comment Submission Error Your comment submission failed for the following reasons: The sign-in validation failed.", you are experienceing this problem.

If 3.2b is configured with TypeKey V1.1, it needs to get a v1.1 response from the typekey servers to work. But (in some installations) it doesn't actually tell the TypeKey server that it needs that version. TypeKey merrily sends back the standard v1.0 response. Which doesn't work.

Soulution: Edit your Individual Archive Entry template and demand a version 1.1 response, by changing this:

<a href="<$MTRemoteSignInLink static="1"$>"> Sign in</a>

into this

<a href="<$MTRemoteSignInLink static="1"$>&v=1.1"> Sign in</a>

4. TypeKey #2 - Configuration: If you're getting a "TypeKey not configured" error when trying to log in to comment, login to www.typkey.com and check your TypeKey account. Under "YOUR WEBLOG PREFERENCES", the urls you enter should be the server, not your weblog. In my case, it is "http://www.moreblogsofroleplay.com/" rather than "http://www.moreblogsofroleplay.com/Meathe".

Scrawled illegibly by Meathe at 01:34 PM

Movable Type

August 09, 2005

Change of theme?

I was half tempted to rework the theme here, after reading Webkittyn's post on changing the theme seasonally. However, I know there are several large disincentives:

  1. I no longer have the source to the seal animation at the top, so to modify it, I'd need to recreate it
  2. JPGs don't have transparencies, so all the background images are colour matched and blended with the current blue background colour. I should have made PNGs.
  3. Far to lazy to address points 1 and 2
  4. I'm still tinkering with the current one

Scrawled illegibly by Meathe at 09:28 AM

Movable Type

July 15, 2005

Background images

Someone asked if they could see all the images I have for backgrounds. So I cobbled together a php script to display them all. It scans in the files from the directory, and is self updating.

Large page, many seals.


Warning: main(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/moreblog/public_html/Meathe/archives/science_and_technology/movable_type/index.php on line 292

Warning: main(http://www.layil.org/images/MTBackgrounds/imagelister.php): failed to open stream: No such file or directory in /home/moreblog/public_html/Meathe/archives/science_and_technology/movable_type/index.php on line 292

Warning: main(): Failed opening 'http://www.layil.org/images/MTBackgrounds/imagelister.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/moreblog/public_html/Meathe/archives/science_and_technology/movable_type/index.php on line 292

Scrawled illegibly by Meathe at 01:11 PM

Code

July 12, 2005

How to: Transparencies in webpages

This wiser effort would have been, to diffuse thought and imagination through the opaque substance of to-day, and thus make it a bright transparency...

Nathaniel Hawthorne, The Scarlet Letter

As some have noted, I like transparencies in web pages. Quite possibly too much, as all my pages appear to have them, from Layil to the Time of Darkness Bugtracker and this blog.

This is not purely for Movable Type, it can easily be added to any page that uses stylesheets. If you're not comfortable editing stylesheets, this is not a complex project. Honest.

Inside the stylesheet, usually right at the top, there is a body tag, which will look somewhat like this:


body {
margin: 0px 0px 20px 0px;
background-color: #8FABBE;
text-align: center;
}

This is a simple body tag, taken from the default Gettysburg CSS, offered by SixApart. Yours may be more complex.

To this is added a background image (so you actaully see the opacity setting work), and the opacity settings themselves.


background-image: url(http://www.layil.org/images/MTBackgrounds/rotator.php);
background-repeat: no-repeat ;
background-position: bottom left ;
background-attachment: fixed;
filter: Alpha(Opacity=75);
-moz-opacity: .75;

The background image and it's position are set (fixed on the lower left so it won't scroll, does not reapeat the image to fill up the screen) and, more importantly, where the (two) opacity filters are configured. These two values are the more or less the same thing, they simply target different browsers so that it should work with IE and Firefox/Mozilla. Safari does not work with these. May I suggest using Firefox or Camino instead?

Increasing the number will make it less transparent, lowering it will make it more so. I find 75 (and .75) pleasant, your mileage may vary.

Combining them, the result is:


body {
margin: 0px 0px 20px 0px;
background-color: #8FABBE;
text-align: center;
background-image: url(http://www.layil.org/images/MTBackgrounds/rotator.php);
background-repeat: no-repeat ;
background-position: bottom left ;
background-attachment: fixed;
filter: Alpha(Opacity=75);
-moz-opacity: .75;
}

After saving and rebuilding the stylesheet, you now have a page that you can see through.

Scrawled illegibly by Meathe at 12:41 PM

Movable Type

Random images

I've been asked a few times about how I get the picture in the background to change. The simple truth is that I let someone else do all the work.

Automatic Labs have a wonderful PHP script that does just that, without the need for mySQL or any configurations.

Create a new folder to contain your images and the PHP script. By far the easiest way is to use MT's Upload File menu option to create the directory and transfer the files. I actually uploaded mine to my webpage account, before I discovered the Upload File option hiding in plain sight.

It's now installed, configured and ready to run. You can type the address of the php script in your browser to check it out. Mine is over on layil, with three images.

Finally, to add it to your pages, use the php script as an image source, either in html, like this:
<img src="http://www.layil.org/images/MTBackgrounds/rotator.php"> or in the CSS (here's a little chunk of mine):


body {
margin: 0px 0px 20px 0px;
background-color: #788e9c ;
background-image: url(http://www.layil.org/images/MTBackgrounds/rotator.php);
background-repeat: no-repeat ;
background-position: bottom left ;
background-attachment: fixed;
margin : 0 0 0 0;
padding : 0 0 0 0;
width : auto;
}


For the diabolical, you could even combine this with the category images, by creating and uploading images and script to an images/category_name folder.


<img class="floatright" src="<$MTBlogURL$>images/<$MTEntryCategory dirify="1"$>/rotator.php" alt="<$MTEntryCategory remove_html="1"$>"/>

This would also work around the "all images must be either jpg or gif" issue with category images. The rotator will pic a random image from the category directory (as there's only one image in each directory, it'll be that picture for that category), and display whatever is there.

Scrawled illegibly by Meathe at 11:22 AM

Movable Type

Category images (and wrapping text around them)

For some time, I'd noticed images for each category on Webkittyn Warbles, and been quite impressed by it. I also had absolutely no idea on how to do it.

The Warbler was very helpful, giving me the code snippet to insert, and several examples. The code, as it often is, was amazingly simple. And after the snippit is in, just upload an image to the server with the same name as the category. Thank you!

The image for "Observations on the news!" is observations_on_the_news.jpg

It also placed the images on the left, which I didn't want, and didn't wrap text around them, which I did. It also requires that all images are of the same type (either .jpg or .gif).

Editing the CSS and creating a new image class called floatright resolved the first two issues.

Image code for index.php (added inside <MTEntries>)


<img class="floatright" src="<$MTBlogURL$>images/<$MTEntryCategory dirify="1"$>.jpg" alt="<$MTEntryCategory remove_html="1"$>"/>

CSS Code, added after body{...}

img.floatright {
float: right;
clear: right;
margin : 0 0 0 0;
padding : 0 0 0 0;
width : auto;
}

The clear: right; ensures that images 'stack up' down the right hand side of the page. It's a matter of preference. Without it, you get a staggered effect if the images would overlap, with the top image being rightmost, and the next being shunted to the left.

I also have transparency settings in mine, but that's a different kettle of seal food.

Scrawled illegibly by Meathe at 10:40 AM

Movable Type

July 05, 2005

Flippery flyin' fishes!

"On the road to Mandalay Where the flyin' fishes play, An' the dawn comes up like thunder outer China 'crost the bay."

Rudyard Kipling, Mandalay

Irony of ironies, I'm a flippery fish in the Truth Laid Bear ecosystem. The bold evolutionary leap (from crunchy crustacean) is largely due to Webkittyn and the Blogs of Roleplay Grand Grimoire, which has also awarded Musing, Meandering with the July 2005 Blog of the Month. This is due in part to my tinkering with the protection module and in part to the antics of the little seal in the banner. Thank you!

Many, many thanks also to Venice for actually having the courage to try it out and help in finding all the shortfalls.

The MTBlogroll, for whatever unfathomable reason, appears to have started working today, as several blogs have the NEW tag next to them now.

Today also marks the return to mud code, and I have quite a list.

Scrawled illegibly by Meathe at 11:20 AM

Movable Type

July 03, 2005

MT Links

It is a mistake to try to look too far ahead. The chain of destiny can only be grasped one link at a time. Sir Winston Churchill (1874 - 1965)

Purely here for my own referecnce.
Documents
Plugin tutorial
API Index


Scrawled illegibly by Meathe at 03:37 PM

Movable Type

July 01, 2005

Entry protection (again)

I've hit two major issues with the protection code. One has been raised with the developer. The second I've developed a work-around for.

If you set up typekey protection, you must enter at least one TypeKey user in the list who can access it. It does not automatically give the author access to the post, and failing to enter at least one name in the list will break your pages, resulting in a white screen and a nasty little PHP error message.

The other visual problem I've encountered is that I like the little horizontal lines as entry delimiters. Wrapping the entire entry up in <MTEntryProtect> or <MTProtected> hides all of this and the posts tend to run together - especially where there is one protected entry following another, resulting in this kind of thing:


Where there are actually three protected entries, very much jumbled together. The first (This Post is password protected) has a login box. The second (Hello Meathe. You do not...) is TypeKey protected, though I do not have rights to read it, and the third (Thanks for signing in) is TypeKey protected, and I do have rights to read it.

It's hard to sort out visually, especially if, like me, you like the horizontal line and post date to delimit the end of each entry.

It involves fiddling your templates, though it is more or less a paste in fix (for index.php, anyway). You have been warned.

The original template will have code like this in it:

<MTEntries>
<MTProtected>
<$MTEntryTrackbackData$>
<MTDateHeader>
<h2><$MTEntryDate format="%x"$></h2>
</MTDateHeader>
<h3 id="a<$MTEntryID pad="1"$>"><$MTEntryTitle$></h3>
<$MTEntryBody$>
<MTEntryIfExtended>
<p class="extended"><a href="<$MTEntryPermalink$>#more">Continue reading "<$MTEntryTitle$>"</a></p>
</MTEntryIfExtended>
<p class="posted">Posted by <$MTEntryAuthor$> at <a href="<$MTEntryPermalink valid_html="1"$>"><$MTEntryDate format="%X"$></a>
<MTEntryIfAllowComments>
| <a href="<$MTEntryPermalink archive_type="Individual"$>#comments">Comments (<$MTEntryCommentCount$>)</a>
</MTEntryIfAllowComments>
<MTEntryIfAllowPings>
| <a href="<$MTEntryPermalink archive_type="Individual"$>#trackbacks">TrackBack (<$MTEntryTrackbackCount$>)</a>
</MTEntryIfAllowPings>
</p>
</MTProtected>
</MTEntries>

Which will hide the title and body of the post if someone is not authorised, with unfortunate effect that it also hides the post date and that nifty horizontal divider.

So here is the drop-in replacement (added code underlined):


<MTEntries>
<$MTEntryTrackbackData$>
<?PHP $ThisEntryProtected=0; ?>
<MTIfProtected>
<?PHP $ThisEntryProtected = 1; ?>
</MTIfProtected>

<MTEntryProtect>
<?PHP $ThisEntryProtected = 0; ?>
<MTDateHeader>
<h2><$MTEntryDate format="%x"$></h2>
</MTDateHeader>
<h3 id="a<$MTEntryID pad="1"$>"><$MTEntryTitle$></h3>
<MTEntryBody>
<MTEntryIfExtended>
<p class="extended"><a href="<$MTEntryPermalink$>">Continue reading "<$MTEntryTitle$>"</a></p>
</MTEntryIfExtended>
</MTEntryProtect>
<p class="posted">Posted by <$MTEntryAuthor$> to <$MTEntryCategory$> at <a href="<$MTEntryPermalink valid_html="1"$>"><$MTEntryDate format="%X"$></a>
<?PHP if($ThisEntryProtected==0) { ?>
<MTEntryIfAllowPings>
| <a href="<$MTEntryPermalink archive_type="Individual"$>#trackbacks">TrackBack (<$MTEntryTrackbackCount$>)</a>
</MTEntryIfAllowPings>
<MTEntryIfAllowComments>
| <a href="<$MTEntryPermalink archive_type="Individual"$>#comments">Comments (<$MTEntryCommentCount$>)</a>
</MTEntryIfAllowComments>
<?PHP } ?>
</p>
</MTEntries>

This is very similar to the way I have it set up on my main page (though I have titles of the entries outside the MTEntryProtect, visible to anyone).

It works by employing the tag <MTIfProtected>. The MTIfProtected will run the PHP code to set $ThisEntryProtected to 1 if the entry is protected (it doesn't care if you have access or not, just if the entry is protected or not).

If the entry is protected and you have access to it, the PHP code inside the <MTEntryProtect> sets $ThisEntryProtected back to 0.

The entry is then unprotected past the entry body, so the post time is displayed, along with the wonderful little horizontal bar.

Further down, with the trackbacks and comments, there's more PHP code. If $ThisEntryProtected is 0 (either you have access or it's unprotected), you will get the link to the comments and trackbacks. Otherwise, you will only get the post date (and divider).

Surprisingly simple code, surprising amount of trial and error ( MTIfProtected doesn't work quite as I expected it to).

Scrawled illegibly by Meathe at 11:17 AM

Movable Type

June 30, 2005

MT Protect upgrade

The version of MT Protect on this server was upgraded, adding a few new features.

The tag <MTEntryProtect> is now functional
The tag <MTIfProtected> is working

Groups have been added - you can now build a group of (TypeKey) friends in the MT Protect configuration. These are used when protecting entries with group:

Creating a group


Adding a group to the userlist


I believe I have all of the wrinkles out, and you should not experience any troubles. Having said that, some data formats were changed (radically) in this release, requring some manual conversions to the protection lists in the database. If anyone has any trouble altering protection on entries that were previously TypeKey protected, please let me know and it will be fixed.

Thanks.

Scrawled illegibly by Meathe at 03:13 PM

Movable Type

June 29, 2005

Standard Password protection test (password=test).

MT, you treacherous siren, you.

The protection bug is fixed here, a submit form was not passing a parameter that it should have. Perl script touched up, all seems good.

Scrawled illegibly by Meathe at 12:41 PM

Movable Type

June 28, 2005

Typekey, restricted comments and protected entries.

"The secret to creativity is knowing how to hide your sources."

Albert Einstein

I'll be damned. I'm actually finding myself curious as to how all this works.

I see interesting things. I've set up typekey identification for comments, which will be automatically approved. Non-typekey comments will be manually vetted.

Update -

Actually, even though both options may be checked simultaneously in the config, it seems it's an either-or thing. You must have a typekey ID to leave comments for the moment.

But how?

For this, you need to register for a typekey account, if you haven't already. Make sure you add the blog host URL to the Weblog preferences (do not use your account name) - http://www.moreblogsofroleplay.com/, not http://www.moreblogsofroleplay.com/Meathe. The trailing slash is important.

Once you're all registered, to set this up on your blog, go to the blog config, Preferences, check the Accept Comments from Registered Visitors. Paste in your typekey token (available from your account at TypeKey).

Having done that, I thought I'd try something new. There is one feature I'm quite interested in, though I never had managed to make it work. Strega, you did set it up correctly! Password and TypeKey protection for entries.

Update-

It seems MTProtect has SQL issues when using it's own password access control. I'm looking into where it goes wrong in the source, however, it's probably better to save yourself the headache and stick with TypeKey authentication. Bug squished.

It's the documentation that's incorrect (and incomplete). <MTProtectEntry> (recomended by them) simply does not work. <MTProtected> does.

So now you must fiddle with your templates - main index, master archive index, Category Archive, Date Based Archive, Individual Entry Archive, index.rdf, etc.

As the first line in each of these templates, add <MTProtectInclude>. This includes all the code needed to make it work.

Somewhere after <MTEntries>
...
<MTProtected>
<MTEntryBody>
....
</MTProtected>
<MTEntries>

This will display the title of the protected entry, but no content and no comments to people who have not logged in and are not approved.

For the individual entry archive, add the <MTProtected> </MTProtected> tags inside the <body></body> tags to hide all protected content.

Now the templates are working, it's time to protect an entry. Any entry you protect must be saved (as a draft is best) before you click the protect button. Then add the list of Typekey IDs you want to be able to read your entry. Any changes to these require a whole site rebuild.



Update: 29/06/2005

As these MT tags insert PHP code, you will need to change your weblog config preferences so that "Extension for Archive Files" is PHP, not HTML, and rebuild your site. Otherwise, the PHP code will not be interpretted correctly (or, indeed, at all). You also have to change your template extensions from html to php. It may take a little while for this to be fully refreshed, as it also alters your .htaccess file to make index.php the default file.

Apologies for the omission.


Scrawled illegibly by Meathe at 11:26 AM

Movable Type

MT Protection test...

Small feature test. Nothing to see here.

I'm finding half my problems are with the proxy server giving me old copies of this every time I tweak something.

Scrawled illegibly by Meathe at 09:23 AM