first commit

This commit is contained in:
2026-02-08 21:16:11 +01:00
commit e17b7026fd
8881 changed files with 1160453 additions and 0 deletions

View File

@@ -0,0 +1,135 @@
<?php
/**
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Adapted from the Joomla Search.categories plugin - plugins/search/categories/categories.php
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
*
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses
*/
defined('JPATH_PLATFORM') or die;
/**
* Categories search plugin.
*
* @since 1.6
*/
class PlgWfSearchCategories extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*
* @since 1.6
*/
public function onContentSearchAreas()
{
static $areas = array(
'categories' => 'PLG_SEARCH_CATEGORIES_CATEGORIES',
);
return $areas;
}
/**
* Search content (categories).
*
* The SQL must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav.
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values: exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest".
* @param mixed $areas An array if the search is to be restricted to areas or null to search all areas.
*
* @return array Search results.
*
* @since 1.6
*/
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
$app = JFactory::getApplication();
$groups = implode(',', $user->getAuthorisedViewLevels());
$searchText = $text;
if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
return array();
}
$limit = $this->params->def('search_limit', 50);
$text = trim($text);
if ($text === '') {
return array();
}
switch ($ordering) {
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.title DESC';
}
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
$query = $db->getQuery(true);
// SQLSRV changes.
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$query->select('a.title, a.description AS text, a.id AS catid, a.created_time, a.language, ' . $case_when);
$query->from('#__categories AS a');
$query->where(
'(a.title LIKE ' . $text . ' OR a.description LIKE ' . $text . ') AND a.published = 1 AND a.extension = '
. $db->quote('com_content') . 'AND a.access IN (' . $groups . ')'
);
$query->group('a.id, a.title, a.description, a.alias, a.created_time');
$query->order($order);
$db->setQuery($query, 0, $limit);
try
{
$rows = $db->loadObjectList();
} catch (RuntimeException $e) {
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
}
if ($rows) {
foreach ($rows as $i => $row) {
$rows[$i]->href = JHelperRoute::getCategoryRoute($row->slug, $row->language, 'com_content');
$rows[$i]->section = JText::_('JCATEGORY');
}
}
return $rows;
}
}

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@@ -0,0 +1,166 @@
<?php
/**
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Adapted from the Joomla Search.contacts plugin - plugins/search/contacts/contacts.php
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
*
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses
*/
defined('JPATH_PLATFORM') or die;
/**
* Contacts search plugin.
*/
class PlgWfSearchContacts extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
*/
protected $autoloadLanguage = true;
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*/
public function onContentSearchAreas()
{
static $areas = array(
'contacts' => 'PLG_SEARCH_CONTACTS_CONTACTS'
);
return $areas;
}
/**
* Search content (contacts).
*
* The SQL must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav.
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values: exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest".
* @param string $areas An array if the search is to be restricted to areas or null to search all areas.
*
* @return array Search results.
*/
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
// create a new RouteHelper instance
$router = new JHelperRoute();
if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas())))
{
return array();
}
$limit = $this->params->def('search_limit', 50);
$text = trim($text);
if ($text === '')
{
return array();
}
$section = JText::_('PLG_SEARCH_CONTACTS_CONTACTS');
switch ($ordering)
{
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'c.title ASC, a.name ASC';
break;
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
$query = $db->getQuery(true);
// SQLSRV changes.
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias', '!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select(
'a.name AS title, a.con_position, a.misc, a.language, '
. $case_when . ',' . $case_when1 . ', '
. $query->concatenate(array('a.name', 'a.con_position', 'a.misc'), ',') . ' AS text'
);
$query->from('#__contact_details AS a')
->join('INNER', '#__categories AS c ON c.id = a.catid')
->where(
'(a.name LIKE ' . $text . ' OR a.misc LIKE ' . $text . ' OR a.con_position LIKE ' . $text
. ' OR a.address LIKE ' . $text . ' OR a.suburb LIKE ' . $text . ' OR a.state LIKE ' . $text
. ' OR a.country LIKE ' . $text . ' OR a.postcode LIKE ' . $text . ' OR a.telephone LIKE ' . $text
. ' OR a.fax LIKE ' . $text . ') AND a.published = 1 AND c.published = 1 '
. ' AND a.access IN (' . $groups . ') AND c.access IN (' . $groups . ')'
)
->order($order);
$db->setQuery($query, 0, $limit);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$rows = array();
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
}
if ($rows)
{
// create a new RouteHelper instance
$router = new JHelperRoute();
foreach ($rows as $key => $row)
{
$rows[$key]->href = $router->getRoute($row->slug, 'com_contact.contact', '', $row->language, $row->catslug);
$rows[$key]->text = $row->title;
$rows[$key]->text .= $row->con_position ? ', ' . $row->con_position : '';
$rows[$key]->text .= $row->misc ? ', ' . $row->misc : '';
$rows[$key]->section = $section;
}
}
return $rows;
}
}

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@@ -0,0 +1,201 @@
<?php
/**
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Adapted from the Joomla Search.content plugin - plugins/search/content/content.php
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
*
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses
*/
defined('JPATH_PLATFORM') or die;
/**
* Content search plugin.
*
*/
class PlgWfSearchContent extends JPlugin
{
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*
*/
public function onContentSearchAreas()
{
static $areas = array(
'content' => 'JGLOBAL_ARTICLES',
);
return $areas;
}
/**
* Search content (articles).
* The SQL must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav.
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values: exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest".
* @param mixed $areas An array if the search it to be restricted to areas or null to search all areas.
*
* @return array Search results.
*
*/
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$db = JFactory::getDbo();
$serverType = $db->getServerType();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$tag = JFactory::getLanguage()->getTag();
$searchText = $text;
if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
return array();
}
$limit = $this->params->def('search_limit', 50);
$nullDate = $db->getNullDate();
$date = JFactory::getDate();
$now = $date->toSql();
$text = trim($text);
if ($text === '') {
return array();
}
$relevance = array();
switch ($phrase) {
case 'exact':
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
$wheres2 = array();
$wheres2[] = 'a.title LIKE ' . $text;
$wheres2[] = 'a.introtext LIKE ' . $text;
$wheres2[] = 'a.fulltext LIKE ' . $text;
$relevance[] = ' CASE WHEN ' . $wheres2[0] . ' THEN 5 ELSE 0 END ';
$where = '(' . implode(') OR (', $wheres2) . ')';
break;
case 'all':
case 'any':
default:
$words = explode(' ', $text);
$wheres = array();
foreach ($words as $word) {
$word = $db->quote('%' . $db->escape($word, true) . '%', false);
$wheres2 = array();
$wheres2[] = 'LOWER(a.title) LIKE LOWER(' . $word . ')';
$wheres2[] = 'LOWER(a.introtext) LIKE LOWER(' . $word . ')';
$wheres2[] = 'LOWER(a.fulltext) LIKE LOWER(' . $word . ')';
$relevance[] = ' CASE WHEN ' . $wheres2[0] . ' THEN 5 ELSE 0 END ';
$wheres[] = implode(' OR ', $wheres2);
}
$where = '(' . implode(($phrase === 'all' ? ') AND (' : ') OR ('), $wheres) . ')';
break;
}
switch ($ordering) {
case 'oldest':
$order = 'a.created ASC';
break;
case 'popular':
$order = 'a.hits DESC';
break;
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
$order = 'c.title ASC, a.title ASC';
break;
case 'newest':
default:
$order = 'a.created DESC';
break;
}
$rows = array();
$query = $db->getQuery(true);
// Search articles.
if ($limit > 0) {
//sqlsrv changes
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('a.alias', '!=', '0');
$case_when1 .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when1 .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $a_id . ' END as slug';
$case_when2 = ' CASE WHEN ';
$case_when2 .= $query->charLength('b.alias', '!=', '0');
$case_when2 .= ' THEN ';
$c_id = $query->castAsChar('b.id');
$case_when2 .= $query->concatenate(array($c_id, 'b.alias'), ':');
$case_when2 .= ' ELSE ';
$case_when2 .= $c_id . ' END as catslug';
$case = ',' . $case_when1 . ',' . $case_when2;
if (!empty($relevance)) {
$query->select(implode(' + ', $relevance) . ' AS relevance');
$order = ' relevance DESC, ' . $order;
}
$query->select('a.id AS slug, b.id AS catslug, a.alias, a.state, a.title AS title, a.access, ' . $query->concatenate(array('a.introtext', 'a.fulltext')) . ' AS text, a.language' . $case);
$query->from('#__content AS a');
$query->innerJoin('#__categories AS b ON b.id = a.catid');
$query->where('(' . $where . ') AND a.state = 1 AND b.published = 1');
if (!$user->authorise('core.admin')) {
$query->where('a.access IN (' . $groups . ')');
$query->where('b.access IN (' . $groups . ')');
}
$query->order($order);
$db->setQuery($query, 0, $limit);
try
{
$rows = $db->loadObjectList();
} catch (RuntimeException $e) {
$rows = array();
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
}
if ($rows) {
// create a new RouteHelper instance
$router = new JHelperRoute();
foreach ($rows as $key => $row) {
$rows[$key]->href = $router->getRoute($row->slug, 'com_content.article', '', $row->language, $row->catslug);
}
}
}
return $rows;
}
}

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@@ -0,0 +1,160 @@
<?php
/**
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Adapted from the Joomla Search.tags plugin - plugins/search/tags/tags.php
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
*
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses
*/
defined('JPATH_PLATFORM') or die;
/**
* Tags search plugin.
*
*/
class PlgWfSearchTags extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
*/
protected $autoloadLanguage = true;
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*
*/
public function onContentSearchAreas()
{
static $areas = array(
'tags' => 'PLG_SEARCH_TAGS_TAGS'
);
return $areas;
}
/**
* Search content (tags).
*
* The SQL must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav.
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values: exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest".
* @param string $areas An array if the search is to be restricted to areas or null to search all areas.
*
* @return array Search results.
*
* @since 3.3
*/
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$app = JFactory::getApplication();
$user = JFactory::getUser();
$lang = JFactory::getLanguage();
$section = JText::_('PLG_SEARCH_TAGS_TAGS');
$limit = $this->params->def('search_limit', 50);
if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas())))
{
return array();
}
$text = trim($text);
if ($text === '')
{
return array();
}
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
switch ($ordering)
{
case 'alpha':
$order = 'a.title ASC';
break;
case 'newest':
$order = 'a.created_time DESC';
break;
case 'oldest':
$order = 'a.created_time ASC';
break;
case 'popular':
default:
$order = 'a.title DESC';
}
$query->select('a.id, a.title, a.alias, a.note, a.published, a.access'
. ', a.checked_out, a.checked_out_time, a.created_user_id'
. ', a.path, a.parent_id, a.level, a.lft, a.rgt'
. ', a.language, a.created_time AS created, a.description');
$case_when_item_alias = ' CASE WHEN ';
$case_when_item_alias .= $query->charLength('a.alias', '!=', '0');
$case_when_item_alias .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when_item_alias .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when_item_alias .= ' ELSE ';
$case_when_item_alias .= $a_id . ' END as slug';
$query->select($case_when_item_alias);
$query->from('#__tags AS a');
$query->where('a.alias <> ' . $db->quote('root'));
$query->where('(a.title LIKE ' . $text . ' OR a.alias LIKE ' . $text . ')');
$query->where($db->qn('a.published') . ' = 1');
if (!$user->authorise('core.admin'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
$query->order($order);
$db->setQuery($query, 0, $limit);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$rows = array();
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
}
if ($rows)
{
// create a new RouteHelper instance
$router = new JHelperRoute();
foreach ($rows as $key => $row)
{
$rows[$key]->href = $router->getRoute($row->slug, 'com_tags.tag', '', $row->language);
$rows[$key]->text = ($row->description !== '' ? $row->description : $row->title);
$rows[$key]->text .= $row->note;
}
}
return $rows;
}
}

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@@ -0,0 +1,179 @@
<?php
/**
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Adapted from the Joomla Search.weblinks plugin - plugins/search/weblinks/weblinks.php
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
*
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses
*/
defined('JPATH_PLATFORM') or die;
require_once JPATH_SITE . '/components/com_weblinks/helpers/route.php';
/**
* Weblinks search plugin.
*
*/
class PlgWfSearchWeblinks extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
*/
protected $autoloadLanguage = true;
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*
*/
public function onContentSearchAreas()
{
static $areas = array(
'weblinks' => 'PLG_SEARCH_WEBLINKS_WEBLINKS'
);
return $areas;
}
/**
* Search content (weblinks).
*
* The SQL must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values: exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest".
* @param mixed $areas An array if the search it to be restricted to areas or null to search all areas.
*
* @return array Search results.
*
* @since 1.6
*/
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$db = JFactory::getDbo();
$groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
$searchText = $text;
if (is_array($areas))
{
if (!array_intersect($areas, array_keys($this->onContentSearchAreas())))
{
return array();
}
}
$limit = $this->params->def('search_limit', 50);
$state = array();
$text = trim($text);
if ($text == '')
{
return array();
}
switch ($phrase)
{
case 'exact':
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
$wheres2 = array();
$wheres2[] = 'a.url LIKE ' . $text;
$wheres2[] = 'a.description LIKE ' . $text;
$wheres2[] = 'a.title LIKE ' . $text;
$where = '(' . implode(') OR (', $wheres2) . ')';
break;
case 'all':
case 'any':
default:
$words = explode(' ', $text);
$wheres = array();
foreach ($words as $word)
{
$word = $db->quote('%' . $db->escape($word, true) . '%', false);
$wheres2 = array();
$wheres2[] = 'a.url LIKE ' . $word;
$wheres2[] = 'a.description LIKE ' . $word;
$wheres2[] = 'a.title LIKE ' . $word;
$wheres[] = implode(' OR ', $wheres2);
}
$where = '(' . implode(($phrase == 'all' ? ') AND (' : ') OR ('), $wheres) . ')';
break;
}
switch ($ordering)
{
case 'oldest':
$order = 'a.created ASC';
break;
case 'popular':
$order = 'a.hits DESC';
break;
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
$order = 'c.title ASC, a.title ASC';
break;
case 'newest':
default:
$order = 'a.created DESC';
}
$query = $db->getQuery(true);
// SQLSRV changes.
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias', '!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select('a.title AS title, a.created AS created, a.url, a.description AS text, a.language, ' . $case_when . "," . $case_when1)
->from('#__weblinks AS a')
->join('INNER', '#__categories as c ON c.id = a.catid')
->where('(' . $where . ') AND a.state = 1 AND c.published = 1 AND c.access IN (' . $groups . ')')
->order($order);
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
if ($rows)
{
foreach ($rows as $key => $row)
{
$rows[$key]->href = WeblinksHelperRoute::getWeblinkRoute($row->slug, $row->catslug, $row->language);
}
}
return $rows;
}
}