<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

include __DIR__ . DIRECTORY_SEPARATOR . 'system.inc.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.Services.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.Sms.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.Sva.Log.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.Sva.Tool.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.mail.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/class.phpmailer.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/class.pop3.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/class.smtp.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'commons/utilities.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.MMG.Management.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.Asterisk.Management.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.Asterisk.cust.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.Xml.Handler.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'libs/PHPExcel/IOFactory.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . "libs/class.writeexcel_workbook.inc.php";
require_once __DIR__ . DIRECTORY_SEPARATOR . "libs/class.writeexcel_worksheet.inc.php";

$svaLog = new SVALog($cfg['web.log.path'], $cfg['web.log.filename'], $cfg['web.log.level']);

$xmlHandler = new xmlHandler($svaLog);

switch ($cfg['db.type']) {

    case 0 : include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.mysql.json.php';
        $dba = new MysqlJson($cfg['db.host'], $cfg['db.username'], $cfg['db.password'], $cfg['db.database'], NULL, $svaLog);

        break;
    case 1 : include __DIR__ . DIRECTORY_SEPARATOR . 'libs/Class.oracle.json.php';
        $dba = new DBAccess($cfg['db.host'], $cfg['db.username'], $cfg['db.password'], $cfg['db.database'], $cfg['db.tnsname'], $svaLog);
        break;
}
$adm = new MMGManagement($dba);
$manager = new ASM();
$custAstManager = new AsteriskCustom($cfg['ast.host'], $cfg['ast.username'], $cfg['ast.password'], $cfg['ast.port'], $svaLog);

$mailAction = new mailAction($cfg['mail.server.hostname'], $cfg['mail.server.port'], $cfg['mail.server.username'], $cfg['mail.server.password'], $globalSender, $globalName);

?>
