#// post.awk
#// The tool to post to the OTT
#// 23.03.2015
#//
#// Copyright (C) 2015 Balthasar SzczepaĆski
#//
#// This program is free software: you can redistribute it and/or modify
#// it under the terms of the GNU Affero General Public License as
#// published by the Free Software Foundation, either version 3 of the
#// License, or (at your option) any later version.
#//
#// This program is distributed in the hope that it will be useful,
#// but WITHOUT ANY WARRANTY; without even the implied warranty of
#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#// GNU Affero General Public License for more details.
#//
#// You should have received a copy of the GNU Affero General Public License
#// along with this program. If not, see
information/) { success=1 } } close(tempfile) if (success!=1) { print "Sent back to preview!" exit INDELIVERABLE } while((getline cookie < cookiefile)>0) { if(cookie ~ /_sid/) { split(cookie,arr,"_sid[ \t]*") SID=arr[2] break } } close(cookiefile) if(system("wget -q -t 3 --connect-timeout=60 -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=logout&sid=" SID"\"")) { print "Logout fail." } } function urlencode(name,all, len,iii,escaped,ch) { len=length(name) escaped="" for(iii=1;iii<=len;++iii) { ch=substr(name,iii,1); if ((ch ~ /[a-zA-Z0-9\.\-_~]/)&&(all=="")) escaped = escaped ch else escaped = escaped "%" ch2hex[ch] } return escaped } function entitydecode(ht ,i,j,un,num) # quot, amp, lt, gt, nbsp, and decimal numbered. { while ((i=match(ht, /&((#[0-9]+)|([a-zA-Z]+));/))!=0)# { un=un substr(ht, 1, i-1) ht=substr(ht, i) j=index(ht, ";") if(ht~/^/) { num=int(substr(ht, 3, j-3)) un=un sprintf("%c",num) } else { num=tolower(substr(ht, 2, j-2)) if(num == "quot") un=un "\"" else if(num == "amp") un=un "&" else if(num == "lt") un=un "<" else if(num == "gt") un=un ">" else if(num == "nbsp") un=un "\xA0" else un = un ht } ht=substr(ht, j+1) } un=un ht return un } function urldecode(ht ,i,j,un,num) # quot, amp, lt, gt, nbsp, and decimal numbered. { while ((i=match(ht, /%[0-9a-fA-F][0-9a-fA-F]/))!=0)# { un=un substr(ht, 1, i-1) ht=substr(ht, i) num=toupper(substr(ht, 2, 2)) un=un hex2ch[num] ht=substr(ht, 4) } un=un ht return un }