Magellan Linux

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

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

revision 7112 by niro, Fri Sep 11 11:02:38 2015 UTC revision 7132 by niro, Tue Sep 15 06:33:24 2015 UTC
# Line 6  include('include/common-functions.php'); Line 6  include('include/common-functions.php');
6  // INCLUDE CURRENT-PROBLEMS  // INCLUDE CURRENT-PROBLEMS
7  include('include/current-problems.php');  include('include/current-problems.php');
8    
9  $tabs = array('cfg_graphic', 'cfg_network', 'cfg_input', 'client_auth', 'cfg_autostart', 'client_serials', 'cfg_comments', 'cfg_printers', 'cfg_sessions', 'cfg_modules', 'cfg_other_menuitems', 'cfg_screensaver', 'client_version', 'cfg_plugins');  $tabs = array('cfg_graphic', 'cfg_network', 'cfg_input', 'client_auth', 'cfg_autostart', 'client_serials', 'cfg_comments', 'cfg_printers', 'cfg_sessions_citrix', 'cfg_sessions_storefront', 'cfg_modules', 'cfg_other_menuitems', 'cfg_screensaver', 'client_version');
10  $multi= array( 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1);  $multi= array( 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0);
11  $data = array();  $data = array();
12    
   
13  // get alx version info for  // get alx version info for
14  $alxinfo = sqlfirst('SELECT * FROM client_version WHERE serial='.$id);  $alxinfo = sqlfirst('SELECT * FROM client_version WHERE serial='.$id);
15  $alxos = $alxinfo[os];  $alxos = $alxinfo[os];
# Line 35  if($kill==1) Line 34  if($kill==1)
34    
35  // FELD-DEFINITIONEN  (ARRAY=>DROPDOWN / HIDDEN / IGNORE / 1 / BOLD / PASSWORD / SHOW / SHOWTIME / MONITORID)  // FELD-DEFINITIONEN  (ARRAY=>DROPDOWN / HIDDEN / IGNORE / 1 / BOLD / PASSWORD / SHOW / SHOWTIME / MONITORID)
36  $drop = array();  $drop = array();
37  $drop['cfg_graphic_module'] = array('vesa', 'ati', 'cirrus', 'i710', 'intel', 'nv', 'nouveau', 'mach64', 'mga', 'unichrome', 'radeon', 's3', 's3virge', 'savage', 'sis', 'trident', 'tseng', 'vmware');  $drop['cfg_graphic_module'] = sqlarr('SELECT value FROM values_graphic_module where enabled=1', '', 'value');
38  if($gfxinfo[module] == 'intel')  if($gfxinfo[module] == 'intel')
39  {  {
40   $drop['cfg_graphic_hdmi'] = array('disable', 'enable');   $drop['cfg_graphic_hdmi'] = array('disable', 'enable');
# Line 44  else Line 43  else
43  {  {
44   $drop['cfg_graphic_hdmi'] = 'ignore';   $drop['cfg_graphic_hdmi'] = 'ignore';
45  }  }
46  $drop['resolution'] = array('640x480', '800x600', '1024x768', '1280x960', '1280x1024', '1360x768', '1366x768', '1400x1050', '1440x900', '1600x1200', '1680x1050', '1280x720', '1920x1080');  $drop['resolution'] = sqlarr('SELECT value FROM values_graphic_resolution where enabled=1', '', 'value');
47  $drop['depth'] = array('24', '16', '8');  $drop['depth'] = sqlarr('SELECT value FROM values_graphic_depth where enabled=1', '', 'value');
48  $drop['mouse'] = array('Auto', 'IMPS/2', 'PS/2');  //$drop['mouse'] = array('Auto', 'IMPS/2', 'PS/2');
49  $drop['keyboard'] = array('PC105');  //$drop['keyboard'] = array('PC105');
50  $drop['cfg_network_module'] = array('3c509', '3c59x', '8139cp', '8139too', '8390', 'amd8111e', 'atl1c', 'atl1e', 'atl1', 'atl2', 'b44', 'bnx2', 'cnic', 'e100', 'e1000', 'e1000e', 'forcedeth', 'igb', 'ipg', 'jme', 'natsemi', 'ne2k-pci', 'ns83820', 'pcnet32', 'qla3xxx', 'r8169', 'sis190', 'sis900', 'skge', 'sky2', 'tg3', 'typhoon', 'via-rhine', 'via-velocity', 'adm8211', 'airo', 'at76c50x-usb', 'ar9170usb', 'ath5k', 'ath9k', 'atmel', 'atmel_pci', 'b43', 'b43legacy', 'hostap_pci', 'hostap_plx', 'ipw2100', 'ipw2200', 'iwl3945', 'iwl4965', 'iwldvm', 'iwlwifi', 'libertas_tf', 'libertas_tf_usb', 'mwl8k', 'orinoco', 'orinoco_nortel', 'orinoco_plx', 'orinoco_tmd', 'orinoco_usb', 'p54pci', 'p54usb', 'prism54', 'rndis_wlan', 'rt2400pci', 'rt2500pci', 'rt2500usb', 'rt2800pci', 'rt2800usb', 'rt61pci', 'rt73usb', 'rtl8180', 'rtl8187', 'usb8xxx', 'wl1251', 'wl1271', 'zd1201', 'zd1211rw');  $drop['keymap'] = sqlarr('SELECT value FROM values_input_keymap where enabled=1', '', 'value');
51    $drop['cfg_network_module'] = sqlarr('SELECT value FROM values_network_module where enabled=1', '', 'value');
52  $drop['networking'] = array('dhcp', 'static');  $drop['networking'] = array('dhcp', 'static');
53  $drop['port'] = array('lpt1', 'usb1', 'usb2', 'com1', 'com2');  $drop['port'] = sqlarr('SELECT value FROM values_printers_port where enabled=1', '', 'value');
54  for ($i=0; $i<999; $i++) { $drop['cfg_printers_'.$i.'_ip'] = 'ignore'; }  //for ($i=0; $i<999; $i++) { $drop['cfg_printers_'.$i.'_ip'] = 'ignore'; }
55  $drop['share'] = 'ignore';  $drop['share'] = 'ignore';
56  $drop['location'] = sqlarr('SELECT location FROM client_locations', '', 'location');  $drop['location'] = sqlarr('SELECT location FROM client_locations where enabled=1', '', 'location');
57  $drop['id'] = 'hidden';  $drop['id'] = 'hidden';
58  $drop['flg_modified'] = '1';  $drop['flg_modified'] = '1';
59  $drop['serial'] = 'ignore';  $drop['serial'] = 'ignore';
60  $drop['monitorid'] = 'ignore';  $drop['monitorid'] = 'ignore';
61  $drop['refresh_rate'] = array('','60','75','85','100');  $drop['refresh_rate'] = sqlarr('SELECT value FROM values_graphic_refresh_rate where enabled=1', '', 'value');
62  $drop['hostname'] = 'bold';  $drop['hostname'] = 'bold';
63  $drop['session'] = 'bold';  $drop['session'] = 'bold';
64  $drop['cfg_autostart_session'] = sqlarr('SELECT filename FROM cfg_sessions where serial='.$id, '', 'filename');  $drop['cfg_autostart_session'] = sqlarr('SELECT filename FROM cfg_sessions_citrix where serial='.$id, '', 'filename');
65  array_unshift($drop['cfg_autostart_session'], "");  array_unshift($drop['cfg_autostart_session'], "");
66  $drop['mtime'] = 'showtime';  $drop['mtime'] = 'showtime';
67  $drop['mac'] = 'show';  $drop['mac'] = 'show';
68  $drop['client_serials_serial'] = 'show';  $drop['client_serials_serial'] = 'show';
69  $drop['password'] = 'password';  //$drop['password'] = 'password';
70  $drop['shell'] = 'password';  //$drop['shell'] = 'password';
71    $drop['client_auth_user'] = 'password';
72    $drop['root'] = 'password';
73  $drop['vnc'] = 'password';  $drop['vnc'] = 'password';
74  $drop['samba'] = 'password';  $drop['samba'] = 'password';
75  $drop['station'] = 'password';  $drop['station'] = 'password';
76  $drop['txt'] = 'txt';  $drop['txt'] = 'txt';
77  $drop['screensaver'] = array('','blank', 'random', 'ant', 'ant3d', 'apollonian', 'ball', 'bat', 'blot', 'bomb', 'bouboule',  $drop['screensaver'] = sqlarr('SELECT value FROM values_screensaver_screensaver where enabled=1', '', 'value');
78   'bounce', 'braid', 'bubble', 'bug', 'clock', 'coral', 'crystal', 'daisy', 'dclock', 'decay', 'deco',  //$drop['iface'] = array('eth0', 'wlan0');
  'demon', 'dilemma', 'discrete', 'dragon', 'drift', 'euler2d', 'eyes', 'fadeplot', 'fiberlamp', 'flag',  
  'flame', 'flow', 'forest', 'galaxy', 'goop', 'grav', 'helix', 'hop', 'hyper', 'ico', 'ifs', 'image',  
  'juggle', 'julia', 'kaleid', 'kumppa', 'laser', 'life', 'life1d', 'life3d', 'lightning', 'lisa', 'lissie',  
  'loop', 'lyapunov', 'mandelbrot', 'marquee', 'matrix', 'maze', 'mountain', 'munch', 'nose', 'pacman',  
  'penrose', 'petal', 'petri', 'polyominoes', 'puzzle',  'pyro', 'qix', 'roll',  'rotor', 'scooter', 'shape',  
  'sierpinski', 'slip', 'solitare', 'space', 'sphere', 'spiral', 'spline', 'star', 'starfish', 'strange',  
  'swarm', 'swirl', 't3d', 'tetris', 'thornbird', 'tik_tak', 'toneclock', 'triangle', 'tube', 'turtle',  
  'vines', 'voters', 'wator', 'wire', 'world', 'worm', 'xcl', 'xjack');  
 $drop['iface'] = array('eth0', 'wlan0');  
79  $drop['client_version_os'] = 'show';  $drop['client_version_os'] = 'show';
80  $drop['client_version_utils'] = 'show';  $drop['client_version_utils'] = 'show';
81    $drop['hwdetected'] = 'ignore';
82    
83  // ACHTUNG!!! wlan_-Felder heißen eigentlich wireless_  // ACHTUNG!!! wlan_-Felder heißen eigentlich wireless_
84  $drop['wireless_mode'] = array('', 'managed', 'ad-hoc', 'master', 'repeater', 'secondary', 'monitor', 'auto');  $drop['wireless_mode'] = array('', 'managed', 'ad-hoc', 'master', 'repeater', 'secondary', 'monitor', 'auto');
# Line 96  $drop['wireless_frequency'] = array('', Line 90  $drop['wireless_frequency'] = array('',
90  $drop['wireless_key'] = 'password';  $drop['wireless_key'] = 'password';
91  $drop['wireless_key_ascii'] = 'password';  $drop['wireless_key_ascii'] = 'password';
92    
 // plugin support  
 for ($i=0; $i<999; $i++) { $drop['cfg_plugins_'.$i.'_plugin'] = 'pluginconfig'; }  
 for ($i=0; $i<999; $i++)  
 {  
  $drop['cfg_plugins_'.$i.'_plugin_array'] = sqlarr('SELECT plugin FROM avail_plugins', '', 'plugin');  
  array_unshift($drop['cfg_plugins_'.$i.'_plugin_array'], "");  
 }  
   
93  // get current citrix sessions  // get current citrix sessions
94  // split all citrix server into an array to get the first server from list  // split all citrix server into an array to get the first server from list
95  $citrix_query_browser = split(";", $citrix_browseradrs);  //$citrix_query_browser = split(";", $citrix_browseradrs);
96  exec($wwwroot.'/pnabrowse-wrapper -A '.$citrix_query_browser[0], $returned_citrix_sessions, $retval);  //exec($wwwroot.'/pnabrowse-wrapper -A '.$citrix_query_browser[0], $returned_citrix_sessions, $retval);
97  if ($retval == 0)  //if ($retval == 0)
98  {  //{
99   $citrix_public_applications = str_replace("'", "", $returned_citrix_sessions);  // $citrix_public_applications = str_replace("'", "", $returned_citrix_sessions);
100   // add an empty value add the first position of the array as session-default  // // add an empty value add the first position of the array as session-default
101   array_unshift($citrix_public_applications, "");  // array_unshift($citrix_public_applications, "");
102   for ($i=0; $i<999; $i++) { $drop['cfg_sessions_'.$i.'_session'] = $citrix_public_applications; }  // for ($i=0; $i<999; $i++) { $drop['cfg_sessions_'.$i.'_session'] = $citrix_public_applications; }
103  }  //}
104    
105    $drop['cfg_sessions_citrix_session'] = sqlarr('SELECT session FROM values_citrix_session where enabled=1', '', 'session');
106    $drop['cfg_sessions_storefront_session'] = sqlarr('SELECT session FROM values_storefront_session where enabled=1', '', 'session');
107    
108    
109  // GGF. NEUEN DATENSATZ EINFÜGEN  // GGF. NEUEN DATENSATZ EINFÜGEN
110  if(isset($_POST['do_add']))  if(isset($_POST['do_add']))
# Line 123  if(isset($_POST['do_add'])) Line 113  if(isset($_POST['do_add']))
113   if($what=='COMMENT') sqladd('cfg_comments', array('serial'=>$id));   if($what=='COMMENT') sqladd('cfg_comments', array('serial'=>$id));
114   else if($what=='PRINTER') sqladd('cfg_printers', array('serial'=>$id));   else if($what=='PRINTER') sqladd('cfg_printers', array('serial'=>$id));
115   else if($what=='MODULE') sqladd('cfg_modules', array('serial'=>$id));   else if($what=='MODULE') sqladd('cfg_modules', array('serial'=>$id));
116   else if($what=='SESSION') sqladd('cfg_sessions', array('domain'=>$citrix_domain_name, 'browseradrs'=>$citrix_browseradrs, 'serial'=>$id));   else if($what=='SESSION-CITRIX') sqladd('cfg_sessions_citrix', array('domain'=>$citrix_domain_name, 'browseradrs'=>$citrix_browseradrs, 'serial'=>$id));
117     else if($what=='SESSION-STOREFRONT') sqladd('cfg_sessions_storefront', array('domain'=>$storefront_domain_name, 'store'=>$storefront_store, 'serial'=>$id));
118   else if($what=='MENUITEM') sqladd('cfg_other_menuitems', array('serial'=>$id));   else if($what=='MENUITEM') sqladd('cfg_other_menuitems', array('serial'=>$id));
119   else if($what=='PLUGIN') sqladd('cfg_plugins', array('serial'=>$id));   else if($what=='AUTOSTART') sqladd('cfg_autostart', array('serial'=>$id));
120  }  }
121    
122    
# Line 237  function parsearr($name, $arr, $del=fals Line 228  function parsearr($name, $arr, $del=fals
228   else if($d=='hidden') echo '<tr><td colspan=2><input type=hidden name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>';   else if($d=='hidden') echo '<tr><td colspan=2><input type=hidden name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>';
229   else if($d=='1') echo '<tr><td colspan=2><input type=hidden name="'.$name.'_'.$k.'" value="1"></td></tr>';   else if($d=='1') echo '<tr><td colspan=2><input type=hidden name="'.$name.'_'.$k.'" value="1"></td></tr>';
230   else if($d=='monitorid') echo '<tr><td class="key">'.$k2.'</td><td>= <input type=button style="width:24px" onclick="window.open(\'monitor.php?id='.$id.'\', \'MonitorWin\', \'width=350,height=200\')" value="..."></td>';   else if($d=='monitorid') echo '<tr><td class="key">'.$k2.'</td><td>= <input type=button style="width:24px" onclick="window.open(\'monitor.php?id='.$id.'\', \'MonitorWin\', \'width=350,height=200\')" value="..."></td>';
  else if($d=='pluginconfig')  
  {  
  $dplugin = $drop[$name.'_'.$k.'_array']; if($dplugin==null) $dplugin = $drop[$k];  
  if(is_array($dplugin))  
  {  
  echo '<tr><td class="key">'.$k2.'</td><td>= <select style="width:144px" name="'.$name.'_'.$k.'">';  
  foreach($dplugin as $di) if($v==$di) echo '<option selected>'.$di; else echo '<option>'.$di;  
  echo '</select></td></tr>';  
  }  
  // $v contains the pluginname, get the configure flag  
  $pflag = sqlfirst('SELECT configflag FROM avail_plugins WHERE plugin="'.$v.'"');  
  if ($pflag[configflag]==1) echo '<tr><td class="key">configure</td><td>= <input type=button style="width:24px" onclick="window.open(\'plugin.php?id='.$id.'&plugin='.$v.'\', \'PluginWin\', \'width=500,height=400\')" value="..."></td>';  
  }  
