[pmwiki-users] [xmlrpc] ... PostWikiPage
Stéphane Heckel
hsteph at club-internet.fr
Mon Mar 31 18:18:42 CDT 2008
"Stéphane Heckel" wrote :
> Any chance to have a "core" expert helping me on this one ?
got the way to do it (inspired from import.php)
function PostWikiPage($pagename, $content, $publish, $isnew=false) {
global $Author,$EditFunctions,$ImportExcludeEditFunctions;
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);
$oldpage = ReadPage($pagename);
// Set new content and perform all edit functions that apply on new page
$newpage = $oldpage;
$newpage['text'] = str_replace("\r",'', $content);
$editfn = array_diff($EditFunctions,
(array)$ImportExcludeEditFunctions);
UpdatePage($pagename, $oldpage, $newpage, $editfn);
// 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"));
}
}
remark : I hope it is consistent
remark2 : I hate php :)
More information about the pmwiki-users
mailing list