1 # ===================================================================== 2 # _usercpi.awk: user-level global CPI processor. 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 # string _usercpi(string s) 21 # 22 # Parse "s" Wiki statements and turn them into the corresponding XHTML 23 # markup. 24 # ===================================================================== 25 26 function _usercpi(s, a,tmp) { 27 28 # This is to allow passing an authenticated session to a backend CSA 29 # weblet -- possibly invoked through an IFRAME or an AJAX interface -- 30 # via a secondary session file (SSF). Note that since such SSF is an 31 # application-level concept, the (:auth:) tag must be a *user* CPI as 32 # opposed to a global CPI handled by the _parsecpi() CSA function. 33 # 34 split(ENVIRON["CSA_SESSION"],a,"\001") 35 gsub(/\(:auth:\)/,a[19],s) 36 37 # (:localhost:) -> $CSA_FQDN 38 gsub(/\(:localhost:\)/,ENVIRON["CSA_FQDN"],s) 39 40 # (:tw:) -> $CSA_ID 41 gsub(/\(:tw:\)/,ENVIRON["CSA_ID"],s) 42 43 # Add support for further markup below. 44 # ... 45 46 return s 47 } 48