function doCategoryQuery()
 {
     $dbr = wfGetDB(DB_SLAVE);
     if ($this->from != '') {
         $pageCondition = 'cl_sortkey >= ' . $dbr->addQuotes($this->from);
         $this->flip = false;
     } elseif ($this->until != '') {
         $pageCondition = 'cl_sortkey < ' . $dbr->addQuotes($this->until);
         $this->flip = true;
     } else {
         $pageCondition = '1 = 1';
         $this->flip = false;
     }
     $res = $dbr->select(array('page', 'categorylinks'), array('page_title', 'page_namespace', 'page_len', 'page_is_redirect', 'cl_sortkey'), array($pageCondition, 'cl_from          =  page_id', 'cl_to' => $this->title->getDBkey()), __METHOD__, array('ORDER BY' => $this->flip ? 'cl_sortkey DESC' : 'cl_sortkey', 'USE INDEX' => 'cl_sortkey', 'LIMIT' => $this->limit + 1));
     $count = 0;
     $this->nextPage = null;
     while ($x = $dbr->fetchObject($res)) {
         if (++$count > $this->limit) {
             // We've reached the one extra which shows that there are
             // additional pages to be had. Stop here...
             $this->nextPage = $x->cl_sortkey;
             break;
         }
         $title = Title::makeTitle($x->page_namespace, $x->page_title);
         if ($title->getNamespace() == NS_CATEGORY) {
             $this->addSubcategory($title, $x->cl_sortkey, $x->page_len);
         } elseif ($this->showGallery && $title->getNamespace() == NS_IMAGE) {
             $this->addImage($title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect);
         } elseif ($title->getNamespace() == MV_NS_MVD || $title->getNamespace() == MV_NS_STREAM || $title->getNamespace() == MV_NS_SEQUENCE) {
             $this->show_mv_links = true;
             //make sure we don't do duplicate stream links:
             $mvTitle = new MV_Title($title);
             if (!isset($this->already_named_resource[$mvTitle->getStreamName() . '/' . $mvTitle->getTimeRequest()])) {
                 $this->already_named_resource[$mvTitle->getStreamName() . '/' . $mvTitle->getTimeRequest()] = true;
                 $this->addMVThumb($title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect);
             }
         } else {
             $this->addPage($title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect);
         }
     }
     $dbr->freeResult($res);
 }
 function auto_complete_stream_name($val)
 {
     global $mvStreamTable, $mvDefaultSearchVideoPlaybackRes;
     $dbr =& wfGetDB(DB_SLAVE);
     //check against stream name list:
     $result = $dbr->select($mvStreamTable, array('name', 'duration'), array('`name` LIKE \'%' . mysql_escape_string($val) . '%\''), __METHOD__, array('LIMIT' => '5'));
     //print "ran: " . $dbr->lastQuery();
     if ($dbr->numRows($result) == 0) {
         return '';
     }
     //$out='<ul>'."\n";
     $out = '';
     while ($row = $dbr->fetchObject($result)) {
         //make sure the person page exists:
         $streamTitle = new MV_Title('Stream:' . $row->name . '/0:00:00/0:00:30');
         //print "stream name:" . $streamTitle->getStreamName();
         //@@TODO fix this up.. this is getting ugly new line in embed video for example breaks things
         $out .= $row->name . '|' . $streamTitle->getStreamNameText() . '|' . $streamTitle->getStreamImageURL('icon') . '|' . $row->duration . '|' . $streamTitle->getEmbedVideoHtml('vid_seq', $mvDefaultSearchVideoPlaybackRes, 'http://metavid.ucsc.edu/image_media/') . "\n";
     }
     //$out.='</ul>';
     //return people people in the Person Category
     return $out;
 }
	function outPutItem($wikiTitle, $desc_html=''){
		global $wgOut;		
		$mvTitle = new MV_Title($wikiTitle);
		$mStreamTitle = Title::makeTitle(MV_NS_STREAM, ucfirst($mvTitle->getStreamName()) . '/'.$mvTitle->getTimeRequest());
		
		//only output media RSS item if its valid media: 
		if(!$mvTitle->doesStreamExist())return ;

		//@@todo this should be cached 	
		$thumb_ref = $mvTitle->getStreamImageURL('320x240');
		if($desc_html==''){			
			$article = new Article($wikiTitle);
			$wgOut->clearHTML(); 			
			$wgOut->addWikiText($article->getContent() );
			$desc_html = $wgOut->getHTML();		
			$wgOut->clearHTML();					
		}
		$desc_xml ='<![CDATA[				
			<center class="mv_rss_view_only">
				<a href="'.$mStreamTitle->getFullUrl().'"><img src="'.$thumb_ref.'" border="0" /></a>
			</center>
			<br />'.
			$desc_html. 
			']]>';
				
		$stream_url = $mvTitle->getWebStreamURL();			
		$talkpage = $wikiTitle->getTalkPage();			
					
		$type_desc = ($mvTitle->getMvdTypeKey())?wfMsg($mvTitle->getMvdTypeKey()):'';			
		$time_desc = ($mvTitle->getTimeDesc())?$mvTitle->getTimeDesc():'';					
		?>	
		<item>
		<link><?=mvRSSFeed::xmlEncode($mStreamTitle->getFullUrl())?></link>
		<title><?=mvRSSFeed::xmlEncode(
			$mvTitle->getStreamNameText() . ' ' .  $time_desc)?></title>
		<description><?=$desc_xml?></description>
		<enclosure type="video/ogg" url="<?=mvRSSFeed::xmlEncode($stream_url)?>"/>
		<comments><?=mvRSSFeed::xmlEncode($talkpage->getFullUrl())?></comments>
		<media:thumbnail url="<?=mvRSSFeed::xmlEncode($thumb_ref)?>"/>
		<? /*todo add in alternate streams HQ, lowQ archive.org etc: 
		<media:group>
    		<media:content blip:role="Source" expression="full" fileSize="2702848" height="240" isDefault="true" type="video/msvideo" url="http://blip.tv/file/get/Conceptdude-EroticDanceOfANiceBabe266.avi" width="360"></media:content>
    		<media:content blip:role="web" expression="full" fileSize="3080396" height="240" isDefault="false" type="video/x-flv" url="http://blip.tv/file/get/Conceptdude-EroticDanceOfANiceBabe266.flv" width="360"></media:content>
  		</media:group>
  		*/ ?> 
		</item>
		<?
	}
