diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 85a8077606..c6a8ebd939 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2012-07-09 18:49 UTC+0200 Viktor Szakats (harbour syenar.net) + * examples/guestbk/guestbk.htm + * examples/guestbk/testcgi.prg + * tests/function.cfm + * minor updates + * lowercased html tags + ! deleted broken links + 2012-07-09 18:37 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbcurl/tests/ftp_uldl.prg ! fixed broken link diff --git a/harbour/examples/guestbk/guestbk.htm b/harbour/examples/guestbk/guestbk.htm index 956e6b2527..009ea1a405 100644 --- a/harbour/examples/guestbk/guestbk.htm +++ b/harbour/examples/guestbk/guestbk.htm @@ -1,33 +1,31 @@ - -
-
-
-" + hb_eol() + ; + "
" + hb_eol() + ; cPara + hb_eol() + ; - "
" + "" RETURN Self @@ -184,45 +177,45 @@ STATIC FUNCTION Generate() LOCAL Self := QSelf() LOCAL cFile, i, hFile, nPos, cRes := "" - LOCAL lFlag := .f. + LOCAL lFlag := .F. // Is this a meta file or hand generated script? - IF empty( ::cHTMLFile ) + IF Empty( ::cHTMLFile ) ::cContent := ; - "" + hb_eol() + ; - "No such file: " + ;
- ::cHTMLFile
+ IF ! hb_FileExists( ::cHTMLFile )
+ ::cContent := "Server Error
No such file: " + ; + ::cHTMLFile ELSE // Read from file - hFile := fOpen( ::cHTMLFile, 0 ) - cFile := space( IF_BUFFER ) - DO WHILE (nPos := fRead( hFile, @cFile, IF_BUFFER )) > 0 + hFile := FOpen( ::cHTMLFile, 0 ) + cFile := Space( IF_BUFFER ) + DO WHILE ( nPos := FRead( hFile, @cFile, IF_BUFFER ) ) > 0 - cFile := left( cFile, nPos ) + cFile := Left( cFile, nPos ) cRes += cFile - cFile := space( IF_BUFFER ) + cFile := Space( IF_BUFFER ) ENDDO - fClose( hFile ) + FClose( hFile ) // Replace matched tags i := 1 ::cContent := cRes /* TODO: Replace this DO WHILE with FOR..NEXT */ - DO WHILE i <= len( ::aReplaceTags ) - ::cContent := strtran( ::cContent, ; - "<#" + ::aReplaceTags[i, 1] + ">", ::aReplaceTags[i, 2] ) + DO WHILE i <= Len( ::aReplaceTags ) + ::cContent := StrTran( ::cContent, ; + "<#" + ::aReplaceTags[ i, 1 ] + ">", ::aReplaceTags[ i, 2 ] ) i++ ENDDO @@ -230,15 +223,15 @@ STATIC FUNCTION Generate() /* cRes := "" FOR i := 1 TO len( ::cContent ) - IF substr( ::cContent, i, 1 ) == "<" .AND. ; - substr( ::cContent, i + 1, 1 ) == "#" + IF SubStr( ::cContent, i, 1 ) == "<" .AND. ; + SubStr( ::cContent, i + 1, 1 ) == "#" lFlag := .t. - ELSEIF substr( ::cContent, i, 1 ) == ">" .AND. lFlag + ELSEIF SubStr( ::cContent, i, 1 ) == ">" .AND. lFlag lFlag := .f. - ELSEIF !lFlag - cRes += substr( ::cContent, i, 1 ) + ELSEIF ! lFlag + cRes += SubStr( ::cContent, i, 1 ) ENDIF - NEXT i + NEXT ::cContent := cRes */ @@ -262,10 +255,10 @@ STATIC FUNCTION ShowResult() STATIC FUNCTION SaveToFile( cFile ) LOCAL Self := QSelf() - LOCAL hFile := fCreate( cFile ) + LOCAL hFile := FCreate( cFile ) - fWrite( hFile, ::cContent ) - fClose( hFile ) + FWrite( hFile, ::cContent ) + FClose( hFile ) RETURN Self @@ -277,7 +270,7 @@ STATIC FUNCTION ProcessCGI() LOCAL nBuff := 0 LOCAL i - IF empty( ::aCGIContents ) + IF Empty( ::aCGIContents ) ::aCGIContents := { ; GetEnv( "SERVER_SOFTWARE" ), ; GetEnv( "SERVER_NAME" ), ; @@ -299,37 +292,37 @@ STATIC FUNCTION ProcessCGI() GetEnv( "CONTENT_TYPE" ), ; GetEnv( "CONTENT_LENGTH" ), ; GetEnv( "ANNOTATION_SERVER" ) ; - } + } cQuery := ::GetCGIParam( CGI_QUERY_STRING ) - IF !empty( cQuery ) + IF !Empty( cQuery ) - ::aQueryFields := {} + ::aQueryFields := {} - FOR i := 1 TO len( cQuery ) + 1 + FOR i := 1 TO Len( cQuery ) + 1 - IF i > len( cQuery ) .OR. substr( cQuery, i, 1 ) == "&" + IF i > Len( cQuery ) .OR. SubStr( cQuery, i, 1 ) == "&" - aadd( ::aQueryFields, ; - { substr( cBuff, 1, at( "=", cBuff ) - 1 ), ; - strtran( substr( cBuff, at( "=", cBuff ) + 1, ; - len( cBuff ) - at( "=", cBuff ) + 1 ), "+", " " ) } ) - cBuff := "" - ELSE - IF substr( cQuery, i, 1 ) == "%" - cBuff += chr( Hex2Dec( substr( cQuery, i + 1, 2 ) ) ) - nBuff := 3 - ENDIF + AAdd( ::aQueryFields, ; + { SubStr( cBuff, 1, At( "=", cBuff ) - 1 ), ; + StrTran( SubStr( cBuff, At( "=", cBuff ) + 1, ; + Len( cBuff ) - At( "=", cBuff ) + 1 ), "+", " " ) } ) + cBuff := "" + ELSE + IF SubStr( cQuery, i, 1 ) == "%" + cBuff += Chr( Hex2Dec( SubStr( cQuery, i + 1, 2 ) ) ) + nBuff := 3 + ENDIF - IF nBuff == 0 - cBuff += substr( cQuery, i, 1 ) - ELSE - nBuff-- - ENDIF - ENDIF + IF nBuff == 0 + cBuff += SubStr( cQuery, i, 1 ) + ELSE + nBuff-- + ENDIF + ENDIF - NEXT + NEXT ENDIF @@ -344,7 +337,7 @@ STATIC FUNCTION GetCGIParam( nParam ) ::ProcessCGI() IF nParam > 20 .OR. nParam < 1 - outerr( "Invalid CGI parameter" ) + OutErr( "Invalid CGI parameter" ) RETURN NIL ENDIF @@ -358,11 +351,11 @@ STATIC FUNCTION QueryFields( cQueryName ) ::ProcessCGI() - nRet := aScan( ::aQueryFields, ; - { |x| upper( x[1] ) == upper( cQueryName ) } ) + nRet := AScan( ::aQueryFields, ; + {| x | Upper( x[ 1 ] ) == Upper( cQueryName ) } ) IF nRet > 0 - cRet := ::aQueryFields[nRet, 2] + cRet := ::aQueryFields[ nRet, 2 ] ENDIF RETURN cRet @@ -379,6 +372,6 @@ STATIC FUNCTION AddReplaceTag( cTag, cReplaceText ) LOCAL Self := QSelf() - aAdd( ::aReplaceTags, { cTag, cReplaceText } ) + AAdd( ::aReplaceTags, { cTag, cReplaceText } ) RETURN Self diff --git a/harbour/tests/function.cfm b/harbour/tests/function.cfm index 5295b3df1e..ee6aba9067 100644 --- a/harbour/tests/function.cfm +++ b/harbour/tests/function.cfm @@ -8,11 +8,11 @@ content="text/html; charset=iso-8859-1"> -
![]()
![]()
Below is a list of all Harbour