Первый фоллен на хелле (wildkin) wrote in changelog,
Первый фоллен на хелле
wildkin
changelog

[livejournal] r18990: LJSUP-8699: Friends page calendar with u...

Committer: dnikolaev
LJSUP-8699: Friends page calendar with urls like 'http://username.livejournal.com/friends/YYYY/MM/DD'

U   trunk/cgi-bin/LJ/S2/FriendsPage.pm
U   trunk/cgi-bin/LJ/TimeUtil.pm
U   trunk/cgi-bin/ljviews.pl
Modified: trunk/cgi-bin/LJ/S2/FriendsPage.pm
===================================================================
--- trunk/cgi-bin/LJ/S2/FriendsPage.pm	2011-04-27 09:29:01 UTC (rev 18989)
+++ trunk/cgi-bin/LJ/S2/FriendsPage.pm	2011-04-27 09:34:10 UTC (rev 18990)
@@ -90,10 +90,17 @@
     my $filter;
     my $group_name    = '';
     my $common_filter = 1;
-    my $events_date   = ($get->{date} =~ m!^(\d{4})-(\d\d)-(\d\d)$!)
-                        ? LJ::TimeUtil->mysqldate_to_time("$1-$2-$3")
-                        : 0;
 
+    my $events_date = 0;
+    my $pathextra = $opts->{pathextra};
+    if ($pathextra && $pathextra =~ m/^\/(\d\d\d\d)\/(\d\d)\/(\d\d)\/?$/) {
+        $events_date = LJ::TimeUtil->mysqldate_to_time("$1-$2-$3");
+        $pathextra = '';
+    }
+    elsif ($get->{date} =~ m!^(\d{4})-(\d\d)-(\d\d)$!) {
+        $events_date = LJ::TimeUtil->mysqldate_to_time("$1-$2-$3");
+    }
+
     if (defined $get->{'filter'} && $remote && $remote->{'user'} eq $user) {
         $filter = $get->{'filter'};
         $common_filter = 0;
@@ -102,8 +109,8 @@
     } else {
 
         # Show group or day log
-        if ($opts->{'pathextra'}) {
-            $group_name = $opts->{'pathextra'};
+        if ($pathextra) {
+            $group_name = $pathextra;
             $group_name =~ s!^/!!;
             $group_name =~ s!/$!!;
 

Modified: trunk/cgi-bin/LJ/TimeUtil.pm
===================================================================
--- trunk/cgi-bin/LJ/TimeUtil.pm	2011-04-27 09:29:01 UTC (rev 18989)
+++ trunk/cgi-bin/LJ/TimeUtil.pm	2011-04-27 09:34:10 UTC (rev 18990)
@@ -74,6 +74,7 @@
 
     # then fix the day up, if so.
     my $max_day = LJ::TimeUtil->days_in_month($mon, $y);
+    return undef unless defined $max_day;
     $d = $max_day if $d > $max_day;
     return $calc->();
 }

Modified: trunk/cgi-bin/ljviews.pl
===================================================================
--- trunk/cgi-bin/ljviews.pl	2011-04-27 09:29:01 UTC (rev 18989)
+++ trunk/cgi-bin/ljviews.pl	2011-04-27 09:34:10 UTC (rev 18990)
@@ -1671,12 +1671,22 @@
     my $group;
     my $common_filter = 1;
 
+    my $events_date = 0;
+    my $pathextra = $opts->{pathextra};
+    if ($pathextra && $pathextra =~ m/^\/(\d\d\d\d)\/(\d\d)\/(\d\d)\/?$/) {
+        $events_date = LJ::TimeUtil->mysqldate_to_time("$1-$2-$3");
+        $pathextra = '';
+    }
+    elsif ($get->{date} =~ m!^(\d{4})-(\d\d)-(\d\d)$!) {
+        $events_date = LJ::TimeUtil->mysqldate_to_time("$1-$2-$3");
+    }
+
     if (defined $get->{'filter'} && $remote && $remote->{'user'} eq $user) {
         $filter = $get->{'filter'};
         $common_filter = 0;
     } else {
-        if ($opts->{'pathextra'}) {
-            $group = $opts->{'pathextra'};
+        if ($pathextra) {
+            $group = $pathextra;
             $group =~ s!^/!!;
             $group =~ s!/$!!;
             if ($group) { $group = LJ::durl($group); $common_filter = 0;}
@@ -1692,10 +1702,6 @@
         }
     }
 
-    my $events_date   = ($get->{date} =~ m!^(\d{4})-(\d\d)-(\d\d)$!)
-                        ? LJ::TimeUtil->mysqldate_to_time("$1-$2-$3")
-                        : 0;
-
     ## load the itemids
     my %friends;
     my %friends_row;

Tags: livejournal, pl, pm, wildkin
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