29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-27 07:33:41 +00:00

[#20783] A lot of issues related to searching and language switcher

git-svn-id: http://joomlacode.org/svn/joomla/development/trunk@17446 6f6e1ebd-4c2b-0410-823f-f34bde69bce9
This commit is contained in:
Christophe Demko 2010-06-02 08:36:30 +00:00
parent 8554d8ceda
commit d022f40c28
25 changed files with 334 additions and 255 deletions

View File

@ -166,8 +166,8 @@ JFIELD_OPTION_NONE="None"
JFIELD_ORDERING_DESC="Ordering Desc"
JFIELD_ORDERING_LABEL="Ordering"
JFIELD_PARAMS_LABEL="Options"
JFIELD_PLG_SEARCH_ALL_DESC="Indicate whether to include archived items in the search"
JFIELD_PLG_SEARCH_ALL_LABEL="Search Archived"
JFIELD_PLG_SEARCH_ALL_DESC="Indicate whether to include published items in the search"
JFIELD_PLG_SEARCH_ALL_LABEL="Search Published"
JFIELD_PLG_SEARCH_ARCHIVED_DESC="Indicate whether to include archived items in the search"
JFIELD_PLG_SEARCH_ARCHIVED_LABEL="Search Archived"
JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC="Sets the maximum number of results to return."

View File

@ -39,9 +39,11 @@ abstract class ContactHelperRoute
{
$categories = JCategories::getInstance('Contact');
$category = $categories->get($catid);
$needles['category'] = array_reverse($category->getPath());
$needles['categories'] = $needles['category'];
$link .= '&catid='.$catid;
if ($category) {
$needles['category'] = array_reverse($category->getPath());
$needles['categories'] = $needles['category'];
$link .= '&catid='.$catid;
}
}
if ($item = ContactHelperRoute::_findItem($needles)) {
@ -109,4 +111,4 @@ abstract class ContactHelperRoute
return null;
}
}
}

View File

