diff options
Diffstat (limited to 'inc/RemoteAPICore.php')
-rw-r--r-- | inc/RemoteAPICore.php | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 2eb8ea403..ffa03ee93 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -3,7 +3,7 @@ /** * Increased whenever the API is changed */ -define('DOKU_API_VERSION', 8); +define('DOKU_API_VERSION', 9); class RemoteAPICore { @@ -24,6 +24,10 @@ class RemoteAPICore { 'return' => 'int', 'doc' => 'Tries to login with the given credentials and sets auth cookies.', 'public' => '1' + ), 'dokuwiki.logoff' => array( + 'args' => array(), + 'return' => 'int', + 'doc' => 'Tries to logoff by expiring auth cookies and the associated PHP session.' ), 'dokuwiki.getPagelist' => array( 'args' => array('string', 'array'), 'return' => 'array', @@ -374,7 +378,8 @@ class RemoteAPICore { throw new RemoteException('The requested page does not exist', 121); } - $info = getRevisionInfo($id, $time, 1024); + $pagelog = new PageChangeLog($id, 1024); + $info = $pagelog->getRevisionInfo($time); $data = array( 'name' => $id, @@ -646,11 +651,12 @@ class RemoteAPICore { throw new RemoteException('Empty page ID', 131); } - $revisions = getRevisions($id, $first, $conf['recent']+1); + $pagelog = new PageChangeLog($id); + $revisions = $pagelog->getRevisions($first, $conf['recent']+1); if(count($revisions)==0 && $first!=0) { $first=0; - $revisions = getRevisions($id, $first, $conf['recent']+1); + $revisions = $pagelog->getRevisions($first, $conf['recent']+1); } if(count($revisions)>0 && $first==0) { @@ -672,7 +678,8 @@ class RemoteAPICore { // case this can lead to less pages being returned than // specified via $conf['recent'] if($time){ - $info = getRevisionInfo($id, $time, 1024); + $pagelog->setChunkSize(1024); + $info = $pagelog->getRevisionInfo($time); if(!empty($info)) { $data['user'] = $info['user']; $data['ip'] = $info['ip']; @@ -767,6 +774,17 @@ class RemoteAPICore { return $ok; } + function logoff(){ + global $conf; + global $auth; + if(!$conf['useacl']) return 0; + if(!$auth) return 0; + + auth_logoff(); + + return 1; + } + private function resolvePageId($id) { $id = cleanID($id); if(empty($id)) { |