Hi,
We have had some problems with Nadmin's replication scripts,
this is useful function to check if the article is online.
<?php
function mgd_is_article_online($article) {
$midgard = mgd_get_midgard();
$host = mgd_get_host($midgard->host);
$article = mgd_get_article($article);
$start = $article->calstart;
$days = $article->caldays;
if ($article) {
$sh = $article->parameter("approve_time", "starthours");
$sm = $article->parameter("approve_time", "startminutes");
$eh = $article->parameter("approve_time", "endhours");
$em = $article->parameter("approve_time", "endminutes");
}
if ($start && ($start >= 1)) {
$de=explode(".",$start);
$su=mktime($sh,$sm,0,$de[1],$de[0],$de[2]);
if ($days) {
$eu=mktime($eh,$em,0,$de[1],$de[0]+$days,$de[2]);
} else {
$eu=mktime($eh,$em,0,$de[1],$de[0]+$days,2010);
}
}
if ($host->port == 8001) {
return 1;
}
if ($su) {
if ($su >= $article->approved) {
} elseif ($eu >= $article->approved) {
} else {
return 0;
}
} elseif ($article->revised == $article->approved) {
if (!$su) {
return 1;
}
} elseif ($article->approved >= $article->revised) {
if (!$su) {
return 1;
}
} elseif ($article->revised >= $article->approved) {
return 0;
}
if ($de[2] == 1900)
return 1;
$now=time();
if(($su<$now)
&& (($eu>$now)
|| !$days))
return 1;
return 0;
}
?>
--
Henri Hovi, Consultant Partner
Nemein Oy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]