mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 17:23:00 +00:00
Allow access to opensearch-description when not logged in, and make opsearch description use search-redirect
This commit is contained in:
parent
60ebd1340c
commit
4ea4315c5a
4 changed files with 11 additions and 9 deletions
|
@ -1689,7 +1689,7 @@ if(!isset($pageindex->{$env->page}) and isset($_GET["search-redirect"]))
|
||||||
// Note we use $_GET here because $env->action isn't populated at this point
|
// Note we use $_GET here because $env->action isn't populated at this point
|
||||||
if($settings->require_login_view === true && // If this site requires a login in order to view pages
|
if($settings->require_login_view === true && // If this site requires a login in order to view pages
|
||||||
!$env->is_logged_in && // And the user isn't logged in
|
!$env->is_logged_in && // And the user isn't logged in
|
||||||
!in_array($_GET["action"], [ "login", "checklogin" ])) // And the user isn't trying to login
|
!in_array($_GET["action"], [ "login", "checklogin", "opensearch-description" ])) // And the user isn't trying to login, or get the opensearch description
|
||||||
{
|
{
|
||||||
// Redirect the user to the login page
|
// Redirect the user to the login page
|
||||||
http_response_code(307);
|
http_response_code(307);
|
||||||
|
@ -3347,7 +3347,8 @@ register_module([
|
||||||
<InputEncoding>UTF-8</InputEncoding>
|
<InputEncoding>UTF-8</InputEncoding>
|
||||||
<OutputEncoding>UTF-8</OutputEncoding>
|
<OutputEncoding>UTF-8</OutputEncoding>
|
||||||
|
|
||||||
<Url type=\"text/html\" method=\"get\" template=\"$siteRoot?action=search&query={searchTerms}&offset={startIndex?}&count={count}\" />
|
<Url type=\"text/html\" method=\"get\" template=\"$siteRoot?action=view&search-redirect=yes&page={searchTerms}&offset={startIndex?}&count={count}\" />
|
||||||
|
<Url type=\"application/x-suggestions+json\" template=\"$siteRoot?action=suggest-pages&query={searchTerms}&type=opensearch\" />
|
||||||
</OpenSearchDescription>");
|
</OpenSearchDescription>");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3367,8 +3368,8 @@ register_module([
|
||||||
if($settings->dynamic_page_suggestion_count === 0)
|
if($settings->dynamic_page_suggestion_count === 0)
|
||||||
{
|
{
|
||||||
header("content-type: application/json");
|
header("content-type: application/json");
|
||||||
header("content-length: 2");
|
header("content-length: 3");
|
||||||
exit("[]");
|
exit("[]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($_GET["query"])) {
|
if(empty($_GET["query"])) {
|
||||||
|
|
2
core.php
2
core.php
|
@ -1336,7 +1336,7 @@ if(!isset($pageindex->{$env->page}) and isset($_GET["search-redirect"]))
|
||||||
// Note we use $_GET here because $env->action isn't populated at this point
|
// Note we use $_GET here because $env->action isn't populated at this point
|
||||||
if($settings->require_login_view === true && // If this site requires a login in order to view pages
|
if($settings->require_login_view === true && // If this site requires a login in order to view pages
|
||||||
!$env->is_logged_in && // And the user isn't logged in
|
!$env->is_logged_in && // And the user isn't logged in
|
||||||
!in_array($_GET["action"], [ "login", "checklogin" ])) // And the user isn't trying to login
|
!in_array($_GET["action"], [ "login", "checklogin", "opensearch-description" ])) // And the user isn't trying to login, or get the opensearch description
|
||||||
{
|
{
|
||||||
// Redirect the user to the login page
|
// Redirect the user to the login page
|
||||||
http_response_code(307);
|
http_response_code(307);
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.",
|
"description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.",
|
||||||
"id": "feature-search",
|
"id": "feature-search",
|
||||||
"lastupdate": 1498643008,
|
"lastupdate": 1498645080,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -273,7 +273,8 @@ register_module([
|
||||||
<InputEncoding>UTF-8</InputEncoding>
|
<InputEncoding>UTF-8</InputEncoding>
|
||||||
<OutputEncoding>UTF-8</OutputEncoding>
|
<OutputEncoding>UTF-8</OutputEncoding>
|
||||||
|
|
||||||
<Url type=\"text/html\" method=\"get\" template=\"$siteRoot?action=search&query={searchTerms}&offset={startIndex?}&count={count}\" />
|
<Url type=\"text/html\" method=\"get\" template=\"$siteRoot?action=view&search-redirect=yes&page={searchTerms}&offset={startIndex?}&count={count}\" />
|
||||||
|
<Url type=\"application/x-suggestions+json\" template=\"$siteRoot?action=suggest-pages&query={searchTerms}&type=opensearch\" />
|
||||||
</OpenSearchDescription>");
|
</OpenSearchDescription>");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -293,8 +294,8 @@ register_module([
|
||||||
if($settings->dynamic_page_suggestion_count === 0)
|
if($settings->dynamic_page_suggestion_count === 0)
|
||||||
{
|
{
|
||||||
header("content-type: application/json");
|
header("content-type: application/json");
|
||||||
header("content-length: 2");
|
header("content-length: 3");
|
||||||
exit("[]");
|
exit("[]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($_GET["query"])) {
|
if(empty($_GET["query"])) {
|
||||||
|
|
Loading…
Reference in a new issue