1 # ===================================================================== 2 # blogger.getUsersBlogs.awk: Blogger API 1.0 3 # 4 # Copyright (c) 2007,2008,2009,2010 Carlo Strozzi 5 # 6 # This program is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; version 2 dated June, 1991. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with this program; if not, write to the Free Software 17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 # 19 # ===================================================================== 20 21 # ===================================================================== 22 # void _userproc(int mode) 23 # ===================================================================== 24 25 function _userproc(mode, value,out,i,j,url,a) { 26 27 if (mode == _O_REQUEST) { # request. 28 29 bloggerAuth("2_1","3_1","0_0") # BloggerAPI 30 31 # The following test is necessary since the address could, 32 # at least in theory, have been set to any string by the 33 # remote user, due to how it is handled to cope with stunnel(8) 34 # and the lack of transproxy support in kernel 2.4.x. 35 36 if (_isipaddr(ENVIRON["REMOTE_ADDR"]) == _TRUE) 37 value = ENVIRON["REMOTE_ADDR"] 38 else value = "0.0.0.0" 39 40 _rcset("REMOTE_ADDR",value) 41 } 42 43 else { # response. 44 45 # Generic template conditionals. These may not be of much 46 # use with XML-RPC but they won't hurt either. 47 48 ifsections() 49 50 # XML-RPC response. 51 52 out = _rcget("tpl.include.tw.rpc") 53 if (out !~ /^\/\.*[a-zA-Z0-9]/) 54 return(_sys("csaExit.fault 0041 out")) 55 56 # Make sure we use the proper CSA URLs in response, 57 # assuming that we must point the user at the 58 # interactive version of the URLs themselves. 59 60 url = ENVIRON["CSA_RPC_URI"] 61 if (url !~ /\/I$/) url = url "/I" 62 63 print "\n" > out 64 65 for (i=1; i<= _TBL[0]; i++) { 66 67 j = split(_TBL[i], a, "\t") 68 69 # k_group, g_name, _language, g_uri, g_descr, k_node 70 71 if (_rcget("cgi.numeric",1) == _NULL) 72 id = "" a[3] "/" a[1] "" 73 else id = "" a[6] "" 74 75 print "\n" \ 76 "\n" \ 77 "url\n" \ 78 "" \ 79 url "/" a[3] "/" a[4] \ 80 "\n" \ 81 "\n" \ 82 "\n" \ 83 "blogid\n" \ 84 "" id "\n" \ 85 "\n" \ 86 "\n" \ 87 "blogName\n" \ 88 "" _xmlencode(a[5]) "\n" \ 89 "" > out 90 91 printf("") > out 92 93 } 94 95 printf("\n\n") > out 96 97 close(out) 98 } 99 } 100 101 # EOF