Thanks perdu,
I am currently studying the code of this function and trying to find out were it is called and when.
In general, my hair on arm, legs and hair is standing up when something I use calls an external server and submits something from the user table in my DB specially if it is the admin account like this one does.
This is the code for the function checkupdate().
Code:
function checkupdate() {
$database = JFactory::getDBO();
$database->setQuery("SELECT MIN(id) from `#__users`");
$idmin = $database->loadResult();
$query = "SELECT params from #__users WHERE id=$idmin";
$database->setQuery($query);
$content = $database->loadResult();
$params = new JParameter($content);
if($params->get('checkUpdateVersDate')!=date("Ymd")){
$params->set('checkUpdateVersDate', date("Ymd"));
$content = $params->toString();
$query = "UPDATE `#__users` SET `params`='$content' WHERE `id`=$idmin";
$database->setQuery($query);
$database->query();
$datas = '$J#PRODUCT_KEY$,$J#OWNER$,'.JURI::base();
$req = "datas=$datas";
$url = '/checkversion.php';
$address = "www3.joomlart.com";
$port = 80;
$header = "POST $url HTTP/1.0\r\n";
$header .= "Host: $address\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen ($req) . "\r\n\r\n";
$fp = fsockopen($address,80);
if (!$fp) return false;
@fputs ($fp, $header . $req);
$res = '';
while (!@feof($fp)){
$res .=@ fgets ($fp, 1024);
}
@fclose ($fp);
preg_match('/\r\n\r\n(.+)$/m', $res, $regs);
//Get result
$lastestVers = $regs[1];
$lastestVers = explode( '-', $lastestVers);
//get content from .xml file
$filename = dirname(__FILE__).DS."templateDetails.xml";
if (file_exists($filename) && is_writable($filename)) {
$data = '';
$fh = fopen($filename, 'rb');
if ($fsize = filesize($filename)) {
$data = fread($fh, $fsize);
}
fclose($fh);
$posfirstVers = strpos($data, '<version>');
$poslastVers = strpos($data, '</version>');
$firstContent = substr($data, 0, $posfirstVers);
$lastContent = substr($data, $poslastVers+10);
$versContent = substr($data, $posfirstVers+9,
($poslastVers- $posfirstVers-9));
$curVers = explode('-', $versContent);
$curVers = count($curVers)?$curVers[0]:'1.0';
$lastVerContent = "<version>$curVers-<a href=\"".$lastestVers[0]."\" target=\"_blank\" >Lastest: ".$lastestVers[1]." </a></version>";
$newdatas = $firstContent.$lastVerContent.$lastContent;
if (($fh = @fopen($filename, 'w+', 1)) === false) {
return false;
}
$bytes = 0;
if (($bytes = @fwrite($fh, $newdatas)) === false) {
return false;
}
@fclose($fh);
}
}
}
}
Perhaps some one else (JA?) could explain what this is about.
Bosse
Bookmarks