添加到 trunk
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@159 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$mainframe->registerEvent( 'onSearch', 'plgSearchAttachments' );
|
||||
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchAttachmentAreas' );
|
||||
|
||||
JPlugin::loadLanguage( 'plg_search_attachments', JPATH_ADMINISTRATOR);
|
||||
|
||||
/**
|
||||
* @return array An array of search areas
|
||||
*/
|
||||
function &plgSearchAttachmentAreas() {
|
||||
static $areas = array(
|
||||
'attachments' => 'Attachments'
|
||||
);
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/* Attachment Search method
|
||||
*/
|
||||
function plgSearchAttachments( $text, $phrase='', $ordering='', $areas=null )
|
||||
{
|
||||
$db =& JFactory::getDBO();
|
||||
$user =& JFactory::getUser();
|
||||
|
||||
// Exit if the search does not include attachments
|
||||
if (is_array( $areas )) {
|
||||
if (!array_intersect( $areas, array_keys( plgSearchAttachmentAreas() ) )) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we have something to search for
|
||||
$text = trim( $text );
|
||||
if ($text == '') {
|
||||
return array();
|
||||
}
|
||||
|
||||
// load plugin params info
|
||||
$plugin =& JPluginHelper::getPlugin('search', 'attachments');
|
||||
$pluginParams = new JParameter( $plugin->params );
|
||||
$limit = $pluginParams->def( 'search_limit', 50 );
|
||||
|
||||
// Get the component parameters
|
||||
jimport('joomla.application.component.helper');
|
||||
$attachParams = JComponentHelper::getParams('com_attachments');
|
||||
$secure = $attachParams->get('secure', false);
|
||||
$user_field_1 = false;
|
||||
if ( strlen($attachParams->get('user_field_1_name', '')) > 0 ) {
|
||||
$user_field_1 = true;
|
||||
$user_field_1_name = $attachParams->get('user_field_1_name');
|
||||
}
|
||||
$user_field_2 = false;
|
||||
if ( strlen($attachParams->get('user_field_2_name', '')) > 0 ) {
|
||||
$user_field_2 = true;
|
||||
$user_field_2_name = $attachParams->get('user_field_2_name');
|
||||
}
|
||||
$user_field_3 = false;
|
||||
if ( strlen($attachParams->get('user_field_3_name', '')) > 0 ) {
|
||||
$user_field_3 = true;
|
||||
$user_field_3_name = $attachParams->get('user_field_3_name');
|
||||
}
|
||||
|
||||
$wheres = array();
|
||||
|
||||
switch ($phrase)
|
||||
{
|
||||
case 'exact':
|
||||
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
|
||||
$user_fields_sql = '';
|
||||
if ( $user_field_1 )
|
||||
$user_fields_sql .= " OR (LOWER(a.user_field_1) LIKE $text)";
|
||||
if ( $user_field_2 )
|
||||
$user_fields_sql .= " OR (LOWER(a.user_field_2) LIKE $text)";
|
||||
if ( $user_field_3 )
|
||||
$user_fields_sql .= " OR (LOWER(a.user_field_3) LIKE $text)";
|
||||
|
||||
$where = "((LOWER(a.filename) LIKE $text)" .
|
||||
" OR (LOWER(a.display_filename) LIKE $text)" .
|
||||
$user_fields_sql .
|
||||
" OR (LOWER(a.description) LIKE $text))";
|
||||
break;
|
||||
|
||||
default:
|
||||
$words = explode( ' ', $text );
|
||||
$wheres = array();
|
||||
foreach ($words as $word)
|
||||
{
|
||||
$word = $db->Quote( '%'.$db->getEscaped( $word, true ).'%', false );
|
||||
$wheres2 = array();
|
||||
$wheres2[] = "LOWER(a.filename) LIKE $word";
|
||||
$wheres2[] = "LOWER(a.display_filename) LIKE $word";
|
||||
if ( $user_field_1 )
|
||||
$wheres2[] = "LOWER(a.user_field_1) LIKE $word";
|
||||
if ( $user_field_2 )
|
||||
$wheres2[] = "LOWER(a.user_field_2) LIKE $word";
|
||||
if ( $user_field_3 )
|
||||
$wheres2[] = "LOWER(a.user_field_3) LIKE $word";
|
||||
$wheres2[] = "LOWER(a.description) LIKE $word";
|
||||
$wheres[] = implode( ' OR ', $wheres2 );
|
||||
}
|
||||
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
|
||||
break;
|
||||
}
|
||||
|
||||
// Set up the sorting
|
||||
switch ( $ordering )
|
||||
{
|
||||
case 'oldest':
|
||||
$order = 'a.create_date ASC';
|
||||
break;
|
||||
|
||||
case 'newest':
|
||||
$order = 'a.create_date DESC';
|
||||
break;
|
||||
|
||||
case 'alpha':
|
||||
default:
|
||||
$order = 'a.filename DESC';
|
||||
}
|
||||
|
||||
// Load the permissions functions
|
||||
require_once(JPATH_SITE.DS.'components'.DS.'com_attachments'.DS.'permissions.php');
|
||||
$user =& JFactory::getUser();
|
||||
|
||||
// Construct and execute the query
|
||||
$query = 'SELECT *, a.id as attachment_id, c.title as article_title'
|
||||
. ' FROM #__attachments AS a'
|
||||
. ' LEFT JOIN #__content as c ON a.article_id = c.id'
|
||||
. ' WHERE ('. $where .')'
|
||||
. ' AND a.published = 1'
|
||||
. ' ORDER BY '. $order;
|
||||
$db->setQuery( $query, 0, $limit );
|
||||
$rows = $db->loadObjectList();
|
||||
|
||||
$count = count( $rows );
|
||||
|
||||
$k = 0;
|
||||
$results = Array();
|
||||
|
||||
for ( $i = 0; $i < $count; $i++ ) {
|
||||
|
||||
// Do not add the attachment if the user may not access it
|
||||
if ( !AttachmentsPermissions::user_may_access_attachment($user, $rows[$i]->id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Construct the download URL if necessary
|
||||
if ( $secure ) {
|
||||
$rows[$i]->href = JRoute::_("index.php?option=com_attachments&task=download&id=".$rows[$i]->attachment_id);
|
||||
}
|
||||
else {
|
||||
$rows[$i]->href = $rows[$i]->url;
|
||||
}
|
||||
if ( $rows[$i]->display_filename && (strlen($rows[$i]->display_filename) > 0) ) {
|
||||
$rows[$i]->title = $rows[$i]->display_filename;
|
||||
}
|
||||
else {
|
||||
$rows[$i]->title = $rows[$i]->filename;
|
||||
}
|
||||
|
||||
// Set the text to the string containing the search target
|
||||
if ( strlen($rows[$i]->display_filename) > 0 ) {
|
||||
$text = $rows[$i]->display_filename .
|
||||
" (" . JText::_('FILENAME COLON') . " " . $rows[$i]->filename . ") ";
|
||||
}
|
||||
else {
|
||||
$text = JText::_('FILENAME COLON') . " " . $rows[$i]->filename;
|
||||
}
|
||||
|
||||
if ( strlen($rows[$i]->description) > 0 ) {
|
||||
$text .= " | " . JText::_('DESCRIPTION COLON') . $rows[$i]->description;
|
||||
}
|
||||
|
||||
if ( $user_field_1 && (strlen($rows[$i]->user_field_1) > 0) ) {
|
||||
$text .= " | " . $user_field_1_name . ": " . $rows[$i]->user_field_1;
|
||||
}
|
||||
if ( $user_field_2 && (strlen($rows[$i]->user_field_2) > 0) ) {
|
||||
$text .= " | " . $user_field_2_name . ": " . $rows[$i]->user_field_2;
|
||||
}
|
||||
if ( $user_field_3 && (strlen($rows[$i]->user_field_3) > 0) ) {
|
||||
$text .= " | " . $user_field_3_name . ": " . $rows[$i]->user_field_3;
|
||||
}
|
||||
$rows[$i]->text = $text;
|
||||
$rows[$i]->created = $rows[$i]->create_date;
|
||||
$rows[$i]->browsernav = 2;
|
||||
$rows[$i]->section = JText::_('ATTACHED TO ARTICLE').": ".$rows[$i]->article_title;
|
||||
|
||||
$results[$k] = $rows[$i];
|
||||
$k++;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE install SYSTEM "http://dev.joomla.org/xml/1.5/plugin-install.dtd">
|
||||
<install version="1.5" type="plugin" group="search">
|
||||
<name>Search - Attachments</name>
|
||||
<author>Paul McDermott (www.bluebellsupport.com), Jonathan Cameron</author>
|
||||
<creationDate>August 17, 2008</creationDate>
|
||||
<copyright>(C) 2007, 2008 Jonathan M. Cameron. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>http://joomlacode.org/gf/project/attachments/</authorUrl>
|
||||
<version>1.3.4</version>
|
||||
<description>ATTACHMENTS SEARCH INSTALLED</description>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.plg_search_attachments.ini</language>
|
||||
</languages>
|
||||
<files>
|
||||
<filename plugin="attachments">attachments.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="search_limit" type="text" size="5" default="50"
|
||||
label="SEARCH LIMIT" description="SEARCH LIMIT DESCRIPTION"/>
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: categories.php 10870 2008-08-30 07:26:29Z willebil $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$mainframe->registerEvent( 'onSearch', 'plgSearchCategories' );
|
||||
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchCategoryAreas' );
|
||||
|
||||
JPlugin::loadLanguage( 'plg_search_categories' );
|
||||
|
||||
/**
|
||||
* @return array An array of search areas
|
||||
*/
|
||||
function &plgSearchCategoryAreas()
|
||||
{
|
||||
static $areas = array(
|
||||
'categories' => 'Categories'
|
||||
);
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Categories Search method
|
||||
*
|
||||
* The sql must return the following fields that are
|
||||
* used in a common display routine: href, title, section, created, text,
|
||||
* browsernav
|
||||
* @param string Target search string
|
||||
* @param string mathcing option, exact|any|all
|
||||
* @param string ordering option, newest|oldest|popular|alpha|category
|
||||
* @param mixed An array if restricted to areas, null if search all
|
||||
*/
|
||||
function plgSearchCategories( $text, $phrase='', $ordering='', $areas=null )
|
||||
{
|
||||
$db =& JFactory::getDBO();
|
||||
$user =& JFactory::getUser();
|
||||
$searchText = $text;
|
||||
|
||||
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
|
||||
|
||||
if (is_array( $areas )) {
|
||||
if (!array_intersect( $areas, array_keys( plgSearchCategoryAreas() ) )) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
// load plugin params info
|
||||
$plugin =& JPluginHelper::getPlugin('search', 'categories');
|
||||
$pluginParams = new JParameter( $plugin->params );
|
||||
|
||||
$limit = $pluginParams->def( 'search_limit', 50 );
|
||||
|
||||
$text = trim( $text );
|
||||
if ( $text == '' ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
switch ( $ordering ) {
|
||||
case 'alpha':
|
||||
$order = 'a.name ASC';
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
case 'popular':
|
||||
case 'newest':
|
||||
case 'oldest':
|
||||
default:
|
||||
$order = 'a.name DESC';
|
||||
}
|
||||
|
||||
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
|
||||
$query = 'SELECT a.title, a.description AS text, "" AS created, a.name,'
|
||||
. ' "2" AS browsernav,'
|
||||
. ' s.id AS secid, a.id AS catid,'
|
||||
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug'
|
||||
. ' FROM #__categories AS a'
|
||||
. ' INNER JOIN #__sections AS s ON s.id = a.section'
|
||||
. ' WHERE ( a.name LIKE '.$text
|
||||
. ' OR a.title LIKE '.$text
|
||||
. ' OR a.description LIKE '.$text.' )'
|
||||
. ' AND a.published = 1'
|
||||
. ' AND s.published = 1'
|
||||
. ' AND a.access <= '.(int) $user->get('aid')
|
||||
. ' AND s.access <= '.(int) $user->get('aid')
|
||||
. ' GROUP BY a.id'
|
||||
. ' ORDER BY '. $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]->secid);
|
||||
$rows[$i]->section = JText::_( 'Category' );
|
||||
}
|
||||
|
||||
$return = array();
|
||||
foreach($rows AS $key => $category) {
|
||||
if(searchHelper::checkNoHTML($category, $searchText, array('name', 'title', 'text'))) {
|
||||
$return[] = $category;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install version="1.5" type="plugin" group="search">
|
||||
<name>Search - Categories</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>November 2005</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5</version>
|
||||
<description>Allows Searching of Categories information</description>
|
||||
<files>
|
||||
<filename plugin="categories">categories.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="search_limit" type="text" size="5" default="50" label="Search Limit" description="Number of Search items to return"/>
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: contacts.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$mainframe->registerEvent( 'onSearch', 'plgSearchContacts' );
|
||||
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchContactAreas' );
|
||||
|
||||
JPlugin::loadLanguage( 'plg_search_contacts' );
|
||||
|
||||
/**
|
||||
* @return array An array of search areas
|
||||
*/
|
||||
function &plgSearchContactAreas()
|
||||
{
|
||||
static $areas = array(
|
||||
'contacts' => 'Contacts'
|
||||
);
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contacts Search method
|
||||
*
|
||||
* The sql must return the following fields that are used in a common display
|
||||
* routine: href, title, section, created, text, browsernav
|
||||
* @param string Target search string
|
||||
* @param string mathcing option, exact|any|all
|
||||
* @param string ordering option, newest|oldest|popular|alpha|category
|
||||
*/
|
||||
function plgSearchContacts( $text, $phrase='', $ordering='', $areas=null )
|
||||
{
|
||||
$db =& JFactory::getDBO();
|
||||
$user =& JFactory::getUser();
|
||||
|
||||
if (is_array( $areas )) {
|
||||
if (!array_intersect( $areas, array_keys( plgSearchContactAreas() ) )) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
// load plugin params info
|
||||
$plugin =& JPluginHelper::getPlugin('search', 'contacts');
|
||||
$pluginParams = new JParameter( $plugin->params );
|
||||
|
||||
$limit = $pluginParams->def( 'search_limit', 50 );
|
||||
|
||||
$text = trim( $text );
|
||||
if ($text == '') {
|
||||
return array();
|
||||
}
|
||||
|
||||
$section = JText::_( 'Contact' );
|
||||
|
||||
switch ( $ordering ) {
|
||||
case 'alpha':
|
||||
$order = 'a.name ASC';
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
$order = 'b.title ASC, a.name ASC';
|
||||
break;
|
||||
|
||||
case 'popular':
|
||||
case 'newest':
|
||||
case 'oldest':
|
||||
default:
|
||||
$order = 'a.name DESC';
|
||||
}
|
||||
|
||||
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
|
||||
$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(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END AS catslug, '
|
||||
. ' CONCAT_WS( ", ", a.name, a.con_position, a.misc ) AS text,'
|
||||
. ' CONCAT_WS( " / ", '.$db->Quote($section).', b.title ) AS section,'
|
||||
. ' "2" AS browsernav'
|
||||
. ' FROM #__contact_details AS a'
|
||||
. ' INNER JOIN #__categories AS b ON b.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 b.published = 1'
|
||||
. ' AND a.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND b.access <= '.(int) $user->get( 'aid' )
|
||||
. ' GROUP BY a.id'
|
||||
. ' ORDER BY '. $order
|
||||
;
|
||||
$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;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install version="1.5" type="plugin" group="search">
|
||||
<name>Search - Contacts</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>November 2005</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5</version>
|
||||
<description>Allows Searching of Contacts Component</description>
|
||||
<files>
|
||||
<filename plugin="contacts">contacts.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="search_limit" type="text" size="5" default="50" label="Search Limit" description="Number of Search items to return"/>
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: content.php 11371 2008-12-30 01:31:50Z ian $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$mainframe->registerEvent( 'onSearch', 'plgSearchContent' );
|
||||
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchContentAreas' );
|
||||
|
||||
JPlugin::loadLanguage( 'plg_search_content' );
|
||||
|
||||
/**
|
||||
* @return array An array of search areas
|
||||
*/
|
||||
function &plgSearchContentAreas()
|
||||
{
|
||||
static $areas = array(
|
||||
'content' => 'Articles'
|
||||
);
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content Search method
|
||||
* The sql must return the following fields that are used in a common display
|
||||
* routine: href, title, section, created, text, browsernav
|
||||
* @param string Target search string
|
||||
* @param string mathcing option, exact|any|all
|
||||
* @param string ordering option, newest|oldest|popular|alpha|category
|
||||
* @param mixed An array if the search it to be restricted to areas, null if search all
|
||||
*/
|
||||
function plgSearchContent( $text, $phrase='', $ordering='', $areas=null )
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$user =& JFactory::getUser();
|
||||
|
||||
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
|
||||
require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_search'.DS.'helpers'.DS.'search.php');
|
||||
|
||||
$searchText = $text;
|
||||
if (is_array( $areas )) {
|
||||
if (!array_intersect( $areas, array_keys( plgSearchContentAreas() ) )) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
// load plugin params info
|
||||
$plugin =& JPluginHelper::getPlugin('search', 'content');
|
||||
$pluginParams = new JParameter( $plugin->params );
|
||||
|
||||
$sContent = $pluginParams->get( 'search_content', 1 );
|
||||
$sUncategorised = $pluginParams->get( 'search_uncategorised', 1 );
|
||||
$sArchived = $pluginParams->get( 'search_archived', 1 );
|
||||
$limit = $pluginParams->def( 'search_limit', 50 );
|
||||
|
||||
$nullDate = $db->getNullDate();
|
||||
$date =& JFactory::getDate();
|
||||
$now = $date->toMySQL();
|
||||
|
||||
$text = trim( $text );
|
||||
if ($text == '') {
|
||||
return array();
|
||||
}
|
||||
|
||||
$wheres = array();
|
||||
switch ($phrase) {
|
||||
case 'exact':
|
||||
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
|
||||
$wheres2 = array();
|
||||
$wheres2[] = 'a.title LIKE '.$text;
|
||||
$wheres2[] = 'a.introtext LIKE '.$text;
|
||||
$wheres2[] = 'a.fulltext LIKE '.$text;
|
||||
$wheres2[] = 'a.metakey LIKE '.$text;
|
||||
$wheres2[] = 'a.metadesc 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->getEscaped( $word, true ).'%', false );
|
||||
$wheres2 = array();
|
||||
$wheres2[] = 'a.title LIKE '.$word;
|
||||
$wheres2[] = 'a.introtext LIKE '.$word;
|
||||
$wheres2[] = 'a.fulltext LIKE '.$word;
|
||||
$wheres2[] = 'a.metakey LIKE '.$word;
|
||||
$wheres2[] = 'a.metadesc LIKE '.$word;
|
||||
$wheres[] = implode( ' OR ', $wheres2 );
|
||||
}
|
||||
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
|
||||
break;
|
||||
}
|
||||
|
||||
$morder = '';
|
||||
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 = 'b.title ASC, a.title ASC';
|
||||
$morder = 'a.title ASC';
|
||||
break;
|
||||
|
||||
case 'newest':
|
||||
default:
|
||||
$order = 'a.created DESC';
|
||||
break;
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
|
||||
// search articles
|
||||
if ( $sContent && $limit > 0 )
|
||||
{
|
||||
$query = 'SELECT a.title AS title, a.metadesc, a.metakey,'
|
||||
. ' a.created AS created,'
|
||||
. ' CONCAT(a.introtext, a.fulltext) AS text,'
|
||||
. ' CONCAT_WS( "/", u.title, b.title ) AS section,'
|
||||
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'
|
||||
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(":", b.id, b.alias) ELSE b.id END as catslug,'
|
||||
. ' u.id AS sectionid,'
|
||||
. ' "2" AS browsernav'
|
||||
. ' FROM #__content AS a'
|
||||
. ' INNER JOIN #__categories AS b ON b.id=a.catid'
|
||||
. ' INNER JOIN #__sections AS u ON u.id = a.sectionid'
|
||||
. ' WHERE ( '.$where.' )'
|
||||
. ' AND a.state = 1'
|
||||
. ' AND u.published = 1'
|
||||
. ' AND b.published = 1'
|
||||
. ' AND a.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND b.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND u.access <= '.(int) $user->get( 'aid' )
|
||||
. ' 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).' )'
|
||||
. ' GROUP BY a.id'
|
||||
. ' ORDER BY '. $order
|
||||
;
|
||||
$db->setQuery( $query, 0, $limit );
|
||||
$list = $db->loadObjectList();
|
||||
$limit -= count($list);
|
||||
|
||||
if(isset($list))
|
||||
{
|
||||
foreach($list as $key => $item)
|
||||
{
|
||||
$list[$key]->href = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid);
|
||||
}
|
||||
}
|
||||
$rows[] = $list;
|
||||
}
|
||||
|
||||
// search uncategorised content
|
||||
if ( $sUncategorised && $limit > 0 )
|
||||
{
|
||||
$query = 'SELECT id, a.title AS title, a.created AS created, a.metadesc, a.metakey, '
|
||||
. ' CONCAT(a.introtext, a.fulltext) AS text,'
|
||||
. ' "2" as browsernav, "'. $db->Quote(JText::_('Uncategorised Content')) .'" AS section'
|
||||
. ' FROM #__content AS a'
|
||||
. ' WHERE ('.$where.')'
|
||||
. ' AND a.state = 1'
|
||||
. ' AND a.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND a.sectionid = 0'
|
||||
. ' AND a.catid = 0'
|
||||
. ' 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).' )'
|
||||
. ' ORDER BY '. ($morder ? $morder : $order)
|
||||
;
|
||||
$db->setQuery( $query, 0, $limit );
|
||||
$list2 = $db->loadObjectList();
|
||||
$limit -= count($list2);
|
||||
|
||||
if(isset($list2))
|
||||
{
|
||||
foreach($list2 as $key => $item)
|
||||
{
|
||||
$list2[$key]->href = ContentHelperRoute::getArticleRoute($item->id);
|
||||
}
|
||||
}
|
||||
|
||||
$rows[] = $list2;
|
||||
}
|
||||
|
||||
// search archived content
|
||||
if ( $sArchived && $limit > 0 )
|
||||
{
|
||||
$searchArchived = JText::_( 'Archived' );
|
||||
|
||||
$query = 'SELECT a.title AS title, a.metadesc, a.metakey,'
|
||||
. ' a.created AS created,'
|
||||
. ' CONCAT(a.introtext, a.fulltext) 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(b.alias) THEN CONCAT_WS(":", b.id, b.alias) ELSE b.id END as catslug,'
|
||||
. ' u.id AS sectionid,'
|
||||
. ' CONCAT_WS( "/", u.title, b.title ) AS section,'
|
||||
. ' "2" AS browsernav'
|
||||
. ' FROM #__content AS a'
|
||||
. ' INNER JOIN #__categories AS b ON b.id=a.catid AND b.access <= ' .$user->get( 'gid' )
|
||||
. ' INNER JOIN #__sections AS u ON u.id = a.sectionid'
|
||||
. ' WHERE ( '.$where.' )'
|
||||
. ' AND a.state = -1'
|
||||
. ' AND u.published = 1'
|
||||
. ' AND b.published = 1'
|
||||
. ' AND a.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND b.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND u.access <= '.(int) $user->get( 'aid' )
|
||||
. ' 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).' )'
|
||||
. ' ORDER BY '. $order
|
||||
;
|
||||
$db->setQuery( $query, 0, $limit );
|
||||
$list3 = $db->loadObjectList();
|
||||
|
||||
if(isset($list3))
|
||||
{
|
||||
foreach($list3 as $key => $item)
|
||||
{
|
||||
$list3[$key]->href = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid);
|
||||
}
|
||||
}
|
||||
|
||||
$rows[] = $list3;
|
||||
}
|
||||
|
||||
$results = array();
|
||||
if(count($rows))
|
||||
{
|
||||
foreach($rows as $row)
|
||||
{
|
||||
$new_row = array();
|
||||
foreach($row AS $key => $article) {
|
||||
if(searchHelper::checkNoHTML($article, $searchText, array('text', 'title', 'metadesc', 'metakey'))) {
|
||||
$new_row[] = $article;
|
||||
}
|
||||
}
|
||||
$results = array_merge($results, (array) $new_row);
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install version="1.5" type="plugin" group="search">
|
||||
<name>Search - Content</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>November 2005</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5</version>
|
||||
<description>ALLOWS SEARCHING OF ALL ARTICLES</description>
|
||||
<files>
|
||||
<filename plugin="content">content.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="search_limit" type="text" size="5" default="50" label="Search Limit" description="Number of Search items to return"/>
|
||||
<param name="@spacer" type="spacer" default="" label="" description="" />
|
||||
<param name="search_content" type="radio" default="1" label="Content Items" description="Search Content Items?">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="search_uncategorised" type="radio" default="1" label="Uncategorised Content" description="Search Uncategorised Content?">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="search_archived" type="radio" default="1" label="Archived Content" description="Search Archived Content?">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: newsfeeds.php 10579 2008-07-22 14:54:24Z ircmaxell $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$mainframe->registerEvent( 'onSearch', 'plgSearchNewsfeedslinks' );
|
||||
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchNewsfeedAreas' );
|
||||
|
||||
JPlugin::loadLanguage( 'plg_search_newsfeeds' );
|
||||
|
||||
/**
|
||||
* @return array An array of search areas
|
||||
*/
|
||||
function &plgSearchNewsfeedAreas()
|
||||
{
|
||||
static $areas = array(
|
||||
'newsfeeds' => 'Newsfeeds'
|
||||
);
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contacts Search method
|
||||
*
|
||||
* The sql must return the following fields that are used in a common display
|
||||
* routine: href, title, section, created, text, browsernav
|
||||
* @param string Target search string
|
||||
* @param string mathcing option, exact|any|all
|
||||
* @param string ordering option, newest|oldest|popular|alpha|category
|
||||
* @param mixed An array if the search it to be restricted to areas, null if search all
|
||||
*/
|
||||
function plgSearchNewsfeedslinks( $text, $phrase='', $ordering='', $areas=null )
|
||||
{
|
||||
$db =& JFactory::getDBO();
|
||||
$user =& JFactory::getUser();
|
||||
|
||||
if (is_array( $areas )) {
|
||||
if (!array_intersect( $areas, array_keys( plgSearchNewsfeedAreas() ) )) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
// load plugin params info
|
||||
$plugin =& JPluginHelper::getPlugin('search', 'newsfeeds');
|
||||
$pluginParams = new JParameter( $plugin->params );
|
||||
|
||||
$limit = $pluginParams->def( 'search_limit', 50 );
|
||||
|
||||
$text = trim( $text );
|
||||
if ($text == '') {
|
||||
return array();
|
||||
}
|
||||
|
||||
$wheres = array();
|
||||
switch ($phrase) {
|
||||
case 'exact':
|
||||
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
|
||||
$wheres2 = array();
|
||||
$wheres2[] = 'a.name LIKE '.$text;
|
||||
$wheres2[] = 'a.link 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->getEscaped( $word, true ).'%', false );
|
||||
$wheres2 = array();
|
||||
$wheres2[] = 'a.name LIKE '.$word;
|
||||
$wheres2[] = 'a.link LIKE '.$word;
|
||||
$wheres[] = implode( ' OR ', $wheres2 );
|
||||
}
|
||||
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( $ordering ) {
|
||||
case 'alpha':
|
||||
$order = 'a.name ASC';
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
$order = 'b.title ASC, a.name ASC';
|
||||
break;
|
||||
|
||||
case 'oldest':
|
||||
case 'popular':
|
||||
case 'newest':
|
||||
default:
|
||||
$order = 'a.name ASC';
|
||||
}
|
||||
|
||||
$searchNewsfeeds = JText::_( 'Newsfeeds' );
|
||||
|
||||
$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(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END as catslug, '
|
||||
. ' CONCAT_WS( " / ", '. $db->Quote($searchNewsfeeds) .', b.title )AS section,'
|
||||
. ' "1" AS browsernav'
|
||||
. ' FROM #__newsfeeds AS a'
|
||||
. ' INNER JOIN #__categories AS b ON b.id = a.catid'
|
||||
. ' WHERE ( '. $where .' )'
|
||||
. ' AND a.published = 1'
|
||||
. ' AND b.published = 1'
|
||||
. ' AND b.access <= '. (int) $user->get( 'aid' )
|
||||
. ' ORDER BY '. $order
|
||||
;
|
||||
$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;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install version="1.5" type="plugin" group="search">
|
||||
<name>Search - Newsfeeds</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>November 2005</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5</version>
|
||||
<description>Allows Searching of Newsfeeds</description>
|
||||
<files>
|
||||
<filename plugin="newsfeeds">newsfeeds.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="search_limit" type="text" size="5" default="50" label="Search Limit" description="Number of Search items to return"/>
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: sections.php 10579 2008-07-22 14:54:24Z ircmaxell $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$mainframe->registerEvent( 'onSearch', 'plgSearchSections' );
|
||||
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchSectionAreas' );
|
||||
|
||||
JPlugin::loadLanguage( 'plg_search_sections' );
|
||||
|
||||
/**
|
||||
* @return array An array of search areas
|
||||
*/
|
||||
function &plgSearchSectionAreas() {
|
||||
static $areas = array(
|
||||
'sections' => 'Sections'
|
||||
);
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sections Search method
|
||||
*
|
||||
* The sql must return the following fields that are used in a common display
|
||||
* routine: href, title, section, created, text, browsernav
|
||||
* @param string Target search string
|
||||
* @param string mathcing option, exact|any|all
|
||||
* @param string ordering option, newest|oldest|popular|alpha|category
|
||||
* @param mixed An array if restricted to areas, null if search all
|
||||
*/
|
||||
function plgSearchSections( $text, $phrase='', $ordering='', $areas=null )
|
||||
{
|
||||
$db =& JFactory::getDBO();
|
||||
$user =& JFactory::getUser();
|
||||
|
||||
$searchText = $text;
|
||||
|
||||
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
|
||||
|
||||
if (is_array( $areas )) {
|
||||
if (!array_intersect( $areas, array_keys( plgSearchSectionAreas() ) )) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
// load plugin params info
|
||||
$plugin =& JPluginHelper::getPlugin('search', 'sections');
|
||||
$pluginParams = new JParameter( $plugin->params );
|
||||
|
||||
$limit = $pluginParams->def( 'search_limit', 50 );
|
||||
|
||||
$text = trim( $text );
|
||||
if ($text == '') {
|
||||
return array();
|
||||
}
|
||||
|
||||
switch ( $ordering ) {
|
||||
case 'alpha':
|
||||
$order = 'a.name ASC';
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
case 'popular':
|
||||
case 'newest':
|
||||
case 'oldest':
|
||||
default:
|
||||
$order = 'a.name DESC';
|
||||
}
|
||||
|
||||
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
|
||||
$query = 'SELECT a.title AS title, a.description AS text, a.name, '
|
||||
. ' "" AS created,'
|
||||
. ' "2" AS browsernav,'
|
||||
. ' a.id AS secid'
|
||||
. ' FROM #__sections AS a'
|
||||
. ' WHERE ( a.name LIKE '.$text
|
||||
. ' OR a.title LIKE '.$text
|
||||
. ' OR a.description LIKE '.$text.' )'
|
||||
. ' AND a.published = 1'
|
||||
. ' AND a.access <= '.(int) $user->get( 'aid' )
|
||||
. ' GROUP BY a.id'
|
||||
. ' ORDER BY '. $order
|
||||
;
|
||||
$db->setQuery( $query, 0, $limit );
|
||||
$rows = $db->loadObjectList();
|
||||
|
||||
$count = count( $rows );
|
||||
for ( $i = 0; $i < $count; $i++ )
|
||||
{
|
||||
$rows[$i]->href = ContentHelperRoute::getSectionRoute($rows[$i]->secid);
|
||||
$rows[$i]->section = JText::_( 'Section' );
|
||||
}
|
||||
|
||||
$return = array();
|
||||
foreach($rows AS $key => $section) {
|
||||
if(searchHelper::checkNoHTML($section, $searchText, array('name', 'title', 'text'))) {
|
||||
$return[] = $section;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install version="1.5" type="plugin" group="search">
|
||||
<name>Search - Sections</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>November 2005</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5</version>
|
||||
<description>Allows Searching of Content Section information</description>
|
||||
<files>
|
||||
<filename plugin="sections">sections.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="search_limit" type="text" size="5" default="50" label="Search Limit" description="Number of Search items to return"/>
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: weblinks.php 10579 2008-07-22 14:54:24Z ircmaxell $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$mainframe->registerEvent( 'onSearch', 'plgSearchWeblinks' );
|
||||
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchWeblinksAreas' );
|
||||
|
||||
JPlugin::loadLanguage( 'plg_search_weblinks' );
|
||||
|
||||
/**
|
||||
* @return array An array of search areas
|
||||
*/
|
||||
function &plgSearchWeblinksAreas() {
|
||||
static $areas = array(
|
||||
'weblinks' => 'Weblinks'
|
||||
);
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Weblink Search method
|
||||
*
|
||||
* The sql must return the following fields that are used in a common display
|
||||
* routine: href, title, section, created, text, browsernav
|
||||
* @param string Target search string
|
||||
* @param string mathcing option, exact|any|all
|
||||
* @param string ordering option, newest|oldest|popular|alpha|category
|
||||
* @param mixed An array if the search it to be restricted to areas, null if search all
|
||||
*/
|
||||
function plgSearchWeblinks( $text, $phrase='', $ordering='', $areas=null )
|
||||
{
|
||||
$db =& JFactory::getDBO();
|
||||
$user =& JFactory::getUser();
|
||||
|
||||
$searchText = $text;
|
||||
|
||||
require_once(JPATH_SITE.DS.'components'.DS.'com_weblinks'.DS.'helpers'.DS.'route.php');
|
||||
|
||||
if (is_array( $areas )) {
|
||||
if (!array_intersect( $areas, array_keys( plgSearchWeblinksAreas() ) )) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
// load plugin params info
|
||||
$plugin =& JPluginHelper::getPlugin('search', 'weblinks');
|
||||
$pluginParams = new JParameter( $plugin->params );
|
||||
|
||||
$limit = $pluginParams->def( 'search_limit', 50 );
|
||||
|
||||
$text = trim( $text );
|
||||
if ($text == '') {
|
||||
return array();
|
||||
}
|
||||
$section = JText::_( 'Web Links' );
|
||||
|
||||
$wheres = array();
|
||||
switch ($phrase)
|
||||
{
|
||||
case 'exact':
|
||||
$text = $db->Quote( '%'.$db->getEscaped( $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->getEscaped( $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.date ASC';
|
||||
break;
|
||||
|
||||
case 'popular':
|
||||
$order = 'a.hits DESC';
|
||||
break;
|
||||
|
||||
case 'alpha':
|
||||
$order = 'a.title ASC';
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
$order = 'b.title ASC, a.title ASC';
|
||||
break;
|
||||
|
||||
case 'newest':
|
||||
default:
|
||||
$order = 'a.date DESC';
|
||||
}
|
||||
|
||||
$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(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END as catslug, '
|
||||
. ' CONCAT_WS( " / ", '.$db->Quote($section).', b.title ) AS section,'
|
||||
. ' "1" AS browsernav'
|
||||
. ' FROM #__weblinks AS a'
|
||||
. ' INNER JOIN #__categories AS b ON b.id = a.catid'
|
||||
. ' WHERE ('. $where .')'
|
||||
. ' AND a.published = 1'
|
||||
. ' AND b.published = 1'
|
||||
. ' AND b.access <= '.(int) $user->get( 'aid' )
|
||||
. ' ORDER BY '. $order
|
||||
;
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install version="1.5" type="plugin" group="search">
|
||||
<name>Search - Weblinks</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>November 2005</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5</version>
|
||||
<description>Allows Searching of Weblinks Component</description>
|
||||
<files>
|
||||
<filename plugin="weblinks">weblinks.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="search_limit" type="text" size="5" default="50" label="Search Limit" description="Number of Search items to return"/>
|
||||
</params>
|
||||
</install>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install version="1.5" type="plugin" group="system">
|
||||
<name>System - Backlinks</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>September 2007</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5</version>
|
||||
<description>Provides backlink support</description>
|
||||
<files>
|
||||
<filename plugin="backlink">backlink.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="url" type="radio" default="1" label="Search Query Strings" description="If yes, it searches for old query strings that might match and redirects">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="sef" type="radio" default="1" label="Search SEF" description="If yes, it uses old style SEF and directs it to the new link">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="legacysef" type="radio" default="1" label="Attempt Legacy SEF" description="If yes, it uses old style SEF and attempts to generate a valid link">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: cache.php 11616 2009-02-07 14:09:52Z kdevine $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
jimport( 'joomla.plugin.plugin' );
|
||||
|
||||
/**
|
||||
* Joomla! Page Cache Plugin
|
||||
*
|
||||
* @package Joomla
|
||||
* @subpackage System
|
||||
*/
|
||||
class plgSystemCache extends JPlugin
|
||||
{
|
||||
|
||||
var $_cache = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* For php4 compatability we must not use the __constructor as a constructor for plugins
|
||||
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
|
||||
* This causes problems with cross-referencing necessary for the observer design pattern.
|
||||
*
|
||||
* @access protected
|
||||
* @param object $subject The object to observe
|
||||
* @param array $config An array that holds the plugin configuration
|
||||
* @since 1.0
|
||||
*/
|
||||
function plgSystemCache(& $subject, $config)
|
||||
{
|
||||
parent::__construct($subject, $config);
|
||||
|
||||
//Set the language in the class
|
||||
$config =& JFactory::getConfig();
|
||||
$options = array(
|
||||
'cachebase' => JPATH_BASE.DS.'cache',
|
||||
'defaultgroup' => 'page',
|
||||
'lifetime' => $this->params->get('cachetime', 15) * 60,
|
||||
'browsercache' => $this->params->get('browsercache', false),
|
||||
'caching' => false,
|
||||
'language' => $config->getValue('config.language', 'en-GB')
|
||||
);
|
||||
|
||||
jimport('joomla.cache.cache');
|
||||
$this->_cache =& JCache::getInstance( 'page', $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converting the site URL to fit to the HTTP request
|
||||
*
|
||||
*/
|
||||
function onAfterInitialise()
|
||||
{
|
||||
global $mainframe, $_PROFILER;
|
||||
$user = &JFactory::getUser();
|
||||
|
||||
if($mainframe->isAdmin() || JDEBUG) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$user->get('aid') && $_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
$this->_cache->setCaching(true);
|
||||
}
|
||||
|
||||
$data = $this->_cache->get();
|
||||
|
||||
if($data !== false)
|
||||
{
|
||||
// the following code searches for a token in the cached page and replaces it with the
|
||||
// proper token.
|
||||
$token = JUtility::getToken();
|
||||
$search = '#<input type="hidden" name="[0-9a-f]{32}" value="1" />#';
|
||||
$replacement = '<input type="hidden" name="'.$token.'" value="1" />';
|
||||
$data = preg_replace( $search, $replacement, $data );
|
||||
|
||||
JResponse::setBody($data);
|
||||
|
||||
echo JResponse::toString($mainframe->getCfg('gzip'));
|
||||
|
||||
if(JDEBUG)
|
||||
{
|
||||
$_PROFILER->mark('afterCache');
|
||||
echo implode( '', $_PROFILER->getBuffer());
|
||||
}
|
||||
|
||||
$mainframe->close();
|
||||
}
|
||||
}
|
||||
|
||||
function onAfterRender()
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
if($mainframe->isAdmin() || JDEBUG) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user =& JFactory::getUser();
|
||||
if(!$user->get('aid')) {
|
||||
//We need to check again here, because auto-login plugins have not been fired before the first aid check
|
||||
$this->_cache->store();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install version="1.5" type="plugin" group="system">
|
||||
<name>System - Cache</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>February 2007</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5</version>
|
||||
<description>Provides page caching</description>
|
||||
<files>
|
||||
<filename plugin="cache">cache.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="browsercache" type="radio" default="0" label="Use browser caching" description="If yes, use mechanism for storing page cache in the browser">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="cachetime" type="text" default="15" label="Cache Lifetime" description="Page cache lifetime in minutes"/>
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: debug.php 10709 2008-08-21 09:58:52Z eddieajau $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
jimport( 'joomla.plugin.plugin' );
|
||||
|
||||
/**
|
||||
* Joomla! Debug plugin
|
||||
*
|
||||
* @package Joomla
|
||||
* @subpackage System
|
||||
*/
|
||||
class plgSystemDebug extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* For php4 compatability we must not use the __constructor as a constructor for plugins
|
||||
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
|
||||
* This causes problems with cross-referencing necessary for the observer design pattern.
|
||||
*
|
||||
* @access protected
|
||||
* @param object $subject The object to observe
|
||||
* @param array $config An array that holds the plugin configuration
|
||||
* @since 1.0
|
||||
*/
|
||||
function plgSystemDebug(& $subject, $config)
|
||||
{
|
||||
parent::__construct($subject, $config);
|
||||
|
||||
//load the translation
|
||||
$this->loadLanguage( );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converting the site URL to fit to the HTTP request
|
||||
*
|
||||
*/
|
||||
function onAfterRender()
|
||||
{
|
||||
global $_PROFILER, $mainframe, $database;
|
||||
|
||||
// Do not render if debugging is not enabled
|
||||
if(!JDEBUG) { return; }
|
||||
|
||||
$document =& JFactory::getDocument();
|
||||
$doctype = $document->getType();
|
||||
|
||||
// Only render for HTML output
|
||||
if ( $doctype !== 'html' ) { return; }
|
||||
|
||||
$profiler =& $_PROFILER;
|
||||
|
||||
ob_start();
|
||||
echo '<div id="system-debug" class="profiler">';
|
||||
if ($this->params->get('profile', 1)) {
|
||||
echo '<h4>'.JText::_( 'Profile Information' ).'</h4>';
|
||||
foreach ( $profiler->getBuffer() as $mark ) {
|
||||
echo '<div>'.$mark.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->params->get('memory', 1)) {
|
||||
echo '<h4>'.JText::_( 'Memory Usage' ).'</h4>';
|
||||
echo $profiler->getMemory();
|
||||
}
|
||||
|
||||
if ($this->params->get('queries', 1))
|
||||
{
|
||||
jimport('geshi.geshi');
|
||||
|
||||
$geshi = new GeSHi( '', 'sql' );
|
||||
$geshi->set_header_type(GESHI_HEADER_DIV);
|
||||
//$geshi->enable_line_numbers( GESHI_FANCY_LINE_NONE );
|
||||
|
||||
$newlineKeywords = '/<span style="color: #993333; font-weight: bold;">'
|
||||
.'(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND)'
|
||||
.'<\\/span>/i'
|
||||
;
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
echo '<h4>'.JText::sprintf( 'Queries logged', $db->getTicker() ).'</h4>';
|
||||
|
||||
if ($log = $db->getLog())
|
||||
{
|
||||
echo '<ol>';
|
||||
foreach ($log as $k=>$sql)
|
||||
{
|
||||
$geshi->set_source($sql);
|
||||
$text = $geshi->parse_code();
|
||||
$text = preg_replace($newlineKeywords, '<br /> \\0', $text);
|
||||
echo '<li>'.$text.'</li>';
|
||||
}
|
||||
echo '</ol>';
|
||||
}
|
||||
|
||||
if(isset($database))
|
||||
{
|
||||
echo '<h4>'.JText::sprintf( 'Legacy Queries logged', $database->getTicker() ).'</h4>';
|
||||
echo '<ol>';
|
||||
|
||||
foreach ($database->getLog() as $k=>$sql)
|
||||
{
|
||||
$geshi->set_source($sql);
|
||||
$text = $geshi->parse_code();
|
||||
$text = preg_replace($newlineKeywords, '<br /> \\0', $text);
|
||||
echo '<li>'.$text.'</li>';
|
||||
}
|
||||
|
||||
echo '</ol>';
|
||||
}
|
||||
}
|
||||
|
||||
$lang = &JFactory::getLanguage();
|
||||
if ($this->params->get('language_files', 1))
|
||||
{
|
||||
echo '<h4>'.JText::_( 'Language Files Loaded' ).'</h4>';
|
||||
echo '<ul>';
|
||||
$extensions = $lang->getPaths();
|
||||
foreach ( $extensions as $extension => $files)
|
||||
{
|
||||
foreach ( $files as $file => $status )
|
||||
{
|
||||
echo "<li>$file $status</li>";
|
||||
}
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
$langStrings = $this->params->get('language_strings', -1);
|
||||
if ($langStrings < 0 OR $langStrings == 1) {
|
||||
echo '<h4>'.JText::_( 'Untranslated Strings Diagnostic' ).'</h4>';
|
||||
echo '<pre>';
|
||||
$orphans = $lang->getOrphans();
|
||||
if (count( $orphans ))
|
||||
{
|
||||
ksort( $orphans, SORT_STRING );
|
||||
foreach ($orphans as $key => $occurance) {
|
||||
foreach ( $occurance as $i => $info) {
|
||||
$class = @$info['class'];
|
||||
$func = @$info['function'];
|
||||
$file = @$info['file'];
|
||||
$line = @$info['line'];
|
||||
echo strtoupper( $key )."\t$class::$func()\t[$file:$line]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo JText::_( 'None' );
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
if ($langStrings < 0 OR $langStrings == 2) {
|
||||
echo '<h4>'.JText::_( 'Untranslated Strings Designer' ).'</h4>';
|
||||
echo '<pre>';
|
||||
$orphans = $lang->getOrphans();
|
||||
if (count( $orphans ))
|
||||
{
|
||||
ksort( $orphans, SORT_STRING );
|
||||
$guesses = array();
|
||||
foreach ($orphans as $key => $occurance) {
|
||||
if (is_array( $occurance ) AND isset( $occurance[0] )) {
|
||||
$info = &$occurance[0];
|
||||
$file = @$info['file'];
|
||||
if (!isset( $guesses[$file] )) {
|
||||
$guesses[$file] = array();
|
||||
}
|
||||
|
||||
$guess = str_replace( '_', ' ', $info['string'] );
|
||||
if ($strip = $this->params->get('language_prefix')) {
|
||||
$guess = trim( preg_replace( chr(1).'^'.$strip.chr(1), '', $guess ) );
|
||||
}
|
||||
$guesses[$file][] = trim( strtoupper( $key ) ).'='.$guess;
|
||||
}
|
||||
}
|
||||
foreach ($guesses as $file => $keys) {
|
||||
echo "\n\n# ".($file ? $file : JText::_( 'Unknown file' ))."\n\n";
|
||||
echo implode( "\n", $keys );
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo JText::_( 'None' );
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
$debug = ob_get_clean();
|
||||
|
||||
$body = JResponse::getBody();
|
||||
$body = str_replace('</body>', $debug.'</body>', $body);
|
||||
JResponse::setBody($body);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install version="1.5" type="plugin" group="system">
|
||||
<name>System - Debug</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>December 2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5</version>
|
||||
<description>Provides debug information</description>
|
||||
<files>
|
||||
<filename plugin="debug">debug.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="profile" type="radio" default="1" label="Display Profiling Information" description="If yes, display profiling information">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="queries" type="radio" default="1" label="Display SQL query log" description="If yes, display SQL query log">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="memory" type="radio" default="1" label="Display memory usage" description="If yes, display memory usage">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="language_files" type="radio" default="1" label="Display loaded language files" description="If yes, display a list of the language files loaded">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="language_strings" type="list" default="2" label="Display undefined language strings" description="Displays orphaned strings in different ways">
|
||||
<option value="0">No</option>
|
||||
<option value="-1">All modes</option>
|
||||
<option value="1">Diagnostic mode</option>
|
||||
<option value="2">Designer mode</option>
|
||||
</param>
|
||||
<param name="language_prefix" type="text" default="" label="Strip String Prefix" description="Strip String Prefix Desc" />
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install version="1.5" type="plugin" group="system">
|
||||
<name>System - Legacy</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>January 2007</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5</version>
|
||||
<description>Provides legacy support for older version of Joomla!</description>
|
||||
<files>
|
||||
<filename plugin="legacy">legacy.php</filename>
|
||||
<filename>legacy/classes.php</filename>
|
||||
<filename>legacy/functions.php</filename>
|
||||
<filename>legacy/toolbar.php</filename>
|
||||
<filename>legacy/index.html</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="route" type="radio" default="0" label="Use legacy URL routing" description="If yes, use legacy url routing mechanism">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
</params>
|
||||
</install>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: cache.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
/**
|
||||
* Legacy class, use &{@link JFactory::getCache()} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
*/
|
||||
class mosCache
|
||||
{
|
||||
/**
|
||||
* @return object A function cache object
|
||||
*/
|
||||
function &getCache( $group='' )
|
||||
{
|
||||
return JFactory::getCache($group);
|
||||
}
|
||||
/**
|
||||
* Cleans the cache
|
||||
*/
|
||||
function cleanCache( $group=false )
|
||||
{
|
||||
$cache =& JFactory::getCache($group);
|
||||
$cache->clean($group);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: category.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
// Register legacy classes for autoloading
|
||||
JLoader::register('JTableCategory' , JPATH_LIBRARIES.DS.'joomla'.DS.'database'.DS.'table'.DS.'category.php');
|
||||
|
||||
/**
|
||||
* Legacy class, use {@link JTableCategory} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
*/
|
||||
class mosCategory extends JTableCategory
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct( &$db)
|
||||
{
|
||||
parent::__construct( $db );
|
||||
}
|
||||
|
||||
function mosCategory(&$db)
|
||||
{
|
||||
parent::__construct( $db );
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy Method, use {@link JTable::reorder()} instead
|
||||
* @deprecated As of 1.5
|
||||
*/
|
||||
function updateOrder( $where='' )
|
||||
{
|
||||
return $this->reorder( $where );
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy Method, use {@link JTable::publish()} instead
|
||||
* @deprecated As of 1.0.3
|
||||
*/
|
||||
function publish_array( $cid=null, $publish=1, $user_id=0 )
|
||||
{
|
||||
$this->publish( $cid, $publish, $user_id );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: classes.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
JLoader::register('JPaneTabs', JPATH_LIBRARIES.DS.'joomla'.DS.'html'.DS.'pane.php');
|
||||
|
||||
/**
|
||||
* Legacy class, replaced by full MVC implementation. See {@link JController}
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
*/
|
||||
class mosAbstractTasker
|
||||
{
|
||||
function mosAbstractTasker()
|
||||
{
|
||||
jexit( 'mosAbstractTasker deprecated, use JController instead' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Legacy class, removed
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
*/
|
||||
class mosEmpty
|
||||
{
|
||||
function def( $key, $value='' )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
function get( $key, $default='' )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Legacy class, removed
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
*/
|
||||
class MENU_Default
|
||||
{
|
||||
function MENU_Default()
|
||||
{
|
||||
JToolBarHelper::publishList();
|
||||
JToolBarHelper::unpublishList();
|
||||
JToolBarHelper::addNew();
|
||||
JToolBarHelper::editList();
|
||||
JToolBarHelper::deleteList();
|
||||
JToolBarHelper::spacer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy class, use {@link JPanel} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
*/
|
||||
class mosTabs extends JPaneTabs
|
||||
{
|
||||
var $useCookies = false;
|
||||
|
||||
function __construct( $useCookies, $xhtml = null) {
|
||||
parent::__construct( array('useCookies' => $useCookies) );
|
||||
}
|
||||
|
||||
function startTab( $tabText, $paneid ) {
|
||||
echo $this->startPanel( $tabText, $paneid);
|
||||
}
|
||||
|
||||
function endTab() {
|
||||
echo $this->endPanel();
|
||||
}
|
||||
|
||||
function startPane( $tabText ){
|
||||
echo parent::startPane( $tabText );
|
||||
}
|
||||
|
||||
function endPane(){
|
||||
echo parent::endPane();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: commonhtml.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
/**
|
||||
* Legacy class, use {@link JHTML::_()} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
*/
|
||||
class mosCommonHTML
|
||||
{
|
||||
/**
|
||||
* Legacy function, use {@link JHTML::_('legend');} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function ContentLegend( )
|
||||
{
|
||||
JHTML::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_content'.DS.'html' );
|
||||
JHTML::_('grid.legend');
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, deprecated
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function menuLinksContent( &$menus )
|
||||
{
|
||||
foreach( $menus as $menu ) {
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<hr />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="90" valign="top">
|
||||
<?php echo JText::_( 'Menu' ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:go2('go2menu','<?php echo $menu->menutype; ?>');" title="<?php echo JText::_( 'Go to Menu' ); ?>">
|
||||
<?php echo $menu->menutype; ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="90" valign="top">
|
||||
<?php echo JText::_( 'Link Name' ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<strong>
|
||||
<a href="javascript:go2('go2menuitem','<?php echo $menu->menutype; ?>','<?php echo $menu->id; ?>');" title="<?php echo JText::_( 'Go to Menu Item' ); ?>">
|
||||
<?php echo $menu->name; ?></a>
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="90" valign="top">
|
||||
<?php echo JText::_( 'State' ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
switch ( $menu->published ) {
|
||||
case -2:
|
||||
echo '<font color="red">'. JText::_( 'Trashed' ) .'</font>';
|
||||
break;
|
||||
case 0:
|
||||
echo JText::_( 'UnPublished' );
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
echo '<font color="green">'. JText::_( 'Published' ) .'</font>';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="hidden" name="menu" value="" />
|
||||
<input type="hidden" name="menuid" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, deprecated
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function menuLinksSecCat( &$menus )
|
||||
{
|
||||
$i = 1;
|
||||
foreach( $menus as $menu ) {
|
||||
?>
|
||||
<fieldset>
|
||||
<legend align="right"> <?php echo $i; ?>. </legend>
|
||||
|
||||
<table class="admintable">
|
||||
<tr>
|
||||
<td valign="top" class="key">
|
||||
<?php echo JText::_( 'Menu' ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:go2('go2menu','<?php echo $menu->menutype; ?>');" title="<?php echo JText::_( 'Go to Menu' ); ?>">
|
||||
<?php echo $menu->menutype; ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="key">
|
||||
<?php echo JText::_( 'Type' ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $menu->type; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="key">
|
||||
<?php echo JText::_( 'Item Name' ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<strong>
|
||||
<a href="javascript:go2('go2menuitem','<?php echo $menu->menutype; ?>','<?php echo $menu->id; ?>');" title="<?php echo JText::_( 'Go to Menu Item' ); ?>">
|
||||
<?php echo $menu->name; ?></a>
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="key">
|
||||
<?php echo JText::_( 'State' ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
switch ( $menu->published ) {
|
||||
case -2:
|
||||
echo '<font color="red">'. JText::_( 'Trashed' ) .'</font>';
|
||||
break;
|
||||
case 0:
|
||||
echo JText::_( 'UnPublished' );
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
echo '<font color="green">'. JText::_( 'Published' ) .'</font>';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<?php
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="menu" value="" />
|
||||
<input type="hidden" name="menuid" value="" />
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, use {@link JHTMLGrid::checkedOut()} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function checkedOut( &$row, $overlib=1 )
|
||||
{
|
||||
jimport('joomla.html.html.grid');
|
||||
return JHTML::_('grid.checkedOut',$row, $overlib);
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, use {@link JHTML::_('behavior.tooltip')} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function loadOverlib()
|
||||
{
|
||||
JHTML::_('behavior.tooltip');
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, use {@link JHTML::_('behavior.calendar')} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function loadCalendar()
|
||||
{
|
||||
JHTML::_('behavior.calendar');
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, use {@link JHTML::_('grid.access')} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function AccessProcessing( &$row, $i, $archived=NULL )
|
||||
{
|
||||
return JHTML::_('grid.access', $row, $i, $archived);
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, use {@link JHTML::_('grid.checkedout')} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function CheckedOutProcessing( &$row, $i )
|
||||
{
|
||||
return JHTML::_('grid.checkedout', $row, $i);
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, use {@link JHTML::_('grid.published')} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function PublishedProcessing( &$row, $i, $imgY='tick.png', $imgX='publish_x.png' )
|
||||
{
|
||||
return JHTML::_('grid.published',$row, $i, $imgY, $imgX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, use {@link JHTML::_('grid.state')} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function selectState( $filter_state=NULL, $published='Published', $unpublished='Unpublished', $archived=NULL )
|
||||
{
|
||||
return JHTML::_('grid.state', $filter_state, $published, $unpublished, $archived);
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, use {@link JHTML::_('grid.order')} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function saveorderButton( $rows, $image='filesave.png' )
|
||||
{
|
||||
echo JHTML::_('grid.order', $rows, $image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, use {@link echo JHTML::_('grid.sort')} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
function tableOrdering( $text, $ordering, &$lists, $task=NULL )
|
||||
{
|
||||
// TODO: We may have to invert order_Dir here because this control now does the flip for you
|
||||
echo JHTML::_('grid.sort', $text, $ordering, @$lists['order_Dir'], @$lists['order'], $task);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: component.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! 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.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
// Register legacy classes for autoloading
|
||||
JLoader::register('JTableComponent', JPATH_LIBRARIES.DS.'joomla'.DS.'database'.DS.'table'.DS.'component.php');
|
||||
|
||||
/**
|
||||
* Legacy class, use {@link JTableComponent} instead
|
||||
*
|
||||
* @deprecated As of version 1.5
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage 1.5
|
||||
*/
|
||||
class mosComponent extends JTableComponent
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct( $db );
|
||||
}
|
||||
|
||||
function mosComponent( &$db)
|
||||
{
|
||||
parent::__construct( $db );
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy Method, use {@link JTable::reorder()} instead
|
||||
* @deprecated As of 1.5
|
||||
*/
|
||||
function updateOrder( $where='' )
|
||||
{
|
||||
return $this->reorder( $where );
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy Method, use {@link JTable::publish()} instead
|
||||
* @deprecated As of 1.0.3
|
||||
*/
|
||||
function publish_array( $cid=null, $publish=1, $user_id=0 )
|
||||
{
|
||||
$this->publish( $cid, $publish, $user_id );
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user