Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
921ba557
Commit
921ba557
authored
12 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Plain Diff
Merge pull request #97 from timroes/master
Remote interface improvements
parents
c67addf8
d41322ba
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inc/RemoteAPICore.php
+18
-10
18 additions, 10 deletions
inc/RemoteAPICore.php
lib/exe/xmlrpc.php
+2
-1
2 additions, 1 deletion
lib/exe/xmlrpc.php
with
20 additions
and
11 deletions
inc/RemoteAPICore.php
+
18
−
10
View file @
921ba557
...
...
@@ -169,7 +169,7 @@ class RemoteAPICore {
* @return page text.
*/
function
rawPage
(
$id
,
$rev
=
''
){
$id
=
cleanID
(
$id
);
$id
=
$this
->
resolvePageId
(
$id
);
if
(
auth_quickaclcheck
(
$id
)
<
AUTH_READ
){
throw
new
RemoteAccessDeniedException
(
'You are not allowed to read this file'
,
111
);
}
...
...
@@ -228,7 +228,7 @@ class RemoteAPICore {
* Return a wiki page rendered to html
*/
function
htmlPage
(
$id
,
$rev
=
''
){
$id
=
cleanID
(
$id
);
$id
=
$this
->
resolvePageId
(
$id
);
if
(
auth_quickaclcheck
(
$id
)
<
AUTH_READ
){
throw
new
RemoteAccessDeniedException
(
'You are not allowed to read this page'
,
111
);
}
...
...
@@ -356,14 +356,14 @@ class RemoteAPICore {
* Return a list of backlinks
*/
function
listBackLinks
(
$id
){
return
ft_backlinks
(
cleanID
(
$id
));
return
ft_backlinks
(
$this
->
resolvePageId
(
$id
));
}
/**
* Return some basic data about a page
*/
function
pageInfo
(
$id
,
$rev
=
''
){
$id
=
cleanID
(
$id
);
$id
=
$this
->
resolvePageId
(
$id
);
if
(
auth_quickaclcheck
(
$id
)
<
AUTH_READ
){
throw
new
RemoteAccessDeniedException
(
'You are not allowed to read this page'
,
111
);
}
...
...
@@ -394,7 +394,7 @@ class RemoteAPICore {
global
$TEXT
;
global
$lang
;
$id
=
cleanID
(
$id
);
$id
=
$this
->
resolvePageId
(
$id
);
$TEXT
=
cleanText
(
$text
);
$sum
=
$params
[
'sum'
];
$minor
=
$params
[
'minor'
];
...
...
@@ -507,7 +507,7 @@ class RemoteAPICore {
* Returns the permissions of a given wiki page
*/
function
aclCheck
(
$id
)
{
$id
=
cleanID
(
$id
);
$id
=
$this
->
resolvePageId
(
$id
);
return
auth_quickaclcheck
(
$id
);
}
...
...
@@ -517,7 +517,7 @@ class RemoteAPICore {
* @author Michael Klier <chi@chimeric.de>
*/
function
listLinks
(
$id
)
{
$id
=
cleanID
(
$id
);
$id
=
$this
->
resolvePageId
(
$id
);
if
(
auth_quickaclcheck
(
$id
)
<
AUTH_READ
){
throw
new
RemoteAccessDeniedException
(
'You are not allowed to read this page'
,
111
);
}
...
...
@@ -633,7 +633,7 @@ class RemoteAPICore {
* @author Michael Klier <chi@chimeric.de>
*/
function
pageVersions
(
$id
,
$first
)
{
$id
=
cleanID
(
$id
);
$id
=
$this
->
resolvePageId
(
$id
);
if
(
auth_quickaclcheck
(
$id
)
<
AUTH_READ
)
{
throw
new
RemoteAccessDeniedException
(
'You are not allowed to read this page'
,
111
);
}
...
...
@@ -711,7 +711,7 @@ class RemoteAPICore {
$unlockfail
=
array
();
foreach
((
array
)
$set
[
'lock'
]
as
$id
){
$id
=
cleanID
(
$id
);
$id
=
$this
->
resolvePageId
(
$id
);
if
(
auth_quickaclcheck
(
$id
)
<
AUTH_EDIT
||
checklock
(
$id
)){
$lockfail
[]
=
$id
;
}
else
{
...
...
@@ -721,7 +721,7 @@ class RemoteAPICore {
}
foreach
((
array
)
$set
[
'unlock'
]
as
$id
){
$id
=
cleanID
(
$id
);
$id
=
$this
->
resolvePageId
(
$id
);
if
(
auth_quickaclcheck
(
$id
)
<
AUTH_EDIT
||
!
unlock
(
$id
)){
$unlockfail
[]
=
$id
;
}
else
{
...
...
@@ -764,6 +764,14 @@ class RemoteAPICore {
return
$ok
;
}
private
function
resolvePageId
(
$id
)
{
$id
=
cleanID
(
$id
);
if
(
empty
(
$id
))
{
global
$conf
;
$id
=
cleanID
(
$conf
[
'start'
]);
}
return
$id
;
}
}
This diff is collapsed.
Click to expand it.
lib/exe/xmlrpc.php
+
2
−
1
View file @
921ba557
...
...
@@ -30,10 +30,11 @@ class dokuwiki_xmlrpc_server extends IXR_Server {
}
catch
(
RemoteAccessDeniedException
$e
)
{
if
(
!
isset
(
$_SERVER
[
'REMOTE_USER'
]))
{
header
(
'HTTP/1.1 401 Unauthorized'
);
return
new
IXR_Error
(
-
32603
,
"server error. not authorized to call method
$methodname
"
);
}
else
{
header
(
'HTTP/1.1 403 Forbidden'
);
return
new
IXR_Error
(
-
32604
,
"server error. forbidden to call the method
$methodname
"
);
}
return
new
IXR_Error
(
-
32603
,
"server error. not authorized to call method
$methodname
"
);
}
catch
(
RemoteException
$e
)
{
return
new
IXR_Error
(
$e
->
getCode
(),
$e
->
getMessage
());
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment