Code:function automated_news() {
global $prefix, $multilingual, $currentlang, $db;
// oprime2001 if ($multilingual == 1) {
// oprime2001 $querylang = "WHERE (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */
// oprime2001 } else {
// oprime2001 $querylang = "";
// oprime2001 }
$today = getdate();
$day = $today['mday'];
if ($day < 10) {
$day = "0$day";
}
$month = $today['mon'];
if ($month < 10) {
$month = "0$month";
}
$year = $today['year'];
$hour = $today['hours'];
$min = $today['minutes'];
$sec = "00";
// oprime2001 $result = $db->sql_query("SELECT anid, time FROM ".$prefix."_autonews $querylang");
$result = $db->sql_query("SELECT anid, time FROM ".$prefix."_autonews");
while (list($anid, $time) = $db->sql_fetchrow($result)) {
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $date);
if (($date[1] <= $year) AND ($date[2] <= $month) AND ($date[3] <= $day)) {
if (($date[4] < $hour) AND ($date[5] >= $min) OR ($date[4] <= $hour) AND ($date[5] <= $min)) {
$result2 = $db->sql_query("SELECT * FROM ".$prefix."_autonews WHERE anid='$anid'");
while ($row2 = $db->sql_fetchrow($result2)) {
$title = stripslashes(FixQuotes(check_html($row2['title'], "nohtml")));
$hometext = stripslashes(FixQuotes($row2['hometext']));
$bodytext = stripslashes(FixQuotes($row2['bodytext']));
$notes = stripslashes(FixQuotes($row2['notes']));
$catid2 = intval($row2['catid']);
$aid2 = $row2['aid'];
$time2 = $row2['time'];
$topic2 = $row2['topic'];
$informant2 = $row2['informant'];
$ihome2 = intval($row2['ihome']);
$alanguage2 = $row2['alanguage'];
$acomm2 = intval($row2['acomm']);
$associated2 = $row2['associated'];
// START - oprime2001 - removed check for duplicate titles
// $num = $db->sql_numrows($db->sql_query("SELECT sid FROM ".$prefix."_stories WHERE title='$title'"));
// if ($num == 0) {
$db->sql_query("DELETE FROM ".$prefix."_autonews WHERE anid='$anid'");
$db->sql_query("INSERT INTO ".$prefix."_stories VALUES (NULL, '$catid2', '$aid2', '$title', '$time2', '$hometext', '$bodytext', '0', '0', '$topic2', '$informant2', '$notes', '$ihome2', '$alanguage2', '$acomm2', '0', '0', '0', '0', '$associated2')");
$db->sql_freeresult($result2);
// }
// END - oprime2001 - removed check for duplicate titles
}
}
}
}
$db->sql_freeresult($result);
}
|