From 2b494a96377ea4987b301e0ea7077385f88dffb0 Mon Sep 17 00:00:00 2001 From: Daniel Mejia Date: Mon, 15 Jun 2026 12:06:34 -0400 Subject: [PATCH 1/3] Disabled public search as an option --- .../admin/language/en-GB/en-GB.com_publications.ini | 2 ++ core/components/com_publications/config/config.xml | 4 ++++ .../site/controllers/publications.php | 12 ++++++++++++ .../site/language/en-GB/en-GB.com_publications.ini | 1 + .../admin/language/en-GB/en-GB.com_resources.ini | 2 ++ core/components/com_resources/config/config.xml | 4 ++++ .../com_resources/site/controllers/resources.php | 12 ++++++++++++ .../site/language/en-GB/en-GB.com_resources.ini | 1 + .../com_tags/admin/language/en-GB/en-GB.com_tags.ini | 2 ++ core/components/com_tags/config/config.xml | 4 ++++ core/components/com_tags/site/controllers/tags.php | 12 ++++++++++++ .../com_tags/site/language/en-GB/en-GB.com_tags.ini | 1 + 12 files changed, 57 insertions(+) diff --git a/core/components/com_publications/admin/language/en-GB/en-GB.com_publications.ini b/core/components/com_publications/admin/language/en-GB/en-GB.com_publications.ini index 165f33e7f4e..686bdc9c6c1 100644 --- a/core/components/com_publications/admin/language/en-GB/en-GB.com_publications.ini +++ b/core/components/com_publications/admin/language/en-GB/en-GB.com_publications.ini @@ -28,6 +28,8 @@ COM_CONFIG_AIP_FIELDSET_LABEL="AIP" COM_CONFIG_SECTIONS_FIELDSET_LABEL="Sections" COM_CONFIG_DOI_FIELDSET_LABEL="DOI Configuration" COM_CONFIG_CURATION_FIELDSET_LABEL="Curation" +COM_PUBLICATIONS_CONFIG_ALLOW_PUBLIC_SEARCH="Allow Public Search" +COM_PUBLICATIONS_CONFIG_ALLOW_PUBLIC_SEARCH_DESC="Allow guests to browse and search publications." COM_PUBLICATIONS_PUBLICATIONS_ADMIN_CONTROLS="Administrative Controls" COM_PUBLICATIONS_GALLERY="Gallery" diff --git a/core/components/com_publications/config/config.xml b/core/components/com_publications/config/config.xml index fa9078e99b2..d907bf38d2a 100644 --- a/core/components/com_publications/config/config.xml +++ b/core/components/com_publications/config/config.xml @@ -12,6 +12,10 @@ + + + + diff --git a/core/components/com_publications/site/controllers/publications.php b/core/components/com_publications/site/controllers/publications.php index 03257dc8251..b3230ea59c1 100644 --- a/core/components/com_publications/site/controllers/publications.php +++ b/core/components/com_publications/site/controllers/publications.php @@ -407,6 +407,18 @@ public function introTask() */ public function browseTask() { + if (!$this->config->get('allow_public_search', 1) && User::isGuest()) + { + $return = base64_encode(Request::current(true)); + + App::redirect( + Route::url('index.php?option=com_users&view=login&return=' . $return, false), + Lang::txt('COM_PUBLICATIONS_SEARCH_LOGIN_REQUIRED'), + 'warning' + ); + return; + } + // Set the default sort $default_sort = 'date'; diff --git a/core/components/com_publications/site/language/en-GB/en-GB.com_publications.ini b/core/components/com_publications/site/language/en-GB/en-GB.com_publications.ini index ab3d8520cb8..a67cb9913ca 100644 --- a/core/components/com_publications/site/language/en-GB/en-GB.com_publications.ini +++ b/core/components/com_publications/site/language/en-GB/en-GB.com_publications.ini @@ -20,6 +20,7 @@ COM_PUBLICATIONS_NO_RESULTS="No results found" COM_PUBLICATIONS_RESULTS="Results" COM_PUBLICATIONS_RESULT="result" COM_PUBLICATIONS_LOGIN_NOTICE="You must log in before you can proceed." +COM_PUBLICATIONS_SEARCH_LOGIN_REQUIRED="You must log in to browse and search publications." COM_PUBLICATIONS_PRIVATE_PUB_LOGIN="This is a private publication. You must login to access this page." COM_PUBLICATIONS_PRIVATE_NO_ACCESS="Sorry, this is a private publication with restricted access." COM_PUBLICATIONS_BROWSE="Browse" diff --git a/core/components/com_resources/admin/language/en-GB/en-GB.com_resources.ini b/core/components/com_resources/admin/language/en-GB/en-GB.com_resources.ini index b47354c9dc2..d56061d4176 100644 --- a/core/components/com_resources/admin/language/en-GB/en-GB.com_resources.ini +++ b/core/components/com_resources/admin/language/en-GB/en-GB.com_resources.ini @@ -11,6 +11,8 @@ COM_CONFIG_FILES_FIELDSET_LABEL="Files" COM_CONFIG_CREATION_FIELDSET_LABEL="New Submissions" COM_CONFIG_ENTRY_FIELDSET_LABEL="Entries" COM_CONFIG_IMPORT_FIELDSET_LABEL="Import" +COM_RESOURCES_ALLOW_PUBLIC_SEARCH_LABEL="Allow Public Search" +COM_RESOURCES_ALLOW_PUBLIC_SEARCH_DESC="Allow guests to browse and search resources." ; Filters COM_RESOURCES_FILTER_CATEGORY="Category" diff --git a/core/components/com_resources/config/config.xml b/core/components/com_resources/config/config.xml index 074d0ed4c83..3e123528186 100644 --- a/core/components/com_resources/config/config.xml +++ b/core/components/com_resources/config/config.xml @@ -8,6 +8,10 @@
+ + + + diff --git a/core/components/com_resources/site/controllers/resources.php b/core/components/com_resources/site/controllers/resources.php index 127f4023326..e743618e2ef 100644 --- a/core/components/com_resources/site/controllers/resources.php +++ b/core/components/com_resources/site/controllers/resources.php @@ -195,6 +195,18 @@ public function displayTask() */ public function browseTask() { + if (!$this->config->get('allow_public_search', 1) && User::isGuest()) + { + $return = base64_encode(Request::current(true)); + + App::redirect( + Route::url('index.php?option=com_users&view=login&return=' . $return, false), + Lang::txt('COM_RESOURCES_SEARCH_LOGIN_REQUIRED'), + 'warning' + ); + return; + } + // Set the default sort $default_sort = 'date'; diff --git a/core/components/com_resources/site/language/en-GB/en-GB.com_resources.ini b/core/components/com_resources/site/language/en-GB/en-GB.com_resources.ini index 3753f58a17d..a82174e3580 100644 --- a/core/components/com_resources/site/language/en-GB/en-GB.com_resources.ini +++ b/core/components/com_resources/site/language/en-GB/en-GB.com_resources.ini @@ -53,6 +53,7 @@ COM_RESOURCES_PENDING="Pending" COM_RESOURCES_ALERTNOTAUTH="You are not authorized to view this resource." COM_RESOURCES_ALERTNOTAUTH_GROUP="You are not authorized to view this resource. You must be logged in and a member of the group "%s". If you would like to join this group, please see the group info for instructions. If you are already a member or feel this message is in error, please contact support." COM_RESOURCES_ALERTLOGIN_REQUIRED="You must login to view this resource." +COM_RESOURCES_SEARCH_LOGIN_REQUIRED="You must log in to browse and search resources." COM_RESOURCES_SELECT="Select..." COM_RESOURCES_AUDIO_PODCAST="Audio podcast" COM_RESOURCES_VIDEO_PODCAST="Video podcast" diff --git a/core/components/com_tags/admin/language/en-GB/en-GB.com_tags.ini b/core/components/com_tags/admin/language/en-GB/en-GB.com_tags.ini index abf7385e464..f01b143f090 100644 --- a/core/components/com_tags/admin/language/en-GB/en-GB.com_tags.ini +++ b/core/components/com_tags/admin/language/en-GB/en-GB.com_tags.ini @@ -6,6 +6,8 @@ COM_TAGS="Tags" COM_TAGS_CONFIGURATION="Tags Configuration" +COM_TAGS_ALLOW_PUBLIC_SEARCH_LABEL="Allow Public Search" +COM_TAGS_ALLOW_PUBLIC_SEARCH_DESC="Allow guests to search using multiple tags." COM_TAGS_NEW="New" COM_TAGS_RELATIONSHIPS="Relationships" COM_TAGS_FOCUS_AREAS="Focus Areas" diff --git a/core/components/com_tags/config/config.xml b/core/components/com_tags/config/config.xml index 091546b9c79..c62b08fdcb1 100644 --- a/core/components/com_tags/config/config.xml +++ b/core/components/com_tags/config/config.xml @@ -8,6 +8,10 @@
+ + + + diff --git a/core/components/com_tags/site/controllers/tags.php b/core/components/com_tags/site/controllers/tags.php index 78d45f0c67e..e3b823548a7 100644 --- a/core/components/com_tags/site/controllers/tags.php +++ b/core/components/com_tags/site/controllers/tags.php @@ -113,6 +113,18 @@ public function viewTask() $tgs[] = $addtag; } + if (!$this->config->get('allow_public_search', 1) && count($tgs) > 1 && User::isGuest()) + { + $return = base64_encode(Request::current(true)); + + App::redirect( + Route::url('index.php?option=com_users&view=login&return=' . $return, false), + Lang::txt('COM_TAGS_SEARCH_LOGIN_REQUIRED'), + 'warning' + ); + return; + } + // Sanitize the tag $tags = array(); $added = array(); diff --git a/core/components/com_tags/site/language/en-GB/en-GB.com_tags.ini b/core/components/com_tags/site/language/en-GB/en-GB.com_tags.ini index ea0f8026ca5..51ea1cb5688 100644 --- a/core/components/com_tags/site/language/en-GB/en-GB.com_tags.ini +++ b/core/components/com_tags/site/language/en-GB/en-GB.com_tags.ini @@ -22,6 +22,7 @@ COM_TAGS_TAG_REMOVED="Tag removed" ; Introduction COM_TAGS_SEARCH="Search" +COM_TAGS_SEARCH_LOGIN_REQUIRED="You must log in to search using multiple tags." COM_TAGS_SEARCH_TAGS="Search tags" COM_TAGS_SEARCH_PLACEHOLDER="Keyword or phrase..." COM_TAGS_TOP_USED="Top Used" From b2af2abf38d2c39e3b2e27fb125c9cfdb97de35e Mon Sep 17 00:00:00 2001 From: Daniel Mejia Date: Mon, 15 Jun 2026 18:38:40 -0400 Subject: [PATCH 2/3] control bots --- .../com_publications/site/controllers/publications.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/components/com_publications/site/controllers/publications.php b/core/components/com_publications/site/controllers/publications.php index b3230ea59c1..145469b33a4 100644 --- a/core/components/com_publications/site/controllers/publications.php +++ b/core/components/com_publications/site/controllers/publications.php @@ -409,6 +409,13 @@ public function browseTask() { if (!$this->config->get('allow_public_search', 1) && User::isGuest()) { + $query = Request::getString('QUERY_STRING', '', 'server'); + + if (Request::getString('tag', '', 'request') || preg_match('/(?:^|[&;])(?:amp;)?tag=/i', $query)) + { + throw new Exception(Lang::txt('COM_PUBLICATIONS_SEARCH_LOGIN_REQUIRED'), 404); + } + $return = base64_encode(Request::current(true)); App::redirect( From 01f7dbd45e42041227bc44f7e9418402a3180466 Mon Sep 17 00:00:00 2001 From: Daniel Mejia Date: Mon, 15 Jun 2026 18:41:47 -0400 Subject: [PATCH 3/3] control bots --- .../com_publications/site/controllers/publications.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/components/com_publications/site/controllers/publications.php b/core/components/com_publications/site/controllers/publications.php index 145469b33a4..ac64e4b9bcd 100644 --- a/core/components/com_publications/site/controllers/publications.php +++ b/core/components/com_publications/site/controllers/publications.php @@ -413,7 +413,7 @@ public function browseTask() if (Request::getString('tag', '', 'request') || preg_match('/(?:^|[&;])(?:amp;)?tag=/i', $query)) { - throw new Exception(Lang::txt('COM_PUBLICATIONS_SEARCH_LOGIN_REQUIRED'), 404); + throw new Exception(Lang::txt('COM_PUBLICATIONS_SEARCH_LOGIN_REQUIRED'), 410); } $return = base64_encode(Request::current(true));