forked from webmin/authentic-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings-upload_save.cgi
executable file
·93 lines (85 loc) · 3.11 KB
/
settings-upload_save.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/perl
#
# Authentic Theme 14.02 (https://github.com/qooob/authentic-theme)
# Copyright 2015 Ilia Rostovtsev <programming@rostovtsev.ru>
# Licensed under MIT (https://github.com/qooob/authentic-theme/blob/master/LICENSE)
#
BEGIN { push( @INC, ".." ); }
use WebminCore;
&init_config();
&ReadParseMime();
&switch_to_remote_user();
do "authentic-theme/authentic-lib.cgi";
__config_dir_available();
if ( usermin_available() ) {
( our $_usermin_config_directory = $config_directory )
=~ s/webmin/usermin/;
}
if ( $in{'authenticated_logo'} eq "true"
&& length $in{'authenticated_logo_file'} )
{
unlink_file( $config_directory . "/authentic-theme/logo.png" );
write_file_contents( $config_directory . '/authentic-theme/logo.png',
$in{'authenticated_logo_file'} );
if ( usermin_available() ) {
unlink_file(
$_usermin_config_directory . "/authentic-theme/logo.png" );
write_file_contents(
$_usermin_config_directory . '/authentic-theme/logo.png',
$in{'authenticated_logo_file'} );
}
if ( -s $config_directory
. "/authentic-theme/logo.png" ne -s $root_directory
. "/authentic-theme/images/logo.png" )
{
copy_source_dest(
$config_directory . "/authentic-theme/logo.png",
$root_directory . "/authentic-theme/images"
);
}
}
elsif ( $in{'authenticated_logo'} ne "true" ) {
unlink_file( $config_directory . '/authentic-theme/logo.png' );
unlink_file( $root_directory . '/authentic-theme/images/logo.png' );
if ( usermin_available() ) {
unlink_file(
$_usermin_config_directory . "/authentic-theme/logo.png" );
}
}
if ( $in{'unauthenticated_logo'} eq "true"
&& length $in{'unauthenticated_logo_file'} )
{
unlink_file( $config_directory . "/authentic-theme/logo_welcome.png" );
write_file_contents(
$config_directory . '/authentic-theme/logo_welcome.png',
$in{'unauthenticated_logo_file'} );
if ( usermin_available() ) {
unlink_file( $_usermin_config_directory
. "/authentic-theme/logo_welcome.png" );
write_file_contents(
$_usermin_config_directory . '/authentic-theme/logo_welcome.png',
$in{'unauthenticated_logo_file'}
);
}
if ( -s $config_directory
. "/authentic-theme/logo_welcome.png" ne -s $root_directory
. "/authentic-theme/images/logo_welcome.png" )
{
copy_source_dest(
$config_directory . "/authentic-theme/logo_welcome.png",
$root_directory . "/authentic-theme/images"
);
}
}
elsif ( $in{'unauthenticated_logo'} ne "true" ) {
unlink_file( $config_directory . '/authentic-theme/logo_welcome.png' );
unlink_file(
$root_directory . '/authentic-theme/images/logo_welcome.png' );
if ( usermin_available() ) {
unlink_file( $_usermin_config_directory
. "/authentic-theme/logo_welcome.png" );
}
}
copy_source_dest( $config_directory . "/authentic-theme/" . $logo . ".png",
$root_directory . "/authentic-theme/images" );
&redirect('settings-upload.cgi?saved=1');