231   else if($d=='bold') echo '<tr><td class="key">'.$k2.'</td><td>= <input style="width:144px;font-weight:bold" name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>';   else if($d=='bold') echo '<tr><td class="key">'.$k2.'</td><td>= <input style="width:144px;font-weight:bold" name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>';
232   else if($d=='filename') echo '<tr><td class="key">filename</td><td>= <input style="width:144px;font-weight:bold" name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>';   else if($d=='filename') echo '<tr><td class="key">filename</td><td>= <input style="width:144px;font-weight:bold" name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>';
233   else if($d=='show') echo '<tr><td class="key">'.$k2.'</td><td>= <b>'.$v.'</b></td></tr>';   else if($d=='show') echo '<tr><td class="key">'.$k2.'</td><td>= <b>'.$v.'</b></td></tr>';
# Line 291  function parsearrs($name, $arr) Line 269  function parsearrs($name, $arr)
269   var $url = url.split("?");   var $url = url.split("?");
270   $.ajax({type:""+typ+"",url:$url[0],data:$url[1],cache:false,success:function(data){ alert(data); }});   $.ajax({type:""+typ+"",url:$url[0],data:$url[1],cache:false,success:function(data){ alert(data); }});
271   }   }
  function plugin(name,id) { window.open('plugin.php?plugin='+name+'&id='+id, '', 'width=350,height=180'); }  
