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 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>
<?
	}
 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 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>
		<?
	}
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.º 6
0
function mvAddToolBoxLinks()
{
    global $wgTitle, $wgUser;
    if ($wgTitle->getNamespace() == MV_NS_STREAM) {
        //make sure the Messages are loaded
        //add export cmml link:
        $sTitle = SpecialPage::getTitleFor('MvExportStream');
        $mvTitle = new MV_Title($wgTitle->getDBkey());
        $sk = $wgUser->getSkin();
        $link = $sk->makeKnownLinkObj($sTitle, wfMsg('mv_stream_resource_export'), 'feed_format=roe&stream_name=' . htmlspecialchars($mvTitle->getStreamName()) . '&t=' . htmlspecialchars($mvTitle->getTimeRequest()), '', '', 'title="' . htmlspecialchars(wfMsg('mv_export_cmml')) . '"');
        echo "<li>" . $link . "</li>";
    }
    return true;
}
    function getResultsHTML()
    {
        global $mvgIP, $wgOut, $mvgScriptPath, $mvgContLang, $wgUser, $wgParser;
        $sk =& $wgUser->getSkin();
        $o = '';
        if ($this->outputContainer) {
            $o .= '<div id="mv_search_results_container">';
        }
        //for each stream range:
        if (count($this->results) == 0) {
            $o .= '<h2><span class="mw-headline">' . wfMsg('mv_search_no_results') . '</span></h2>';
            if ($this->outputContainer) {
                $o .= '</div>';
            }
            return $o;
        } else {
            if ($this->outputInlineHeader) {
                $o .= '<h2>
						<span class="mw-headline">' . wfMsg('mv_media_matches') . '</span>
					</h2>';
                $title = Title::MakeTitle(NS_SPECIAL, 'MediaSearch');
                $o .= $sk->makeKnownLinkObj($title, wfMsg('mv_advaced_search'), $this->get_httpd_filters_query());
            }
        }
        //media pagging:
        $prevnext = mvViewPrevNext($this->offset, $this->limit, SpecialPage::getTitleFor('MediaSearch'), $this->get_httpd_filters_query(), $this->num < $this->limit);
        $o .= "<br /><span id=\"mv_search_pagging\">{$prevnext}</span>\n";
        //add the rss link:
        $sTitle = Title::MakeTitle(NS_SPECIAL, 'MvExportSearch');
        $o .= '<span style="float:right;">';
        $o .= $sk->makeKnownLinkObj($sTitle, '<img border="0" src="' . $mvgScriptPath . '/skins/images/feed-icon-28x28.png">', $this->get_httpd_filters_query());
        $o .= '</span>';
        //add the results bar:
        $o .= $this->getResultsBar();
        //print_r($this->results);
        foreach ($this->results as $stream_id => &$stream_set) {
            $matches = 0;
            $stream_out = $mvTitle = '';
            foreach ($stream_set as &$srange) {
                $cat_html = $mvd_out = '';
                $range_match = 0;
                foreach ($srange['rows'] as $inx => &$mvd) {
                    $matches++;
                    $mvTitle = new MV_Title($mvd->wiki_title);
                    //retrieve only the first article:
                    //$title = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title);
                    //$article = new Article($title);
                    $bgcolor = MV_Overlay::getMvdBgColor($mvd);
                    //output indent if not the first and count more than one
                    if (count($srange['rows']) != 1 && $inx != 0) {
                        $mvd_out .= '&nbsp; &nbsp; &nbsp; &nbsp;';
                    }
                    //'<img src="'. $mvgScriptPath . '/skins/images/film.png">'
                    //$mvd_out .= '<div class="mv_rtdesc" title="' . wfMsg('mv_expand_play') . '"  '.
                    //				'> ';
                    $mvd_out .= '<img style="float:left;width:84px;cursor:pointer;border:solid #' . $bgcolor . '" ' . ' onclick="mv_ex(\'' . $mvd->id . '\')" width="80" height="60" src="' . $mvTitle->getStreamImageURL('icon') . '">';
                    $mvd_out .= '</div>';
                    $mvd_out .= '<b>' . $mvTitle->getTimeDesc() . '</b>&nbsp;';
                    $mvd_cnt_links = '';
                    if (isset($mvd->spoken_by)) {
                        $ptitle = Title::MakeTitle(NS_MAIN, $mvd->spoken_by);
                        $mvd_cnt_links .= wfMsg('mv_search_spoken_by') . ': ' . $sk->makeKnownLinkObj($ptitle);
                        $mvd_cnt_links .= '<br>';
                    }
                    if ($this->outputSeqLinks == true) {
                        $mvd_cnt_links .= '&nbsp;<a href="javascript:mv_add_to_seq({mvclip:\'' . $mvTitle->getStreamName() . '/' . $mvTitle->getTimeRequest() . '\',' . 'src:\'' . $mvTitle->getWebStreamURL() . '\',' . 'img_url:\'' . $mvTitle->getStreamImageURL() . '\'})">' . '<img style="cursor:pointer;" ' . 'title="' . wfMsg('mv_seq_add_end') . '" ' . 'src="' . $mvgScriptPath . '/skins/mv_embed/images/application_side_expand.png">' . wfMsg('mv_seq_add_end') . '</a>';
                    }
                    $mvd_cnt_links .= '<a title="' . wfMsg('mv_expand_play') . '" href="javascript:mv_ex(\'' . $mvd->id . '\')">' . '<img id="mv_img_ex_' . $mvd->id . '"  src="' . $mvgScriptPath . '/skins/images/closed.png">' . '<span id="mv_watch_clip_' . $mvd->id . '">' . wfMsg('mv_watch_clip') . '</span>' . '<span style="display:none;" id="mv_close_clip_' . $mvd->id . '">' . wfMsg('mv_close_clip') . '</span>' . '</a>' . '&nbsp;&nbsp;';
                    //output control links:
                    //make stream title link:
                    $mvStreamTitle = Title::MakeTitle(MV_NS_STREAM, $mvTitle->getNearStreamName());
                    //$mvTitle->getStreamName() .'/'.$mvTitle->getStartTime() .'/'. $mvTitle->getEndTime() );
                    $mvd_cnt_links .= $sk->makeKnownLinkObj($mvStreamTitle, '<img border="1" src="' . $mvgScriptPath . '/skins/images/run_mv_stream.png"> ' . wfMsg('mv_improve_transcript'), '', '', '', '', ' title="' . wfMsg('mv_view_in_stream_interface') . '" ');
                    $mvd_cnt_links .= '<br>';
                    //$title = MakeTitle::()
                    //don't inclue link to wiki page (too confusing)
                    //$mvd_out .='&nbsp;';
                    $mvdTitle = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title);
                    //$mvd_out .= $sk->makeKnownLinkObj($mvdTitle, '<img border="0" src="' . $mvgScriptPath . '/skins/images/run_mediawiki.png">', '', '', '', '', ' title="' . wfMsg('mv_view_wiki_page') . '" ');
                    $mvd_out .= '<span id="mvr_desc_' . $mvd->id . '">';
                    if (!isset($mvd->toplq)) {
                        $mvd->toplq = false;
                    }
                    //output short desc send partial regEx:
                    if (!$mvd->toplq) {
                        $mvd_out .= $this->termHighlight($mvd->text, implode('|', $this->getTerms()));
                    } else {
                        if ($mvdTitle->exists() && !isset($mvd->text)) {
                            //grab the article text:
                            $curRevision = Revision::newFromTitle($mvdTitle);
                            $wikiText = $curRevision->getText();
                        } else {
                            $wikiText =& $mvd->text;
                        }
                        //@@todo parse category info if present
                        $cat_html = '';
                        //run via parser to add in Category info:
                        $parserOptions = ParserOptions::newFromUser($wgUser);
                        $parserOptions->setEditSection(false);
                        $parserOptions->setTidy(true);
                        $title = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title);
                        $parserOutput = $wgParser->parse($wikiText, $title, $parserOptions);
                        $cats = $parserOutput->getCategories();
                        foreach ($cats as $catkey => $title_str) {
                            $catTitle = Title::MakeTitle(NS_CATEGORY, $catkey);
                            $cat_html .= ' ' . $sk->makeKnownLinkObj($catTitle);
                        }
                        //add category pre-text:
                        //if ($cat_html != '')
                        //$mvd_out.= wfMsg('Categories') . ':' . $cat_html;
                        $mvd_out .= $cat_html;
                        $mvd_out .= count($srange['rows']) - 1 == 1 ? wfMsg('mv_match_text_one') : wfMsg('mv_match_text', count($srange['rows']) - 1);
                        //$wgOut->addCategoryLinks( $parserOutput->getCategories() );
                        //$cat_html = $sk->getCategories();
                        //empty out the categories
                        //$wgOut->mCategoryLinks = array();
                    }
                    $mvd_out .= '</span>';
                    $mvd_out .= '<br>' . $mvd_cnt_links;
                    $mvd_out .= '<div style="display:block;clear:both;padding-top:4px;padding-bottom:4px;"/>';
                    $mvd_out .= '<div id="mvr_' . $mvd->id . '" style="display:none;background:#' . $bgcolor . ';" ></div>';
                }
                $stream_out .= $mvd_out;
                /*if(count($srange['rows'])!=1){					
                			$stream_out .= '&nbsp;' . $cat_html . ' In range:' . 
                			seconds2ntp($srange['s']) . ' to ' . seconds2ntp($srange['e']) .
                			wfMsg('mv_match_text', count($srange['rows'])).'<br />' . "\n";
                			$stream_out .= $mvd_out;
                		}else{								
                			$stream_out .= $mvd_out;
                		}*/
            }
            $nsary = $mvgContLang->getNamespaces();
            //output stream name and mach count
            /*$o.='<br /><img class="mv_stream_play_button" name="'.$nsary[MV_NS_STREAM].':' .
            			$mvTitle->getStreamName() .
            				'" align="left" src="'.$mvgScriptPath.'/skins/mv_embed/images/vid_play_sm.png">';
            		*/
            $o .= '<h3>' . $mvTitle->getStreamNameText();
            $o .= $matches == 1 ? wfMsg('mv_match_text_one') : wfMsg('mv_match_text', $matches);
            $o .= '</h3>';
            $o .= '<div id="mv_stream_' . $stream_id . '">' . $stream_out . '</div>';
        }
        if ($this->outputContainer) {
            $o .= '</div>';
        }
        return $o;
    }
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);
	}	
}