<?php
require_once('config.inc'); 
require_once(CORE_PATH . 'langHeader.inc'); 
require_once(CORE_PATH . 'translate.inc'); 
require_once(NONAUTH_LIB_PATH . 'Language.inc'); 
require_once(CORE_PATH . 'common.inc'); 
require_once(LIB_PATH . 'Page.inc'); 
function x_3m($x_3n = Array()) { 
if (!is_array($x_3n)) { 
$x_3n = Array(); 
} 
$x_3o = Array('java' => 0, 'applet' => 0, 'script' => 0, 'popup' => 0, 'referer' => 0); 
foreach ($x_3o as $x_3p => $x_3q) { 
if (!array_key_exists($x_3p, $x_3n) || 
(array_key_exists($x_3p, $x_3n) && intval($x_3n[$x_3p]) != 1)) { 
$x_3o[$x_3p] = 0; 
} else { 
$x_3o[$x_3p] = 1; 
} 
} 
return $x_3o; 
} 
class x_3r { 
private $x_33; 
public function __construct($x_33) { 
$this->x_33 = $x_33; 
} 
public function sort($x_3s, $x_3t) { 
$x_3s = $x_3s['name']; 
$x_3t = $x_3t['name']; 
if ($x_3s == $x_3t) { 
return 0; 
} 
$x_3u = array($x_3s, $x_3t); 
kerio_sort($this->x_33, &$x_3u); 
$x_3u = array_values($x_3u); 
return ($x_3s == $x_3u[0])?-1:1; 
} 
} 
if (!$x_1) { 
exit(); 
} else { 
$x_3v = $_REQUEST['target']; 
$x_1->getCsrf(&$x_s); 
$x_t = $_POST['x_u']; 
if ('' == $x_t || ($x_t != $x_s)) { 
exit(); 
} 
switch ($x_3v) { 
case 'x_3w': 
$x_3x = urldecode($_POST['x_3y']); 
$x_3q = urldecode($_POST['x_3z']); 
$x_1->setSessionVariable($x_3x, $x_3q); 
$x_1->getSessionVariable($x_3x, &$x_g); 
break; 
case 'x_40': 
$x_41 = urldecode($_POST['x_42']); 
if (0 == $x_5) { 
$x_1->setUserLanguageConf($x_41); 
} 
$x_v = new x_w(); 
$x_v->x_x('window.top.location = "index.php";'); 
$x_v->x_1o('Lang changed to: ' . $x_41); 
$x_v->x_y(); 
break; 
case 'x_43': 
$x_3n = x_3m($_POST['wwwFilter']); 
if (0 == $x_5) { 
$x_1->setUserWwwFilter($x_3n); 
} 
$x_3k = Array(); 
$x_3k['page'] = 'prefs'; 
$x_3k['htmlDoc'] = 0; 
require_once('processTemplate.php'); 
break; 
case 'x_44': 
$x_45 = $x_1->isPasswdChangeable(); 
$x_46 = Array('status' => 0, 'statusText' => '', 'reasonText' => ''); 
$x_v = new x_w(); 
$x_v->x_b = Array(SCRIPT_PATH . 'main.js'); 
if ($x_45 != 0) { 
$x_3k = Array(); 
$x_3k['oldPwd'] = $_POST['x_47']; 
$x_3k['newPwd'] = $_POST['x_48']; 
$x_3k['newPwdRetype'] = $_POST['x_49']; 
if ($x_3k['newPwd'] != $x_3k['newPwdRetype']) { 
$x_46 = Array( 'status' => 0, 
'statusText' => x_4a('lang_pwd_change_error'), 
'reasonText' => x_4a('lang_pwd_incorrect')); 
} else { 
$x_4b = 0; 
if (0 == $x_5) { 
$x_4b = $x_1->changePasswd($x_3k['newPwd'], $x_3k['oldPwd']); 
} 
if ($x_4b != 0) { 
$x_46 = Array( 'status' => 1, 
'statusText' => x_4a('lang_pwd_change_success'), 
'reasonText' => x_4a('lang_pwd_changed')); 
} else { 
$x_46 = Array( 'status' => 0, 
'statusText' => x_4a('lang_pwd_change_error'), 
'reasonText' => x_4a('lang_pwd_incorrect')); 
} 
} 
} else { 
$x_46 = Array( 'status' => 0, 
'statusText' => x_4a('lang_pwd_change_error'), 
'reasonText' => x_4a('pwd_change_impossible')); 
} 
$x_v->x_x('window.top.x_4c(' . $x_46['status'] . ',


															"' . addslashes(x_4d($x_46['statusText'])) . '",


															"' . addslashes(x_4d($x_46['reasonText'])) . '");'); 
$x_v->x_y(); 
break; 
case 'x_4e': 
$x_4f = $_REQUEST['x_4g']; 
$x_4h = kerio('webiface::PhpRasController'); 
if (!$x_4h || !$x_4f) { 
die(json_encode(array('x_4i'=>false))); 
} else { 
die(json_encode(array( 
'x_4i' => $x_4h->connect($x_4f) 
))); 
} 
break; 
case 'x_4j': 
$x_4f = $_REQUEST['x_4g']; 
$x_4h = kerio('webiface::PhpRasController'); 
if (!$x_4h || !$x_4f) { 
die(json_encode(array('x_4i'=>false))); 
} else { 
die(json_encode(array( 
'x_4i' => $x_4h->disconnect($x_4f) 
))); 
} 
break; 
case 'x_4k': 
$x_4h = kerio('webiface::PhpRasController'); 
if (!$x_4h) { 
die(json_encode(array('x_4l' => 'noRights'))); 
} else { 
$x_4h->getList(&$x_4m); 
$x_33 = new x_4n(); 
$x_4o = array(); 
foreach ($x_4m as $x_4h) { 
$x_4h['id'] = addslashes($x_4h['id']); 
$x_4h['name'] = htmlspecialchars($x_4h['name']); 
$x_4h['bytesIn'] = x_4p(x_4q($x_4h['bytesIn']), $x_33->x_4r()); 
$x_4h['bytesOut'] = x_4p(x_4q($x_4h['bytesOut']), $x_33->x_4r()); 
$x_4h['time'] = x_4s($x_4h['time'], $x_33->x_4t(), $x_33->x_4u()); 
$x_4o[] = $x_4h; 
} 
$x_4v = new x_3r($x_33->x_4w); 
usort(&$x_4o, array($x_4v, 'sort')); 
die(json_encode(array('x_4x'=>array_values($x_4o)))); 
} 
break; 
default: 
exit(); 
break; 
} 
} 
?>
