From: paul Date: Wed, 5 Aug 2015 19:58:40 +0000 (+0000) Subject: renamed function to urlsafe, introduced htmlsafe function X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=348367d4594d3fa840a4ebf7fb98fc1969a6b666;p=cgilite renamed function to urlsafe, introduced htmlsafe function svn path=/trunk/; revision=13 --- diff --git a/cgi.sh b/cgi.sh index 4397730..fdc57b4 100755 --- 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;<;\<\;;g; + s;>;\>\;;g; + s;&;\&\;;g; + s;";\"\;;g; + s;'\'';&apos\;;g;' } redirect(){