} ini_set("include_path", $include_path); include_once "{$config}.inc"; require_once "sql.inc"; require_once "template.inc"; require_once "user.inc"; require_once "textwrap.inc"; require_once "mailfrom.inc"; $tpl = new Template($template_dir, "comment"); $tpl->set_file("mail", "mail/offtopic.tpl"); db_connect(); if (!ini_get('safe_mode')) { set_time_limit(0); } $sth = db_query("select * from f_forums"); while ($f = $sth->fetch()) { $forums[$f['fid']] = $f; } $sth->closeCursor(); $sth = db_query("select * from f_offtopic where UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(tstamp) > 10 * 60"); while ($msg = $sth->fetch()) { $nuser = new User(); $nuser->find_by_aid((int) $msg['aid']); $tpl->set_var(array("EMAIL" => $nuser->email, "FORUM_SHORTNAME" => $forums[$msg['fid']]['shortname'], "MSG_MID" => $msg['mid'], "PHPVERSION" => phpversion())); $e_message = $tpl->parse("MAIL", "mail"); $e_message = textwrap($e_message, 78, "\n"); mailfrom("followup-" . $nuser->aid . "@" . $bounce_host, $nuser->email, $e_message); unset($nuser); db_exec("delete from f_offtopic where fid = ? and mid = ?", array($msg['fid'], $msg['mid'])); } $sth->closeCursor();
$sql = "select subject from f_messages{$iid} where mid = ?"; $row = db_query_first($sql, array($thread['mid'])); list($t_subject) = $row; $e_message = substr($msg['message'], 0, 1024); if (strlen($msg['message']) > 1024) { $bytes = strlen($msg['message']) - 1024; $plural = $bytes == 1 ? '' : 's'; $e_message .= "...\n\nMessage continues for another {$bytes} byte{$plural}\n"; } $tpl->set_var(array("THREAD_SUBJECT" => $t_subject, "USER_NAME" => $user->name, "HOST" => $_url, "FORUM_NAME" => $forum['name'], "FORUM_SHORTNAME" => $forum['shortname'], "MSG_MID" => $msg['mid'], "MAIL_MSG_SUBJECT" => $msg['subject'], "MAIL_MSG_MESSAGE" => $e_message, "PHPVERSION" => phpversion())); do { $uuser = new ForumUser($track['aid']); $tpl->set_var("EMAIL", $uuser->email); $e_message = $tpl->parse("MAIL", "mail"); $e_message = textwrap($e_message, 78, "\n"); mailfrom("followup-" . $track['aid'] . "@" . $bounce_host, $uuser->email, $e_message); } while ($track = $sth->fetch()); } $sth->closeCursor(); /* $_page set by main.php from $_REQUEST */ if (!isset($_page) || empty($_page)) { $tpl->set_var("refresh_page", ""); } /* FIXME: Dumb workaround */ /* ??? why are we not getting $_page from $tpl here, like we do for $_domain * here and $_page in showforum and tracking? */ unset($tpl->varkeys["PAGE"]); unset($tpl->varvals["PAGE"]); $_domain = $tpl->get_var("DOMAIN"); unset($tpl->varkeys["DOMAIN"]); unset($tpl->varvals["DOMAIN"]);