index.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. if (cfr('UBIM')) {
  3. $altcfg = $ubillingConfig->getAlter();
  4. //posting new message
  5. if (wf_CheckPost(array('im_message_to', 'im_message_text'))) {
  6. im_CreateMessage($_POST['im_message_to'], $_POST['im_message_text']);
  7. rcms_redirect("?module=ubim&gothread=" . $_POST['im_message_to']);
  8. }
  9. //checking for new messages
  10. if (!wf_CheckGet(array('checknew'))) {
  11. $unreadMessageCount = im_CheckForUnreadMessages();
  12. if ($unreadMessageCount) {
  13. $unreadIMNotify = __('You received') . ' ' . $unreadMessageCount . ' ' . __('new messages');
  14. $urlIM = $unreadIMNotify . wf_delimiter() . wf_Link("?module=ubim&checknew=true", __('Click here to go to the instant messaging service.'), false, 'ubButton');
  15. show_window('', wf_modalOpened(__('New messages received'), $urlIM, '450', '200'));
  16. }
  17. }
  18. //ajax thread data
  19. if (wf_CheckGet(array('showthread'))) {
  20. $threadContent = im_ConversationForm($_GET['showthread']) . im_ThreadShow($_GET['showthread']);
  21. die($threadContent);
  22. }
  23. //refresh time testing for unread messages
  24. if (wf_CheckGet(array('timecheckunread'))) {
  25. $unreadMessageCount = im_CheckForUnreadMessages();
  26. if ($unreadMessageCount) {
  27. die(json_encode(array('messagesCount' => $unreadMessageCount)));
  28. }
  29. }
  30. if (!wf_checkGet(array('avatarcontrol'))) {
  31. //display main grid
  32. $mainGrid = im_MainWindow();
  33. show_window(__('Instant messaging service'), $mainGrid);
  34. if (!wf_CheckGet(array('timecheckunread'))) {
  35. //update notification area
  36. $darkVoid = new DarkVoid();
  37. $darkVoid->flushCache();
  38. }
  39. } else {
  40. //avatar control and mail change form
  41. show_window(__('Avatar control'), im_AvatarControlForm());
  42. }
  43. //refresh container
  44. if ($altcfg['UBIM_REFRESH']) {
  45. im_RefreshContainer($altcfg['UBIM_REFRESH']);
  46. }
  47. // direct link thread loader
  48. if (wf_CheckGet(array('gothread'))) {
  49. show_window('', im_ThreadLoad($_GET['gothread']));
  50. }
  51. zb_BillingStats(true);
  52. } else {
  53. show_error(__('You cant control this module'));
  54. }
  55. ?>