#! /usr/bin/perl # # evcal.cgi # イベントカレンダー # # 1.040 : 7/18/08 : 過去ログ一ヶ月表示のバグを修正 # 1.039 : 6/12/08 : 携帯モードでの管理人オンリーモード変更画面を修正 # 1.038 : 6/10/08 : 携帯モードでの管理人オンリーモードを修正 # 1.037 : 5/27/08 : グループモードを追加 # 1.036 : 5/9/08 : SSIモードの携帯での表示を修正 # 1.035 : 4/28/08 : 携帯モードの今日へジャンプを修正 # 1.034 : 3/21/08 : 過去ログ一ヶ月表示のバグを修正 # 1.033 : 2/24/08 : Macのブラウザでトップへのリンクが機能するよう修正 # 1.032 : 2/15/08 : 管理人オンリーモードでリンク非表示時の携帯モードを修正。プルダウン日付登録を修正 # 1.031 : 1/28/08 : 毎週イベント設定を追加 # 1.030 : 11/10/07 : 携帯モードのパスワードミスのページを修正 # ページ下部へのHTML挿入文を追加 # 過去ログ1ページ表示長の設定を追加 # 管理人オンリーモード時の追加変更リンク非表示オプション追加 # 1.029 : 10/16/07 : 携帯モード「今日へジャンプ」リンクを追加 # 1.028 : 9/13/07 : 携帯モードで記念日を正確に表示できるよう修正 # 1.027 : 9/1/07 : SSIモードで記念日を正確に表示できるよう修正 # 1.026 : 7/29/07 : 記念日に第何曜日指定を出来るように修正 # 1.025 : 5/22/07 : 携帯用のトップへのリンクオプションを追加 # 1.024 : 3/24/07 : タグのミスを修正 # 1.023 : 1/14/07 : SSIモードの複数行表示を修正 # 1.022 : 12/5/06 : カラーコードの#を自動で付加するよう修正 # 1.021 : 11/6/06 : SSIモードのイベント無しメッセージが無いときの処理を修正 # 1.020 : 11/5/06 : SSIモードを強化 # 1.019 : 8/14/06 : データファイルのパーミッションを修正 # 1.018 : 8/6/06 : フォームのテキストを修正 # 1.017 : 6/27/06 : 半角スペースを表示するように修正 # 1.016 : 6/26/06 : 過去ページの戻るリンク名を修正 # 1.015 : 6/20/06 : 管理人オンリーモードを追加 # 1.014 : 6/14/06 : 更新リンクを更新者にした時のリンクを修正 # 1.013 : 6/13/06 : 携帯モードを追加 # 1.012 : 10/31/05 : 記念日オプションを追加 # 1.011 : 10/29/05 : 表示開始月のオプションを追加 # 1.010 : 10/11/05 : カラーコードのチェックを追加 # 1.009 : 10/6/05 : 書きこみイベント日の背景色変更のオプションを追加 # 1.008 : 10/1/05 : Copyrightにリンクを追加 # 1.007 : 9/25/06 : テンポラリファイルが残るバグを修正 # 1.006 : 9/19/05 : 更新リンクを更新者にするオプションを追加 # その際のURLの自動リンク機能を追加 # 1.005 : 8/29/05 : デコードを修正 # 1.004 : 8/25/05 : cryptを修正 # 1.003 : 8/22/05 : 更新者欄の幅を変更できるオプションを追加 # 1.002 : 8/12/05 : データファイルが無い時のエラー処理を追加 # 1.001 : 8/9/05 : SSIモード追加 # 1.0 : 8/8/05 : 一般公開のために大幅改良 # # http://www.hidekik.com/ # # $Id: evcal.cgi,v 1.78 2008/07/18 14:57:49 Hideki Kanayama Exp $ # Copyright(c) 1997-2008, Hideki Kanayama, All rights reserved.# use File::Basename; use Time::Local; use strict; use CGI::Carp qw(fatalsToBrowser); use CGI qw(:cgi-lib); my $lastupdatedyear = 2008; my $version = "1.040"; my $script = basename($0); my $setupfile = "evcal_setup.pl"; my $admindat = "adminpwd.dat"; my $groupdat = "grouppwd.dat"; my $lang = 0; ##################################### # データファイル名 our $datafile = "eventcal.dat"; # lockfile our $lockfile = "lockfile.dat"; # 戻りリンク 1:on 0:off our $backlink_en = 1; our $backlink = "../evcal.html"; our $backlink_name = '【戻る】'; our $mob_backlink = "../evcal.html"; our $mob_backlink_name = '【戻る】'; # バックグラウンド our $bgimage_en = 0; our $bgcolor = 'white'; our $bgimage_file = ''; # カレンダーの色 # ヘッダの背景 our $table_head_bgcolor = 'white'; # ヘッダの文字 our $table_head_color = 'black'; # 更新者の色 our $post_name_color = 'black'; # 更新日の色 our $post_update_color = 'black'; # 平日の背景 our $weekday_bgcolor = 'white'; # 土曜日の背景 our $sat_bgcolor = '#ccffff'; # 日曜日の背景 our $sun_bgcolor = '#ffcccc'; # 日付、内容の文字色はスタイルシートのリンク色の設定で行ってください。 # 日付はclass=daylink, コメントはclass=comlinkとなっています。 # 更新リンク 0:内容 1:更新者 our $update_link = 0; # 更新者を内容更新のリンクに設定した場合はスタイルシートで色の設定を # 行ってください。class=namelinkとなっています。 # その場合の内容の色 our $post_com_color = 'black'; # 本文中のリンクを文字列に置き換える 1:on 0:off # この機能をONにするには更新リンクを更新者に設定してください。 our $link_replace_en = 1; our $link_replace = 'リンクはこちら'; our $link_replace_top_en = 0; # 書き込んだイベントのバックグランドの色 1:on 0:off our $day_bgcolor_en = 0; # 表の幅 our $body_width = 100; # 更新者欄の幅 our $name_width = 10; #表示開始月 0:今月 1:先月 our $start_month = 0; # 表示する月数 our $disp_length = 12; our $disp_length_other = ''; # 過去ログ表示月数 0:一ヶ月 1:1年 our $past_length = 1; # タイトル our %title = ( display => { text => 'イベントカレンダー', image => '', color => 'black', size => '+1', face => '', style => '', sel => 0, # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート loc => 1, # 0:左、1:中、2:右 }, register => { text => 'のイベント登録', image => '', color => 'black', size => '+1', face => '', style => '', sel => 0, # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート loc => 1, # 0:左、1:中、2:右 }, modify => { text => 'のイベントの変更', image => '', color => 'black', size => '+1', face => '', style => '', sel => 0, # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート loc => 1, # 0:左、1:中、2:右 }, setadminpwd => { text => '管理人用パスワードを設定してください。', sel => 4, }, setgradminpwd => { text => 'グループ用パスワードを設定してください。', sel => 4, }, setup => { text => '管理人セットアップ', sel => 4, }, ); # ジャンプリンク 1:on 0:off our $jumplink_en = 1; our $jumplink_name = '【「今日」へジャンプ】'; # 携帯モードリンク 1:on 0:off our $mobilelink_en = 1; our $mobilelink_name = '【携帯モード】'; # セットアップリンク 1:on 0:off our $setup_en = 1; our $setup_name = '【管理用】'; # 記念日設定 our $anniv_en = 0; our $anniv = '1,1,#ffcccc,#0000ee,元旦 1,dai-2-mon,#ffcccc,#0000ee,成人の日 2,11,#ffcccc,#0000ee,建国記念日 4,29,#ffcccc,#0000ee,昭和の日 5,3,#ffcccc,#0000ee,憲法記念日 5,4,#ffcccc,#0000ee,みどりの日 5,5,#ffcccc,#0000ee,子供の日 7,dai-3-mon,#ffcccc,#0000ee,海の日 9,dai-3-mon,#ffcccc,#0000ee,敬老の日 10,dai-2-mon,#ffcccc,#0000ee,体育の日 11,3,#ffcccc,#0000ee,文化の日 11,23,#ffcccc,#0000ee,勤労感謝の日 12,23,#ffcccc,#0000ee,天皇誕生日'; # グループモード our $group_en = 0; # 管理人オンリーモード our $adminonly_en = 0; # 管理人オンリーモード時に登録ボタンとリンクの表示 1:表示, 0:非表示 our $admin_reglinks = 1; # SSIモード # イベントが無い時の表示 our $ssi_noev_msg = 'イベントはありません。'; # 本日を含めてイベントを表示する日数 our $ssi_evdisp = 3; # イベント表示時の日付表示 1:on 0:off our $ssi_evdate_en = 1; #スタイルシート 1:on 0:off our $style_sheet_en = 1; our $style_sheet = ' A:link {text-decoration: none} A:visited {text-decoration: none} A:active {text-decoration: none} '; #〜内に挿入できる構文 1:on, 0:off our $head_insert_en = 0; our $head_insert = ''; #使い方 our $usage_en = 1; our $usage_name = '【使い方】'; our $usage = '

