changeset 72:6a0c2f85faa3 draft

Canonicalize arguments for isHoliday(), which will be sent to Time.mktime().
author HIROSE Yuuji <yuuji@gentei.org>
date Thu, 29 Nov 2012 10:21:21 +0900
parents 156f315f52b8
children 8b8cb30b78fa
files after5.rb
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/after5.rb	Thu Jul 26 19:25:07 2012 +0900
+++ b/after5.rb	Thu Nov 29 10:21:21 2012 +0900
@@ -4,7 +4,7 @@
 # Associative Scheduling Table - after5
 # (C)2003, 2004, 2006, 2008, 2012 by HIROSE Yuuji [yuuji<at>gentei.org]
 # $Id: after5.rb,v 1.19 2012/04/01 11:52:25 yuuji Exp yuuji $
-# Last modified Thu Jul 26 19:24:15 2012 on firestorm
+# Last modified Thu Nov 29 10:17:51 2012 on firestorm
 # See http://www.gentei.org/~yuuji/software/after5/
 # このスクリプトはEUCで保存してください。
 $hgid = <<_HGID_.split[1..-2].join(" ")
@@ -834,7 +834,7 @@
 	  user = @usermap.keys.grep(user)[0]
 	end
 	next unless user
-	ud = File.join(dd, user)
+	ud = File.join(dd, user).untaint
 	next unless test(?d, ud)
 	ntl[user] = {}
 	Dir.foreach(ud){|date|
@@ -1847,10 +1847,12 @@
     ## p day, last
     while column <= last
       @O.print @H.elementln("tr", nil){
+        sunday = first + (column-1)*3600
 	(column..column+6).collect{|d|
 	  todayp = (day.year==todayy && day.month==todaym && d==todayd)
 	  wd=d-column
-	  hd = holiday.isHoliday(day.year, day.month, d, wd)
+          thisday = sunday+3600*wd
+	  hd = holiday.isHoliday(thisday.year, thisday.month, thisday.day, wd)
 	  tdclass['class'] = (hd ? 'holiday' : wname[wd])
 	  @H.element("td", tdclass){
 	    if d>0 

yatex.org