mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 16:50:24 +00:00
Make all code strict and warnings compliant
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
do 'change-user-lib.pl';
|
||||
our (%text, %in);
|
||||
|
||||
# acl_security_form(&options)
|
||||
# Output HTML for editing security options for the acl module
|
||||
|
||||
@@ -6,11 +6,13 @@ say here.
|
||||
=cut
|
||||
|
||||
BEGIN { push(@INC, ".."); };
|
||||
use strict;
|
||||
use warnings;
|
||||
use WebminCore;
|
||||
&init_config();
|
||||
&foreign_require("acl", "acl-lib.pl");
|
||||
&foreign_require("webmin", "webmin-lib.pl");
|
||||
%access = &get_module_acl();
|
||||
my %access = &get_module_acl();
|
||||
|
||||
=head2 can_change_pass(&user)
|
||||
|
||||
@@ -19,7 +21,8 @@ Returns 1 if some user's password can be changed.
|
||||
=cut
|
||||
sub can_change_pass
|
||||
{
|
||||
return $_[0]->{'pass'} ne 'x' && $_[0]->{'pass'} ne 'e' && !$_[0]{'sync'} &&
|
||||
$_[0]->{'pass'} ne "*LK*";
|
||||
my ($user) = @_;
|
||||
return $user->{'pass'} ne 'x' && $user->{'pass'} ne 'e' && !$user->{'sync'} &&
|
||||
$user->{'pass'} ne "*LK*";
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
# change.cgi
|
||||
# Make all the changes, and re-direct to / in case the theme has changed
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
require './change-user-lib.pl';
|
||||
our (%text, %in, %gconfig, $base_remote_user, %access);
|
||||
&ReadParse();
|
||||
|
||||
@users = &acl::list_users();
|
||||
($user) = grep { $_->{'name'} eq $base_remote_user } @users;
|
||||
$oldtheme = $user->{'theme'};
|
||||
$oldoverlay = $user->{'overlay'};
|
||||
my @users = &acl::list_users();
|
||||
my ($user) = grep { $_->{'name'} eq $base_remote_user } @users;
|
||||
my $oldtheme = $user->{'theme'};
|
||||
my $oldoverlay = $user->{'overlay'};
|
||||
if (!defined($oldtheme)) {
|
||||
($oldtheme, $oldoverlay) = split(/\s+/, $gconfig{'theme'});
|
||||
}
|
||||
@@ -18,7 +21,7 @@ if ($access{'pass'} && &can_change_pass($user) && !$in{'pass_def'}) {
|
||||
$in{'pass'} =~ /:/ && &error($text{'change_ecolon'});
|
||||
$in{'pass'} eq $in{'pass2'} ||
|
||||
&error($text{'change_epass2'});
|
||||
$perr = &acl::check_password_restrictions(
|
||||
my $perr = &acl::check_password_restrictions(
|
||||
$user->{'name'}, $in{'pass'});
|
||||
&error(&text('change_epass', $perr)) if ($perr);
|
||||
}
|
||||
@@ -34,6 +37,7 @@ if ($access{'lang'}) {
|
||||
}
|
||||
|
||||
# Parse custom theme and possibly overlay
|
||||
my ($newoverlay, $newtheme);
|
||||
if ($access{'theme'}) {
|
||||
if ($in{'theme_def'}) {
|
||||
$user->{'theme'} = undef;
|
||||
@@ -54,7 +58,7 @@ if ($access{'theme'}) {
|
||||
else {
|
||||
$newoverlay = $in{'overlay'};
|
||||
$user->{'theme'} || &error($text{'change_eoverlay'});
|
||||
%oinfo = &get_theme_info($in{'overlay'});
|
||||
my %oinfo = &get_theme_info($in{'overlay'});
|
||||
if ($oinfo{'overlays'} &&
|
||||
&indexof($user->{'theme'},
|
||||
split(/\s+/, $oinfo{'overlays'})) < 0) {
|
||||
|
||||
@@ -2,16 +2,20 @@
|
||||
# index.cgi
|
||||
# Display the user's current language, theme and password
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
require './change-user-lib.pl';
|
||||
our (%text, %access, $base_remote_user, $default_lang, %gconfig);
|
||||
&ui_print_header(undef, $text{'index_title'}, "", undef, 0, 1);
|
||||
|
||||
@users = &acl::list_users();
|
||||
($user) = grep { $_->{'name'} eq $base_remote_user } @users;
|
||||
my @users = &acl::list_users();
|
||||
my ($user) = grep { $_->{'name'} eq $base_remote_user } @users;
|
||||
|
||||
my @can;
|
||||
push(@can, 'lang') if ($access{'lang'});
|
||||
push(@can, 'theme') if ($access{'theme'});
|
||||
push(@can, 'pass') if ($access{'pass'} && &can_change_pass($user));
|
||||
$can = &text('index_d'.scalar(@can), map { $text{'index_d'.$_} } @can);
|
||||
my $can = &text('index_d'.scalar(@can), map { $text{'index_d'.$_} } @can);
|
||||
print &text('index_desc2', $can),"<p>\n";
|
||||
|
||||
print &ui_form_start("change.cgi", "post");
|
||||
@@ -19,9 +23,9 @@ print &ui_table_start(undef, undef, 2);
|
||||
|
||||
if ($access{'lang'}) {
|
||||
# Show personal language
|
||||
@langs = &list_languages();
|
||||
$glang = $gconfig{"lang"} || $default_lang;
|
||||
($linfo) = grep { $_->{'lang'} eq $glang } @langs;
|
||||
my @langs = &list_languages();
|
||||
my $glang = $gconfig{"lang"} || $default_lang;
|
||||
my ($linfo) = grep { $_->{'lang'} eq $glang } @langs;
|
||||
print &ui_table_row($text{'index_lang'},
|
||||
&ui_radio("lang_def", $user->{'lang'} ? 0 : 1,
|
||||
[ [ 1, &text('index_langglobal',
|
||||
@@ -35,17 +39,18 @@ if ($access{'lang'}) {
|
||||
|
||||
if ($access{'theme'}) {
|
||||
# Show personal theme
|
||||
my $tname;
|
||||
if ($gconfig{'theme'}) {
|
||||
($gtheme, $goverlay) = split(/\s+/, $gconfig{'theme'});
|
||||
%tinfo = &webmin::get_theme_info($gtheme);
|
||||
my ($gtheme, $goverlay) = split(/\s+/, $gconfig{'theme'});
|
||||
my %tinfo = &webmin::get_theme_info($gtheme);
|
||||
$tname = $tinfo{'desc'};
|
||||
}
|
||||
else {
|
||||
$tname = $text{'index_themedef'};
|
||||
}
|
||||
@all = &webmin::list_themes();
|
||||
@themes = grep { !$_->{'overlay'} } @all;
|
||||
@overlays = grep { $_->{'overlay'} } @all;
|
||||
my @all = &webmin::list_themes();
|
||||
my @themes = grep { !$_->{'overlay'} } @all;
|
||||
my @overlays = grep { $_->{'overlay'} } @all;
|
||||
|
||||
# Main theme
|
||||
print &ui_table_row($text{'index_theme'},
|
||||
|
||||
Reference in New Issue
Block a user