$srt_file = $workingdir . '/' . $stream_name . '.srt';
$srt_ary = file($srt_file);
if ($srt_ary === false) {
    die(' could not find srt file: ' . $srt_file);
}
//time stamp:
$org_start_time = intval(trim(str_replace('starttime', '', $srt_ary[2])));
class streamObject
{
}
$stream = new streamObject();
$stream->name = $stream_name;
$stream->date_start_time = $org_start_time;
$stream->sync_status = 'in_sync';
$stream->duration = $duration;
$mvTitle = new MV_Title('Stream:' . $stream_name);
if (!$mvTitle->doesStreamExist()) {
    print $stream_name . " does not exist ... creating\n";
    // print 'do stream desc'."\n";
    if (!isset($MVStreams)) {
        $MVStreams = array();
    }
    // init the stream (legacy from old stream insert system)
    $MVStreams[$stream->name] = new MV_Stream($stream);
    do_add_stream($mvTitle, $stream);
}
$stream_id = $mvTitle->getStreamId();
print 'got stream id: ' . $stream_id . "\n";
//check for & update stream files:
do_stream_file_check($stream);
$filedir = '/video/metavid/mvprime_stream_images/' . MV_StreamImage::getRelativeImagePath($stream_id);
Ejemplo n.º 5
0
 function update_index_page(&$article, &$text)
 {
     global $mvgIP, $mvIndexTableName;
     //check static or $this usage context
     //use mv title to split up the values:
     $mvTitle = new MV_Title($article->mTitle->getDBkey());
     //print "Wiki title: " . $mvTitle->getWikiTitle();
     //fist check if an mvd entry for this stream already exists:
     $mvd_row = MV_Index::getMVDbyTitle($mvTitle->getWikiTitle());
     //set up the insert values:
     $insAry = array('mv_page_id' => $article->mTitle->getArticleID(), 'wiki_title' => $mvTitle->getWikiTitle(), 'mvd_type' => $mvTitle->getTypeMarker(), 'stream_id' => $mvTitle->getStreamId(), 'start_time' => $mvTitle->getStartTimeSeconds(), 'end_time' => $mvTitle->getEndTimeSeconds());
     $dbw =& wfGetDB(DB_WRITE);
     if (count($mvd_row) == 0) {
         return $dbw->insert($mvIndexTableName, $insAry);
     } else {
         $dbw->update($mvIndexTableName, $insAry, array('mv_page_id' => $mvd_row->mv_page_id));
     }
 }
Ejemplo n.º 6
0
 function get_overlay_context_from_title($contextTitle = null)
 {
     global $mvDefaultStreamViewLength, $wgTitle;
     if (!$contextTitle) {
         $contextTitle = $wgTitle;
     }
     $mvContextTitle = new MV_Title($contextTitle);
     $mvContextTitle->setStartEndIfEmpty();
     $this->start_time = $mvContextTitle->getStartTimeSeconds();
     $this->end_time = $mvContextTitle->getEndTimeSeconds();
     $this->duration = $mvContextTitle->getDuration();
 }
