1 |
use strict; |
use strict; |
2 |
|
|
3 |
|
my $mail_from = q<webmaster@suika.fam.cx>; |
4 |
|
my $mail_to = q<webmaster@suika.fam.cx>; |
5 |
|
my $subject_prefix = q<[suika.fam.cx account]>; |
6 |
|
|
7 |
my $user_data_dir_name = 'data/'; |
my $user_data_dir_name = 'data/'; |
8 |
my $user_prop_file_suffix = '.user'; |
my $user_prop_file_suffix = '.user'; |
9 |
|
|
173 |
} |
} |
174 |
} # regenerate_htpasswd_and_htgroup |
} # regenerate_htpasswd_and_htgroup |
175 |
|
|
176 |
sub print_error ($$) { |
sub print_error ($$;$) { |
177 |
my ($code, $text) = @_; |
my ($code, $text, $text_arg) = @_; |
178 |
|
our $Lang; |
179 |
binmode STDOUT, ':encoding(utf-8)'; |
binmode STDOUT, ':encoding(utf-8)'; |
180 |
print qq[Status: $code $text |
my $_text = $text; |
181 |
|
$_text =~ s/%s/$text_arg/g; |
182 |
|
print qq[Status: $code $_text |
183 |
Content-Type: text/html; charset=utf-8 |
Content-Type: text/html; charset=utf-8 |
184 |
|
|
185 |
<!DOCTYPE HTML> |
<!DOCTYPE HTML> |
186 |
<html lang=en> |
<html lang="$Lang"> |
187 |
<title>$code @{[htescape ($text)]}</title> |
<title lang=en>$code @{[htescape ($_text)]}</title> |
188 |
<h1>Error</h1> |
<link rel=stylesheet href="/www/style/html/xhtml"> |
189 |
<p>@{[htescape ($text)]}.<!--]; |
<h1>]; |
190 |
|
print_text ('Error'); |
191 |
|
print q[</h1><p>]; |
192 |
|
print_text ($text, sub { print '', htescape ($text_arg) }); |
193 |
|
print_text ('.'); |
194 |
|
print q[<!--]; |
195 |
print 0 for 0..511; # for WinIE |
print 0 for 0..511; # for WinIE |
196 |
print q[-->]; |
print q[-->]; |
197 |
} # print_error |
} # print_error |
216 |
return $pass_crypted; |
return $pass_crypted; |
217 |
} # check_password |
} # check_password |
218 |
|
|
219 |
|
sub send_mail ($$) { |
220 |
|
require Net::SMTP; |
221 |
|
require Encode; |
222 |
|
|
223 |
|
my $smtp = Net::SMTP->new ('localhost'); |
224 |
|
$smtp->mail ($mail_from); |
225 |
|
$smtp->to ($mail_to); |
226 |
|
## NOTE: What's wrong with UTF-8 Subject? :-) |
227 |
|
$smtp->data (Encode::encode ('utf-8', "From: <$mail_from> |
228 |
|
To: <$mail_to> |
229 |
|
Subject: $_[0] |
230 |
|
Content-Type: text/plain; charset=utf-8 |
231 |
|
MIME-Version: 1.0 |
232 |
|
|
233 |
|
$_[1]")); |
234 |
|
$smtp->send; |
235 |
|
} # send_mail |
236 |
|
|
237 |
sub system_ (@) { |
sub system_ (@) { |
238 |
(system join (' ', map {quotemeta $_} @_) . " > /dev/null") == 0 |
(system join (' ', map {quotemeta $_} @_) . " > /dev/null") == 0 |
239 |
or die "$0: $?"; |
or die "$0: $?"; |