mirror of
https://github.com/webmin/webmin.git
synced 2026-02-04 14:42:15 +00:00
Compare commits
1 Commits
dev/firewa
...
dev/time-o
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd3e985cf8 |
@@ -376,22 +376,9 @@ return @rv ? wantarray ? @rv : $rv[0]
|
||||
sub find_value
|
||||
{
|
||||
my @v = &find($_[0], $_[1]);
|
||||
if (!@v) {
|
||||
return undef;
|
||||
}
|
||||
elsif (wantarray) {
|
||||
return map { &extract_value($_) } @v;
|
||||
}
|
||||
else {
|
||||
return &extract_value($v[0]);
|
||||
}
|
||||
}
|
||||
|
||||
sub extract_value
|
||||
{
|
||||
my ($dir) = @_;
|
||||
return defined($dir->{'value'}) ? $dir->{'value'} :
|
||||
@{$dir->{'values'}} ? $dir->{'values'}->[0] : undef;
|
||||
if (!@v) { return undef; }
|
||||
elsif (wantarray) { return map { $_->{'value'} } @v; }
|
||||
else { return $v[0]->{'value'}; }
|
||||
}
|
||||
|
||||
# base_directory([&config], [no-cache])
|
||||
@@ -513,8 +500,9 @@ for(my $i=0; $i<@oldv || $i<@newv; $i++) {
|
||||
sub recursive_set_value
|
||||
{
|
||||
my ($dir) = @_;
|
||||
if (!defined($dir->{'value'})) {
|
||||
$dir->{'value'} = &extract_value($dir);
|
||||
if ($dir->{'values'}) {
|
||||
my @v = @{$dir->{'values'}};
|
||||
$dir->{'value'} = @v ? $v[0] : undef;
|
||||
}
|
||||
if ($dir->{'type'} && $dir->{'type'} == 1 && $dir->{'members'}) {
|
||||
foreach my $m (@{$dir->{'members'}}) {
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
firewall_cmd=firewall-cmd
|
||||
init_name=firewalld
|
||||
config_dir=/etc/firewalld
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
firewall_cmd=Full path to firewall-cmd program,0
|
||||
init_name=FirewallD init script name,0
|
||||
config_dir=FirewallD configuration directory,0
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Show a page for manually editing FirewallD config files
|
||||
|
||||
require './firewalld-lib.pl';
|
||||
&ui_print_header(undef, $text{'manual_title'}, "");
|
||||
&ReadParse();
|
||||
my @files = &unique(&get_config_files());
|
||||
my $file = $in{'file'} || $files[0];
|
||||
&indexof($file, @files) >= 0 || &error($text{'manual_efile'});
|
||||
|
||||
# Show the file selector
|
||||
print &ui_form_start("edit_manual.cgi");
|
||||
print "<b>$text{'manual_editsel'}</b>\n";
|
||||
print &ui_select("file", $file, \@files),"\n";
|
||||
print &ui_submit($text{'manual_ok'});
|
||||
print &ui_form_end();
|
||||
|
||||
# Show the file contents
|
||||
print &ui_form_start("save_manual.cgi", "form-data");
|
||||
print &ui_hidden("file", $file);
|
||||
print &ui_table_start(undef, undef, 2);
|
||||
$data = &read_file_contents($file);
|
||||
print &ui_table_row(undef, ui_textarea("data", $data, 20, 80), 2);
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ "save", $text{'save'} ] ]);
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
|
||||
@@ -495,21 +495,4 @@ $out = &backquote_logged(&$get_cmd('permanent')." 2>&1 </dev/null");
|
||||
return $? ? $out : undef;
|
||||
}
|
||||
|
||||
sub get_config_files
|
||||
{
|
||||
my $conf_dir = $config{'config_dir'} || '/etc/firewalld';
|
||||
my @conf_files;
|
||||
my @dirpath = ($conf_dir);
|
||||
eval "use File::Find;";
|
||||
if (!$@) {
|
||||
find(sub {
|
||||
my $file = $File::Find::name;
|
||||
push(@conf_files, $file)
|
||||
if (-f $file && $file =~ /\.(conf|xml)$/);
|
||||
}, @dirpath);
|
||||
}
|
||||
push(@conf_files, "$conf_dir/direct.xml");
|
||||
return @conf_files;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -76,7 +76,6 @@ if ($ok) {
|
||||
$text{'index_sadd'}),
|
||||
&ui_link("edit_forward.cgi?new=1&zone=".&urlize($zone->{'name'}),
|
||||
$text{'index_fadd'}),
|
||||
&ui_link("edit_manual.cgi", $text{'index_manual'}),
|
||||
);
|
||||
if (@{$zone->{'services'}} || @{$zone->{'ports'}}) {
|
||||
my @tds = ( "width=5" );
|
||||
|
||||
@@ -38,14 +38,6 @@ index_restart_firewalld=Reload FirewallD
|
||||
index_restart_firewallddesc=Reload the FirewallD server and apply the rules that were permanently created.
|
||||
index_listrules_restartdesc=List details about existing rich and direct FirewallD rules in $1 zone.
|
||||
index_dependent=Failed to restart $1 dependent service
|
||||
index_manual=Edit Config Files.
|
||||
|
||||
manual_title=Edit Config Files
|
||||
manual_editsel=Edit FirewallD configuration file
|
||||
manual_err=Failed to save config file
|
||||
manual_efile=Selected configuration file is not valid
|
||||
manual_ok=Edit
|
||||
|
||||
|
||||
port_edit=Edit Port
|
||||
port_create=Add Port
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Update the manually edited FirewallD config file
|
||||
|
||||
require './firewalld-lib.pl';
|
||||
&ReadParseMime();
|
||||
&error_setup($text{'manual_err'});
|
||||
my @files = &unique(&get_config_files());
|
||||
my $file = $in{'file'};
|
||||
&indexof($file, @files) >= 0 || &error($text{'manual_efile'});
|
||||
|
||||
$in{'data'} =~ s/\r//g;
|
||||
|
||||
&open_lock_tempfile(my $data, ">$file");
|
||||
&print_tempfile($data, $in{'data'});
|
||||
&close_tempfile($data);
|
||||
|
||||
&webmin_log("manual", undef, $file);
|
||||
&redirect("");
|
||||
|
||||
87
miniserv.pl
87
miniserv.pl
@@ -323,8 +323,8 @@ if ($use_syslog) {
|
||||
# get the time zone
|
||||
if ($config{'log'}) {
|
||||
local(@gmt, @lct, $days, $hours, $mins);
|
||||
@gmt = gmtime(time());
|
||||
@lct = localtime(time());
|
||||
@gmt = gmtime(time_local());
|
||||
@lct = localtime(time_local());
|
||||
$days = $lct[3] - $gmt[3];
|
||||
$hours = ($days < -1 ? 24 : 1 < $days ? -24 : $days * 24) +
|
||||
$lct[2] - $gmt[2];
|
||||
@@ -590,7 +590,7 @@ if ($config{'logclear'}) {
|
||||
local $write_logtime = 0;
|
||||
local @st = stat("$config{'logfile'}.time");
|
||||
if (@st) {
|
||||
if ($st[9]+$config{'logtime'}*60*60 < time()){
|
||||
if ($st[9]+$config{'logtime'}*60*60 < time_local()){
|
||||
# need to clear log
|
||||
$write_logtime = 1;
|
||||
unlink($config{'logfile'});
|
||||
@@ -599,7 +599,7 @@ if ($config{'logclear'}) {
|
||||
else { $write_logtime = 1; }
|
||||
if ($write_logtime) {
|
||||
open(LOGTIME, ">$config{'logfile'}.time");
|
||||
print LOGTIME time(),"\n";
|
||||
print LOGTIME time_local(),"\n";
|
||||
close(LOGTIME);
|
||||
}
|
||||
sleep(5*60);
|
||||
@@ -686,12 +686,12 @@ while(1) {
|
||||
# Stop flag file created
|
||||
&term_handler();
|
||||
}
|
||||
local $time_now = time();
|
||||
local $time_now = time_local();
|
||||
|
||||
# Clean up processes that have been idle for too long, if configured
|
||||
if ($config{'maxlifetime'}) {
|
||||
foreach my $c (@childpids) {
|
||||
my $age = time() - $childstarts{$c};
|
||||
my $age = time_local() - $childstarts{$c};
|
||||
if ($childstarts{$c} &&
|
||||
$age > $config{'maxlifetime'}) {
|
||||
kill(9, $c);
|
||||
@@ -938,7 +938,7 @@ while(1) {
|
||||
exit;
|
||||
}
|
||||
push(@childpids, $handpid);
|
||||
$childstarts{$handpid} = time();
|
||||
$childstarts{$handpid} = time_local();
|
||||
push(@$ipconns, $handpid);
|
||||
push(@$netconns, $handpid);
|
||||
if ($need_pipes) {
|
||||
@@ -1149,7 +1149,7 @@ while(1) {
|
||||
'host' => $host,
|
||||
'step' => 0,
|
||||
'cid' => $cid,
|
||||
'time' => time() };
|
||||
'time' => time_local() };
|
||||
print $outfd "3 Password\n";
|
||||
}
|
||||
else {
|
||||
@@ -1158,7 +1158,7 @@ while(1) {
|
||||
$conv = { 'user' => $realuser,
|
||||
'host' => $host,
|
||||
'cid' => $cid,
|
||||
'time' => time() };
|
||||
'time' => time_local() };
|
||||
local ($PAMINr, $PAMINw, $PAMOUTr,
|
||||
$PAMOUTw) = &allocate_pipes();
|
||||
local $pampid = fork();
|
||||
@@ -1205,10 +1205,9 @@ while(1) {
|
||||
# This must be the password .. try it
|
||||
# and send back the results
|
||||
local ($vu, $expired, $nonexist) =
|
||||
&validate_user_caseless(
|
||||
$conv->{'user'},
|
||||
$answer,
|
||||
$conf->{'host'});
|
||||
&validate_user($conv->{'user'},
|
||||
$answer,
|
||||
$conf->{'host'});
|
||||
local $ok = $vu ? 1 : 0;
|
||||
print $outfd "2 $conv->{'user'} $ok $expired $notexist\n";
|
||||
&end_pam_conversation($conv);
|
||||
@@ -1217,14 +1216,14 @@ while(1) {
|
||||
elsif ($inline =~ /^writesudo\s+(\S+)\s+(\d+)/) {
|
||||
# Store the fact that some user can sudo to root
|
||||
local ($user, $ok) = ($1, $2);
|
||||
$sudocache{$user} = $ok." ".time();
|
||||
$sudocache{$user} = $ok." ".time_local();
|
||||
}
|
||||
elsif ($inline =~ /^readsudo\s+(\S+)/) {
|
||||
# Query the user sudo cache (valid for 1 minute)
|
||||
local $user = $1;
|
||||
local ($ok, $last) =
|
||||
split(/\s+/, $sudocache{$user});
|
||||
if ($last < time()-60) {
|
||||
if ($last < time_local()-60) {
|
||||
# Cache too old
|
||||
print $outfd "2\n";
|
||||
}
|
||||
@@ -1264,7 +1263,7 @@ else {
|
||||
$acpthost = $acptip;
|
||||
}
|
||||
$loghost = $acpthost;
|
||||
$datestr = &http_date(time());
|
||||
$datestr = &http_date(time_local());
|
||||
$ok_code = 200;
|
||||
$ok_message = "Document follows";
|
||||
$logged_code = undef;
|
||||
@@ -1718,8 +1717,8 @@ if (!$validated && !$deny_authentication && !$config{'session'} &&
|
||||
($authuser, $authpass) = split(/:/, &b64decode($1), 2);
|
||||
print DEBUG "handle_request: doing basic auth check authuser=$authuser authpass=$authpass\n";
|
||||
local ($vu, $expired, $nonexist, $wvu) =
|
||||
&validate_user_caseless($authuser, $authpass, $host,
|
||||
$acptip, $port);
|
||||
&validate_user($authuser, $authpass, $host,
|
||||
$acptip, $port);
|
||||
print DEBUG "handle_request: vu=$vu expired=$expired nonexist=$nonexist\n";
|
||||
if ($vu && (!$expired || $config{'passwd_mode'} == 1)) {
|
||||
$authuser = $vu;
|
||||
@@ -1814,8 +1813,8 @@ if ($config{'session'} && !$deny_authentication &&
|
||||
}
|
||||
|
||||
local ($vu, $expired, $nonexist, $wvu) =
|
||||
&validate_user_caseless($in{'user'}, $in{'pass'}, $host,
|
||||
$acptip, $port);
|
||||
&validate_user($in{'user'}, $in{'pass'}, $host,
|
||||
$acptip, $port);
|
||||
if ($vu && $wvu) {
|
||||
my $uinfo = &get_user_details($wvu, $vu);
|
||||
if ($uinfo && $uinfo->{'twofactor_provider'}) {
|
||||
@@ -2713,7 +2712,7 @@ else {
|
||||
"Server: $config{server}\r\n".
|
||||
"Content-type: ".&get_type($full)."\r\n".
|
||||
"Last-Modified: ".&http_date($stopen[9])."\r\n".
|
||||
"Expires: ".&http_date(time()+$etime)."\r\n".
|
||||
"Expires: ".&http_date(time_local()+$etime)."\r\n".
|
||||
"Cache-Control: public; max-age=".$etime."\r\n";
|
||||
|
||||
if (!$gzipped && $use_gzip && $acceptenc{'gzip'} &&
|
||||
@@ -3311,7 +3310,7 @@ if ($config{'log'}) {
|
||||
# make_datestr()
|
||||
sub make_datestr
|
||||
{
|
||||
local @tm = localtime(time());
|
||||
local @tm = localtime(time_local());
|
||||
return sprintf "%2.2d/%s/%4.4d:%2.2d:%2.2d:%2.2d %s",
|
||||
$tm[3], $month[$tm[4]], $tm[5]+1900,
|
||||
$tm[2], $tm[1], $tm[0], $timezone;
|
||||
@@ -3580,20 +3579,6 @@ sub urlize {
|
||||
return $tmp2;
|
||||
}
|
||||
|
||||
# validate_user_caseless(username, password, host, remote-ip, webmin-port)
|
||||
# Calls validate_user, but also checks the lower case name if the given login
|
||||
# is mixed case
|
||||
sub validate_user_caseless
|
||||
{
|
||||
my @args = @_;
|
||||
my @rv = &validate_user(@args);
|
||||
if (!$rv[0] && $args[0] ne lc($args[0])) {
|
||||
$args[0] = lc($args[0]);
|
||||
@rv = &validate_user(@args);
|
||||
}
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# validate_user(username, password, host, remote-ip, webmin-port)
|
||||
# Checks if some username and password are valid. Returns the modified username,
|
||||
# the expired / temp pass flag, the non-existence flag, and the underlying
|
||||
@@ -3623,7 +3608,7 @@ elsif ($canmode == 1) {
|
||||
local $lc = $uinfo->{'lastchanges'};
|
||||
print DEBUG "validate_user: Password is valid lc=$lc pass_maxdays=$config{'pass_maxdays'}\n";
|
||||
if ($config{'pass_maxdays'} && $lc && !$uinfo->{'nochange'}) {
|
||||
local $daysold = (time() - $lc)/(24*60*60);
|
||||
local $daysold = (time_local() - $lc)/(24*60*60);
|
||||
print DEBUG "maxdays=$config{'pass_maxdays'} daysold=$daysold temppass=$uinfo->{'temppass'}\n";
|
||||
if ($config{'pass_lockdays'} &&
|
||||
$daysold > $config{'pass_lockdays'}) {
|
||||
@@ -3760,10 +3745,10 @@ elsif ($config{'passwd_file'}) {
|
||||
# Password may have expired!
|
||||
local $c = $l[$config{'passwd_cindex'}];
|
||||
local $m = $l[$config{'passwd_mindex'}];
|
||||
local $day = time()/(24*60*60);
|
||||
local $day = time_local()/(24*60*60);
|
||||
print DEBUG "validate_unix_user: c=$c m=$m day=$day\n";
|
||||
$m ||= 0;
|
||||
if ($c =~ /^\d+/ && $m =~ /^\d+/ && $day - $c > $m) {
|
||||
if ($c =~ /^\d+/ && $day - $c > $m) {
|
||||
# Yep, it has ..
|
||||
$rv = 2;
|
||||
}
|
||||
@@ -4149,7 +4134,7 @@ sub check_user_time
|
||||
local ($username) = @_;
|
||||
local $uinfo = &get_user_details($username);
|
||||
return 1 if (!$uinfo || !$uinfo->{'allowdays'} && !$uinfo->{'allowhours'});
|
||||
local @tm = localtime(time());
|
||||
local @tm = localtime(time_local());
|
||||
if ($uinfo->{'allowdays'}) {
|
||||
# Make sure day is allowed
|
||||
return 0 if (&indexof($tm[6], @{$uinfo->{'allowdays'}}) < 0);
|
||||
@@ -4334,7 +4319,7 @@ sub write_login_utmp
|
||||
if ($write_utmp) {
|
||||
# Write utmp record for login
|
||||
%utmp = ( 'ut_host' => $_[1],
|
||||
'ut_time' => time(),
|
||||
'ut_time' => time_local(),
|
||||
'ut_user' => $_[0],
|
||||
'ut_type' => 7, # user process
|
||||
'ut_pid' => $miniserv_main_pid,
|
||||
@@ -4356,7 +4341,7 @@ sub write_logout_utmp
|
||||
if ($write_utmp) {
|
||||
# Write utmp record for logout
|
||||
%utmp = ( 'ut_host' => $_[1],
|
||||
'ut_time' => time(),
|
||||
'ut_time' => time_local(),
|
||||
'ut_user' => $_[0],
|
||||
'ut_type' => 8, # dead process
|
||||
'ut_pid' => $miniserv_main_pid,
|
||||
@@ -4459,7 +4444,7 @@ if (!$line) {
|
||||
$line = <$pr>;
|
||||
$line =~ s/\r|\n//g;
|
||||
}
|
||||
$conf->{'last'} = time();
|
||||
$conf->{'last'} = time_local();
|
||||
if (!$line) {
|
||||
# Failed!
|
||||
print $fh "0 PAM conversation error\n";
|
||||
@@ -4501,7 +4486,7 @@ sub send_pam_answer
|
||||
{
|
||||
local ($conf, $answer) = @_;
|
||||
local $pw = $conf->{'PAMINw'};
|
||||
$conf->{'last'} = time();
|
||||
$conf->{'last'} = time_local();
|
||||
print $pw "$answer\n";
|
||||
}
|
||||
|
||||
@@ -5796,7 +5781,7 @@ lc($rheader{'sec-websocket-accept'}) eq lc($bdigest) ||
|
||||
# Start forwarding data
|
||||
seek(DEBUG, 0, 2);
|
||||
print DEBUG "in websockets loop\n";
|
||||
my $last_session_check_time = time();
|
||||
my $last_session_check_time = time_local();
|
||||
while(1) {
|
||||
my $rmask = undef;
|
||||
vec($rmask, fileno($fh), 1) = 1;
|
||||
@@ -5815,7 +5800,7 @@ while(1) {
|
||||
last if (!defined($buf) || length($buf) == 0);
|
||||
syswrite($fh, $buf, length($buf)) || last;
|
||||
}
|
||||
my $now = time();
|
||||
my $now = time_local();
|
||||
if ($now - $last_session_check_time > 10) {
|
||||
# Re-validate the browser session every 10 seconds
|
||||
print DEBUG "verifying websockets session $session_id\n";
|
||||
@@ -6299,7 +6284,7 @@ if ($salt =~ /^\$6\$([^\$]+)/) {
|
||||
# Extract actual salt from already encrypted password
|
||||
$salt = $1;
|
||||
}
|
||||
$salt ||= '$6$'.substr(time(), -8).'$';
|
||||
$salt ||= '$6$'.substr(time_local(), -8).'$';
|
||||
return crypt($passwd, $salt);
|
||||
}
|
||||
|
||||
@@ -6352,7 +6337,7 @@ close(ARFILE);
|
||||
sub execute_ready_webmin_crons
|
||||
{
|
||||
my ($runs) = @_;
|
||||
my $now = time();
|
||||
my $now = time_local();
|
||||
my $changed = 0;
|
||||
foreach my $cron (@webmincrons) {
|
||||
my $run = 0;
|
||||
@@ -6824,6 +6809,12 @@ my ($key) = @_;
|
||||
return $ENV{ uc($key) } || $ENV{ lc($key) };
|
||||
}
|
||||
|
||||
# time_local()
|
||||
sub time_local
|
||||
{
|
||||
return time() + ($config{'timezone_offset'} || 0);
|
||||
}
|
||||
|
||||
# open_socket(host, port, filehandle)
|
||||
# Connect to a TCP port on some host. Returns undef on success, or an error
|
||||
# message on failure.
|
||||
|
||||
@@ -1217,8 +1217,8 @@ local $file = @old ? $old[0]->{'file'} :
|
||||
local $lref = &read_file_lines($file);
|
||||
|
||||
for(my $i=0; $i<@old || $i<@$values; $i++) {
|
||||
local $old = $i < @old ? $old[$i] : undef;
|
||||
local $line = $i < @$values || $values->[$i] eq "" ? $name :
|
||||
local $old = $old[$i];
|
||||
local $line = $values->[$i] eq "" ? $name :
|
||||
"$name = $values->[$i]";
|
||||
if ($old && defined($values->[$i])) {
|
||||
# Updating
|
||||
|
||||
@@ -646,7 +646,7 @@ if ($has_pdbedit) {
|
||||
local $out = &backquote_logged(
|
||||
"cd / && $config{'pdbedit'} -a -s $config{'smb_conf'} -t -u ".
|
||||
quotemeta($user->{'name'}).
|
||||
($config{'sync_gid'} ? " -g $config{'sync_gid'}" : "").
|
||||
($config{'sync_gid'} ? " -G $config{'sync_gid'}" : "").
|
||||
" -c '[".join("", @opts)."]' $ws <$temp 2>&1");
|
||||
$? && &error("$config{'pdbedit'} failed : <pre>$out</pre>");
|
||||
}
|
||||
|
||||
@@ -201,11 +201,9 @@ $passmode = $pass eq "" && $random_password eq "" ? 0 :
|
||||
$pass && $pass ne $config{'lock_string'} &&
|
||||
$random_password eq "" ? 2 : -1;
|
||||
$pffunc = $config{'passwd_stars'} ? \&ui_password : \&ui_textbox;
|
||||
my $modes = [];
|
||||
if ($passmode eq '0' || $config{'empty_mode'}) {
|
||||
push(@{$modes}, [ 0, $config{'empty_mode'} ? $text{'none1'} : $text{'none2'} ]);
|
||||
}
|
||||
push(@{$modes},
|
||||
print &ui_table_row(&hlink($text{'pass'}, "pass"),
|
||||
&ui_radio_table("passmode", $passmode,
|
||||
[ [ 0, $config{'empty_mode'} ? $text{'none1'} : $text{'none2'} ],
|
||||
[ 1, $text{'nologin'} ],
|
||||
[ 3, $text{'clear'},
|
||||
&$pffunc("pass", $config{'random_password'} && $n eq "" ?
|
||||
@@ -214,9 +212,8 @@ push(@{$modes},
|
||||
( [ 2, $text{'nochange'},
|
||||
&ui_hidden("encpass", $pass) ] ) :
|
||||
( [ 2, $text{'encrypted'},
|
||||
&ui_textbox("encpass", $passmode == 2 ? $pass : "", 60) ] ));
|
||||
print &ui_table_row(&hlink($text{'pass'}, "pass"),
|
||||
&ui_radio_table("passmode", $passmode, $modes).
|
||||
&ui_textbox("encpass", $passmode == 2 ? $pass : "", 60) ] )
|
||||
]).
|
||||
($can_disable ? " ".&ui_checkbox("disable", 1,
|
||||
$text{'uedit_disabled'}, $disabled) : "")
|
||||
);
|
||||
|
||||
@@ -327,8 +327,7 @@ my $tmp_base = $gconfig{'tempdir_'.&get_module_name()} ?
|
||||
$ENV{'TMP'} && $ENV{'TMP'} ne "/tmp" ? $ENV{'TMP'} :
|
||||
-d "c:/temp" ? "c:/temp" : "/tmp/.webmin";
|
||||
my $tmp_dir;
|
||||
if (@remote_user_info && -d $remote_user_info[7] &&
|
||||
-w $remote_user_info[7] && !$gconfig{'nohometemp'}) {
|
||||
if (@remote_user_info && -d $remote_user_info[7] && !$gconfig{'nohometemp'}) {
|
||||
$tmp_dir = "$remote_user_info[7]/.tmp";
|
||||
}
|
||||
elsif (@remote_user_info) {
|
||||
@@ -1996,21 +1995,14 @@ if (!$@) {
|
||||
my $opts = ref($only) ? $only : {};
|
||||
my $locale_default = &get_default_system_locale();
|
||||
my $locale_auto = &parse_accepted_language();
|
||||
my $locale_name = $opts->{'locale'} || $gconfig{'locale_'.$remote_user} ||
|
||||
$locale_auto || $gconfig{'locale'} || &get_default_system_locale();
|
||||
my $locale_name = $opts->{'locale'} || $gconfig{'locale_'.$remote_user} || $locale_auto || $gconfig{'locale'} || &get_default_system_locale();
|
||||
my $tz = $opts->{'tz'};
|
||||
if (!$tz) {
|
||||
eval {
|
||||
$tz =
|
||||
DateTime::TimeZone->new(name => strftime("%z", localtime()))->name(); # +0200
|
||||
$tz = DateTime::TimeZone->new( name => 'local' )->name(); # Asia/Nicosia
|
||||
};
|
||||
if ($@) {
|
||||
eval {
|
||||
$tz = DateTime::TimeZone->new(name => 'local')->name(); # Asia/Nicosia
|
||||
};
|
||||
if ($@) {
|
||||
$tz = DateTime::TimeZone->new(name => 'UTC')->name(); # UTC
|
||||
}
|
||||
$tz = DateTime::TimeZone->new( name => 'UTC' )->name(); # UTC
|
||||
}
|
||||
}
|
||||
my $locale = DateTime::Locale->load($locale_name);
|
||||
|
||||
Reference in New Issue
Block a user