<?php
include($_SERVER['DOCUMENT_ROOT'] .'/script/HeaderInc.php');
if('XMLHttpRequest' == $_SERVER['HTTP_X_REQUESTED_WITH'] && true === isset($_SESSION['SessionAuth']['id']) && 0 < $_SESSION['SessionAuth']['id']) {
  $VarLeftJoin = "t2.users_id = ''";
  if(true === isset($_GET['users_id']) && true === is_numeric($_GET['users_id'])){
    $ObjUsersMod = new UsersMod($MS_SP);
    $ArrUsers = $ObjUsersMod->GetFromDb('SqlAll', 'GetRow', "u.users_id = '". $_GET['users_id'] ."'");
    $smarty->assign('ArrUsers', $ArrUsers);
    $VarLeftJoin = "t2.users_id = '". $_GET['users_id'] ."'";
  }
  $VarWhere = '';
  if(false === isset($_SESSION['SessionAuth']['IpsAdmin']['reg']) || 1 != $_SESSION['SessionAuth']['IpsAdmin']['reg']){
    $VarWhere = "t1.webservices_session != 'IpsAdmin'";
  }
  $ObjWebServicesMod = new WebServicesMod($MS_SP);
  $ArrWebServices = $ObjWebServicesMod->GetFromDb('SqlAll', 'GetAll', $VarWhere, 't1.webservices_name', '', $VarLeftJoin);
  $smarty->assign('ArrWebServices', $ArrWebServices);

  $VarReturn = $smarty->fetch('Users/Form.tpl');
}
else{
  $VarReturn = $MS_SP->Sp_LangMessage['error']['ErrFuncAccessDenied'];
}
echo $VarReturn;
include($_SERVER['DOCUMENT_ROOT'] .'/script/FooterInc.php');
?>