1 # ===================================================================== 2 # wikiFilter.awk: content filtering function for wiki editable content. 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 # string wikiFilter(string content, string groupdir) 23 # ===================================================================== 24 25 function wikiFilter(content,groupdir, value,tmp,tmp1,tmp2,a,i,j) { 26 27 value = _strip(content) 28 29 # Apply filtering for allowed [X]HTML markup, beside the 30 # filtering already done by either an AJAX GUI on the client 31 # side or by a server side parser, such as 'tw-parsewiki'. 32 33 while (sub(/<[Bb]*[Bb][Oo][Dd][Yy][^>]*>/,_NULL,value)); 34 while (sub(/<\/[Bb]*[Bb][Oo][Dd][Yy][^>]*>/,_NULL,value)); 35 36 while (sub(/<[Hh]*[Ee][Aa][Dd][^>]*>/,_NULL,value)); 37 while (sub(/<\/[Hh]*[Ee][Aa][Dd][^>]*>/,_NULL,value)); 38 39 # Caveat: currently it is not possible for the user to enter a 40 #
element in the editing textarea, or it will interefere 41 # with the editing form in the confirmation page, like any 42 # embedded in an outer . This can be overcome in the future 43 # possibly by intriducing a new (::form:) ... (:form::) CPI that 44 # tweaks the inner in the confirmation page as appropriate. 45 # In fact, thanks to the new "form" attribute available for input 46 # fields in HTML5, it may be possible to accomplish the same result 47 # even without a new CPI. 48 49 if (_TNS_CMS_FILTER != "parsewiki") { 50 51 # Filtering out