index.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. $altCfg = $ubillingConfig->getAlter();
  3. if ($altCfg['ITSATRAP_ENABLED']) {
  4. if (cfr('ITSATRAP')) {
  5. $itsatrap = new ItSaTrap();
  6. //saving new data source and lines limit
  7. if (ubRouting::checkPost('newdatasource', false)) {
  8. if (cfr('ITSATRAPCFG')) {
  9. $itsatrap->saveBasicConfig();
  10. ubRouting::nav($itsatrap::URL_ME . $itsatrap::URL_CONFIG);
  11. } else {
  12. show_error(__('Access denied'));
  13. }
  14. }
  15. //new trap type creation
  16. if (ubRouting::checkPost(array('newname', 'newmatch', 'newcolor'))) {
  17. if (cfr('ITSATRAPCFG')) {
  18. $itsatrap->createTrapType();
  19. ubRouting::nav($itsatrap::URL_ME . $itsatrap::URL_CONFIG);
  20. } else {
  21. show_error(__('Access denied'));
  22. }
  23. }
  24. //existing trap editing
  25. if (ubRouting::checkPost(array('edittraptypeid', 'editname', 'editmatch', 'editcolor'))) {
  26. if (cfr('ITSATRAPCFG')) {
  27. $itsatrap->saveTrapType();
  28. ubRouting::nav($itsatrap::URL_ME . $itsatrap::URL_CONFIG);
  29. } else {
  30. show_error(__('Access denied'));
  31. }
  32. }
  33. //trap type deletion
  34. if (ubRouting::checkGet('deletetrapid')) {
  35. if (cfr('ITSATRAPCFG')) {
  36. $deletionResult = $itsatrap->deleteTrapType(ubRouting::get('deletetrapid', 'int'));
  37. if (empty($deletionResult)) {
  38. ubRouting::nav($itsatrap::URL_ME . $itsatrap::URL_CONFIG);
  39. } else {
  40. show_error($deletionResult);
  41. }
  42. } else {
  43. show_error(__('Access denied'));
  44. }
  45. }
  46. //current trap events background data
  47. if (ubRouting::checkGet('ajaxtrapslist')) {
  48. $itsatrap->ajTrapList();
  49. }
  50. //some interface here
  51. if (cfr('ITSATRAPCFG')) {
  52. // we dont need control panel if no CFG rights.
  53. show_window('', $itsatrap->renderControls());
  54. }
  55. //render some configuration forms and controls
  56. if (ubRouting::get('config')) {
  57. show_window(__('Configuration'), $itsatrap->renderConfigForm());
  58. $itsatrap->renderDataSourceCheck();
  59. show_window(__('Available SNMP trap types'), $itsatrap->renderTrapTypesList());
  60. show_window('', $itsatrap->renderTrapCreateForm());
  61. } else {
  62. //rendering raw results
  63. if (ubRouting::get('rawdata')) {
  64. show_window(__('RAW') . ' ' . __('Data'), $itsatrap->renderRawData());
  65. } else {
  66. //normal trap events display
  67. show_window(__('Events'), $itsatrap->renderTrapEventsList());
  68. }
  69. }
  70. zb_BillingStats(true);
  71. } else {
  72. show_error(__('Access denied'));
  73. }
  74. } else {
  75. show_error(__('This module is disabled'));
  76. }