Fun with drafts

Bug.

Patch.

Can’t use patches? That’s a shame. Incomprehensible as it can be, there are a lot of things Unix got right, and diff and patch are two huge ones. If I need to tell you how to change two lines in a file to fix something, I can either save a copy before I start editing, make the edits, then say diff -Naur Trackback.pm.orig Trackback.pm > NoDrafts.Trackback.pm.patch and be done with it, and you can then copy the patch to your lib/MT/App directory and type patch -p0 < NoDrafts.Trackback.pm.patch and we’re all done, or…

You can save a copy of {yourMTdir}/lib/MT/App/Trackback.pm for safety’s sake, then open it in a text editor, find the spot around line 13 where it says:

use MT::App;
@MT::App::Trackback::ISA = qw( MT::App );

and in between those two lines insert

use MT::Entry qw( HOLD RELEASE REVIEW );

so you have

use MT::App;
use MT::Entry qw( HOLD RELEASE REVIEW );
@MT::App::Trackback::ISA = qw( MT::App );

Then down around line 37 find

    my $entry = MT::Entry->load($entry_id)
        or return $app->error($app->translate(
            "Invalid entry ID '[_1]'", $entry_id));
    my $ctx = MT::Template::Context->new;

and insert

    $entry->status == RELEASE
    	or return $app->error("What are you doing in my underwear drawer?");

so you have

    my $entry = MT::Entry->load($entry_id)
        or return $app->error($app->translate(
            "Invalid entry ID '[_1]'", $entry_id));
    $entry->status == RELEASE
    	or return $app->error("What are you doing in my underwear drawer?");
    my $ctx = MT::Template::Context->new;

save it and re-upload it, and people won’t be able to see your draft entry titles by just guessing entry numbers in the Trackback “view” URL.

6 Comments

Comment by Jacques Distler #
2004-02-21 23:58:13

To give credit where credit is due, diff and patch were written by Larry Wall, the same man who invented Perl.

Comment by Phil Ringnalda #
2004-02-22 00:06:06

I actually thought about mentioning that, having oddly enough read it three times in the last week, but then I started thinking about Perl, and how diff has thirty billion options, and defaults to what you really don’t particularly want (though I’m sure there’s an extremely well-thought-out reason that would make perfect sense to me if I had several hours with an experienced Unix philosopher), and I started to smell rant on the breeze, and desisted.

 
 
Comment by Matt #
2004-02-22 10:43:51

Where do you find the time for all this?

Comment by Phil Ringnalda #
2004-02-22 11:20:15

My two main weapons are:

  1. Lots of practice at finding the fastest way to read through stuff
  2. A willingness to ignore questions that are poorly titled or annoyingly asked
  3. An odd tendency to prefer solving other people’s problems rather than my own
 
 
Comment by medya #
2004-02-25 21:45:21

can u plz tell me how did you create that nice Archive? I do have blogger acount…

Comment by Phil Ringnalda #
2004-02-25 22:00:21

Indeed you do. Is the irony of claiming in the source that it is illegal to copy or steal peopls works . when you yourself are stealing from your host by hiding the advertising that allows them to give you your blog for free completely lost on you?

 
 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <del datetime="" cite=""> <dd> <dl> <dt> <em> <i> <ins datetime="" cite=""> <kbd> <li> <ol> <p> <pre> <q cite=""> <samp> <strong> <sub> <sup> <ul> in your comment.