使い方

'; #上部に表示させる文 1:on, 0:off our $body_insert1_en = 1; our $body_insert1 = '
'; our $body_insert2_en = 0; our $body_insert2 = ''; our $body_insert3_en = 0; our $body_insert3 = ''; our $body_insert4_en = 0; our $body_insert4 = ''; our $body_insert5_en = 0; our $body_insert5 = ''; our $body_insert6_en = 1; our $body_insert6 = '
'; #下部に表示させる文 1:on, 0:off our $body_insert7_en = 0; our $body_insert7 = ''; # 時間設定 GMTからのオフセット 日本:+9 our $offset = 9; #################################### require "$setupfile" if (-e "$setupfile"); my $q = CGI->new; my $cgierror = $q->cgi_error; &error($cgierror) if ($cgierror); my %in = $q->Vars; &postprocess; if ($script eq 'evmobile.cgi'){ $script = 'evcal.cgi'; $in{mode} = 'mobile'; } if (! -e "$admindat"){ if ($in{mode} eq 'wradminpwd'){ &wradminpwd; } else { &setadminpwd; } } my $grouppwd; if ($group_en){ if (! -e "$groupdat"){ if ($in{mode} eq 'grwradminpwd'){ &wradminpwd; } else { &setadminpwd($groupdat); } } open(FILE,"< $groupdat") or &error("$groupdatが開けません。"); $grouppwd = ; close(FILE); } if ($script eq 'evssi.cgi'){ $script = 'evcal.cgi'; $in{mode} = 'ssi'; } my $host = $ENV{'REMOTE_HOST'}; my $ip = $ENV{'REMOTE_ADDR'}; my @weekday = ('日','月','火','水','木','金','土'); my $day; my $now = time+$offset*3600; #my $now = time+$offset*3600 + 24 * 30 * 3600; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime($now); if ($start_month == 1){ $mon--; if ($mon < 0){ $mon = 11; $year--; } } my $next_mon = $disp_length+$mon; my $next_year = $year; if ($next_mon > 11){ $next_year += int($next_mon/12); $next_mon %= 12; } my $start_day = timegm(0,0,0,1,$mon,$year); my $end_day = timegm(0,0,0,1,$next_mon,$next_year) - 1; if ($in{mode} eq 'register') { ®ister; } elsif ($in{mode} eq 'evwrite') { &evwrite; } elsif ($in{mode} eq 'modify') { &modify; } elsif ($in{mode} eq 'evreplace') { &evreplace; } elsif ($in{mode} eq 'setup') { &setup; } elsif ($in{mode} eq 'setupwrite') { &setupwrite; } elsif ($in{mode} eq 'ssi') { &evssi; } elsif ($in{mode} eq 'mobile') { &evmobile; } elsif ($in{mode} eq 'mobile_admin') { &mobile_admin; } else { &display; } sub display { my $subname = 'display'; my $caldata; my $calname; my $caldate; my $calid; my $i; my $pastyear; my $calbg; my $calfg; my $pastmon; if ($in{mode} eq 'past'){ if ($past_length){ $start_day = timegm(0,0,0,1,0,$in{year}); $end_day = timegm(59,59,23,31,11,$in{year}); } else { if ($in{pastmon} eq ''){ $pastmon = 0; } else { $pastmon = $in{pastmon}-1; } $start_day = timegm(0,0,0,1,$pastmon,$in{year}); $end_day = timegm(59,59,23,&lastday($pastmon,$in{year}),$pastmon,$in{year}); } } my $origtitle = "$title{$subname}{text}"; if ($in{mode} eq 'past'){ $title{$subname}{text} = "$in{year}年"; $title{$subname}{sel} = 1 if ($title{$subname}{sel} == 2); } &htmlhead($title{$subname}{text}); print "\n"; my $titleprint=&titleprint($title{$subname}); print "$body_insert1\n" if ($body_insert1_en == 1); print "$titleprint\n"; print "$body_insert2\n" if ($body_insert2_en == 1); if ($in{mode} eq 'past') { print "【$origtitleへ】

\n"; } else { &inputform($now) unless ($adminonly_en and $admin_reglinks == 0); print "$body_insert3\n" if ($body_insert3_en == 1); &updateinfo; print "$body_insert4\n" if ($body_insert4_en == 1); &misclink($now); print "$body_insert5\n" if ($body_insert5_en == 1); } ($caldata, $calname, $caldate, $calid, $pastyear, $calbg, $calfg) = &getevdata; my @pastarray; # if ($in{mode} ne 'past'){ @pastarray = sort {$a <=> $b} @{$pastyear}; if ($#pastarray != -1){ foreach ($pastarray[0] .. $year+1900){ print "$_年 "; } } # } if ($in{mode} eq 'past'){ print "
\n"; foreach (1 .. 12){ if ($past_length){ print "$_月 \n"; } else { print "$_月 \n"; } } } print "$body_insert6\n" if ($body_insert6_en == 1 && $in{mode} ne 'past'); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; my @comment; my @name; my @update; my @id; my @day_bgcolor; my @day_fgcolor; my @week_number; for ($i=$start_day;$i<=$end_day;$i+=86400) { my $col_bgcolor; my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=gmtime($i); if ((gmtime($i - 604800))[4] != $mon) { # 7 * 86400 = 604800 last week $week_number[$wday] = 1; } else { $week_number[$wday]++; } print "\n"; $mon++; $year += 1900; if ($wday == 0){ $col_bgcolor = "$sun_bgcolor"; } elsif ($wday == 6) { $col_bgcolor = "$sat_bgcolor"; } else { $col_bgcolor = "$weekday_bgcolor"; } my @weekname = qw(sun mon tue wed thu fri sat); my $dai_day = "dai-$week_number[$wday]-$weekname[$wday]"; my ($comment_ref, $name_ref, $update_ref, $id_ref, $day_bgcolor_ref, $day_fgcolor_ref) = &get_each_data($caldata, $calname, $caldate, $calid, $pastyear, $calbg, $calfg, $year, $mon, $day, $dai_day, $weekname[$wday]); @comment = @$comment_ref; @name = @$name_ref; @update = @$update_ref; @id = @$id_ref; @day_bgcolor = @$day_bgcolor_ref; @day_fgcolor = @$day_fgcolor_ref; my $rowspan = $#comment+1; print "\n"; } else { if ($adminonly_en and $admin_reglinks == 0){ print "
$mon月$day日
\n"; } else { print "$mon月$day日\n"; } } print "\n"; my $day_bgcolor; my $j; for ($j=0;$j<=$#comment;$j++){ chomp($comment[$j]); next if ($comment[$j] eq ''); if ($id[$j] eq 'anniv') { if ($day_bgcolor[$j] ne 'default') { $day_bgcolor = "$day_bgcolor[$j]"; } else { $day_bgcolor = "$col_bgcolor"; } } else { if ($day_bgcolor[$j] ne '' and $day_bgcolor_en){ $day_bgcolor = "$day_bgcolor[$j]"; } else { $day_bgcolor = "$col_bgcolor"; } } if ($day_fgcolor[$j] eq 'default'){ $day_fgcolor[$j]='black'; } print "\n"; print "\n"; my $updatedate; $updatedate = &calupdate($update[$j]); if ($id[$j] eq 'anniv'){ print "\n"; } else { print "\n"; } print "\n"; print "\n" if ($j < $#comment); } } print "
日付内容更新者更新日
"; if ($in{mode} eq 'past'){ print "$mon月$day日$weekday[$wday]"; print ""; if ($comment[$j] ne ' ' && $in{mode} ne 'past') { $comment[$j] =~ s/ / /g; if ($update_link == 0){ if ($id[$j] eq 'anniv'){ print "$comment[$j]"; } else { if ($adminonly_en and $admin_reglinks == 0){ $comment[$j] = &link_replace($comment[$j]); print "$comment[$j]"; } else { print "$comment[$j]"; } } } else { if ($id[$j] eq 'anniv'){ print "$comment[$j]"; } else { $comment[$j] = &link_replace($comment[$j]); print "$comment[$j]"; } } } else { if ($id[$j] eq 'anniv'){ print "$comment[$j]"; } else { $comment[$j] = &link_replace($comment[$j]); print "$comment[$j]"; } } print ""; if ($update_link == 0){ if ($id[$j] eq 'anniv' or $name[$j] eq ' '){ print " \n"; } else { print "$name[$j]\n"; } } else { if ($id[$j] eq 'anniv' or $name[$j] eq ' '){ print " \n"; } else { if ($adminonly_en and $admin_reglinks == 0){ print "$name[$j]\n"; } else { print "$name[$j]"; } } } print " $updatedate
\n"; print "

