video.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once '../../../global.inc.php';
  4. if (api_is_anonymous()) {
  5. api_not_allowed(true);
  6. }
  7. $roomName = isset($_GET['room']) ? $_GET['room'] : null;
  8. $room = VideoChat::getChatRoomByName($roomName);
  9. if ($room === false) {
  10. Header::location(api_get_path(WEB_PATH));
  11. }
  12. $friend_html = SocialManager::listMyFriendsBlock(
  13. $user_id,
  14. $link_shared,
  15. $show_full_profile
  16. );
  17. $isSender = $room['from_user'] == api_get_user_id();
  18. $isReceiver = $room['to_user'] == api_get_user_id();
  19. if (!$isSender && !$isReceiver) {
  20. Header::location(api_get_path(WEB_PATH));
  21. }
  22. if ($isSender) {
  23. $chatUser = api_get_user_info($room['to_user']);
  24. } elseif ($isReceiver) {
  25. $chatUser = api_get_user_info($room['from_user']);
  26. }
  27. $idUserLocal = api_get_user_id();
  28. $userLocal = api_get_user_info($idUserLocal, true);
  29. $htmlHeadXtra[] = '<script type="text/javascript" src="'
  30. . api_get_path(WEB_PATH) . 'web/assets/simplewebrtc/latest.js'
  31. . '"></script>' . "\n";
  32. $template = new Template();
  33. $template->assign('room', $room);
  34. $template->assign('chat_user', $chatUser);
  35. $template->assign('user_local', $userLocal);
  36. $template->assign('block_friends', $friend_html);
  37. $content = $template->fetch('default/chat/video.tpl');
  38. //$template->assign('header', $room['room_name']);
  39. $template->assign('content', $content);
  40. $template->assign('message', Display::return_message(get_lang('BroswerDoesNotSupportWebRTC'), 'warning'));
  41. $template->display_one_col_template();
  42. //$template->display_no_layout_template();