Ejemplo n.º 7
0
    function getItemOutput($row, $opt = array())
    {
        global $wgUser;
        $sk = $wgUser->getSkin();
        //set defaults:
        $person_ht = $bill_ht = $category_ht = $o = '';
        if (!isset($row->start_time)) {
            $row->start_time = 0;
        }
        if (!isset($row->end_time)) {
            $row->end_time = 60 * 20;
        }
        $mvd_out_html = '';
        $mvd_rows = MV_Index::getMVDInRange($row->stream_id, $row->start_time, $row->end_time, $mvd_type = 'anno_en', $getText = true, $smw_properties = array('Speech_by', 'Bill', 'category'), $options = array('limit' => 1));
        if (count($mvd_rows) != 0) {
            reset($mvd_rows);
            $mvd_row = current($mvd_rows);
            if (isset($opt['use_mvd_time']) && $opt['use_mvd_time']) {
                $row->start_time = $mvd_row->start_time;
                $row->end_time = $mvd_row->end_time;
            }
            // print_r($mvd_rows);
            // print "type of: " . gettype($mvd_row);
            if (isset($mvd_row->Speech_by)) {
                if (trim($mvd_row->Speech_by) != '') {
                    $ptitle = Title::MakeTitle(NS_MAIN, $mvd_row->Speech_by);
                    $mvd_out_html .= '<span class="keywords">' . $sk->makeKnownLinkObj($ptitle, $ptitle->getText()) . '</span><br />';
                }
            }
            if (isset($mvd_row->Bill)) {
                if (trim($mvd_row->Bill) != '') {
                    $btitle = Title::MakeTitle(NS_MAIN, $mvd_row->Bill);
                    $mvd_out_html .= '<span class="keywords">Bill: ' . $sk->makeKnownLinkObj($btitle) . '
 						</span><br />';
                }
            }
            global $wgContLang;
            $mvdNStxt = $wgContLang->getNsText(MV_NS_MVD);
            //grab categories if no bill or speech
            if ($this->params['display_cat'] || $mvd_out_html == '') {
                $dbr = wfGetDB(DB_READ);
                $cl_res = $dbr->select('categorylinks', 'cl_to', array('cl_sortkey' => $mvdNStxt . ':' . str_replace('_', ' ', $mvd_row->wiki_title)), 'getTopClips::Categories', 'LIMIT 0, 5');
                if ($dbr->numRows($cl_res) != 0) {
                    $mvd_out_html .= '<span class="keywords">Categories: ';
                    $coma = '';
                    while ($cl_row = $dbr->fetchObject($cl_res)) {
                        $cTitle = Title::MakeTitle(NS_CATEGORY, $cl_row->cl_to);
                        $mvd_out_html .= $coma . $sk->makeKnownLinkObj($cTitle, $cTitle->getText());
                        $coma = ', ';
                    }
                    $mvd_out_html .= '</span><br />';
                }
            }
        } else {
            //we have not meta
            //if( isset($opt['remove_no_meta']) && $opt['remove_no_meta'])
            //return false;
        }
        // first make link and stream title:
        $mvStream = MV_Stream::newStreamByID($row->stream_id);
        if (!$mvStream->doesStreamExist()) {
            return false;
        }
        //limit our output range to < 20 min
        if ($row->end_time - $row->start_time > 20 * 60) {
            $row->end_time = $row->start_time + 20 * 60;
        }
        $nt = $mvStream->getStreamName() . '/' . seconds2npt($row->start_time) . '/' . seconds2npt($row->end_time);
        $mvTitle = new MV_Title($nt, MV_NS_STREAM);
        $mvStreamTitle = Title::MakeTitle(MV_NS_STREAM, $mvTitle->getNearStreamName($extra_range = '0'));
        // output the image:
        $o .= $sk->makeKnownLinkObj($mvStreamTitle, '<img alt="image for ' . $mvTitle->getStreamNameText() . ' ' . $mvTitle->getTimeDesc() . '" src="' . $mvTitle->getStreamImageURL('small') . '"/>', 'tl=1');
        $title_span = '';
        if (isset($mvStream->date_start_time)) {
            $parts = split('_', $mvStream->getStreamName());
            if (count($parts) >= 3) {
                $title_span = ucfirst($parts[0] . ' ');
            } else {
                $title_span = $mvStream->getStreamName();
            }
            $title_span .= date('F jS, Y', $mvStream->date_start_time);
        } else {
            $title_span = $mvTitle->getStreamNameText() . $mvTitle->getTimeDesc();
        }
        $o .= '<span class="title">' . $sk->makeKnownLinkObj($mvStreamTitle, $title_span, 'tl=1') . '</span>';
        //add mvd_annotative output:
        $o .= $mvd_out_html;
        return $o;
    }
 function execute()
 {
     global $wgRequest, $wgOut, $wgUser, $mvSitting_name, $mvgIP;
     #init html output var:
     $html = '';
     # Get request data from, e.g.
     $title_str = $wgRequest->getVal('title');
     //get Mv_Title to normalize the sitting name:
     $this->sitting_name = $wgRequest->getVal('sitting_name') == '' ? '' : MV_Title::normalizeTitle($wgRequest->getVal('sitting_name'));
     // data about the sitting
     $this->sitting_start_time = $wgRequest->getVal('sitting_start_time');
     $this->sitting_end_time = $wgRequest->getVal('sitting_end_time');
     $this->sitting_session_number = $wgRequest->getVal('sitting_session_number');
     $this->wpEditToken = $wgRequest->getVal('wpEditToken');
     $this->sitting_desc = $wgRequest->getVal('sitting_desc');
     //grab the desc from the wiki page if not in the POST req
     if ($this->sitting_desc == '') {
         $desTitle = Title::makeTitle(MV_NS_SITTING, $this->sitting_name);
         //grab the article text:
         $curRevision = Revision::newFromTitle($desTitle);
         if ($curRevision) {
             $this->stream_desc = $curRevision->getText();
         }
     }
     if ($this->sitting_name == '') {
         //default page request
         $parts = split('/', $title_str);
         if (count($parts) >= 2) {
             //means we can use part 1 as a sitting name:
             $this->sitting_name = $parts[1];
         }
     } else {
         if ($this->mode == 'add') {
             //output add_ status to html
             $html .= $this->add_sitting();
         } else {
             //possible edit
         }
     }
     //if edit check for sitting name:
     if ($this->mode == 'edit' && $this->sitting_name == '') {
         $html .= wfMsg('edit_sitting_missing');
         $wgOut->addHTML($html);
         return;
     }
     $this->check_permissions();
     if (count($this->_allowedSittingTypeArray) == 0) {
         //break out user lacks permissions to add anything
         $html .= wfMsg('add_sitting_permission');
         $wgOut->addHTML($html);
         return;
     }
     //output the add sitting form
     $spectitle = Title::makeTitle(NS_SPECIAL, 'Mv_Add_sitting');
     $docutitle = Title::newFromText(wfMsg('mv_add_sitting'), NS_HELP);
     if ($this->mode == 'edit') {
         $mvSittingTitle = Title::makeTitle(MV_NS_SITTING, $this->sitting_name);
         if ($mvSittingTitle->exists()) {
             $sk = $wgUser->getSkin();
             $sittingLink = $sk->makeLinkObj($mvSittingTitle, $this->sitting_name);
             $html .= wfMsg('mv_edit_sitting_docu', $sittingLink);
         }
     } else {
         $html .= wfMsg('mv_add_sitting_docu', $docutitle->getFullURL()) . "\n";
     }
     $html .= '<form name="add_sitting" action="' . $spectitle->escapeLocalURL() . '" method="post" enctype="multipart/form-data">';
     $html .= '<fieldset><legend>' . wfMsg('mv_add_sitting') . '</legend>' . "\n" . '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>';
     $html .= '<table width="600" border="0">';
     $html .= '"<tr><td width="600">TO DO</td></tr>"';
     $html .= '"<tr><td>1. Pretty Javascript calender for session date</td></tr>"';
     $html .= '"<tr><td>2. Name - Derived from bungeni perhaps</td></tr>"';
     $html .= '"<tr><td>3. Session Number - again Derived from bungeni perhaps</td></tr>"';
     $html .= '<tr>';
     $html .= '<td  width="140">';
     $html .= '<i>' . wfMsg('mv_label_sitting_name') . "</i>:";
     $html .= '</td><td>';
     $html .= '<input type="text" name="sitting_name" value="" size="30" maxlength="1024"><br />' . "\n";
     $html .= '</td>';
     $html .= '</tr>' . "\n";
     $html .= '<td width="140">';
     $html .= '<i>' . wfMsg('mv_label_sitting_date') . "</i>:";
     $html .= '</td><td>';
     $html .= '<input type="text" name="sitting_date" value="" size="30" maxlength="1024"><br />' . "\n";
     $html .= '</td>';
     $html .= '</tr>' . "\n";
     $html .= '<td  width="140">';
     $html .= '<i>' . wfMsg('mv_label_sitting_session_number') . "</i>:";
     $html .= '</td><td>';
     $html .= '<input type="text" name="sitting_session_number" value="" size="30" maxlength="1024"><br />' . "\n";
     $html .= '</td>';
     $html .= '</tr>' . "\n";
     $html .= '<td  width="140">';
     $html .= '<i>' . wfMsg('mv_label_sitting_start_time') . "</i>:";
     $html .= '</td><td>';
     $html .= '<input type="text" name="sitting_start_time" value="" size="30" maxlength="1024"><br />' . "\n";
     $html .= '</td>';
     $html .= '</tr>' . "\n";
     $html .= '<td  width="140">';
     $html .= '<i>' . wfMsg('mv_label_sitting_end_time') . "</i>:";
     $html .= '</td><td>';
     $html .= '<input type="text" name="sitting_end_time" value="" size="30" maxlength="1024"><br />' . "\n";
     $html .= '</td>';
     $html .= '</tr>' . "\n";
     $html .= '<tr><td valign="top"><i>' . wfMsg('mv_label_sitting_desc') . '</i>:</td><td>';
     //add an edit token (for the stream description)
     if ($wgUser->isLoggedIn()) {
         $token = htmlspecialchars($wgUser->editToken());
     } else {
         $token = EDIT_TOKEN_SUFFIX;
     }
     $html .= "\n<input type='hidden' value=\"{$token}\"{$docutitle} name=\"wpEditToken\" />\n";
     //output the text area:
     $html .= '<textarea tabindex="1" accesskey="," name="sitting_desc" id="stream_desc" rows=6 cols=5>' . $this->sitting_desc . '</textarea>' . "\n";
     $html .= '<br /><input type="submit" value="' . wfMsg('mv_add_sitting_submit') . "\"/>\n</form>";
     $html .= '</td></tr></table>';
     $html .= '</fieldset>';
     # Output menu items
     # @@todo link with language file
     $wgOut->addHTML($html);
     //output the stream files list (if in edit mode)
     //if($this->mode=='edit')
     //$this->list_streams();
 }
 function resolveResourceNode(&$node)
 {
     global $wgUser, $wgParser;
     //print 'resolveResourceNode:' . $node->nodeName . " : " . $node->nodeValue . "\n";
     //don't process free flowing text
     //@@todo (we should probably throw it out)
     if ($node instanceof DOMText) {
         return $node;
     }
     $nodeAttr = $node->attributes;
     $node_uri = false;
     if (!is_null($nodeAttr)) {
         foreach ($nodeAttr as $atrr) {
             if ($atrr->nodeName == 'uri') {
                 $node_uri = $atrr->nodeValue;
             }
         }
     }
     //if no resource uri is provided just parse inner html and return
     if (!$node_uri) {
         $node->setAttribute('type', 'text/html');
         return $this->parseInnerWikiText($node);
     }
     $uriTitle = Title::newFromDBkey($node_uri);
     //figure out if how we should parse innerHTML:
     switch ($uriTitle->getNamespace()) {
         case NS_MAIN:
             //top level ref includes of pages in the main namespace not supported
             break;
         case MV_NS_SEQUENCE:
             //type sequence ..@@todo transclude the sequence into present sequence
             //@@todo we should
             //change the node type to "par" to group the sequence under a single element (helpfull for editor representation)
             /*$parElm = $node->ownerDocument->createElement('par');
             
             				$seqArticle = new MV_SequencePage( $uriTitle );
              				$seqArticle->getSequenceSMIL();*/
             break;
         case MV_NS_STREAM:
             global $mvDefaultVideoQualityKey, $mvDefaultFlashQualityKey;
             //we could include relevant timed text and relevant different source types.
             //make sure the stream exists:
             $mvTitle = new MV_Title($uriTitle);
             if (!$mvTitle->doesStreamExist()) {
                 $node->setAttribute('type', 'text/html');
                 $this->parseInnerWikiText($node, wfMsg('mv_resource_not_found', $uriTitle->getText()));
                 return $node;
             }
             //get urls for flash and ogg
             $stream_web_url = $mvTitle->getWebStreamURL($mvDefaultVideoQualityKey);
             $flash_stream_url = $mvTitle->getWebStreamURL($mvDefaultFlashQualityKey);
             if (!$stream_web_url && !$flash_stream_url) {
                 $node->setAttribute('type', 'text/html');
                 $this->parseInnerWikiText($node, wfMsg('mv_resource_not_found', $uriTitle->getText()));
                 return $node;
             }
             //by default set the ogg source
             //@@todo parse child nodes for stream request params?
             if ($stream_web_url) {
                 $node->setAttribute('type', htmlspecialchars(MV_StreamFile::getTypeForQK($mvDefaultVideoQualityKey)));
                 $node->setAttribute('src', $stream_web_url);
                 $node->setAttribute('poster', $mvTitle->getStreamImageURL());
             }
             //add in flash as a fallback method:
             if ($flash_stream_url) {
                 $f = $node->ownerDocument->createDocumentFragment();
                 $f->appendXML('<source type="' . htmlspecialchars(MV_StreamFile::getTypeForQK($mvDefaultFlashQualityKey)) . '" src="' . $flash_stream_url . '"></source>');
                 $node->appendChild($f);
             }
             break;
         case NS_TEMPLATE:
             //templates are of type text/html
             $node->setAttribute('type', 'text/html');
             //print "none type: ". $node->getAttribute('type');
             //if template look for template parameters:
             $templateText = '{{' . $uriTitle->getText();
             $addedParamFlag = false;
             $paramVars = array();
             while ($node->childNodes->length) {
                 if ($node->firstChild->nodeName == 'param') {
                     $param =& $node->firstChild;
                     //make sure we have a name:
                     if ($param->hasAttribute('name')) {
                         //we have parameters:
                         $templateText .= "|\n";
                         $templateText .= $param->getAttribute('name') . '=';
                         //try and get the value from the value attribute or innerHTML
                         if ($param->hasAttribute('value')) {
                             $templateText .= $param->getAttribute('value');
                             $paramVars[$param->getAttribute('name')] = $param->getAttribute('value');
                         } else {
                             //grab from inner html:
                             $inerHTML = '';
                             while ($param->childNodes->length) {
                                 $inerHTML .= $param->ownerDocument->saveXML($param->firstChild);
                                 $param->removeChild($param->firstChild);
                             }
                             $templateText .= $inerHTML;
                             $paramVars[$param->getAttribute('name')] = $inerHTML;
                         }
                     }
                     $addedParamFlag = true;
                 }
                 $node->removeChild($node->firstChild);
             }
             //close up the template wikiText call:
             $templateText .= $addedParamFlag ? "\n}}" : '}}';
             //$parserOutput = $wgParser->parse($templateText  ,$this->mTitle, ParserOptions::newFromUser( $wgUser ));
             //print "should parse: \n $templateText";
             $this->parseInnerWikiText($node, $templateText);
             //re-add the param nodes
             $phtml = '';
             foreach ($paramVars as $name => $val) {
                 $phtml .= '<param name="' . htmlentities($name) . '">' . htmlentities($val) . '</param>';
             }
             if ($phtml != '') {
                 $f = $node->ownerDocument->createDocumentFragment();
                 $f->appendXML($phtml);
                 $node->appendChild($f);
             }
             break;
         case NS_IMAGE:
         case NS_FILE:
             //lookup the file/stream
             global $mvDefaultVideoPlaybackRes;
             list($width, $height) = explode('x', $mvDefaultVideoPlaybackRes);
             //@@todo more flexibility with image grabbing
             // (probably should be handled via "figure" namespace which could allow arbitrary crop, resize, overlay)
             $img = wfFindFile($uriTitle);
             if (!$img) {
                 $node->setAttribute('type', 'text/html');
                 $this->parseInnerWikiText($node, wfMsg('mv_resource_not_found', $uriTitle->getText()));
                 return $node;
             }
             //print "resource found set: " . $img->getMimeType();
             //set type attribute:
             //get a default wide media;
             $thumbnail = $img->transform(array('width' => $width));
             if ($thumbnail->isError()) {
                 $this->parseInnerWikiText($node, $thumbnail->toHtml());
             } else {
                 $node->setAttribute('type', $img->getMimeType());
                 $node->setAttribute('src', $img->getURL());
                 //if type is ogg: (set dur and poster)
                 if ($img->getMimeType() == 'application/ogg') {
                     //set the durationHint to the real media duration:
                     $node->setAttribute('durationHint', $thumbnail->file->getLength());
                     //set up default dur to media length if not already set:
                     if (!$node->hasAttribute('dur')) {
                         $node->setAttribute('dur', $thumbnail->file->getLength());
                     }
                     //set the poster attribute:
                     if (!$node->hasAttribute('poster')) {
                         $node->setAttribute('poster', $thumbnail->getURL());
                     }
                 }
             }
             break;
         default:
             $node->setAttribute('type', 'text/html');
             $this->parseInnerWikiText($node, wfMsg('mv_resource_not_supported', $uriTitle->getNsText() . $uriTitle->getText()));
             break;
     }
     return $node;
 }
