[Slashdotjp-dev 1140] [667] * Redirect to mobile story page when mobile clients come to normal shtml

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 6月 19日 (木) 18:52:07 JST


Revision: 667
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=667
Author:   tach
Date:     2008-06-19 18:52:07 +0900 (Thu, 19 Jun 2008)

Log Message:
-----------
* Redirect to mobile story page when mobile clients come to normal shtml

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-06-19 09:00:09 UTC (rev 666)
+++ slashjp/branches/2.5.0.192/Slash/Apache/Apache.pm	2008-06-19 09:52:07 UTC (rev 667)
@@ -360,6 +360,20 @@
 		return DECLINED;
 	}
 
+	# REDIRECT article page shtml for mobile mode
+	if ($uri !~ m|^$constants->{mobile_urlpath}/| && $uri =~ m|^/\w+/(\d{2}/\d{2}/\d{2}/\d{6,})\.shtml|) {
+		my $sid = $1;
+		if ($constants->{mobile_enabled}) {
+			if (($constants->{mobile_useragent_regex} &&
+			     $r->header_in('user-agent') =~ $constants->{mobile_useragent_regex}) ||
+			     $r->args() =~ m{\bm=[1-9a-zA-Z]}) {
+				my $newuri = $constants->{real_rootdir}.$constants->{mobile_urlpath}."/$sid.shtml";
+				redirect($newuri);
+				return DONE;
+			}
+		}
+	}
+
 	# Comment this in if you want to try having this do the right
 	# thing dynamically
 	# my $slashdb = getCurrentDB();

Modified: slashjp/branches/2.5.0.192/debian/changelog
===================================================================
--- slashjp/branches/2.5.0.192/debian/changelog	2008-06-19 09:00:09 UTC (rev 666)
+++ slashjp/branches/2.5.0.192/debian/changelog	2008-06-19 09:52:07 UTC (rev 667)
@@ -30,8 +30,9 @@
   * Fix to specify correct ssi include file for mobile mode
   * Fix linkStory() for mobile mode
   * Show mobile mode page when useragent matches "mobile_useragent_regex"
+  * Redirect to mobile story page when mobile clients come to normal shtml
 
- -- Taku YASUI <tach****@osdn*****>  Thu, 19 Jun 2008 08:59:14 +0000
+ -- Taku YASUI <tach****@osdn*****>  Thu, 19 Jun 2008 09:51:05 +0000
 
 slash (2.5.0.192-12) unstable; urgency=low
 


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