1
0

transferHosts.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /* $Id: transferHosts.php 2893 2007-04-14 13:20:30Z b4rt $ */
  3. /*******************************************************************************
  4. LICENSE
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License (GPL)
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. To read the license please visit http://www.gnu.org/copyleft/gpl.html
  14. *******************************************************************************/
  15. // prevent direct invocation
  16. if ((!isset($cfg['user'])) || (isset($_REQUEST['cfg']))) {
  17. @ob_end_clean();
  18. @header("location: ../../index.php");
  19. exit();
  20. }
  21. /******************************************************************************/
  22. // transfer functions
  23. require_once('inc/functions/functions.transfer.php');
  24. // init template-instance
  25. tmplInitializeInstance($cfg["theme"], "page.transferHosts.tmpl");
  26. // init transfer
  27. transfer_init();
  28. // stat
  29. $sf = new StatFile($transfer);
  30. // set vars
  31. if ($sf->running == 1) {
  32. $transfer_pid = getTransferPid($transfer);
  33. $transfer_cons = netstatConnectionsByPid($transfer_pid);
  34. $transfer_hosts = netstatHostsByPid($transfer_pid);
  35. } else {
  36. $transfer_cons = 0;
  37. }
  38. $tmpl->setvar('cons_hosts', ((isset($transfer_cons)) && ($transfer_cons != "")) ? $transfer_cons : 0);
  39. if ((isset($transfer_hosts)) && ($transfer_hosts != "")) {
  40. $tmpl->setvar('transfer_hosts_aval', 1);
  41. $tmpl->setvar('_ID_HOST', $cfg['_ID_HOST']);
  42. $tmpl->setvar('_ID_PORT', $cfg['_ID_PORT']);
  43. $hostAry = array_keys($transfer_hosts);
  44. $list_host = array();
  45. foreach ($hostAry as $host) {
  46. $host = @trim($host);
  47. $port = @trim($transfer_hosts[$host]);
  48. if ($cfg["transferHosts"] == 1)
  49. $host = @gethostbyaddr($host);
  50. if ($host != "") {
  51. $tmpl->setvar('hosts', 1);
  52. array_push($list_host, array(
  53. 'host' => $host,
  54. 'port' => $port
  55. )
  56. );
  57. }
  58. }
  59. $tmpl->setloop('list_host', $list_host);
  60. }
  61. //refresh
  62. //$tmpl->setvar('meta_refresh', '15;URL=index.php?iid=transferHosts&transfer='.$transfer);
  63. // title + foot
  64. tmplSetTitleBar($transferLabel." - ".$cfg['_ID_HOSTS'], false);
  65. tmplSetFoot(false);
  66. tmplSetIidVars();
  67. // parse template
  68. $tmpl->pparse();
  69. ?>