It appears to me that the javascript shipped in the open source movable type for Ubuntu Intrepid (8.10) is broken. To be fair, it is listed as beta. Anyway, details and a fix follow …
It contains code like this:
if (u.is_authenticated) {
u.is_anonymous = false;
} else {
u.is_anonymous = true;
}
The problem appears to be that the u(ser) object stores boolean 0/1 values as strings (with the character “0” or “1”), and a string of “0” evaluates to true (at least on the currently stable releases Firefox 3.0.8, Safari 4 - 5528.16 and Opera 9.63 on a Mac).
Try it yourself:
<script type=text/javascript>
if ("0") { alert('true!'); }
</script>
If you want to confirm this in the MovableType code, find the web root of your blog (/var/www/… in Ubuntu), then find your mt.js
find . -name mt.js -print
edit it, find the function mtBakeUserCookie(u) and add these lines just before the return str at the end:
alert('is_authenticated set to ' + u.is_authenticated);
if (u.is_authenticated) { alert('and it is true'); }
clear all your cookies, visit a post on your blog and click the “sign in” link to post a comment (assuming you have comments enabled). It should trigger the alert. if (u.is_authenticated) will evaluate to true.
Republish your blog via your web admin UI and it’ll republish mt.js which will undo your edits.
(If you want the change to be permanent, then via the web admin UI: Select your blog via the little triangle top left, then Design menu -> Templates. The top section “Index Templates”, contains a row for “JavaScript, mt.js, Static”. Click on the “JavaScript” link to edit. These changes are permenant and I don’t see any revision control, so be careful … aka, take a backup before you start.)
Happily this bug appears to be fixed in Ubuntu Jaunty 9.04 (it looks like it stores booleans as boolean/integers, not as strings … if (0) does what you expect where if ("0") does not), which is due for release 23rd April 2009. And it looks like the “beta” tag has been removed too. Win!
If you particularly need to upgrade before then (or without doing a full system upgrade) then we can upgrade just the movabletype packages to those in Jaunty. This worked for me, but there are no guarantees - in general it isn’t clever to be using packages meant for Jaunty on a box running Intrepid!
I’d strongly encourage you to backup everything before you start (the database & your web directories).
Edit your /etc/apt/sources.list adding a line for jaunty, eg:
- deb http://gb.archive.ubuntu.com/ubuntu jaunty main restricted universe multiverse
then:
- sudo aptitude update
- sudo aptitude install movabletype-opensource
- sudo aptitude install movabletype-plugin-core
now removed the jaunty line you just added from /etc/apt/sources.list and re-run
- sudo aptitude update
After upgrading, be sure to login to the web admin ui, and go to:
- System Overview (top left, from the triangle below the MovableType logo)
- Preferences
- General
and set the System Email address, else new registrations won’t get their email to confirm their account.


Leave a comment