index.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. if (cfr('MIKMIGR')) {
  3. $greed = new Avarice();
  4. $beggar = $greed->runtime('MIKMIGR');
  5. if (!empty($beggar)) {
  6. foreach ($beggar['CERT'] as $each) {
  7. eval($each);
  8. }
  9. if (file_exists($beggar['DUMP'])) {
  10. $mik = new mikbill();
  11. show_window('', $mik->web_MikbillMigrationNetworksForm());
  12. $converts = array('db_user', 'db_pass', 'db_host', 'db_name', 'tariff_period');
  13. if (wf_CheckPost($converts)) {
  14. if (isset($_POST['login_as_pass'])) {
  15. $login_ap = true;
  16. } else {
  17. $login_ap = false;
  18. }
  19. if (isset($_POST['contract_as_uid'])) {
  20. $contract_au = true;
  21. } else {
  22. $contract_au = false;
  23. }
  24. $result = $mik->ConvertMikBill($_POST['db_user'], $_POST['db_pass'], $_POST['db_host'], $_POST['db_name'], $_POST['tariff_period'], $login_ap, $contract_au);
  25. if (empty($result)) {
  26. rcms_redirect("?module=mikbill_migration&success=1");
  27. } else {
  28. $warn = __('We have found some non unique IP addresses and excluded duplicates from processing');
  29. foreach ($result as $login => $s_login) {
  30. $warn .= wf_tag('br', true);
  31. $warn .= __('Login');
  32. $warn .= ': ' . $s_login;
  33. $warn .= ' -> ' . $login;
  34. }
  35. show_warning($warn);
  36. }
  37. }
  38. if (isset($_GET['success'])) {
  39. show_success(__("SQL dump was generated. You can find it in" . " billing/content/backups/sql/ub.sql."));
  40. }
  41. } else {
  42. show_error(__('File not found' . ':ub.sql'));
  43. }
  44. } else {
  45. show_error(__('No license key available'));
  46. }
  47. } else {
  48. show_error(__('Access denied'));
  49. }