File: cron_mailer.php

package info (click to toggle)
ocsinventory-server 2.5%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,088 kB
  • sloc: php: 27,462; perl: 8,241; sh: 1,680; sql: 1,355; xml: 1,041; makefile: 34
file content (31 lines) | stat: -rw-r--r-- 1,138 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/php

<?php
require_once('../dbconfig.inc.php');
require_once('../var.php');
require_once('../require/function_commun.php');
require_once('../require/mail/NotificationMail.php');
require_once('../require/config/include.php');
require_once('../require/fichierConf.class.php');


$_SESSION['OCS']["readServer"] = dbconnect(SERVER_READ, COMPTE_BASE, PSWD_BASE, DB_NAME);
$mail = new NotificationMail(DEFAULT_LANGUAGE);

$week = array('MON' => 'Monday', 'TUE' => 'Tuesday', 'WED' => 'Wednesday', 'THURS' => 'Thursday', 'FRI' => 'Friday', 'SAT' => 'Saturday', 'SUN' => 'Sunday');
$values = $mail->get_info_smtp();

foreach ($values as $key => $value){
  if(array_key_exists($value, $week)){
    $day[$week[$value]] = $week[$value];
  }
}

if($values['NOTIF_FOLLOW'] == 'ON' && $values['NOTIF_PROG_TIME'] == date('H:i') && array_key_exists(date('l'), $day)){
    $mail->config_mailer();
    $selected = $mail->get_notif_selected();
    $body_mail = $mail->get_all_information($selected);
    $mail->send_notification($body_mail[$selected]['SUBJECT'], $body_mail[$selected]['FILE'], $body_mail[$selected]['ALTBODY'], $selected);
}

?>