index.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. $result = '';
  3. if (cfr('USERPROFILE')) {
  4. if (ubRouting::get('ip', 'mres')) {
  5. $userIp = ubRouting::get('ip', 'mres');
  6. $nethosts = new NyanORM('nethosts');
  7. $nases = new NyanORM('nas');
  8. $networks = new NyanORM('networks');
  9. //getting some user nethost data
  10. $nethosts->where('ip', '=', $userIp);
  11. $userNethost = $nethosts->getAll();
  12. if (!empty($userNethost)) {
  13. $userNetId = $userNethost[0]['netid'];
  14. $userNetId = ubRouting::filters($userNetId, 'int');
  15. $nases->where('netid', '=', $userNetId);
  16. $allNases = $nases->getAll('id');
  17. if (!empty($allNases)) {
  18. $rows = '';
  19. //all NASes for this network
  20. foreach ($allNases as $io => $each) {
  21. $cells = wf_TableCell(__('NAS'), '', 'row1');
  22. $cells .= wf_TableCell($each['nasname']);
  23. $cells .= wf_TableCell($each['nasip']);
  24. $rows .= wf_TableRow($cells, 'row2');
  25. }
  26. //Network info
  27. if (!empty($userNetId)) {
  28. $networks->where('id', '=', $userNetId);
  29. $userNetwork = $networks->getAll();
  30. $userNetwork = $userNetwork[0];
  31. $cells = wf_TableCell(__('Network'), '', 'row1');
  32. $cells .= wf_TableCell($userNetwork['nettype']);
  33. $cells .= wf_TableCell($userNetwork['desc']);
  34. $rows .= wf_TableRow($cells, 'row2');
  35. }
  36. $result .= wf_TableBody($rows, '40%', '0', '');
  37. } else {
  38. $messages = new UbillingMessageHelper();
  39. $result .= $messages->getStyledMessage(__('No NAS servers assigned for this user network'), 'warning');
  40. }
  41. } else {
  42. $result = __('Strange exeption') . ': NO_NETHOST_DATA';
  43. }
  44. } else {
  45. $result = __('Strange exeption') . ': NO_GET_IP';
  46. }
  47. } else {
  48. $result = __('Access denied');
  49. }
  50. die($result);
  51. ?>