- md5
- 83baac906dd0e776933d2cd52835c39a
- sha1
- a4f95d3e20750d18decd04cc46a3ac941b8c04fc
- sha256
- 9bb4c194f24c517fde371f1f2897a2cc446596ce1e52ee20ce87e2fec9025048
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
<?php
/**
* @version $Id: mod_related_items.php 1650 2006-01-04 05:40:49Z stingrey $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html 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( '_VALID_MOS' ) or die( 'Restricted access' );
$option = mosGetParam( $_REQUEST, 'option' );
$task = mosGetParam( $_REQUEST, 'task' );
$id = intval( mosGetParam( $_REQUEST, 'id', null ) );
$now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 );
if ($option == 'com_content' && $task == 'view' && $id) {
// select the meta keywords from the item
$query = "SELECT metakey"
. "\n FROM #__content"
. "\n WHERE id = $id"
;
$database->setQuery( $query );
if ($metakey = trim( $database->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[] = $database->getEscaped( $key );
}
}
if (count( $likes )) {
// select other items based on the metakey field 'like' the keys found
$query = "SELECT id, title"
. "\n FROM #__content"
. "\n WHERE id != $id"
. "\n AND state = 1"
. "\n AND access <= $my->gid"
. "\n AND ( metakey LIKE '%" . implode( "%' OR metakey LIKE '%", $likes ) ."%' )"
. "\n AND ( publish_up = '$nullDate' OR publish_up <= '$now' )"
. "\n AND ( publish_down = '$nullDate' OR publish_down >= '$now' )"
;
$database->setQuery( $query );
if ( $related = $database->loadObjectList() ) {
?>
<ul>
<?php
foreach ($related as $item) {
if ($option="com_content" && $task="view") {
$Itemid = $mainframe->getItemid($item->id);
}
$href = sefRelToAbs( "index.php?option=com_content&task=view&id=$item->id&Itemid=$Itemid" );
?>
<li>
<a href="<?php echo $href; ?>">
<?php echo $item->title; ?></a>
</li>
<?php
}
?>
</ul>
<?php
}
}
}
}
?>
The same content is in 2 releases, Joomla 1.0.6 to 1.0.7. See them all, or every version of this file.