online_streaming.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php // $Id: online_streaming.php 9246 2006-09-25 13:24:53Z bmol $
  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. $langFile='chat';
  29. include('../inc/global.inc.php');
  30. $this_section=SECTION_COURSES;
  31. $tbl_user = Database::get_main_table(MAIN_USER_TABLE);
  32. $query="SELECT username FROM $tbl_user WHERE user_id='$_uid'";
  33. $result=api_sql_query($query,__FILE__,__LINE__);
  34. list($pseudoUser)=mysql_fetch_row($result);
  35. $isAllowed=(empty($pseudoUser) || !$_cid)?false:true;
  36. $isMaster=$is_courseAdmin?true:false;
  37. if(!$isAllowed || !$isMaster)
  38. {
  39. exit();
  40. }
  41. $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
  42. $onlinePath=$documentPath.'online_files/';
  43. if($_POST['sent'])
  44. {
  45. $sent=1;
  46. $stream_url=trim(stripslashes($_POST['stream_url']));
  47. $stream_type=trim(stripslashes($_POST['stream_type']));
  48. if(!empty($stream_url) && $stream_url != 'http://')
  49. {
  50. $fp=fopen($onlinePath.'streaming.txt','w');
  51. fputs($fp,$stream_url."\n".$stream_type);
  52. fclose($fp);
  53. }
  54. mysql_close();
  55. header('Location: online_master.php');
  56. exit();
  57. }
  58. else
  59. {
  60. if(!list($stream_url,$stream_type)=@file($onlinePath.'streaming.txt'))
  61. {
  62. $stream_url='';
  63. $stream_type='mp3';
  64. }
  65. else
  66. {
  67. $stream_url=rtrim($stream_url);
  68. $stream_type=rtrim($stream_type);
  69. }
  70. }
  71. include('header_frame.inc.php');
  72. ?>
  73. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  74. <tr>
  75. <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')); ?>"></a></td>
  76. <td width="99%" align="left">&nbsp;<a href="online_master.php"><?php echo get_lang('Back'); ?></a></td>
  77. </tr>
  78. </table>
  79. <br>
  80. <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  81. <input type="hidden" name="sent" value="1">
  82. <table border="0" cellpadding="3" cellspacing="0">
  83. <tr>
  84. <td width="45%"><?php echo get_lang('StreamURL'); ?> :</td>
  85. <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>
  86. </tr>
  87. <tr>
  88. <td width="45%" valign="middle"><?php echo get_lang('StreamType'); ?> :</td>
  89. <td width="55%">
  90. <input type="radio" name="stream_type" value="mp3" <?php if($stream_type == 'mp3') echo 'checked="checked"'; ?> > MP3<br>
  91. <input type="radio" name="stream_type" value="mp4" <?php if($stream_type == 'mp4') echo 'checked="checked"'; ?> > MP4<br>
  92. <input type="radio" name="stream_type" value="mov" <?php if($stream_type == 'mov') echo 'checked="checked"'; ?> > MOV<br>
  93. </td>
  94. </tr>
  95. <tr>
  96. <td colspan="2" align="center"><input type="submit" value="<?php echo htmlentities(get_lang('Modify')); ?>"></td>
  97. </tr>
  98. </table>
  99. </form>
  100. <?php
  101. include('footer_frame.inc.php');
  102. ?>