<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># mod_env.pl
# Defines editors for passing variables to CGI scripts

sub mod_env_directives
{
local($rv);
$rv = [ [ 'PassEnv UnsetEnv SetEnv', 1, 11, 'virtual', -1.309 ],
	[ 'PassEnv UnsetEnv SetEnv', 1, 11, 'virtual directory', 1.309 ] ];
return &amp;make_directives($rv, $_[0], "mod_env");
}

sub edit_PassEnv_UnsetEnv_SetEnv
{
local($d, $e, @var, @mode, @val, $i, $rv);
foreach $d (@{$_[0]}, @{$_[1]}, @{$_[2]}) {
	if ($d-&gt;{'name'} ne "SetEnv") {
		foreach $e (@{$d-&gt;{'words'}}) {
			push(@var, $e);
			push(@mode, $d-&gt;{'name'} eq "PassEnv" ? 0 : 1);
			push(@val, "");
			}
		}
	else {
		push(@var, $d-&gt;{'words'}-&gt;[0]);
		push(@mode, 2);
		push(@val, $d-&gt;{'words'}-&gt;[1]);
		}
	}
push(@var, ""); push(@mode, 0); push(@val, "");
$rv = "&lt;table border&gt;\n".
      "&lt;tr $tb&gt; &lt;td&gt;&lt;b&gt;$text{'mod_env_var'}&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;$text{'mod_env_value'}&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;\n";
for($i=0; $i&lt;@var; $i++) {
	$rv .= "&lt;tr $cb&gt;\n";
	$rv .= "&lt;td&gt;&lt;input name=Env_var_$i size=20 value=\"$var[$i]\"&gt;&lt;/td&gt;\n";
	$rv .= "&lt;td&gt;".&amp;choice_input($mode[$i], "Env_mode_$i", 0,
	                            "$text{'mod_env_pass'},0", "$text{'mod_env_clear'},1", "$text{'mod_env_set'},2");
	$rv .= "&lt;input name=Env_val_$i size=20 value=\"$val[$i]\"&gt;&lt;/td&gt;\n";
	$rv .= "&lt;/tr&gt;\n";
	}
$rv .= "&lt;/table&gt;\n";
return (2, "$text{'mod_env_cgivar'}", $rv);
}
sub save_PassEnv_UnsetEnv_SetEnv
{
local($i, $var, $mode, $val, @pa, @uns, @se);
for($i=0; defined($var = $in{"Env_var_$i"}); $i++) {
	$mode = $in{"Env_mode_$i"}; $val = $in{"Env_val_$i"};
	if ($var !~ /\S/ &amp;&amp; $val !~ /\S/) { next; }
	$var =~ /^\S+$/ || &amp;error(&amp;text('mod_env_evar', $var));
	if ($mode == 0) { push(@pa, $var); }
	elsif ($mode == 1) { push(@uns, $var); }
	elsif ($var !~ /^\S+$/) {
		&amp;error(&amp;text('mod_env_evalue', $var));
		}
	else { push(@se, "$var \"$val\""); }
	}
return ( \@pa, \@uns, \@se );
}

sub edit_PassEnvAll
{
return (1, "$text{'mod_env_passall'}",
	&amp;choice_input($_[0]-&gt;{'value'}, "PassEnvAll",
		      "", "$text{'yes'},on", "$text{'no'},off", "$text{'mod_env_default'},"));
}
sub save_PassEnvAll
{
return &amp;parse_choice("PassEnvAll");
}

1;

</pre></body></html>