Added support for Unbuntu, which has not /etc/inittab file.
---- Changes since 1.310 ----
Added start_action and stop_action functions for starting and stopping services in an OS-independent manner.
+---- Changes since 1.390 ----
+Re-wrote all user interface code to use the new Webmin UI library, for a more consistent look.
require './init-lib.pl';
&ReadParse();
-%access = &get_module_acl();
$access{'bootup'} == 1 || &error($text{'change_ecannot'});
&ui_print_header(undef, $text{'change_title'}, "");
require './init-lib.pl';
&ReadParse();
-%access = &get_module_acl();
$access{'bootup'} == 1 || &error($text{'save_ecannot'});
if ($in{type} == 0) {
# just plain runlevel files
require './init-lib.pl';
-%access = &get_module_acl();
$access{'bootup'} || &error($text{'edit_ecannot'});
$ty = $ARGV[0];
$ss = $ARGV[5];
&ui_print_header(undef, $text{'edit_title'}, "");
$file = &runlevel_filename($rl, $ss, $num, $ac);
- $data = `cat $file`;
+ $data = &read_file_contents($file);
}
else {
# Creating a new action in init.d
&ui_print_header(undef, $text{'create_title'}, "");
}
-print "<table border width=100%>\n";
-print "<tr $tb> <td><b>$text{'edit_details'}</b></td> </tr>\n";
-print "<tr $cb> <td><table width=100%>\n";
-print "<form method=post action=save_action.cgi enctype=multipart/form-data>\n";
-print "<input type=hidden name=type value=$ty>\n";
+print &ui_form_start("save_action.cgi", "form-data");
+print &ui_table_start($text{'edit_details'}, "width=100%", 2);
+print &ui_hidden("type", $ty);
+
if ($ty != 2) {
- print "<input type=hidden name=old value=\"$ac\">\n";
+ print &ui_hidden("old", $ac);
+ print &ui_hidden("file", $file);
if ($ty == 1) {
- print "<input type=hidden name=runlevel value=\"$rl\">\n";
- print "<input type=hidden name=startstop value=\"$ss\">\n";
- print "<input type=hidden name=number value=\"$num\">\n";
+ print &ui_hidden("runlevel", $rl);
+ print &ui_hidden("startstop", $ss);
+ print &ui_hidden("number", $num);
}
}
-print "<tr> <td><b>$text{'edit_name'}</b></td>\n";
+
+# Action name
if ($ac =~ /^\// || $access{'bootup'} == 2) {
- print "<td><tt>$ac</tt></td> </tr>\n";
- print "<input type=hidden name=name value=\"$ac\">\n";
- print "<input type=hidden name=extra value=1>\n";
+ print &ui_table_row($text{'edit_name'}, "<tt>$ac</tt>");
+ print &ui_hidden("name", $ac);
+ print &ui_hidden("extra", 1);
}
else {
- print "<td><input size=20 name=name value=\"$ac\"></td> </tr>\n";
+ print &ui_table_row($text{'edit_name'},
+ &ui_textbox("name", $ac, 30));
}
$fs = "<font size=-1>"; $fe = "</font>";
if ($ty == 2) {
- # Display fields for a template
- print "<tr> <td valign=top><b>$text{'edit_desc'}</b></td>\n";
- print "<td>$fs<textarea rows=2 cols=80 name=desc>",
- "</textarea>$fe</td> </tr>\n";
+ # Display fields for a template for a new action
+ print &ui_table_row($text{'edit_desc'},
+ &ui_textarea("desc", undef, 2, 80));
if ($config{'start_stop_msg'}) {
- print "<tr> <td><b>$text{'edit_startmsg'}</b></td>\n";
- print "<td><input name=start_msg size=40></td> </tr>\n";
+ print &ui_table_row($text{'edit_startmsg'},
+ &ui_textbox("start_msg", undef, 40));
- print "<tr> <td><b>$text{'edit_stopmsg'}</b></td>\n";
- print "<td><input name=stop_msg size=40></td> </tr>\n";
+ print &ui_table_row($text{'edit_stopmsg'},
+ &ui_textbox("stop_msg", undef, 40));
}
- print "<tr> <td valign=top><b>$text{'edit_start'}</b></td>\n";
- print "<td>$fs<textarea rows=5 cols=80 name=start>",
- "</textarea>$fe</td> </tr>\n";
+ print &ui_table_row($text{'edit_start'},
+ &ui_textarea("start", undef, 5, 80));
- print "<tr> <td valign=top><b>$text{'edit_stop'}</b></td>\n";
- print "<td>$fs<textarea rows=5 cols=80 name=stop>",
- "</textarea>$fe</td> </tr>\n";
+ print &ui_table_row($text{'edit_stop'},
+ &ui_textarea("stop", undef, 5, 80));
}
elsif ($access{'bootup'} == 2) {
# Just show current script
- print "<tr> <td valign=top><b>$text{'edit_script'}</b></td>\n";
- print "<td>$fs<pre>",&html_escape($data),"</pre>$fe</td> </tr>\n";
+ print &ui_table_row($text{'edit_script'},
+ "$fs<pre>".&html_escape($data)."</pre>$fe");
}
else {
# Allow direct editing of the script
- print "<tr> <td valign=top><b>$text{'edit_script'}</b></td>\n";
- print "<td>$fs<textarea rows=15 cols=80 name=data>",&html_escape($data),
- "</textarea>$fe</td> </tr>\n";
+ print &ui_table_row($text{'edit_script'},
+ &ui_textarea("data", $data, 15, 80));
}
if ($ty == 1 && $access{'bootup'} == 1) {
# Display a message about the script being bogus
- print "</table></td></tr></table><p>\n";
+ print &ui_table_end();
print "<b>",&text("edit_bad$ss", $rl),"</b><br>\n";
print "<a href=\"fix_action.cgi?$rl+$ss+$num+$ac\">",
"$text{'edit_fix'}</a>. <p>\n";
elsif (!$config{'expert'} || $access{'bootup'} == 2) {
# Just tell the user if this action is started at boot time
local $boot = 0;
- print "<tr> <td><b>$text{'edit_boot'}</b></td>\n";
if ($ty == 0) {
local @boot = &get_inittab_runlevel();
foreach $s (&action_levels('S', $ac)) {
&read_env_file("$config{'daemons_dir'}/$ac", \%daemon)) {
$boot = lc($daemon{'ONBOOT'}) eq 'yes' ? 1 : 0;
}
- print "<input type=hidden name=oldboot value='$boot'>\n";
+ print &ui_hidden("oldboot", $boot);
}
if ($access{'bootup'} == 1) {
- printf "<td><input name=boot type=radio value=1 %s> %s\n",
- $boot || $ty == 2 ? 'checked' : '', $text{'yes'};
- printf "<input name=boot type=radio value=0 %s> %s\n",
- $boot || $ty == 2 ? '' : 'checked', $text{'no'};
+ print &ui_table_row($text{'edit_boot'},
+ &ui_yesno_radio("boot", $boot || $ty == 2 ? 1 : 0));
}
else {
- print "<td>",$boot || $ty == 2 ? $text{'yes'} : $text{'no'};
+ print &ui_table_row($text{'edit_boot'},
+ $boot || $ty == 2 ? $text{'yes'} : $text{'no'});
}
+
+ # Show if action is currently running
if ($hasarg{'status'} && $config{'status_check'}) {
- # Show if action is currently running
- $out = `$file status </dev/null 2>/dev/null`;
- print " ",
- "<b>$text{'edit_status'}</b> \n";
+ $out = &backquote_command("$file status</dev/null 2>/dev/null");
if ($out =~ /running/i) {
- print $text{'yes'};
+ $status = $text{'yes'};
}
elsif ($out =~ /stopped/i) {
- print "<font color=#ff0000>$text{'no'}</font>";
+ $status = "<font color=#ff0000>$text{'no'}</font>";
}
else {
- print "<i>$text{'edit_unknown'}</i>";
+ $status = "<i>$text{'edit_unknown'}</i>";
}
+ print &ui_table_row($text{'edit_status'}, $status);
}
- print "</td></tr> </table></td></tr></table>\n";
+ print &ui_table_end();
}
else {
if ($config{'daemons_dir'} && $ac &&
&read_env_file("$config{'daemons_dir'}/$ac", \%daemon)) {
# Display onboot flag from daemons file
$boot = lc($daemon{'ONBOOT'}) eq 'yes';
- print "<tr> <td><b>$text{'edit_boot'}</b></td>\n";
- printf "<td><input name=boot type=radio value=1 %s> %s\n",
- $boot ? 'checked' : '', $text{'yes'};
- printf "<input name=boot type=radio value=0 %s> %s</td></tr>\n",
- $boot ? '' : 'checked', $text{'no'};
+ print &ui_table_row($text{'edit_boot'},
+ &ui_yesno_radio("boot", $boot ? 1 : 0));
}
+ print &ui_table_end();
# Display which runlevels the action is started/stopped in
- print "</table></td></tr></table><p>\n";
-
- print "<table border width=100%>\n";
- print "<tr $tb> <td><b>$text{'edit_levels'}</b></td> </tr>\n";
- print "<tr $cb> <td><b><table width=100%>\n";
+ print &ui_table_start($text{'edit_levels'}, "width=100%", 4);
if ($ac) {
foreach $s (&action_levels('S', $ac)) {
@s = split(/\s+/, $s);
}
@boot = &get_inittab_runlevel();
foreach $rl (&list_runlevels()) {
- print "<tr>\n" if (!$sw);
if (&indexof($rl, @boot) == -1) {
- print "<td><b>",&text('edit_rl', $rl),"</b></td>\n";
+ $label = &text('edit_rl', $rl);
}
else {
- print "<td><b><i>",&text('edit_rl', $rl),
- "</i></b></td>\n";
+ $label = "<i>".&text('edit_rl', $rl)."</i>";
}
$od = $config{'order_digits'};
- printf "<td><input type=checkbox name=S$rl value=1 %s>\n",
- defined($spri{$rl}) ? "checked" : "";
- print $text{'edit_startat'},"\n";
- print "<input name=pri_S$rl size=$od value=$spri{$rl}></td>\n";
-
- printf "<td><input type=checkbox name=K$rl value=1 %s>\n",
- defined($kpri{$rl}) ? "checked" : "";
- print $text{'edit_stopat'},"\n";
- print "<input name=pri_K$rl size=$od value=$kpri{$rl}></td>\n";
- print "</tr>\n" if ($sw);
- $sw = !$sw;
- }
- print "<td colspan=3><br></td> </tr>\n" if ($sw);
- print "</table></td></tr></table>\n";
+ $msg = &ui_checkbox("S$rl", 1, $text{'edit_startat'},
+ defined($spri{$rl}))." ".
+ &ui_textbox("pri_S$rl", $spri{$rl}, $od)."\n".
+ &ui_checkbox("K$rl", 1, $text{'edit_stopat'},
+ defined($kpri{$rl}))." ".
+ &ui_textbox("pri_K$rl", $kpri{$rl}, $od);
+ print &ui_table_row($label, $msg);
+ }
+ print &ui_table_end();
}
if ($ty != 2) {
- print "<table width=100%><tr>\n";
if ($access{'bootup'} == 1) {
- print "<td><input type=submit value=\"$text{'save'}\"></td>\n";
+ push(@buts, [ undef, $text{'save'} ]);
}
- print "</form><form action=\"start_stop.cgi\">\n";
- print "<input type=hidden name=file value=\"$file\">\n";
- print "<input type=hidden name=name value=\"$ac\">\n";
+ # Buttons to start and stop
$args = join("+", @ARGV);
- print "<input type=hidden name=back value=\"edit_action.cgi?$args\">\n";
- print "<td align=center>\n";
- print "<input type=submit name=start value=\"$text{'edit_startnow'}\">\n";
- if ($hasarg{'restart'}) {
- print "<input type=submit name=restart value=\"$text{'edit_restartnow'}\">\n";
- }
- if ($hasarg{'condrestart'}) {
- print "<input type=submit name=condrestart value=\"$text{'edit_condrestartnow'}\">\n";
- }
- if ($hasarg{'reload'}) {
- print "<input type=submit name=reload value=\"$text{'edit_reloadnow'}\">\n";
- }
- if ($hasarg{'status'}) {
- print "<input type=submit name=status value=\"$text{'edit_statusnow'}\">\n";
+ print &ui_hidden("back", "edit_action.cgi?$args");
+ foreach $a (@action_buttons) {
+ if ($a eq 'start' || $a eq 'stop' || $hasarg{$a}) {
+ push(@buts, [ $a, $text{'edit_'.$a.'now'} ]);
+ }
}
- print "<input type=submit name=stop value=\"$text{'edit_stopnow'}\">\n";
- print "</td>\n";
+ # Button to delete
if ($access{'bootup'} == 1) {
- print "</form><form action=\"delete_action.cgi\">\n";
- print "<input type=hidden name=type value=\"$ty\">\n";
- print "<input type=hidden name=action value=\"$ac\">\n";
- if ($ty == 1) {
- print "<input type=hidden name=runlevel value=\"$rl\">\n";
- print "<input type=hidden name=startstop value=\"$ss\">\n";
- print "<input type=hidden name=number value=\"$num\">\n";
- }
- print "<td align=right><input type=submit ",
- "value=\"$text{'delete'}\"></td>\n";
+ push(@buts, [ "delete", $text{'delete'} ]);
}
- print "</tr></form></table><p>\n";
+ print &ui_form_end(\@buts);
}
else {
- print "<input type=submit value=\"$text{'create'}\"></form><p>\n";
+ print &ui_form_end([ [ undef, $text{'create'} ] ]);
}
&ui_print_footer("", $text{'index_return'});
require './init-lib.pl';
require './hostconfig-lib.pl';
use File::Basename;
-%access = &get_module_acl();
$access{'bootup'} == 1 || &error($text{'edit_ecannot'});
$ty = $ARGV[0];
require './init-lib.pl';
&ReadParse();
-%access = &get_module_acl();
$access{'bootup'} || &error($text{'edit_ecannot'});
if ($in{'new'}) {
# Convert an action from a run-level file to a proper action in init.d
require './init-lib.pl';
-%access = &get_module_acl();
$access{'bootup'} == 1 || &error("You are not allowed to edit bootup actions");
$rl = $ARGV[0];
$ss = $ARGV[1];
####
local($ahref, $setting, $link, $description);
my($ahref, $setting, $description) = @_;
+local @cols;
if ($access{'bootup'} == 1) {
- $link = "<td><a href=\"edit_hostconfig.cgi?0+$ahref\">$ahref</a></td>";
+ push(@cols, "<a href=\"edit_hostconfig.cgi?0+$ahref\">$ahref</a>");
+ }
+else {
+ push(@cols, $ahref);
}
if ( $setting eq "-NO-" ) {
- $setting = "<td><FONT color=#ff0000>$setting</font></td>";
+ push(@cols, "<FONT color=#ff0000>$setting</font>");
}
elsif ( $setting ne "" ) {
- $setting = "<td>$setting</td>";
- }
-else {
- $setting = "<td> </td>"
- }
-if ( $description ne "" ) {
- $description = "<td>$description</td>";
+ push(@cols, $setting);
}
else {
- $description = "<td> </td>";
+ push(@cols, "");
}
+push(@cols, $description);
if ( $ahref ne "" ) {
- return "<tr $cb>\n$link\n$setting\n$description\n</tr>\n";
+ return &ui_columns_row(\@cols);
}
else {
return "<!-- this is annoying- I'll have to track it down.. -->";
require './init-lib.pl';
require './hostconfig-lib.pl';
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
-%access = &get_module_acl();
if ($init_mode eq "osx" && $access{'bootup'}) {
# This hostconfig if block written by Michael A Peters <mpeters@mac.com>
@hconf_set = &hostconfig_settings();
%description_list = &hostconfig_gather(description);
- print "<table border width=100%>\n";
- print "<tr $tb> <td><b>", &text('index_action'), "</b></td>\n";
- print "<td><b>", &text('index_setting'), "</b></td>\n";
- print "<td> <b>", &text('index_desc'), "</b></td> </tr>\n";
+ print &ui_columns_start([ &text('index_action'),
+ &text('index_setting'),
+ &text('index_desc') ], 100, 0);
$i = 0;
while (<@hconf_set>) {
$action_description = $description_list{"$hconf_set[$i][0]"};
print &hostconfig_table($hconf_set[$i][0], $hconf_set[$i][1], $action_description);
$i++;
}
- print "</table>\n";
+ print &ui_columns_end();
if ($access{'bootup'} == 1) {
- print "<a href='edit_hostconfig.cgi?1'>$text{'index_add_mac'}</a><br>\n";
- print "<a href='edit_hostconfig.cgi?2'>", &text('index_editconfig',
- "<tt>$config{'hostconfig'}</tt>"),"</a><P>\n";
+ print &ui_links_row([
+ "<a href='edit_hostconfig.cgi?1'>".
+ "$text{'index_add_mac'}</a>",
+ "<a href='edit_hostconfig.cgi?2'>".
+ &text('index_editconfig',
+ "<tt>$config{'hostconfig'}</tt>")."</a>"
+ ]);
}
- print "<hr>\n";
}
elsif ($init_mode eq "init" && $access{'bootup'}) {
# build list of normal and broken actions
if (!$config{'desc'}) {
# Display actions by name only
print &ui_links_row(\@links);
- print "<table width=100% border>\n";
- print "<tr $tb> <td><b>$text{'index_title'}</b></td> </tr>\n";
- print "<tr $cb> <td><table width=100%>\n";
- $len = @acts; $len = int(($len+3)/4)*4;
- for($i=0; $i<$len; $i++) {
- if ($i%4 == 0) { print "<tr>\n"; }
- print "<td width=25%>";
+ @grid = ( );
+ for($i=0; $i<@acts; $i++) {
if ($acts[$i]) {
- print "<a href=\"edit_action.cgi?$actsl[$i]\">",
- "$acts[$i]</a>\n";
+ push(@grid, "<a href=\"edit_action.cgi?".
+ "$actsl[$i]\">$acts[$i]</a>");
}
- print "</td>\n";
- if ($i%4 == 3) { print "</tr>\n"; }
}
- print "</table></td></tr></table>\n";
+ print &ui_grid_table(\@grid, 4, 100,
+ [ "width=25%", "width=25%", "width=25%", "width=25%" ],
+ undef, $text{'index_title'});
print &ui_links_row(\@links);
}
else {
$config{'order'} ? ( $text{'index_order'} ) : ( ),
$config{'status_check'} == 2 ? ( $text{'index_status'} ) : ( ),
$text{'index_desc'} ],
- 100);
+ 100, 0, [ "", "nowrap", "nowrap", "nowrap", "nowrap" ]);
for($i=0; $i<@acts; $i++) {
local ($boot, %daemon, @levels, $order);
}
print &ui_columns_end();
print &ui_links_row(\@links);
- print "<input type=submit name=start value='$text{'index_start'}'>\n";
- print "<input type=submit name=stop value='$text{'index_stop'}'>\n";
- print "<input type=submit name=restart value='$text{'index_restart'}'>\n";
+ @buts = ( [ "start", $text{'index_start'} ],
+ [ "stop", $text{'index_stop'} ],
+ [ "restart", $text{'index_restart'} ] );
if ($access{'bootup'} == 1) {
# Show buttons to enable/disable at boot
- print " \n";
- print "<input type=submit name=addboot value='$text{'index_addboot'}'>\n";
- print "<input type=submit name=delboot value='$text{'index_delboot'}'>\n";
- print " \n";
- print "<input type=submit name=addboot_start value='$text{'index_addboot_start'}'>\n";
- print "<input type=submit name=delboot_stop value='$text{'index_delboot_stop'}'>\n";
+ push(@buts, undef,
+ [ "addboot", $text{'index_addboot'} ],
+ [ "delboot", $text{'index_delboot'} ],
+ undef,
+ [ "addboot_start", $text{'index_addboot_start'} ],
+ [ "delboot_stop", $text{'index_delboot_stop'} ],
+ );
}
- }
- print "</form>\n";
- print "<hr>\n";
-
- if ($access{'bootup'} == 1) {
- # Show runlevel switch form
- print "<form action=change_rl.cgi>\n";
- print "<table width=100%>\n";
-
- print "<tr> <td nowrap><input type=submit ",
- "value='$text{'index_rlchange'}'>\n";
- print "<select name=level>\n";
- foreach $r (@runlevels) {
- printf "<option %s>%s\n",
- $r eq $boot[0] ? "selected" : "", $r;
- }
- print "</select></td> <td>$text{'index_rlchangedesc'}</td> </tr>\n";
-
- print "</table></form><hr>\n";
+ print &ui_form_end(\@buts);
}
}
elsif ($init_mode eq "local" && $access{'bootup'} == 1) {
print &text('index_script',
"<tt>$config{'local_script'}</tt>"),"<br>\n";
}
- print "<form action=save_local.cgi method=post>\n";
- print "<textarea name=local rows=15 cols=80>";
- open(LOCAL, $config{'local_script'});
- while(<LOCAL>) { print &html_escape($_) }
- close(LOCAL);
- print "</textarea><br>\n";
+ print &ui_form_start("save_local.cgi", "post");
+ print &ui_textarea("local",
+ &read_file_contents($config{'local_script'}), 15, 80)."<br>\n";
+ # Show shutdown script too, if any
if ($config{'local_down'}) {
- # Show shutdown script too
print &text('index_downscript',
"<tt>$config{'local_down'}</tt>"),"<br>\n";
- print "<textarea name=down rows=15 cols=80>";
- open(LOCAL, $config{'local_down'});
- while(<LOCAL>) { print &html_escape($_) }
- close(LOCAL);
- print "</textarea><br>\n";
+ print &ui_textarea("down",
+ &read_file_contents($config{'local_down'}), 15, 80).
+ "<br>\n";
}
- print "<input type=submit value='$text{'save'}'></form>\n";
- print "<hr>\n";
+ print &ui_form_end([ [ undef, $text{'save'} ] ]);
}
elsif ($init_mode eq "win32" && $access{'bootup'}) {
# Show Windows services
[ "addboot_start", $text{'index_addboot_start'} ],
[ "delboot_stop", $text{'index_delboot_stop'} ],
]);
- print "<hr>\n";
-
}
# reboot/shutdown buttons
-print "<table cellpadding=5 width=100%>\n";
+print "<hr>\n";
+print &ui_buttons_start();
+if ($init_mode eq 'init' && $access{'bootup'} == 1) {
+ print &ui_buttons_row("change_rl.cgi", $text{'index_rlchange'},
+ $text{'index_rlchangedesc'}, undef,
+ &ui_select("level", $boot[0], \@runlevels));
+ }
if ($access{'reboot'}) {
- print "<form action=reboot.cgi>\n";
- print "<tr> <td><input type=submit ",
- "value=\"$text{'index_reboot'}\"></td>\n";
- print "</form>\n";
- print "<td>$text{'index_rebootmsg'}</td> </tr>\n";
+ print &ui_buttons_row("reboot.cgi", $text{'index_reboot'},
+ $text{'index_rebootmsg'});
}
-
if ($access{'shutdown'}) {
- print "<form action=shutdown.cgi>\n";
- print "<tr> <td><input type=submit ",
- "value=\"$text{'index_shutdown'}\"></td>\n";
- print "</form>\n";
- print "<td>$text{'index_shutdownmsg'}</td> </tr>\n";
+ print &ui_buttons_row("shutdown.cgi", $text{'index_shutdown'},
+ $text{'index_shutdownmsg'});
}
-print "</table>\n";
+print &ui_buttons_end();
&ui_print_footer("/", $text{'index'});
do '../web-lib.pl';
&init_config();
do '../ui-lib.pl';
+@action_buttons = ( 'start', 'restart', 'condrestart', 'reload', 'status',
+ 'stop' );
+%access = &get_module_acl();
# Work out init mode
if ($config{'hostconfig'}) {
index_setting=Setting
index_script_mac=The script $1 listed below will be run at bootup time. However, it is suggested that you add your own commands to have daemons or servers started upon system boot to the startup directory.
index_editconfig=Edit the $1 file manually
-index_stop=Stop Selected
-index_start=Start Selected
-index_restart=Restart Selected
+index_stop=Stop
+index_start=Start
+index_restart=Restart
index_rlchange=Change to runlevel:
index_rlchangedesc=Click this button to switch your system from the current runlevel to the selected one. This will cause all the actions in the current level to be stopped, and then all the actions in the new runlevel to be started.
index_addboot=Start On Boot
# Start or stop a bunch of RC scripts
require './init-lib.pl';
-%access = &get_module_acl();
&ReadParse();
@sel = split(/\0/, $in{'d'});
@sel || &error($text{'mass_enone'});
# Start or stop multiple actions at once
require './init-lib.pl';
-%access = &get_module_acl();
&ReadParse();
@sel = split(/\0/, $in{'idx'});
@sel || &error($text{'mass_enone2'});
# for OSX/Darwin
require './init-lib.pl';
-%access = &get_module_acl();
$access{'bootup'} == 1 || &error("You are not allowed to edit the bootup script");
&ReadParse();
require './init-lib.pl';
&ReadParse();
-%access = &get_module_acl();
$access{'reboot'} || &error($text{'reboot_ecannot'});
&ui_print_header(undef, $text{'reboot_title'}, "");
print "<p>\n";
require './init-lib.pl';
&error_setup($text{'save_err'});
-%access = &get_module_acl();
-$access{'bootup'} == 1 || &error($text{'save_ecannot'});
&ReadParseMime();
+# Redirect to other CGIs for delete / start / stop
+if ($in{'delete'} && $in{'old'}) {
+ &redirect("delete_action.cgi?type=".&urlize($in{'type'}).
+ "&action=".&urlize($in{'old'}).
+ "&runlevel=".&urlize($in{'runlevel'}).
+ "&startstop=".&urlize($in{'startstop'}).
+ "&number=".&urlize($in{'number'}));
+ }
+elsif ($in{'old'}) {
+ foreach $a (@action_buttons) {
+ if ($in{$a}) {
+ &redirect("start_stop.cgi?file=".&urlize($in{'file'}).
+ "&name=".&urlize($in{'old'})."&$a=1".
+ "&back=".&urlize($in{'back'}));
+ exit;
+ }
+ }
+ }
+
+$access{'bootup'} == 1 || &error($text{'save_ecannot'});
+
# Check inputs
$in{'extra'} || $in{name} =~ /^[A-z0-9\_\-\.]+$/ ||
&error($text{'save_ename'});
# module for Darwin and OS X.
require './init-lib.pl';
-%access = &get_module_acl();
$access{'bootup'} == 1 || &error("You are not allowed to edit the bootup script");
&ReadParse();
# 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;
require './init-lib.pl';
&ReadParse();
-%access = &get_module_acl();
$access{'bootup'} || &error($text{'edit_ecannot'});
&foreign_require("proc", "proc-lib.pl");
# Start or stop a bunch of win32 services
require './init-lib.pl';
-%access = &get_module_acl();
&ReadParse();
@sel = split(/\0/, $in{'d'});
@sel || &error($text{'mass_enone2'});
require './init-lib.pl';
require './hostconfig-lib.pl';
use File::Basename;
-%access = &get_module_acl();
$access{'bootup'} == 1 || &error("You are not allowed to edit the bootup script");
&ReadParse();
require './init-lib.pl';
&ReadParse();
-%access = &get_module_acl();
$access{'shutdown'} || &error($text{'shutdown_ecannot'});
&ui_print_header(undef, $text{'shutdown_title'}, "");
print "<p>\n";
require './init-lib.pl';
&foreign_require("proc", "proc-lib.pl");
-%access = &get_module_acl();
$access{'bootup'} || &error($text{'ss_ecannot'});
&ReadParse();