]> git.plutz.net Git - cgilite/commitdiff
renamed function to urlsafe, introduced htmlsafe function
authorpaul <paul@plutz.net>
Wed, 5 Aug 2015 19:58:40 +0000 (19:58 +0000)
committerpaul <paul@plutz.net>
Wed, 5 Aug 2015 19:58:40 +0000 (19:58 +0000)
svn path=/trunk/; revision=13

cgi.sh

diff --git a/cgi.sh b/cgi.sh
index 439773015f82e103c2459e32b5059faa8e401205..fdc57b409fb8f6ed95dc6752a81eed4c7361bc6a 100755 (executable)
--- a/cgi.sh
+++ b/cgi.sh
@@ -70,20 +70,30 @@ cgi_cookie() { # Parse GET data from referer
   done
 }
 
-urlsave(){
+urlsafe(){
   printf %s "$*" \
   | sed 's;%;%25;g;
-         s; ;%20;g;
-         s;!;%21;g;
-         s;";%22;g;
-         s;&;%26;g;
-         s;(;%28;g;
-         s;);%29;g;
-         s;:;%3a;g
+         s;\?;%3f;g;
+         s;#;%23;g;
          s;<;%3c;g;
          s;>;%3e;g;
-         s;'\'';%27;g;
-         s;\?;%3f;g;'
+         s;&;%26;g;
+         s;";%22;g;
+         s;'\'';%27;g;'
+# s; ;%20;g;
+# s;!;%21;g;
+# s;(;%28;g;
+# s;);%29;g;
+# s;:;%3a;g;
+}
+
+htmlsafe(){
+  printf %s "$*" \
+  | sed 's;<;\&lt\;;g;
+         s;>;\&gt\;;g;
+         s;&;\&amp\;;g;
+         s;";\&quot\;;g;
+         s;'\'';&apos\;;g;'
 }
 
 redirect(){