index.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. if (cfr('YOUTV')) {
  3. if ($ubillingConfig->getAlterParam('YOUTV_ENABLED')) {
  4. $youtv = new YTV();
  5. //new subscriber register
  6. if (ubRouting::checkPost($youtv::PROUTE_SUBREG)) {
  7. $userLogin = ubRouting::post($youtv::PROUTE_SUBREG, 'mres');
  8. $regResult = $youtv->userRegister($userLogin);
  9. if (!$regResult) {
  10. ubRouting::nav($youtv::URL_ME . '&' . $youtv::ROUTE_SUBVIEW . '=' . $userLogin);
  11. } else {
  12. show_error($regResult);
  13. }
  14. }
  15. //rendering available subscribers list data
  16. if (ubRouting::checkGet($youtv::ROUTE_SUBAJ)) {
  17. $youtv->renderSubsribersAjReply();
  18. }
  19. //new tariff creation
  20. if (ubRouting::checkPost(array($youtv::PROUTE_CREATETARIFFNAME, $youtv::PROUTE_CREATETARIFFID))) {
  21. $tariffCreateResult = $youtv->createTariff();
  22. if (!$tariffCreateResult) {
  23. ubRouting::nav($youtv::URL_ME . '&' . $youtv::ROUTE_TARIFFS . '=true');
  24. } else {
  25. show_error($tariffCreateResult);
  26. }
  27. }
  28. //deleting existing tariff
  29. if (ubRouting::checkGet($youtv::ROUTE_TARDEL)) {
  30. $tariffDeletionResult = $youtv->deleteTariff(ubRouting::get($youtv::ROUTE_TARDEL));
  31. if (!$tariffDeletionResult) {
  32. ubRouting::nav($youtv::URL_ME . '&' . $youtv::ROUTE_TARIFFS . '=true');
  33. } else {
  34. show_error($tariffDeletionResult);
  35. }
  36. }
  37. //subscriber primary tariff editing
  38. if (ubRouting::checkPost(array($youtv::PROUTE_TARIFFEDITSUBID, $youtv::PROUTE_SETMAINTARIFFID))) {
  39. $userLogin = $youtv->getSubscriberLogin(ubRouting::post($youtv::PROUTE_TARIFFEDITSUBID));
  40. $youtv->setMainTariff(ubRouting::post($youtv::PROUTE_TARIFFEDITSUBID), ubRouting::post($youtv::PROUTE_SETMAINTARIFFID));
  41. ubRouting::nav($youtv::URL_ME . '&' . $youtv::ROUTE_SUBVIEW . '=' . $userLogin);
  42. }
  43. //black magic redirect here
  44. if (ubRouting::checkGet($youtv::ROUTE_SUBLOOKUP)) {
  45. $userLogin = ubRouting::get($youtv::ROUTE_SUBLOOKUP);
  46. $subscriberId = $youtv->getSubscriberId($userLogin);
  47. if ($subscriberId) {
  48. ubRouting::nav($youtv::URL_ME . '&' . $youtv::ROUTE_SUBVIEW . '=' . $userLogin);
  49. } else {
  50. show_error(__('This user account is not associated with any existing YouTV subscriber'));
  51. show_window('', web_UserControls($userLogin));
  52. }
  53. } else {
  54. //main module controls
  55. show_window(__('YouTV'), $youtv->renderPanel());
  56. }
  57. //render existing subscriber by its login
  58. if (ubRouting::checkGet($youtv::ROUTE_SUBVIEW)) {
  59. show_window(__('User profile') . ' ' . __('YouTV'), $youtv->renderSubscriber(ubRouting::get($youtv::ROUTE_SUBVIEW)));
  60. }
  61. //rendering subscribers list container
  62. if (ubRouting::checkGet($youtv::ROUTE_SUBLIST)) {
  63. show_window(__('Subscriptions'), $youtv->renderSubscribersList());
  64. }
  65. //available tariffs list rendering
  66. if (ubRouting::checkGet($youtv::ROUTE_TARIFFS)) {
  67. show_window(__('Tariffs'), $youtv->renderTariffs());
  68. }
  69. zb_BillingStats(true);
  70. } else {
  71. show_error(__('This module is disabled'));
  72. }
  73. } else {
  74. show_error(__('Access denied'));
  75. }