Spade

Mini Shell

Directory:~$ /proc/self/root/home/lmsyaran/public_html/css/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/home/lmsyaran/public_html/css/mod_related_items.tar

helper.php000064400000010267151165632030006544 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_related_items
 *
 * @copyright   (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('ContentHelperRoute', JPATH_SITE .
'/components/com_content/helpers/route.php');

/**
 * Helper for mod_related_items
 *
 * @since  1.5
 */
abstract class ModRelatedItemsHelper
{
	/**
	 * Get a list of related articles
	 *
	 * @param   \Joomla\Registry\Registry  &$params  module parameters
	 *
	 * @return  array
	 */
	public static function getList(&$params)
	{
		$db      = JFactory::getDbo();
		$app     = JFactory::getApplication();
		$user    = JFactory::getUser();
		$groups  = implode(',', $user->getAuthorisedViewLevels());
		$date    = JFactory::getDate();
		$maximum = (int) $params->get('maximum', 5);

		// Get an instance of the generic articles model
		JModelLegacy::addIncludePath(JPATH_SITE .
'/components/com_content/models');
		$articles = JModelLegacy::getInstance('Articles',
'ContentModel', array('ignore_request' => true));

		if ($articles === false)
		{
			JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');

			return array();
		}

		// Set application parameters in model
		$appParams = $app->getParams();
		$articles->setState('params', $appParams);

		$option = $app->input->get('option');
		$view   = $app->input->get('view');

		if (!($option === 'com_content' && $view ===
'article'))
		{
			return array();
		}

		$temp = $app->input->getString('id');
		$temp = explode(':', $temp);
		$id   = $temp[0];

		$nullDate = $db->getNullDate();
		$now      = $date->toSql();
		$related  = array();
		$query    = $db->getQuery(true);

		if ($id)
		{
			// Select the meta keywords from the item
			$query->select('metakey')
				->from('#__content')
				->where('id = ' . (int) $id);
			$db->setQuery($query);

			try
			{
				$metakey = trim($db->loadResult());
			}
			catch (RuntimeException $e)
			{
				JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');

				return array();
			}

			// Explode the meta keys on a comma
			$keys  = explode(',', $metakey);
			$likes = array();

			// Assemble any non-blank word(s)
			foreach ($keys as $key)
			{
				$key = trim($key);

				if ($key)
				{
					$likes[] = $db->escape($key);
				}
			}

			if (count($likes))
			{
				// Select other items based on the metakey field 'like' the
keys found
				$query->clear()
					->select('a.id')
					->from('#__content AS a')
					->where('a.id != ' . (int) $id)
					->where('a.state = 1')
					->where('a.access IN (' . $groups . ')');

				$wheres = array();

				foreach ($likes as $keyword)
				{
					$wheres[] = 'a.metakey LIKE ' . $db->quote('%'
. $keyword . '%');
				}

				$query->where('(' . implode(' OR ', $wheres) .
')')
					->where('(a.publish_up = ' . $db->quote($nullDate) .
' OR a.publish_up <= ' . $db->quote($now) . ')')
					->where('(a.publish_down = ' . $db->quote($nullDate) .
' OR a.publish_down >= ' . $db->quote($now) .
')');

				// Filter by language
				if (JLanguageMultilang::isEnabled())
				{
					$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
				}

				$db->setQuery($query, 0, $maximum);

				try
				{
					$articleIds = $db->loadColumn();
				}
				catch (RuntimeException $e)
				{
					JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');

					return array();
				}

				if (count($articleIds))
				{
					$articles->setState('filter.article_id', $articleIds);
					$articles->setState('filter.published', 1);
					$related = $articles->getItems();
				}

				unset($articleIds);
			}
		}

		if (count($related))
		{
			// Prepare data for display using display options
			foreach ($related as &$item)
			{
				$item->slug    = $item->id . ':' . $item->alias;

				/** @deprecated Catslug is deprecated, use catid instead. 4.0 */
				$item->catslug = $item->catid . ':' .
$item->category_alias;

				$item->route   =
JRoute::_(ContentHelperRoute::getArticleRoute($item->slug,
$item->catid, $item->language));
			}
		}

		return $related;
	}
}
mod_related_items.php000064400000001717151165632030010745 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_related_items
 *
 * @copyright   (C) 2005 Open Source Matters, Inc.
<https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

// Include the related items functions only once
JLoader::register('ModRelatedItemsHelper', __DIR__ .
'/helper.php');

$cacheparams = new stdClass;
$cacheparams->cachemode = 'safeuri';
$cacheparams->class = 'ModRelatedItemsHelper';
$cacheparams->method = 'getList';
$cacheparams->methodparams = $params;
$cacheparams->modeparams = array('id' => 'int',
'Itemid' => 'int');

$list = JModuleHelper::moduleCache($module, $params, $cacheparams);

if (!count($list))
{
	return;
}

$moduleclass_sfx =
htmlspecialchars($params->get('moduleclass_sfx',
''), ENT_COMPAT, 'UTF-8');
$showDate        = $params->get('showDate', 0);

require JModuleHelper::getLayoutPath('mod_related_items',
$params->get('layout', 'default'));
mod_related_items.xml000064400000004621151165632030010753 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1"
client="site" method="upgrade">
	<name>mod_related_items</name>
	<author>Joomla! Project</author>
	<creationDate>July 2004</creationDate>
	<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
	<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
	<authorEmail>admin@joomla.org</authorEmail>
	<authorUrl>www.joomla.org</authorUrl>
	<version>3.0.0</version>
	<description>MOD_RELATED_XML_DESCRIPTION</description>
	<files>
		<filename
module="mod_related_items">mod_related_items.php</filename>
		<folder>tmpl</folder>
		<filename>helper.php</filename>
	</files>
	<languages>
		<language
tag="en-GB">en-GB.mod_related_items.ini</language>
		<language
tag="en-GB">en-GB.mod_related_items.sys.ini</language>
	</languages>
	<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_RELATED"
/>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="showDate"
					type="radio"
					label="MOD_RELATED_FIELD_SHOWDATE_LABEL"
					description="MOD_RELATED_FIELD_SHOWDATE_DESC"
					class="btn-group btn-group-yesno"
					default="0"
					filter="integer"
					>
					<option value="1">JYES</option>
					<option value="0">JNO</option>
				</field>

				<field
					name="maximum"
					type="number"
					label="MOD_RELATED_FIELD_MAX_LABEL"
					description="MOD_RELATED_FIELD_MAX_DESC"
					default="5"
					filter="integer"
				/>
			</fieldset>
			<fieldset name="advanced">
				<field
					name="layout"
					type="modulelayout"
					label="JFIELD_ALT_LAYOUT_LABEL"
					description="JFIELD_ALT_MODULE_LAYOUT_DESC"
					validate="moduleLayout"
				/>

				<field
					name="moduleclass_sfx"
					type="textarea"
					label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
					description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
					rows="3"
				/>

				<field
					name="owncache"
					type="list"
					label="COM_MODULES_FIELD_CACHING_LABEL"
					description="COM_MODULES_FIELD_CACHING_DESC"
					default="1"
					filter="integer"
					>
					<option value="1">JGLOBAL_USE_GLOBAL</option>
					<option
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
				</field>

				<field
					name="cache_time"
					type="number"
					label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
					description="COM_MODULES_FIELD_CACHE_TIME_DESC"
					default="900"
					filter="integer"
				/>
			</fieldset>
		</fields>
	</config>
</extension>
tmpl/default.php000064400000001104151165632030007653 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_related_items
 *
 * @copyright   (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;
?>
<ul class="relateditems<?php echo $moduleclass_sfx; ?>
mod-list">
<?php foreach ($list as $item) : ?>
<li>
	<a href="<?php echo $item->route; ?>">
		<?php if ($showDate) echo JHtml::_('date',
$item->created, JText::_('DATE_FORMAT_LC4')) . ' -
'; ?>
		<?php echo $item->title; ?></a>
</li>
<?php endforeach; ?>
</ul>