【イベントカレンダーへ】
\n" if ($in{mode} eq 'past'); &usage unless ($in{mode} eq 'past'); print "
$body_insert7\n" if ($body_insert7_en == 1); &htmltail; } sub evmobile { &htmlhead($title{display}{text}); print "$mob_backlink_name

\n"; print "$title{display}{text}

"; print "今日へジャンプ

\n"; &inputform($now) unless ($adminonly_en and $admin_reglinks == 0); &updateinfo; if ($adminonly_en and $admin_reglinks == 0){ print "管理用

\n"; } my ($caldata, $calname, $caldate, $calid, $pastyear, $calbg, $calfg) = &getevdata; print "

\n"; my @pastarray; my @comment; my @name; my @update; my @id; my @day_bgcolor; my @day_fgcolor; my @week_number; my $i; my ($tsec,$tmin,$thour,$tday,$tmon,$tyear,$twday,$tyday,$tisdst)=gmtime($now); for ($i=$start_day;$i<=$end_day;$i+=86400) { my $col_bgcolor; my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=gmtime($i); if ((gmtime($i - 604800))[4] != $mon) { # 7 * 86400 = 604800 last week $week_number[$wday] = 1; } else { $week_number[$wday]++; } $mon++; $year += 1900; if ($year == $tyear+1900 && $mon == $tmon+1 && $day == $tday){ print "\n"; } if ($wday == 0){ print "
$mon月$day日($weekday[$wday])"; } elsif ($wday == 6) { print "
$mon月$day日($weekday[$wday])"; } else { print "
$mon月$day日($weekday[$wday])"; } my @weekname = qw(sun mon tue wed thu fri sat); my $dai_day = "dai-$week_number[$wday]-$weekname[$wday]"; my ($comment_ref, $name_ref, $update_ref, $id_ref, $day_bgcolor_ref, $day_fgcolor_ref) = &get_each_data($caldata, $calname, $caldate, $calid, $pastyear, $calbg, $calfg, $year, $mon, $day, $dai_day, $weekname[$wday]); @comment = @$comment_ref; @name = @$name_ref; @update = @$update_ref; @id = @$id_ref; @day_bgcolor = @$day_bgcolor_ref; @day_fgcolor = @$day_fgcolor_ref; my $rowspan = $#comment+1; my $day_bgcolor; my $j; for ($j=0;$j<=$#comment;$j++){ chomp($comment[$j]); next if ($comment[$j] eq ''); if ($id[$j] eq 'anniv') { if ($day_bgcolor[$j] ne 'default') { $day_bgcolor = "$day_bgcolor[$j]"; } else { $day_bgcolor = "$col_bgcolor"; } } else { if ($day_bgcolor[$j] ne '' and $day_bgcolor_en){ $day_bgcolor = "$day_bgcolor[$j]"; } else { $day_bgcolor = "$col_bgcolor"; } } if ($day_fgcolor[$j] eq 'default'){ $day_fgcolor[$j]='black'; } if ($comment[$j] ne ' ') { print "
"; if ($update_link == 0){ if ($id[$j] eq 'anniv'){ print "$comment[$j]"; } else { if ($adminonly_en and $admin_reglinks == 0){ print "$comment[$j]"; } else { print "$comment[$j]"; } print "($name[$j])"; } } else { if ($id[$j] eq 'anniv'){ print "$comment[$j]"; } else { $comment[$j] = &link_replace($comment[$j]); print "$comment[$j]"; if ($adminonly_en and $admin_reglinks == 0){ print "($name[$j])"; } else { print "($name[$j])"; } } } print "
\n"; } else { if ($id[$j] eq 'anniv'){ print "$comment[$j]"; } else { print "
\n"; } } } } print "
\n"; &htmltail; } sub link_replace { my $elem = shift; my $link_replace_target; if ($link_replace_top_en == 1){ $link_replace_target = 'target="_top"'; } else { $link_replace_target = 'target="_blank"'; } if ($link_replace_en == 1){ $elem =~ s/(https?:\/\/[\w\.\~\-\/\?\&\+\=\:\@\%\;\#\%\$]*)/$link_replace<\/a>/g; } else { $elem =~ s/(https?:\/\/[\w\.\~\-\/\?\&\+\=\:\@\%\;\#\%\$]*)/$1<\/a>/g; } return ($elem); } sub evssi { my ($caldata, $calname, $caldate, $calid, $pastyear); ($caldata, $calname, $caldate, $calid, $pastyear) = &getevdata; print "Content-Type: text/html\n\n"; # my @week_number; print "
\n"; foreach my $repday (0 .. $ssi_evdisp-1){ my $exists = 0; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime($now + 86400 * $repday); $year += 1900; $mon++; if ($ssi_evdate_en){ print "
  • $mon月$mday日($weekday[$wday])
  • \n"; } my $week_number = int(($mday-1)/7)+1; my @weekname = qw(sun mon tue wed thu fri sat); my $dai_day = "dai-$week_number-$weekname[$wday]"; foreach my $m ($mon, 'every'){ my @comment; foreach my $d ($mday, $dai_day, $weekname[$wday]){ if (exists $caldata->{anniv}{$m}{$d}) { $exists = 1; push @comment , split //, $caldata->{anniv}{$m}{$d}; } } foreach (@comment){ $_ = &link_replace($_); if ($ssi_evdate_en){ foreach my $tmp (split /
    /i){ print "
    $tmp
    \n"; } } else { print "
  • $_
  • \n"; } } } if (exists $caldata->{$year}{$mon}{$mday} or $exists){ my @comment = split //, $caldata->{$year}{$mon}{$mday}; foreach (@comment){ $_ = &link_replace($_); if ($ssi_evdate_en){ foreach my $tmp (split /
    /i){ print "
    $tmp
    \n"; } } else { print "
  • $_
  • \n"; } } } else { if ($ssi_noev_msg ne ''){ if ($ssi_evdate_en){ print "
    $ssi_noev_msg
    \n"; } else { print "
  • $ssi_noev_msg
  • \n"; } } } } print "
    \n"; } sub postprocess { foreach my $key (keys %in){ my $br = "
    "; $in{$key} =~ s//>/g; $in{$key} =~ s/\r\n/$br/g; $in{$key} =~ s/\n/$br/g; $in{$key} =~ s/\r/$br/g; $in{$key} =~ s/,/&\#44;/g; } } sub htmlhead { my $title = shift; if ($in{mobile} eq 'on' or $in{mode} eq 'mobile'){ print "Content-type:text/html;charset=Shift_JIS\n\n"; print "\n"; print "\n"; print "$title\n"; print "\n"; print "\n"; } else { my $bgimage; if ($bgimage_en == 1){ $bgimage = "background=\"$bgimage_file\""; } else { $bgimage = "bgcolor=\"$bgcolor\""; } print "Content-type:text/html\n\n"; print "\n"; print "\n"; print "\n"; print "$title\n"; if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } if ($in{mode} eq 'modify' or $in{mode} eq 'register') { print "\n"; } print "\n"; print "\n"; print "\n
    \n"; } } sub htmltail { my $mysite = ('http://www.hidekik.com/','http://www.hidekik.com/en/')[$lang]; if ($in{mobile} eq 'on' or $in{mode} =~ /mobile/){ print "
    evcal.cgi Ver. $version\n"; print "Copyright(C) 1997-$lastupdatedyear, hidekik.com\n"; print "\n"; } else { print "
    evcal.cgi Ver. $version
    \n"; print "
    Copyright(C) 1997-$lastupdatedyear, hidekik.com
    \n"; print "
    \n"; } } sub error { my ($msg) = shift; &unlockfile; &htmlhead($msg); print "
    $msg
    \n"; &htmltail; exit; } sub makecrypt { my $plain = shift; my $salt = join "", ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64]; my $result = crypt($plain,$salt) or crypt($plain,'$1$'.$salt.'$'); return $result; } sub setadminpwd { my $group = shift; my $ad; my $next; my $subname; if ($group eq ''){ $ad = '管理者'; $next = 'wradminpwd'; $subname = 'setadminpwd'; } else { $ad = 'グループ'; $next = 'grwradminpwd'; $subname = 'setgradminpwd'; } &htmlhead("$title{$subname}{text}"); print &titleprint($title{$subname}); print "
    \n"; if ($in{mode} eq 'setup'){ print "
    管理者用パスワードを入力してください。
    \n"; print "\n"; print "\n"; print "\n"; print "\n"; if ($adminonly_en and $admin_reglinks == 0){ print "

    管理人用イベント登録・変更
    \n"; &inputform($now); &editbutton; } } else { print "

    $ad用パスワードを設定してください。
    \n"; print "\n"; print "\n"; print "\n"; print "\n"; } &htmltail; exit; } sub wradminpwd { my $passwd = &makecrypt($in{pwd}); my $file; if ($in{mode} eq 'grwradminpwd'){ $file = $groupdat; } else { $file = $admindat; } if (open(FILE,"> $file")){ print FILE "$passwd"; close(FILE); } else { &error('パスワードファイル作成に失敗しました'); } print "Location: $script\n\n"; } sub checkadmin { my $pwd = shift; if (open(FILE,"< $admindat")){ my $filepwd = ; close(FILE); my $inpwd = crypt($pwd,$filepwd); return ("$inpwd" eq "$filepwd"); } else { &error('パスワードファイルが存在しません'); } } sub titleprint { my $title = shift; my @location = ('left','center','right'); my $titleline; if ($title->{sel} == 0) { $titleline = "
    {loc}]\">

    $title->{text}

    "; } elsif ($title->{sel} == 1){ $titleline = "
    {loc}]\">{size}\" color=\"$title->{color}\" face=\"$title->{face}\">$title->{text}

    "; } elsif ($title->{sel} == 2){ $titleline = "
    {loc}]\">{image}\" alt=\"$title->{text}\">

    "; } elsif ($title->{sel} == 3){ $titleline = "
    {loc}]\" style=\"$title->{style}\">$title->{text}

    "; } elsif ($title->{sel} == 4){ $titleline = ""; } return($titleline); } sub register { my $subname = 'register'; if ($ENV{"REQUEST_METHOD"} eq "POST"){ my ($ssec,$smin,$shour,$sday,$smon,$syear,$swday,$syday,$sisdst)=gmtime($start_day); if ($in{year} eq ''){ if ($smon > $in{month}-1) { $in{year} = $syear + 1901; } else { $in{year} = $syear + 1900; } } &monthdaycheck($in{year},$in{month}-1,$in{day}); my $regtime = timegm(0,0,0,$in{day},$in{month}-1,$in{year}); &error('選択範囲が登録可能範囲(カレンダーの表示範囲)を超えています。') if ($regtime > $end_day || $regtime < $start_day); ($ssec,$smin,$shour,$sday,$smon,$syear,$swday,$syday,$sisdst)=gmtime($regtime); $in{weekday} = $swday; } $title{$subname}{text} = "$in{year}年$in{month}月$in{day}日($weekday[$in{weekday}])$title{$subname}{text}"; my $titleprint=&titleprint($title{$subname}); my $colwidth; my $pwdname = 'password'; if ($in{mobile} eq 'on'){ print "Content-type:text/html;charset=Shift_JIS\n\n"; print "\n"; print "\n"; print " $title{$subname}{text}\n"; print "\n"; print "\n"; print "$title{$subname}{text}

    "; $colwidth = 30; } else { &htmlhead($title{$subname}{text}); print "$titleprint"; $colwidth = 50; } print < お名前


    内容

    HTMLOUT if ($day_bgcolor_en and $in{mobile} ne 'on'){ print "イベント日の色(オプション)
    \n"; print "

    \n"; } if ($in{mobile} eq 'on'){ print "\n"; } if ($group_en){ print <

    HTMLOUT2 } print <

    HTMLOUT3 &htmltail; } sub modify { my $subname = 'modify'; if ($adminonly_en and $admin_reglinks == 0){ foreach my $key1 (split /&/, $in{param}){ my ($key,$elem) = split /=/, $key1; $in{$key} = $elem; } } $title{$subname}{text} = "$in{year}年$in{month}月$in{day}日($weekday[$in{weekday}])$title{$subname}{text}"; my $caldata; my $calname; my $caldate; my $calid; my $pastyear; my $calbg; ($caldata, $calname, $caldate, $calid, $pastyear, $calbg) = &getevdata; my @comment = (); my @name = (); my @update = (); my @id = (); my @bg = (); if (exists $calname->{$in{year}}{$in{month}}{$in{day}}) { @comment = split //, $caldata->{$in{year}}{$in{month}}{$in{day}}; @name = split //, $calname->{$in{year}}{$in{month}}{$in{day}}; @update = split //, $caldate->{$in{year}}{$in{month}}{$in{day}}; @id = split //, $calid->{$in{year}}{$in{month}}{$in{day}}; @bg = split //, $calbg->{$in{year}}{$in{month}}{$in{day}}; } my $titleprint=&titleprint($title{$subname}); my $colwidth; my $pwdname = 'password'; if ($in{mobile} eq 'on'){ print "Content-type:text/html;charset=Shift_JIS\n\n"; print "\n"; print "\n"; print " $title{$subname}{text}\n"; print "\n"; print "\n"; print "$title{$subname}{text}

    "; $colwidth = 30; } else { &htmlhead($title{$subname}{text}); print "$titleprint"; $colwidth = 50; } my $j; my $dataline; my $name; my $id; my $bg; for ($j=0;$j<=$#comment;$j++){ next unless ($in{id} == $id[$j]); $dataline = $comment[$j]; $dataline =~ s/
    /\n/g; $dataline =~ s/\n*$//; $name = $name[$j]; $id = $id[$j]; $bg = $bg[$j]; last; } print < お名前


    内容

    HTMLOUT if ($day_bgcolor_en and $in{mobile} ne 'on'){ print "イベント日の色(オプション)
    \n"; print "

    \n"; } if ($in{mobile} eq 'on'){ print "\n"; } print <

    HTMLOUT2 &htmltail; } sub evwrite { &error('名前とパスワードは必ず入力してください。') if ($in{name} eq '' || $in{pwd} eq ''); if ($adminonly_en and !&checkadmin($in{pwd})) { &error('管理人オンリーモードでの管理人パスワードが違います。'); } if ($group_en && !&checkcrypt($in{grouppwd},$grouppwd)) { my $message = 'グループ用パスワードが違います。'; &error($message); } if ($day_bgcolor_en){ &error("無効なカラーコード、$in{day_bgcolor}です。") unless &color_check($in{day_bgcolor}); } &lockfile; my ($id) = &getevdata(-lastid); $id++; my $pwd = &makecrypt($in{pwd}); my $now = time+$offset*3600; my $day_bgcolor = $day_bgcolor_en ? $in{day_bgcolor} : ''; $day_bgcolor =~ s/^([\da-f]{6})$/\#$&/i; open WR, ">> $datafile" or &error("データファイル$datafileが開けません。"); print WR "$id,$in{year},$in{month},$in{day},$in{name},$now,$pwd,$host,$ip,$in{comment},$day_bgcolor\n"; close WR; &unlockfile; chmod (0666, "$datafile"); if ($in{mobile} eq 'on'){ print "Location: $script?mode=mobile\n\n"; } else { print "Location: $script#${in{year}}_${in{month}}_${in{day}}\n\n"; } } sub evreplace { &error('名前とパスワードは必ず入力してください。') if ($in{name} eq '' || $in{pwd} eq ''); if ($day_bgcolor_en){ &error("無効なカラーコード、$in{day_bgcolor}です。") unless &color_check($in{day_bgcolor}); } &lockfile; my $now = time+$offset*3600; my ($dyear,$dmonth,$dday,$dname,$dnow,$dpwd,$dhost,$dip,$dcomment,$day_bgcolor); my $id; open DATA, "< $datafile" or &error("データファイル$datafileが開けません。"); open WR, "> tmp.$$" or &error("テンポラリファイルが開けません。"); while (){ chomp; ($id,$dyear,$dmonth,$dday,$dname,$dnow,$dpwd,$dhost,$dip,$dcomment,$day_bgcolor) = split /,/; chomp; if ($id == $in{id}){ if (!checkcrypt($in{pwd}, $dpwd)){ close(WR); &error('修正用パスワードが違います。'); } $in{day_bgcolor} =~ s/^([\da-f]{6})$/\#$&/i; print WR "$in{id},$in{year},$in{month},$in{day},$in{name},$now,$dpwd,$host,$ip,$in{comment},$in{day_bgcolor}\n"; } else { print WR "$id,$dyear,$dmonth,$dday,$dname,$dnow,$dpwd,$dhost,$dip,$dcomment,$day_bgcolor\n"; } } close WR; close DATA; rename("tmp.$$","$datafile"); &unlockfile; chmod (0666, "$datafile"); if ($in{mobile} eq 'on'){ print "Location: $script?mode=mobile\n\n"; } else { print "Location: $script#${in{year}}_${in{month}}_${in{day}}\n\n"; } } sub calupdate { my $now = shift; return $now if ($now eq ' '); my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=gmtime($now); $mon++; $year += 1900; my $update = "$mon/$day/$year"; return $update; } sub getevdata { # options # -lastid : Return the last id in the data file # -latest : Return the latest update information in the data file # -alldta : Retrun hash reference for all registered contents in the data file # (default) my @options = @_; my %caldata; my %calname; my %caldate; my %calid; my %calbg; my %calfg; my $id; my ($dyear,$dmonth,$dday,$dname,$dnow,$dpwd,$dcomment,$day_bgcolor,$day_fgcolor); my $host; my $ip; my $data_day; my $latest; my ($lid,$lyear,$lmonth,$lday,$lname,$lnow); my @pastyear; if ((grep /-alldata/, @options or $#options == -1) and $anniv_en and $anniv ne '') { my @anniv_data = split /[\r\n]/, $anniv; foreach (@anniv_data){ chomp; ($dmonth,$dday,$day_bgcolor,$day_fgcolor,$dcomment) = split /,/; $dday = lc($dday); $dmonth = lc($dmonth); $day_bgcolor ||= 'default'; $day_fgcolor ||= 'default'; $dyear = 'anniv'; if (grep /-alldata/, @options or $#options == -1) { if (exists $caldata{$dyear}{$dmonth}{$dday}) { next if ($dcomment eq ''); $caldata{$dyear}{$dmonth}{$dday} .= "$dcomment"; $calname{$dyear}{$dmonth}{$dday} .= " "; $caldate{$dyear}{$dmonth}{$dday} .= " "; $calid{$dyear}{$dmonth}{$dday} .= "anniv"; $calbg{$dyear}{$dmonth}{$dday} .= "$day_bgcolor"; $calfg{$dyear}{$dmonth}{$dday} .= "$day_fgcolor"; } else { next if ($dcomment eq ''); $caldata{$dyear}{$dmonth}{$dday} = "$dcomment"; $calname{$dyear}{$dmonth}{$dday} = " "; $caldate{$dyear}{$dmonth}{$dday} = " "; $calid{$dyear}{$dmonth}{$dday} = "anniv"; $calbg{$dyear}{$dmonth}{$dday} = "$day_bgcolor"; $calfg{$dyear}{$dmonth}{$dday} = "$day_fgcolor"; } } } } if (open DATA, "< $datafile"){ while (){ chomp; ($id,$dyear,$dmonth,$dday,$dname,$dnow,$dpwd,$host,$ip,$dcomment,$day_bgcolor) = split /,/; if (grep /-alldata/, @options or $#options == -1) { $data_day = timegm(0,0,0,$dday,--$dmonth,$dyear); if ($data_day < $start_day || $in{mode} eq 'past') { push @pastyear, $dyear if (! grep /$dyear/, @pastyear); } next if ($data_day < $start_day or $data_day > $end_day); $dmonth++; if (exists $caldata{$dyear}{$dmonth}{$dday}) { next if ($dcomment eq ''); $caldata{$dyear}{$dmonth}{$dday} .= "$dcomment"; $calname{$dyear}{$dmonth}{$dday} .= "$dname"; $caldate{$dyear}{$dmonth}{$dday} .= "$dnow"; $calid{$dyear}{$dmonth}{$dday} .= "$id"; $calbg{$dyear}{$dmonth}{$dday} .= "$day_bgcolor"; $calfg{$dyear}{$dmonth}{$dday} .= "default"; } else { next if ($dcomment eq ''); $caldata{$dyear}{$dmonth}{$dday} = "$dcomment"; $calname{$dyear}{$dmonth}{$dday} = "$dname"; $caldate{$dyear}{$dmonth}{$dday} = "$dnow"; $calid{$dyear}{$dmonth}{$dday} = "$id"; $calbg{$dyear}{$dmonth}{$dday} = "$day_bgcolor"; $calfg{$dyear}{$dmonth}{$dday} = "default"; } } elsif (grep /-latest/, @options){ if ($dnow > $latest) { $latest = $dnow; $lnow = $dnow; $lid = $id; $lyear = $dyear; $lmonth = $dmonth; $lday = $dday; $lname = $dname; } } } close DATA; } if (grep /-lastid/, @options) { return ($id); } elsif (grep /-latest/, @options){ return ($lid,$lyear,$lmonth,$lday,$lname,$lnow); } else { return (\%caldata, \%calname, \%caldate, \%calid, \@pastyear, \%calbg, \%calfg); } } sub lockfile { while(-e "$lockfile"){ sleep(1); } open(LOCK,"> $lockfile"); close(LOCK); } sub unlockfile { unlink("tmp.$$") if (-e "tmp.$$"); unlink("$lockfile") if (-e $lockfile); } sub checkcrypt { my ($pwd,$encpwd)=@_; return(crypt($pwd,$encpwd) eq "$encpwd" or &checkadmin($pwd)); } sub updateinfo { my ($id,$dyear,$dmonth,$dday,$dname,$dnow); ($id,$dyear,$dmonth,$dday,$dname,$dnow) = &getevdata(-latest); my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=gmtime($dnow); my $datetime = sprintf("%d年%d月%d日%d時%d分",$year+1900,++$mon,$day,$hour,$min); my $newest = sprintf("%4d年%d月%d日",$dyear,$dmonth,$dday); print "最終更新者は "; print "$dname、 "; print "
    \n" if ($in{mode} eq 'mobile'); print "最終更新日は "; print "$datetimeです。
    \n"; my ($nsec,$nmin,$nhour,$nday,$nmon,$nyear,$nwday,$nyday,$nisdst)=gmtime($now); my $start_table_date = timegm(0,0,0,1,$nmon,$nyear); my $dmonth_n = $dmonth - 1 if ($dmonth != 0); $dday = 1 if ($dday eq ''); my $last_written_date = timegm(0,0,0,$dday,$dmonth_n,$dyear); print "イベントが更新された日は、"; if ($in{mode} eq 'mobile'){ print "$newest"; } else { if ($last_written_date < $start_table_date){ if ($past_length) { print "
    $newest"; } else { print "$newest"; } } else { print "$newest"; } } print "です。

    \n"; } sub inputform { my $now = shift; my $n; my $nn; my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=gmtime($now); print "

    \n"; if ($disp_length > 12) { print "年\n"; } print "月\n"; print "日 \n"; my $regmode; if ($in{mode} eq 'mobile'){ print "
    \n"; } print "\n"; print "\n"; print "

    \n"; } sub usage { if ($usage_en == 1){ print < $usage USAGE print "【トップへ】\n"; } } sub misclink { my $now = shift; my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=gmtime($now); $mon++; $year += 1900; print "$backlink_name\n" if ($backlink_en == 1); print "$jumplink_name\n" if ($jumplink_en == 1); print "$mobilelink_name\n" if ($mobilelink_en == 1); print "$usage_name\n" if ($usage_en == 1); print "$setup_name\n" if ($setup_en == 1); print "

    \n"; } sub monthdaycheck { my ($year,$month,$day) = @_; my @monthdays = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); my $md = $monthdays[$month]; ++$md unless $month != 1 or $year % 4 or !($year % 400); $month++; &error("日付が適切ではありません。$month月$day日") if $day > $md or $day < 1; } sub setup { my $subname = 'setup'; &setadminpwd if ($in{pwd} eq ''); &error('管理用パスワードが違います。') unless &checkadmin($in{pwd}); &htmlhead($title{$subname}{text}); my %check; $check{backlink}[$backlink_en] = "checked"; $check{bgimage}[$bgimage_en] = "checked"; $check{title}{display}{sel}[$title{display}{sel}] = "checked"; $check{title}{display}{loc}[$title{display}{loc}] = "checked"; $check{title}{register}{sel}[$title{register}{sel}] = "checked"; $check{title}{register}{loc}[$title{register}{loc}] = "checked"; $check{title}{modify}{sel}[$title{modify}{sel}] = "checked"; $check{title}{modify}{loc}[$title{modify}{loc}] = "checked"; $check{style_sheet}[$style_sheet_en] = "checked"; $check{head_insert}[$head_insert_en] = "checked"; $check{usage}[$usage_en] = "checked"; $check{jumplink}[$jumplink_en] = "checked"; $check{mobilelink}[$mobilelink_en] = "checked"; $check{setup}[$setup_en] = "checked"; $check{start_month}[$start_month] = "checked"; $check{disp_length}[$disp_length] = "checked"; $check{disp_length}[13] = "checked" if (!grep /checked/, @{$check{disp_length}}[1,3,6,12]); $check{past_length}[$past_length] = "checked"; $check{body_insert1}[$body_insert1_en] = "checked"; $check{body_insert2}[$body_insert2_en] = "checked"; $check{body_insert3}[$body_insert3_en] = "checked"; $check{body_insert4}[$body_insert4_en] = "checked"; $check{body_insert5}[$body_insert5_en] = "checked"; $check{body_insert6}[$body_insert6_en] = "checked"; $check{body_insert7}[$body_insert7_en] = "checked"; $check{update_link}[$update_link] = "checked"; $check{link_replace_en}[$link_replace_en] = "checked"; $check{link_replace_top_en}[$link_replace_top_en] = "checked"; $check{day_bgcolor_en}[$day_bgcolor_en] = "checked"; $check{anniv_en}[$anniv_en] = "checked"; $check{group_en}[$group_en] = "checked"; $check{adminonly_en}[$adminonly_en] = "checked"; $check{admin_reglinks}[$admin_reglinks] = "checked"; $check{ssi_evdate_en}[$ssi_evdate_en] = "checked"; print "

    \n"; print "\n"; print "\n"; print <
    • セットアップリンクを非表\示にしている場合は、$script?mode=setupからパスワードを入力してこのページに入ってください。
    • 数字やカラー指定は必ず半角で指定してください。全角やブランクだとCGIが起動しなくなります。万一間違って全角で書いてしまった場合は、$setupfileをエディタで開きその場所を半角に正しく修正してください。それで直ります。
    データファイル ロックファイル バックグランド 画像を使う カラー設定にする
    画像を使う場合の画像ファイル
    カラー設定の場合のカラー番号(白:#ffffff 又は white) カレンダーの色 カラー番号又はカラー名
    ヘッダの背景
    ヘッダの文字
    更新者
    更新日
    平日欄の背景
    土曜日の背景
    日曜日の背景
    日付、内容の文字色はスタイルシートのリンク色の設定で行ってください。
    日付はclass=daylink, コメントはclass=comlinkとなっています。 更新リンク 更新ページへのリンクを「内容」欄にするか「更新者」欄にするか
    内容 更新者
    ここの設定を「更新者」にした場合の更新者の色設定はスタイルシートで行ってください。class=namelinkとなっています。
    その場合の「内容」の色 http://からの自動リンク置き換え 自動リンクは更新ページリンクを「更新者」に設定したときの表\示、過去の表\示ページ、SSIモードでの表\示で有効です。
    置き換え そのまま
    リンク名
    リンククリック時
    同じウィンドウ 別ウィンドウ
    書き込んだイベント日の背景色 有効 無効 表\の表\示幅 ブラウザ全体の% 更新者欄の幅 テーブル全体の% 表\示開始月 先月 今月 表\示する月数 1ヶ月 3ヶ月 6ヶ月 12ヶ月 その他 過去ログ1ページ表\示長 1ヶ月 1年 イベントカレンダータイトル名
    無し
    デフォルト<H2></H2>
    テキスト color= size= face=
    ロゴ画像
    スタイルシート
    位置: 右 登録タイトル名 ○月×日
    無し
    デフォルト<H2></H2>
    テキスト color= size= face=
    スタイルシート
    位置: 右 変更タイトル名 ○月×日
    無し
    デフォルト<H2></H2>
    テキスト color= size= face=
    スタイルシート
    位置: 右 トップへのリンク 表\示 非表\示
    リンク名
    URL
    携帯モード時のトップへのリンク(非表\示設定はできません)
    リンク名
    URL
    ジャンプのリンク 表\示 非表\示
    リンク名
    携帯モードのリンク 表\示 非表\示
    リンク名
    セットアップのリンク 表\示 非表\示
    リンク名
    管理人オンリーモード 有効 無効
    管理人オンリーモード時にイベント追加のボタンとリンクの表\示
    表\示 非表\示
    非表\示時には管理用リンクをクリックすると登録ボタンが表\示されます。
    グループモード 有効 無効
    SSIモード イベントが無い日のメッセージ

    本日を含めてイベントを表\示する日数 日分
    日付表\示 表\示 非表\示
    使い方 表\示 非表\示
    リンク名
    記念日 有効 無効
    • 記念日を「月,日,背景色,文字色,コメント内容」のように半角カンマで区切ってください。月、日、背景色、文字色は半角英数で。
    • その月日に毎年自動的にコメント内容が挿入されます。色はブランクでデフォルト色になります。
    • 第何曜日指定の場合は、日にちの部分を「dai-<number>-<weekday>」のようにします。例えば、第3月曜日は、「dai-3-mon」と指定します。
    • 曜日コードは、日曜日:sun、 月曜日:mon、火曜日:tue、水曜日:wed、木曜日:thu、金曜日:fri、土曜日:sat
    • 毎月指定の場合は、月の部分を「every」とします。例えば、毎月25日であれば月日の部分は「every,25,」となります。
    • 毎週指定の場合は、日の部分を曜日コードのみ指定します。例えば、毎週水曜日であれば月日の部分は「every,wed,」となります。
    • 指定月のみの毎週指定の場合は、月をそのまま指定し、日の部分を曜日コードのみにします。例えば、2月の毎週金曜日であれば月日の部分は「2,fri,」となります。
    • 記念日設定の例:
      1,1,#ffcccc,#0000ee,元旦
      1,dai-2-mon,#ffcccc,#0000ee,成人の日
      5,5,#ffcccc,#0000ee,こどもの日
      6,dai-2-fri,lightgreen,,ボー\ナスの日
      7,dai-3-mon,#ffcccc,#0000ee,海の日
      every,25,,,給料日
      every,dai-2-wed,,,締め日
      every,wed,,,毎週水曜日
      2,fri,,,2月の毎週金曜日

    <head>内挿入文 有効 無効
    HTML書式
    ポップアップ広告やJavascript、<META>を挿入したい場合にここに記述する。
    以下の記述が<head>〜</head>内に挿入される。

    スタイルシート 有効 無効

    日付、内容の文字色はスタイルシートで変更できます。
    日付はclass=daylink, コメントはclass=comlinkとなっています。 <body>内挿入文 イベントカレンダー上部に表\示される文をHTMLで記述。ルールやコメント、広告やアクセスカウンタ、リンクなど記すことができます。
    タイトルの上 有効 無効

    タイトルの下 有効 無効

    「更新情報」の上 有効 無効

    「更新情報」の下 有効 無効

    メニューリンクの下 有効 無効

    表\の上 有効 無効

    ページ一番下 有効 無効

    時間設定 GMTより時間(日本:+9時間) END print ""; print ""; &htmltail; } sub setupwrite { $in{title_display_size} =~ s/ /+/; $in{title_register_size} =~ s/ /+/; $in{title_modify_size} =~ s/ /+/; foreach (keys(%in)){ $in{$_} =~ s/
    /\n/g; $in{$_} =~ s/,/,/g; $in{$_} =~ s/<//g; } open(SETUP,"> $setupfile"); $in{disp_length_other} = 12 if ($in{disp_length_other} !~ /\d/); $in{disp_length} = $in{disp_length_other} if ($in{disp_length} == 13); print SETUP <〜内に挿入できる構文 1:on, 0:off \$head_insert_en = $in{head_insert_en}; \$head_insert = '$in{head_insert}'; #使い方 \$usage_en = $in{usage_en}; \$usage_name = '$in{usage_name}'; \$usage = '$in{usage}'; #上部に表\示させる文 1:on, 0:off \$body_insert1_en = $in{body_insert1_en}; \$body_insert1 = '$in{body_insert1}'; \$body_insert2_en = $in{body_insert2_en}; \$body_insert2 = '$in{body_insert2}'; \$body_insert3_en = $in{body_insert3_en}; \$body_insert3 = '$in{body_insert3}'; \$body_insert4_en = $in{body_insert4_en}; \$body_insert4 = '$in{body_insert4}'; \$body_insert5_en = $in{body_insert5_en}; \$body_insert5 = '$in{body_insert5}'; \$body_insert6_en = $in{body_insert6_en}; \$body_insert6 = '$in{body_insert6}'; #下部に表\示させる文 1:on, 0:off \$body_insert7_en = $in{body_insert7_en}; \$body_insert7 = '$in{body_insert7}'; # 時間設定 GMTからのオフセット 日本:+9 \$offset = $in{offset}; 1; END close(SETUP); print "Location: $script\n\n"; } sub color_check { my $incode = shift; # /usr/X11R6/lib/X11/rgb.txt my $color_code = ' snow ghost white GhostWhite white smoke WhiteSmoke gainsboro floral white FloralWhite old lace OldLace linen antique white AntiqueWhite papaya whip PapayaWhip blanched almond BlanchedAlmond bisque peach puff PeachPuff navajo white NavajoWhite moccasin cornsilk ivory lemon chiffon LemonChiffon seashell honeydew mint cream MintCream azure alice blue AliceBlue lavender lavender blush LavenderBlush misty rose MistyRose white black dark slate gray DarkSlateGray dark slate grey DarkSlateGrey dim gray DimGray dim grey DimGrey slate gray SlateGray slate grey SlateGrey light slate gray LightSlateGray light slate grey LightSlateGrey gray grey light grey LightGrey light gray LightGray midnight blue MidnightBlue navy navy blue NavyBlue cornflower blue CornflowerBlue dark slate blue DarkSlateBlue slate blue SlateBlue medium slate blue MediumSlateBlue light slate blue LightSlateBlue medium blue MediumBlue royal blue RoyalBlue blue dodger blue DodgerBlue deep sky blue DeepSkyBlue sky blue SkyBlue light sky blue LightSkyBlue steel blue SteelBlue light steel blue LightSteelBlue light blue LightBlue powder blue PowderBlue pale turquoise PaleTurquoise dark turquoise DarkTurquoise medium turquoise MediumTurquoise turquoise cyan light cyan LightCyan cadet blue CadetBlue medium aquamarine MediumAquamarine aquamarine dark green DarkGreen dark olive green DarkOliveGreen dark sea green DarkSeaGreen sea green SeaGreen medium sea green MediumSeaGreen light sea green LightSeaGreen pale green PaleGreen spring green SpringGreen lawn green LawnGreen green chartreuse medium spring green MediumSpringGreen green yellow GreenYellow lime green LimeGreen yellow green YellowGreen forest green ForestGreen olive drab OliveDrab dark khaki DarkKhaki khaki pale goldenrod PaleGoldenrod light goldenrod yellow LightGoldenrodYellow light yellow LightYellow yellow gold light goldenrod LightGoldenrod goldenrod dark goldenrod DarkGoldenrod rosy brown RosyBrown indian red IndianRed saddle brown SaddleBrown sienna peru burlywood beige wheat sandy brown SandyBrown tan chocolate firebrick brown dark salmon DarkSalmon salmon light salmon LightSalmon orange dark orange DarkOrange coral light coral LightCoral tomato orange red OrangeRed red hot pink HotPink deep pink DeepPink pink light pink LightPink pale violet red PaleVioletRed maroon medium violet red MediumVioletRed violet red VioletRed magenta violet plum orchid medium orchid MediumOrchid dark orchid DarkOrchid dark violet DarkViolet blue violet BlueViolet purple medium purple MediumPurple thistle snow1 snow2 snow3 snow4 seashell1 seashell2 seashell3 seashell4 AntiqueWhite1 AntiqueWhite2 AntiqueWhite3 AntiqueWhite4 bisque1 bisque2 bisque3 bisque4 PeachPuff1 PeachPuff2 PeachPuff3 PeachPuff4 NavajoWhite1 NavajoWhite2 NavajoWhite3 NavajoWhite4 LemonChiffon1 LemonChiffon2 LemonChiffon3 LemonChiffon4 cornsilk1 cornsilk2 cornsilk3 cornsilk4 ivory1 ivory2 ivory3 ivory4 honeydew1 honeydew2 honeydew3 honeydew4 LavenderBlush1 LavenderBlush2 LavenderBlush3 LavenderBlush4 MistyRose1 MistyRose2 MistyRose3 MistyRose4 azure1 azure2 azure3 azure4 SlateBlue1 SlateBlue2 SlateBlue3 SlateBlue4 RoyalBlue1 RoyalBlue2 RoyalBlue3 RoyalBlue4 blue1 blue2 blue3 blue4 DodgerBlue1 DodgerBlue2 DodgerBlue3 DodgerBlue4 SteelBlue1 SteelBlue2 SteelBlue3 SteelBlue4 DeepSkyBlue1 DeepSkyBlue2 DeepSkyBlue3 DeepSkyBlue4 SkyBlue1 SkyBlue2 SkyBlue3 SkyBlue4 LightSkyBlue1 LightSkyBlue2 LightSkyBlue3 LightSkyBlue4 SlateGray1 SlateGray2 SlateGray3 SlateGray4 LightSteelBlue1 LightSteelBlue2 LightSteelBlue3 LightSteelBlue4 LightBlue1 LightBlue2 LightBlue3 LightBlue4 LightCyan1 LightCyan2 LightCyan3 LightCyan4 PaleTurquoise1 PaleTurquoise2 PaleTurquoise3 PaleTurquoise4 CadetBlue1 CadetBlue2 CadetBlue3 CadetBlue4 turquoise1 turquoise2 turquoise3 turquoise4 cyan1 cyan2 cyan3 cyan4 DarkSlateGray1 DarkSlateGray2 DarkSlateGray3 DarkSlateGray4 aquamarine1 aquamarine2 aquamarine3 aquamarine4 DarkSeaGreen1 DarkSeaGreen2 DarkSeaGreen3 DarkSeaGreen4 SeaGreen1 SeaGreen2 SeaGreen3 SeaGreen4 PaleGreen1 PaleGreen2 PaleGreen3 PaleGreen4 SpringGreen1 SpringGreen2 SpringGreen3 SpringGreen4 green1 green2 green3 green4 chartreuse1 chartreuse2 chartreuse3 chartreuse4 OliveDrab1 OliveDrab2 OliveDrab3 OliveDrab4 DarkOliveGreen1 DarkOliveGreen2 DarkOliveGreen3 DarkOliveGreen4 khaki1 khaki2 khaki3 khaki4 LightGoldenrod1 LightGoldenrod2 LightGoldenrod3 LightGoldenrod4 LightYellow1 LightYellow2 LightYellow3 LightYellow4 yellow1 yellow2 yellow3 yellow4 gold1 gold2 gold3 gold4 goldenrod1 goldenrod2 goldenrod3 goldenrod4 DarkGoldenrod1 DarkGoldenrod2 DarkGoldenrod3 DarkGoldenrod4 RosyBrown1 RosyBrown2 RosyBrown3 RosyBrown4 IndianRed1 IndianRed2 IndianRed3 IndianRed4 sienna1 sienna2 sienna3 sienna4 burlywood1 burlywood2 burlywood3 burlywood4 wheat1 wheat2 wheat3 wheat4 tan1 tan2 tan3 tan4 chocolate1 chocolate2 chocolate3 chocolate4 firebrick1 firebrick2 firebrick3 firebrick4 brown1 brown2 brown3 brown4 salmon1 salmon2 salmon3 salmon4 LightSalmon1 LightSalmon2 LightSalmon3 LightSalmon4 orange1 orange2 orange3 orange4 DarkOrange1 DarkOrange2 DarkOrange3 DarkOrange4 coral1 coral2 coral3 coral4 tomato1 tomato2 tomato3 tomato4 OrangeRed1 OrangeRed2 OrangeRed3 OrangeRed4 red1 red2 red3 red4 DeepPink1 DeepPink2 DeepPink3 DeepPink4 HotPink1 HotPink2 HotPink3 HotPink4 pink1 pink2 pink3 pink4 LightPink1 LightPink2 LightPink3 LightPink4 PaleVioletRed1 PaleVioletRed2 PaleVioletRed3 PaleVioletRed4 maroon1 maroon2 maroon3 maroon4 VioletRed1 VioletRed2 VioletRed3 VioletRed4 magenta1 magenta2 magenta3 magenta4 orchid1 orchid2 orchid3 orchid4 plum1 plum2 plum3 plum4 MediumOrchid1 MediumOrchid2 MediumOrchid3 MediumOrchid4 DarkOrchid1 DarkOrchid2 DarkOrchid3 DarkOrchid4 purple1 purple2 purple3 purple4 MediumPurple1 MediumPurple2 MediumPurple3 MediumPurple4 thistle1 thistle2 thistle3 thistle4 gray0 grey0 gray1 grey1 gray2 grey2 gray3 grey3 gray4 grey4 gray5 grey5 gray6 grey6 gray7 grey7 gray8 grey8 gray9 grey9 gray10 grey10 gray11 grey11 gray12 grey12 gray13 grey13 gray14 grey14 gray15 grey15 gray16 grey16 gray17 grey17 gray18 grey18 gray19 grey19 gray20 grey20 gray21 grey21 gray22 grey22 gray23 grey23 gray24 grey24 gray25 grey25 gray26 grey26 gray27 grey27 gray28 grey28 gray29 grey29 gray30 grey30 gray31 grey31 gray32 grey32 gray33 grey33 gray34 grey34 gray35 grey35 gray36 grey36 gray37 grey37 gray38 grey38 gray39 grey39 gray40 grey40 gray41 grey41 gray42 grey42 gray43 grey43 gray44 grey44 gray45 grey45 gray46 grey46 gray47 grey47 gray48 grey48 gray49 grey49 gray50 grey50 gray51 grey51 gray52 grey52 gray53 grey53 gray54 grey54 gray55 grey55 gray56 grey56 gray57 grey57 gray58 grey58 gray59 grey59 gray60 grey60 gray61 grey61 gray62 grey62 gray63 grey63 gray64 grey64 gray65 grey65 gray66 grey66 gray67 grey67 gray68 grey68 gray69 grey69 gray70 grey70 gray71 grey71 gray72 grey72 gray73 grey73 gray74 grey74 gray75 grey75 gray76 grey76 gray77 grey77 gray78 grey78 gray79 grey79 gray80 grey80 gray81 grey81 gray82 grey82 gray83 grey83 gray84 grey84 gray85 grey85 gray86 grey86 gray87 grey87 gray88 grey88 gray89 grey89 gray90 grey90 gray91 grey91 gray92 grey92 gray93 grey93 gray94 grey94 gray95 grey95 gray96 grey96 gray97 grey97 gray98 grey98 gray99 grey99 gray100 grey100 dark grey DarkGrey dark gray DarkGray dark blue DarkBlue dark cyan DarkCyan dark magenta DarkMagenta dark red DarkRed light green LightGreen '; my @code; foreach (split /[\r?\n]/, $color_code){ next if ($_ eq ''); chomp; push @code, lc($_); } $incode = lc($incode); $incode =~ s/^\s*\#//; return (grep /^$incode$/, @code or $incode =~ /^[\da-f]{6}$/ or $incode eq ''); } sub lastday { my ($month,$year) = @_; my @monthdays = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); my $md = $monthdays[$month]; ++$md if ($month == 1 and $year % 4 == 0 and ($year % 100 != 0 or $year % 400 == 0)); return $md; } sub editbutton { my ($caldata, $calname, $caldate, $calid, $pastyear, $calbg, $calfg) = &getevdata; print "
    \n"; print "\n"; print "\n"; print "\n"; print "\n"; if ($in{mode} eq 'mobile'){ print "
    \n"; } print "
    \n"; } sub substr_fixtail { my $lmain = shift; my $lmain1 = $lmain; if (length($lmain) > 10){ my $taillmain = chop($lmain1); my $taillmain2 = substr($lmain1,-1); my $tailhex = unpack("C",$taillmain); my $tailhex2 = unpack("C",$taillmain2); my $lastchar = $tailhex2 * 0x100 + $tailhex; if (!($lastchar >= 0x8140 && $lastchar <= 0x84be || $lastchar >= 0x889f && $lastchar <= 0x9872 || $lastchar >= 0x989f && $lastchar <= 0x9ffc)){ $lmain = $lmain1; } } return $lmain; } sub get_each_data { my ($caldata, $calname, $caldate, $calid, $pastyear, $calbg, $calfg, $year, $mon, $day, $dai_day, $wday) = @_; my @comment; my @name; my @update; my @id; my @day_bgcolor; my @day_fgcolor; foreach my $m ($mon, 'every'){ foreach my $d ($day, $dai_day, $wday){ if (exists $caldata->{anniv}{$m}{$d}) { push @comment , split //, $caldata->{anniv}{$m}{$d}; push @name , split //, $calname->{anniv}{$m}{$d}; push @update , split //, $caldate->{anniv}{$m}{$d}; push @id , split //, $calid->{anniv}{$m}{$d}; push @day_bgcolor, split //, $calbg->{anniv}{$m}{$d}; push @day_fgcolor, split //, $calfg->{anniv}{$m}{$d}; } } } if (exists $caldata->{$year}{$mon}{$day}) { push @comment , split //, $caldata->{$year}{$mon}{$day}; push @name , split //, $calname->{$year}{$mon}{$day}; push @update , split //, $caldate->{$year}{$mon}{$day}; push @id , split //, $calid->{$year}{$mon}{$day}; push @day_bgcolor , split //, $calbg->{$year}{$mon}{$day}; push @day_fgcolor , split //, $calfg->{$year}{$mon}{$day}; } if ($#comment == -1) { $comment[0] = " "; $name[0] = " "; $update[0] = " "; } return (\@comment, \@name, \@update, \@id, \@day_bgcolor, \@day_fgcolor); } sub mobile_admin { $in{mode} = 'mobile'; &htmlhead("管理用イベント登録・変更"); if ($adminonly_en and $admin_reglinks == 0){ print "

    管理人用イベント登録・変更
    \n"; &inputform($now); &editbutton; } &htmltail; }