<?php
$sendemail = FALSE;
$folder = '../';

require_once($folder . '/maintenance/config.php');
require_once($folder . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php');

require_once($folder . '/maintenance/sync_maintenance.php');

require_once($folder . '/maintenance/sync_emailtopartners.php');
require_once($folder . '/maintenance/sync_switch.php');
require_once($folder . '/maintenance/sync_states.php');
require_once($folder . '/maintenance/sync_honapkepe.php');

$jmdb = 'jml';
require($folder . '/maintenance/sync_workshop.php');
require($folder . '/maintenance/sync_download.php');
require($folder . '/maintenance/sync_history.php');
require($folder . '/maintenance/sync_sendemail.php');
require($folder . '/maintenance/sync_fizetes.php');

$jmdb = 'eng';
require($folder . '/maintenance/sync_download.php');
require($folder . '/maintenance/sync_history.php');
require($folder . '/maintenance/sync_sendemail.php');

if ($sendemail == TRUE) {
  $msg = 'Hell� adminisztr�tor, <br />Szinkroniz�ci� lefutott. (sub)';
  $mail = new PHPMailer;
  //$mail->isSendmail();
  $mail->isSMTP();
  $mail->Host = $mailconfig['Host'];
  $mail->SMTPAuth = true;
  $mail->Username = $mailconfig['Username'];
  $mail->Password = $mailconfig['Password'];
  $mail->SMTPSecure = $mailconfig['SMTPSecure'];
  $mail->Port = $mailconfig['Port'];
  $mail->isHTML(TRUE);
  $mail->setFrom(DEFAULT_EMAIL);
  $mail->addAddress('webdeveloper@cadline.hu');
  $mail->Subject = 'Cron - sync';
  $mail->msgHTML($msg);
  $mail->AltBody = strip_tags($msg);
  $mail->send();
  unset($mail);
}

$strRes = file_get_contents("https://pay.archline.hu/cron.php?modules=BAR&action=subscription");
if (trim($strRes) > '') error_log($strRes, 3, "../logs/pay.txt");
