2 # The shebang is only there for mcedit syntax highlights, as I'm too lazy to
3 # change the configfile. It won't hurt performance
13 print qq{<input type=hidden name="$_" value="$hash->{$_}">}
14 unless exists $saves{$_};
21 if (defined wantarray){
37 if ($@){ return defined wantarray ? @_ : undef }
39 return defined wantarray ? (wantarray ? @$ref : "@$ref") : undef;
42 # Browsers do s/ /+/ - I don't care about RFC's, but I do care about real-life
48 my $dec = uri_unescape($_);
49 if (defined wantarray){
53 return undef if $@; # ;DecodeURI("foo");
56 return defined wantarray ? (wantarray ? @r : "@r") : undef;
61 my $esc = uri_escape($_, '^;\/?:@&=\$,A-Za-z0-9\-_.!~*\'()');
62 if (defined wantarray){
66 return undef if $@; # ;EncodeURI("foo");
69 return defined wantarray ? (wantarray ? @r : "@r") : undef;
73 if ($header{'set-cookie'}){
74 $header{'set-cookie'} .= "\nset-cookie: $_[0]";
76 $header{'set-cookie'} = $_[0];
82 open (READFILE, $_[0]);
90 open (WRITEFILE, ">$_[0]");
92 print WRITEFILE $_[1];
98 open COUNTER, "+<$_[0]";
101 my $counter = <COUNTER>;
104 print COUNTER ++$counter;
112 if (defined wantarray){
113 $ref = \(my $copy = $_[0]);
119 $$ref =~ s/"/"\cC"/g;
120 $$ref =~ s/>/>\cC>/g;
121 $$ref =~ s/</<\cC</g;
122 # Now this is a big, ugly regex! But hey - it works :)
123 $$ref =~ s{((\w+://|www\.|WWW\.)[a-zA-Z0-9\.\@:-]+[^\"\'>< \r\t\n]*)}{
124 local $_ = $1, $p = $2, ((($b) = /([\.,!\?\(\)\[\]]+$)/) ? s/// :
125 undef), s/&(?!\x23?\w+;)/&/g, s/\"/"/g, $c =
126 ($p eq 'www.' || $p eq 'WWW.' ? "http://$_" : $_),
127 qq{<a href="$c" target="_blank">$_</a>$b}
131 $$ref =~ s/"\cC"/"/g;
132 $$ref =~ s/>\cC>/>/g;
133 $$ref =~ s/<\cC</</g;
135 if ($@){ return defined wantarray ? @_ : undef }
136 return defined wantarray ? $$ref : undef;