272    
273  /* ignore this atm, not always working, sometime open does not work  /* ignore this atm, not always working, sometime open does not work
274   function openclose(nummer, act)   function openclose(nummer, act)
# Line 383  echo '</td><td valign=top>'; Line 360  echo '</td><td valign=top>';
360   $state = 'Off';   $state = 'Off';
361   if(count($conn)>0)   if(count($conn)>0)
362   {   {
363   if($retval==0) $state = 'On';   if($retval==0)
364     {
365     // first try mcore, then get ssh
366     $ping_retval = ping_host($conn['ip'],$mcore_port,$ping_timeout);
367     if($ping_retval==1) $ping_retval = ping_host($dat['ip'],$ssh_port,$ping_timeout);
368     if($ping_retval==0)
369     {
370     $state = 'On';
371     }
372     }
373   }   }
374    
375   echo '<img src="pics/logo2.jpg"><br><br>';   echo '<img src="pics/logo2.jpg"><br><br>';
376    
377   echo '<input class="but" type=submit value="SAVE" style="width:150px"><br><br>';   echo '<input class="but" type=submit value="SAVE" style="width:150px"><br><br>';
378    
379   echo '<input class="but" type=submit name="do_add" value="SAVE+ADD COMMENT" style="width:150px"><br>';   echo '<input class="but" type=submit name="do_add" value="ADD COMMENT" style="width:150px"><br>';
380   echo '<input class="but" type=submit name="do_add" value="SAVE+ADD PRINTER" style="width:150px"><br>';   echo '<input class="but" type=submit name="do_add" value="ADD PRINTER" style="width:150px"><br>';
381   echo '<input class="but" type=submit name="do_add" value="SAVE+ADD SESSION" style="width:150px"><br>';   echo '<input class="but" type=submit name="do_add" value="ADD SESSION-CITRIX" style="width:150px"><br>';
382   echo '<input class="but" type=submit name="do_add" value="SAVE+ADD MODULE" style="width:150px"><br>';   echo '<input class="but" type=submit name="do_add" value="ADD SESSION-STOREFRONT" style="width:150px"><br>';
383   echo '<input class="but" type=submit name="do_add" value="SAVE+ADD MENUITEM" style="width:150px"><br>';   echo '<input class="but" type=submit name="do_add" value="ADD MODULE" style="width:150px"><br>';
384   if($alxos >= '0.6.0')   echo '<input class="but" type=submit name="do_add" value="ADD MENUITEM" style="width:150px"><br>';
385   {   echo '<input class="but" type=submit name="do_add" value="ADD AUTOSTART" style="width:150px"><br>';
  echo '<input class="but" type=submit name="do_add" value="INSTALL PLUGIN" style="width:150px"><br>';  
  }  
386   echo '<br>';   echo '<br>';
387    
388   if($id>0) $KILLCAP='DEACTIVATE'; else $KILLCAP='ACTIVATE';   if($id>0) $KILLCAP='DEACTIVATE'; else $KILLCAP='ACTIVATE';
# Line 423  echo '</td><td valign=top>'; Line 407  echo '</td><td valign=top>';
407   if($state=='On')   if($state=='On')
408   {   {
409   echo '<u>IP:</u> '.$conn['ip'].'<br><br>';   echo '<u>IP:</u> '.$conn['ip'].'<br><br>';
410   $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}"', $conn['ip']);   echo '<u>OS:</u> '.$alxos.'<br>';
411   $osver = explode(':',$osver[1]);   echo '<u>Utils:</u> '.$alxutils.'<br>';
  if($osver[0] == '') $osver[0]='unknown';  
  if($osver[1] == '') $osver[1]='unknown';  
   
  # update os string in database  
  if($alxos == '')  
  {  
  mysql_query('insert into client_version(serial,os,utils) values("'.$id.'","'.$osver[0].'","'.$osver[1].'")  
  on duplicate key update os="'.$osver[0].'", utils="'.$osver[1].'"');  
  # reload the site  
  echo '<script type="text/javascript">setTimeout(\'window.location.reload()\',0);</script>';  
  }  
   
  echo '<u>OS:</u> '.$osver[0].'<br>';  
  echo '<u>Utils:</u> '.$osver[1].'<br>';  
   
  if($osver[0] <> 'unknown')  
  {  
  //write them to database  
  }  
412   }   }
413    
414   echo '</b></div>';   echo '</b></div>';

Legend:
Removed from v.7112  
changed lines
  Added in v.7132