index.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. if (cfr('NAS')) {
  3. $altCfg = $ubillingConfig->getAlter();
  4. //NAS deletion
  5. if (ubRouting::checkGet('delete', false)) {
  6. $deletenas = ubRouting::get('delete', 'int');
  7. zb_NasDelete($deletenas);
  8. zb_NasConfigSave();
  9. if (@$altCfg['MULTIGEN_ENABLED']) {
  10. $multigen = new MultiGen();
  11. $multigen->deleteAllNasConfiguration($deletenas);
  12. }
  13. ubRouting::nav('?module=nas');
  14. }
  15. //NAS creation
  16. if (ubRouting::checkPost('newnasip')) {
  17. $newnasip = ubRouting::post('newnasip');
  18. $newnetid = ubRouting::post('networkselect');
  19. $newnasname = ubRouting::post('newnasname');
  20. $newnastype = ubRouting::post('newnastype');
  21. $newbandw = ubRouting::post('newbandw');
  22. if ((!empty($newnasip)) AND ( !empty($newnasname))) {
  23. zb_NasAdd($newnetid, $newnasip, $newnasname, $newnastype, $newbandw);
  24. zb_NasConfigSave();
  25. ubRouting::nav('?module=nas');
  26. }
  27. }
  28. if (!ubRouting::checkGet('edit', false)) {
  29. $radiusControls = '';
  30. if ($altCfg['MULTIGEN_ENABLED']) {
  31. $multigenRadiusClientData = web_MultigenListClients();
  32. $radiusControls .= ' ' . wf_modal(web_icon_extended(__('Multigen NAS parameters')), __('Multigen NAS parameters'), $multigenRadiusClientData, '', '600', '300');
  33. }
  34. if ($altCfg['NASMON_ENABLED']) {
  35. $radiusControls .= ' ' . wf_Link('?module=report_nasmon&callback=nas', wf_img_sized('skins/icon_health.png', __('NAS servers state'), '16', '16'));
  36. }
  37. //rendering available NASes list and creation form
  38. show_window(__('Network Access Servers') . ' ' . $radiusControls, web_NasList());
  39. show_window(__('Add new'), web_NasAddForm());
  40. //vlangen patch start
  41. if ($altCfg['VLANGEN_SUPPORT']) {
  42. $terminator = new VlanTerminator;
  43. if (ubRouting::checkGet('DeleteTerminator', false)) {
  44. $TermID = ubRouting::get('DeleteTerminator');
  45. $terminator->delete($TermID);
  46. ubRouting::nav(VlanTerminator::MODULE_URL);
  47. }
  48. if (!ubRouting::checkGet('EditTerminator', false)) {
  49. if (ubRouting::checkPost('AddTerminator', false)) {
  50. $terminator_req = array('IP', 'Username', 'Password');
  51. if (wf_CheckPost($terminator_req)) {
  52. $terminator->add(ubRouting::post('NetworkSelected'), ubRouting::post('VlanPoolSelected'), ubRouting::post('IP'), ubRouting::post('Type'), ubRouting::post('Username'), ubRouting::post('Password'), ubRouting::post('RemoteID'), ubRouting::post('Interface'), ubRouting::post('Relay'));
  53. ubRouting::nav(VlanTerminator::MODULE_URL);
  54. } else {
  55. show_window(__('Error'), __('No all of required fields is filled'));
  56. }
  57. }
  58. $terminator->RenderTerminators();
  59. $terminator->AddForm();
  60. } else {
  61. if (ubRouting::checkGet('EditTerminator', false)) {
  62. $term_id = ubRouting::get('EditTerminator');
  63. if (ubRouting::checkPost('TerminatorEdit', false)) {
  64. $terminator_req = array('IP', 'Username', 'Password');
  65. if (wf_CheckPost($terminator_req)) {
  66. $terminator->edit(ubRouting::post('NetworkSelected'), ubRouting::post('VlanPoolSelected'), ubRouting::post('IP'), ubRouting::post('Type'), ubRouting::post('Username'), ubRouting::post('Password'), ubRouting::post('RemoteID'), ubRouting::post('Interface'), ubRouting::post('Relay'), $term_id);
  67. ubRouting::nav(VlanTerminator::MODULE_URL);
  68. } else {
  69. show_window(__('Error'), __('No all of required fields is filled'));
  70. }
  71. }
  72. $terminator->EditForm($term_id);
  73. }
  74. }
  75. }
  76. //vlangen patch end
  77. } else {
  78. //NAS id to edit
  79. $nasid = ubRouting::get('edit', 'int');
  80. //updating NAS parameters on form receive
  81. if (ubRouting::checkPost('editnastype')) {
  82. $nastype = ubRouting::post('editnastype');
  83. $nasip = ubRouting::post('editnasip');
  84. $nasname = ubRouting::post('editnasname');
  85. $nasbwdurl = ubRouting::post('editnasbwdurl');
  86. $netid = ubRouting::post('networkselect');
  87. zb_NasUpdateParams($nasid, $nastype, $nasip, $nasname, $nasbwdurl, $netid);
  88. zb_NasConfigSave();
  89. ubRouting::nav('?module=nas&edit=' . $nasid);
  90. }
  91. //rendering editing form
  92. show_window(__('Edit') . ' NAS', web_NasEditForm($nasid));
  93. }
  94. } else {
  95. show_error(__('You cant control this module'));
  96. }