%zewdAPI ; Enterprise Web Developer run-time functions and user APIs ; ; Product: Enterprise Web Developer (Build 944) ; Build Date: Fri, 23 Nov 2012 17:15:06 ; ; ---------------------------------------------------------------------------- ; | Enterprise Web Developer for GT.M and m_apache | ; | Copyright (c) 2004-12 M/Gateway Developments Ltd, | ; | Reigate, Surrey UK. | ; | All rights reserved. | ; | | ; | http://www.mgateway.com | ; | Email: rtweed@mgateway.com | ; | | ; | 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 . | ; ---------------------------------------------------------------------------- ; ;QUIT ; ; version() ; QUIT "Enterprise Web Developer (Build "_$$getVersion^%zewdCompiler()_")" ; date() ; QUIT $$getDate^%zewdCompiler() ; compilePage(app,page,mode,technology,outputPath,multilingual,maxLines) d compilePage^%zewdCompiler($g(app),$g(page),$g(mode),$g(technology),$g(outputPath),$g(multilingual),$g(maxLines)) QUIT ; compileAll(app,mode,technology,outputPath,multilingual,templatePageName,maxLines) d compileAll^%zewdCompiler($g(app),$g(mode),$g(technology),$g(outputPath),$g(multilingual),$g(templatePageName),$g(maxLines)) QUIT ; autoTranslate(app,language,verbose) d autoTranslate^%zewdMgr($g(app),$g(language),$g(verbose)) ; startSession(page,requestArray,serverArray,sessionArray,filesArray) ; ; QUIT $$startSession^%zewdPHP(page,.requestArray,.serverArray,.sessionArray,.filesArray) ; closeSession(requestArray) ; ; QUIT $$closeSession^%zewdPHP(.requestArray) ; saveSession(sessionArray) ; ; d saveSession^%zewdPHP(.sessionArray) QUIT ; endOfPage(sessionArray) ; d endOfPage^%zewdPHP(.sessionArray) QUIT ; prePageScript(sessid) QUIT $$prePageScript^%zewdPHP(sessid) ; releaseLock(sessid) d releaseLock^%zewdPHP(sessid) QUIT ; tokeniseURL(url,sessid) QUIT $$tokeniseURL^%zewdCompiler16($g(url),$g(sessid)) ; getSessid(token) ; i token="" QUIT "" i $$isTokenExpired(token) QUIT "" QUIT $p(^%zewdSession("tokens",token),"~",1) ; initialiseSession(sessid) k ^%zewdSession("session",sessid) QUIT ; deleteSession(sessid) ; d deleteSession^%zewdPHP(sessid) ; QUIT ; changeApp(appName,sessid) i $g(appName)="" QUIT i $g(sessid)="" QUIT d setSessionValue("ewd_appName",appName,sessid) QUIT ; setRedirect(toPage,sessid,app) i $g(app)'="" d . d setSessionValue("ewd_appName",app,sessid) d setJump(toPage,sessid,$g(app)) QUIT ; setJump(toPage,sessid,app) ; n token ; i $g(app)'="",$e(sessid,1,4)="csp:" d . n path . s path=$$getRootURL("csp") . i $e(path,$l(path))'="/" s path=path_"/" . s toPage=path_app_"/"_toPage d setSessionValue("ewd_jump",toPage,sessid) d setSessionValue("ewd_nextPage",toPage,sessid) QUIT:$e(sessid,1,4)="csp:" s token=$$setNextPageToken(toPage,sessid) d setSessionValue("ewd_pageToken",token,sessid) QUIT ; setNextPageToken(nextPage,sessid) ; n token,length ; s length=$$getSessionValue("ewd_sessid_length",sessid) i length="" s length=30 i $g(sessid)="" s sessid=0 f s token=$$makeTokenString(length) q:'$d(^%zewdSession("nextPageTokens",sessid,token)) i $g(^zewd("trace"))=1 d trace^%zewdAPI("setNextPageToken^%zewdAPI: sessid="_sessid_"; token="_token_"; nextPage="_nextPage) s ^%zewdSession("nextPageTokens",sessid,token,$$zcvt(nextPage,"l"))="" QUIT token ; isNextPageTokenValid(token,sessid,page) QUIT $$isNextPageTokenValid^%zewdCompiler13(token,sessid,page) ; isCSP(sessid) QUIT $e(sessid,1,4)="csp:" ; normaliseTextValue(text) s text=$$replaceAll(text,"'","'") QUIT $$zcvt(text,"o","HTML") ; writeLine(line,technology) i technology="node" d . s ^CacheTempBuffer($j,$increment(^CacheTempBuffer($j)))=line e d . w line QUIT ; displayOptions(fieldName,listName,escape) ;d displayOptions^%zewdCompiler13($g(fieldName),$g(listName),$g(escape)) n codeValue,%d,i,line,name,nnvp,nvp,pos,technology,textValue,value ; s technology=$$getSessionValue^%zewdAPI("ewd.technology",sessid) s fieldName=$tr(fieldName,".","_") s listName=$tr(listName,".","_") i 0 e d . s escape=+$g(escape) . s pos="" . f s pos=$o(^%zewdSession("session",sessid,"ewd_list",listName,pos)) q:pos="" d . . k %d,textValue,codeValue,codeValueEsc,textValueEsc . . s %d=^%zewdSession("session",sessid,"ewd_list",listName,pos) . . s textValue=$p(%d,$c(1),1) . . ; . . s textValueEsc=textValue . . i $g(^zewd("xssEncoding")) d . . . s textValueEsc=$$htmlOutputEncode^%zewdAPI2(textValueEsc) . . e d . . . s textValueEsc=$$replaceAll(textValueEsc,"'","'") . . . i escape s textValueEsc=$$zcvt(textValue,"o","HTML") . . ; . . s codeValue=$p(%d,$c(1),2) . . i codeValue="" s codeValue=textValue . . s codeValueEsc=codeValue . . i $g(^zewd("xssEncoding")) d . . . s codeValueEsc=$$htmlOutputEncode^%zewdAPI2(codeValueEsc) . . e d . . . s codeValueEsc=$$replaceAll(codeValueEsc,"'","'") . . . i escape s codeValueEsc=$$zcvt(codeValue,"o","HTML") . . s line="