+# dos_wildcard_match()
+#
+# Check if a string matches against a DOS-style wildcard
+#
+# Params: 1. Pattern
+# 2. String
+#
+# Return: Status code (Boolean)
+
+sub dos_wildcard_match($$)
+{
+ my ($pattern,$string) = @_;
+
+ return 1 if($pattern eq '*');
+
+ # The following part is stolen from File::DosGlob
+
+ # escape regex metachars but not glob chars
+ $pattern =~ s:([].+^\-\${}[|]):\\$1:g;
+ # and convert DOS-style wildcards to regex
+ $pattern =~ s/\*/.*/g;
+ $pattern =~ s/\?/.?/g;
+
+ return ($string =~ m|^$pattern$|is);
+}
+
+# encode_html()
+#
+# Encode HTML control characters (< > " &)
+#
+# Params: String to encode
+#
+# Return: Encoded string
+
+sub encode_html($)
+{
+ my $string = shift;
+
+ $string =~ s/&/&/g;
+ $string =~ s/</</g;
+ $string =~ s/>/>/g;
+ $string =~ s/"/"/g;
+
+ return $string;
+}
+
+# equal_url()
+#
+# Create URL equal to a file or directory
+#
+# Params: 1. HTTP root
+# 2. Relative path
+#
+# Return: Formatted link (String)
+
+sub equal_url($$)
+{
+ my ($root,$path) = @_;
+ my $url;
+
+ $root =~ s!/+$!!;
+ $path =~ s!^/+!!;
+ $url = $root.'/'.$path;
+
+ return $url;
+}
+
+# file_name()
+#
+# Return the last part of a path
+#
+# Params: Path
+#
+# Return: Last part of the path
+
+sub file_name($)
+{
+ my $path = shift;
+ $path =~ tr!\\!/!;
+
+ unless($path =~ m!^/+$! || ($^O eq 'MSWin32' && $path =~ m!^[a-z]:/+$!i))
+ {
+ $path =~ s!/+$!!;
+ $path = substr($path,rindex($path,'/')+1);
+ }
+
+ return $path;
+}
+
+# in_array()
+#
+# Check if a value is in an array
+#
+# Params: 1. Value to find
+# 2. Array
+#
+# Return: Status code (Boolean)
+
+sub in_array($$)
+{
+ my ($string,$array) = @_;
+
+ foreach my $element(@{$array})
+ {
+ return 1 if($string eq $element);
+ }
+
+ return;
+}
+
+# is_archive()
+#
+# Check if a file is an archive
+# (currently only by file extension)
+#
+# Params: Archive file name
+#
+# Return: Status code (Boolean)
+
+sub is_archive($)
+{
+ my $file = shift;
+
+ foreach my $ext(@archive_exts)
+ {
+ return 1 if(lc(substr($file,length($file)-length($ext),length($ext))) eq lc($ext));
+ }
+
+ return;
+}
+
+# is_disabled_command()
+#
+# Check if a command is disabled
+#
+# Params: 1. Array Reference containing the list
+# 2. Command to check
+#
+# Return: Status code (Boolean)
+
+sub is_disabled_command($$)
+{
+ my ($list,$command) = @_;
+ $command =~ s!/+$!!g;
+
+ foreach my $entry(@$list)
+ {
+ return 1 if(lc($command) eq lc($entry));
+ }
+
+ return;
+}
+
+# is_forbidden_file()