=== {$ax['cro_sum_header']} ~ ".IDtoDD(date("Y-m-d"))." {$ax['at_time']} ".date("H:i")." ===
=== {$ax['cro_sum_trailer']} ===
"; sendEml($subject,$msgBody,$set['calendarEmail'],1,0,0); } //end of Send cronjob summary //prevent abortion when run as command line script ignore_user_abort(true); //set working directory chdir(dirname(__FILE__)); //set user parameters $usr['vCats'] = '0'; //view: all categories $usr['eCats'] = ''; //edit: no categories //load config data require './lcconfig.php'; //load toolboxes require './common/messaging.php'; require './common/toolbox.php'; require './common/toolboxd.php'; //database tools //log start of cron job $message = "Cron job started - Cron host: ".($crHost == 0 ? 'local' : 'remote'); $message .= $crHost == 2 ? " - Required IP address: {$crIpAd}" : ''; $message .= ' - Remote IP address: '.(empty($_SERVER['REMOTE_ADDR']) ? 'None' : $_SERVER['REMOTE_ADDR']); logMessage('luxcal',3,$message,'lcalcron:'.__LINE__); //security check if(($crHost == 0 and !empty($_SERVER['REQUEST_METHOD'])) or //via local cron only, via browser not allowed ($crHost == 2 and $_SERVER['REMOTE_ADDR'] != $crIpAd)){ //via remote cron with fixed IP address logMessage('luxcal',0,'Aborted.'); //log abortion of cron job header("Location: index.php"); exit(); } if ($dbType == 'MySQL') { //MySQL if (!$dbH = dbConnect('void',0)) { exit('Could not connect to calendar database'); } //connect to db } //get calendars $calIDs = getCIDs(); if (empty($calIDs)) { exit('No calendars found in database'); } //load retrieve functions require './common/retrieve.php'; require './common/retrieve2.php'; //load cronjob functions require './cronjobs/notify.php'; require './cronjobs/sendchg.php'; require './cronjobs/expical.php'; require './cronjobs/eventchk.php'; require './cronjobs/userchk.php'; //run job for each calendar in the db foreach ($calIDs as $cID) { if ($dbType == 'SQLite') { //SQLite $dbH = dbConnect($cID); //connect to database } else { //MySQL $calID = $cID; //set current active calendar ID } //get settings from database $set = getSettings(); //load language files require_once './lang/ui-'.strtolower($set['language']).'.php'; require_once './lang/ai-'.strtolower($set['language']).'.php'; //set timezone date_default_timezone_set($set['timeZone']); $sumReport = ''; //1 - check for email notifications to be sent if ($set['emlService'] > 0) { $sentTo = cronNotifyEml(); $sumText = $sentTo ? $ax['cro_not_sent_to'].":\n".$sentTo : $ax['cro_no_reminders_due'].".\n"; $sumReport .= "".nl2br(trim($sumText))."
\n"; } //2 - check for SMS notifications to be sent if ($set['smsService'] > 0) { $sentTo = cronNotifySms(); $sumText = $sentTo ? $ax['cro_not_sent_to'].":\n".$sentTo : $ax['cro_no_reminders_due'].".\n"; $sumReport .= "".nl2br(trim($sumText))."
\n"; } //3 - check for calendar changes and mail change list if ($set['chgNofDays'] > 0) { $changes = 0; $sentTo = cronSendChg(); $sumText = "{$ax['cro_nr_changes_last']} {$set['chgNofDays']} {$ax['cro_days']}: {$changes}\n"; $sumText .= $sentTo ? "{$ax['cro_report_sent_to']}:\n{$sentTo}" : $ax['cro_no_report_sent'].".\n"; $sumReport .= "".nl2br(trim($sumText))."
\n"; } //4 - export events in iCalendar format to .ics file in 'files' folder if ($set['icsExport'] > 0) { $fileName = ''; $nrExported = cronExpIcal(); $sumText = "{$ax['cro_nr_events_exported']} {$fileName}: {$nrExported}.\n"; $sumReport .= "".nl2br(trim($sumText))."
\n"; } //5 - check for expired events which can be deleted if ($set['eventExp'] > 0) { $nrDeleted = cronEventChk(); $sumText = "{$ax['cro_nr_evts_deleted']}: {$nrDeleted}.\n"; $sumReport .= "".nl2br(trim($sumText))."
\n"; } //6 - check for unused user accounts if ($set['maxNoLogin'] > 0) { $nrRemoved = cronUserChk(); $sumText = ($nrRemoved > 0) ? "{$ax['cro_nr_accounts_deleted']}: {$nrRemoved}\n" : $ax['cro_no_accounts_deleted'].".\n"; $sumReport .= "".nl2br(trim($sumText))."
\n"; } if ($set['adminCronSum']) { //send cronjob summary to admin sendSum($sumReport); } } //log completion of cron job logMessage('luxcal',0,'OK.'); ?>