File: save_local.cgi

package info (click to toggle)
webmin 1.180-3sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 16,900 kB
  • ctags: 2,152
  • sloc: perl: 55,792; java: 1,362; sh: 980; ansic: 221; makefile: 191
file content (25 lines) | stat: -rwxr-xr-x 677 bytes parent folder | download
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
#!/usr/local/bin/perl
# save_local.cgi
# Save the local startup script

require './init-lib.pl';
%access = &get_module_acl();
$access{'bootup'} == 1 || &error("You are not allowed to edit the bootup script");
&ReadParse();
$in{'local'} =~ s/\r//g;
&lock_file($config{'local_script'});
open(LOCAL, "> $config{'local_script'}");
print LOCAL $in{'local'};
close(LOCAL);
&unlock_file($config{'local_script'});
if ($config{'local_down'}) {
	$in{'down'} =~ s/\r//g;
	&lock_file($config{'local_down'});
	open(LOCAL, "> $config{'local_down'}");
	print LOCAL $in{'down'};
	close(LOCAL);
	&unlock_file($config{'local_down'});
	}
&webmin_log("local", undef, undef, \%in);
&redirect("");