ソースを参照

add translation for all device pages

rajven 3 年 前
コミット
e6030b2176

+ 1 - 1
html/admin/devices/index.php

@@ -65,7 +65,7 @@ foreach ($switches as $row) {
 <table class="data">
 <tr><td><?php echo WEB_color_device_description; ?></td></tr>
 <tr>
-<td class="shutdown"><?php echo WEB_color_device_down; ?></td>
+<td class="shutdown"><?php echo WEB_device_down; ?></td>
 <td class="up"><?php echo WEB_color_device_online; ?></td>
 <tr>
 </table>

+ 1 - 1
html/admin/devices/portmactable.php

@@ -35,7 +35,7 @@ if ($port_info['vendor_id'] == 9) {
 
 if ($port_info['snmp_index'] > 0) {
     print "<table class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
-    print "<tr><td><b>".WEB_device_port_mac_table_show."</b></td></tr>\n";
+    print "<tr><td colspan=2><b>".WEB_device_port_mac_table_show."</b></td></tr>\n";
     if (! $port_info['fdb_snmp_index']) { $port_info['snmp_index'] = $port_info['port']; }
     $fdb = get_fdb_port_table($port_info['ip'], $port_info['snmp_index'], $port_info['community'], $port_info['snmp_version']);
     foreach ($fdb as $a_mac => $a_port) {

+ 1 - 1
html/admin/devices/snmpwalk.php

@@ -23,7 +23,7 @@ if (empty($v_clean)) { continue; }
 print "$v_data<br>";
 }
 print "<table  class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
-print "<tr><td><b>Interface index</b></td><td><b>Interface name</b></td></tr>\n";
+print "<tr><td><b>".WEB_snmp_interface_index."</div></b></td><td><b>".WEB_snmp_interface_name."</b></td></tr>\n";
 foreach ($interfaces as $key => $int) { 
 list ($v_type,$v_data)=explode(':',$int);
 print "<tr><td class=\"data\">$key</td><td class=\"data\"> $v_data</td></tr>"; 

+ 11 - 7
html/admin/devices/switchport-conn.php

@@ -3,7 +3,7 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
 
-$switch=get_record($db_link,'devices',"id=".$id);
+$device=get_record($db_link,'devices',"id=".$id);
 
 if (isset($_POST["remove"])) {
     $fid = $_POST["f_id"];
@@ -19,22 +19,26 @@ if (isset($_POST["remove"])) {
 
 unset($_POST);
 
+$user_info = get_record_sql($db_link,"SELECT * FROM User_list WHERE id=".$device['user_id']);
+
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
-print_editdevice_submenu($page_url,$id,$device['device_type']);
+
+print_device_submenu($page_url);
+print_editdevice_submenu($page_url,$device_id,$device['device_type'],$user_info['login']);
 
 ?>
-<div id="cont">
+<div id="contsubmenu">
 <form name="def" action="switchport-conn.php?id=<?php echo $id; ?>" method="post">
 <br>
 
-<?php print "<b>Список соединений на портах ".$switch['device_name']." - ".$switch['ip']."</b><br>\n"; ?>
+<?php print "<b>".WEB_device_port_connections."&nbsp".$device['device_name']." - ".$device['ip']."</b><br>\n"; ?>
 
 <table class="data">
 <tr>
 <td width=20><input type="checkbox" onClick="checkAll(this.checked);"></td>
-<td width=40><b>Порт</b></td>
-<td ><b>Юзер</b></td>
-<td width=100><input type="submit" onclick="return confirm('Удалить?')" name="remove" value="Удалить"></td>
+<td width=40><b><?php echo WEB_device_port_number; ?></b></td>
+<td ><b><?php echo WEB_cell_login; ?></b></td>
+<td width=100><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="remove" value="<?php echo WEB_btn_delete; ?>"></td>
 </tr>
 
 <?php

+ 41 - 36
html/admin/devices/switchport.php

@@ -3,6 +3,8 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
 
+$device=get_record($db_link,'devices',"id=".$id);
+
 if (isset($_POST["regensnmp"])) {
     $snmp_index = $_POST["f_snmp_start"] * 1;
     $sSQL = "SELECT id,port from device_ports WHERE device_ports.device_id=$id order by id";
@@ -53,34 +55,37 @@ if (isset($_POST['save'])) {
     }
 
 
-$switch=get_record($db_link,'devices',"id=".$id);
-
 unset($_POST);
 
+$user_info = get_record_sql($db_link,"SELECT * FROM User_list WHERE id=".$device['user_id']);
+
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
-print_editdevice_submenu($page_url,$id,$device['device_type']);
+
+print_device_submenu($page_url);
+print_editdevice_submenu($page_url,$device_id,$device['device_type'],$user_info['login']);
+
 ?>
-<div id="cont">
+<div id="contsubmenu">
 <form name="def" action="switchport.php?id=<?php echo $id; ?>" method="post">
 <br>
 
-<?php print "<b>Список портов ".$switch['device_name']." - ".$switch['ip']."</b><br>\n"; ?>
+<?php print "<b>".WEB_device_port_list."&nbsp".$device['device_name']." - ".$device['ip']."</b><br>\n"; ?>
 
 <table class="data" cellspacing="1" cellpadding="4">
 <tr>
 <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
 <td>id</td>
 <td>N</td>
-<td>Порт</td>
-<td>snmp index</td>
-<td>Юзер|Device</td>
-<td>Комментарий</td>
-<td>Uplink</td>
-<td>Nagios</td>
-<td>Skip</td>
-<td>Vlan</td>
-<td>ifName</td>
-<td>Mac count</td>
+<td><?php echo WEB_device_port_name; ?></td>
+<td><?php echo WEB_device_port_snmp_index; ?></td>
+<td><?php echo WEB_device_connected_endpoint; ?></td>
+<td><?php echo WEB_cell_comment; ?></td>
+<td><?php echo WEB_device_port_uplink; ?></td>
+<td><?php echo WEB_nagios; ?></td>
+<td><?php echo WEB_cell_skip; ?></td>
+<td><?php echo WEB_cell_vlan; ?></td>
+<td><?php echo WEB_device_snmp_port_oid_name; ?></td>
+<td><?php echo WEB_cell_mac_count; ?></td>
 </tr>
 <?php
 $sSQL = "SELECT * FROM device_ports WHERE device_ports.device_id=$id ORDER BY port";
@@ -88,47 +93,47 @@ $ports=get_records_sql($db_link,$sSQL);
 foreach ($ports as $row) {
         print "<tr align=center>\n";
         $cl = "data";
-        print "<td class=\"$cl\" style='padding:0'><input type=checkbox name=f_id[] value='{$row['id']}'></td>\n";
-        print "<td class=\"data\"><input type=\"hidden\" name='p_id[]' value='{$row['id']}'><a href=\"editport.php?id=".$row['id']."\">{$row['id']}</a></td>\n";
-        print "<td class=\"$cl\" >".$row['port']."</td>\n";
-        print "<td class=\"$cl\" ><input type=\"text\" name='f_name[]' value='{$row['port_name']}' size=5></td>\n";
-        print "<td class=\"$cl\" ><input type=\"text\" name='f_snmp_index[]' value='{$row['snmp_index']}' size=10></td>\n";
-        print "<td class=\"$cl\">";
+        print "<td class='".$cl."' style='padding:0'><input type=checkbox name=f_id[] value='{$row['id']}'></td>\n";
+        print "<td class='data'><input type='hidden' name='p_id[]' value='{$row['id']}'><a href='editport.php?id=".$row['id']."'>{$row['id']}</a></td>\n";
+        print "<td class='".$cl."' >".$row['port']."</td>\n";
+        print "<td class='".$cl."' ><input type='text' name='f_name[]' value='{$row['port_name']}' size=5></td>\n";
+        print "<td class='".$cl."' ><input type='text' name='f_snmp_index[]' value='{$row['snmp_index']}' size=10></td>\n";
+        print "<td class='".$cl."'>";
         if (isset($row['target_port_id']) and $row['target_port_id'] > 0) {
             print_device_port($db_link, $row['target_port_id']);
         } else {
             print_auth_port($db_link, $row['id']);
         }
         print "</td>\n";
-        print "<td class=\"$cl\">" . $row['comment'] . "</td>\n";
-        print "<td class=\"$cl\" >" . get_qa($row['uplink']) . "</td>\n";
-        print "<td class=\"$cl\" >" . get_qa($row['nagios']) . "</td>\n";
-        print "<td class=\"$cl\" >" . get_qa($row['skip']) . "</td>\n";
+        print "<td class='".$cl."'>" . $row['comment'] . "</td>\n";
+        print "<td class='".$cl."' >" . get_qa($row['uplink']) . "</td>\n";
+        print "<td class='".$cl."' >" . get_qa($row['nagios']) . "</td>\n";
+        print "<td class='".$cl."' >" . get_qa($row['skip']) . "</td>\n";
         $vlan = $row['vlan'];
         $ifname= compact_port_name($row['ifName']);
-        $f_cacti_url = get_cacti_graph($switch['ip'], $row['snmp_index']);
+        $f_cacti_url = get_cacti_graph($device['ip'], $row['snmp_index']);
         if (empty(get_const('torrus_url')) and (empty($f_cacti_url))) {  $snmp_url=$ifname; }
                 else {
-                if (isset($f_cacti_url)) { $snmp_url = "<a href=\"$f_cacti_url\">" . $ifname . "</a>"; }
+                if (isset($f_cacti_url)) { $snmp_url = "<a href='".$f_cacti_url."'>" . $ifname . "</a>"; }
                 if (!empty(get_const('torrus_url'))) {
                     $normed_ifname = str_replace("/", "_", $ifname);
                     $normed_ifname = str_replace(".", "_", $normed_ifname);
                     $normed_ifname = trim(str_replace(" ", "_", $normed_ifname));
-                    $t_url = str_replace("HOST_IP", $switch['ip'], get_const('torrus_url'));
+                    $t_url = str_replace("HOST_IP", $device['ip'], get_const('torrus_url'));
                     $t_url = str_replace("IF_NAME", $normed_ifname, $t_url);
-                    $snmp_url = "<a href=\"$t_url\">" . $ifname . "</a>";
+                    $snmp_url = "<a href='".$t_url."'>" . $ifname . "</a>";
                     }
                 }
-        print "<td class=\"$cl\">" . $vlan . "</td>\n";
-        print "<td class=\"$cl\">" . $snmp_url . "</td>\n";
-        print "<td class=\"$cl\" ><button name=\"write\" class=\"j-submit-report\" onclick=\"window.open('portmactable.php?id=" . $row['id'] . "')\">" . $row['last_mac_count'] . "</button></td>\n";
+        print "<td class='".$cl."'>" . $vlan . "</td>\n";
+        print "<td class='".$cl."'>" . $snmp_url . "</td>\n";
+        print "<td class='".$cl."' ><button name='write' class='j-submit-report' onclick='window.open('portmactable.php?id=" . $row['id'] . "')'>" . $row['last_mac_count'] . "</button></td>\n";
 print "</tr>";
 }
 print "<tr>\n";
-print "<td colspan=6>snmp start</td>\n";
-print "<td class=\"data\"><input type=\"text\" name='f_snmp_start' value=1></td>\n";
-print "<td><input type=\"submit\" name=\"regensnmp\" value=\"Обновить snmp\"></td>\n";
-print "<td colspan=5 align=right><input type=\"submit\" name=\"save\" value=\"Сохранить\"></td>\n";
+print "<td colspan=6>".WEB_device_first_port_snmp_value."</td>\n";
+print "<td class='data'><input type='text' name='f_snmp_start' value=1></td>\n";
+print "<td><input type='submit' name='regensnmp' value='".WEB_device_recalc_snmp_port."'></td>\n";
+print "<td colspan=5 align=right><input type='submit' name='save' value='".WEB_btn_save."'></td>\n";
 print "</tr>\n";
 print "</table>\n";
 ?>

+ 86 - 74
html/admin/devices/switchstatus.php

@@ -3,7 +3,7 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
 
-$switch=get_record($db_link,'devices',"id=".$id);
+$device=get_record($db_link,'devices',"id=".$id);
 
 if (isset($_POST["regensnmp"])) {
     $snmp_index = $_POST["f_snmp_start"] * 1;
@@ -19,45 +19,45 @@ if (isset($_POST["regensnmp"])) {
     exit;
     }
 
-if (isset($_POST['poe_on']) and $switch['snmp_version']>0) {
+if (isset($_POST['poe_on']) and $device['snmp_version']>0) {
     $len = is_array($_POST['poe_on']) ? count($_POST['poe_on']) : 0;
     for ($i = 0; $i < $len; $i ++) {
         $port_index = intval($_POST['poe_on'][$i]);
         LOG_DEBUG($db_link, "Device id: $id enable poe at port snmp index $port_index");
-        set_port_poe_state($switch['vendor_id'], $port_index, $switch['ip'], $switch['rw_community'], $switch['snmp_version'], 1);
+        set_port_poe_state($device['vendor_id'], $port_index, $device['ip'], $device['rw_community'], $device['snmp_version'], 1);
     }
     header("Location: " . $_SERVER["REQUEST_URI"]);
     exit;
 }
 
-if (isset($_POST['poe_off']) and $switch['snmp_version']>0) {
+if (isset($_POST['poe_off']) and $device['snmp_version']>0) {
     $len = is_array($_POST['poe_off']) ? count($_POST['poe_off']) : 0;
     for ($i = 0; $i < $len; $i ++) {
         $port_index = intval($_POST['poe_off'][$i]);
         LOG_DEBUG($db_link, "Device id: $id disable poe at port snmp index $port_index");
-        set_port_poe_state($switch['vendor_id'], $port_index, $switch['ip'], $switch['rw_community'], $switch['snmp_version'], 0);
+        set_port_poe_state($device['vendor_id'], $port_index, $device['ip'], $device['rw_community'], $device['snmp_version'], 0);
     }
     header("Location: " . $_SERVER["REQUEST_URI"]);
     exit;
 }
 
-if (isset($_POST['port_on']) and $switch['snmp_version']>0) {
+if (isset($_POST['port_on']) and $device['snmp_version']>0) {
     $len = is_array($_POST['port_on']) ? count($_POST['port_on']) : 0;
     for ($i = 0; $i < $len; $i ++) {
         $port_index = intval($_POST['port_on'][$i]);
         LOG_DEBUG($db_link, "Device id: $id enable port with snmp index $port_index");
-        set_port_state($switch['vendor_id'], $port_index, $switch['ip'], $switch['rw_community'], $switch['snmp_version'], 1);
+        set_port_state($device['vendor_id'], $port_index, $device['ip'], $device['rw_community'], $device['snmp_version'], 1);
     }
     header("Location: " . $_SERVER["REQUEST_URI"]);
     exit;
 }
 
-if (isset($_POST['port_off']) and $switch['snmp_version']>0) {
+if (isset($_POST['port_off']) and $device['snmp_version']>0) {
     $len = is_array($_POST['port_off']) ? count($_POST['port_off']) : 0;
     for ($i = 0; $i < $len; $i ++) {
         $port_index = intval($_POST['port_off'][$i]);
         LOG_DEBUG($db_link, "Device id: $id disable port with snmp index $port_index");
-        set_port_state($switch['vendor_id'], $port_index, $switch['ip'], $switch['rw_community'], $switch['snmp_version'], 0);
+        set_port_state($device['vendor_id'], $port_index, $device['ip'], $device['rw_community'], $device['snmp_version'], 0);
     }
     header("Location: " . $_SERVER["REQUEST_URI"]);
     exit;
@@ -65,26 +65,32 @@ if (isset($_POST['port_off']) and $switch['snmp_version']>0) {
 
 unset($_POST);
 
+$user_info = get_record_sql($db_link,"SELECT * FROM User_list WHERE id=".$device['user_id']);
+
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
-print_editdevice_submenu($page_url,$id,$device['device_type']);
+
+print_device_submenu($page_url);
+print_editdevice_submenu($page_url,$device_id,$device['device_type'],$user_info['login']);
 
 ?>
-<div id="cont">
+
+<div id="contsubmenu">
+
 <form name="def" action="switchstatus.php?id=<?php echo $id; ?>" method="post">
 
 <?php
 print "<br>\n";
-print "<b>Состояние портов ".$switch['device_name']." - ".$switch['ip']."</b><br>\n";
+print "<b>".WEB_device_port_state_list."&nbsp".$device['device_name']." - ".$device['ip']."</b><br>\n";
 
-if ($switch['snmp_version']>0) {
-    $snmp_ok = check_snmp_access($switch['ip'], $switch['community'], $switch['snmp_version']);
+if ($device['snmp_version']>0) {
+    $snmp_ok = check_snmp_access($device['ip'], $device['community'], $device['snmp_version']);
     $modules_oids = NULL;
     if ($snmp_ok) {
-            if ($switch['snmp_version'] == 2) {
-	        $modules_oids = snmp2_real_walk($switch['ip'], $switch['community'], CISCO_MODULES);
+            if ($device['snmp_version'] == 2) {
+	        $modules_oids = snmp2_real_walk($device['ip'], $device['community'], CISCO_MODULES);
 	        }
-            if ($switch['snmp_version'] == 1) {
-	        $modules_oids = snmprealwalk($switch['ip'], $switch['community'], CISCO_MODULES);
+            if ($device['snmp_version'] == 1) {
+	        $modules_oids = snmprealwalk($device['ip'], $device['community'], CISCO_MODULES);
 	        }
 	    }
     } else { $snmp_ok = 0; }
@@ -92,22 +98,22 @@ if ($switch['snmp_version']>0) {
     print "<table class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
     print "<tr>\n";
     print "<td>id</td>\n";
-    print "<td>N</td>\n";
-    print "<td>Порт</td>\n";
-    print "<td>snmp</td>\n";
-    print "<td>Юзер|Device</td>\n";
-    print "<td>Комментарий</td>\n";
-    print "<td>Uplink</td>\n";
-    print "<td>Nagios</td>\n";
-    print "<td>Skip</td>\n";
-    print "<td>Vlan</td>\n";
-    print "<td>IfName</td>\n";
-    print "<td>Speed</td>\n";
-    print "<td>Errors</td>\n";
-    print "<td>Mac count</td>\n";
-    print "<td>Additional</td>\n";
-    print "<td>POE Control</td>\n";
-    print "<td>Port Control</td>\n";
+    print "<td>".WEB_device_port_number."</td>\n";
+    print "<td>".WEB_device_port_name."</td>\n";
+    print "<td>".WEB_device_port_snmp_index."</td>\n";
+    print "<td>".WEB_device_connected_endpoint."</td>\n";
+    print "<td>".WEB_cell_comment."</td>\n";
+    print "<td>".WEB_device_port_uplink."</td>\n";
+    print "<td>".WEB_nagios."</td>\n";
+    print "<td>".WEB_cell_skip."</td>\n";
+    print "<td>".WEB_cell_vlan."</td>\n";
+    print "<td>".WEB_device_snmp_port_oid_name."</td>\n";
+    print "<td>".WEB_device_port_speed."</td>\n";
+    print "<td>".WEB_device_port_errors."</td>\n";
+    print "<td>".WEB_cell_mac_count."</td>\n";
+    print "<td>".WEB_msg_additional."</td>\n";
+    print "<td>".WEB_device_poe_control."</td>\n";
+    print "<td>".WEB_device_port_control."</td>\n";
     print "</tr>\n";
     $sSQL = "SELECT * FROM device_ports WHERE device_ports.device_id=$id ORDER BY port";
     $ports=get_records_sql($db_link,$sSQL);
@@ -117,43 +123,43 @@ if ($switch['snmp_version']>0) {
         $new_info = NULL;
         //fix empty port names
         if (empty($row['port_name'])) { $row['port_name']=$row['port']; $new_info['port_name']=$row['port']; }
-        if (isset($switch['ip']) and ($switch['ip'] != '') and $snmp_ok) {
-            $port_state_detail = get_port_state_detail($row['snmp_index'], $switch['ip'], $switch['community'], $switch['snmp_version'], $switch['fdb_snmp_index']);
+        if (isset($device['ip']) and ($device['ip'] != '') and $snmp_ok) {
+            $port_state_detail = get_port_state_detail($row['snmp_index'], $device['ip'], $device['community'], $device['snmp_version'], $device['fdb_snmp_index']);
             list ($poper, $padmin, $pspeed, $perrors) = explode(';', $port_state_detail);
             if ($poper == 1 ) { $cl = "up";  }
             if ($poper >= 2 ) {
                 if ($padmin >=2) { $cl = "shutdown"; } else { $cl = "down"; }
                 }
             }
-	print "<td class=\"$cl\" style='padding:0'><input type=checkbox name=d_port_index[] value=".$row['snmp_index']." ></td>\n";
-        print "<td class=\"$cl\"><a href=\"editport.php?id=".$row['id']."\">" . $row['port'] . "</a></td>\n";
-        print "<td class=\"$cl\" >" . $row['port_name'] . "</td>\n";
-        print "<td class=\"$cl\" >" . $row['snmp_index'] . "</td>\n";
-        print "<td class=\"$cl\">";
+	print "<td class='".$cl."' style='padding:0'><input type=checkbox name=d_port_index[] value=".$row['snmp_index']." ></td>\n";
+        print "<td class='".$cl."'><a href=\"editport.php?id=".$row['id']."\">" . $row['port'] . "</a></td>\n";
+        print "<td class='".$cl."' >" . $row['port_name'] . "</td>\n";
+        print "<td class='".$cl."' >" . $row['snmp_index'] . "</td>\n";
+        print "<td class='".$cl."'>";
         if (isset($row['target_port_id']) and $row['target_port_id'] > 0) {
             print_device_port($db_link, $row['target_port_id']);
         } else {
             print_auth_port($db_link, $row['id']);
         }
         print "</td>\n";
-        print "<td class=\"$cl\">" . $row['comment'] . "</td>\n";
-        print "<td class=\"$cl\" >" . get_qa($row['uplink']) . "</td>\n";
-        print "<td class=\"$cl\" >" . get_qa($row['nagios']) . "</td>\n";
-        print "<td class=\"$cl\" >" . get_qa($row['skip']) . "</td>\n";
+        print "<td class='".$cl."'>" . $row['comment'] . "</td>\n";
+        print "<td class='".$cl."' >" . get_qa($row['uplink']) . "</td>\n";
+        print "<td class='".$cl."' >" . get_qa($row['nagios']) . "</td>\n";
+        print "<td class='".$cl."' >" . get_qa($row['skip']) . "</td>\n";
         $poe_info="POE:None";
 
         $vlan = $row['vlan'];
         $ifname= $row['ifName'];
 
         if ($snmp_ok) {
-            $vlan = get_port_vlan($row['port'], $row['snmp_index'], $switch['ip'], $switch['community'], $switch['snmp_version'], $switch['fdb_snmp_index']);
-            $ifname = get_snmp_ifname1($switch['ip'], $switch['community'], $switch['snmp_version'], $row['snmp_index']);
-            if (empty($ifname)) { $ifname = get_snmp_ifname2($switch['ip'], $switch['community'], $switch['snmp_version'], $row['snmp_index']); }
-            $sfp_status = get_sfp_status($switch['vendor_id'], $row['snmp_index'], $switch['ip'], $switch['community'], $switch['snmp_version'], $modules_oids);
-            $poe_status = get_port_poe_state($switch['vendor_id'], $row['snmp_index'], $switch['ip'], $switch['community'], $switch['snmp_version']);
+            $vlan = get_port_vlan($row['port'], $row['snmp_index'], $device['ip'], $device['community'], $device['snmp_version'], $device['fdb_snmp_index']);
+            $ifname = get_snmp_ifname1($device['ip'], $device['community'], $device['snmp_version'], $row['snmp_index']);
+            if (empty($ifname)) { $ifname = get_snmp_ifname2($device['ip'], $device['community'], $device['snmp_version'], $row['snmp_index']); }
+            $sfp_status = get_sfp_status($device['vendor_id'], $row['snmp_index'], $device['ip'], $device['community'], $device['snmp_version'], $modules_oids);
+            $poe_status = get_port_poe_state($device['vendor_id'], $row['snmp_index'], $device['ip'], $device['community'], $device['snmp_version']);
             if (isset($poe_status)) {
                 if ($poe_status == 1) {
-                    $port_poe_detail = get_port_poe_detail($switch['vendor_id'], $row['snmp_index'], $switch['ip'], $switch['community'], $switch['snmp_version']);
+                    $port_poe_detail = get_port_poe_detail($device['vendor_id'], $row['snmp_index'], $device['ip'], $device['community'], $device['snmp_version']);
                     $poe_info="POE:On " . $port_poe_detail;
                     }
                 if ($poe_status == 2) { $poe_info="POE:Off"; }
@@ -168,7 +174,7 @@ if ($switch['snmp_version']>0) {
         if (!empty($new_info)) { update_record($db_link, "device_ports", "id=".$row['id'], $new_info); }
 
         $ifname=compact_port_name($ifname);
-        $f_cacti_url = get_cacti_graph($switch['ip'], $row['snmp_index']);
+        $f_cacti_url = get_cacti_graph($device['ip'], $row['snmp_index']);
         if (empty(get_const('torrus_url')) and (empty($f_cacti_url))) {  $snmp_url=$ifname; } 
                 else {
                 if (isset($f_cacti_url)) { $snmp_url = "<a href=\"$f_cacti_url\">" . $ifname . "</a>"; }
@@ -176,14 +182,14 @@ if ($switch['snmp_version']>0) {
                     $normed_ifname = str_replace("/", "_", $ifname);
                     $normed_ifname = str_replace(".", "_", $normed_ifname);
                     $normed_ifname = trim(str_replace(" ", "_", $normed_ifname));
-                    $t_url = str_replace("HOST_IP", $switch['ip'], get_const('torrus_url'));
+                    $t_url = str_replace("HOST_IP", $device['ip'], get_const('torrus_url'));
                     $t_url = str_replace("IF_NAME", $normed_ifname, $t_url);
                     $snmp_url = "<a href=\"$t_url\">" . $ifname . "</a>";
                     }
                 }
 
-        print "<td class=\"$cl\">" . $vlan . "</td>\n";
-        print "<td class=\"$cl\">" . $snmp_url . "</td>\n";
+        print "<td class='".$cl."'>" . $vlan . "</td>\n";
+        print "<td class='".$cl."'>" . $snmp_url . "</td>\n";
 
         $speed = "0";
         $cl_speed = $cl;
@@ -198,52 +204,58 @@ if ($switch['snmp_version']>0) {
         $cl_error = $cl;
         if ($perrors > 0) { $cl_error = "crc"; }
         print "<td class=\"$cl_error\">" . $perrors . "</td>\n";
-        print "<td class=\"$cl\" ><button name=\"write\" class=\"j-submit-report\" onclick=\"window.open('portmactable.php?id=" . $row['id'] . "')\">" . $row['last_mac_count'] . "</button></td>\n";
-        print "<td class=\"$cl\">" . $sfp_status. " ". $poe_info."</td>\n";
-        if (isset($poe_status) and ! $row['skip'] and ! $switch['is_router']) {
+        print "<td class='".$cl."' ><button name=\"write\" class=\"j-submit-report\" onclick=\"window.open('portmactable.php?id=" . $row['id'] . "')\">" . $row['last_mac_count'] . "</button></td>\n";
+        print "<td class='".$cl."'>" . $sfp_status. " ". $poe_info."</td>\n";
+        if (isset($poe_status) and ! $row['skip'] and ! $device['is_router']) {
                 print "<td class=\"data\">";
-                if ($switch['vendor_id'] != 9) {
+                if ($device['vendor_id'] != 9) {
                     if ($poe_status == 2) {
-                        print "<button name='poe_on[]' value='{$row['snmp_index']}'>POE On</button>";
+                        print "<button name='poe_on[]' value='{$row['snmp_index']}'>".WEB_device_poe_on."</button>";
                 	}
                     if ($poe_status == 1) {
-                        print "<button name='poe_off[]' value='{$row['snmp_index']}'>POE Off</button>";
+                        print "<button name='poe_off[]' value='{$row['snmp_index']}'>".WEB_device_poe_off."</button>";
                 	}
             	    } else {
-                    print "Not supported";
+                    print WEB_msg_unsupported;
             	    }
                 print "</td>\n";
         	} else {
-        	print "<td>Not supported</td>\n";
+        	print "<td>".WEB_msg_unsupported."</td>\n";
         	}
-        if (isset($padmin) and ! $row['uplink'] and ! $row['skip'] and ! $switch['is_router']) {
+        if (isset($padmin) and ! $row['uplink'] and ! $row['skip'] and ! $device['is_router']) {
                 print "<td class=\"data\">";
-                if ($switch['vendor_id'] != 9) {
+                if ($device['vendor_id'] != 9) {
                     if ($padmin >=2) {
-                        print "<button name='port_on[]' value='{$row['snmp_index']}'>Enable port</button>";
+                        print "<button name='port_on[]' value='{$row['snmp_index']}'>".WEB_device_port_on."</button>";
                 	}
                     if ($padmin ==1) {
-                        print "<button name='port_off[]' value='{$row['snmp_index']}'>Shutdown port</button>";
+                        print "<button name='port_off[]' value='{$row['snmp_index']}'>".WEB_device_port_off."</button>";
                 	}
             	    } else {
-                    print "Not supported";
+                    print WEB_msg_unsupported;
             	    }
                 print "</td>\n";
         	}
         print "</tr>";
     }
     print "<tr>\n";
-    print "<td colspan=10>snmp start &nbsp<input type=\"text\" name='f_snmp_start' value=1></td>\n";
-    print "<td><input type=\"submit\" name=\"regensnmp\" value=\"Обновить snmp\"></td>\n";
+    print "<td colspan=12>".WEB_device_first_port_snmp_value."</td>\n";
+    print "<td class='data'><input type='text' name='f_snmp_start' value=1></td>\n";
+    print "<td><input type='submit' name='regensnmp' value='".WEB_device_recalc_snmp_port."'></td>\n";
+    print "<td colspan=5 align=right><input type='submit' name='save' value='".WEB_btn_save."'></td>\n";
     print "</tr>\n";
     print "</table>\n";
+
+
     print "<table class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
-    print "<tr><td>Port status</td></tr>\n";
-    print "<tr><td class=\"down\">Oper down</td><td class=\"up\">Oper up</td><td class=\"shutdown\">Admin shutdown</td><tr>\n";
+    print "<tr><td>".WEB_port_status."</td></tr>\n";
+    print "<tr><td class=\"down\">".WEB_port_oper_down."</td>";
+    print "<td class=\"up\">".WEB_port_oper_up."</td>";
+    print "<td class=\"shutdown\">".WEB_port_admin_shutdown."</td><tr>\n";
     print "</table>\n";
     print "<table class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
-    print "<tr><td>Port speed</td></tr>\n";
-    print "<tr><td class=\"speed10M\">10M</td><td class=\"speed100M\">100M</td><td class=\"speed1G\">1G</td><td class=\"speed10G\">10G</td><tr>\n";
+    print "<tr><td>".WEB_port_speed."</td></tr>\n";
+    print "<tr><td class=\"speed10M\">".WEB_port_speed_10."</td><td class=\"speed100M\">".WEB_port_speed_100."</td><td class=\"speed1G\">".WEB_port_speed_1G."</td><td class=\"speed10G\">".WEB_port_speed_10G."</td><tr>\n";
     print "</table>\n";
 
 print "</form>";

+ 43 - 4
html/inc/languages/russian.php

@@ -40,6 +40,8 @@ define("WEB_msg_forbidden","Запрещено");
 define("WEB_msg_traffic_blocked","Блок по трафику");
 define("WEB_msg_internet","Интернет");
 define("WEB_msg_delete","Удалить");
+define("WEB_msg_additional","Дополнительно");
+define("WEB_msg_unsupported","Не поддерживается");
 
 /* SNMP */
 define("WEB_snmp_version","SNMP version");
@@ -49,14 +51,27 @@ define("WEB_snmp_v3_ro_password","Snmpv3 RO password");
 define("WEB_snmp_v3_rw_password","Snmpv3 RW password");
 define("WEB_snmp_community_ro","Snmp RO Community");
 define("WEB_snmp_community_rw","Snmp RW Community");
+define("WEB_snmp_interface_name","Interface name");
+define("WEB_snmp_interface_index","Interface index");
 
 /* color schema description */
 define("WEB_color_description","Цветовая маркировка");
-define("WEB_color_user_disabled","Пользователь вылкючен");
+define("WEB_color_user_disabled","Пользователь выключен");
 define("WEB_color_user_blocked","Блокировка по трафику");
-define("WEB_color_device_description","Device status");
-define("WEB_color_device_online","Online");
-define("WEB_color_device_down","Down");
+define("WEB_color_device_description","Состояние устройства");
+
+/* device and port state */
+define("WEB_device_online","Online");
+define("WEB_device_down","Down");
+define("WEB_port_status","Состояние портов");
+define("WEB_port_oper_down","Oper down");
+define("WEB_port_oper_up","Oper up");
+define("WEB_port_admin_shutdown","Admin off");
+define("WEB_port_speed","Port speed");
+define("WEB_port_speed_10","10M");
+define("WEB_port_speed_100","100M");
+define("WEB_port_speed_1G","1G");
+define("WEB_port_speed_10G","10G");
 
 /* select items */
 define("WEB_select_item_yes","Да");
@@ -174,6 +189,9 @@ define("WEB_cell_ip_quote_month","Квота на адрес, месяц");
 define("WEB_cell_login_quote_day","Квота на логин, день");
 define("WEB_cell_ip_quote_day","Квота на адрес, день");
 define("WEB_cell_type","Тип");
+define("WEB_cell_skip","Пропустить");
+define("WEB_cell_vlan","Vlan");
+define("WEB_cell_mac_count","Mac count");
 
 /* lists name */
 define("WEB_list_ou","Список групп");
@@ -315,4 +333,25 @@ define("WEB_device_port_mac_table_history","Список маков когда-
 /* portsbyvlan */
 define("WEB_device_ports_by_vlan","Список портов в влане");
 
+/* switchport-connection */
+define("WEB_device_port_connections","Список соединений на портах");
+
+/* switchport */
+define("WEB_device_port_list","Список портов");
+define("WEB_device_connected_endpoint","Юзер/Устройство");
+define("WEB_device_first_port_snmp_value","SNMP-индекс первого порта");
+define("WEB_device_recalc_snmp_port","Пересчитать snmp индексы");
+
+/* switchport-status */
+define("WEB_device_port_state_list","Состояние портов");
+define("WEB_device_snmp_port_oid_name","IfName");
+define("WEB_device_port_speed","Speed");
+define("WEB_device_port_errors","Errors");
+define("WEB_device_poe_control","Управление POE");
+define("WEB_device_port_control","Управление портом");
+define("WEB_device_port_on","Включить порт");
+define("WEB_device_port_off","Выключить порт");
+define("WEB_device_poe_on","Включить POE");
+define("WEB_device_poe_off","Выключить POE");
+
 ?>