.+?<\/tr>/s', $buffer, $matches))
{
foreach ($matches as $match)
{
foreach ($match as $m)
{
if (preg_match('/
.+?(?P.+?)<\/td>(.+?right>(?P.+?) (?P.+?)<\/td.+?)?(?P.+?)<\/td.+?nfo<\/a>.+)?| (?P.+?)<\/td.+tr>/s', $m, $matches2))
{
$oldname = $db->queryOneRow(sprintf("SELECT title, source, ID FROM prehash WHERE title = %s", $db->escapeString($matches2["title"])));
if ($oldname["title"] == $matches2["title"])
{
if ($oldname["source"] == "womble")
{
continue;
}
else
{
if (!isset($matches2["size1"]) && empty($matches2["size1"]))
$size = "NULL";
else
$size = $db->escapeString($matches2["size1"].$matches2["size2"]);
if ($matches2["nfo"] == "")
$nfo = "NULL";
else
$nfo = $db->escapeString("http://nzb.isasecret.com/".$matches2["nfo"]);
$db->query(sprintf("UPDATE prehash SET nfo = %s, size = %s, category = %s, predate = FROM_UNIXTIME(".strtotime($matches2["date"])."), adddate = now(), source = %s where ID = %d", $nfo, $size, $db->escapeString($matches2["category"]), $db->escapeString("womble"), $oldname["ID"]));
$newnames++;
}
}
else
{
if (!isset($matches2["size1"]) && empty($matches2["size1"]))
$size = "NULL";
else
$size = $db->escapeString($matches2["size1"].$matches2["size2"]);
if ($matches2["nfo"] == "")
$nfo = "NULL";
else
$nfo = $db->escapeString("http://nzb.isasecret.com/".$matches2["nfo"]);
$db->query(sprintf("INSERT IGNORE INTO prehash (title, nfo, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $nfo, $size, $db->escapeString($matches2["category"]), $db->escapeString("womble"), $db->escapeString(md5($matches2["title"]))));
$newnames++;
}
}
}
}
}
}
return $newnames;
?> | | |