index.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. global $ubillingConfig;
  3. $altcfg = $ubillingConfig->getAlter();
  4. if (@$altcfg[OnuRegister::MODULE_CONFIG]) {
  5. if (cfr(OnuRegister::REG_MODULE_RIGHTS)) {
  6. $register = new OnuRegister();
  7. $avidity = $register->getAvidity();
  8. $onuIdentifier = OnuRegister::EMPTY_FIELD;
  9. if (wf_CheckGet(array('action'))) {
  10. if (isset($_GET['login'])) {
  11. $tmpLogin = $_GET['login'];
  12. } else {
  13. $tmpLogin = '';
  14. }
  15. die($register->getQinqByLogin($tmpLogin));
  16. }
  17. if (!empty($avidity)) {
  18. $avidity_z = $avidity['M']['LUCIO'];
  19. $avidity_w = $avidity['M']['REAPER'];
  20. $avidity_b = $avidity['M']['LAI'];
  21. if (wf_CheckGet(array('oltlist'))) {
  22. if (wf_CheckGet(array('oltid'))) {
  23. if (wf_CheckGet(array('massfix', 'preview'))) {
  24. $actionLinks = wf_Link(OnuRegister::UNREG_MASS_FIX_RUN_OLT_URL . $_GET['oltid'], __('Run'), false, 'ubButton');
  25. $register->listFixable();
  26. }
  27. if (wf_CheckGet(array('massfix', 'run'))) {
  28. $register->onuMassRegister();
  29. show_window(__('Result'), $register->result);
  30. }
  31. if (wf_CheckGet(array(OnuRegister::OLTIP_FIELD, OnuRegister::INTERFACE_FIELD, OnuRegister::TYPE_FIELD))) {
  32. if ($altcfg['ONUREG_ALWAYS_SHOW_UNREGISTERED']) {
  33. show_info(__('OLT device') . ' : ' . $_GET[OnuRegister::OLTIP_FIELD]);
  34. show_window(__('Check for unauthenticated ONU/ONT'), $register->$avidity_z());
  35. show_warning(__('OLT device') . ' : ' . $_GET[OnuRegister::OLTIP_FIELD]);
  36. }
  37. if (wf_CheckGet(array(OnuRegister::MACONU_FIELD))) {
  38. $onuIdentifier = $_GET[OnuRegister::MACONU_FIELD];
  39. }
  40. if (wf_CheckGet(array(OnuRegister::SERIAL_FIELD))) {
  41. $onuIdentifier = $_GET[OnuRegister::SERIAL_FIELD];
  42. }
  43. if (!empty($onuIdentifier)) {
  44. $register->currentOltIp = $_GET[OnuRegister::OLTIP_FIELD];
  45. $register->currentOltInterface = $_GET[OnuRegister::INTERFACE_FIELD];
  46. $register->currentPonType = $_GET[OnuRegister::TYPE_FIELD];
  47. $register->onuIdentifier = $onuIdentifier;
  48. $register->currentOltSwId = $_GET[OnuRegister::OLTID_FIELD];
  49. show_window(__('Register'), $register->registerOnuForm());
  50. }
  51. } else {
  52. show_window(__('Check for unauthenticated ONU/ONT'), $register->$avidity_z());
  53. }
  54. } else {
  55. show_window(__('All ZTE OLTs'), $register->$avidity_b(false));
  56. }
  57. } elseif (wf_CheckGet(array('massfix', 'preview'))) {
  58. $actionLinks = wf_Link(OnuRegister::UNREG_MASS_FIX_RUN_URL, __('Run'), false, 'ubButton');
  59. $register->listFixable();
  60. } elseif (wf_CheckGet(array('massfix', 'run'))) {
  61. $register->onuMassRegister();
  62. show_window(__('Result'), $register->result);
  63. } else {
  64. if (wf_CheckGet(array(OnuRegister::OLTIP_FIELD, OnuRegister::INTERFACE_FIELD, OnuRegister::TYPE_FIELD))) {
  65. if ($altcfg['ONUREG_ALWAYS_SHOW_UNREGISTERED']) {
  66. show_window(__('Check for unauthenticated ONU/ONT'), $register->$avidity_z());
  67. }
  68. if (wf_CheckGet(array(OnuRegister::MACONU_FIELD))) {
  69. $onuIdentifier = $_GET[OnuRegister::MACONU_FIELD];
  70. }
  71. if (wf_CheckGet(array(OnuRegister::SERIAL_FIELD))) {
  72. $onuIdentifier = $_GET[OnuRegister::SERIAL_FIELD];
  73. }
  74. if (!empty($onuIdentifier)) {
  75. $register->currentOltIp = $_GET[OnuRegister::OLTIP_FIELD];
  76. $register->currentOltInterface = $_GET[OnuRegister::INTERFACE_FIELD];
  77. $register->currentPonType = $_GET[OnuRegister::TYPE_FIELD];
  78. $register->onuIdentifier = $onuIdentifier;
  79. $register->currentOltSwId = $_GET[OnuRegister::OLTID_FIELD];
  80. show_window(__('Register'), $register->registerOnuForm());
  81. }
  82. } else {
  83. show_window(__('Check for unauthenticated ONU/ONT'), $register->$avidity_z());
  84. }
  85. }
  86. show_window(OnuRegister::EMPTY_FIELD, wf_BackLink(PONizer::URL_ONULIST));
  87. if (wf_CheckPost(array(OnuRegister::TYPE_FIELD, OnuRegister::INTERFACE_FIELD, OnuRegister::OLTIP_FIELD, OnuRegister::MODELID_FIELD, OnuRegister::OLTID_FIELD))) {
  88. if ($_POST[OnuRegister::MODELID_FIELD] != OnuRegister::MODELID_PLACEHOLDER) {
  89. if (wf_CheckPost(array(OnuRegister::VLAN_FIELD)) or $_POST[OnuRegister::GET_UNIVERSALQINQ] != 'none') {
  90. $register->addMac = OnuRegister::EMPTY_FIELD;
  91. $save = false;
  92. $router = false;
  93. $register->login = OnuRegister::EMPTY_FIELD;
  94. $PONizerAdd = false;
  95. if (wf_CheckPost(array(OnuRegister::LOGIN_FIELD))) {
  96. $register->login = $_POST[OnuRegister::LOGIN_FIELD];
  97. }
  98. if (wf_CheckPost(array(OnuRegister::MAC_FIELD))) {
  99. $onuIdentifier = $_POST[OnuRegister::MAC_FIELD];
  100. }
  101. if (wf_CheckPost(array(OnuRegister::SN_FIELD))) {
  102. $onuIdentifier = $_POST[OnuRegister::SN_FIELD];
  103. }
  104. if (isset($_POST[OnuRegister::ROUTER_FIELD])) {
  105. $router = $_POST[OnuRegister::ROUTER_FIELD];
  106. }
  107. if (isset($_POST[OnuRegister::MAC_ONU_FIELD])) {
  108. $register->addMac = $_POST[OnuRegister::MAC_ONU_FIELD];
  109. }
  110. if (isset($_POST[OnuRegister::RANDOM_MAC_FIELD])) {
  111. $register->addMac = $register->generateRandomOnuMac();
  112. }
  113. if (isset($_POST[OnuRegister::SAVE_FIELD])) {
  114. $save = $_POST[OnuRegister::SAVE_FIELD];
  115. }
  116. if (isset($_POST[OnuRegister::PONIZER_ADD_FIELD])) {
  117. $register->ponizerAdd = true;
  118. }
  119. $register->currentOltIp = $_POST[OnuRegister::OLTIP_FIELD];
  120. $register->currentOltInterface = $_POST[OnuRegister::INTERFACE_FIELD];
  121. $register->currentPonType = $_POST[OnuRegister::TYPE_FIELD];
  122. $register->onuIdentifier = $onuIdentifier;
  123. $register->currentOltSwId = $_POST[OnuRegister::OLTID_FIELD];
  124. $register->save = $save;
  125. $register->router = $router;
  126. $register->vlan = $_POST[OnuRegister::VLAN_FIELD];
  127. $register->onuModel = $_POST[OnuRegister::MODELID_FIELD];
  128. if ($_POST[OnuRegister::ONUDESCRIPTION_FIELD] and !empty($_POST[OnuRegister::ONUDESCRIPTION_FIELD]) and $_POST[OnuRegister::ONUDESCRIPTION_FIELD] != '__empty') {
  129. $register->onuDescription = $_POST[OnuRegister::ONUDESCRIPTION_FIELD];
  130. }
  131. if ($register->login) {
  132. if (isset($_POST[OnuRegister::ONUDESCRIPTION_AS_LOGIN_FIELD])) {
  133. $register->onuDescription = $register->login;
  134. }
  135. }
  136. if (isset($_POST[OnuRegister::GET_UNIVERSALQINQ])) {
  137. $register->useUniversalQINQ = $_POST[OnuRegister::GET_UNIVERSALQINQ];
  138. }
  139. if (isset($_POST[OnuRegister::DHCP_SNOOPING_FIELD])) {
  140. $register->onuDhcpSnooping = 'set';
  141. }
  142. if (isset($_POST[OnuRegister::LOOPDETECT_FIELD])) {
  143. $register->onuLoopdetect = 'set';
  144. }
  145. $loginCheck = $register->checkOltParams();
  146. if ($loginCheck !== OnuRegister::NO_ERROR_CONNECTION) {
  147. show_error(__($loginCheck));
  148. } else {
  149. $register->$avidity_w();
  150. if (empty($register->error)) {
  151. show_window(__('Result'), $register->result);
  152. } else {
  153. show_error(__($register->error) . ': ' . count($register->existId));
  154. }
  155. }
  156. } else {
  157. show_error(__(OnuRegister::ERROR_NOT_ALL_FIELDS));
  158. show_error(__(OnuRegister::ERROR_NO_VLAN_SET));
  159. }
  160. } else {
  161. show_error(__(OnuRegister::ERROR_WRONG_MODELID));
  162. }
  163. } elseif (wf_CheckPost(array(OnuRegister::TYPE_FIELD))) {
  164. show_error(__(OnuRegister::ERROR_NOT_ALL_FIELDS));
  165. if (!wf_CheckPost(array(OnuRegister::INTERFACE_FIELD))) {
  166. show_error(__(OnuRegister::ERROR_NO_INTERFACE_SET));
  167. }
  168. if (!wf_CheckPost(array(OnuRegister::OLTIP_FIELD))) {
  169. show_error(__(OnuRegister::ERROR_NO_OLTIP_SET));
  170. }
  171. }
  172. zb_BillingStats(true, 'zteonureg');
  173. } else {
  174. show_error(__(OnuRegister::ERROR_NO_LICENSE));
  175. }
  176. } else {
  177. show_error(__(OnuRegister::ERROR_NO_RIGHTS));
  178. }
  179. } else {
  180. show_error(__(OnuRegister::ERROR_NOT_ENABLED));
  181. }