-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsend_main.cgi
More file actions
executable file
·164 lines (138 loc) · 4.76 KB
/
send_main.cgi
File metadata and controls
executable file
·164 lines (138 loc) · 4.76 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/usr/bin/perl
# Copyright (C) 2004-2019
# Emmanuel Saracco <emmanuel@esaracco.fr>
#
# GNU GENERAL PUBLIC LICENSE
require './translator-lib.pl';
my ($_success, $_error, $_info) = ('', '', '');
my $module_type = ($in{'module_type'}) ? $in{'module_type'} : 'core';
my $old_module_type = $in{'old_module_type'}||'';
my @array_app = ($module_type ne $old_module_type) ? () : split(/\0/, $in{'app'});
push (@array_app, $in{'app'}) if (!scalar (@array_app) && $in{'app'});
my $multiple_modules = (scalar (@array_app) > 1);
my $app = ($multiple_modules) ? $text{'MULTIPLE_MODULES'} : $array_app[0];
my $lang = $in{'lang'};
my $email = $in{'email'};
##my $do_not_display = $in{'do_not_display'};
my $bad_email = '';
my $not_display = 0;
my $action = (defined($in{'send_email_webmin'}) ||
defined($in{'send_email_owner'}));
if ($app && !$multiple_modules && !$in{'module_type'})
{
$module_type = (&trans_is_webmin_module ($app)) ? 'core' : 'non-core';
}
# init_msg ()
#
# Set success or error message.
#
sub init_msg ()
{
if ($bad_email ne '')
{
$_error = sprintf ($text{'MSG_BAD_EMAIL_ERROR'}, $bad_email);
}
elsif ($action)
{
if ($app eq '')
{
$_error = $text{'MSG_ERROR_CHOOSE_MODULE'};
}
elsif (defined ($in{'send_email_owner'}) && $email eq '')
{
$_error = $text{'MSG_ERROR_ENTER_EMAIL'};
}
}
}
##### POST actions #####
#
# send email with archive attached
if ($action && $app ne '')
{
my $tmp_email = '';
$tmp_email = $in{'email'} if (defined($in{'send_email_owner'}));
# translation team
if ($tmp_email eq '' && !defined($in{'send_email_owner'}))
{
$tmp_email = ($config{'trans_team_email'} ne '') ?
$config{'trans_team_email'} : 'translations@webmin.com';
}
# specific address
else
{
$tmp_email = $in{'email'};
}
# check email
$bad_email = $tmp_email;
$tmp_email = &trans_email_check ($tmp_email);
# ok
if ($tmp_email ne '')
{
my $url = '';
&trans_set_user_var ("default_email_$app", $tmp_email)
if ($module_type eq 'non-core');
$url = 'send_build.cgi?l='.&urlize($lang).'&e='.&urlize($tmp_email).'&app=';
foreach my $mod (@array_app)
{
$url .= &urlize($mod).'|';
};
$url =~ s/\|$//;
&redirect ($url);
exit;
}
}
else
{
$email = &trans_get_user_var ("default_email_$app");
}
#
########################
##if ($do_not_display)
##{
## open (H, '>',
## "/$config{'trans_working_path'}/.translator/$remote_user/not_display_flg");
## close (H);
##}
##$not_display = (-f "/$config{'trans_working_path'}/.translator/$remote_user/not_display_flg");
&trans_header ($text{'SEND_TITLE'}, $app, $lang);
&trans_get_menu_icons_panel ('send_main', ($multiple_modules)?undef:$app);
print qq(<br/>$text{'SEND_DESCRIPTION1'});
# Set success or error msg
&init_msg ();
print qq(<p>);
print qq(<form action="send_main.cgi" method="post">);
print qq(<input type="hidden" name="old_module_type" value="$module_type">);
# radio for choosing to display "core" or "non-core" modules
print qq(<p>$text{'CHOOSE_MODULES_TYPE'}:</p>);
print "<p><input onChange=\"getElementById('app').selectedIndex=-1;submit()\" type=\"radio\" id='mt1' name=\"module_type\" value=\"core\"" .
(($module_type eq 'core') ? ' checked="checked"' : '') . "> <label for='mt1'> $text{'CORE_MODULES'}</label> ";
print "<input onChange=\"getElementById('app').selectedIndex=-1;submit()\" type=\"radio\" id='mt2' name=\"module_type\" value=\"non-core\"" .
(($module_type eq 'non-core') ? ' checked="checked"' : '') . "> <label for='mt2'> $text{'NON_CORE_MODULES'}</label></p>";
&trans_modules_list_get_options (\@array_app, $module_type);
if (scalar (@array_app))
{
if (($module_type eq 'non-core') && !$not_display)
{
## $_info = qq($text{'SEND_EMAIL_ALERT1'}<br/><input type="checkbox" name="do_not_display" value="1" onclick="submit()"> $text{'SEND_EMAIL_ALERT2'});
$_info = $text{'SEND_EMAIL_ALERT1'};
}
print qq(<p>$text{'SEND_DESCRIPTION2'}</p>);
print qq(<p><select name="lang">);
printf qq(<option value="">$text{'ALL_LANGUAGES'}</option>);
foreach my $m (&trans_get_existing_translations (\@array_app))
{
print qq(<option value="$m">$m</option>);
}
print "</select></p>";
if ($module_type eq 'core')
{
print qq(
<button type="submit" class="btn btn-success btn-tiny" name="send_email_webmin"><i class="fa fa-fw fa-bolt"></i> <span>$text{'BUILD'}</span></button> $text{'SEND_CHOICE1'}.
);
}
print qq(
<p/><button type="submit" class="btn btn-success btn-tiny" name="send_email_owner"><i class="fa fa-fw fa-envelope"></i> <span>$text{'SEND'}</span></button> $text{'SEND_CHOICE2'}: <input type="text" value="$email" name="email">);
print qq(</form>);
print qq(</p>);
}
&trans_footer ('', $text{'MODULE_INDEX'}, $_success, $_error, $_info);