function mvDoMetavidStreamPage(&$title, &$article)
{
    $mvTitle = new MV_Title($title->mDbkeyform);
    if ($mvTitle->doesStreamExist()) {
        // @@TODO check if we have /name corresponding to a view or
        // /ss:ss:ss or /ss:ss:ss/ee:ee:ee corresponding to a time request
        // force metavid to be special
        // (@@todo clean up skin.php to enable better tab controls)
        // $title->mNamespace= NS_SPECIAL;
        // add a hit to the digest if enabled:
        // @@todo (maybe in the future use javascript to confirm they acutally "watched" the clip)
        global $mvEnableClipViewDigest, $wgRequest;
        // don't log views without end times (default stream view)
        if ($mvEnableClipViewDigest && $mvTitle->end_time != null && $wgRequest->getVal('tl') != '1') {
            $dbw = wfGetDB(DB_WRITE);
            $dbw->insert('mv_clipview_digest', array('stream_id' => $mvTitle->getStreamId(), 'start_time' => $mvTitle->getStartTimeSeconds(), 'end_time' => $mvTitle->getEndTimeSeconds(), 'query_key' => $mvTitle->getStreamId() . $mvTitle->getStartTimeSeconds() . $mvTitle->getEndTimeSeconds(), 'view_date' => time()));
            // compensate for $mvDefaultClipRange around clips
            global $mvDefaultClipRange;
            $start_time = $mvTitle->getStartTimeSeconds() + $mvDefaultClipRange < 0 ? 0 : $mvTitle->getStartTimeSeconds() + $mvDefaultClipRange;
            $end_time = $mvTitle->getEndTimeSeconds() - $mvDefaultClipRange > $mvTitle->getDuration() ? 0 : $mvTitle->getEndTimeSeconds() - $mvDefaultClipRange;
            // also increment the mvd_page if we find a match:
            $dbw->update('mv_mvd_index', array('`view_count`=`view_count`+1'), array('stream_id' => $mvTitle->getStreamId(), 'start_time' => $start_time, 'end_time' => $end_time));
            // print $dbw->lastQuery();
            // also update the mvd_page if directly requested:
            $dbw->update('mv_mvd_index', array('`view_count`=`view_count`+1'), array('stream_id' => $mvTitle->getStreamId(), 'start_time' => $mvTitle->getStartTimeSeconds(), 'end_time' => $mvTitle->getEndTimeSeconds()));
            // print $dbw->lastQuery();
        }
        // @@todo check if the requested title is already just the stream name:
        $streamTitle = Title::newFromText($mvTitle->getStreamName(), MV_NS_STREAM);
        // print " new title: " . $streamTitle . "\n";
        $article = new MV_StreamPage($streamTitle, $mvTitle);
    } else {
        mvMissingStreamPage($mvTitle->stream_name);
    }
}
Ejemplo n.º 11
0
function mv_pl_wt($mvd_id)
{
    global $wgRequest;
    $mvd = MV_Index::getMVDbyId($mvd_id);
    $mvTitle = new MV_Title($mvd->wiki_title);
    return $mvTitle->getEmbedVideoHtml(array('id' => 'vid_' . $mvd_id, 'size' => $wgRequest->getVal('size'), 'autoplay' => true));
}
 function expand_wt($mvd_id, $terms_ary)
 {
     global $wgOut, $mvgIP;
     global $mvDefaultSearchVideoPlaybackRes;
     $mvd = MV_Index::getMVDbyId($mvd_id);
     if (count($mvd) != 0) {
         $mvTitle = new MV_Title($mvd->wiki_title);
         // validate title and load stream ref:
         if ($mvTitle->validRequestTitle()) {
             list($vWidth, $vHeight) = explode('x', $mvDefaultSearchVideoPlaybackRes);
             $embedHTML = '<span style="float:left;width:' . htmlspecialchars($vWidth + 20) . 'px">' . $mvTitle->getEmbedVideoHtml(array('id' => 'vid_' . $mvd_id, 'size' => $mvDefaultSearchVideoPlaybackRes, 'autoplay' => true)) . '</span>';
             $wgOut->clearHTML();
             $MvOverlay = new MV_Overlay();
             $MvOverlay->outputMVD($mvd, $mvTitle);
             $pageHTML = '<span style="padding-top:10px;float:left;width:450px">' . $wgOut->getHTML() . '</span>';
             // return page html:
             return $embedHTML . $pageHTML . '<div style="clear: both;"/>';
         } else {
             return wfMsg('mvBadMVDtitle');
         }
     } else {
         return wfMsg('mv_error_mvd_not_found');
     }
     // $title = Title::MakeTitle(MV_NS_MVD, $wiki_title);
     // $article = new Article($title);
     // output table with embed left, and content right
     // return $wgOut->parse($article->getContent());
 }
 function add_stream($stream = null)
 {
     $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
         if (!$stream) {
             $stream =& mvGetMVStream(array('name' => $this->stream_name));
         }
         // if the stream is inserted proced 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);
             $article = new Article($streamTitle);
             $status = $article->doEdit($this->stream_desc, wfMsg('mv_summary_add_stream'));
             if ($status === true || is_object($status) && $status->isOK()) {
                 // stream inserted sucesfully report to output
                 $out = wfMsg('mv_stream_added', $sk->makeLinkObj($streamTitle, htmlspecialchars($this->stream_name)));
             } else {
                 $out = wfMsg('mv_error_stream_insert');
             }
         } else {
             // stream failed insert
         }
     }
     return $out;
 }
