index.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. if (cfr('MTSIGMON')) {
  3. // Main code part
  4. $alter_config = $ubillingConfig->getAlter();
  5. if ($alter_config['MTSIGMON_ENABLED']) {
  6. $sigmon = new MTsigmon();
  7. if ( wf_CheckGet(array('IndividualRefresh')) && wf_getBoolFromVar($_GET['IndividualRefresh'], true) ) {
  8. if ( wf_CheckGet(array('apid')) and !wf_CheckGet(array('cpeMAC')) ) { $sigmon->MTDevicesPolling(false, vf($_GET['apid'], 3)); }
  9. if ( wf_CheckGet(array('GetAPInfo')) && wf_getBoolFromVar($_GET['GetAPInfo'], true) && wf_CheckGet(array('apid')) ) {
  10. $APInfoData = $sigmon->getAPEssentialData( $_GET['apid'],
  11. wf_getBoolFromVar($_GET['returnAsHTML'], true),
  12. wf_getBoolFromVar($_GET['returnInSpoiler'], true)
  13. );
  14. die($APInfoData);
  15. }
  16. if ( wf_CheckGet(array('cpeMAC')) ) {
  17. if ( wf_CheckGet(array('getGraphs')) && wf_getBoolFromVar($_GET['getGraphs'], true) ) {
  18. $getDataFromAP = ( wf_CheckGet(array('fromAP')) && wf_getBoolFromVar($_GET['fromAP'], true) );
  19. if ($getDataFromAP) {
  20. $SignalGraph = $sigmon->renderSignalGraphs( $_GET['cpeMAC'], true,
  21. wf_getBoolFromVar($_GET['showTitle'], true),
  22. wf_getBoolFromVar($_GET['showXLabel'], true),
  23. wf_getBoolFromVar($_GET['showYLabel'], true),
  24. wf_getBoolFromVar($_GET['showRangeSelector'], true)
  25. );
  26. } else {
  27. $SignalGraph = $sigmon->renderSignalGraphs( $_GET['cpeMAC'], false,
  28. wf_getBoolFromVar($_GET['showTitle'], true),
  29. wf_getBoolFromVar($_GET['showXLabel'], true),
  30. wf_getBoolFromVar($_GET['showYLabel'], true),
  31. wf_getBoolFromVar($_GET['showRangeSelector'], true)
  32. );
  33. }
  34. if ( empty($SignalGraph)) {die();}
  35. if ( wf_CheckGet(array('returnInSpoiler')) && wf_getBoolFromVar($_GET['returnInSpoiler'], true)) {
  36. $WCPE = new WifiCPE();
  37. $SpoilerTitle = ($getDataFromAP) ? __('Signal data from AP') : __('Signal data from CPE');
  38. $GraphContainerID = ( ($getDataFromAP) ? 'SpoilerCPE_' : 'SpoilerAP_') . wf_InputId();
  39. $GraphContainerSelector = '#' . $GraphContainerID . ' .spoiler_body';
  40. $GraphRefreshButton = $WCPE->getAPCPEGraphRefreshButton($_GET['cpeMAC'], $GraphContainerSelector, $getDataFromAP, false);
  41. $SignalGraph = wf_Spoiler($SignalGraph, $GraphRefreshButton . '&nbsp&nbsp' . $SpoilerTitle, false, $GraphContainerID, '', '', '', 'style="margin: 10px auto; display: table;"');
  42. }
  43. die($SignalGraph);
  44. }
  45. if (wf_CheckGet(array('apid'))) {
  46. die ( json_encode( $sigmon->getCPESignalData($_GET['cpeMAC'], $_GET['apid'], '', '', true, true ) ) );
  47. }
  48. if (wf_CheckGet(array('cpeIP', 'cpeCommunity'))) {
  49. die ( json_encode( $sigmon->getCPESignalData($_GET['cpeMAC'], 0, $_GET['cpeIP'], $_GET['cpeCommunity'], false, true ) ) );
  50. }
  51. }
  52. } else {
  53. // force MT polling
  54. if (wf_CheckGet(array('forcepoll'))) {
  55. $sigmon->MTDevicesPolling(true);
  56. if (wf_CheckGet(array('username'))) {
  57. rcms_redirect($sigmon::URL_ME . '&username=' . vf($_GET['username']));
  58. } else {
  59. rcms_redirect($sigmon::URL_ME);
  60. }
  61. }
  62. // getting MT json data for list
  63. if (wf_CheckGet(array('ajaxmt', 'mtid'))) {
  64. $sigmon->renderMTsigmonList(vf($_GET['mtid'], 3));
  65. }
  66. // rendering availavle MT LIST
  67. show_window(__('Wireless APs signal monitor'), $sigmon->controls());
  68. if ($sigmon->useSwtichGroupsAndTabs()) {
  69. $sigmon->renderMTListTabbed();
  70. } else {
  71. $sigmon->renderMTList();
  72. }
  73. }
  74. } else {
  75. show_error(__('This module disabled'));
  76. }
  77. } else {
  78. show_error(__('You cant control this module'));
  79. }
  80. ?>