X-Git-Url: https://git.infodrom.org/?p=misc%2Fhallinta-metro;a=blobdiff_plain;f=utils.php;h=45b1c935a2a2da6c8c5f565cf6c00fc10784c69c;hp=9e5e005ba0f4890087fd6189be5501a2a9e94470;hb=44602f0fd181b7789ba4c5289d5dd4bc2526c7b1;hpb=7c4605897a5784608744e2e99682ac7f730445f6;ds=sidebyside diff --git a/utils.php b/utils.php index 9e5e005..45b1c93 100644 --- a/utils.php +++ b/utils.php @@ -6,7 +6,17 @@ define('FNAME_VARS', 'ordersatz_vars.tex'); define('FNAME_ITEMS', 'ordersatz_items.tex'); define('FAXNUMBER','2002-364'); define('ERROR_SAFT','joey@finlandia'); -define('ERROR_MAIL','joey@finlandia'); +define('ERROR_MAIL','joey@finlandia.infodrom.org'); + +function is_done($id) +{ + global $db; + + $query = sprintf('SELECT count(*) AS count FROM metro_ordersatz WHERE id = %d AND done IS NULL', $id); + $sth = $db->query($query); + $row = $sth->fetch(); + return $row['count'] == 0; +} function mk_tempdir() { @@ -182,10 +192,10 @@ function ordersatz_write($id, $dir, $send) if ($ret !== 0) { $fname = sprintf("ordersatz-%d-%d.tar.bz2", $id, time()); $cmd = sprintf("tar cfj %s ordersatz.tex ordersatz_vars.tex ordersatz_items.tex ordersatz.out && " . - "mail -s 'Probleme beim Compilieren des Ordersatzes %d' %s < %s && " . + "mpack -s 'Probleme beim Compilieren des Ordersatzes %d' -d ordersatz.out %s %s && " . "sendfile -Q -c='Probleme beim Compilieren des Ordersatzes %d' %s %s", $fname, - $id, ERROR_MAIL, $fname, + $id, $fname, ERROR_MAIL, $id, $fname, ERROR_SAFT); system($cmd); return "Probleme beim Compilieren des Ordersatzes";