function mvDoMetavidStreamPage(&$title, &$article){
	$mvTitle = new MV_Title( $title->mDbkeyform); 	
	if($mvTitle->doesStreamExist()){				
		//@@TODO check if we have /name corresponding to a view or
		// /ss:ss:ss or /ss:ss:ss/ee:ee:ee corresponding to a time request
		//force metavid to be special 
		//(@@todo clean up skin.php to enable better tab controls)
		//$title->mNamespace= NS_SPECIAL;
		
		//@@todo check if the requested title is already just the stream name:		 	
		$streamTitle = Title::newFromText( $mvTitle->getStreamName(), MV_NS_STREAM);
		//print " new title: " . $streamTitle . "\n";		
		$article = new MV_StreamPage($streamTitle, $mvTitle);
	}else{				
		mvMissingStreamPage($mvTitle->stream_name);
	}	
}
Ejemplo n.º 15
0
 function get_export_page($stream_title)
 {
     global $wgUser, $wgRequest;
     $req_time = $wgRequest->getVal('time_range') ? '/' . $wgRequest->getVal('time_range') : '';
     $mvTitle = new MV_Title($stream_title . $req_time);
     $sk = $wgUser->getSkin();
     $out = '<h3>' . wfMsg('mv_tool_export_title') . '</h3>';
     $tr = $wgRequest->getVal('time_range');
     // @@todo pull in metadata layer selector (populated by current selection set)
     // makeKnownLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' )
     $sTitle = SpecialPage::getTitleFor('MvExportStream');
     $out .= $sk->makeKnownLinkObj($sTitle, wfMsg('mv_export_cmml'), 'feed_format=cmml&stream_name=' . $stream_title . '&t=' . $tr);
     $out .= ' for ' . $mvTitle->getTitleDesc();
     return $out;
 }
