madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[ljcom] r11468: LJSUP-11241: process method for /latest ...

Committer: sbelyaev
LJSUP-11241: process method for /latest uri is changed
A   trunk/htdocs/misc/latest.bml
Added: trunk/htdocs/misc/latest.bml
===================================================================
--- trunk/htdocs/misc/latest.bml	                        (rev 0)
+++ trunk/htdocs/misc/latest.bml	2012-02-13 14:33:10 UTC (rev 11468)
@@ -0,0 +1,25 @@
+<?_code
+{
+    use strict;
+    my $u = LJ::get_active_journal();
+
+    if (!$u) {
+        warn "no user";
+        LJ::Request->pnotes ('error' => 'e404');
+        LJ::Request->pnotes ('remote' => LJ::get_remote());
+        BML::return_error_status(404);
+        return;
+    }
+
+    my $latest_item = LJ::get_latest_ditemid($u);
+    if (!$latest_item) {
+        warn "no ditemid";
+        LJ::Request->pnotes ('error' => 'e404');
+        LJ::Request->pnotes ('remote' => LJ::get_remote());
+        BML::return_error_status(404);
+    }
+    
+    my $latest_link = $u->journal_base . "/$latest_item.html";
+    return BML::redirect($latest_link);
+}
+_code?>

Tags: bml, ljcom, madeon, sbelyaev
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments