index.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <?php
  2. if (cfr('USEREDIT')) {
  3. if (ubRouting::checkGet('username')) {
  4. $login = ubRouting::get('username', 'login');
  5. /**
  6. * Renders basic user params editing interface
  7. *
  8. * @global object $ubillingConfig
  9. * @global object $branchControl
  10. * @param string $login
  11. *
  12. * @return void
  13. */
  14. function web_UserEditShowForm($login) {
  15. global $ubillingConfig;
  16. $altCfg = $ubillingConfig->getAlter();
  17. $stgData = zb_UserGetStargazerData($login);
  18. if (!empty($stgData)) {
  19. $address = zb_UserGetFullAddress($login);
  20. $realname = zb_UserGetRealName($login);
  21. $phone = zb_UserGetPhone($login);
  22. $contract = zb_UserGetContract($login);
  23. $mobile = zb_UserGetMobile($login);
  24. $mail = zb_UserGetEmail($login);
  25. $notes = zb_UserGetNotes($login);
  26. $ip = $stgData['IP'];
  27. $mac = zb_MultinetGetMAC($stgData['IP']);
  28. $speedoverride = zb_UserGetSpeedOverride($login);
  29. $tariff = $stgData['Tariff'];
  30. $credit = $stgData['Credit'];
  31. $cash = $stgData['Cash'];
  32. $password = $stgData['Password'];
  33. $aonline = $stgData['AlwaysOnline'];
  34. $dstatdisable = $stgData['DisabledDetailStat'];
  35. $passive = $stgData['Passive'];
  36. $down = $stgData['Down'];
  37. $creditexpire = $stgData['CreditExpire'];
  38. if ($altCfg['PASSWORDSHIDE']) {
  39. $password = __('Hidden');
  40. }
  41. if ($speedoverride == '0') {
  42. $speedoverride = __('No');
  43. }
  44. if ($creditexpire > 0) {
  45. $creditexpire = date("Y-m-d", $creditexpire);
  46. } else {
  47. $creditexpire = __('No');
  48. }
  49. $cells = wf_TableCell(__('Parameter'));
  50. $cells .= wf_TableCell(__('Current value'));
  51. $cells .= wf_TableCell(__('Actions'));
  52. $rows = wf_TableRow($cells, 'row2');
  53. //default fields editing
  54. $cells = wf_TableCell(__('Full address'));
  55. $cells .= wf_TableCell($address);
  56. $cells .= wf_TableCell(zb_rightControl('BINDER', wf_Link('?module=binder&username=' . $login, wf_img('skins/icon_build.gif') . ' ' . __('Occupancy'))));
  57. $rows .= wf_TableRow($cells, 'row3');
  58. $cells = wf_TableCell(__('Password'));
  59. $cells .= wf_TableCell($password);
  60. $cells .= wf_TableCell(zb_rightControl('PASSWORD', wf_Link('?module=passwordedit&username=' . $login, wf_img('skins/icon_key.gif') . ' ' . __('Change') . ' ' . __('password'))));
  61. $rows .= wf_TableRow($cells, 'row3');
  62. $cells = wf_TableCell(__('Real Name'));
  63. $cells .= wf_TableCell($realname);
  64. $cells .= wf_TableCell(zb_rightControl('REALNAME', wf_Link('?module=realnameedit&username=' . $login, wf_img('skins/icon_user_16.gif') . ' ' . __('Change') . ' ' . __('Real Name'))));
  65. $rows .= wf_TableRow($cells, 'row3');
  66. $cells = wf_TableCell(__('Phone'));
  67. $cells .= wf_TableCell($phone);
  68. $cells .= wf_TableCell(zb_rightControl('PHONE', wf_Link('?module=phoneedit&username=' . $login, wf_img('skins/icon_phone.gif') . ' ' . __('Change') . ' ' . __('phone'))));
  69. $rows .= wf_TableRow($cells, 'row3');
  70. $cells = wf_TableCell(__('Mobile'));
  71. $cells .= wf_TableCell($mobile);
  72. $cells .= wf_TableCell(zb_rightControl('MOBILE', wf_Link('?module=mobileedit&username=' . $login, wf_img('skins/icon_mobile.gif') . ' ' . __('Change') . ' ' . __('mobile'))));
  73. $rows .= wf_TableRow($cells, 'row3');
  74. $cells = wf_TableCell(__('Contract'));
  75. $cells .= wf_TableCell($contract);
  76. $cells .= wf_TableCell(zb_rightControl('CONTRACT', wf_Link('?module=contractedit&username=' . $login, wf_img('skins/icon_link.gif') . ' ' . __('Change') . ' ' . __('contract'))));
  77. $rows .= wf_TableRow($cells, 'row3');
  78. if ($altCfg['BRANCHES_ENABLED']) {
  79. global $branchControl;
  80. $cells = wf_TableCell(__('Branch'));
  81. $cells .= wf_TableCell($branchControl->userGetBranchName($login));
  82. $cells .= wf_TableCell(zb_rightControl('BRANCHESUSERMOD', wf_Link('?module=branches&userbranch=' . $login, wf_img('skins/icon_branch.png') . ' ' . __('Change branch'))));
  83. $rows .= wf_TableRow($cells, 'row3');
  84. }
  85. if ($altCfg['CORPS_ENABLED']) {
  86. $greed = new Avarice();
  87. $corpsRuntime = $greed->runtime('CORPS');
  88. if (!empty($corpsRuntime)) {
  89. $corps = new Corps();
  90. $corpsCheck = $corps->userIsCorporate($login);
  91. $cells = wf_TableCell(__('User type'));
  92. $corpControls = zb_rightControl('CORPS', wf_Link(Corps::URL_USER_MANAGE . $login, wf_img('skins/corporate_small.gif') . ' ' . __('Change') . ' ' . __('user type')));
  93. if ($corpsCheck) {
  94. $cells .= wf_TableCell(__('Corporate user'));
  95. $cells .= wf_TableCell($corpControls);
  96. } else {
  97. $cells .= wf_TableCell(__('Private user'));
  98. $cells .= wf_TableCell($corpControls);
  99. }
  100. $rows .= wf_TableRow($cells, 'row3');
  101. }
  102. }
  103. $cells = wf_TableCell(__('Email'));
  104. $cells .= wf_TableCell($mail);
  105. $cells .= wf_TableCell(zb_rightControl('EMAIL', wf_Link('?module=mailedit&username=' . $login, wf_img('skins/icon_mail_16.png') . ' ' . __('Change') . ' ' . __('email'))));
  106. $rows .= wf_TableRow($cells, 'row3');
  107. $cells = wf_TableCell(__('Tariff'));
  108. $cells .= wf_TableCell($tariff);
  109. $cells .= wf_TableCell(zb_rightControl('TARIFFEDIT', wf_Link('?module=tariffedit&username=' . $login, wf_img('skins/icon_tariff.gif') . ' ' . __('Change') . ' ' . __('tariff'))));
  110. $rows .= wf_TableRow($cells, 'row3');
  111. $cells = wf_TableCell(__('Speed override'));
  112. $cells .= wf_TableCell($speedoverride);
  113. $cells .= wf_TableCell(zb_rightControl('USERSPEED', wf_Link('?module=speededit&username=' . $login, wf_img('skins/icon_speed.gif') . ' ' . __('Change') . ' ' . __('speed override'))));
  114. $rows .= wf_TableRow($cells, 'row3');
  115. $cells = wf_TableCell(__('Credit'));
  116. $cells .= wf_TableCell($credit);
  117. $cells .= wf_TableCell(zb_rightControl('CREDIT', wf_Link('?module=creditedit&username=' . $login, wf_img('skins/icon_credit.gif') . ' ' . __('Change') . ' ' . __('credit limit'))));
  118. $rows .= wf_TableRow($cells, 'row3');
  119. $cells = wf_TableCell(__('Credit expire'));
  120. $cells .= wf_TableCell($creditexpire);
  121. $cells .= wf_TableCell(zb_rightControl('CREDIT', wf_Link('?module=creditexpireedit&username=' . $login, wf_img('skins/icon_calendar.gif') . ' ' . __('Change') . ' ' . __('credit expire date'))));
  122. $rows .= wf_TableRow($cells, 'row3');
  123. $cells = wf_TableCell(__('Balance'));
  124. $cells .= wf_TableCell($cash);
  125. $cells .= wf_TableCell(zb_rightControl('CASH', wf_Link('?module=addcash&username=' . $login . '#cashfield', wf_img('skins/icon_dollar_16.gif') . ' ' . __('Finance operations'))));
  126. $rows .= wf_TableRow($cells, 'row3');
  127. if ($altCfg['DISCOUNTS_ENABLED']) {
  128. $discounts = new Discounts();
  129. $currentUserDiscount = $discounts->getUserDiscount($login);
  130. $renderUserDiscount = ($currentUserDiscount) ? $currentUserDiscount . '%' : __('No');
  131. $cells = wf_TableCell(__('Discount'));
  132. $cells .= wf_TableCell($renderUserDiscount);
  133. $cells .= wf_TableCell(zb_rightControl('DISCOUNTS', wf_Link('?module=discountedit&username=' . $login, wf_img('skins/icon_discount_16.png') . ' ' . __('Change discount'))));
  134. $rows .= wf_TableRow($cells, 'row3');
  135. }
  136. if (isset($altCfg['SIGNUP_PAYMENTS']) && !empty($altCfg['SIGNUP_PAYMENTS'])) {
  137. $payment = zb_UserGetSignupPrice($login);
  138. $paid = zb_UserGetSignupPricePaid($login);
  139. if ($payment != $paid && $payment > 0) {
  140. $cells = wf_TableCell(__('Signup paid'));
  141. $cells .= wf_TableCell(zb_UserGetSignupPricePaid($login) . '/' . zb_UserGetSignupPrice($login));
  142. $cells .= wf_TableCell(zb_rightControl('SIGNUPPRICES', wf_Link('?module=signupprices&username=' . $login, wf_img('skins/icons/register.png', __('Edit signup price')) . ' ' . __('Edit signup price'))));
  143. $rows .= wf_TableRow($cells, 'row3');
  144. }
  145. }
  146. $cells = wf_TableCell(__('IP'));
  147. $cells .= wf_TableCell($ip);
  148. $cells .= wf_TableCell(zb_rightControl('PLIPCHANGE', wf_Link('?module=pl_ipchange&username=' . $login, wf_img('skins/icon_ip.gif') . ' ' . __('Change') . ' ' . __('IP'))));
  149. $rows .= wf_TableRow($cells, 'row3');
  150. $cells = wf_TableCell(__('MAC'));
  151. $cells .= wf_TableCell($mac);
  152. $cells .= wf_TableCell(zb_rightControl('MAC', wf_Link('?module=macedit&username=' . $login, wf_img('skins/icon_ether_16.png') . ' ' . __('Change') . ' ' . __('MAC'))));
  153. $rows .= wf_TableRow($cells, 'row3');
  154. $cells = wf_TableCell(__('AlwaysOnline'));
  155. $cells .= wf_TableCell(web_trigger($aonline));
  156. $cells .= wf_TableCell(zb_rightControl('ALWAYSONLINE', wf_Link('?module=aoedit&username=' . $login, wf_img('skins/icon_online.gif') . ' ' . __('AlwaysOnline'))));
  157. $rows .= wf_TableRow($cells, 'row3');
  158. if (@$altCfg['DSTAT_ENABLED']) {
  159. $cells = wf_TableCell(__('Disable detailed stats'));
  160. $cells .= wf_TableCell(web_trigger($dstatdisable));
  161. $cells .= wf_TableCell(zb_rightControl('DSTAT', wf_Link('?module=dstatedit&username=' . $login, wf_img('skins/icon_stats_16.gif') . ' ' . __('Disable detailed stats'))));
  162. $rows .= wf_TableRow($cells, 'row3');
  163. }
  164. $cells = wf_TableCell(__('User passive'));
  165. $cells .= wf_TableCell(web_trigger($passive));
  166. $cells .= wf_TableCell(zb_rightControl('PASSIVE', wf_Link('?module=passiveedit&username=' . $login, wf_img('skins/icon_passive.gif') . ' ' . __('User passive'))));
  167. $rows .= wf_TableRow($cells, 'row3');
  168. $cells = wf_TableCell(__('User down'));
  169. $cells .= wf_TableCell(web_trigger($down));
  170. $cells .= wf_TableCell(zb_rightControl('DOWN', wf_Link('?module=downedit&username=' . $login, wf_img('skins/icon_down.gif') . ' ' . __('User down'))));
  171. $rows .= wf_TableRow($cells, 'row3');
  172. $cells = wf_TableCell(__('Passport data'));
  173. $cells .= wf_TableCell('');
  174. $cells .= wf_TableCell(zb_rightControl('PDATA', wf_Link('?module=pdataedit&username=' . $login, wf_img('skins/icon_passport.gif') . ' ' . __('Change') . ' ' . __('passport data'))));
  175. $rows .= wf_TableRow($cells, 'row3');
  176. if ($altCfg['CONDET_ENABLED']) {
  177. $conDet = new ConnectionDetails();
  178. $cells = wf_TableCell(__('Connection details'));
  179. $cells .= wf_TableCell($conDet->renderData($login));
  180. $cells .= wf_TableCell(zb_rightControl('CONDET', wf_Link('?module=condetedit&username=' . $login, wf_img('skins/cableseal_small.png') . ' ' . __('Change') . ' ' . __('Connection details'))));
  181. $rows .= wf_TableRow($cells, 'row3');
  182. }
  183. //additional comments indication
  184. if ($altCfg['ADCOMMENTS_ENABLED']) {
  185. $adcomments = new ADcomments('USERNOTES');
  186. if (cfr('NOTES')) {
  187. $indicatorIcon = ' ' . wf_Link('?module=notesedit&username=' . $login, $adcomments->getCommentsIndicator($login), false, '');
  188. } else {
  189. $indicatorIcon = ' ' . $adcomments->getCommentsIndicator($login);
  190. }
  191. } else {
  192. $indicatorIcon = '';
  193. }
  194. $cells = wf_TableCell(__('Notes'));
  195. $cells .= wf_TableCell($notes . $indicatorIcon);
  196. $cells .= wf_TableCell(zb_rightControl('NOTES', wf_Link('?module=notesedit&username=' . $login, wf_img('skins/icon_note.gif') . ' ' . __('Notes'))));
  197. $rows .= wf_TableRow($cells, 'row3');
  198. $form = wf_TableBody($rows, '100%', 0, 'useredittable');
  199. //primary user options
  200. show_window(__('Edit user') . ' ' . $address, $form);
  201. //custom fields editor here
  202. $cf = new CustomFields($login);
  203. $cfEditForm = $cf->renderUserFieldEditor();
  204. if (!empty($cfEditForm)) {
  205. show_window(__('Additional profile fields'), $cfEditForm);
  206. }
  207. //basic profile controls
  208. show_window('', web_UserControls($login));
  209. } else {
  210. show_error(__('Strange exception') . ': ' . __('User not exists'));
  211. show_window('', wf_tag('center') . wf_img('skins/unicornwrong.png') . wf_tag('center', true));
  212. }
  213. }
  214. web_UserEditShowForm($login);
  215. } else {
  216. show_error(__('Strange exception') . ': ' . __('Empty login'));
  217. show_window('', wf_tag('center') . wf_img('skins/unicornwrong.png') . wf_tag('center', true));
  218. }
  219. } else {
  220. show_error(__('You cant control this module'));
  221. }