Ejemplo n.º 16
0
 function parsePlaylist()
 {
     global $wgParser, $wgOut;
     //valid playlist in-line-attributes:
     $mvInlineAttr = array('wClip', 'mvClip', 'title', 'linkback', 'desc', 'desc', 'image');
     //build a associative array of "clips"
     $seq_text = $this->getSequenceText();
     $seq_lines = explode("\n", $seq_text);
     $parseBucket = $cur_attr = '';
     $clip_inx = -1;
     foreach ($seq_lines as $line) {
         //actions start with |
         $e = strpos($line, '=');
         if ($e !== false) {
             $cur_attr = substr($line, 1, $e - 1);
         }
         if (in_array($cur_attr, $mvInlineAttr)) {
             if ($cur_attr == 'mvClip') {
                 $clip_inx++;
             }
             //close the parse bucket (found a valid inline attr)
             if ($parseBucket != '' && $cur_attr != 'desc') {
                 $output = $wgParser->parse($parseBucket, $parser->mTitle, $parser->mOptions, true, false);
                 $parseBucket = '';
             }
         }
         $start_pos = $e !== false ? $e + 1 : 0;
         if ($clip_inx != -1) {
             if (!isset($this->clips[$clip_inx])) {
                 $this->clips[$clip_inx] = array();
             }
             if (!isset($this->clips[$clip_inx][$cur_attr])) {
                 $this->clips[$clip_inx][$cur_attr] = '';
             }
             $this->clips[$clip_inx][$cur_attr] .= substr($line, $start_pos);
         }
     }
     //poluate data (this could go here or somewhere else)
     foreach ($this->clips as $inx => &$clip) {
         if (trim($clip['mvClip']) == '') {
             unset($this->clips[$inx]);
             continue;
         }
         if ($clip['mvClip']) {
             $sn = str_replace('?t=', '/', $clip['mvClip']);
             $streamTitle = new MV_Title($sn);
             $wgStreamTitle = Title::newFromText($sn, MV_NS_STREAM);
             if ($streamTitle->doesStreamExist()) {
                 //mvClip is a substitue for src so assume its there:
                 $clip['src'] = $streamTitle->getWebStreamURL();
                 //title
                 if (!isset($clip['title'])) {
                     $clip['title'] = '';
                 }
                 if ($clip['title'] == '') {
                     $clip['title'] = $streamTitle->getTitleDesc();
                 }
                 if (!isset($clip['info'])) {
                     $clip['info'] = '';
                 }
                 if ($clip['info'] == '') {
                     $clip['info'] = $wgStreamTitle->getFullURL();
                 }
             }
             //check if we should look up the image:
             if (!isset($clip['image'])) {
                 $clip['image'] == '';
             }
             if ($clip['image'] == '') {
                 $clip['image'] = $streamTitle->getFullStreamImageURL();
             }
             //check if desc was present:
             if (!isset($clip['desc'])) {
                 $clip['desc'] = '';
             }
             //for now just lookup all ... @@todo future expose diffrent language tracks
             if ($clip['desc'] == '') {
                 $dbr =& wfGetDB(DB_SLAVE);
                 $mvd_res = MV_Index::getMVDInRange($streamTitle->getStreamId(), $streamTitle->getStartTimeSeconds(), $streamTitle->getEndTimeSeconds());
                 if (count($dbr->numRows($mvd_res)) != 0) {
                     $MV_Overlay = new MV_Overlay();
                     $wgOut->clearHTML();
                     while ($mvd = $dbr->fetchObject($mvd_res)) {
                         //output a link /line break
                         $MV_Overlay->outputMVD($mvd);
                         $wgOut->addHTML('<br>');
                     }
                     $clip['desc'] = $wgOut->getHTML();
                     $wgOut->clearHTML();
                 }
             }
         }
     }
     //print_r($this->clips);
 }
 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;
 }
 function toHTML()
 {
     global $wgLang, $mvDefaultAspectRatio;
     $sk = $this->getSkin();
     $attribs = Sanitizer::mergeAttributes(array('class' => 'gallery', 'cellspacing' => '0', 'cellpadding' => '0'), $this->mAttribs);
     $s = Xml::openElement('table', $attribs);
     if ($this->mCaption) {
         $s .= "\n\t<caption>" . htmlspecialchars($this->mCaption) . "</caption>";
     }
     $params = array('width' => $this->mWidths, 'height' => $this->mHeights);
     $i = 0;
     $this->already_named_resource = array();
     foreach ($this->mImages as $pair) {
         $nt = $pair[0];
         $text = $pair[1];
         # Give extensions a chance to select the file revision for us
         $time = false;
         wfRunHooks('BeforeGalleryFindFile', array(&$this, &$nt, &$time));
         $img = wfFindFile($nt, array('time' => $time));
         if ($nt->getNamespace() == MV_NS_MVD || $nt->getNamespace() == MV_NS_STREAM || $nt->getNamespace() == MV_NS_SEQUENCE) {
             // @@todo fix sequence embed
             // $vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2;
             $mvTitle = new MV_Title($nt);
             // remap MVD namespace links into the Stream view (so contextual metadata is present)
             if ($nt->getNamespace() == MV_NS_MVD) {
                 $nt = Title::MakeTitle(MV_NS_STREAM, ucfirst($mvTitle->getStreamName()) . '/' . $mvTitle->getTimeRequest());
             }
             $vidH = round($this->mWidths * $mvDefaultAspectRatio);
             $vidRes = $this->mWidths . 'x' . $vidH;
             // print "img url: " . 	$mvTitle->getStreamImageURL();
             $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="padding: 4px 0; width: ' . htmlspecialchars($this->mWidths + 5) . 'px;">' . '<div style="margin-left: auto; margin-right: auto; width: ' . htmlspecialchars($this->mWidths) . 'px;">' . $sk->makeKnownLinkObj($nt, '<img title="' . htmlspecialchars($mvTitle->getStreamNameText()) . '"' . ' width="160" height="120" src="' . $mvTitle->getStreamImageURL('160x120') . '">') . '</div>' . '</div>' . '<span class="gallerytext" style="float:left">' . $sk->makeKnownLinkObj($nt, $mvTitle->getStreamNameText() . ' ' . $mvTitle->getTimeDesc()) . '</span>' . '</div>';
             $nb = '';
             $textlink = '';
         } else {
             if ($nt->getNamespace() != NS_IMAGE || !$img) {
                 # We're dealing with a non-image, spit out the name and be done with it.
                 $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . htmlspecialchars($nt->getText()) . '</div>';
             } elseif ($this->mHideBadImages && wfIsBadImage($nt->getDBkey(), $this->getContextTitle())) {
                 # The image is blacklisted, just show it as a text link.
                 $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . $sk->makeKnownLinkObj($nt, htmlspecialchars($nt->getText())) . '</div>';
             } elseif (!($thumb = $img->transform($params))) {
                 # Error generating thumbnail.
                 $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . htmlspecialchars($img->getLastError()) . '</div>';
             } else {
                 $vpad = floor((1.25 * $this->mHeights - $thumb->height) / 2) - 2;
                 $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="padding: ' . htmlspecialchars($vpad) . 'px 0; width: ' . htmlspecialchars($this->mWidths + 30) . 'px;">' . '<div style="margin-left: auto; margin-right: auto; width: ' . htmlspecialchars($this->mWidths) . 'px;">' . $thumb->toHtml(array('desc-link' => true)) . '</div></div>';
                 // Call parser transform hook
                 if ($this->mParser && $img->getHandler()) {
                     $img->getHandler()->parserTransformHook($this->mParser, $img);
                 }
             }
             if ($this->mShowBytes) {
                 if ($img) {
                     $nb = wfMsgExt('nbytes', array('parsemag', 'escape'), $wgLang->formatNum($img->getSize()));
                 } else {
                     $nb = wfMsgHtml('filemissing');
                 }
                 $nb = "{$nb}<br />\n";
             } else {
                 $nb = '';
             }
             $textlink = $this->mShowFilename ? $sk->makeKnownLinkObj($nt, htmlspecialchars($wgLang->truncate($nt->getText(), 20))) . "<br />\n" : '';
         }
         # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
         # in version 4.8.6 generated crackpot html in its absence, see:
         # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
         if ($i % $this->mPerRow == 0) {
             $s .= "\n\t<tr>";
         }
         $s .= "\n\t\t" . '<td><div class="gallerybox" style="width: ' . ($this->mWidths + 10) . 'px;">' . $thumbhtml . "\n\t\t\t" . '<div class="gallerytext">' . "\n" . $textlink . htmlspecialchars($text) . $nb . "\n\t\t\t</div>" . "\n\t\t</div></td>";
         if ($i % $this->mPerRow == $this->mPerRow - 1) {
             $s .= "\n\t</tr>";
         }
         ++$i;
     }
     if ($i % $this->mPerRow != 0) {
         $s .= "\n\t</tr>";
     }
     $s .= "\n</table>";
     return $s;
 }
