<?php
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/json');

require_once (dirname(__FILE__). "/ImportController.php");

$database['connect'] = 'mysql:host=localhost;dbname=tasks';
$database['user'] = 'root';
$database['password'] = 'gc01mysql';

$imap['server'] = "{imap.1und1.de:993/imap/ssl}INBOX";
$imap['user'] = "status@global-cube.de";
$imap['password'] = "(6QNLU=7m3R?f2?6]JO4WH(K";

ob_start();
$importCtrl = new ImportController($database, $imap);
$importCtrl->Workflow();
$result = ob_get_contents();
if (trim($result) != "") {
	file_put_contents(dirname(__FILE__)."/logs/import_".date("Ymd_His").".log", $result);
}
ob_end_clean();

if ($importCtrl->fail) {
	die(23);
}