- md5
- 9fd0cfbd6f7380fa9f3f43815e8a15f0
- sha1
- 03cfe95ff3fa9a8329cf6648cc760569d1211f72
- sha256
- b5bdb1639332a6de58edb69d21272bc7b1f5f8a3cc6197403100e419963b3c7d
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
<?php
/**
* @version $Id: mod_related_items.php 393 2005-10-08 13:37:52Z akede $
* @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 ) );
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 ) ."%' )"
;
$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
}
}
}
}
?>
No other release has this exact content. See every version of this file.