function mail_pp($row, $cn, $pp, $action) { global $AUTH_uid; $uid = $AUTH_uid ? $AUTH_uid : core_getConfig("robotUID"); $tit = $action == "Reminder" ? "Preprint {$row['Status']} " . long_date_and_time_string((int) $row["Tm"]) . " (" . core_deltaTime(time(), (int) $row["Tm"]) . " ago) but has not being completed yet.\n\n" . "URL: " . mail_ppURL($row["RowId"]) : "Preprint {$action} " . long_date_and_time_string((int) $row["Tm"]); return join("\n", array($tit, "Number: {$pp}", "Field: " . $GLOBALS["NOR_fields"][$row["Field"]], "Owner: {$cn}", "Title: " . $row["Title"], "Authors: " . $row["Authors"], "{$action} by " . uid2gecos($uid))); }
function logIt($type, $text, $submitter = "") { global $dbClass, $AUTH_uid; if ($type) { $dbClass->query("INSERT INTO " . PP_LOGTABLE . " (type,time,uid,text,ip) " . "VALUES ('{$type}'," . time() . ",'" . ($AUTH_uid ? $AUTH_uid : core_getConfig("robotUID")) . "','{$text} {$submitter}','{$_SERVER['REMOTE_ADDR']}')"); } }
function core_importantMessagePrinter($txt, $h1, $body) { $w = core_getConfig('errorWidth', 'width=70%'); # $c = 'class=log2'; $t = new table("{$w} cellpaddindg=50 cellspacing=0 {$c}", " <br>"); $t->tr($c, $c, x("{$h1} class=darkgray", $txt, True) . x('i', x('font class=darkgray', ' ' . eregi_replace('<br>', '<br> ', $body)))); $t->close("<br>"); }
function sendReminder() { global $dbClass, $row; $action = "reminder"; if ($_SESSION[$action][$action]++) { return; } $remindingPeriod = core_getConfig("remindingPeriod", 7 * 24 * 3600); // a week if ($q = getPendingPreprints("Tm < " . (time() - $remindingPeriod))) { while ($row = $dbClass->next_record($q)) { $pp = pp_preprintID($row["Year"], $row["Report"]); $gecos = uid2gecos($row["Id"]); if (core_getoption("CLI")) { print sprintf("%-15s %-25s %-15s %s \n", $pp, uid2login($row["Id"]), $gecos, long_date_and_time_string($row["Tm"])); } $l = $dbClass->query("SELECT * FROM " . PP_LOGTABLE . " WHERE text REGEXP '" . $pp . " ' " . "AND type = '" . $action . "' ORDER BY time DESC"); $tobeSent = !$dbClass->num_rows($l); while ($log = $dbClass->next_record($l)) { if ((int) $log["time"] > time() - $remindingPeriod) { break; } $tobeSent = True; } if ($tobeSent) { logIt($action, $pp, $gecos); mailReminder(); } } } }
function header() { $this->author = join("@", array(core_getConfig("developperLogin", "yb"), core_flavor2domain())); $this->parse_GET(); }
public static function showMailsSent() { if (!empty(self::$sentMails)) { $t = new table("cellpadding='5' cellspacing='0' bgcolor='yellow' " . core_getConfig("errorWidth", "width=70%")); $t->tro(); $t->th("colspan=3", "Important message"); $t->trc(); $many = count(self::$sentMails) > 1; $t->tr("", "colspan=3", "We have sent the following e-mail" . ($many ? "s" : "") . " (see below) with an important information.<br>" . "Please make sure that " . ($many ? "these e-mails are" : "this e-mail is") . " not considered as spam by the mail filter and that<br>" . ($many ? "they reach" : "it reaches") . " the address you indicated.<br>"); $t->tro(); $t->th("", " "); $t->th("", $t->x("i", "To:")); $t->th("", $t->x("i", "Subject:")); $t->trc(); foreach (self::$sentMails as $to => $v) { if (!$v || (int) $to) { continue; } foreach ($v as $k => $subject) { $t->tro(); $t->td(); $t->td("", $to); $t->td("", $subject); $t->trc(); $to = ""; } } $t->close(); } }
function showMailsSent() { global $apps_listOfEmails; if ($apps_listOfEmails) { $t = new table("cellpadding='5' cellspacing='0' bgcolor='yellow' " . core_getConfig('errorWidth', 'width=70%')); $t->tro(); $t->th('colspan=3', 'Important message'); $t->trc(); $many = count($apps_listOfEmails) > 1; $t->tr('', 'colspan=3', 'We have sent the following e-mail' . ($many ? 's' : '') . ' (see below) with an important information.<br>' . 'Please make sure that ' . ($many ? 'these e-mails are' : 'this e-mail is') . ' not considered as spam by the mail filter and that<br>' . ($many ? 'they reach' : 'it reaches') . ' the address you indicated.<br>'); $t->tro(); $t->th('', ' '); $t->th('', $t->x('i', "To:")); $t->th('', $t->x('i', "Subject:")); $t->trc(); foreach ($apps_listOfEmails as $to => $v) { if (!$v || (int) $to) { continue; } foreach ($v as $k => $subject) { $t->tro(); $t->td(); $t->td('', $to); $t->td('', $subject); $t->trc(); $to = ''; } } $t->close(); } }