index.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. if ($ubillingConfig->getAlterParam('ASTERISK_ENABLED')) {
  3. $asterisk = new Asterisk();
  4. //getting asterisk data
  5. if (wf_CheckGet(array('ajax'))) {
  6. $asterisk->ajaxAvaibleCDR();
  7. }
  8. $asterisk->catchFileDownload();
  9. if (isset($_GET['username'])) {
  10. $user_login = vf($_GET['username']);
  11. // Profile:
  12. $profile = new UserProfile($user_login);
  13. show_window(__('User profile'), $profile->render());
  14. if ($ubillingConfig->getAlterParam('ADCOMMENTS_ENABLED') and isset($_GET['addComments'])) {
  15. $adcomments = new ADcomments('ASTERISK');
  16. show_window(__('Additional comments'), $adcomments->renderComments($_GET['addComments']));
  17. }
  18. } elseif (isset($_GET['AsteriskWindow']) and ! wf_CheckPost(array('datefrom', 'dateto'))) {
  19. if ($ubillingConfig->getAlterParam('ADCOMMENTS_ENABLED') and isset($_GET['addComments'])) {
  20. $adcomments = new ADcomments('ASTERISK');
  21. show_window(__('Additional comments'), $adcomments->renderComments($_GET['addComments']));
  22. }
  23. }
  24. if (cfr('ASTERISK')) {
  25. //showing configuration form
  26. if (wf_CheckGet(array('config'))) {
  27. //changing settings
  28. if (wf_CheckPost(array('newhost', 'newdb', 'newtable', 'newlogin', 'newpassword'))) {
  29. $asterisk->AsteriskUpdateConfig($_POST['newhost'], $_POST['newdb'], $_POST['newtable'], $_POST['newlogin'], $_POST['newpassword'], vf($_POST['newcachetime'], 3), vf($_POST['dopmobile'], 3));
  30. }
  31. //aliases creation
  32. if (wf_CheckPost(array('newaliasnum', 'newaliasname'))) {
  33. $asterisk->AsteriskCreateAlias($_POST['newaliasnum'], $_POST['newaliasname']);
  34. }
  35. //alias deletion
  36. if (wf_CheckPost(array('deletealias'))) {
  37. $asterisk->AsteriskDeleteAlias($_POST['deletealias']);
  38. }
  39. show_window(__('Settings'), $asterisk->AsteriskConfigForm());
  40. show_window(__('Phone book'), $asterisk->AsteriskAliasesForm());
  41. } else {
  42. //showing call history form
  43. show_window(__('Calls history'),$asterisk->panel());
  44. //and parse some calls history if this needed
  45. if (wf_CheckPost(array('datefrom', 'dateto')) or isset($user_login)) {
  46. show_window('', $asterisk->renderAsteriskCDR());
  47. }
  48. }
  49. } else {
  50. show_error(__('Permission denied'));
  51. }
  52. } else {
  53. show_error(__('Asterisk PBX integration now disabled'));
  54. }
  55. ?>