Magellan Linux

Diff of /alx-src/branches/alx-web-070/index.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2196 by niro, Tue Jun 7 13:12:26 2011 UTC revision 3348 by niro, Wed Feb 8 13:03:11 2012 UTC
# Line 1  Line 1 
1  <?  <?
2    
3  include('include/basesql.php');  include('include/basesql.php');
4    include('include/common-functions.php');
5    
6  session_start();  session_start();
7  session_register('alx_sort_krit'); session_register('alx_sort_onfirst'); session_register('alx_sort_loc');  session_register('alx_sort_krit'); session_register('alx_sort_onfirst'); session_register('alx_sort_loc');
8    
# Line 66  function checkif($b) Line 68  function checkif($b)
68  }  }
69    
70  $comps = sqlarr("select client_serials.serial, client_serials.location, client_serials.mac, cfg_network.hostname, state_connected.mtime from client_serials left join cfg_network on client_serials.serial=cfg_network.serial left join state_connected on client_serials.serial=state_connected.serial", "serial");  $comps = sqlarr("select client_serials.serial, client_serials.location, client_serials.mac, cfg_network.hostname, state_connected.mtime from client_serials left join cfg_network on client_serials.serial=cfg_network.serial left join state_connected on client_serials.serial=state_connected.serial", "serial");
71    
72  sqlforeach('SELECT serial, ip, hostname, mac FROM state_connected', 'check_online', null);  sqlforeach('SELECT serial, ip, hostname, mac FROM state_connected', 'check_online', null);
73  usort($comps, 'sortcomp');  usort($comps, 'sortcomp');
74  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
# Line 112  echo '</form>'; Line 114  echo '</form>';
114    
115  echo '<table border="1" id="mytab">';  echo '<table border="1" id="mytab">';
116  echo '<thead><tr style="font-weight:bold;background-color:#d5e5ff"><th>edit</th><th colspan=3>serial</th><th width=170>hostname</th><th width=100>ip</th><th width=100>last connected</th>';  echo '<thead><tr style="font-weight:bold;background-color:#d5e5ff"><th>edit</th><th colspan=3>serial</th><th width=170>hostname</th><th width=100>ip</th><th width=100>last connected</th>';
117    //always enable showversion atm
118    $showversion = "on";
119  if($showversion=='on') echo '<th colspan=2>version</th>';  if($showversion=='on') echo '<th colspan=2>version</th>';
120  echo '<th width=150>up/down</th></tr></thead><tbody>';  echo '<th width=150>up/down</th></tr></thead><tbody>';
121    
# Line 120  foreach($comps as $c) Line 124  foreach($comps as $c)
124   if(!$_SESSION['alx_sort_loc'][$c['location']]) Continue;   if(!$_SESSION['alx_sort_loc'][$c['location']]) Continue;
125   if($c['serial']<0 && !$_SESSION['alx_sort_loc']['DEAD']) Continue;   if($c['serial']<0 && !$_SESSION['alx_sort_loc']['DEAD']) Continue;
126    
127   if($c['online']) $pic='online'   if($c['online']) $pic='online';
128   else $pic='offline';   else $pic='offline';
129    
130   if($c['serial']<0)   if($c['serial']<0)
# Line 141  foreach($comps as $c) Line 145  foreach($comps as $c)
145   //if($c['mtime']) { echo '<td><nobr>'.$c['mtime'].'</nobr></td>'; }   //if($c['mtime']) { echo '<td><nobr>'.$c['mtime'].'</nobr></td>'; }
146   else echo '<td></td>';   else echo '<td></td>';
147    
148   if($c['online'])   if($showversion=='on')
149   {   {
150   if($showversion=='on')   // get alx version info for
151     $alxinfo = sqlfirst('SELECT * FROM client_version WHERE serial='.$c['serial']);
152     $alxver = $alxinfo[os];
153     $alxutils = $alxinfo[utils];
154    
155     if( $alxver == '')
156   {   {
157   $osver = sshdo('os_ver=$(</etc/mageversion);cfg_ver=$(/sbin/magequery -n alxconfig-ng | cut -d" " -f5);pname=${cfg_ver%-*-*};cfg_ver=${cfg_ver/${pname}-};echo "${os_ver}:${cfg_ver}"', .$c['ip']);   if($c['online'])
158   $osver = explode(':',$osver[1]);   {
159   if($osver[0] == '') $osver[0]='unkown';   //$alxinfo = @sshdo('os_ver=$(</etc/mageversion);cfg_ver=$(/sbin/magequery -n alxconfig-ng | cut -d" " -f5);pname=${cfg_ver%-*-*};cfg_ver=${cfg_ver/${pname}-};echo "${os_ver}:${cfg_ver}"', $c['ip']);
160   if($osver[1] == '') $osver[1]='unkown';   //$alxinfo = explode(':',$alxinfo[1]);
161           echo '<td>'.$osver[0].'</td>';   //$alxver = $alxinfo[0];
162           echo '<td>'.$osver[1].'</td>';   //$alxutils = $alxinfo[1];
163          }   }
164     }
165     if($alxver == '') $alxver='unkown';
166     if($alxutils == '') $alxutils='unkown';
167    
168           echo '<td>'.$alxver.'</td>';
169           echo '<td>'.$alxutils.'</td>';
170   }   }
171    
172   echo '<td>';   echo '<td>';

Legend:
Removed from v.2196  
changed lines
  Added in v.3348