-# Last modified: 2005-02-13
+# Last modified: 2005-04-21
#
use strict;
@@ -29,9 +29,11 @@ use base qw(Exporter);
clean_path
devedit_reload
dos_wildcard_match
+ encode_html
equal_url
file_name
mode_string
+ multi_string
upper_path);
# check_path()
@@ -189,6 +191,26 @@ sub dos_wildcard_match($$)
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
@@ -270,6 +292,29 @@ sub mode_string($)
return $string;
}
+# multi_string()
+#
+# Create a Hash Reference containing three forms of a string
+#
+# Params: String
+#
+# Return: Hash Reference:
+# normal => Normal form of the string
+# html => HTML encoded form (see encode_html())
+# url => URL encoded form
+
+sub multi_string($)
+{
+ my $string = shift;
+ my %multi;
+
+ $multi{'normal'} = $string;
+ $multi{'html'} = encode_html($string);
+ $multi{'url'} = escape($string);
+
+ return \%multi;
+}
+
# upper_path()
#
# Remove the last part of a path
diff --git a/templates/copyfile.htm b/templates/copyfile.htm
index 1a81a6e..2570b84 100644
--- a/templates/copyfile.htm
+++ b/templates/copyfile.htm
@@ -12,7 +12,7 @@
(equals {URL})
-Back to {DIR}
+Back to {DIR}
diff --git a/templates/dirlist.htm b/templates/dirlist.htm
index c87faac..7338db2 100644
--- a/templates/dirlist.htm
+++ b/templates/dirlist.htm
@@ -39,7 +39,7 @@
{IF dir_writeable}
-Upload a file |
+Upload a file |
{ENDIF}
diff --git a/templates/dirlist_dir.htm b/templates/dirlist_dir.htm
index 4daa787..4a57acb 100644
--- a/templates/dirlist_dir.htm
+++ b/templates/dirlist_dir.htm
@@ -1,6 +1,6 @@
[SUBDIR] |
{DATE}{IF gmt} (GMT){ENDIF} |
-{IF readable}{DIR_NAME}/{ELSE}{DIR_NAME}/{ENDIF} |
-({IF dir_writeable}Rename | Delete | {ENDIF}{IF users}Chmod/Chgrp | {ENDIF}View in Browser) |
+{IF readable}{DIR_NAME}/{ELSE}{DIR_NAME}/{ENDIF} |
+({IF dir_writeable}Rename | Delete | {ENDIF}{IF users}Chmod/Chgrp | {ENDIF}View in Browser) |
diff --git a/templates/dirlist_file.htm b/templates/dirlist_file.htm
index 44d67a5..eb107ba 100644
--- a/templates/dirlist_file.htm
+++ b/templates/dirlist_file.htm
@@ -2,5 +2,5 @@
{SIZE} |
{DATE}{IF gmt} (GMT){ENDIF} |
{FILE_NAME} |
-({IF viewable}View{ELSE}View{ENDIF} | {IF editable}Edit{ELSE}Edit{ENDIF}{IF no_link} | Copy{ENDIF}{IF dir_writeable} | Rename | Delete{ENDIF} |{IF users} Chmod/Chgrp |{ENDIF} View in Browser) |
+({IF viewable}View{ELSE}View{ENDIF} | {IF editable}Edit{ELSE}Edit{ENDIF}{IF no_link} | Copy{ENDIF}{IF dir_writeable} | Rename | Delete{ENDIF} |{IF users} Chmod/Chgrp |{ENDIF} View in Browser) |
diff --git a/templates/dirlist_up.htm b/templates/dirlist_up.htm
index 44cdce5..b0e34ed 100644
--- a/templates/dirlist_up.htm
+++ b/templates/dirlist_up.htm
@@ -1,5 +1,5 @@
[SUBDIR] |
{DATE}{IF gmt} (GMT){ENDIF} |
-../ |
+../ |
diff --git a/templates/editfile.htm b/templates/editfile.htm
index 5d14d4a..82c9973 100644
--- a/templates/editfile.htm
+++ b/templates/editfile.htm
@@ -12,7 +12,7 @@
(equals {URL})
-Back to {DIR}
{IF error}
+Back to {DIR}
{IF error}
{ERROR}
{ENDIF}
diff --git a/templates/error.htm b/templates/error.htm
index 17abf7f..195b79d 100644
--- a/templates/error.htm
+++ b/templates/error.htm
@@ -12,6 +12,6 @@
{ERROR}
{IF dir}
-Back to {BACK}
{ENDIF}
+Back to {BACK}
{ENDIF}