<?php
/**
 * Setup 2-factor authentication
 *
 * @category   DMS
 * @package    SeedDMS
 * @license    GPL 2
 * @version    @version@
 * @author     Uwe Steinmann <uwe@steinmann.cx>
 * @copyright  Copyright (C) 2016 Uwe Steinmann
 * @version    Release: @package_version@
 */

if(!isset($settings))
	require_once("../inc/inc.Settings.php");
require_once("inc/inc.Language.php");
require_once("inc/inc.Init.php");
require_once("inc/inc.Extension.php");
require_once("inc/inc.DBInit.php");
require_once("inc/inc.ClassUI.php");
require_once("inc/inc.Authentication.php");

$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);

if ($user->isGuest()) {
	UI::exitError(getMLText("2_factor_auth"),getMLText("access_denied"));
}

if($view) {
	$view->setParam('sitename', $settings->_siteName);
	$view->setParam('enable2factauth', $settings->_enable2FactorAuthentication);
	$view->setParam('accessobject', $accessop);
	$view($_GET);
	exit;
}
