index.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. // check for right of current admin on this module
  3. if (cfr('BINDER')) {
  4. if (ubRouting::checkGet('username')) {
  5. global $ubillingConfig;
  6. //needed login
  7. $login = ubRouting::get('username', 'callback','vf');
  8. //if change
  9. if (ubRouting::checkPost('changeapt', false)) {
  10. $changeaptdata = zb_AddressGetAptData($login);
  11. $changeaptid = $changeaptdata['id'];
  12. $changeaptbuildid = $changeaptdata['buildid'];
  13. $changeapt = ubRouting::post('changeapt');
  14. if (empty($changeapt)) {
  15. $changeapt = 0;
  16. }
  17. @$changefloor = ubRouting::post('changefloor');
  18. @$changeentrance = ubRouting::post('changeentrance');
  19. zb_AddressChangeApartment($changeaptid, $changeaptbuildid, $changeentrance, $changefloor, $changeapt);
  20. rcms_redirect("?module=binder&username=" . $login);
  21. }
  22. //if extended address info change
  23. if (ubRouting::checkPost('change_extended_address')) {
  24. zb_AddAddressExtenSave($login, true,
  25. ubRouting::post('changepostcode'),
  26. ubRouting::post('changetowndistr'),
  27. ubRouting::post('changeaddrexten')
  28. );
  29. rcms_redirect("?module=binder&username=" . $login);
  30. }
  31. //if delete
  32. if (ubRouting::checkGet('orphan')) {
  33. $deletedata = zb_AddressGetAptData($login);
  34. $deleteatpid = $deletedata['aptid'];
  35. zb_AddressOrphanUser($login);
  36. zb_AddressDeleteApartment($deleteatpid);
  37. if ($ubillingConfig->getAlterParam('ADDRESS_EXTENDED_ENABLED')) {
  38. zb_AddAddressExtenDelete($login);
  39. }
  40. rcms_redirect("?module=binder&username=" . $login);
  41. }
  42. //if create new home to user
  43. if (ubRouting::checkPost('apt', false)) {
  44. $apt = ubRouting::post('apt');
  45. if (empty($apt)) {
  46. $apt = 0;
  47. }
  48. @$entrance = ubRouting::post('entrance');
  49. @$floor = ubRouting::post('floor');
  50. $buildid = ubRouting::post('buildsel');
  51. zb_AddressCreateApartment($buildid, $entrance, $floor, $apt);
  52. $newaptid = zb_AddressGetLastid();
  53. zb_AddressCreateAddress($login, $newaptid);
  54. rcms_redirect("?module=binder&username=" . $login);
  55. }
  56. $addrdata = zb_AddressGetAptData($login);
  57. if (!empty($addrdata)) {
  58. //if just wan to modify entrance/floor/apt
  59. show_window(__('Change user apartment'), web_AddressAptForm($login));
  60. } else {
  61. // if user is orphan and need new home
  62. show_window(__('User occupancy'), web_AddressOccupancyForm());
  63. }
  64. show_window('', web_UserControls($login));
  65. }
  66. } else {
  67. show_error(__('Access denied'));
  68. }
  69. ?>