[pmwiki-users] [xmlrpc] ... PostWikiPage
Stéphane Heckel
hsteph at club-internet.fr
Sat Mar 29 06:08:08 CDT 2008
Greetings list, ..
Any chance to have a "core" expert helping me on this one ?
Is this "create page" process still consistent with latest version of PmWiki
?
Thanks for your feedback.
SH
> The code below is part of the xmlrpc\blogger.php. It writes a wiki page
> with $content.
> I would like to set/add the author name ($username), ...
> It seems that adding $newpage['author'] = $username is not enough, ...
> How should I do that ?
> function PostWikiPage($pagename, $content, $publish, $isnew=false) {
> global $EditFunctions;
>
> Lock(2);
> $oldpage = RetrieveAuthPage($pagename, 'edit', false);
> if (!$oldpage) {
> return new xmlrpcresp(0, 101, "Permission denied to edit page");
> }
>
> // If the publish flag is set then tell PmWiki that we are posting
> if($publish) $_POST['post'] = 1;
>
> PCache($pagename,$oldpage);
>
> // Set new content and perform all edit functions that apply on new
> page
> $newpage = $oldpage;
> $newpage['text'] = str_replace("\r",'', $content);
>
> foreach((array)$EditFunctions as $fn) $fn($pagename,$oldpage,$newpage);
>
> if($isnew) {
> return new xmlrpcresp(new xmlrpcval($pagename));
> } else {
> return new xmlrpcresp(new xmlrpcval(1,"boolean"));
> }
> }
More information about the pmwiki-users
mailing list