[Slashdotjp-dev 562] CVS update: slashjp/Slash/Utility/Environment

Back to archive index

Tatsuki SUGIURA sugi****@users*****
2006年 7月 13日 (木) 10:12:26 JST


Index: slashjp/Slash/Utility/Environment/Environment.pm
diff -u slashjp/Slash/Utility/Environment/Environment.pm:1.12 slashjp/Slash/Utility/Environment/Environment.pm:1.13
--- slashjp/Slash/Utility/Environment/Environment.pm:1.12	Wed Jul 12 21:24:22 2006
+++ slashjp/Slash/Utility/Environment/Environment.pm	Thu Jul 13 10:12:26 2006
@@ -1,7 +1,7 @@
 # This code is a part of Slash, and is released under the GPL.
 # Copyright 1997-2005 by Open Source Technology Group. See README
 # and COPYING for more information, or see http://slashcode.com/.
-# $Id: Environment.pm,v 1.12 2006/07/12 12:24:22 sugi Exp $
+# $Id: Environment.pm,v 1.13 2006/07/13 01:12:26 sugi Exp $
 
 package Slash::Utility::Environment;
 
@@ -29,11 +29,13 @@
 use Digest::MD5 'md5_hex';
 use Time::HiRes;
 use Socket qw( inet_aton inet_ntoa );
+use Encode;
+use Encode::Guess;
 
 use base 'Exporter';
 use vars qw($VERSION @EXPORT);
 
-($VERSION) = ' $Revision: 1.12 $ ' =~ /\$Revision:\s+([^\s]+)/;
+($VERSION) = ' $Revision: 1.13 $ ' =~ /\$Revision:\s+([^\s]+)/;
 @EXPORT	   = qw(
 
 	dbAvailable
@@ -2687,18 +2689,26 @@
 		$hostname =~ s/:\d+$//;
  
 		my $skins = $reader->getSkins;
-		($skin) = grep {
+		my @potSkin = grep {
 				(my $tmp = lc $skins->{$_}{hostname} || '') =~ s/:\d+$//;
 				$tmp eq lc $hostname
 			} sort { $a <=> $b } keys %$skins;
 
+		# match /section/...,  / is matched to
+		if ($r->uri() =~ m|^/(\w+)/|){
+			my $key = $1;
+			($skin) = grep {$skins->{$_}{name} eq $key } @potSkin;
+		} else {
+			($skin) = @potSkin;
+		}
+
 		# don't bother warning if $hostname is numeric IP
 		if (!$skin && $hostname !~ /^\d+\.\d+\.\d+\.\d+$/) {
 			$skin = getCurrentStatic('mainpage_skid');
 			if (!$skin) {
 				errorLog("determineCurrentSkin called but no skin found (even default) for '$hostname'\n");
 			} else {
-				errorLog("determineCurrentSkin called but no skin found (so using default) for '$hostname'\n");
+				#errorLog("determineCurrentSkin called but no skin found (so using default) for '$hostname'\n");
 			}
 		}
 	} else {
@@ -3399,4 +3409,4 @@
 
 =head1 VERSION
 
-$Id: Environment.pm,v 1.12 2006/07/12 12:24:22 sugi Exp $
+$Id: Environment.pm,v 1.13 2006/07/13 01:12:26 sugi Exp $


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