<?php
  ///////////////////////////////////////////////////
  //2008 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("../lang/".$lang."/".$lang.".php")) include "../lang/".$lang."/".$lang.".php";
     else include "../lang/ru/ru.php";

  require_once "../config.php";

  if(empty($_GET['res_id'])) puterror2($TEXT['error-res10']);
  if(strlen($_GET['res_id'])>11) puterror2($TEXT['error-res11']);
  $_GET['res_id'] = rep($_GET['res_id']);

?>
<html>
<head>
<meta http-equiv="Expires" content="Mon, 23 May 1995 02:00:00 GMT" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo $description; ?>" />
<meta name="keywords" content="<?php echo $keywords; ?>" />
<link rel="icon" href="../../Favicon/user.ico" type="image/x-icon" />
<link rel="shortcut icon" href="../../Favicon/user.ico" type="image/x-icon" />
<title><?php echo $TEXT['whois-title']; ?></title>
<link rel="StyleSheet" type="text/css" href="../../utils/reader.css" />
</head>
<body>
<?php
  $query_tmp = "SELECT tbl_resource.*, tbl_organizaciya.organizaciya, tbl_sizes.size_name 
  FROM tbl_resource 
  JOIN tbl_organizaciya ON tbl_resource.org_id=tbl_organizaciya.org_id 
  JOIN tbl_sizes ON tbl_resource.size_id=tbl_sizes.size_id 
  WHERE tbl_resource.res_id='".$_GET['res_id']."'";
  $result = mysql_query($query_tmp);
  if(!$result) puterror2($TEXT['error-tbl16']);
  $result_resource = mysql_fetch_array($result,MYSQL_ASSOC);
   if(mysql_num_rows($result)>0);
         {
          $org_name = $result_resource['organizaciya'];
          $size_name = $result_resource['size_name'];

         if($result_resource['visible']=='show') $res_vis=$TEXT['res-visible'];
           else $res_vis=$TEXT['res-invisible'];

  $dog = "@";

  $query = "SELECT tbl_users.user_id, tbl_users.room, tbl_users.familiya, tbl_users.name, tbl_users.otchestvo, tbl_users.mail, tbl_users.phone_mob, tbl_users.phone_int, tbl_users.phone_city, tbl_users.photo, tbl_dolzhnost.dolzhnost, tbl_domain.domain, tbl_city.city, tbl_street.street, tbl_house.house, tbl_organizaciya.organizaciya, tbl_upravlenie.upravlenie, tbl_otdel.otdel 
FROM tbl_users 
JOIN tbl_dolzhnost ON tbl_users.dol_id=tbl_dolzhnost.dol_id 
JOIN tbl_domain ON tbl_users.dom_id=tbl_domain.dom_id 
JOIN tbl_city ON tbl_users.city_id=tbl_city.city_id 
JOIN tbl_street ON tbl_users.str_id=tbl_street.str_id 
JOIN tbl_house ON tbl_users.house_id=tbl_house.house_id 
JOIN tbl_organizaciya ON tbl_users.org_id=tbl_organizaciya.org_id 
JOIN tbl_upravlenie ON tbl_users.upr_id=tbl_upravlenie.upr_id 
JOIN tbl_otdel ON tbl_users.otd_id=tbl_otdel.otd_id 
WHERE user_id = '".$result_resource['user_id']."'";
  $users = mysql_query($query);
         if(!$users) puterror2($TEXT['error-tbl2']);
            $user = mysql_fetch_array($users,MYSQL_ASSOC);

               $room = $user['room'];
               $familiya = $user['familiya'];
               $name = $user['name'];
               $otchestvo = $user['otchestvo'];
               $mail = $user['mail'];
               $phone_mob = $user['phone_mob'];
               $phone_int = $user['phone_int'];
               $phone_city = $user['phone_city'];
               $res_dol = $user['dolzhnost'];
               $res_dom = $user['domain'];
               $email = $mail.$dog.$res_dom;
               $res_cit = $user['city'];
               $res_str = $user['street'];
               $res_hou = $user['house'];
               $res_org = $user['organizaciya'];
               $res_upr = $user['upravlenie'];
               $res_otd = $user['otdel'];

              if(!empty($user['photo']) && $user['photo']!="-") $result_image = "<img width='130' height='185' src='../../photo/".$user['photo']."' />";
               else $result_image = "<img width='130' height='185' class=photo src='../../img/nophoto.png' />";

                   if(!empty($res_cit) && $res_cit!=="-"){$cit = "&nbsp;".$TEXT['user-city']."&nbsp;".$res_cit.",&nbsp;";}
                    else $cit = "";

                   if(!empty($res_str) && $res_str!=="-"){$str = $TEXT['user-str']."&nbsp;".$res_str.",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";}
                     else $str = "";

                   if(!empty($res_hou) && $res_hou!=="-"){$hou = $TEXT['user-home']." ".$res_hou;}
                     else $hou = "";

                   if(!empty($room) && $room!=="-"){$rum = ",&nbsp;".$TEXT['user-room']." ".$room;}
                     else $rum = "";

        echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'> ";
        echo "<tr valign=top><td width='20%' rowspan='11'>$result_image</td></tr>";
        if(!empty($familiya)) echo "<tr align=top><td width='80%' class='texttableusrtit'>$familiya&nbsp;$name&nbsp;$otchestvo</td></tr>";
        if($cit!=="" || $str !== "" || $hou !== "" || $rum !== "")  echo "<tr valign=top><td width='80%' class='about'>".$TEXT['user-adrr']."<span class='texttableusr'>".$cit."".$str."".$hou."".$rum."</span></td></tr>";
        if(!empty($res_org)) echo "<tr valign=top><td width='80%' class='about'>".$TEXT['search-org']."<span class='texttableusr'>&nbsp;$res_org</i></b></td></tr>";
        if(!empty($res_upr) && $res_upr!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['search-upr']."<span class='texttableusr'>&nbsp;$res_upr</span></td></tr>";
        if(!empty($res_otd) && $res_otd!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['search-otd']."<span class='texttableusr'>&nbsp;$res_otd</span></td></tr>";
        if(!empty($res_dol) && $res_dol!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['search-dol']."<span class='texttableusr'>&nbsp;$res_dol</span></td></tr>";
        if(!empty($phone_mob) && $phone_mob!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['user-tel-mob']."<span class='texttableusr'>&nbsp;$phone_mob</span></td></tr>";
        if(!empty($phone_city) && $phone_city!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['user-tel-city']."<span class='texttableusr'>&nbsp;$phone_city</span></td></tr>";
        if(!empty($phone_int) && $phone_int!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['user-tel-int']."<span class='texttableusr'>&nbsp;$phone_int</span></td></tr>";
        if(!empty($mail)) echo "<tr valign=top><td width='80%' class='about'>".$TEXT['user-e-mail']."<span class='texttableusr'>&nbsp;<a href=mailto:$email>$email</span></td></tr>";
        echo "</table>";
        echo "<hr />";
        echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
        if(!empty($result_resource['ukk']) && $result_resource['ukk']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field5'].":&nbsp;<span class='texttableusr'>".$result_resource['ukk']."</span></td></tr>";
        if(!empty($result_resource['resource']) && $result_resource['resource']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field3'].":&nbsp;<span class='texttableusr'>".$result_resource['resource']."</span></td></tr>";
        if(!empty($result_resource['description']) && $result_resource['description']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['tbl-descr'].":&nbsp;<span class='texttableusr'>".$result_resource['description']."</span></td></tr>";
        if(!empty($result_resource['data']) && $result_resource['data']!=="0000-00-00") echo "<tr valign=top><td class='about' >".$TEXT['res-mdata'].":&nbsp;<span class='texttableusr'>".date('d.m.Y',strtotime($result_resource['data']))."</span></td></tr>";
        if(!empty($org_name) && $org_name!=="-") echo "<tr valign=top><td class='about' align='right'>".$TEXT['tbl-org'].":&nbsp;<span class='texttableusr'>".$org_name."</span></td></tr>";
        if(!empty($result_resource['visible']) && $result_resource['visible']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['tbl-visible'].":&nbsp;<span class='texttableusr'>".$res_vis."</span></td></tr>";
        if(!empty($result_resource['srvname']) && $result_resource['srvname']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field6'].":&nbsp;<span class='texttableusr'>".$result_resource['srvname']."</span></td></tr>";
        if(!empty($result_resource['srvput']) && $result_resource['srvput']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field7'].":&nbsp;<span class='texttableusr'>".$result_resource['srvput']."</span></td></tr>";
        if(!empty($result_resource['gread']) && $result_resource['gread']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field8'].":&nbsp;<span class='texttableusr'>".$result_resource['gread']."</span></td></tr>";
        if(!empty($result_resource['gwrite']) && $result_resource['gwrite']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field9'].":&nbsp;<span class='texttableusr'>".$result_resource['gwrite']."</span></td></tr>";
        if(!empty($result_resource['sppubl']) && $result_resource['sppubl']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field10'].":&nbsp;<span class='texttableusr'>".$result_resource['sppubl']."</span></td></tr>";
        if(!empty($result_resource['srvkvota']) && $result_resource['srvkvota']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field11'].":&nbsp;<span class='texttableusr'>".$result_resource['srvkvota']."&nbsp;".$size_name."</span></td></tr>";
        if(!empty($result_resource['bakup']) && $result_resource['bakup']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field12'].":&nbsp;<span class='texttableusr'>".$result_resource['bakup']."</span></td></tr>";
        if(!empty($result_resource['rezim']) && $result_resource['rezim']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field13'].":&nbsp;<span class='texttableusr'>".$result_resource['rezim']."</span></td></tr>";
        if(!empty($result_resource['bakrazm']) && $result_resource['bakrazm']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field14'].":&nbsp;<span class='texttableusr'>".$result_resource['bakrazm']."</span></td></tr>";
        if(!empty($result_resource['bakprog']) && $result_resource['bakprog']!=="-") echo "<tr valign=top><td class='about' >".$TEXT['res-field15'].":&nbsp;<span class='texttableusr'>".$result_resource['bakprog']."</span></td></tr>";
        if(!empty($result_resource['photo']) && file_exists("../".$result_resource['photo'])) echo "<tr valign=top><td class='about' >".$TEXT['tbl-doc'].":&nbsp;<span class='texttableusr'><a href='../".$result_resource['photo']."' target=_blank title='".$TEXT['tbl-doc']."''>".$TEXT['tbl-link']."</span></a></td></tr>";
       echo "<tr valign=right><td class='about'><a  href=# onClick='self.close()' title='".$TEXT['user-close-tit']."'><span class='texttableusr'>".$TEXT['user-close']."</span></a></td></tr>";
        echo "</table>";
        }

  require_once "../util/bottom.php";
?>