index.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. $altCfg = $ubillingConfig->getAlter();
  3. if (@$altCfg['STEALTH_TARIFFS_ENABLED']) {
  4. if (cfr(StealthTariffs::RIGHT_CONFIG)) {
  5. $stealth = new StealthTariffs();
  6. //setting some existing tariff as stealth
  7. if (ubRouting::checkPost($stealth::PROUTE_CREATE)) {
  8. $newTariffName = ubRouting::post($stealth::PROUTE_CREATE);
  9. $creationResult = $stealth->create($newTariffName);
  10. if (empty($creationResult)) {
  11. ubRouting::nav($stealth::URL_ME);
  12. } else {
  13. show_error($creationResult);
  14. }
  15. }
  16. //deleting existing stealth tariff
  17. if (ubRouting::checkGet($stealth::ROUTE_DELETE)) {
  18. $tariffToDelete = ubRouting::get($stealth::ROUTE_DELETE);
  19. $deletionResult = $stealth->delete($tariffToDelete);
  20. if (empty($deletionResult)) {
  21. ubRouting::nav($stealth::URL_ME);
  22. } else {
  23. show_error($deletionResult);
  24. }
  25. }
  26. //rendering list/creation forms
  27. show_window(__('Available stealth tariffs'), $stealth->renderList());
  28. } else {
  29. show_error(__('Access denied'));
  30. }
  31. } else {
  32. show_error(__('This module is disabled'));
  33. }