online_streaming.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php // $Id: online_streaming.php 13296 2007-09-27 02:19:40Z yannoo $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Olivier Brouckaert
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. */
  19. /**
  20. ==============================================================================
  21. * Allows to define the format and the URL of the audio or video stream
  22. *
  23. * @author Olivier Brouckaert
  24. * @package dokeos.online
  25. ==============================================================================
  26. */
  27. define('FRAME','streaming');
  28. // name of the language file that needs to be included
  29. $language_file='chat';
  30. include('../inc/global.inc.php');
  31. $this_section=SECTION_COURSES;
  32. $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
  33. $query="SELECT username FROM $tbl_user WHERE user_id='".$_user['user_id']."'";
  34. $result=api_sql_query($query,__FILE__,__LINE__);
  35. list($pseudoUser)=mysql_fetch_row($result);
  36. $isAllowed=(empty($pseudoUser) || !$_cid)?false:true;
  37. $isMaster=$is_courseAdmin?true:false;
  38. if(!$isAllowed || !$isMaster)
  39. {
  40. exit();
  41. }
  42. $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
  43. $onlinePath=$documentPath.'online_files/';
  44. if($_POST['sent'])
  45. {
  46. $sent=1;
  47. $stream_url=trim(stripslashes($_POST['stream_url']));
  48. $stream_type=trim(stripslashes($_POST['stream_type']));
  49. if(!empty($stream_url) && $stream_url != 'http://')
  50. {
  51. $fp=fopen($onlinePath.'streaming.txt','w');
  52. fputs($fp,$stream_url."\n".$stream_type);
  53. fclose($fp);
  54. }
  55. mysql_close();
  56. header('Location: online_master.php');
  57. exit();
  58. }
  59. else
  60. {
  61. if(!list($stream_url,$stream_type)=@file($onlinePath.'streaming.txt'))
  62. {
  63. $stream_url='';
  64. $stream_type='mp3';
  65. }
  66. else
  67. {
  68. $stream_url=rtrim($stream_url);
  69. $stream_type=rtrim($stream_type);
  70. }
  71. }
  72. include('header_frame.inc.php');
  73. ?>
  74. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  75. <tr>
  76. <td width="1%" valign="middle"><a href="online_master.php"><img src="../img/home.gif" border="0" alt="" title="<?php echo htmlentities(get_lang('Back'),ENT_QUOTES,$charset); ?>"></a></td>
  77. <td width="99%" align="left">&nbsp;<a href="online_master.php"><?php echo get_lang('Back'); ?></a></td>
  78. </tr>
  79. </table>
  80. <br>
  81. <form method="post" action="<?php echo api_get_self(); ?>">
  82. <input type="hidden" name="sent" value="1">
  83. <table border="0" cellpadding="3" cellspacing="0">
  84. <tr>
  85. <td width="45%"><?php echo get_lang('StreamURL'); ?> :</td>
  86. <td width="55%"><input type="text" name="stream_url" size="10" maxlength="100" value="<?php if(!empty($stream_url)) echo htmlentities($stream_url); else echo 'http://'; ?>" style="width: 100px;"></td>
  87. </tr>
  88. <tr>
  89. <td width="45%" valign="middle"><?php echo get_lang('StreamType'); ?> :</td>
  90. <td width="55%">
  91. <input type="radio" name="stream_type" value="mp3" <?php if($stream_type == 'mp3') echo 'checked="checked"'; ?> > MP3<br>
  92. <input type="radio" name="stream_type" value="mp4" <?php if($stream_type == 'mp4') echo 'checked="checked"'; ?> > MP4<br>
  93. <input type="radio" name="stream_type" value="mov" <?php if($stream_type == 'mov') echo 'checked="checked"'; ?> > MOV<br>
  94. </td>
  95. </tr>
  96. <tr>
  97. <td colspan="2" align="center"><input type="submit" value="<?php echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset); ?>"></td>
  98. </tr>
  99. </table>
  100. </form>
  101. <?php
  102. include('footer_frame.inc.php');
  103. ?>