| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/eadsa/plugins/content/ |
Upload File : |
<?php
/**
* MOSIMAGELINK.PHP July 2006 Version 1.5
* -----------------------------------------------------------
* Copyright by Thomas Kahl
* FOR JOOMLA 1.0.x and MAMBO 4.5.1 and 4.5.2
* -----------------------------------------------------------
* This mambot links the first image found in the introtext to
* the full article (if there is one)
* -----------------------------------------------------------
* author Thomas Kahl (aka ZorkHH)
* website: www.joomlaexpert.com
* email : tk@thomas-kahl.net
* -----------------------------------------------------------
* USAGE : Install with Mambo-Admin.
* DON'T FORGET TO PUBLISH THE MAMBOT!
**/
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$_MAMBOTS->registerFunction( 'onPrepareContent', 'botimagelink' );
function botimagelink( $published, &$row, &$params, $page=0 ) {
global $task, $_Itemid, $ItemidCount, $mainframe, $database;
// Is there anything to do for us?
if (!$published | $task=="view" | ($botpos=strpos(strtolower($row->text),"{mosimage}")===false && $imgpos=strpos(strtolower($row->text),"<img")===false)) return true;
// We have to search for the fulltext after Joomla 1.0.4
$query="SELECT `fulltext` FROM `#__content` WHERE `id` =".$row->id;
$database->setQuery($query);
$checkfulltext=$database->loadResult();
if (!$checkfulltext) return true;
// which one is first
if ($botpos<$imgpos && $botpos<>"") {
$botname=substr($row->text,strpos(strtolower($row->text),"{mosimage"));
$botname=substr($botname,0,strpos(strtolower($botname),"}")+1);
} else {
$botname=substr($row->text,strpos(strtolower($row->text),"<img "));
$botname=substr($botname,0,strpos(strtolower($botname),">")+1);
}
$_Itemid = $mainframe->getItemid( $row->id, 0, 0, 1, 1, 1 );
$output='<a href="index.php?option=com_content&task=view&id='.$row->id.'&Itemid='.$_Itemid.'">'.$botname.'</a>';
$row->text=str_replace($botname,$output,$row->text);
return true;
}
?>