index.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?php
  2. if (cfr('OMEGATV')) {
  3. $altCfg = $ubillingConfig->getAlter();
  4. if (@$altCfg['OMEGATV_ENABLED']) {
  5. $omega = new OmegaTV();
  6. show_window(__('OmegaTV'), $omega->renderPanel());
  7. //tariffs management
  8. if (wf_CheckGet(array('tariffs'))) {
  9. //creating new tariff
  10. if (wf_CheckPost(array('newtariffid'))) {
  11. $omega->createTariff();
  12. rcms_redirect($omega::URL_ME . '&tariffs=true');
  13. }
  14. //deleting existing tariff
  15. if (wf_CheckGet(array('deleteid'))) {
  16. if (!$omega->isTariffProtected($_GET['deleteid'])) {
  17. $omega->deleteTariff($_GET['deleteid']);
  18. rcms_redirect($omega::URL_ME . '&tariffs=true');
  19. } else {
  20. show_error(__('You know, we really would like to let you perform this action, but our conscience does not allow us to do') . ' ' . __('Tariff is used by some users'));
  21. }
  22. }
  23. //editing tariff
  24. if (wf_CheckPost(array('edittariffid'))) {
  25. $omega->catchTariffSave();
  26. rcms_redirect($omega::URL_ME . '&tariffs=true');
  27. }
  28. if (!wf_CheckGet(array('chanlist'))) {
  29. //listing available tariffs
  30. show_window(__('Tariffs'), $omega->renderTariffsList());
  31. //channels list preview
  32. show_window(__('Channels'), $omega->renderChanControls());
  33. //tariffs creation form
  34. show_window(__('Create new tariff'), $omega->renderTariffCreateForm());
  35. } else {
  36. //view tariff channels list
  37. show_window('', wf_BackLink($omega::URL_ME . '&tariffs=true'));
  38. show_window(__('Channels'), $omega->renderTariffsRemote($_GET['chanlist'], true, true));
  39. }
  40. }
  41. if (wf_CheckGet(array('subscriptions'))) {
  42. //getting new device activation code
  43. if (wf_CheckGet(array('getdevicecode'))) {
  44. die($omega->generateDeviceCode($_GET['getdevicecode']));
  45. }
  46. //deleting existing device for some user
  47. if (wf_CheckGet(array('deletedevice', 'customerid'))) {
  48. $deleteUniq = $_GET['deletedevice'];
  49. $deviceDeleteLogin = $omega->getLocalCustomerLogin($_GET['customerid']);
  50. $omega->deleteDevice($_GET['customerid'], $deleteUniq);
  51. log_register('OMEGATV DEVICE DELETE `' . $deleteUniq . '` FOR (' . $deviceDeleteLogin . ') AS [' . $_GET['customerid'] . ']');
  52. rcms_redirect($omega::URL_SUBSCRIBER . $_GET['customerid']);
  53. }
  54. //deleting existing playlist for some user
  55. if (wf_CheckGet(array('deleteplaylist', 'customerid'))) {
  56. $deleteUniq = $_GET['deleteplaylist'];
  57. $playlistDeleteLogin = $omega->getLocalCustomerLogin($_GET['customerid']);
  58. $omega->deletePlaylist($_GET['customerid'], $deleteUniq);
  59. log_register('OMEGATV PLAYLIST DELETE `' . $deleteUniq . '` FOR (' . $playlistDeleteLogin . ') AS [' . $_GET['customerid'] . ']');
  60. rcms_redirect($omega::URL_SUBSCRIBER . $_GET['customerid']);
  61. }
  62. //json ajax data for subscribers list
  63. if (wf_CheckGet(array('ajuserlist'))) {
  64. $omega->ajUserList();
  65. }
  66. //rendering user list container
  67. show_window(__('Subscriptions'), $omega->renderUserListContainer());
  68. zb_BillingStats(true);
  69. }
  70. if (wf_CheckGet(array('customerprofile'))) {
  71. //user blocking
  72. if (wf_CheckGet(array('blockuser'))) {
  73. $omega->setCustomerActive($_GET['customerprofile'], false);
  74. rcms_redirect($omega::URL_SUBSCRIBER . $_GET['customerprofile']);
  75. }
  76. //user unblocking
  77. if (wf_CheckGet(array('unblockuser'))) {
  78. $omega->setCustomerActive($_GET['customerprofile'], true);
  79. rcms_redirect($omega::URL_SUBSCRIBER . $_GET['customerprofile']);
  80. }
  81. //user tariff editing
  82. if (wf_CheckPost(array('changebasetariff'))) {
  83. $omega->changeUserTariffs($_GET['customerprofile']);
  84. rcms_redirect($omega::URL_SUBSCRIBER . $_GET['customerprofile']);
  85. }
  86. //user device assign
  87. if (wf_CheckPost(array('manualassigndevice', 'manualassigndevicecustomerid', 'manualassigndeviceuniq'))) {
  88. $assignResult = $omega->assignDeviceManual();
  89. if (empty($assignResult)) {
  90. rcms_redirect($omega::URL_SUBSCRIBER . $_GET['customerprofile']);
  91. } else {
  92. show_error($assignResult);
  93. }
  94. }
  95. //cretaion of new playlist
  96. if (wf_CheckPost(array('manualassigndevicecustomerid', 'manualassigndevice', 'manualassignnewplaylist'))) {
  97. $assignResult = $omega->assignPlaylistManual();
  98. if (empty($assignResult)) {
  99. rcms_redirect($omega::URL_SUBSCRIBER . $_GET['customerprofile']);
  100. } else {
  101. show_error($assignResult);
  102. }
  103. }
  104. show_window(__('Profile'), $omega->renderUserInfo($_GET['customerprofile']));
  105. show_window('', wf_BackLink($omega::URL_ME . '&subscriptions=true'));
  106. }
  107. //devices management
  108. if (wf_CheckGet(array('devices'))) {
  109. //deleting existing device
  110. if (wf_CheckGet(array('deletedevice', 'customerid'))) {
  111. $deleteUniq = $_GET['deletedevice'];
  112. $deviceDeleteLogin = $omega->getLocalCustomerLogin($_GET['customerid']);
  113. $omega->deleteDevice($_GET['customerid'], $deleteUniq);
  114. log_register('OMEGATV DEVICE DELETE `' . $deleteUniq . '` FOR (' . $deviceDeleteLogin . ') AS [' . $_GET['customerid'] . ']');
  115. rcms_redirect($omega::URL_ME . '&devices=true');
  116. }
  117. //rendering devices list
  118. show_window(__('Devices'), $omega->renderDevicesList());
  119. }
  120. //new user manual registration
  121. if (wf_CheckPost(array('manualregister', 'manualregisterlogin'))) {
  122. $manualRegResult = $omega->registerUserManual($_POST['manualregisterlogin']);
  123. if (empty($manualRegResult)) {
  124. if (wf_CheckGet(array('username'))) {
  125. $localCustomerId = $omega->getLocalCustomerId($_GET['username']);
  126. rcms_redirect($omega::URL_SUBSCRIBER . $localCustomerId);
  127. } else {
  128. rcms_redirect($omega::URL_ME . '&subscriptions=true');
  129. }
  130. } else {
  131. show_error($manualRegResult);
  132. }
  133. }
  134. //black magic profile redirect or new subscriber registration
  135. if (wf_CheckGet(array('username'))) {
  136. $localCustomerId = $omega->getLocalCustomerId($_GET['username']);
  137. if (!empty($localCustomerId)) {
  138. rcms_redirect($omega::URL_SUBSCRIBER . $localCustomerId);
  139. } else {
  140. show_warning(__('This user have not existing OmegaTV subscription profile. You can register it using appropriate button on upper panel.'));
  141. show_window('', web_UserControls($_GET['username']));
  142. }
  143. }
  144. } else {
  145. show_error(__('This module is disabled'));
  146. }
  147. } else {
  148. show_error(__('Acccess denied'));
  149. }
  150. ?>