index.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /**
  3. * This module is deprecated and disabled by default.
  4. */
  5. if (cfr('PLVCASH')) {
  6. $altCfg = $ubillingConfig->getAlter();
  7. if (@$altCfg['VCASH_ENABLED']) {
  8. function web_VserviceCashForm($login) {
  9. $currentvcash = zb_VserviceCashGet($login);
  10. $alladdr = zb_AddressGetFulladdresslist();
  11. $allrealnames = zb_UserGetAllRealnames();
  12. $form = '
  13. <form action="" method="POST">
  14. <table width="50%" border="0">
  15. <tr>
  16. <td class="row2">' . __('Login') . '</td>
  17. <td class="row3">' . $login . '</td>
  18. </tr>
  19. <tr>
  20. <td class="row2">' . __('Address') . '</td>
  21. <td class="row3">' . @$alladdr[$login] . '</td>
  22. </tr>
  23. <tr>
  24. <td class="row2">' . __('Real Name') . '</td>
  25. <td class="row3">' . @$allrealnames[$login] . '</td>
  26. </tr>
  27. <tr>
  28. <td class="row2">' . __('Current Cash state') . '</td>
  29. <td class="row3">' . $currentvcash . '</td>
  30. </tr>
  31. <tr>
  32. <td class="row2">' . __('New cash') . '</td>
  33. <td class="row3"><input name="newcash" size="5" type="text"></td>
  34. </tr>
  35. <tr>
  36. <td class="row2">' . __('Actions') . '</td>
  37. <td class="row3">
  38. <input name="operation" value="add" checked="checked" type="radio"> ' . __('Add cash') . '
  39. <input name="operation" value="set" type="radio"> ' . __('Set cash') . '
  40. </td>
  41. </tr>
  42. <tr>
  43. <td class="row2">' . __('Payment type') . '</td>
  44. <td class="row3">' . web_CashTypeSelector() . '</td>
  45. </tr>
  46. <tr>
  47. <td class="row2">' . __('Virtual services') . '</td>
  48. <td class="row3">' . web_VservicesSelector() . '</td>
  49. </tr>
  50. </table>
  51. <input type="submit" value="' . __('Change') . '">
  52. </form>';
  53. return($form);
  54. }
  55. if (isset($_GET['username'])) {
  56. $login = $_GET['username'];
  57. //if we adds cash to someone
  58. if (isset($_POST['newcash'])) {
  59. //collect needed data
  60. $cash = mysql_real_escape_string($_POST['newcash']);
  61. $balance = zb_VserviceCashGet($login);
  62. $date = curdatetime();
  63. $cashtype = $_POST['cashtype'];
  64. $vserviceid = $_POST['vserviceid'];
  65. $note = 'Service:' . $vserviceid;
  66. $admin = whoami();
  67. if ($cash) {
  68. //if it only adding
  69. if ($_POST['operation'] == 'add') {
  70. zb_VserviceCashAdd($login, $cash, $vserviceid);
  71. $paymentlog = "INSERT INTO `payments` (
  72. `id` ,
  73. `login` ,
  74. `date` ,
  75. `admin` ,
  76. `balance` ,
  77. `summ` ,
  78. `cashtypeid` ,
  79. `note`
  80. )
  81. VALUES (
  82. NULL , '" . $login . "', '" . $date . "','" . $admin . "' ,'" . $balance . "', '" . $cash . "', '" . $cashtype . "', '" . $note . "'
  83. );";
  84. nr_query($paymentlog);
  85. rcms_redirect("?module=pl_vcash&username=" . $login);
  86. }
  87. //or set
  88. if ($_POST['operation'] == 'set') {
  89. zb_VserviceCashSet($login, $_POST['newcash']);
  90. zb_VserviceCashLog($login, $balance, $cash, $vserviceid);
  91. rcms_redirect("?module=pl_vcash&username=" . $login);
  92. }
  93. }
  94. }
  95. show_window(__('Virtual cash account'), web_VserviceCashForm($login));
  96. show_window('', web_UserControls($login));
  97. }
  98. } else {
  99. show_error(__('This module is disabled'));
  100. }
  101. } else {
  102. show_error(__('You cant control this module'));
  103. }
  104. ?>