} if (in_array("filNS", $col)) { echo "<td>"; $fp = 'topo'; if ($l[1]) { $fp .= '/' . preg_replace('/\\W/', '', $l[1]); } if ($l[2]) { $fp .= '/' . preg_replace('/\\W/', '', $l[2]); } if ($l[3]) { $fp .= '/' . preg_replace('/\\W/', '', $l[3]); } foreach (glob("{$fp}/*.*") as $fil) { $lbl = basename($fil); list($ico, $ed) = FileImg($fil); echo "{$ico} "; } echo "</td>"; } if (in_array("cmdNS", $col)) { $ur = urlencode($l[1]); $uc = urlencode($l[2]); $ub = urlencode($l[3]); $ul = urlencode(TopoLoc($l[1], $l[2], $l[3])); echo "<td align=\"right\">\n"; if ($ns and $ew) { echo "<a href=\"http://nominatim.openstreetmap.org/search.php?q={$ns},{$ew}\" target=\"window\"><img src=\"img/16/osm.png\" title=\"Openstreetmap\"></a>\n"; echo "<a href=\"http://www.google.com/maps?q={$ns},{$ew}\" target=\"window\"><img src=\"img/16/map.png\" title=\"Google Maps, Coords\"></a>\n"; } echo "<a href=\"http://www.google.com/maps?q=" . ($ub ? "{$ub} " : '') . ($uc ? "{$uc} " : '') . ",{$ur}\" target=\"window\"><img src=\"img/16/map.png\" title=\"Google Maps, {$namlbl}\"></a>\n";
function TopoFloors($r, $c, $b, $siz = 0) { global $link, $dev, $img, $modgroup, $self, $v, $place, $netlbl, $acslbl, $porlbl, $frelbl, $refresh; $query = GenQuery('locations', 's', 'id,x,y,ns,ew,locdesc', '', '', array('region', 'city', 'building'), array('=', '=', '='), array($r, $c, $b), array('AND', 'AND')); $res = DbQuery($query, $link); if (DbNumRows($res)) { list($id, $x, $y, $ns, $ew, $des) = DbFetchRow($res); echo "<h2>{$b} - {$des}</h2>\n"; } else { echo "<h2>{$b} {$place['b']}</h2>\n"; } echo "<table class=\"content fixed\">\n"; uksort($dev, "floorsort"); foreach (array_keys($dev) as $fl) { echo "<tr>\n\t<td class=\"{$modgroup[$self]}2\" width=\"80\"><h3>\n"; if (!$siz) { echo "<img src=\"img/stair.png\"><br>\n"; } echo "{$fl}</h3>\n"; if (!$siz) { $bas = "topo/" . preg_replace('/\\W/', '', $r) . '/' . preg_replace('/\\W/', '', $c) . '/' . preg_replace('/\\W/', '', $b) . '-' . preg_replace('/\\W/', '', $fl); foreach (glob("{$bas}*") as $f) { list($ico, $ed) = FileImg($f); echo "{$ico} "; } } echo "</td>\n"; $col = 0; $prm = ""; ksort($dev[$fl]); foreach (array_keys($dev[$fl]) as $rm) { if ($prm != $rm) { $bi = $bi == "imga" ? "imgb" : "imga"; } $prm = $rm; foreach (array_keys($dev[$fl][$rm]) as $d) { $ip = $dev[$fl][$rm][$d]['ip']; $po = $dev[$fl][$rm][$d]['po']; $ty = $dev[$fl][$rm][$d]['ty']; $di = $dev[$fl][$rm][$d]['ic']; $co = $dev[$fl][$rm][$d]['co']; $rk = $dev[$fl][$rm][$d]['rk']; $mn = $dev[$fl][$rm][$d]['mn']; $al = $dev[$fl][$rm][$d]['al']; $sz = $dev[$fl][$rm][$d]['sz']; $sk = $dev[$fl][$rm][$d]['sk'] > 1 ? "<img src=\"img/" . $dev[$fl][$rm][$d]['sk'] . ".png\" title=\"Stack\">" : ""; list($statbg, $stat) = StatusBg(1, $mn, $al, $bi); $tit = $stat ? $stat : $ty; $ud = urlencode($d); $ur = urlencode($r); $uc = urlencode($c); $ub = urlencode($b); $uf = urlencode($fl); $um = urlencode($rm); if ($col == $_SESSION['col']) { $col = 0; echo "</tr><tr><td> </td>\n"; } if ($siz) { echo "<td class=\"{$statbg}\" valign=\"top\"><center><img src=\"img/dev/{$di}.png\" title=\"{$ip}\"><br>{$d}</center></td>\n"; } else { $ii = $refresh ? 0 : IfFree($d); $inif = $ii ? "<div style=\"float:right\"><a href=\"Devices-Interfaces.php?in[]=device&op[]==&st[]={$ud}&co[]=AND&in[]=ifstat&op[]=<&st[]=3&co[]=AND&in[]=iftype&op[]=~&st[]=^(6|7|117)\$&col[]=imBL&col[]=ifname&col[]=device&col[]=linktype&col[]=ifdesc&col[]=alias&col[]=lastchg&col[]=inoct&col[]=outoct&ord=lastchg\"><img src=\"img/p45.png\" title=\"{$acslbl} {$porlbl} {$frelbl}\">{$ii}</a></div>" : ''; $rkv = $dev[$fl][$rm][$d]['ru'] ? "<a href=\"Topology-Table.php?reg={$ur}&cty={$uc}&bld={$ub}&fl={$uf}&rm={$um}\">{$rm}</a>" : $rm; echo "<td class=\"{$statbg}\" valign=\"top\"><b>{$rkv}</b> {$rk} {$inif}<p><div style=\"text-align:center;\">\n"; echo "<a href=\"Devices-Status.php?dev={$ud}\">"; echo "<img src=\"" . ($img ? DevPanel($ty, $di, $sz) . "\" width=\"" . (preg_match('/^ph|^wa|^ca/', $di) ? 40 : 100) . "\"" : "img/dev/{$di}.png\"") . " title=\"{$tit}\"></a>{$sk}<br><b>{$d}</b><br>\n"; echo Devcli($ip, $po); echo "<p>{$co}</div></td>\n"; } $col++; } } } echo "</tr></table>\n"; }
function DirList($dir,$opt,$lvl){ global $row,$sub,$upllbl,$levlbl,$dellbl,$edilbl,$cfmmsg,$isadmin; $tsiz = 0; $ed = ''; foreach (glob("$dir/*") as $f){ if ($row % 2){$bg = "txta"; $bi = "imga";}else{$bg = "txtb"; $bi = "imgb";} $row++; $plen = strlen($dir); $t = substr($f,$plen+1); TblRow($bg); echo "<td class=\"$bi\" width=\"20\" nowrap>"; $i=0; while ($i < $lvl) { echo "<img src=\"img/sub.png\">"; $i++; } $i=0; if(is_dir($f)){ if($lvl and $opt == "web"){ echo "<a href=\"?sub=$f&mde=o\"><img src=\"img/16/".(($f == $sub)?'foye':'fogy').".png\" title=\"$upllbl $levlbl $lvl\"></a></td>"; }else{ echo "<img src=\"img/16/fogy.png\" title=\"Folder $levlbl $lvl\">"; } echo "</td><td colspan=\"4\">$t"; if($isadmin){ echo "<span style=\"float:right\"><a href=\"?del=".urlencode($f)."\"> <img src=\"img/16/bcnl.png\" onclick=\"return confirm('$dellbl, $cfmmsg')\" title=\"$dellbl!\"></a></span>"; } echo "</td></tr>\n"; $tsiz += DirList("$dir/$t",$opt,$lvl+1); }else{ list($ico,$ed) = FileImg($f); echo "$ico</td><td>"; if($opt == "web"){ echo "<a href=\"$f\" target=\"window\">$t</a></td>"; }else{ echo "$t</td>"; } $siz = filesize($f); $tsiz += $siz; echo "<td align=\"right\">".DecFix($siz)."</td><td align=\"right\">".date ($_SESSION['date'],filemtime($f))."<td align=\"right\">"; if($isadmin){ if($opt == "tftp" and $ed){ echo "<a href=\"?tft=".urlencode($t)."\"><img src=\"img/16/note.png\" title=\"$edilbl\"></a>"; } echo "<a href=\"?del=".urlencode($f)."\"><img src=\"img/16/bcnl.png\" onclick=\"return confirm('$dellbl, $cfmmsg')\" title=\"$dellbl!\"></a>"; } echo "</td></tr>\n"; } } return $tsiz; }