function add_stream()
 {
     $out = '';
     $mvTitle = new MV_Title($this->stream_name);
     //fist check if the given stream name already exists
     if ($mvTitle->doesStreamExist()) {
         $mv_page = Title::newFromText($this->stream_name, MV_NS_STREAM);
         return '<span class="error">' . wfMsg('mv_stream_already_exists', $this->stream_name, $mv_page->getFullURL()) . '</span> ';
     } else {
         //get the stream pointer
         //$stream =& mvGetMVStream(array('name'=>$this->stream_name,'sitting_id'=>$this->sitting_id));
         //$strarray = array($key=>val);
         //foreach ($this as $key => $val) {
         //	if (isset ($key)) {
         //		$strarray[$key] = $val;
         //	}
         //}
         $stream = new MV_Stream(array('name' => $this->stream_name, 'state' => $this->state, 'date_start_time' => $this->date_start_time, 'duration' => $this->duration, 'sitting_id' => $this->sitting_id));
         $stream->db_load_stream();
         //if the stream is inserted proceed with page insertion
         if ($stream->insertStream($this->stream_type)) {
             global $wgUser;
             $sk = $wgUser->getSkin();
             //insert page
             $streamTitle = Title::newFromText($this->stream_name, MV_NS_STREAM);
             $wgArticle = new Article($streamTitle);
             $success = $wgArticle->doEdit($this->stream_desc, wfMsg('mv_summary_add_stream'));
             if ($success) {
                 //stream inserted succesfully report to output
                 //$streamLink = $sk->makeLinkObj( $streamTitle,  $this->stream_name );
                 //$out='stream '.$streamLink.' added';
                 return true;
             } else {
                 //$out=wfMsg('mv_error_stream_insert');
                 return false;
             }
         } else {
             //stream failed insert
             return false;
         }
     }
     //return $out;
 }
示例#2
0
function mv_frame_server($stream_name = '', $req_time = '', $req_size = '')
{
    global $wgRequest;
    $stream_id = '';
    // try loading vals from $wgRequest if not set
    $stream_name = $stream_name == '' ? $wgRequest->getVal('stream_name') : $stream_name;
    if ($stream_name == null) {
        $stream_id = $wgRequest->getVal('stream_id');
    }
    $req_time = $req_time == '' ? $wgRequest->getVal('t') : $req_time;
    $req_size = $req_size == '' ? $wgRequest->getVal('size') : $req_size;
    $redirect_req = $wgRequest->getVal('redirect') == 'true' ? true : false;
    if ($stream_id == '') {
        $mvStream = mvGetMVStream($stream_name);
        $stream_id = $mvStream->getStreamId();
    } else {
        $mvStream = new MV_Stream(array('id' => $stream_id));
    }
    if ($mvStream->db_load_stream()) {
        global $mvServeImageRedirect, $mvExternalImages;
        if ($mvServeImageRedirect || $redirect_req || $mvExternalImages) {
            header("Location:" . MV_StreamImage::getStreamImageURL($stream_id, $req_time, $req_size, true));
        } else {
            // serve up the image directly
            MV_StreamImage::getStreamImageRaw($stream_id, $req_time, $req_size, true);
        }
        exit;
    } else {
        return 'error: invalid stream name';
    }
}