function do_stream_insert($mode, $stream_name = '')
{
    global $mvgIP, $MVStreams, $options, $args, $wgDBname;
    $dbr = wfGetDB(DB_SLAVE);
    if ($mode == 'all') {
        $sql = "SELECT * FROM `metavid`.`streams` WHERE `sync_status`='in_sync'";
    } elseif ($mode == 'files') {
        $sql = "SELECT * FROM `metavid`.`streams` WHERE `trascoded` != 'none'";
    } elseif ($mode == 'all_in_wiki') {
        $sql = "SELECT `metavid`.`streams`.* FROM `{$wgDBname}`.`mv_streams` LEFT JOIN `metavid`.`streams` ON (`{$wgDBname}`.`mv_streams`.`name` = `metavid`.`streams`.`name`) ";
    } elseif ($mode == 'all_sync_past_date') {
        print "doing all after: " . $args[$options['date']] . "\n";
        list($month, $day, $year) = explode('/', $args[$options['date']]);
        $date_time = mktime(0, 0, 0, $month, $day, $year);
        $sql = "SELECT * FROM `metavid`.`streams` WHERE `sync_status`= 'in_sync' AND `adj_start_time` > {$date_time}";
    } else {
        $sql = "SELECT * FROM `metavid`.`streams` WHERE `name` LIKE '{$stream_name}'";
    }
    $res = $dbr->query($sql);
    if ($dbr->numRows($res) == 0) {
        die('could not find stream: ' . $stream_name . "\n");
    }
    // load all stream names:
    while ($row = $dbr->fetchObject($res)) {
        $streams[] = $row;
    }
    print "working on " . count($streams) . ' streams' . "\n";
    foreach ($streams as $stream) {
        print "on stream {$stream->name} \n";
        $force = isset($options['force']) ? true : false;
        // init the stream
        $MVStreams[$stream->name] = new MV_Stream($stream);
        // check if the stream has already been added to the wiki (if not add it)
        $mvTitle = new MV_Title('Stream:' . $stream->name);
        if (!$mvTitle->doesStreamExist()) {
            // print 'do stream desc'."\n";
            do_add_stream($mvTitle, $stream);
            echo "stream " . $mvTitle->getStreamName() . " added \n";
        } else {
            do_update_wiki_page($stream->name, mv_semantic_stream_desc($mvTitle, $stream), MV_NS_STREAM, $force);
            // $updated = ' updated' echo "stream " . $mvTitle->getStreamName() . " already present $updated\n";
        }
        if ($mode != 'all_in_wiki') {
            // add duration and start_time attr
            do_stream_attr_check($stream);
        }
        // do insert/copy all media images
        if (!isset($options['skipimage'])) {
            do_process_images($stream, $force);
            print "done with images\n";
        }
        if (!isset($options['skipfiles'])) {
            // check for files (make sure they match with metavid db values
            do_stream_file_check($stream);
        }
        if (!isset($options['skiptext'])) {
            // process all stream text:
            do_process_text($stream, $force);
        }
        if (!isset($options['skipSpeechMeta'])) {
            // do annoative track for continus speches
            do_annotate_speeches($stream, $force);
        }
    }
}
    function outPutItem($wikiTitle, $desc_html = '')
    {
        global $wgOut, $wgUser;
        $sk = $wgUser->getSkin();
        $mvTitle = new MV_Title($wikiTitle);
        $mStreamTitle = Title::makeTitle(MV_NS_STREAM, ucfirst($mvTitle->getStreamName()) . '/' . $mvTitle->getTimeRequest());
        // only output media RSS item if its valid media:
        if (!$mvTitle->doesStreamExist()) {
            return;
        }
        // @@todo this should be cached
        $thumb_ref = $mvTitle->getFullStreamImageURL('320x240', null, '', true);
        if ($desc_html == '') {
            $article = new Article($wikiTitle);
            $wgOut->clearHTML();
            $wgOut->addWikiText($article->getContent());
            $desc_html = $wgOut->getHTML();
            $wgOut->clearHTML();
        }
        //get the parent meta if allowed:
        global $mvGetParentMeta;
        $pmvd = false;
        if ($mvGetParentMeta && strtolower($mvTitle->getMvdTypeKey()) == 'ht_en') {
            $pmvd = MV_Index::getParentAnnotativeLayers($mvTitle);
            if ($pmvd->wiki_title) {
                $pMvTitle = new MV_Title($pmvd->wiki_title);
                $pAnnoStreamTitle = Title::MakeTitle(MV_NS_STREAM, $pMvTitle->getNearStreamName(0));
            }
        }
        $desc_xml = '<![CDATA[
			<center class="mv_rss_view_only">
				<a href="' . htmlspecialchars($mStreamTitle->getFullUrl()) . '"><img src="' . $thumb_ref . '" border="0" /></a>
			</center>
			<br />' . $desc_html . ']]>';
        $stream_url = $mvTitle->getWebStreamURL();
        $talkpage = $wikiTitle->getTalkPage();
        $type_desc = $mvTitle->getMvdTypeKey() ? wfMsg($mvTitle->getMvdTypeKey()) : '';
        $time_desc = $mvTitle->getTimeDesc() ? $mvTitle->getTimeDesc() : '';
        ?>