@ -62,27 +62,26 @@ function ContactBuildRoute(&$query){
$menuCatid = $mId;
$categories = JCategories::getInstance('Contact');
$category = $categories->get($catid);
if(!$category)
if($category)
{
die('The category is not published or does not exist');
//TODO Throw error that the category either not exists or is unpublished
}
$path = array_reverse($category->getPath());
$path = array_reverse($category->getPath());
$array = array();
foreach($path as $id)
{
if((int) $id == (int)$menuCatid)
$array = array();
foreach($path as $id)
{
break;
if((int) $id == (int)$menuCatid)
{
break;
}
if($advanced)
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
}
if($advanced)
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
$segments = array_merge($segments, array_reverse($array));
}
$segments = array_merge($segments, array_reverse($array));
if($view == 'contact')
{
if($advanced)

View File

@ -64,25 +64,24 @@ function ContentBuildRoute(&$query)
$menuCatid = $mId;
$categories = JCategories::getInstance('Content');
$category = $categories->get($catid);
if (!$category)
if ($category)
{
die('The category is not published or does not exist');
//TODO Throw error that the category either not exists or is unpublished
}
$path = array_reverse($category->getPath());
$path = array_reverse($category->getPath());
$array = array();
foreach($path as $id) {
if ((int) $id == (int)$menuCatid) {
break;
$array = array();
foreach($path as $id) {
if ((int) $id == (int)$menuCatid) {
break;
}
if ($advanced) {
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
}
if ($advanced) {
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
}
$segments = array_merge($segments, array_reverse($array));
$segments = array_merge($segments, array_reverse($array));
}
if ($view == 'article') {
if ($advanced) {
list($tmp, $id) = explode(':', $query['id'], 2);
@ -233,4 +232,4 @@ function ContentParseRoute($segments)
}
return $vars;
}
}

View File

@ -39,14 +39,13 @@ abstract class NewsfeedsHelperRoute
{
$categories = JCategories::getInstance('Newsfeeds');
$category = $categories->get($catid);
if(!$category)
if($category)
{
die('The category is not published or does not exist');
//TODO Throw error that the category either not exists or is unpublished
$needles['category'] = array_reverse($category->getPath());
$needles['categories'] = $needles['category'];
$link .= '&catid='.$catid;
}
$needles['category'] = array_reverse($category->getPath());
$needles['categories'] = $needles['category'];
$link .= '&catid='.$catid;
}
if ($item = NewsfeedsHelperRoute::_findItem($needles)) {
@ -114,4 +113,4 @@ abstract class NewsfeedsHelperRoute
return null;
}
}
}

View File

@ -71,23 +71,25 @@ function NewsfeedsBuildRoute(&$query)
$menuCatid = $mId;
$categories = JCategories::getInstance('Newsfeeds');
$category = $categories->get($catid);
$path = $category->getPath();
$path = array_reverse($path);
if ($category) {
$path = $category->getPath();
$path = array_reverse($path);
$array = array();
foreach($path as $id)
{
if((int) $id == (int)$menuCatid)
$array = array();
foreach($path as $id)
{
break;
if((int) $id == (int)$menuCatid)
{
break;
}
if($advanced)
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
}
if($advanced)
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
$segments = array_merge($segments, array_reverse($array));
}
$segments = array_merge($segments, array_reverse($array));
if($view == 'newsfeed')
{
if($advanced)

View File

@ -23,9 +23,9 @@ defined('_JEXEC') or die;
<?php endif; ?>
<?php echo $this->loadTemplate('form'); ?>
<?php if (!$this->error && count($this->results) > 0) :
<?php if ($this->error==null && count($this->results) > 0) :
echo $this->loadTemplate('results');
else :
echo $this->loadTemplate('error');
endif; ?>
</div>
</div>

View File

@ -16,7 +16,7 @@ defined('_JEXEC') or die;
<dt class="result-title">
<?php echo $this->pagination->limitstart + $result->count.'. ';?>
<?php if ($result->href) :?>
<a href="<?php echo JRoute::_($result->href); ?>"<?php if ($result->browsernav == 1) :?> target="_blank"><?php endif;?>>
<a href="<?php echo JRoute::_($result->href); ?>"<?php if ($result->browsernav == 1) :?> target="_blank"<?php endif;?>>
<?php echo $this->escape($result->title);?>
</a>
<?php else:?>

View File

@ -31,8 +31,9 @@ class SearchViewSearch extends JView
$pathway = &$app->getPathway();
$uri = &JFactory::getURI();
$error = '';
$error = null;
$rows = null;
$results= null;
$total = 0;
// Get some data from the model
@ -101,8 +102,7 @@ class SearchViewSearch extends JView
// put the filtered results back into the model
// for next release, the checks should be done in the model perhaps...
$state->set('keyword', $searchword);
if (!$error)
if ($error==null)
{
$results = &$this->get('data');
$total = &$this->get('total');

View File

@ -39,9 +39,12 @@ abstract class WeblinksHelperRoute
{
$categories = JCategories::getInstance('Weblinks');
$category = $categories->get($catid);
$needles['category'] = array_reverse($category->getPath());
$needles['categories'] = $needles['category'];
$link .= '&catid='.$catid;
if($category)
{
$needles['category'] = array_reverse($category->getPath());
$needles['categories'] = $needles['category'];
$link .= '&catid='.$catid;
}
}
if ($item = WeblinksHelperRoute::_findItem($needles)) {
@ -110,4 +113,4 @@ abstract class WeblinksHelperRoute
return null;
}
}
}

View File

@ -71,23 +71,27 @@ function WeblinksBuildRoute(&$query)
$menuCatid = $mId;
$categories = JCategories::getInstance('Weblinks');
$category = $categories->get($catid);
$path = $category->getPath();
$path = array_reverse($path);
$array = array();
foreach($path as $id)
if ($category)
{
if((int) $id == (int)$menuCatid)
//TODO Throw error that the category either not exists or is unpublished
$path = $category->getPath();
$path = array_reverse($path);
$array = array();
foreach($path as $id)
{
break;
if((int) $id == (int)$menuCatid)
{
break;
}
if($advanced)
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
}
if($advanced)
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
$segments = array_merge($segments, array_reverse($array));
}
$segments = array_merge($segments, array_reverse($array));
if($view == 'weblink')
{
if($advanced)

View File

@ -37,12 +37,9 @@ class WeblinksViewWeblink extends JView
return;
}
//get the weblink
$weblink = &$this->get('data');
if ($weblink->url) {
if ($item->url) {
// redirects to url if matching id found
$app->redirect($weblink->url);
$app->redirect($item->url);
} else {
//TODO create proper error handling
$app->redirect('index.php', 'Weblink not found');

View File

@ -61,28 +61,20 @@ final class JSite extends JApplication
// if a language was specified it has priority
// otherwise use user or default language settings
jimport('joomla.plugin.helper');
JPluginHelper::importPlugin('system');
if (empty($options['language'])) {
$sef = JRequest::getString('lang', null);
if (!empty($sef)) {
$languages = JLanguageHelper::getLanguages('sef');
if (isset($languages[$sef])) {
$lang = $languages[$sef]->lang_code;
// Make sure that the sef's language exists
if ($lang && JLanguage::exists($lang)) {
$config = JFactory::getConfig();
$cookie_domain = $config->get('config.cookie_domain', '');
$cookie_path = $config->get('config.cookie_path', '/');
setcookie(JUtility::getHash('language'), $lang, time() + 365 * 86400, $cookie_path, $cookie_domain);
$options['language'] = $lang;
}
}
$lang = JRequest::getString('language', null);
if ($lang && JLanguage::exists($lang)) {
$options['language'] = $lang;
}
}
if ($this->_language_filter && empty($options['language'])) {
// Detect cookie language
jimport('joomla.utilities.utility');
$lang = JRequest::getString(JUtility::getHash('language'), null ,'cookie');
// Make sure that the user's language exists
if ($lang && JLanguage::exists($lang)) {
$options['language'] = $lang;
@ -184,7 +176,6 @@ final class JSite extends JApplication
$document->setTitle($params->get('page_title'));
$document->setDescription($params->get('page_description'));
$contents = JComponentHelper::renderComponent($component);
$document->setBuffer($contents, 'component');
@ -384,6 +375,9 @@ final class JSite extends JApplication
// Get the id of the active menu item
$menu = $this->getMenu();
$item = $menu->getActive();
if (!$item) {
$item = $menu->getItem(JRequest::getVar('Itemid'));
}
$id = 0;
if (is_object($item)) { // valid item retrieved
@ -540,4 +534,4 @@ final class JSite extends JApplication
$this->_detect_browser=$state;
return $old;
}
}
}

View File

@ -307,7 +307,7 @@ class JRouterSite extends JRouter
if (isset($query['Itemid']) && !empty($query['Itemid'])) {
$item = $menu->getItem($query['Itemid']);
if (is_object($item) && $query['option'] == $item->component) {
if (!$item->home) {
if (!$item->home || $item->language!='*') {
$tmp = !empty($tmp) ? $item->route.'/'.$tmp : $item->route;
}
$built = true;
@ -321,7 +321,9 @@ class JRouterSite extends JRouter
$route .= '/'.$tmp;
// Unset unneeded query information
unset($query['Itemid']);
if (isset($item) && $query['option'] == $item->component) {
unset($query['Itemid']);
}
unset($query['option']);
//Set query again in the URI
@ -417,4 +419,4 @@ class JRouterSite extends JRouter
return $uri;
}
}
}

View File

@ -32,6 +32,7 @@ $ -> Language fix or change
# Fixed issue [#20788] Error when saving template style for administrator template.
02-June-2010 Christophe Demko
# Fixed issue [#20783] A lot of issues related to searching and language switcher
# Fixed issue [#12757] JDate override problem in Backend
# Fixed issue [#20784] Some minours errors in the beez* templates

View File

@ -467,8 +467,8 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`
(415, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, '', '{}', '', '', 0, '0000-00-00 00:00:00', 3, 0),
(416, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, '', '{}', '', '', 0, '0000-00-00 00:00:00', 4, 0),
(417, 'plg_search_categories', 'plugin', 'categories', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","search_content":"0","search_uncategorised":"0","search_archived":"0"}', '', '', 0, '0000-00-00 00:00:00', 2, 0),
(418, 'plg_search_contacts', 'plugin', 'contacts', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","search_content":"1","search_uncategorised":"0","search_archived":"0"}', '', '', 0, '0000-00-00 00:00:00', 4, 0),
(419, 'plg_search_content', 'plugin', 'content', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","search_content":"0","search_uncategorised":"0","search_archived":"0"}', '', '', 0, '0000-00-00 00:00:00', 5, 0),
(418, 'plg_search_contacts', 'plugin', 'contacts', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","search_content":"0","search_uncategorised":"0","search_archived":"0"}', '', '', 0, '0000-00-00 00:00:00', 4, 0),
(419, 'plg_search_content', 'plugin', 'content', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","search_content":"1","search_uncategorised":"0","search_archived":"0"}', '', '', 0, '0000-00-00 00:00:00', 5, 0),
(420, 'plg_search_newsfeeds', 'plugin', 'newsfeeds', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","search_content":"0","search_uncategorised":"0","search_archived":"0"}', '', '', 0, '0000-00-00 00:00:00', 3, 0),
(421, 'plg_search_weblinks', 'plugin', 'weblinks', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","search_content":"0","search_uncategorised":"0","search_archived":"0"}', '', '', 0, '0000-00-00 00:00:00', 1, 0),
(422, 'plg_system_cache', 'plugin', 'cache', 'system', 0, 0, 1, 0, '', '{"browsercache":"0","cachetime":"15"}', '', '', 0, '0000-00-00 00:00:00', 1, 0),

View File

@ -190,7 +190,7 @@ INSERT IGNORE INTO `#__categories` VALUES
(41, 147, 32, 16, 17, 4, 'sample-data-content/joomla/extensions/templates', 'com_content', 'Templates', 'templates', '', '<p>Templates give your site its look and feel. They determine layout, colors, type faces, graphics and other aspects of design that make your site unique. Your installation of Joomla comes prepackaged with three templates.</p>', 1, 0, '0000-00-00 00:00:00', 1, '{"target":"","image":""}', '', '', '{"page_title":"","author":"","robots":""}', 0, '2010-05-16 02:27:52', 0, '0000-00-00 00:00:00', 0, '*'),
(42, 151, 32, 18, 19, 4, 'sample-data-content/joomla/extensions/languages', 'com_content', 'Languages', 'languages', '', '\r\nJoomla! installs in English, but there are translations of the interfaces, sample data and help screens are available in dozens of languages.\r\nTranslation information\r\nIf there is no language pack available for your language, instructions are available for creating your own translation, which you can also contribute to the community by starting a translation team to create an accredited translation.\r\nTranslations are installed the the extensions manager in the site administrator and then managed using the language manager.\r\n\r\n', 1, 0, '0000-00-00 00:00:00', 1, '{"target":""}', '', '', '{"page_title":"","author":"","robots":""}', 0, '2010-04-30 19:44:04', 0, '0000-00-00 00:00:00', 0, '*'),
(43, 153, 32, 20, 21, 4, 'sample-data-content/joomla/extensions/plugins', 'com_content', 'Plugins', 'plugins', '', 'Plugins are small task oriented extensions that enhance the Joomla! framework.\r\nSome are associated with particular extensions and others, such as editors, are used across all of Joomla!. Most beginning users do not need to change any of the plugins that install with Joomla!.\r\n ', 1, 0, '0000-00-00 00:00:00', 1, '{"target":""}', '', '', '{"page_title":"","author":"","robots":""}', 0, '2010-04-30 19:43:02', 0, '0000-00-00 00:00:00', 0, '*'),
(44, 0, 20, 6, 7, 2, 'sample-data-weblinks/parks-links', 'com_weblinks', 'Parks Links', 'parks-links', '', '<p>Here are links to some of my favorite parks.</p>', 1, 0, '0000-00-00 00:00:00', 1, '{"target":"","image":""}', '', '', '{"page_title":"","author":"","robots":""}', 0, '2010-01-24 11:23:53', 0, '0000-00-00 00:00:00', 0, '*'),
(44, 0, 20, 6, 7, 2, 'sample-data-weblinks/parks-links', 'com_weblinks', 'Parks Links', 'parks-links', '', '<p>Here are links to some of my favorite parks.</p>', 1, 0, '0000-00-00 00:00:00', 1, '{"target":"","image":""}', '', '', '{"page_title":"","author":"","robots":""}', 0, '2010-01-24 11:23:53', 0, '0000-00-00 00:00:00', 0, 'en-GB'),
(45, 55, 26, 54, 55, 2, 'contacts/parks-site', 'com_contact', 'Parks Site', 'parks-site', '', '', 1, 0, '0000-00-00 00:00:00', 1, '{"target":"","image":""}', '', '', '{"page_title":"","author":"","robots":""}', 0, '2010-05-12 21:19:28', 0, '0000-00-00 00:00:00', 0, '*'),
(46, 0, 26, 56, 111, 2, 'contacts/shop-site', 'com_contact', 'Shop Site', 'shop-site', '', '', 1, 0, '0000-00-00 00:00:00', 1, '{"target":"","image":""}', '', '', '{"page_title":"","author":"","robots":""}', 0, '2010-05-12 21:19:28', 0, '0000-00-00 00:00:00', 0, '*'),
(47, 56, 46, 57, 58, 3, 'contacts/shop-site/staff', 'com_contact', 'Staff', 'staff', '', '', 1, 0, '0000-00-00 00:00:00', 1, '{"target":"","image":""}', '', '', '{"page_title":"","author":"","robots":""}', 0, '2010-05-12 21:19:28', 0, '0000-00-00 00:00:00', 0, '*'),
@ -251,14 +251,14 @@ INSERT IGNORE INTO `#__contact_details` VALUES
INSERT IGNORE INTO `#__content` VALUES
(1, 27, 'Joomla!', 'joomla', '', '<p>Congratulations, You have a Joomla! site! Joomla! makes your site easy to build a website just the way you want it and keep it simple to update and maintain. Joomla! is a flexible and powerful platform, whether you are building a small site for yourself or a huge site with hundreds of thousands of visitors. Joomla is open source, which means you can make it work just the way you want it to.</p>', '', 1, 1, 0, 0, '2008-08-12 10:00:00', 42, 'Joomla!', '2010-05-26 23:51:11', 42, 0, '0000-00-00 00:00:00', '2006-01-03 01:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":""}', 36, 0, 1, '', '', 1, 121, '{"robots":"","author":""}', 1, '*', ''),
(87, 162, 'Language Switcher', 'language-switcher', '', '<p>The language switcher module allows you to take advantage of the language tags that are available when content and menu links are created.</p>\r\n<p>{loadposition languageswitcherload}</p>', '', 1, 0, 0, 40, '2010-05-15 09:39:34', 42, '', '2010-05-17 09:23:50', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":""}', 2, 0, 27, '', '', 1, 2, '', 0, '*', ''),
(2, 33, 'Great Barrier Reef', 'great-barrier-reef', '', '<p>The Great Barrier Reef is the largest coral reef system composed of over 2,900 individual reefs[3] and 900 islands stretching for over 3,000 kilometres (1,600 mi) over an area of approximately 344,400 square kilometres (133,000 sq mi). The reef is located in the Coral Sea, off the coast of Queensland in northeast Australia.</p><p>http://en.wikipedia.org/wiki/Great_Barrier_Reef</p>', '<p>The Great Barrier Reef can be seen from outer space and is the world''s biggest single structure made by living organisms. This reef structure is composed of and built by billions of tiny organisms, known as coral polyps. The Great Barrier Reef supports a wide diversity of life, and was selected as a World Heritage Site in 1981.CNN has labelled it one of the 7 natural wonders of the world. The Queensland National Trust has named it a state icon of Queensland.</p><p>A large part of the reef is protected by the Great Barrier Reef Marine Park, which helps to limit the impact of human use, such as overfishing and tourism. Other environmental pressures to the reef and its ecosystem include water quality from runoff, climate change accompanied by mass coral bleaching, and cyclic outbreaks of the crown-of-thorns starfish.</p><p>The Great Barrier Reef has long been known to and utilised by the Aboriginal Australian and Torres Strait Islander peoples, and is an important part of local groups'' cultures and spirituality. The reef is a very popular destination for tourists, especially in the Whitsundays and Cairns regions. Tourism is also an important economic activity for the region. Fishing also occurs in the region, generating AU$ 1 billion per year.</p>', 1, 0, 0, 24, '2009-06-22 11:07:08', 42, '', '2010-04-25 21:48:59', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","article-allow_ratings":"","article-allow_comments":"","show_author":"","show_create_date":"","show_modify_date":"","show_print_icon":"","show_email_icon":"","readmore":"","page_title":"","layout":""}', 1, 0, 1, '', '', 1, 3, '{"robots":"","author":""}', 0, '*', ''),
(2, 33, 'Great Barrier Reef', 'great-barrier-reef', '', '<p>The Great Barrier Reef is the largest coral reef system composed of over 2,900 individual reefs[3] and 900 islands stretching for over 3,000 kilometres (1,600 mi) over an area of approximately 344,400 square kilometres (133,000 sq mi). The reef is located in the Coral Sea, off the coast of Queensland in northeast Australia.</p><p>http://en.wikipedia.org/wiki/Great_Barrier_Reef</p>', '<p>The Great Barrier Reef can be seen from outer space and is the world''s biggest single structure made by living organisms. This reef structure is composed of and built by billions of tiny organisms, known as coral polyps. The Great Barrier Reef supports a wide diversity of life, and was selected as a World Heritage Site in 1981.CNN has labelled it one of the 7 natural wonders of the world. The Queensland National Trust has named it a state icon of Queensland.</p><p>A large part of the reef is protected by the Great Barrier Reef Marine Park, which helps to limit the impact of human use, such as overfishing and tourism. Other environmental pressures to the reef and its ecosystem include water quality from runoff, climate change accompanied by mass coral bleaching, and cyclic outbreaks of the crown-of-thorns starfish.</p><p>The Great Barrier Reef has long been known to and utilised by the Aboriginal Australian and Torres Strait Islander peoples, and is an important part of local groups'' cultures and spirituality. The reef is a very popular destination for tourists, especially in the Whitsundays and Cairns regions. Tourism is also an important economic activity for the region. Fishing also occurs in the region, generating AU$ 1 billion per year.</p>', 1, 0, 0, 24, '2009-06-22 11:07:08', 42, '', '2010-04-25 21:48:59', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","article-allow_ratings":"","article-allow_comments":"","show_author":"","show_create_date":"","show_modify_date":"","show_print_icon":"","show_email_icon":"","readmore":"","page_title":"","layout":""}', 1, 0, 1, '', '', 1, 3, '{"robots":"","author":""}', 0, 'en-GB', ''),
(3, 34, 'Cradle Mountain-Lake St Clair National Park', 'cradle-mountain-lake-st-clair-national-park', '', '<p>Cradle Mountain-Lake St Clair National Park is located in the Central Highlands area of Tasmania (Australia), 165 km northwest of Hobart. The park contains many walking trails, and is where hikes along the well-known Overland Track usually begins. Major features are Cradle Mountain and Barn Bluff in the northern end, Mount Pelion East, Mount Pelion West, Mount Oakleigh and Mount Ossa in the middle and Lake St Clair in the southern end of the park. The park is part of the Tasmanian Wilderness World Heritage Area.</p><p>http://en.wikipedia.org/wiki/Cradle_Mountain-Lake_St_Clair_National_Park</p>', '<h3>Access and usage fee</h3><p>Access from the south (Lake St. Clair) is usually from Derwent Bridge on the Lyell Highway. Northern access (Cradle Valley) is usually via Sheffield, Wilmot or Mole Creek. A less frequently used entrance is via the Arm River Track, from the east.</p><p>In 2005, the Tasmanian Parks & Wildlife Service introduced a booking system & fee for use of the Overland Track over peak periods. Initially the fee was 100 Australian dollars, but this was raised to 150 Australian dollars in 2007. The money that is collected is used to finance the park ranger organisation, track maintenance, building of new facilities and rental of helicopter transport to remove waste from the toilets at the huts in the park.</p>', 1, 0, 0, 25, '2009-06-22 11:17:24', 42, '', '2010-04-25 21:48:58', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","article-allow_ratings":"","article-allow_comments":"","show_author":"","show_create_date":"","show_modify_date":"","show_print_icon":"","show_email_icon":"","readmore":"","page_title":"","layout":""}', 1, 0, 1, '', '', 1, 0, '{"robots":"","author":""}', 0, '*', ''),
(4, 127, 'Joomla! Beginners', 'joomla-beginners', '', '<p>If this is your first Joomla site or your first web site, you have come to the right place. Joomla will help you get your website up and running quickly and easily.</p>\r\n', '\r\n<p>Start off using your site by logging in using the administrator account you created when you installed. Explore the articles and other resources right here on your site data to learn more about how Joomla works.(When you''re done reading, you can delete or archive all of this.) You will also probably want to visit the beginners'' areas of the <a href="http://docs.joomla.org">Joomla documentation</a> and <a href="http://forum.joomla.org">support forums</a>.</p>\r\n<p>You''ll also want to sign up for the Joomla Security Mailing list and the Announcements mailing list. For inspiration visit the Joomla Site Showcase to see an amazing array of ways people use Joomla to tell their stories on the web.</p>\r\n<p>The basic Joomla! installation will let you get a great site up and running, but when you are ready for more features the power of Joomla! is in the creative ways that developers have extended it to do all kinds of things. Visit the Joomla! Extensions Directory to see thousands of extensions that can do almost anything you could want on a website. Can''t find what you need? You may want to find a Joomla professional on the Joomla! Resources Directory.</p>\r\n<p>Want to learn more? Consider attending a Joomla! Day or other event or joining a local Joomla! Users Group. Can''t find one near you? Start one yourself.</p>', 1, 0, 0, 31, '2010-01-10 01:30:47', 42, '', '2010-05-26 23:51:11', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"1","link_titles":"0","show_intro":"","show_category":"0","link_category":"0","show_parent_category":"","link_parent_category":"","show_author":"0","show_create_date":"0","show_modify_date":"0","show_publish_date":"0","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":""}', 12, 0, 5, '', '', 1, 12, '{"robots":"","author":""}', 1, '*', ''),
(5, 128, 'Upgraders', 'upgraders', '', '<p>If you are an experienced Joomla! 1.5 user, 1.6 will seem very familiar. There are new templates and improved user interfaces, but most functionality is the same. The biggest changes are improved access control (ACL) and nested categories.</p>\r\n', '\r\n<p><br /> The new user manager which will let you manage who has access to what in your site. You can leave access groups exactly the way you had them in Joomla 1.5 or make them as complicated as you want. You can learn more about how access control works [in this article] and on the [Joomla Documentation site].<br /> <br /> In Joomla 1.5 and 1.0 content was organized into sections and categories. In 1.6 sections are gone, and you can create categories within categories, going as deep as you want. You can learn more about how categories work in 1.6 [in this article] and [on the Joomla Documentation site].<br /> <br /> All layouts have been redesigned to improve accessibility and flexibility. If you would like to keep the 1.5 layouts, you can find them in the html folder of the MilkyWay template. Simply copy the layouts you want to the html folder of your template.<br /> <br /> Updating your site and extensions when needed is easier than ever thanks to installer improvements.<br /> <br /> To learn more about how to move a Joomla 1.5 site to a Joomla 1.6 installation [read this].</p>', 1, 0, 0, 31, '2010-01-10 01:33:34', 42, '', '2010-05-26 23:51:11', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"1","link_titles":"0","show_intro":"","show_category":"0","link_category":"0","show_parent_category":"","link_parent_category":"","show_author":"0","show_create_date":"0","show_modify_date":"0","show_publish_date":"0","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":""}', 3, 0, 4, '', '', 1, 6, '{"robots":"","author":""}', 1, '*', ''),
(6, 114, 'Professionals', 'professionals', '', '<p>Joomla! 1.6 continues development of the Joomla Framework and CMS as a powerful and flexible way to bring your vision of the web to reality. With the administrator now fully MVC, the ability to control its look and the management of extensions is now complete.</p>\r\n', '\r\n<p> </p>\r\n<p>Languages files can now be overridden and working with multiple templates and overrides for the same views, creating the design you want is easier than it has ever been. Limiting support to PHP 5.x and above and ending legacy support for Joomla 1.0 makes Joomla lighter and faster than ever.</p>\r\n<p>Access control lists are now incorporated using a new system developed for Joomla. The ACL system is designed with developers in mind, so it is easy to incorporate into your extensions. The new nested sets libraries allow you to incorporate infinitely deep categories but also to use nested sets in a variety of other ways.</p>\r\n<p>A new forms library makes creating all kinds of user interaction simple. MooTools 1.2 provides a highly flexible javascript framework that is a major advance over MooTools 1.0.</p>\r\n<p><br /> New events throughout the core make integration of your plugins where you want them a snap.</p>\r\n<p>Learn about:</p>\r\n<ul>\r\n<li> [working with ACL] </li>\r\n<li> [working with nested sets] </li>\r\n<li> [integrating comments]</li>\r\n<li> [using the forms library] </li>\r\n<li> [working with Mootools 1.2] </li>\r\n<li> [using the override system] </li>\r\n<li> [Joomla! API]</li>\r\n<li> [Database] </li>\r\n<li> [Triggers] </li>\r\n<li> [Xmlrpc] </li>\r\n<li> [Installing and updating extensions]</li>\r\n<li>[Setting up your development environment]</li>\r\n</ul>', 1, 0, 0, 31, '2010-01-10 01:37:46', 42, '', '2010-05-26 23:51:11', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"1","link_titles":"","show_intro":"","show_category":"0","link_category":"0","show_parent_category":"","link_parent_category":"","show_author":"0","show_create_date":"0","show_modify_date":"0","show_publish_date":"0","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":"","article-allow_ratings":"","article-allow_comments":""}', 7, 0, 3, '', '', 1, 9, '{"robots":"","author":"","rights":""}', 1, '*', ''),
(7, 59, 'Sample Sites', 'sample-sites', '', '<p>Your installation includes sample data, designed to show you some of the options you have for building your website. In addition to information about Joomla! there are two sample "sites within a site" designed to help you get started with builidng your own site.</p>\r\n<p>The first site is a simple site about <a href="index.php?option=com_content&view=article&catid=23&id=9">Australian Parks</a>. It shows you you an quickly and easily build a personal site with just the building blocks that are part of Joomla!. It includes a personal blog, weblinks, and a very simple image gallery.</p>\r\n<p>The second site is slightly more complex and represents what you might do if you are building a site for a small business, in this case a <a href="index.php/welcome.html"><a href="index.php?option=com_content&view=article&catid=75&id=79">Fruit Shop</a></a>.</p>\r\n<p>In building either style site, or something completely different, you will probably want to add <a href="http://extensions.joomla.org">extensions</a> and either create or purchase your own template. Many Joomla! users start off by modifying the <a href="http://docs.joomla.org/How_do_you_modify_a_template%3F">templates</a> that come with the core distribution so that they include special images and other design elements that relate to their site''s focus.</p>', '', 1, 0, 0, 31, '2010-01-10 01:59:13', 42, '', '2010-05-13 02:58:04', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":""}', 9, 0, 6, '', '', 1, 114, '{"robots":"","author":""}', 0, '*', ''),
(8, 121, 'Components', 'components', '', '<p>Components are larger extensions that produce the major content for your site. Each component has one or more "views" that control how content is displayed.</p><p>', '<p>In the Joomla! administrator there are additional extensions suce as Menus, Redirection, and the extension managers.</p>', 1, 0, 0, 32, '2010-01-10 02:07:38', 42, '', '2010-05-01 01:24:30', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":"","article-allow_ratings":"","article-allow_comments":""}', 2, 0, 1, '', '', 1, 38, '{"robots":"","author":""}', 0, '*', ''),
(9, 51, 'Australian Parks', 'australian-parks', '', '<p>Welcome!</p>\r\n<p>This is a basic site about the beautiful and fascinating parks of Australia.</p>\r\n<p>On this site you can read all about my travels to different parks, see photos, and find links to park websites.</p>\r\n<p>.</p>', '', 1, 0, 0, 23, '2010-01-10 05:41:55', 42, 'Park Fan', '2010-05-29 16:13:14', 42, 0, '0000-00-00 00:00:00', '2010-05-29 16:13:14', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":""}', 4, 0, 1, '', '', 1, 50, '{"robots":"","author":""}', 0, '*', ''),
(9, 51, 'Australian Parks', 'australian-parks', '', '<p>Welcome!</p>\r\n<p>This is a basic site about the beautiful and fascinating parks of Australia.</p>\r\n<p>On this site you can read all about my travels to different parks, see photos, and find links to park websites.</p>\r\n<p>.</p>', '', 1, 0, 0, 23, '2010-01-10 05:41:55', 42, 'Park Fan', '2010-05-29 16:13:14', 42, 0, '0000-00-00 00:00:00', '2010-05-29 16:13:14', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":""}', 4, 0, 1, '', '', 1, 50, '{"robots":"","author":""}', 0, 'en-GB', ''),
(10, 123, 'Content', 'content', '', '<p>The content component (com_content) is what you use to write articles. It is extremely flexible and has the largest number of built in views.</p>', '', 1, 0, 0, 39, '2010-01-10 12:50:35', 42, 'Joomla!', '2010-04-30 22:38:03', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":"","article-allow_ratings":"","article-allow_comments":""}', 3, 0, 1, '', '', 1, 20, '{"robots":"","author":""}', 0, '*', ''),
(11, 130, 'Weblinks', 'weblinks', '', '<p>Weblinks (com_weblinks) is a component that provides a structured way to organize external links and present them in a visually attractive, consistent and informative way.</p>', '', 1, 0, 0, 39, '2010-01-10 12:58:33', 42, '', '2010-04-26 05:19:12', 43, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":"","article-allow_ratings":"","article-allow_comments":""}', 3, 0, 2, '', '', 1, 15, '{"robots":"","author":""}', 0, '*', ''),
(12, 131, 'News Feeds', 'news-feeds', '', '<p>News Feeds (com_newsfeeds) provides a way to organize and present news feeds. News feeds are a way that you present information from another site on your site. For example, the joomla.org website has numerous feeds that you an incorporate on your site. You an use menus to present a single feed, a list of feeds in a category, or or a list of all feed categories.</p>', '', 1, 0, 0, 39, '2010-01-10 13:08:52', 42, 'Joomla!', '2010-04-30 22:38:36', 42, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_readmore":"","show_print_icon":"","show_email_icon":"","show_hits":"","page_title":"","alternative_readmore":"","layout":"","article-allow_ratings":"","article-allow_comments":""}', 5, 0, 3, '', '', 1, 45, '{"robots":"","author":""}', 0, '*', ''),
@ -927,6 +927,6 @@ INSERT IGNORE INTO `#__weblinks` VALUES
(4, 20, 0, 'OpenSourceMatters', 'opensourcematters', 'http://www.opensourcematters.org', 'Home of OSM', '2005-02-14 15:19:02', 11, 1, 0, '0000-00-00 00:00:00', 2, 0, 1, 1, '{"target":"0"}', 'en-GB', '0000-00-00 00:00:00', 0, '', '0000-00-00 00:00:00', 0, '', '', '', 0, '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(5, 21, 0, 'Joomla! - Forums', 'joomla-forums', 'http://forum.joomla.org', 'Joomla! Forums', '2005-02-14 15:19:02', 4, 1, 0, '0000-00-00 00:00:00', 4, 0, 1, 1, '{"target":"0"}', 'en-GB', '0000-00-00 00:00:00', 0, '', '0000-00-00 00:00:00', 0, '', '', '', 0, '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(6, 21, 0, 'Ohloh Tracking of Joomla!', 'ohloh-tracking-of-joomla', 'http://www.ohloh.net/projects/20', 'Objective reports from Ohloh about Joomla''s development activity. Joomla! has some star developers with serious kudos.', '2007-07-19 09:28:31', 1, 1, 0, '0000-00-00 00:00:00', 6, 0, 1, 1, '{"target":"0"}', 'en-GB', '0000-00-00 00:00:00', 0, '', '0000-00-00 00:00:00', 0, '', '', '', 0, '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(7, 44, 0, 'Baw Baw National Park', 'baw-baw-national-park', 'http://www.parkweb.vic.gov.au/1park_display.cfm?park=44', 'Park of the Austalian Alps National Parks system, Baw Baw  features sub alpine vegetation, beautiful views, and opportunities for hiking, skiing and other outdoor activities.', '0000-00-00 00:00:00', 0, 1, 0, '0000-00-00 00:00:00', 7, 0, 1, 1, '{"target":"0"}', '*', '0000-00-00 00:00:00', 0, '', '0000-00-00 00:00:00', 0, '', '', '', 0, '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(8, 44, 0, 'Kakadu', 'kakadu', 'http://www.environment.gov.au/parks/kakadu/index.html', 'Kakadu is known for both its cultural heritage and its natural features. It is one of a small number of places listed as World Heritage Places for both reasons. Extensive rock art is found there.', '0000-00-00 00:00:00', 0, 1, 0, '0000-00-00 00:00:00', 8, 0, 1, 1, '{"target":"0"}', '*', '0000-00-00 00:00:00', 0, '', '0000-00-00 00:00:00', 0, '', '', '', 0, '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(9, 44, 0, 'Pulu Keeling', 'pulu-keeling', 'http://www.environment.gov.au/parks/cocos/index.html', 'Located on an atoll 2000 kilometers north of Perth, Pulu Keeling is Australia''s smallest national park.', '0000-00-00 00:00:00', 0, 1, 0, '0000-00-00 00:00:00', 9, 0, 1, 1, '{"target":"0"}', '*', '0000-00-00 00:00:00', 0, '', '0000-00-00 00:00:00', 0, '', '', '', 0, '', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
(7, 44, 0, 'Baw Baw National Park', 'baw-baw-national-park', 'http://www.parkweb.vic.gov.au/1park_display.cfm?park=44', 'Park of the Austalian Alps National Parks system, Baw Baw  features sub alpine vegetation, beautiful views, and opportunities for hiking, skiing and other outdoor activities.', '0000-00-00 00:00:00', 0, 1, 0, '0000-00-00 00:00:00', 7, 0, 1, 1, '{"target":"0"}', 'en-GB', '0000-00-00 00:00:00', 0, '', '0000-00-00 00:00:00', 0, '', '', '', 0, '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(8, 44, 0, 'Kakadu', 'kakadu', 'http://www.environment.gov.au/parks/kakadu/index.html', 'Kakadu is known for both its cultural heritage and its natural features. It is one of a small number of places listed as World Heritage Places for both reasons. Extensive rock art is found there.', '0000-00-00 00:00:00', 0, 1, 0, '0000-00-00 00:00:00', 8, 0, 1, 1, '{"target":"0"}', 'en-GB', '0000-00-00 00:00:00', 0, '', '0000-00-00 00:00:00', 0, '', '', '', 0, '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(9, 44, 0, 'Pulu Keeling', 'pulu-keeling', 'http://www.environment.gov.au/parks/cocos/index.html', 'Located on an atoll 2000 kilometers north of Perth, Pulu Keeling is Australia''s smallest national park.', '0000-00-00 00:00:00', 0, 1, 0, '0000-00-00 00:00:00', 9, 0, 1, 1, '{"target":"0"}', 'en-GB', '0000-00-00 00:00:00', 0, '', '0000-00-00 00:00:00', 0, '', '', '', 0, '', '0000-00-00 00:00:00', '0000-00-00 00:00:00');

View File

@ -10,7 +10,7 @@
// no direct access
defined('_JEXEC') or die;
?>
<form action="index.php" method="post">
<form action="<?php echo JRoute::_('index.php');?>" method="post">
<div class="search<?php echo $params->get('moduleclass_sfx') ?>">
<?php
$output = '<label for="mod_search_searchword">'.JText::_('MOD_SEARCH_FIELD_TEXT_LABEL').'</label><input name="searchword" id="mod_search_searchword" maxlength="'.$maxlength.'" class="inputbox'.$moduleclass_sfx.'" type="text" size="'.$width.'" value="'.$text.'" onblur="if (this.value==\'\') this.value=\''.$text.'\';" onfocus="if (this.value==\''.$text.'\') this.value=\'\';" />';
@ -50,4 +50,4 @@ defined('_JEXEC') or die;
<input type="hidden" name="task" value="search" />
<input type="hidden" name="option" value="com_search" />
<input type="hidden" name="Itemid" value="<?php echo $mitemid; ?>" />
</form>
</form>

View File

@ -48,6 +48,7 @@ class plgSearchCategories extends JPlugin
{
$db = &JFactory::getDbo();
$user = &JFactory::getUser();
$app = &JFactory::getApplication();
$groups = implode(',', $user->authorisedLevels());
$searchText = $text;
@ -57,7 +58,17 @@ class plgSearchCategories extends JPlugin
}
}
$limit = $this->params->def('search_limit', 50);
$sContent = $this->params->get('search_content', 1);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$state = array();
if ($sContent) {
$state[]=1;
}
if ($sArchived) {
$state[]=2;
}
$text = trim($text);
if ($text == '') {
@ -80,30 +91,37 @@ class plgSearchCategories extends JPlugin
$text = $db->Quote('%'.$db->getEscaped($text, true).'%', false);
$query = $db->getQuery(true);
$query->select('a.title, a.description AS text, "" AS created, "2" AS browsernav, a.id AS catid, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug');
$query->from('#__categories AS a');
$query->where('(a.title LIKE '. $text .' OR a.description LIKE '. $text .') AND a.published = 1 AND a.extension = \'com_content\''
.'AND a.access IN ('. $groups .')' );
$query->group('a.id');
$query->order($order);
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
$count = count($rows);
for ($i = 0; $i < $count; $i++) {
$rows[$i]->href = ContentHelperRoute::getCategoryRoute($rows[$i]->slug);
$rows[$i]->section = JText::_('JCATEGORY');
}
$return = array();
foreach($rows AS $key => $category) {
if (searchHelper::checkNoHTML($category, $searchText, array('name', 'title', 'text'))) {
$return[] = $category;
if (!empty($state)) {
$query->select('a.title, a.description AS text, "" AS created, "2" AS browsernav, a.id AS catid, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug');
$query->from('#__categories AS a');
$query->where('(a.title LIKE '. $text .' OR a.description LIKE '. $text .') AND a.published IN ('.implode(',',$state).') AND a.extension = \'com_content\''
.'AND a.access IN ('. $groups .')' );
$query->group('a.id');
$query->order($order);
if ($app->isSite() && $app->getLanguageFilter()) {
$query->where('a.language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
if ($rows) {
$count = count($rows);
for ($i = 0; $i < $count; $i++) {
$rows[$i]->href = ContentHelperRoute::getCategoryRoute($rows[$i]->slug);
$rows[$i]->section = JText::_('JCATEGORY');
}
$return = array();
foreach($rows AS $key => $category) {
if (searchHelper::checkNoHTML($category, $searchText, array('name', 'title', 'text'))) {
$return[] = $category;
}
}
}
}
return $return;
}
}
}

View File

@ -34,15 +34,6 @@
<option value="1">JON</option>
</field>
<field name="search_uncategorised" type="radio"
default="0"
description="JFIELD_PLG_SEARCH_UNCATEGORIZED_DESC"
label="JFIELD_PLG_SEARCH_UNCATEGORIZED_LABEL"
>
<option value="0">JOFF</option>
<option value="1">JON</option>
</field>
<field name="search_archived" type="radio"
default="0"
description="JFIELD_PLG_SEARCH_ARCHIVED_DESC"

View File

@ -53,7 +53,17 @@ class plgSearchContacts extends JPlugin
}
}
$limit = $this->params->def('search_limit', 50);
$sContent = $this->params->get('search_content', 1);
$sUncategorised = $this->params->get('search_uncategorised', 1);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$state = array();
if ($sContent) {
$state[]=1;
}
if ($sArchived) {
$state[]=2;
}
$text = trim($text);
if ($text == '') {
@ -80,34 +90,40 @@ class plgSearchContacts extends JPlugin
$text = $db->Quote('%'.$db->getEscaped($text, true).'%', false);
$query = $db->getQuery(true);
$query->select('a.name AS title, "" AS created, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
.'CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END AS catslug, '
.'CONCAT_WS(", ", a.name, a.con_position, a.misc) AS text, '
.'CONCAT_WS(" / ", '.$db->Quote($section).', c.title) AS section, "2" AS browsernav');
$query->from('#__contact_details AS a');
$query->innerJoin('#__categories AS c ON c.id = a.catid');
$query->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. ')' );
$query->group('a.id');
$query->order($order);
$rows = array();
if (!empty($state)) {
$query = $db->getQuery(true);
$query->select('a.name AS title, "" AS created, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
.'CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END AS catslug, '
.'CONCAT_WS(", ", a.name, a.con_position, a.misc) AS text, '
.'CONCAT_WS(" / ", '.$db->Quote($section).', c.title) AS section, "2" AS browsernav');
$query->from('#__contact_details AS a');
$query->innerJoin('#__categories AS c ON c.id = a.catid');
$query->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 IN ('.implode(',',$state).') AND c.published=1 '
.'AND a.access IN ('. $groups. ') AND c.access IN ('. $groups. ')' );
$query->group('a.id');
$query->order($order);
// Filter by language
if ($app->isSite() && $app->getLanguageFilter()) {
$query->where('a.language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')');
// Filter by language
if ($app->isSite() && $app->getLanguageFilter()) {
$tag = JFactory::getLanguage()->getTag();
$query->where('a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
$query->where('c.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
if ($rows) {
foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_contact&view=contact&id='.$row->slug.'&catid='.$row->catslug;
}
}
}
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_contact&view=contact&id='.$row->slug.'&catid='.$row->catslug;
}
return $rows;
}
}

View File

@ -48,6 +48,7 @@ class plgSearchContent extends JPlugin
$app = &JFactory::getApplication();
$user = &JFactory::getUser();
$groups = implode(',', $user->authorisedLevels());
$tag = JFactory::getLanguage()->getTag();
require_once JPATH_SITE.'/components/com_content/helpers/route.php';
require_once JPATH_SITE.'/administrator/components/com_search/helpers/search.php';
@ -153,7 +154,8 @@ class plgSearchContent extends JPlugin
// Filter by language
if ($app->isSite() && $app->getLanguageFilter()) {
$query->where('a.language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')');
$query->where('a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
$query->where('c.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
@ -186,7 +188,8 @@ class plgSearchContent extends JPlugin
// Filter by language
if ($app->isSite() && $app->getLanguageFilter()) {
$query->where('a.language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')');
$query->where('a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
$query->where('c.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
@ -217,7 +220,7 @@ class plgSearchContent extends JPlugin
.'CONCAT_WS("/", c.title) AS section, "2" AS browsernav' );
$query->from('#__content AS a');
$query->innerJoin('#__categories AS c ON c.id=a.catid AND c.access IN ('. $groups .')');
$query->where('('. $where .') AND a.state = -1 AND c.published = 1 AND a.access IN ('. $groups
$query->where('('. $where .') AND a.state = 2 AND c.published = 1 AND a.access IN ('. $groups
.') AND c.access IN ('. $groups .') '
.'AND (a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).') '
.'AND (a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).')' );
@ -226,7 +229,8 @@ class plgSearchContent extends JPlugin
// Filter by language
if ($app->isSite() && $app->getLanguageFilter()) {
$query->where('a.language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')');
$query->where('a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
$query->where('c.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
}
$db->setQuery($query, 0, $limit);

View File

@ -54,7 +54,17 @@ class plgSearchNewsfeeds extends JPlugin
}
}
$limit = $this->params->def('search_limit', 50);
$sContent = $this->params->get('search_content', 1);
$sUncategorised = $this->params->get('search_uncategorised', 1);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$state = array();
if ($sContent) {
$state[]=1;
}
if ($sArchived) {
$state[]=2;
}
$text = trim($text);
if ($text == '') {
@ -106,29 +116,35 @@ class plgSearchNewsfeeds extends JPlugin
$searchNewsfeeds = JText::_('PLG_SEARCH_NEWSFEEDS_NEWSFEEDS');
$query = $db->getQuery(true);
$query->select('a.name AS title, "" AS created, a.link AS text, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
.'CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug, '
.'CONCAT_WS(" / ", '. $db->Quote($searchNewsfeeds) .', c.title) AS section,'
.'"1" AS browsernav');
$query->from('#__newsfeeds AS a');
$query->innerJoin('#__categories as c ON c.id = a.catid');
$query->where('('. $where .')' . 'AND a.published = 1 AND c.published = 1 AND c.access IN ('. $groups .')');
$query->order($order);
$rows = array();
if (!empty($state)) {
$query = $db->getQuery(true);
$query->select('a.name AS title, "" AS created, a.link AS text, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
.'CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug, '
.'CONCAT_WS(" / ", '. $db->Quote($searchNewsfeeds) .', c.title) AS section,'
.'"1" AS browsernav');
$query->from('#__newsfeeds AS a');
$query->innerJoin('#__categories as c ON c.id = a.catid');
$query->where('('. $where .')' . 'AND a.published IN ('.implode(',',$state).') AND c.published = 1 AND c.access IN ('. $groups .')');
$query->order($order);
// Filter by language
if ($app->isSite() && $app->getLanguageFilter()) {
$query->where('a.language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')');
// Filter by language
if ($app->isSite() && $app->getLanguageFilter()) {
$tag = JFactory::getLanguage()->getTag();
$query->where('a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
$query->where('c.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
if ($rows) {
foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_newsfeeds&view=newsfeed&catid='.$row->catslug.'&id='.$row->slug;
}
}
}
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_newsfeeds&view=newsfeed&catid='.$row->catslug.'&id='.$row->slug;
}
return $rows;
}
}

View File

@ -57,7 +57,17 @@ class plgSearchWeblinks extends JPlugin
}
}
$limit = $this->params->def('search_limit', 50);
$sContent = $this->params->get('search_content', 1);
$sUncategorised = $this->params->get('search_uncategorised', 1);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$state = array();
if ($sContent) {
$state[]=1;
}
if ($sArchived) {
$state[]=2;
}
$text = trim($text);
if ($text == '') {
@ -118,35 +128,41 @@ class plgSearchWeblinks extends JPlugin
$order = 'a.date DESC';
}
$query = $db->getQuery(true);
$query->select('a.title AS title, a.description AS text, a.date AS created, a.url, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
.'CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug, '
.'CONCAT_WS(" / ", '.$db->Quote($section).', c.title) AS section, "1" AS browsernav');
$query->from('#__weblinks AS a');
$query->innerJoin('#__categories AS c ON c.id = a.catid');
$query->where('('.$where.')' . ' AND a.state=1 AND c.published=1 AND c.access IN ('.$groups.')');
$query->order($order);
// Filter by language
if ($app->isSite() && $app->getLanguageFilter()) {
$query->where('a.language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = WeblinksHelperRoute::getWeblinkRoute($row->slug, $row->catslug);
}
$return = array();
foreach($rows AS $key => $weblink) {
if (searchHelper::checkNoHTML($weblink, $searchText, array('url', 'text', 'title'))) {
$return[] = $weblink;
if (!empty($state)) {
$query = $db->getQuery(true);
$query->select('a.title AS title, a.description AS text, a.date AS created, a.url, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
.'CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug, '
.'CONCAT_WS(" / ", '.$db->Quote($section).', c.title) AS section, "1" AS browsernav');
$query->from('#__weblinks AS a');
$query->innerJoin('#__categories AS c ON c.id = a.catid');
$query->where('('.$where.')' . ' AND a.state in ('.implode(',',$state).') AND c.published=1 AND c.access IN ('.$groups.')');
$query->order($order);
// Filter by language
if ($app->isSite() && $app->getLanguageFilter()) {
$tag = JFactory::getLanguage()->getTag();
$query->where('a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
$query->where('c.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
$return = array();
if ($rows) {
foreach($rows as $key => $row) {
$rows[$key]->href = WeblinksHelperRoute::getWeblinkRoute($row->slug, $row->catslug);
}
foreach($rows AS $key => $weblink) {
if (searchHelper::checkNoHTML($weblink, $searchText, array('url', 'text', 'title'))) {
$return[] = $weblink;
}
}
}
}
return $return;
}
}

View File

@ -28,28 +28,55 @@ class plgSystemLanguageFilter extends JPlugin
public static $default_lang;
public static $default_sef;
public function onAfterInitialise()
public function __construct(&$subject, $config)
{
$app = JFactory::getApplication();
if ($app->isSite()) {
$app->setLanguageFilter(true);
$router = $app->getRouter();
$router = &$app->getRouter();
// setup language data
self::$mode_sef = ($router->getMode() == JROUTER_MODE_SEF) ? true : false;
self::$sefs = JLanguageHelper::getLanguages('sef');
self::$lang_codes = JLanguageHelper::getLanguages('lang_code');
self::$default_lang = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
self::$default_sef = self::$lang_codes[self::$default_lang]->sef;
$uri = &JFactory::getURI();
if (self::$mode_sef) {
$path = $uri->getPath();
$path = substr($path,strpos($path,'index.php'));
$parts = explode('/', $path);
$sef = isset($parts[1]) ? $parts[1] : '';
}
else {
$sef = $uri->getVar('lang');
}
if (isset(self::$sefs[$sef])) {
$lang_code = self::$sefs[$sef]->lang_code;
// Create a cookie
$conf =& JFactory::getConfig();
$cookie_domain = $conf->get('config.cookie_domain', '');
$cookie_path = $conf->get('config.cookie_path', '/');
setcookie(JUtility::getHash('language'), $lang_code, time() + 365 * 86400, $cookie_path, $cookie_domain);
// set the request var
JRequest::setVar('language',$lang_code);
}
}
parent::__construct($subject, $config);
}
public function onAfterInitialise()
{
$app = JFactory::getApplication();
if ($app->isSite()) {
self::$tag = JFactory::getLanguage()->getTag();
$router = &$app->getRouter();
// attach build rules for language SEF
$router->attachBuildRule(array($this, 'buildRule'));
// attach parse rules for language SEF
$router->attachParseRule(array($this, 'parseRule'));
// setup language data
self::$mode_sef = ($router->getMode() == JROUTER_MODE_SEF) ? true : false;
self::$tag = JFactory::getLanguage()->getTag();
self::$sefs = JLanguageHelper::getLanguages('sef');
self::$lang_codes = JLanguageHelper::getLanguages('lang_code');
// todo - not used?
self::$default_lang = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
self::$default_sef = self::$lang_codes[self::$default_lang]->sef;
}
}
@ -68,7 +95,7 @@ class plgSystemLanguageFilter extends JPlugin
if ($Itemid != 'absent') {
$menu =& JSite::getMenu()->getItem($Itemid);
// if no menu - that means that we are routing home menu item of none-current language or alias to home
if (!$menu || $menu->home) {
if (!$menu || $menu->home && $uri->getVar('option')!='com_search') {
$uri->delVar('option');
$uri->delVar('Itemid');
}
@ -96,27 +123,16 @@ class plgSystemLanguageFilter extends JPlugin
$sef = self::$default_sef;
}
$lang_code = self::$sefs[$sef]->lang_code;
if (!$lang_code || !JLanguage::exists($lang_code)) {
$lang_code = self::$default_lang;
}
else {
if ($lang_code && JLanguage::exists($lang_code)) {
array_shift($parts);
$uri->setPath(implode('/', $parts));
}
// Set the language
JFactory::getLanguage()->setLanguage($lang_code);
self::$tag = $lang_code;
// Create a cookie
$config =& JFactory::getConfig();
$cookie_domain = $config->get('config.cookie_domain', '');
$cookie_path = $config->get('config.cookie_path', '/');
setcookie(JUtility::getHash('language'), $lang_code, time() + 365 * 86400, $cookie_path, $cookie_domain);
$array = array('lang' => $sef);
}
else {
$sef = $uri->getVar('lang');
}
$array = array('lang' => $sef);
return $array;
}
}