@@ -372,10 +372,49 @@ namespace fb.fbdoc
372372
373373 '':::::
374374 function CWikiConUrl.LoadPage _
375+ ( _
376+ byval pagename as zstring ptr, _
377+ byref body as string _
378+ ) as boolean
379+
380+ function = FALSE
381+ body = ""
382+
383+ if ( ctx = NULL ) then
384+ exit function
385+ end if
386+
387+ ctx->pageid = - 1
388+ ctx->pagename = reallocate( ctx->pagename, len( *pagename ) + 1 )
389+ *ctx->pagename = *pagename
390+
391+ dim as CHttpStream ptr stream
392+
393+ stream = new CHttpStream( ctx->http )
394+ if ( stream = NULL ) then
395+ exit function
396+ end if
397+
398+ dim URL as string
399+ URL = build_url( ctx, NULL, @wakka_raw )
400+
401+ if ( stream->Receive( URL, TRUE , ctx->ca_file ) ) then
402+ body = stream->Read()
403+ remove_http_headers( body )
404+ end if
405+
406+ delete stream
407+
408+ ctx->pageid = get_pageid( ctx )
409+
410+ function = TRUE
411+
412+ end function
413+
414+ '':::::
415+ function CWikiConUrl.LoadIndex _
375416 ( _
376417 byval page as zstring ptr, _
377- byval israw as integer , _
378- byval getid as integer , _
379418 byref body as string _
380419 ) as boolean
381420
@@ -397,43 +436,30 @@ namespace fb.fbdoc
397436 exit function
398437 end if
399438
400- dim as zstring ptr rawmethod = iif( israw, @wakka_raw, NULL )
401-
402439 dim URL as string
403- URL = build_url( ctx, NULL, rawmethod )
440+ URL = build_url( ctx, NULL, NULL )
404441
405442 if ( stream->Receive( URL, TRUE , ctx->ca_file ) ) then
406443 body = stream->Read()
407444 remove_http_headers( body )
408- '' remove_trailing_whitespace( body )
409445 end if
410446
411447 delete stream
412448
413- if ( getid ) then
414- 'if( len( body ) > 0 ) then
415- ctx->pageid = get_pageid( ctx )
416- 'else
417- ' ctx->pageid = -1
418- 'end if
419- else
420- ctx->pageid = - 1
421- end if
449+ ctx->pageid = - 1
422450
423- ''body += chr( 13, 10 )
424-
425451 function = TRUE
426452
427453 end function
428454
429455 '':::::
430456 function CWikiConUrl.StorePage _
431457 ( _
432- byval body_in as zstring ptr, _
458+ byval body as zstring ptr, _
433459 byval note as zstring ptr _
434460 ) as boolean
435461
436- dim body as string
462+ dim body_out as string
437463
438464 if ( ctx = NULL ) then
439465 return FALSE
@@ -452,9 +478,9 @@ namespace fb.fbdoc
452478
453479 form->Add( "wakka" , *ctx->pagename + wakka_edit )
454480 form->Add( "previous" , ctx->pageid )
455- body = *body_in
456- '' remove_trailing_whitespace( body )
457- form->Add( "body" , body , "text/html" )
481+ body_out = *body
482+
483+ form->Add( "body" , body_out , "text/html" )
458484 if ( note ) then
459485 form->Add( "note" , *note )
460486 else
0 commit comments