From cffea7877fa1a5e2c46852274ae878bf73284598 Mon Sep 17 00:00:00 2001 From: Tim Roes Date: Thu, 12 Apr 2012 22:23:09 +0200 Subject: Added page title to search results in Remote API --- inc/RemoteAPICore.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/RemoteAPICore.php') diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 546832100..80deb7377 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -302,6 +302,7 @@ class RemoteAPICore { 'mtime' => filemtime($file), 'size' => filesize($file), 'snippet' => $snippet, + 'title' => p_get_first_heading($id) ); } return $pages; -- cgit v1.2.3 From 5529fa3167d83c7fd8ab03d077c2b46163b20c24 Mon Sep 17 00:00:00 2001 From: Tim Roes Date: Thu, 12 Apr 2012 23:29:24 +0200 Subject: Remote search is aware of useheading option --- 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 80deb7377..9da493210 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -302,7 +302,7 @@ class RemoteAPICore { 'mtime' => filemtime($file), 'size' => filesize($file), 'snippet' => $snippet, - 'title' => p_get_first_heading($id) + 'title' => useHeading('navigation') ? p_get_first_heading($id) : $id ); } return $pages; -- cgit v1.2.3 From d41322ba564fdb4e6c0e6572fb14c20e9238a7ee Mon Sep 17 00:00:00 2001 From: Tim Roes Date: Thu, 19 Apr 2012 13:51:37 +0200 Subject: Resolve empty page ID to configured start page --- inc/RemoteAPICore.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'inc/RemoteAPICore.php') 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 */ 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 */ 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; + } } -- cgit v1.2.3