<?php
function x_9x($x_9y) { 
$x_9z = kerio('webiface::PhpNonAuth'); 
$x_9z->decodeUrl($x_9y, &$x_2); 
unset($x_9z); 
return $x_2; 
} 
function x_a0($x_2) { 
if ($x_2) { 
header('HTTP/1.0 302 Found'); 
header('location: '.$x_2); 
exit('If your browser does not redirect automatically, please click this link: <a href="'.$x_2.'">'.$x_2.'</a>'); 
} else return false; 
} 
function x_a1($x_a2 = false) { 
$x_2 = $_SERVER['HTTP_REFERER']; 
if (!$x_2) { 
$x_2 = '/nonauth/login.php?'; 
if (trim($_REQUEST['dest']) != '') { 
$x_2 .= 'dest='.$_REQUEST['dest']; 
} 
} 
elseif (false === strpos($x_2, '?')) { 
$x_2 .= '?'; 
} 
if (false === strpos($x_2, 'fail') && !$x_a2) { 
$x_2 .= '&fail'; 
} 
if ($x_a2) { 
$x_2 .= '&NTLM=0'; 
} 
if (false === strpos($x_2, 'internal=')) { 
$x_2 .= '&internal='.$_REQUEST['internal']; 
} 
return x_a0($x_2); 
} 
$x_1 = kerio('webiface::PhpSession'); 
if ($x_1) { 
$x_2 = '/index.php'; 
if (trim($_REQUEST['dest']) != '') { 
$x_2 = x_9x($_REQUEST['dest']); 
} 
if (!x_a0($x_2)) { 
header('HTTP/1.0 500 Server error'); 
die('Server error: Invalid URL!'); 
} 
} 
else { 
if (!x_a1($x_a3)) { 
header('HTTP/1.0 500 Server error'); 
die('Server error: Invalid URL!'); 
} 
} 
?>