9 Star 27 Fork 0

Gitee 极速下载/Webmin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/webmin/webmin
克隆/下载
switch_theme.cgi 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
Ilia Ross 提交于 2025-02-21 20:58 +08:00 . Fix to always print header
#!/usr/local/bin/perl
# switch_theme.cgi
# Change the theme for the current user if allowed
BEGIN { push(@INC, "."); };
use WebminCore;
&init_config();
&ReadParse();
&PrintHeader();
my $err = sub {
print("<tt>Cannot change theme : $_[0]</tt>\n");
exit(1);
};
# Check if allowed to change theme,
# otherwise throw an error
if (!&foreign_available('theme') &&
!&foreign_available('change-user') &&
!&foreign_available('webmin') &&
!&foreign_available('acl')) {
&$err("You are not allowed to change themes!");
}
# Check if the theme is known
&$err("Theme identification is not known!")
if (!$in{'theme'} || $in{'theme'} !~ /^[123]$/);
# Check if the remote user is known
&$err("Remote user is not known!") if (!$remote_user);
# Define the theme
my $themes = {
'1' => 'authentic-theme',
'2' => 'gray-theme',
'3' => '' };
my $theme = $themes->{$in{'theme'}};
# Change the theme
&foreign_require('acl');
my @users = &acl::list_users();
my ($user) = grep { $_->{'name'} eq $remote_user } @users;
$user->{'theme'} = $theme;
&acl::modify_user($user->{'name'}, $user);
&load_theme_library();
&theme_post_change_theme() if (defined(&theme_post_change_theme));
&reload_miniserv();
print &js_redirect("/", "top");
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Perl
1
https://gitee.com/mirrors/webmin.git
git@gitee.com:mirrors/webmin.git
mirrors
webmin
Webmin
master

搜索帮助