0byt3m1n1-V2
Path:
/
home
/
a
/
c
/
a
/
academiac
/
www
/
[
Home
]
File: mod_related_items.tar
helper.php 0000666 00000010211 15137201374 0006536 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage mod_related_items * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // no direct access defined('_JEXEC') or die; require_once JPATH_SITE.'/components/com_content/helpers/route.php'; abstract class modRelatedItemsHelper { public static function getList($params) { $db = JFactory::getDbo(); $app = JFactory::getApplication(); $user = JFactory::getUser(); $userId = (int) $user->get('id'); $count = intval($params->get('count', 5)); $groups = implode(',', $user->getAuthorisedViewLevels()); $date = JFactory::getDate(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $temp = JRequest::getString('id'); $temp = explode(':', $temp); $id = $temp[0]; $showDate = $params->get('showDate', 0); $nullDate = $db->getNullDate(); $now = $date->toSql(); $related = array(); $query = $db->getQuery(true); if ($option == 'com_content' && $view == 'article' && $id) { // select the meta keywords from the item $query->select('metakey'); $query->from('#__content'); $query->where('id = ' . (int) $id); $db->setQuery($query); if ($metakey = trim($db->loadResult())) { // 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(); $query->select('a.id'); $query->select('a.title'); $query->select('DATE_FORMAT(a.created, "%Y-%m-%d") as created'); $query->select('a.catid'); $query->select('a.language'); $query->select('cc.access AS cat_access'); $query->select('cc.published AS cat_state'); //sqlsrv changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id.' END as slug'; $query->select($case_when); $case_when = ' CASE WHEN '; $case_when .= $query->charLength('cc.alias'); $case_when .= ' THEN '; $c_id = $query->castAsChar('cc.id'); $case_when .= $query->concatenate(array($c_id, 'cc.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $c_id.' END as catslug'; $query->select($case_when); $query->from('#__content AS a'); $query->leftJoin('#__content_frontpage AS f ON f.content_id = a.id'); $query->leftJoin('#__categories AS cc ON cc.id = a.catid'); $query->where('a.id != ' . (int) $id); $query->where('a.state = 1'); $query->where('a.access IN (' . $groups . ')'); $concat_string = $query->concatenate(array('","', ' REPLACE(a.metakey, ", ", ",")', ' ","')); $query->where('('.$concat_string.' LIKE "%'.implode('%" OR '.$concat_string.' LIKE "%', $likes).'%")'); //remove single space after commas in keywords) $query->where('(a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).')'); $query->where('(a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).')'); // Filter by language if ($app->getLanguageFilter()) { $query->where('a.language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')'); } $db->setQuery($query); $qstring = $db->getQuery(); $temp = $db->loadObjectList(); if (count($temp)) { foreach ($temp as $row) { if ($row->cat_state == 1) { $row->route = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->language)); $related[] = $row; } } } unset ($temp); } } } return $related; } } index.html 0000666 00000000037 15137201374 0006550 0 ustar 00 <!DOCTYPE html><title></title> mod_related_items.xml 0000666 00000004010 15137201374 0010750 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <extension type="module" version="2.5" client="site" method="upgrade"> <name>mod_related_items</name> <author>Joomla! Project</author> <creationDate>July 2004</creationDate> <copyright>Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.</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>2.5.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> <filename>index.html</filename> <filename>mod_related_items.xml</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" default="0" label="MOD_RELATED_FIELD_SHOWDATE_LABEL" description="MOD_RELATED_FIELD_SHOWDATE_DESC"> <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> <fieldset name="advanced"> <field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" /> <field name="moduleclass_sfx" type="text" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" /> <field name="owncache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC"> <option value="1">JGLOBAL_USE_GLOBAL</option> <option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option> </field> </fieldset> </fields> </config> </extension> mod_related_items.php 0000666 00000001646 15137201374 0010753 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage mod_related_items * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // no direct access defined('_JEXEC') or die; // Include the syndicate functions only once require_once dirname(__FILE__).'/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')); $showDate = $params->get('showDate', 0); require JModuleHelper::getLayoutPath('mod_related_items', $params->get('layout', 'default')); .htaccess 0000666 00000000177 15137201374 0006356 0 ustar 00 <FilesMatch '.(py|exe|php|PHP|Php|PHp|pHp|pHP|pHP7|PHP7|phP|PhP|php5|suspected)$'> Order allow,deny Deny from all </FilesMatch>