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(); } } } }
startPage("Managing preprints"); $time = time(); $date = getdate($time); $year = $date["year"]; core_declare_input("nor_pp_period", $year); /* * show the legend (edit, delete buttons) */ $my = $authClass->isAdmin() ? "" : " my"; define("PP_PENDING", "manage" . $my . " pending preprints"); define("PP_ALL", "manage all" . $my . " preprints"); /* * draw tabs */ $links = array(); if ($pendingHash = getPendingPreprints()) { $links[PP_PENDING] = $_SERVER["PHP_SELF"] . "?show=" . urlencode(PP_PENDING); } if ($allHash = getAllPreprints()) { if ($dbClass->num_rows($pendingHash) != $dbClass->num_rows($allHash)) { $links[PP_ALL] = $_SERVER["PHP_SELF"] . "?show=" . urlencode(PP_ALL); } } $tabs = new tabs(); $tabs->show($links); $t = new table("cellpadding='5'", "</center>"); if ($authClass->isAdmin() && $tabs->active == PP_ALL) { // provide the "year selection" option for ($i = $nor_pp_year0; $i <= $year; $i++) { $sel[] = x("option" . ($i == $nor_pp_period ? " selected='selected'" : ""), $i); }