dokeos-online
[ class tree: dokeos-online ] [ index: dokeos-online ] [ all elements ]

Source for file online_streaming.php

Documentation is available at online_streaming.php

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

Documentation generated on Thu, 12 Jun 2008 14:08:39 -0500 by phpDocumentor 1.4.1