<item>
<link>
		<?php 
        echo mvRSSFeed::xmlEncode($mStreamTitle->getFullUrl());
        ?>
</link>
<title><?php 
        echo mvRSSFeed::xmlEncode($mvTitle->getStreamNameText() . ' ' . $time_desc);
        ?>
</title>
<description>
<?php 
        echo $desc_xml;
        ?>
</description>
<?php 
        global $mvDefaultVideoQualityKey, $mvVidQualityMsgKeyType, $mvDefaultVideoHighQualityKey, $mvDefaultFlashQualityKey;
        //check a few different types in order of prefrence:
        if ($stream_url = $mvTitle->getWebStreamURL($mvDefaultVideoHighQualityKey)) {
            $mk = $mvDefaultVideoHighQualityKey;
        } elseif ($stream_url = $mvTitle->getWebStreamURL($mvDefaultVideoQualityKey)) {
            $mk = $mvDefaultVideoQualityKey;
        } elseif ($stream_url = $mvTitle->getWebStreamURL($mvDefaultFlashQualityKey)) {
            $mk = $mvDefaultFlashQualityKey;
        }
        if ($stream_url) {
            echo '<enclosure name="' . wfMsg($mk) . '" type="video/ogg" ' . 'url="' . mvRSSFeed::xmlEncode($stream_url) . '"/>';
        }
        ?>

<comments>
<?php 
        echo mvRSSFeed::xmlEncode($talkpage->getFullUrl());
        ?>
</comments>
<?php 
        $person = '';
        if ($pmvd && $pmvd->Speech_by) {
            $personTitle = Title::newFromText($pmvd->Speech_by);
            ?>
<media:person label="<?php 
            echo $personTitle->getText();
            ?>
" url="<?php 
            echo mvRSSFeed::xmlEncode($personTitle->getFullURL());
            ?>
" />
<?php 
        }
        //handle any parent clip tag info:
        if ($pmvd) {
            ?>
<media:parent_clip url="<?php 
            echo mvRSSFeed::xmlEncode($pAnnoStreamTitle->getFullUrl());
            ?>
" />
<?php 
            if ($pmvd->Bill) {
                $bTitle = Title::newFromText($pmvd->Bill);
                ?>
<media:bill label="<?php 
                echo $bTitle->getText();
                ?>
" url="<?php 
                echo mvRSSFeed::xmlEncode($bTitle->getFullURL());
                ?>
" />
<?php 
            }
            if ($pmvd->category) {
                foreach ($pmvd->category as $cat_titlekey) {
                    $cTitle = $cTitle = Title::MakeTitle(NS_CATEGORY, $cat_titlekey);
                    ?>
<media:category label="<?php 
                    echo $cTitle->getText();
                    ?>
" url="<?php 
                    echo mvRSSFeed::xmlEncode($cTitle->getFullUrl());
                    ?>
" />
<?php 
                }
            }
        }
        ?>
<media:thumbnail
	url="<?php 
        echo mvRSSFeed::xmlEncode($thumb_ref);
        ?>
" />
<media:roe_embed
	url="<?php 
        echo mvRSSFeed::xmlEncode($mvTitle->getROEURL());
        ?>
" />
<media:group>
<?php 
        global $mvDefaultFlashQualityKey, $mvVidQualityMsgKeyType, $mvDefaultFlashQualityKey;
        //add in media group:
        $vid_types = array($mvDefaultVideoQualityKey, 'mv_ogg_high_quality', $mvDefaultFlashQualityKey);
        foreach ($vid_types as $vid_key) {
            $stream_url = $mvTitle->getWebStreamURL($vid_key);
            if ($stream_url !== false && isset($mvVidQualityMsgKeyType[$vid_key])) {
                ?>
	<media:content
		blip:role="<?php 
                echo mvRSSFeed::xmlEncode($vid_key);
                ?>
"
		expression="full"
		type="<?php 
                echo mvRSSFeed::xmlEncode($mvVidQualityMsgKeyType[$vid_key]);
                ?>
"
		url="<?php 
                echo htmlentities($stream_url);
                ?>
"></media:content>
		<?php 
            }
        }
        ?>
</media:group>
</item>
<?
	}
Ejemplo n.º 21
0
function mvDoMvPage(&$title, &$article, $doOutput = true)
{
    global $wgOut;
    if ($title->getNamespace() == NS_CATEGORY) {
        $article = new MV_CategoryPage($title);
    } elseif ($title->getNamespace() == MV_NS_SEQUENCE) {
        $article = new MV_SequencePage($title);
    } elseif ($title->getNamespace() == MV_NS_STREAM) {
        mvDoMetavidStreamPage($title, $article);
    } elseif ($title->getNamespace() == MV_NS_MVD) {
        $mvTitle = new MV_Title($title->getDBkey());
        //check if mvd type exist
        if ($mvTitle->validRequestTitle()) {
            //this page can be edited seen the MVD page:
            $article = new MV_DataPage($title, $mvTitle);
            //$title = 'Stream: ' . $mvTitle['type_marker'] . $mvTitle['stream_name'];
            //$body = 'body content';
            //mvOutputSpecialPage($title,$body);
        } else {
            //@@TODO get type of error: & put this in the language file
            //$title = 'missing type, stream missing, or not valid time format';
            if ($doOutput) {
                mvOutputSpecialPage(wfMsg('mvBadMVDtitle'), wfMsg('mvMVDFormat'));
            }
            return false;
        }
    } elseif ($title->getNamespace() == MV_NS_SITTING) {
        mvDoMetavidSittingpage($title, $article);
        return false;
    }
    return true;
}