[Slashdotjp-dev 1218] [746] Redirect to new journal RSS URL

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 9月 16日 (火) 21:46:01 JST


Revision: 746
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=746
Author:   tach
Date:     2008-09-16 21:46:01 +0900 (Tue, 16 Sep 2008)

Log Message:
-----------
Redirect to new journal RSS URL

Modified Paths:
--------------
    slashjp/branches/2.5.0.192/Slash/Apache/Apache.pm
    slashjp/branches/2.5.0.192/debian/changelog


-------------- next part --------------
Modified: slashjp/branches/2.5.0.192/Slash/Apache/Apache.pm
===================================================================
--- slashjp/branches/2.5.0.192/Slash/Apache/Apache.pm	2008-09-16 12:03:04 UTC (rev 745)
+++ slashjp/branches/2.5.0.192/Slash/Apache/Apache.pm	2008-09-16 12:46:01 UTC (rev 746)
@@ -354,6 +354,31 @@
 	#	$uri =~ s/^\Q$path//;
 	#}
 
+	# redirect to new journal rss URL for slashdot.jp (2008-09-16, tach)
+	# Before: /journal.pl?op=display&uid=3&content_type=rss
+	# After: /~tach/journal/rss
+	if ($uri =~ m!/journal\.pl! && $r->the_request =~ m!\bcontent_type=rss\b!) {
+		my $qs = {$r->the_request =~ m!\b(uid|op|nick|type)=([-\w/+%]+)!g};
+		if (defined($qs->{uid}) && $qs->{uid} =~ /^\d+$/) {
+			my $slashdb = getCurrentDB();
+			my $nick = $slashdb->getUser($qs->{uid}, 'nickname');
+			if ($nick) {
+				redirect("$constants->{absolutedir}/~".URI::Escape::uri_escape($nick)."/journal/rss", 301);
+			} else {
+				return NOT_FOUND;
+			}
+		} elsif (defined($qs->{nick})) {
+			$qs->{nick} =~ s/\+/%20/g;
+			redirect("$constants->{absolutedir}/~$qs->{nick}/journal/rss", 301);
+		} elsif (defined($qs->{type}) && $qs->{type} eq 'count' || $qs->{type} eq 'friends') {
+			# not impremented (2008-09-16, tach)
+		} else {
+			redirect("$constants->{absolutedir}/journals/rss", 301);
+		}
+	} elsif ($r->the_request =~ m!\bcontent_type=rss\b! && $uri =~ m!/~([^/]+)/journal!i) {
+		redirect("$constants->{absolutedir}/~".URI::Escape::uri_escape($1)."/journal/rss", 301);
+	}
+
 	# return shtml internally when AC
 	# for slashdot.jp (2008-07-17)
 	if ($uri =~ m!^/(\w+/)?article\.pl$! && !$is_user) {

Modified: slashjp/branches/2.5.0.192/debian/changelog
===================================================================
--- slashjp/branches/2.5.0.192/debian/changelog	2008-09-16 12:03:04 UTC (rev 745)
+++ slashjp/branches/2.5.0.192/debian/changelog	2008-09-16 12:46:01 UTC (rev 746)
@@ -12,8 +12,9 @@
   * Add logcheck ignore rule for SearchEst
   * Add plugins/Journal/journal_update_slashbox.pl to create topjournal blocks
   * Add feature to change redirect status code on redirect()
+  * Redirect to new journal RSS URL
 
- -- Taku YASUI <tach****@osdn*****>  Tue, 16 Sep 2008 12:02:15 +0000
+ -- Taku YASUI <tach****@osdn*****>  Tue, 16 Sep 2008 12:45:27 +0000
 
 slash (2.5.0.192-16) unstable; urgency=low
 


Slashdotjp-dev メーリングリストの案内
Back to archive index