-
-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathsave_cloud.cgi
executable file
·37 lines (33 loc) · 1.03 KB
/
save_cloud.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
#!/usr/local/bin/perl
# Save settings for one provider
require './virtual-server-lib.pl';
&ReadParse();
&licence_status();
&error_setup($text{'cloud_err'});
&can_cloud_providers() || &error($text{'clouds_ecannot'});
@provs = &list_cloud_providers();
($prov) = grep { $_->{'name'} eq $in{'name'} } @provs;
$prov || &error($text{'cloud_egone'});
if ($in{'clear'}) {
# Clear all cloud settings for this provider, to force re-enrollment
$cfunc = "cloud_".$prov->{'name'}."_clear";
&$cfunc();
&webmin_log("clear", "cloud", $in{'name'});
&redirect("list_clouds.cgi");
}
else {
# Save provider settings
$config{'cloud_'.$in{'name'}.'_reseller'} = $in{'useby_reseller'};
$config{'cloud_'.$in{'name'}.'_owner'} = $in{'useby_owner'};
$pfunc = "cloud_".$prov->{'name'}."_parse_inputs";
$html = &$pfunc(\%in);
&webmin_log("save", "cloud", $in{'name'});
if ($html) {
&ui_print_header(undef, $text{'cloud_title'}, "");
print $html;
&ui_print_footer("list_clouds.cgi", $text{'clouds_return'});
}
else {
&redirect("list_clouds.cgi");
}
}