summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-04-20 03:14:20 -0700
committerAndreas Gohr <andi@splitbrain.org>2012-04-20 03:14:20 -0700
commit921ba557ebfbe154e3771715471d9f65630a464b (patch)
tree73b93bfe5086666a683f6f13d7a2dd9969fd9190 /inc
parentc67addf8c8a91cb62cdadb0f39683cdf0e2ea9fd (diff)
parentd41322ba564fdb4e6c0e6572fb14c20e9238a7ee (diff)
downloadrpg-921ba557ebfbe154e3771715471d9f65630a464b.tar.gz
rpg-921ba557ebfbe154e3771715471d9f65630a464b.tar.bz2
Merge pull request #97 from timroes/master
Remote interface improvements
Diffstat (limited to 'inc')
-rw-r--r--inc/RemoteAPICore.php28
1 files changed, 18 insertions, 10 deletions
diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php
index 9da493210..36c518881 100644
--- a/inc/RemoteAPICore.php
+++ b/inc/RemoteAPICore.php
@@ -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;
+ }
}