From f523c9718baf12a5bc99e2285bc0666796ab2a97 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Wed, 20 Nov 2013 13:36:22 +0100 Subject: update function calls to changelog functions --- inc/RemoteAPICore.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'inc/RemoteAPICore.php') diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 2eb8ea403..311ff8c8c 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -374,7 +374,8 @@ class RemoteAPICore { throw new RemoteException('The requested page does not exist', 121); } - $info = getRevisionInfo($id, $time, 1024); + $pagelog = new PageRevisionLog($id, 1024); + $info = $pagelog->getRevisionInfo($time); $data = array( 'name' => $id, @@ -646,11 +647,12 @@ class RemoteAPICore { throw new RemoteException('Empty page ID', 131); } - $revisions = getRevisions($id, $first, $conf['recent']+1); + $pagelog = new PageRevisionLog($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 +674,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']; -- cgit v1.2.3 From 047bad06fab8157452aa0dd04379a7c507b1f39f Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Thu, 21 Nov 2013 21:07:08 +0100 Subject: refactor PageRevisionLog into Media- and PageChangelog extending Changelog --- inc/RemoteAPICore.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/RemoteAPICore.php') diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 311ff8c8c..aa1e06f57 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -374,7 +374,7 @@ class RemoteAPICore { throw new RemoteException('The requested page does not exist', 121); } - $pagelog = new PageRevisionLog($id, 1024); + $pagelog = new PageChangeLog($id, 1024); $info = $pagelog->getRevisionInfo($time); $data = array( @@ -647,7 +647,7 @@ class RemoteAPICore { throw new RemoteException('Empty page ID', 131); } - $pagelog = new PageRevisionLog($id); + $pagelog = new PageChangeLog($id); $revisions = $pagelog->getRevisions($first, $conf['recent']+1); if(count($revisions)==0 && $first!=0) { -- cgit v1.2.3 From 684116d77c83029b1dc95ede21a59a6f4f8114c7 Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine Date: Sun, 24 Nov 2013 01:40:51 +0100 Subject: Prepare an XMLRPC logoff method. Rationale: XMLRPC is thought for script, which typically should not store their authentication cookies on disk. However: 1st: DW cannot tell if an external script is in this respect well-behaved. 2nd: it does not hurt to provide means for a voluntary log-out. There are, BTW, two parts of authentication data: one is stored in the cookie-storage of the client, and the other part is stored in the session data of the DW instance on the server. This logoff call is responsible for invalidating the credentials stored on the server, regardless of any cookie data remaining (or being stolen) on the client side. --- inc/RemoteAPICore.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'inc/RemoteAPICore.php') diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 2eb8ea403..9607b5c89 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -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', @@ -767,6 +771,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)) { -- cgit v1.2.3 From b053d671002dff76c61d0d1cb8280d59c6e5dbef Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine Date: Sun, 24 Nov 2013 15:33:25 +0100 Subject: Increase also the API version. --- inc/RemoteAPICore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/RemoteAPICore.php') diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 9607b5c89..a26c2d0de 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 { -- cgit v1.2.3