r39271 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39270‎ | r39271 | r39272 >
Date:03:12, 13 August 2008
Author:dale
Status:old
Tags:
Comment:
security updates, database refactoring to use mediaWiki db_wrappers, style updates, lazy loading of special pages
Modified paths:
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_AutoCompleteCache.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_EditStreamPage.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_GlobalFunctions.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_Hooks.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_ImageGallery.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_Index.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MagicWords.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_EditPageAjax.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_MetavidInterface.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_PageHistoryAjax.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_SequencePlayer.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_SequenceTimeline.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_SequenceTools.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_StreamMeta.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_Tools.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/MV_Title.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/articlepages/MV_CategoryPage.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/articlepages/MV_SequencePage.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/specials/MV_SpecialCRUDStream.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/specials/MV_SpecialExport.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/specials/MV_SpecialListStreams.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/specials/MV_SpecialMVAdmin.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/maintenance/download_from_archive_org.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/maintenance/metavid2mvWiki.inc.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/maintenance/metavid_gov_templates.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/maintenance/mv_update.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/maintenance/ogg_thumb_insert.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/maintenance/scrape_and_insert.inc.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/skins/images/add.png (added) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/skins/mv_embed/cortado_iframe.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/skins/mv_embed/mv_data_proxy.php (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/skins/mv_stream.js (modified) (history)

Diff [purge]

Index: branches/MetavidWiki-exp/MetavidWiki/maintenance/download_from_archive_org.php
@@ -6,7 +6,10 @@
77 define('MV_DOWNLOAD_DIR', '/metavid/video_archive/');
88 define('MV_ARCHIVE_ORG_DL', 'http://www.archive.org/download/mv_');
99
 10+define('ARCHIVE_ORG_SKIP_LIST', '/metavid/ao_skip_list.txt');
1011
 12+define('MV_BASE_MEDIA_SERVER_PATH', 'http://mvbox2.cse.ucsc.edu/mvFlvServer.php/');
 13+
1114 //for gennerate flv metadata:
1215 include_once('../skins/mv_embed/flvServer/MvFlv.php');
1316
@@ -30,13 +33,49 @@
3134 $sql = "SELECT * FROM `mv_streams` WHERE `name` ={$stream_name}";
3235 }
3336 $dbr = wfGetDB(DB_READ);
 37+ $dbw = wfGetDB(DB_WRITE);
3438 $result = $dbr->query($sql);
 39+ $skip_list = unserialize(file_get_contents(ARCHIVE_ORG_SKIP_LIST));
3540 while($stream = $dbr->fetchObject($result) ){
3641 $local_fl = MV_DOWNLOAD_DIR . $stream->name.'.flv';
3742 $remote_fl = MV_ARCHIVE_ORG_DL . $stream->name.'/'.$stream->name.'.flv';
 43+
 44+ if(is_file($local_fl). META_DATA_EXT && is_file($local_fl) ){
 45+ //check db table for updated mv_flash_low_quality ref
 46+ $sql = " SELECT * FROM `mv_stream_files` WHERE `stream_id`='".$stream->id."' " .
 47+ " AND `file_desc_msg`='mv_flash_low_quality'";
 48+ $resFcheck = $dbr->query($sql);
 49+ if($dbr->numRows($resFcheck)==0){
 50+ //grab duration from mv_ogg_low_quality
 51+ $sql = " SELECT * FROM `mv_stream_files` WHERE `stream_id`='".$stream->id."' " .
 52+ " AND `file_desc_msg`='mv_ogg_low_quality'";
 53+ $rdur = $dbr->query($sql);
 54+ $dur_val =0;
 55+ if($dbr->numRows($rdur)){
 56+ $ogg_file = $dbr->fetchObject($rdur);
 57+ $dur_val = $ogg_file->duration;
 58+ }
 59+ $sql="INSERT INTO `mv_stream_files`
 60+ (`id`,`base_offset`,`duration`,`file_desc_msg`,`path_type`,`path`)
 61+ VALUES('',0,'{$dur_val}','mv_flash_low_quality','','".
 62+ MV_BASE_MEDIA_SERVER_PATH . $stream->name .".flv');";
 63+ print "insert {$stream->name}.flv\n";
 64+ $dbw->query($sql);
 65+ }else{
 66+ $file = $dbr->fetchObject($resFcheck);
 67+ $sql="UPDATE `mv_stream_files` WHERE `id` = '".$file->id."'
 68+ SET `path`=".MV_BASE_MEDIA_SERVER_PATH . $stream->name .'.flv';
 69+ print "update {$stream->name}.flv\n";
 70+ $dbw->query($sql);
 71+ }
 72+ }
 73+
3874 //lets just skip local files for now and try to remove incomplete mannually
 75+ if(isset($skip_list[$stream->name])){
 76+ print "skipping:".$stream->name."\n";
 77+ continue;
 78+ }
3979
40 -
4180 //senate_proceeding_08-01-07/senate_proceeding_08-01-07.flv
4281 //check local file size matches remote:
4382 if(is_file($local_fl)){
@@ -50,18 +89,19 @@
5190 echo ' sizes match: ' . hr_bytes(filesize($local_fl)) .'='.
5291 hr_bytes(remotefsize($remote_fl))."\n";
5392 }*/
54 - }else{
 93+ }else{
5594 //check if flash file exists:
5695 //$sql ="SELECT * FROM `mv_stream_files` WHERE `stream_id`=" .$stream->id
5796 //ao_file_flash_flv
5897
5998 if(remotefsize($remote_fl)<100000){
6099 print "remote file: $remote_fl < 100k (skipping) \n";
 100+ $skip_list[$stream->name]=true;
61101 continue;
62102 }
63103 echo "DL it: $remote_fl \n";
64104 if(curldownload($remote_fl, $local_fl)){
65 - echo 'succesfully grabed '.$remote_fl."\n";
 105+ echo 'succesfully grabed '.$remote_fl."\n";
66106 };
67107 }
68108 if(!is_file($local_fl). META_DATA_EXT){
@@ -75,6 +115,11 @@
76116 $flv->getMetaData();
77117 echo "done with .meta (" . filesize($local_fl.META_DATA_EXT).") \n";
78118 }
 119+ //add to skip list
 120+ if(is_file($local_fl). META_DATA_EXT && is_file($local_fl) ){
 121+ $skip_list[$stream->name]=true;
 122+ }
 123+ file_put_contents(ARCHIVE_ORG_SKIP_LIST,serialize($skip_list));
79124 }
80125
81126 }
Index: branches/MetavidWiki-exp/MetavidWiki/maintenance/metavid_gov_templates.php
@@ -1,5 +1,5 @@
22 <?
3 -
 3+require_once ('../../../maintenance/commandLine.inc');
44 function upTemplates($force=false){
55 /***************************************************
66 * Transcripts:
Index: branches/MetavidWiki-exp/MetavidWiki/maintenance/mv_update.php
@@ -113,7 +113,7 @@
114114 $i=0;
115115 }
116116 $i++;
117 - $j++;
 117+ $j++;
118118 }
119119 //now we can drop id and add PRIMARY to mv_page_id
120120 print "DROP id COLUMN from $mvIndexTableName ...";
Index: branches/MetavidWiki-exp/MetavidWiki/maintenance/metavid2mvWiki.inc.php
@@ -13,7 +13,7 @@
1414 /*
1515 * Templates:
1616 */
17 -
 17+require_once ('../../../maintenance/commandLine.inc');
1818 //$i=0;
1919 function do_stream_attr_check($old_stream) {
2020 global $i;
@@ -233,7 +233,7 @@
234234 if($mvStream->doesStreamExist()){
235235 $dbr =& wfGetDB(DB_SLAVE);
236236 //get all meta in range (up 10k)
237 - $mvd_res = MV_Index::getMVDInRange($mvStream->getStreamId(), null, null, 'Ht_en',false, 'Spoken_by', 'LIMIT 0, 10000');
 237+ $mvd_res = MV_Index::getMVDInRange($mvStream->getStreamId(), null, null, 'Ht_en',false, 'Spoken_by', '10000');
238238 if(count($dbr->numRows($mvd_res))!=0){
239239 $prev_person ='';
240240 $prev_st=$prev_et=0;
Index: branches/MetavidWiki-exp/MetavidWiki/maintenance/scrape_and_insert.inc.php
@@ -9,7 +9,7 @@
1010 * @email dale@ucsc.edu
1111 * @url http://metavid.ucsc.edu
1212 */
13 -
 13+require_once ('../../../maintenance/commandLine.inc');
1414 class MV_BillScraper extends MV_BaseScraper{
1515 var $base_url = 'http://www.c-spanarchives.org/congress/';
1616 var $base_query = '?q=node/69850';
Index: branches/MetavidWiki-exp/MetavidWiki/maintenance/ogg_thumb_insert.php
@@ -9,7 +9,7 @@
1010 * @email dale@ucsc.edu
1111 * @url http://metavid.ucsc.edu
1212 */
13 -
 13+
1414 $cur_path = $IP = dirname(__FILE__);
1515 //include commandLine.inc from the mediaWiki maintance dir:
1616 require_once ('../../../maintenance/commandLine.inc');
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_Hooks.php
@@ -13,332 +13,329 @@
1414 */
1515 if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
1616
17 - /*
18 - * This method will be called after an article is saved
19 - * to update the metavid data index
20 - */
21 - function mvSaveHook(&$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags){
22 - global $mvgIP;
23 -
24 - //confirm we are in the metavid data Namespace (where data indexes are updated)
25 - if($article->mTitle->getNamespace()==MV_NS_MVD){
26 - MV_Index::update_index_page($article,$text);
27 - }
28 - return true; // always return true, in order not to stop MW's hook processing!
 17+/*
 18+* This method will be called after an article is saved
 19+* to update the metavid data index
 20+*/
 21+ function mvSaveHook(&$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags){
 22+ global $mvgIP;
 23+
 24+ //confirm we are in the metavid data Namespace (where data indexes are updated)
 25+ if($article->mTitle->getNamespace()==MV_NS_MVD){
 26+ MV_Index::update_index_page($article,$text);
 27+ }
 28+ return true; // always return true, in order not to stop MW's hook processing!
 29+ }
 30+ /*
 31+ * mvisValidMoveOperation
 32+ */
 33+ function mvisValidMoveOperation( &$new_title){
 34+ $mvTitle = new MV_Title( $new_title->getDBkey() );
 35+ if( $mvTitle->validRequestTitle() ){
 36+ return true;
 37+ }else{
 38+ return 'mvMVDFormat';
2939 }
30 - /*
31 - * mvisValidMoveOperation
32 - */
33 - function mvisValidMoveOperation( &$new_title){
34 - $mvTitle = new MV_Title( $new_title->getDBkey() );
35 - if( $mvTitle->validRequestTitle() ){
36 - return true;
37 - }else{
38 - return 'mvMVDFormat';
39 - }
40 - }
41 - /*
42 - * handles general parse and replace functions for sequences and internal embedding setup
43 - *
44 - * in sequence pages: replace <playlist> with sequence formatted <playlist>
45 - * all pages: replace [[Sequence:SeqName]] with embed formatted playlist from that seq page
46 - * replace [[MvStream:StreamName/ss:ss:ss/ee:ee:ee]] with clip segment
47 - */
48 - function mvParserAfterTidy(&$parser, &$text) {
49 - // find markers in $text
50 - // replace markers with actual output
51 - global $markerList;
52 - for ($i=0;$i<count($markerList);$i++)
53 - $text = preg_replace('/xx-marker'.$i.'-xx/',$markerList[$i],$text);
54 - return true;
 40+ }
 41+ /*
 42+ * handles general parse and replace functions for sequences and internal embedding setup
 43+ *
 44+ * in sequence pages: replace <playlist> with sequence formatted <playlist>
 45+ * all pages: replace [[Sequence:SeqName]] with embed formatted playlist from that seq page
 46+ * replace [[MvStream:StreamName/ss:ss:ss/ee:ee:ee]] with clip segment
 47+ */
 48+ function mvParserAfterTidy(&$parser, &$text) {
 49+ // find markers in $text
 50+ // replace markers with actual output
 51+ global $markerList;
 52+ for ($i=0;$i<count($markerList);$i++)
 53+ $text = preg_replace('/xx-marker'.$i.'-xx/',$markerList[$i],$text);
 54+ return true;
 55+}
 56+//load the sequence page
 57+function mvSeqTag(&$input, &$argv, &$parser){
 58+ global $wgTitle;
 59+ //print "cur title: " . $wgTitle->getDBkey() . ' ns: ' . $wgTitle->getNamespace();
 60+ //check namespace (seq only show up via <tag> when in mvSequence namespace
 61+ if( !$wgTitle instanceof Title ) {
 62+ wfDebugLog( 'mvSeqTag', "wgTitle not instance of Title`" );
 63+ return true;
5564 }
56 - //load the sequence page
57 - function mvSeqTag(&$input, &$argv, &$parser){
58 - global $wgTitle;
59 - //print "cur title: " . $wgTitle->getDBkey() . ' ns: ' . $wgTitle->getNamespace();
60 - //check namespace (seq only show up via <tag> when in mvSequence namespace
61 - if( !$wgTitle instanceof Title ) {
62 - wfDebugLog( 'mvSeqTag', "wgTitle not instance of Title`" );
63 - return true;
64 - }
65 - if($wgTitle->getNamespace() == MV_NS_SEQUENCE ){
66 - $marker = MV_SequencePage::doSeqReplace($input, $argv, $parser);
67 - return $marker;
68 - }
69 - return true;
 65+ if($wgTitle->getNamespace() == MV_NS_SEQUENCE ){
 66+ $marker = MV_SequencePage::doSeqReplace($input, $argv, $parser);
 67+ return $marker;
7068 }
71 - /*
72 - * This method will be called whenever an article is moved so that
73 - * updates the time stamps when an article is moved
74 - */
75 - function mvMoveHook(&$old_title, &$new_title, &$user, $pageid, $redirid){
76 - global $mvgIP;
77 - //die;
78 - //confirm we are in the mvd Namespace & update the wiki_title
79 - if($old_title->getNamespace()==MV_NS_MVD){
80 - MV_Index::update_index_title($old_title->getDBkey() , $new_title->getDBkey());
81 - }
82 - return true;// always return true, in order not to stop MW's hook processing!
83 - }
84 - /*
85 - * This method will be called whenever an article is deleted so that
86 - * the metavid index is updated accordingly
87 - */
88 - function mvDeleteHook(&$article, &$user, &$reason) {
89 - global $mvgIP;
90 - //print 'mvDeleteHook'."\n";
91 - //only need to update the mvd index when in the mvd namespace:
92 - if($article->mTitle->getNamespace()==MV_NS_MVD){
93 - //remove article with that title:
94 - MV_Index::remove_by_wiki_title($article->mTitle->getDBkey());
95 - }else if($article->mTitle->getNamespace()==MV_NS_STREAM){
96 - MV_Index::remove_by_stream_id($article->mvTitle->mvStream->getStreamId());
97 - $article->mvTitle->mvStream->deleteDB();
98 - }
99 - return true; // always return true, in order not to stop MW's hook processing!
 69+ return true;
 70+}
 71+ /*
 72+ * This method will be called whenever an article is moved so that
 73+ * updates the time stamps when an article is moved
 74+ */
 75+ function mvMoveHook(&$old_title, &$new_title, &$user, $pageid, $redirid){
 76+ global $mvgIP;
 77+ //die;
 78+ //confirm we are in the mvd Namespace & update the wiki_title
 79+ if($old_title->getNamespace()==MV_NS_MVD){
 80+ MV_Index::update_index_title($old_title->getDBkey() , $new_title->getDBkey());
 81+ }
 82+ return true;// always return true, in order not to stop MW's hook processing!
 83+ }
 84+ /*
 85+* This method will be called whenever an article is deleted so that
 86+* the metavid index is updated accordingly
 87+*/
 88+function mvDeleteHook(&$article, &$user, &$reason) {
 89+ global $mvgIP;
 90+ //print 'mvDeleteHook'."\n";
 91+ //only need to update the mvd index when in the mvd namespace:
 92+ if($article->mTitle->getNamespace()==MV_NS_MVD){
 93+ //remove article with that title:
 94+ MV_Index::remove_by_wiki_title($article->mTitle->getDBkey());
 95+ }else if($article->mTitle->getNamespace()==MV_NS_STREAM){
 96+ MV_Index::remove_by_stream_id($article->mvTitle->mvStream->getStreamId());
 97+ $article->mvTitle->mvStream->deleteDB();
10098 }
101 - function mvCustomEditor(&$article, &$user){
102 - global $wgTitle, $wgRequest;
103 - switch($wgTitle->getNamespace()){
104 - case MV_NS_SEQUENCE:
105 - $MvInterface = new MV_MetavidInterface('edit_sequence', $article);
106 - $MvInterface->render_full();
107 - return false;
108 - break;
109 - case MV_NS_STREAM:
110 - $editor = new MV_EditStreamPage($article);
111 - $editor->edit();
112 - return false;
113 - break;
114 - case MV_NS_MVD:
115 - $editor = new MV_EditDataPage( $article );
116 - $editor->edit();
117 - return false;
118 - break;
119 - default:
120 - // continue proccessing (use default editor)
121 - return true;
122 - break;
123 - }
124 - /*
125 - //@@todo how will 'external' editors work?
126 - if( !$wgRequest->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal ||
127 - $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) {
128 - $editor = new MvEditSequence( $article );
129 - $editor->submit();
130 - } elseif( $wgRequest->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) {
131 - $mode = $wgRequest->getVal( 'mode' );
132 - $extedit = new ExternalEdit( $article, $mode );
133 - $extedit->edit();
134 - }*/
135 -
136 - }
137 - /*function mvArticleViewOpts(&$out, &$sk){
138 -
 99+ return true; // always return true, in order not to stop MW's hook processing!
 100+}
 101+function mvCustomEditor(&$article, &$user){
 102+ global $wgTitle, $wgRequest;
 103+ switch($wgTitle->getNamespace()){
 104+ case MV_NS_SEQUENCE:
 105+ $MvInterface = new MV_MetavidInterface('edit_sequence', $article);
 106+ $MvInterface->render_full();
 107+ return false;
 108+ break;
 109+ case MV_NS_STREAM:
 110+ $editor = new MV_EditStreamPage($article);
 111+ $editor->edit();
 112+ return false;
 113+ break;
 114+ case MV_NS_MVD:
 115+ $editor = new MV_EditDataPage( $article );
 116+ $editor->edit();
 117+ return false;
 118+ break;
 119+ default:
 120+ // continue proccessing (use default editor)
 121+ return true;
 122+ break;
 123+ }
 124+ /*
 125+ //@@todo how will 'external' editors work?
 126+ if( !$wgRequest->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal ||
 127+ $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) {
 128+ $editor = new MvEditSequence( $article );
 129+ $editor->submit();
 130+ } elseif( $wgRequest->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) {
 131+ $mode = $wgRequest->getVal( 'mode' );
 132+ $extedit = new ExternalEdit( $article, $mode );
 133+ $extedit->edit();
139134 }*/
140 - /*
141 - * mvDoMvPage handles the article rewriting
142 - * by processing the given title request/namespace
143 - */
144 - function mvDoMvPage (&$title, &$article, $doOutput=true){
145 - global $wgOut;
146 - if($title->getNamespace() == NS_CATEGORY){
147 - $article = new MV_CategoryPage($title);
148 - } elseif ($title->getNamespace() == MV_NS_SEQUENCE){
149 - $article = new MV_SequencePage($title);
150 - } elseif ($title->getNamespace() == MV_NS_STREAM){
151 - mvDoMetavidStreamPage($title, $article);
152 - } elseif ( $title->getNamespace() == MV_NS_MVD ) {
153 - $mvTitle = new MV_Title( $title->getDBkey() );
154 - //check if mvd type exist
155 - if( $mvTitle->validRequestTitle() ){
156 - //this page can be edited seen the MVD page:
157 - $article = new MV_DataPage($title, $mvTitle);
158 - //$title = 'Stream: ' . $mvTitle['type_marker'] . $mvTitle['stream_name'];
159 - //$body = 'body content';
160 - //mvOutputSpecialPage($title,$body);
161 - }else{
162 - //@@TODO get type of error: & put this in the language file
163 - //$title = 'missing type, stream missing, or not valid time format';
164 - if($doOutput)mvOutputSpecialPage(wfMsg('mvBadMVDtitle'), wfMsg('mvMVDFormat'));
165 - return false;
166 - }
 135+
 136+}
 137+ /*
 138+ * mvDoMvPage handles the article rewriting
 139+ * by processing the given title request/namespace
 140+ */
 141+function mvDoMvPage (&$title, &$article, $doOutput=true){
 142+ global $wgOut;
 143+ if($title->getNamespace() == NS_CATEGORY){
 144+ $article = new MV_CategoryPage($title);
 145+ } elseif ($title->getNamespace() == MV_NS_SEQUENCE){
 146+ $article = new MV_SequencePage($title);
 147+ } elseif ($title->getNamespace() == MV_NS_STREAM){
 148+ mvDoMetavidStreamPage($title, $article);
 149+ } elseif ( $title->getNamespace() == MV_NS_MVD ) {
 150+ $mvTitle = new MV_Title( $title->getDBkey() );
 151+ //check if mvd type exist
 152+ if( $mvTitle->validRequestTitle() ){
 153+ //this page can be edited seen the MVD page:
 154+ $article = new MV_DataPage($title, $mvTitle);
 155+ //$title = 'Stream: ' . $mvTitle['type_marker'] . $mvTitle['stream_name'];
 156+ //$body = 'body content';
 157+ //mvOutputSpecialPage($title,$body);
 158+ }else{
 159+ //@@TODO get type of error: & put this in the language file
 160+ //$title = 'missing type, stream missing, or not valid time format';
 161+ if($doOutput)mvOutputSpecialPage(wfMsg('mvBadMVDtitle'), wfMsg('mvMVDFormat'));
 162+ return false;
167163 }
168 - return true;
169164 }
170 - function mvCatHook(&$catArticle){
171 - global $mvgIP;
172 - $catArticle = new MV_CategoryPage($catArticle);
173 - return true;
174 - }
175 - function mvMissingStreamPage($missing_stream_name){
176 - $streamListTitle = Title::newFromText(wfMsg('mv_list_streams_page'), NS_SPECIAL);
177 - $streamAddTitle = Title::newFromText(wfMsg('mv_add_stream_page'), NS_SPECIAL);
 165+ return true;
 166+}
 167+function mvCatHook(&$catArticle){
 168+ global $mvgIP;
 169+ $catArticle = new MV_CategoryPage($catArticle);
 170+ return true;
 171+}
 172+function mvMissingStreamPage($missing_stream_name){
 173+ $streamListTitle = Title::newFromText(wfMsg('mv_list_streams_page'), NS_SPECIAL);
 174+ $streamAddTitle = Title::newFromText(wfMsg('mv_add_stream_page'), NS_SPECIAL);
 175+
 176+ $html = wfMsg('mv_missing_stream_text',
 177+ $missing_stream_name,
 178+ $streamListTitle->getFullURL(),
 179+ $streamAddTitle->getFullURL() . '/'.$missing_stream_name
 180+ );
 181+ $title = wfMsg( 'mv_missing_stream' , $missing_stream_name);
178182
179 - $html = wfMsg('mv_missing_stream_text',
180 - $missing_stream_name,
181 - $streamListTitle->getFullURL(),
182 - $streamAddTitle->getFullURL() . '/'.$missing_stream_name
183 - );
184 - $title = wfMsg( 'mv_missing_stream' , $missing_stream_name);
185 -
186 - mvOutputSpecialPage($title, $html );
 183+ mvOutputSpecialPage($title, $html );
 184+}
 185+/* ajax Entry points:
 186+ * as entered in global functions: $wgAjaxExportList[]
 187+ *
 188+ * @@todo we could probably do a cleaner abstraction for ajax calls
 189+*/
 190+function mv_add_disp($baseTitle, $mvdType, $time_range){
 191+ $MV_Overlay = new MV_Overlay();
 192+ return $MV_Overlay->get_add_disp(strtolower($baseTitle), $mvdType, $time_range);
 193+}
 194+function mv_disp_mvd($titleKey, $mvd_id){
 195+ $MV_Overlay = new MV_Overlay();
 196+ return $MV_Overlay->get_fd_mvd_request($titleKey, $mvd_id);
 197+}
 198+function mv_disp_remove_mvd($titleKey, $mvd_id){
 199+ $MV_Overlay = new MV_Overlay();
 200+ return $MV_Overlay->get_disp_remove_mvd($titleKey, $mvd_id);
 201+}
 202+function mv_remove_mvd(){
 203+ $MV_Overlay = new MV_Overlay();
 204+ return $MV_Overlay->do_remove_mvd($_REQUEST['title'], $_REQUEST['mvd_id']);
 205+}
 206+function mv_edit_disp($titleKey, $mvd_id){
 207+ $MV_Overlay = new MV_Overlay();
 208+ return $MV_Overlay->get_edit_disp($titleKey, $mvd_id);
 209+}
 210+/* genneral autocomplete */
 211+function mv_helpers_auto_complete($val=null){
 212+ global $mvMetaDataHelpers,$wgRequest;
 213+ $property = $wgRequest->getVal('prop_name');
 214+ switch($property){
 215+ case 'smw_Speech_by':
 216+ return MV_SpecialMediaSearch::auto_complete_person($val);
 217+ break;
 218+ case 'smw_Bill':
 219+ return MV_SpecialMediaSearch::auto_complete_category('Bill', $val);
 220+ break;
 221+ case 'category':
 222+ return MV_SpecialMediaSearch::auto_complete_search_categories($val);
 223+ break;
187224 }
188 - /* ajax Entry points:
189 - * as entered in global functions: $wgAjaxExportList[]
190 - *
191 - * @@todo we could probably do a cleaner abstraction for ajax calls
192 - */
193 - function mv_add_disp($baseTitle, $mvdType, $time_range){
194 - $MV_Overlay = new MV_Overlay();
195 - return $MV_Overlay->get_add_disp(strtolower($baseTitle), $mvdType, $time_range);
 225+}
 226+function mv_auto_complete_person($val=null){
 227+ return MV_SpecialMediaSearch::auto_complete_person($val);
 228+}
 229+function mv_auto_complete_all($val=null){
 230+ return MV_SpecialMediaSearch::auto_complete_all($val);
 231+}
 232+function mv_auto_complete_stream_name($val=null){
 233+ return MV_SequenceTools::auto_complete_stream_name($val);
 234+}
 235+function mv_edit_sequence_submit(){
 236+ $MV_SequenceTools = new MV_SequenceTools();
 237+ return $MV_SequenceTools->do_edit_submit();
 238+}
 239+function mv_edit_submit(){
 240+ global $wgOut, $wgRequest;
 241+ //@@todo more input scrubbing value checks
 242+ $title = $wgRequest->getVal('title');
 243+ $mvd_id = $wgRequest->getVal('mvd_id');
 244+ if($title=='' || $mvd_id=='')
 245+ return 'error missing title or id';
 246+
 247+ $MV_Overlay = new MV_Overlay();
 248+ $do_adjust = $wgRequest->getVal('do_adjust');
 249+ if($do_adjust=='true'){
 250+ //first edit then move
 251+ $outputMVD = $MV_Overlay->do_edit_submit($title, $mvd_id);
 252+ //clear the wgOut var:
 253+ $wgOut->clearHTML();
 254+ //do move and display output page
 255+ return $MV_Overlay->do_adjust_submit($wgRequest->getVal('titleKey'), $mvd_id, $wgRequest->getVal('newTitle'), $wgRequest->getVal('wgTitle'), $outputMVD);
 256+ }else{
 257+ return $MV_Overlay->do_edit_submit($_POST['title'], $_POST['mvd_id']);
196258 }
197 - function mv_disp_mvd($titleKey, $mvd_id){
198 - $MV_Overlay = new MV_Overlay();
199 - return $MV_Overlay->get_fd_mvd_request($titleKey, $mvd_id);
 259+}
 260+function mv_history_disp($titleKey, $mvd_id){
 261+ global $wgOut;
 262+ $MV_Overlay = new MV_Overlay();
 263+ return $MV_Overlay->get_history_disp($titleKey, $mvd_id);
 264+}
 265+/*function mv_adjust_disp($titleKey, $mvd_id){
 266+ global $mvgIP;
 267+ include_once($mvgIP . '/includes/MV_MetavidInterface/MV_Overlay.php');
 268+ $MV_Overlay = new MV_Overlay();
 269+ return $MV_Overlay->get_adjust_disp($titleKey, $mvd_id);
 270+}*/
 271+/*function mv_adjust_submit(){
 272+ $MV_Overlay = new MV_Overlay();
 273+ if(!isset($_POST['titleKey']) || !isset($_POST['newTitle']))
 274+ return 'error: missing titleKey or newTitle';
 275+ return $MV_Overlay->do_adjust_submit($_POST['titleKey'], $_POST['newTitle']);
 276+}*/
 277+function mv_seqtool_disp($tool_id){
 278+ $MV_SequenceTools = new MV_SequenceTools();
 279+ return $MV_SequenceTools->get_tool_html($tool_id);
 280+}
 281+function mv_tool_disp($tool_id, $ns='', $title_str=''){
 282+ $MV_Tools = new MV_Tools();
 283+ return $MV_Tools->get_tool_html($tool_id, $ns, $title_str);
 284+}
 285+function mv_expand_wt($mvd_id){
 286+ global $wgRequest;
 287+ $search_terms = explode('|',$wgRequest->getVal('st'));
 288+ $mvSearch = new MV_SpecialMediaSearch();
 289+ return $mvSearch->expand_wt($mvd_id, $search_terms);
 290+}
 291+function mv_pl_wt($mvd_id){
 292+ global $wgRequest;
 293+ $mvd = MV_Index::getMVDbyId($mvd_id);
 294+ $mvTitle = new MV_Title($mvd->wiki_title);
 295+ return $mvTitle->getEmbedVideoHtml('vid_'.$mvd_id, $wgRequest->getVal('size'), '', true);
 296+}
 297+function mv_date_obj(){
 298+ //returns the date object for existing stream set
 299+ //@@todo this is very cacheable since it only changes when a streams change date or a new stream is added.
 300+ return MV_SpecialMediaSearch::getJsonDateObj();
 301+}
 302+function mv_frame_server($stream_name='',$req_time='', $req_size=''){
 303+ global $wgRequest;
 304+ $stream_id='';
 305+ //try loading vals from $wgRequest if not set
 306+ $stream_name=($stream_name=='')?$wgRequest->getVal('stream_name'):$stream_name;
 307+ if($stream_name==null)$stream_id=$wgRequest->getVal('stream_id');
 308+ $req_time=($req_time=='')?$wgRequest->getVal('t'):$req_time;
 309+ $req_size=($req_size=='')?$wgRequest->getVal('size'):$req_size;
 310+ $redirect_req=($wgRequest->getVal('redirect')=='true')?true:false;
 311+
 312+ if($stream_id==''){
 313+ $mvStream = mvGetMVStream($stream_name);
 314+ $stream_id=$mvStream->getStreamId();
 315+ }else{
 316+ $mvStream = new MV_Stream(array('id'=>$stream_id));
200317 }
201 - function mv_disp_remove_mvd($titleKey, $mvd_id){
202 - $MV_Overlay = new MV_Overlay();
203 - return $MV_Overlay->get_disp_remove_mvd($titleKey, $mvd_id);
204 - }
205 - function mv_remove_mvd(){
206 - $MV_Overlay = new MV_Overlay();
207 - return $MV_Overlay->do_remove_mvd($_REQUEST['title'], $_REQUEST['mvd_id']);
208 - }
209 - function mv_edit_disp($titleKey, $mvd_id){
210 - $MV_Overlay = new MV_Overlay();
211 - return $MV_Overlay->get_edit_disp($titleKey, $mvd_id);
212 - }
213 - /* genneral autocomplete */
214 - function mv_helpers_auto_complete($val=null){
215 - global $mvMetaDataHelpers,$wgRequest;
216 - $property = $wgRequest->getVal('prop_name');
217 - switch($property){
218 - case 'smw_Speech_by':
219 - return MV_SpecialMediaSearch::auto_complete_person($val);
220 - break;
221 - case 'smw_Bill':
222 - return MV_SpecialMediaSearch::auto_complete_category('Bill', $val);
223 - break;
224 - case 'category':
225 - return MV_SpecialMediaSearch::auto_complete_search_categories($val);
226 - break;
 318+
 319+ if($mvStream->db_load_stream()){
 320+ global $mvServeImageRedirect, $mvExternalImages;
 321+ if($mvServeImageRedirect || $redirect_req || $mvExternalImages){
 322+ header("Location:" . MV_StreamImage::getStreamImageURL($stream_id, $req_time, $req_size, true));
 323+ }else{
 324+ //serve up the image directly
 325+ MV_StreamImage::getStreamImageRaw($stream_id, $req_time, $req_size, true);
227326 }
 327+ exit();
 328+ }else{
 329+ return 'error: invalid stream name';
228330 }
229 - function mv_auto_complete_person($val=null){
230 - return MV_SpecialMediaSearch::auto_complete_person($val);
231 - }
232 - function mv_auto_complete_all($val=null){
233 - return MV_SpecialMediaSearch::auto_complete_all($val);
234 - }
235 - function mv_auto_complete_stream_name($val=null){
236 - return MV_SequenceTools::auto_complete_stream_name($val);
237 - }
238 - function mv_edit_sequence_submit(){
239 - $MV_SequenceTools = new MV_SequenceTools();
240 - return $MV_SequenceTools->do_edit_submit();
241 - }
242 - function mv_edit_submit(){
243 - global $wgOut, $wgRequest;
244 - //@@todo more input scrubbing value checks
245 - $title = $wgRequest->getVal('title');
246 - $mvd_id = $wgRequest->getVal('mvd_id');
247 - if($title=='' || $mvd_id=='')
248 - return 'error missing title or id';
249 -
250 - $MV_Overlay = new MV_Overlay();
251 - $do_adjust = $wgRequest->getVal('do_adjust');
252 - if($do_adjust=='true'){
253 - //first edit then move
254 - $outputMVD = $MV_Overlay->do_edit_submit($title, $mvd_id);
255 - //clear the wgOut var:
256 - $wgOut->clearHTML();
257 - //do move and display output page
258 - return $MV_Overlay->do_adjust_submit($wgRequest->getVal('titleKey'), $mvd_id, $wgRequest->getVal('newTitle'), $wgRequest->getVal('wgTitle'), $outputMVD);
259 - }else{
260 - return $MV_Overlay->do_edit_submit($_POST['title'], $_POST['mvd_id']);
261 - }
262 - }
263 - function mv_history_disp($titleKey, $mvd_id){
264 - global $wgOut;
265 - $MV_Overlay = new MV_Overlay();
266 - return $MV_Overlay->get_history_disp($titleKey, $mvd_id);
267 - }
268 - /*function mv_adjust_disp($titleKey, $mvd_id){
269 - global $mvgIP;
270 - include_once($mvgIP . '/includes/MV_MetavidInterface/MV_Overlay.php');
271 - $MV_Overlay = new MV_Overlay();
272 - return $MV_Overlay->get_adjust_disp($titleKey, $mvd_id);
273 - }*/
274 - /*function mv_adjust_submit(){
275 - $MV_Overlay = new MV_Overlay();
276 - if(!isset($_POST['titleKey']) || !isset($_POST['newTitle']))
277 - return 'error: missing titleKey or newTitle';
278 - return $MV_Overlay->do_adjust_submit($_POST['titleKey'], $_POST['newTitle']);
279 - }*/
280 - function mv_seqtool_disp($tool_id){
281 - $MV_SequenceTools = new MV_SequenceTools();
282 - return $MV_SequenceTools->get_tool_html($tool_id);
283 - }
284 - function mv_tool_disp($tool_id, $ns='', $title_str=''){
285 - $MV_Tools = new MV_Tools();
286 - return $MV_Tools->get_tool_html($tool_id, $ns, $title_str);
287 - }
288 - function mv_expand_wt($mvd_id){
289 - global $wgRequest;
290 - $search_terms = explode('|',$wgRequest->getVal('st'));
291 - $mvSearch = new MV_SpecialMediaSearch();
292 - return $mvSearch->expand_wt($mvd_id, $search_terms);
293 - }
294 - function mv_pl_wt($mvd_id){
295 - global $wgRequest;
296 - $mvd = MV_Index::getMVDbyId($mvd_id);
297 - $mvTitle = new MV_Title($mvd->wiki_title);
298 - return $mvTitle->getEmbedVideoHtml('vid_'.$mvd_id, $wgRequest->getVal('size'), '', true);
299 - }
300 - function mv_date_obj(){
301 - //returns the date object for existing stream set
302 - //@@todo this is very cacheable since it only changes when a streams change date or a new stream is added.
303 - return MV_SpecialMediaSearch::getJsonDateObj();
304 - }
305 - function mv_frame_server($stream_name='',$req_time='', $req_size=''){
306 - global $wgRequest;
307 - $stream_id='';
308 - //try loading vals from $wgRequest if not set
309 - $stream_name=($stream_name=='')?$wgRequest->getVal('stream_name'):$stream_name;
310 - if($stream_name==null)$stream_id=$wgRequest->getVal('stream_id');
311 - $req_time=($req_time=='')?$wgRequest->getVal('t'):$req_time;
312 - $req_size=($req_size=='')?$wgRequest->getVal('size'):$req_size;
313 - $redirect_req=($wgRequest->getVal('redirect')=='true')?true:false;
314 -
315 - if($stream_id==''){
316 - $mvStream = mvGetMVStream($stream_name);
317 - $stream_id=$mvStream->getStreamId();
318 - }else{
319 - $mvStream = new MV_Stream(array('id'=>$stream_id));
320 - }
321 -
322 - if($mvStream->db_load_stream()){
323 - global $mvServeImageRedirect, $mvExternalImages;
324 - if($mvServeImageRedirect || $redirect_req || $mvExternalImages){
325 - header("Location:" . MV_StreamImage::getStreamImageURL($stream_id, $req_time, $req_size, true));
326 - }else{
327 - //serve up the image directly
328 - MV_StreamImage::getStreamImageRaw($stream_id, $req_time, $req_size, true);
329 - }
330 - exit();
331 - }else{
332 - return 'error: invalid stream name';
333 - }
334 - }
335 - /*function mv_edit_preview(){
336 - global $mvgIP;
337 - include_once($mvgIP . '/includes/MV_MetavidInterface/MV_Overlay.php');
338 - if(!isset($_POST['title']) || !isset($_POST['mvd_id']))
339 - return 'error missing title or id';
340 - $MV_Overlay = new MV_Overlay();
341 - return $MV_Overlay->edit_preview_form_html($_POST['title'], $_POST['mvd_id']);
342 - }*/
 331+}
 332+/*function mv_edit_preview(){
 333+ global $mvgIP;
 334+ include_once($mvgIP . '/includes/MV_MetavidInterface/MV_Overlay.php');
 335+ if(!isset($_POST['title']) || !isset($_POST['mvd_id']))
 336+ return 'error missing title or id';
 337+ $MV_Overlay = new MV_Overlay();
 338+ return $MV_Overlay->edit_preview_form_html($_POST['title'], $_POST['mvd_id']);
 339+}*/
343340
344341
345342 ?>
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_SequenceTools.php
@@ -94,7 +94,7 @@
9595 list($iw, $ih) = explode('x',$mvDefaultSearchVideoPlaybackRes);
9696 $wgOut->addHTML('<h3>'.wfMsg('mv_add_clip_by_name').':</h3>' .
9797 '<form id="mv_add_to_seq_form" action="">' .
98 - '<div id="mv_seq_manual_embed" style="display:none;position:relative;border:solid thin black;width:'.$iw.'px;height:'.$ih.'px;"> </div><br />'.
 98+ '<div id="mv_seq_manual_embed" style="display:none;position:relative;border:solid thin black;width:'.htmlspecialchars($iw).'px;height:'.htmlspecialchars($ih).'px;"> </div><br />'.
9999 wfMsg('mv_label_stream_name') . ': <input id="mv_add_stream_name" name="mv_add_stream_name" ' .
100100 ' size="25" maxlength="65" ' .
101101 'value="">');
@@ -150,9 +150,9 @@
151151 }
152152 function render_menu(){
153153 return
154 - '<a title="'.wfMsg('mv_sequence_page_desc').'" href="javascript:mv_seqtool_disp(\'sequence_page\')">'.wfMsg('mv_save_sequence').'</a>' .
155 - ' | ' . '<a title="'.wfMsg('mv_sequence_add_manual_desc').'" href="javascript:mv_seqtool_disp(\'add_clips_manual\')">'.wfMsg('mv_sequence_add_manual').'</a>' .
156 - ' | ' . '<a title="'.wfMsg('mv_sequence_add_search_desc').'" href="javascript:mv_seqtool_disp(\'add_clips_search\')">'.wfMsg('mv_sequence_add_search').'</a>' ;
 154+ '<a title="'.htmlspecialchars(wfMsg('mv_sequence_page_desc')).'" href="javascript:mv_seqtool_disp(\'sequence_page\')">'.wfMsg('mv_save_sequence').'</a>' .
 155+ ' | ' . '<a title="'.htmlspecialchars(wfMsg('mv_sequence_add_manual_desc')).'" href="javascript:mv_seqtool_disp(\'add_clips_manual\')">'.wfMsg('mv_sequence_add_manual').'</a>' .
 156+ ' | ' . '<a title="'.htmlspecialchars(wfMsg('mv_sequence_add_search_desc')).'" href="javascript:mv_seqtool_disp(\'add_clips_search\')">'.wfMsg('mv_sequence_add_search').'</a>' ;
157157 }
158158 }
159159 ?>
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_MetavidInterface.php
@@ -81,17 +81,17 @@
8282 $this->components['MV_Overlay']->procMVDReqSet();
8383 //add in title & tracks var:
8484 global $mvgScriptPath;
85 - $wgOut->addScript('<script type="text/javascript">/*<![CDATA[*/'."
86 - var mvTitle = '{$this->article->mvTitle->getWikiTitle()}';
87 - var mvTracks = '".$this->components['MV_Overlay']->getMVDReqString(). "';
88 - var mvgScriptPath = '".$mvgScriptPath."';
89 - /*]]>*/</script>\n");
 85+ $wgOut->addScript('<script type="text/javascript">/*<![CDATA[*/'.'
 86+ var mvTitle = \''.htmlspecialchars($this->article->mvTitle->getWikiTitle()).'\';
 87+ var mvTracks = \''.htmlspecialchars($this->components['MV_Overlay']->getMVDReqString()). '\';
 88+ var mvgScriptPath = \''.htmlspecialchars($mvgScriptPath).'\';
 89+ /*]]>*/</script>\n');
9090
9191 //also add prev next paging
9292 $this->page_header ='<h1 class="videoHeader">'.
9393 $this->article->mvTitle->getStreamNameText().' :: '.
9494 $this->components['MV_Tools']->stream_paging_links('prev') .
95 - ' <span title="'.wfMsg('mv_click_to_edit').'" id="mv_stream_time">'.$this->article->mvTitle->getTimeDesc($span_separated=true) . '</span>'.
 95+ ' <span title="'.htmlspecialchars(wfMsg('mv_click_to_edit')).'" id="mv_stream_time">'.$this->article->mvTitle->getTimeDesc($span_separated=true) . '</span>'.
9696 $this->components['MV_Tools']->stream_paging_links('next') .
9797 wfMsg('mv_of') . seconds2ntp($this->article->mvTitle->getDuration()) .
9898 '</h1>';
@@ -101,9 +101,9 @@
102102 $sTitle = Title::makeTitle(NS_SPECIAL, 'MvExportStream');
103103 $sk = $wgUser->getSkin();
104104 $this->page_header.= $sk->makeKnownLinkObj($sTitle,
105 - '<img style="width:28px;height:28px;" src="'.$mvgScriptPath . '/skins/images/Feed-icon_cmml_28x28.png">',
106 - 'feed_format=roe&stream_name='.$this->article->mvTitle->getStreamName().'&t='.$this->article->mvTitle->getTimeRequest(),
107 - '','','title="'.wfMsg('mv_export_cmml').'"');
 105+ '<img style="width:28px;height:28px;" src="'.htmlspecialchars($mvgScriptPath) . '/skins/images/Feed-icon_cmml_28x28.png">',
 106+ 'feed_format=roe&stream_name='.htmlspecialchars($this->article->mvTitle->getStreamName()).'&t='.htmlspecialchars($this->article->mvTitle->getTimeRequest()),
 107+ '','','title="'.htmlspecialchars(wfMsg('mv_export_cmml')).'"');
108108 $this->page_header.='</span>';
109109 $this->page_title = $this->article->mvTitle->getStreamNameText().' '.$this->article->mvTitle->getTimeDesc();
110110 }
@@ -135,7 +135,7 @@
136136 $wgOut->setHTMLTitle($this->page_title);
137137
138138 if($this->page_header=='')$this->page_header = '<span style="position:relative;top:-12px;font-weight:bold">' .
139 - $this->page_title . '</span>';
 139+ htmlspecialchars($this->page_title) . '</span>';
140140 $wgOut->addHTML($this->page_header);
141141
142142 //@@todo dynamic re-size page_spacer:
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_SequenceTimeline.php
@@ -9,9 +9,7 @@
1010 * @email dale@ucsc.edu
1111 * @url http://metavid.ucsc.edu
1212 */
13 - if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
14 - //make sure the parent class mv_component is included
15 -
 13+ if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
1614 class MV_SequenceTimeline extends MV_Component{
1715 function render_menu(){
1816 return wfMsg('mv_sequence_timeline');
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_Tools.php
@@ -92,7 +92,7 @@
9393 case 'search':
9494 $title = Title::newFromText($title_str, MV_NS_STREAM);
9595 //render search box
96 - $this->innerHTML = '<h3>Search Stream: '. $title_str . '</h3>';
 96+ $this->innerHTML = '<h3>Search Stream: '. htmlspecialchars($title_str) . '</h3>';
9797 $MvSearch = new MV_SpecialMediaSearch();
9898 $MvSearch->setupFilters('stream', array('stream_name'=>$title->getDBkey() ));
9999 $this->innerHTML.= $MvSearch->dynamicSearchControl();
@@ -150,7 +150,7 @@
151151 if($prev_time_end < $mvDefaultStreamViewLength)$prev_time_end =$mvDefaultStreamViewLength;
152152 $newTitle = Title::MakeTitle(MV_NS_STREAM, $mvTitle->getStreamName().'/'.seconds2ntp($prev_time_start).'/'.seconds2ntp($prev_time_end));
153153 $prev_link = $sk->makeKnownLinkObj($newTitle,
154 - '<img style="index:5" border="0" src="'.$mvgScriptPath.'/skins/images/results_previous.png">',
 154+ '<img style="index:5" border="0" src="'.htmlspecialchars($mvgScriptPath).'/skins/images/results_previous.png">',
155155 $this->getStateReq() );
156156 }
157157 }
@@ -163,7 +163,7 @@
164164 if($next_time_end > $mvTitle->getDuration())$next_time_end=$mvTitle->getDuration();
165165 $newTitle =Title::MakeTitle(MV_NS_STREAM, $mvTitle->getStreamName().'/'.seconds2ntp($next_time_start).'/'.seconds2ntp($next_time_end));
166166 $next_link= $sk->makeKnownLinkObj($newTitle,
167 - '<img style="index:5" border="0" src="'.$mvgScriptPath.'/skins/images/results_next.png">',
 167+ '<img style="index:5" border="0" src="'.htmlspecialchars($mvgScriptPath).'/skins/images/results_next.png">',
168168 $this->getStateReq() );
169169 }
170170 }
@@ -180,7 +180,8 @@
181181 $out='';
182182 $heading=wfMsg('mv_stream_tool_heading') . ':';
183183 $out.='<ul>';
184 - foreach($this->mv_valid_tools as $tool_id){
 184+ foreach($this->mv_valid_tools as $tool_id){
 185+ $tool_id = htmlspecialchars($tool_id);
185186 $out.='<li><a title="'.wfMsg('mv_tool_'.$tool_id.'_title').
186187 '" href="javascript:mv_tool_disp(\''.$tool_id.'\')">' .
187188 wfMsg('mv_tool_'.$tool_id) . '</li>'."\n";
@@ -195,18 +196,19 @@
196197 //grab the current track set:
197198 $this->procMVDReqSet();
198199 foreach($mvMVDTypeAllAvailable as $type_key){
 200+ $type_key = htmlspecialchars($type_key);
199201 //@@todo use something better than "title" for type_key description
200202 $checked = (in_array($type_key, $this->mvd_tracks))?' checked':'';
201203 $out.='<input type="checkbox" name="option_'.$type_key.'" id="option_'.$type_key.'" value="'.$type_key.'" '.$checked.'/> '.
202204 '<a class="mv_mang_layers" id="a_'.$type_key.'" title="'.wfMsg($type_key.'_desc').'" href="#">'.wfMsg($type_key).'</a><br />';
203205 }
204 - $out.='<input id="submit_mang_layers" type="submit" value="'.wfMsg('mv_update_layers').'">';
 206+ $out.='<input id="submit_mang_layers" type="submit" value="'.htmlspecialchars(wfMsg('mv_update_layers')).'">';
205207 return $out;
206208 }
207209 function get_nav_page($stream_title){
208210 global $mvgIP;
209211 //output sliders for stream navigation:
210 - $out = '<h3>'.wfMsg('mv_tool_navigate').' '.ucfirst($stream_title).'</h3>';
 212+ $out = '<h3>'.wfMsg('mv_tool_navigate').' '.htmlspecialchars(ucfirst($stream_title)).'</h3>';
211213 //normalize stream title:
212214 $stream_title = str_replace(' ', '_', strtolower($stream_title));
213215
@@ -221,7 +223,7 @@
222224 $out.= $MvOverlay->get_adjust_disp($titleKey, 'nav');
223225 $out.='<input type="button" id="mv_go_nav" value="Go">';
224226 //set range:
225 - $this->js_eval = "var end_time = {$duration};";
 227+ $this->js_eval = 'var end_time = \''.htmlspecialchars($duration).'\';';
226228 return $out;
227229 }
228230 function get_export_page($stream_title){
@@ -247,7 +249,7 @@
248250 $width+=2;
249251 $height+=30;
250252 $top = $height+30+12;
251 - return "style=\"top:{$top}px;width:{$width}px;\"";
 253+ return 'style="top:'.htmlspecialchars($top).'px;width:'.htmlspecialchars($width).'px;"';
252254 }
253255 }
254256 }
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php
@@ -67,8 +67,8 @@
6868 $base_title = $this->mv_interface->article->mvTitle->getStreamName();
6969 }
7070 //'<a title="'.wfMsg('mv_search_stream_title').'" href="javascript:mv_tool_disp(\'search\')">'.wfMsg('mv_search_stream').'</a>'
71 - return '<a title="'.wfMsg('mv_mang_layers_title').'" href="javascript:mv_tool_disp(\'mang_layers\')">'.wfMsg('mv_mang_layers').'</a>' .
72 - ' | ' . '<a title="'.wfMsg('mv_new_ht_en').'" href="javascript:mv_disp_add_mvd(\'ht_en\')">'.wfMsg('mv_new_ht_en').'</a>' .
 71+ return '<a title="'.htmlspecialchars(wfMsg('mv_mang_layers_title')).'" href="javascript:mv_tool_disp(\'mang_layers\')">'.wfMsg('mv_mang_layers').'</a>' .
 72+ ' | ' . '<a title="'.htmlspecialchars(wfMsg('mv_new_ht_en')).'" href="javascript:mv_disp_add_mvd(\'ht_en\')">'.wfMsg('mv_new_ht_en').'</a>' .
7373 ' | ' . '<a href="javascript:mv_disp_add_mvd(\'anno_en\')">'.wfMsg('mv_new_anno_en').'</a>';
7474 }
7575 /* output caption div links */
@@ -122,7 +122,7 @@
123123
124124 $out='';
125125 if(count($this->mvd_pages)==0){
126 - $out= 'no mvd rows found';
 126+ $out= 'no mvd rows found';
127127 }else{
128128 foreach($this->mvd_pages as $mvd_id => $mvd_page){
129129 $this->get_fd_mvd_page($mvd_page);
@@ -140,8 +140,9 @@
141141 $img_url = MV_StreamImage::getStreamImageURL($mvd_page->stream_id, $mvd_page->start_time, 'medium', true);
142142 }
143143 //style=\"background:#".$this->getMvdBgColor($mvd_page)."\" "
144 - $wgOut->addHTML("<fieldset class=\"mv_fd_mvd\" id=\"mv_fd_mvd_{$mvd_page->id}\" name=\"{$mvd_page->wiki_title}\" " .
145 - "image_url=\"{$img_url}\" >" );
 144+ $wgOut->addHTML('<fieldset class="mv_fd_mvd" id="mv_fd_mvd_'.htmlspecialchars($mvd_page->id).'" '.
 145+ 'name="'.htmlspecialchars($mvd_page->wiki_title).'" ' .
 146+ 'image_url="'.htmlspecialchars($img_url).'" >' );
146147
147148 /*$wgOut->addHTML("<legend id=\"mv_ld_{$mvd_page->id}\">" .
148149 $this->get_mvd_menu($mvd_page) .
@@ -291,10 +292,11 @@
292293 if(is_object($mvdTile))$template_key = $mvdTile->getMvdTypeKey();
293294 //$wgOut->addHTML('looking at: ' . strtolower($template_key));
294295
295 - //slow... don't use templates.. just hard code here:
 296+
296297 $img_float ='';
297298 switch(strtolower($template_key)){
298299 case 'ht_en':
 300+ //slow... don't use templates.. just hard code here:
299301 /*$smwStore =& smwfGetStore();
300302 $title = $mvdTile->getMwTitle();
301303 //print "Title: ".$title->getDBKey() . "\n";
@@ -305,8 +307,6 @@
306308 $pimg = mv_get_person_img($smwProps['Spoken_By'].'.jpg');
307309 $img_float='<img src="'.$pimg.'">';
308310 }*/
309 -
310 -
311311 global $wgParser, $wgUser, $wgContLang;
312312 $templetTitle = Title::makeTitle(NS_TEMPLATE, $template_key );
313313 if($templetTitle->exists()){
@@ -314,15 +314,21 @@
315315 $template_wiki_text = '{{'.$template_key."|\n";
316316
317317 //@@todo lookup with attributes
318 - if(isset($smw_attr['Spoken By'])){
319 - $template_wiki_text.= '|PersonName='.$smw_attr['Spoken By']."\n";
 318+ if(isset($smw_attr['spoken_by'])){
 319+ $template_wiki_text.= '|PersonName='.$smw_attr['spoken_by']."\n";
320320 }
321321 $template_wiki_text.='|BodyText='.$text."\n".
322322 '}}';
323323 $text = $template_wiki_text;
324324 }
325325 break;
326 - case 'anno_en':
 326+ case 'anno_en':
 327+ $text='';
 328+ //format anno_en:
 329+ $smw_attr = $this->get_and_strip_semantic_tags($text);
 330+ if(isset($smw_attr['speech_by'])){
 331+ $text.=wfMsg('mv_speech_by').$smw_attr['speech_by'];
 332+ }
327333 break;
328334 default:
329335 break;
@@ -394,7 +400,7 @@
395401 $out='';
396402 //set up links:
397403 $plink = '';
398 - $elink = '<a title="'.wfMsg('mv_edit_adjust_title').'" href="javascript:mv_edit_disp(\''.$mvd_page->wiki_title.'\', \''.$mvd_page->id.'\')">'.wfMsg('mv_edit').'</a>';
 404+ $elink = '<a title="'.htmlspecialchars(wfMsg('mv_edit_adjust_title')).'" href="javascript:mv_edit_disp(\''.htmlspecialchars($mvd_page->wiki_title).'\', \''.htmlspecialchars($mvd_page->id).'\')">'.wfMsg('mv_edit').'</a>';
399405 //$alink = '<a title="'.wfMsg('mv_adjust_title').'" href="javascript:mv_adjust_disp(\''.$mvd_page->wiki_title.'\', \''.$mvd_page->id.'\')">'.wfMsg('mv_adjust').'</a>';
400406
401407 //print "wiki title: " . $mvd_page->wiki_title;
@@ -405,17 +411,17 @@
406412 $dlink = $sk->makeKnownLinkObj($dTitle, wfMsg('talk') );
407413
408414 //{s:\''.seconds2ntp($mvd_page->start_time).'\',e:\''.seconds2ntp($mvd_page->end_time).'\'}
409 - $plink='<a title="'.wfMsg('mv_play').' '.seconds2ntp($mvd_page->start_time) . ' to ' . seconds2ntp($mvd_page->end_time).' " ' .
 415+ $plink='<a title="'.htmlspecialchars(wfMsg('mv_play').' '.seconds2ntp($mvd_page->start_time) . ' to ' . seconds2ntp($mvd_page->end_time)).' " ' .
410416 'style="text-decoration:none;" ' .
411 - 'href="javascript:mv_do_play('.$mvd_page->id.');">' .
412 - '<span style="width:44px"><img src="'.$mvgScriptPath.'/skins/images/control_play_blue.png"></span>'.
413 - seconds2ntp($mvd_page->start_time) . ' to ' . seconds2ntp($mvd_page->end_time).'</a>';
 417+ 'href="javascript:mv_do_play('.htmlspecialchars($mvd_page->id).');">' .
 418+ '<span style="width:44px"><img src="'.htmlspecialchars($mvgScriptPath).'/skins/images/control_play_blue.png"></span>'.
 419+ htmlspecialchars(seconds2ntp($mvd_page->start_time) . ' to ' . seconds2ntp($mvd_page->end_time)).'</a>';
414420
415421 //@@TODO set up conditional display: (view source if not logged on, protect, remove if given permission)
416422 $out.=$plink;
417423 $out.="- $elink - $hlink - $dlink ";
418424 if($wgUser->isAllowed('mv_delete_mvd')){
419 - $rlink = '<a title="'.wfMsg('mv_remove_title').'" href="javascript:mv_disp_remove_mvd(\''.$mvd_page->wiki_title.'\', \''.$mvd_page->id.'\')">'.wfMsg('mv_remove').'</a>';
 425+ $rlink = '<a title="'.htmlspecialchars(wfMsg('mv_remove_title')).'" href="javascript:mv_disp_remove_mvd(\''.htmlspecialchars($mvd_page->wiki_title).'\', \''.htmlspecialchars($mvd_page->id).'\')">'.wfMsg('mv_remove').'</a>';
420426 $out.=' - ' . $rlink;
421427 }
422428 return $out;
@@ -446,7 +452,11 @@
447453 $semanticLinkPattern = '(\[\[(([^:][^]]*):[=|:])+((?:[^|\[\]]|\[\[[^]]*\]\]|\[[^]]*\])*)(\|([^]]*))?\]\])';
448454 $mv_smw_tag_arry = array();
449455 $text = preg_replace_callback($semanticLinkPattern, 'mvParsePropertiesCallback',$text);
450 - return $mv_smw_tag_arry;
 456+ $ret_ary = array();
 457+ foreach($mv_smw_tag_arry as $k=>$v){
 458+ $ret_ary[strtolower(str_replace(' ','_',$k))]=$v;
 459+ }
 460+ return $ret_ary;
451461 }
452462 /*
453463 * @@todo in the future dataHelpers could accommodate more.. (but lets avoid recreating the halo semantic mediaWiki extension).).
@@ -462,11 +472,11 @@
463473 $metaData=array('prop'=>array(), 'categories'=>array());
464474 //just get msg and basic div layout: \
465475 //css layout of forms was F*@#!!! withing me for some reason so yay table :P
466 - $o.='<span class="mv_basic_edit"><a href="#" onClick="mv_mvd_advs_toggle('.$mvd_id.');return false;">'.wfMsg('mv_advanced_edit').'</a></span>
467 - <span style="display:none" class="mv_advanced_edit"><a href="#" onClick="mv_mvd_advs_toggle('.$mvd_id.');return false;">'.wfMsg('mv_basic_edit').'</a></span>';
 476+ $o.='<span class="mv_basic_edit"><a href="#" onClick="mv_mvd_advs_toggle('.htmlspecialchars($mvd_id).');return false;">'.wfMsg('mv_advanced_edit').'</a></span>
 477+ <span style="display:none" class="mv_advanced_edit"><a href="#" onClick="mv_mvd_advs_toggle('.htmlspecialchars($mvd_id).');return false;">'.wfMsg('mv_basic_edit').'</a></span>';
468478
469 - $o.='<input type="hidden" id="adv_basic_'.$mvd_id.'" name="adv_basic" value="basic">';
470 - $o.='<table class="mv_basic_edit mv_dataHelpers" id="mv_dataHelpers_'.$mvd_id.'">';
 479+ $o.='<input type="hidden" id="adv_basic_'.htmlspecialchars($mvd_id).'" name="adv_basic" value="basic">';
 480+ $o.='<table class="mv_basic_edit mv_dataHelpers" id="mv_dataHelpers_'.htmlspecialchars($mvd_id).'">';
471481 if(isset($mvMetaDataHelpers[strtolower($mvd_type)])){
472482 //get existing metadata
473483 if($mvd_id!='new' && $mvd_id!='seq'){
@@ -489,29 +499,32 @@
490500 $swmTitle = Title::newFromText((string)$prop, SMW_NS_PROPERTY);
491501 $smwImageHTML='';
492502 if($swmTitle->exists()){
493 - $help_img =$sk->makeKnownLinkObj($swmTitle, '<img src="'.$mvgScriptPath.'/skins/images/help_icon.png">');
 503+ $help_img =$sk->makeKnownLinkObj($swmTitle, '<img src="'.htmlspecialchars($mvgScriptPath).'/skins/images/help_icon.png">');
494504 //special case for person image: (would be good to generalize but kind of complicated)
495505 if($swmTitle->getText()=='Speech_by'){
496506 $img = mv_get_person_img($val);
497 - $smwImageHTML="<img id=\"smw_{$prop}_img\" style=\"display: block;margin-left: auto;margin-right: auto;\" src=\"{$img->getURL()}\" width=\"44\">";
 507+ $smwImageHTML='<img id="smw_'.htmlspecialchars($prop).'_img" style="display: block;margin-left: auto;margin-right: auto;" src="'.htmlspecialchars($img->getURL()).'" width=\"44\">';
498508 }
499509
500 - $o.= "<tr><td><label>".$swmTitle->getText().$help_img.":</label></td><td>{$smwImageHTML}<input class=\"mv_anno_ac_{$mvd_id}\" size=\"40\" name=\"smw_{$prop}\" type=\"text\" value=\"$val\">
501 - <div class=\"autocomplete\" id=\"smw_{$prop}_choices_{$mvd_id}\" style=\"display: none;\"/>
502 - </td></tr>";
 510+ $o.= "<tr><td><label>".htmlspecialchars($swmTitle->getText()).$help_img.
 511+ ':</label></td><td>'.$smwImageHTML.'<input class="mv_anno_ac_'.htmlspecialchars($mvd_id).'" '.
 512+ 'size="40" name="smw_'.htmlspecialchars($prop).'" type="text" value="'.htmlspecialchars($val).'"> '.
 513+ '<div class="autocomplete" id="smw_'.htmlspecialchars($prop).'_choices_'.htmlspecialchars($mvd_id).'" style="display: none;"/>
 514+ </td></tr>';
503515 }else{
504516 print '<span class="error">Error:</span>'.$sk->makeKnownLinkObj($swmTitle, $swmTitle->getText()) . ' does not exist<br>' ;
505517 }
506518 }
507 -
 519+ $mvgScriptPath = htmlspecialchars($mvgScriptPath);
 520+ $mvd_id = htmlspecialchars($mvd_id);
508521 if($mvMetaCategoryHelper){
509522 //list each category with a little - next to it that removes its respective hidden field.
510523 $i=0;
511524 $o.='<tr><td>'.wfMsg('mv_existing_categories').'</td><td>';
512 - $o.='<div id="mv_ext_cat_container_'.$mvd_id.'"></div>';
 525+ $o.='<div id="mv_ext_cat_container_'.htmlspecialchars($mvd_id).'"></div>';
513526 foreach($metaData['categories'] as $cat=>$page){
514527 $catTitle = Title::newFromText($cat, NS_CATEGORY);
515 - $o.='<span id="ext_cat_'.$i.'"><input value="'. $catTitle->getDBKey().'" type="hidden" style="display:none;" name="ext_cat[]" class="mv_ext_cat">'.
 528+ $o.='<span id="ext_cat_'.htmlspecialchars($i).'"><input value="'. $catTitle->getDBKey().'" type="hidden" style="display:none;" name="ext_cat_'.$i.'" class="mv_ext_cat">'.
516529 $catTitle->getText().
517530 '<a href="#" onclick="$j(\'#ext_cat_'.$i.'\').fadeOut(\'fast\').remove();return false;">
518531 <img border="0" src="'.$mvgScriptPath.'/skins/images/delete.png">
@@ -519,18 +532,17 @@
520533 </span><br>';
521534 $i++;
522535 }
523 - $o.='</tr>';
 536+ $o.='</tr>';
524537 $o.= "<tr><td><label for=\"category\">".wfMsg('mv_add_category').":</label></td><td><input id=\"mv_add_cat_ext_{$mvd_id}\" maxlength=\"255\" size=\"20\" class=\"mv_anno_ac_{$mvd_id}\" name=\"category\" type=\"text\">
525 - <img onClick=\"mv_add_category('{$mvd_id}', \$j('#mv_add_cat_ext_{$mvd_id}').val())\" border=\"0\" src=\"{$mvgScriptPath}/skins/images/add.png\">
 538+ <img onClick=\"mv_add_category('{$mvd_id}', \$j('#mv_add_cat_ext_{$mvd_id}').val());\$j('#mv_add_cat_ext_{$mvd_id}').val('');\" border=\"0\" src=\"{$mvgScriptPath}/skins/images/add.png\">
526539 <div class=\"autocomplete\" id=\"category_choices_{$mvd_id}\" style=\"display: none;\"/></td></tr>";
527540 }
528541 //output a short desc field (the text with striped semantic values)...
529542 $o.='<tr><td>'.wfMsg("mv_basic_text_desc").'</td></td><textarea name="basic_wpTextbox" rows="2" cols="40">';
530 - if(isset($metaData['striped_text']))$o.=$metaData['striped_text'];
531 - $o.='</textarea></td></tr>';
532 -
 543+ if(isset($metaData['striped_text']))
 544+ $o.=htmlspecialchars($metaData['striped_text']);
 545+ $o.='</textarea></td></tr>';
533546 }
534 - //foreach($mvMetaDataHelpers[
535547 $o.='</table>';
536548 return $o;
537549 }
@@ -554,7 +566,9 @@
555567
556568 /*
557569 * @@todo move some of this to CSS
558 - */
 570+ */
 571+ $mvd_id = htmlspecialchars( $mvd_id );
 572+ $mvgScriptPath = htmlspecialchars( $mvgScriptPath );
559573 $out.= '
560574 <span id="mv_adjust_msg_'.$mvd_id.'"></span>
561575 <table style="background:transparent;position:relative" width="94%" border="0"><tr><td width="40">
@@ -584,11 +598,11 @@
585599 <br />';
586600
587601 $out.='<span style="float:left;"><label class="mv_css_form" for="mv_start_hr_'.$mvd_id.'"><i>'.wfMsg('mv_start_desc').':</i></label> ' .
588 - '<input class="mv_adj_hr" size="8" maxlength="8" value="'.$start_time.'" id="mv_start_hr_'.$mvd_id.'" name="mv_start_hr_'.$mvd_id.'">' .
 602+ '<input class="mv_adj_hr" size="8" maxlength="8" value="'.htmlspecialchars($start_time).'" id="mv_start_hr_'.$mvd_id.'" name="mv_start_hr_'.$mvd_id.'">' .
589603 '</span>';
590604
591605 $out.='<span style="float:left;"><label class="mv_css_form" for="mv_end_hr_'.$mvd_id.'"><i>'.wfMsg('mv_end_desc').':</i></label> ' .
592 - '<input class="mv_adj_hr" size="8" maxlength="8" value="'.$end_time.'" id="mv_end_hr_'.$mvd_id.'" name="mv_end_hr_'.$mvd_id.'">' .
 606+ '<input class="mv_adj_hr" size="8" maxlength="8" value="'.htmlspecialchars($end_time).'" id="mv_end_hr_'.$mvd_id.'" name="mv_end_hr_'.$mvd_id.'">' .
593607 '</span>';
594608
595609 //output page text (if not "new")
@@ -658,8 +672,10 @@
659673 }
660674 //add all categorizations:
661675 $catNStxt = $wgContLang->getNsText(NS_CATEGORY);
662 - foreach($_POST['ext_cat'] as $k=>$v){
663 - $wpTextbox1.="\n\n[[".$catNStxt.":".$v."]]";
 676+ foreach($_POST as $k=>$v){
 677+ if(strpos($k, 'ext_cat_')!==false){
 678+ $wpTextbox1.="\n[[".$catNStxt.":".$v."]]";
 679+ }
664680 }
665681 //add the text to the end after a line break to not confuse mannual editors
666682 $editPageAjax = new MV_EditPageAjax( $Article);
@@ -872,7 +888,7 @@
873889
874890 //add custom data helpers if editing annotative layer:
875891 if($mvd_type=='anno_en'){
876 - $customPreEditHtml.=$this->get_dataHelpers($titleKey, $mvd_id);
 892+ $editPageAjax->setBasicHtml($this->get_dataHelpers($titleKey, $mvd_id));
877893 //don't display "advanced" edit
878894 $editPageAjax->display_advanced_edit='none';
879895 }
@@ -931,7 +947,7 @@
932948 $width+=2;
933949 $height+=30;
934950 $left = $width+10+30;
935 - return "style=\"left:{$left}px;\"";
 951+ return 'style=\"left:'.htmlspecialchars($left).'px;"';
936952 }
937953 }
938954 }
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_PageHistoryAjax.php
@@ -9,7 +9,7 @@
1010 * @email dale@ucsc.edu
1111 * @url http://metavid.ucsc.edu
1212 */
13 -class MV_PageHistoryAjax extends PageHistory{
14 -
 13+ if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
 14+class MV_PageHistoryAjax extends PageHistory{
1515 }
1616 ?>
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_StreamMeta.php
@@ -9,6 +9,7 @@
1010 * @email dale@ucsc.edu
1111 * @url http://metavid.ucsc.edu
1212 */
 13+ if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
1314 class MV_StreamMeta extends MV_Component{
1415 function getHTML(){
1516 global $wgOut;
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php
@@ -8,7 +8,7 @@
99 /*
1010 * stores all the html for the video player and its associated ajax functions
1111 */
12 - if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
 12+if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
1313 class MV_VideoPlayer extends MV_Component{
1414 var $name = 'MV_VideoPlayer';
1515 function getHTML(){
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_SequencePlayer.php
@@ -34,7 +34,7 @@
3535 $wgOut->addHTML(''.
3636 '<div style="position:absolute;width:320px;height:270px;" id="mv_video_container">'.
3737 //'<div style="display:none;" id="mv_inline_pl_txt">'.$article->getSequenceText().'</div>'.
38 - '<div style="display:none;" id="mv_pl_url">'.$title_url.'</div>'.
 38+ '<div style="display:none;" id="mv_pl_url">'.htmlspecialchars($title_url).'</div>'.
3939 '</div>' ."\n");
4040 }
4141 }
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_EditPageAjax.php
@@ -20,6 +20,7 @@
2121
2222 class MV_EditPageAjax extends EditPage{
2323 var $adj_html='';
 24+ var $basic_html='';
2425
2526 function __construct( $article ) {
2627 $this->mArticle =& $article;
@@ -73,23 +74,23 @@
7475
7576 //add in adjust html if present:
7677 $wgOut->addHTML($this->adj_html);
77 -
 78+
7879 //structure layout via tables (@@todo switch to class based css layout)
7980 $wgOut->addHTML('<table style="background: transparent;" width="100%"><tr><td valign="top" width="90">');
8081 //output the person selector:
81 - if (!isset ($semantic_data['Spoken By']))$semantic_data['Spoken By'] = '';
82 - $img = mv_get_person_img($semantic_data['Spoken By']);
83 - $wgOut->addHTML("<img id=\"mv_edit_im_{$this->mvd_id}\" style=\"display: block;margin-left: auto;margin-right: auto;\" src=\"{$img->getURL()}\" width=\"44\">");
 82+ if (!isset ($semantic_data['spoken_by']))$semantic_data['spoken_by'] = '';
 83+ $img = mv_get_person_img($semantic_data['spoken_by']);
 84+ $wgOut->addHTML('<img id=\"mv_edit_im_'.htmlspecialchars($this->mvd_id).'" style="display: block;margin-left: auto;margin-right: auto;" src="'.htmlspecialchars($img->getURL()).'" width="44">');
8485 $wgOut->addHTML('<input style="font-size:x-small"
85 - value="'.$semantic_data['Spoken By'].'"
 86+ value="'.htmlspecialchars($semantic_data['spoken_by']).'"
8687 name="smw_Spoken_By"
8788 onClick="this.value=\'\';"
88 - type="text" id="auto_comp_'.$this->mvd_id.'" size="12"
 89+ type="text" id="auto_comp_'.htmlspecialchars($this->mvd_id).'" size="12"
8990 maxlength="125" autocomplete="off"/>');
9091 //only add one auto_comp_choices_ per object/request pass
9192 if(!isset($this->auto_comp_choices)){
9293 $this->auto_comp_choices = true;
93 - $wgOut->addHTML('<div id="auto_comp_choices_'.$this->mvd_id.'" class="autocomplete"></div>');
 94+ $wgOut->addHTML('<div id="auto_comp_choices_'.htmlspecialchars($this->mvd_id).'" class="autocomplete"></div>');
9495 }
9596 //add container formatting for MV_Overlay
9697 $wgOut->addHTML('</td>' .
@@ -333,7 +334,9 @@
334335 $this->showDeletionLog( $wgOut );
335336 }
336337 }
337 -
 338+ function setBasicHtml($basic_html){
 339+ $this->basic_html = $basic_html;
 340+ }
338341 function setAdjustHtml($adj_html){
339342 $this->adj_html = $adj_html;
340343 }
@@ -522,10 +525,24 @@
523526
524527 #need to parse the preview early so that we know which templates are used,
525528 #otherwise users with "show preview after edit box" will get a blank list
 529+
526530 if ( $this->formtype == 'preview' ) {
527531 $previewOutput = $this->getPreviewText();
528532 }
529533
 534+ if ( $wgUser->getOption( 'previewontop' ) ) {
 535+
 536+ if ( 'preview' == $this->formtype ) {
 537+ $this->showPreview( $previewOutput );
 538+ } else {
 539+ $wgOut->addHTML( '<div id="wikiPreview_'.htmlspecialchars($this->mvd_id).'"></div>' );
 540+ }
 541+
 542+ if ( 'diff' == $this->formtype ) {
 543+ $this->showDiff();
 544+ }
 545+ }
 546+ $wgOut->addHTML($this->basic_html);
530547 $wgOut->addHTML('<div style="display:inline" class="mv_advanced_edit"><br>');
531548
532549 //$rows = $wgUser->getIntOption( 'rows' );
@@ -595,21 +612,8 @@
596613 if( $wgUser->getOption( 'minordefault' ) ) $this->minoredit = true;
597614 }
598615
599 - $wgOut->addHTML( $this->editFormPageTop );
 616+ $wgOut->addHTML( $this->editFormPageTop );
600617
601 - if ( $wgUser->getOption( 'previewontop' ) ) {
602 -
603 - if ( 'preview' == $this->formtype ) {
604 - $this->showPreview( $previewOutput );
605 - } else {
606 - $wgOut->addHTML( '<div id="wikiPreview_'.$this->mvd_id.'"></div>' );
607 - }
608 -
609 - if ( 'diff' == $this->formtype ) {
610 - $this->showDiff();
611 - }
612 - }
613 -
614618 $wgOut->addHTML( $this->editFormTextTop );
615619
616620 # if this is a comment, show a subject line at the top, which is also the edit summary.
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_AutoCompleteCache.php
@@ -9,7 +9,6 @@
1010 * @email dale@ucsc.edu
1111 * @url http://metavid.ucsc.edu
1212 */
13 - //@@todo populate this stub (use to store auto-complete stuff for a bit)
1413 class MV_AutoCompleteCache{
1514 }
1615 ?>
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_GlobalFunctions.php
@@ -21,39 +21,9 @@
2222 if ( !function_exists( 'extAddSpecialPage' ) ) {
2323 require_once( dirname(__FILE__) . '/../ExtensionFunctions.php' );
2424 }
25 -
 25+//add language:
2626 $wgExtensionMessagesFiles['MetavidWiki'] =$mvgIP . '/languages/MV_Messages.php';
2727 require_once($mvgIP . '/languages/MV_Language.php');
28 -
29 -
30 -//setup autoload classes:
31 -$wgAutoloadClasses['MV_Overlay'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_Overlay.php';
32 -$wgAutoloadClasses['MV_Component'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_Component.php';
33 -
34 -$wgAutoloadClasses['MV_MetavidInterface']= dirname(__FILE__) .'/MV_MetavidInterface/MV_MetavidInterface.php';
35 -$wgAutoloadClasses['MV_SequencePlayer']= dirname(__FILE__) .'/MV_MetavidInterface/MV_SequencePlayer.php';
36 -$wgAutoloadClasses['MV_SequenceTools']= dirname(__FILE__) .'/MV_MetavidInterface/MV_SequenceTools.php';
37 -$wgAutoloadClasses['MV_SequenceTimeline']= dirname(__FILE__) .'/MV_MetavidInterface/MV_SequenceTimeline.php';
38 -$wgAutoloadClasses['MV_VideoPlayer']= dirname(__FILE__) .'/MV_MetavidInterface/MV_VideoPlayer.php';
39 -$wgAutoloadClasses['MV_Tools']= dirname(__FILE__) .'/MV_MetavidInterface/MV_Tools.php';
40 -$wgAutoloadClasses['MV_EditPageAjax'] = dirname(__FILE__) .'/MV_MetavidInterface/MV_EditPageAjax.php';
41 -
42 -$wgAutoloadClasses['MV_CategoryPage']= dirname(__FILE__) .'/articlepages/MV_CategoryPage.php';
43 -$wgAutoloadClasses['MV_SequencePage'] = dirname(__FILE__) .'/articlepages/MV_SequencePage.php';
44 -$wgAutoloadClasses['MV_StreamPage'] = dirname(__FILE__) .'/articlepages/MV_StreamPage.php';
45 -$wgAutoloadClasses['MV_EditDataPage'] = $wgAutoloadClasses['MV_DataPage'] = dirname(__FILE__) . '/articlepages/MV_DataPage.php';
46 -$wgAutoloadClasses['MV_EditStreamPage']=dirname(__FILE__) .'/MV_EditStreamPage.php';
47 -
48 -
49 -$wgAutoloadClasses['MV_Title'] = dirname(__FILE__) . '/MV_Title.php';
50 -$wgAutoloadClasses['MV_Index'] = dirname(__FILE__) . '/MV_Index.php';
51 -$wgAutoloadClasses['MV_ImageGallery']=dirname(__FILE__) . '/MV_ImageGallery.php';
52 -$wgAutoloadClasses['MV_Image'] = dirname(__FILE__) . '/MV_Image.php';
53 -$wgAutoloadClasses['MV_Stream'] = dirname(__FILE__) .'/MV_Stream.php';
54 -$wgAutoloadClasses['MV_StreamFile']=dirname(__FILE__) . '/MV_StreamFile.php';
55 -$wgAutoloadClasses['MV_StreamImage'] = dirname(__FILE__) . '/MV_StreamImage.php';
56 -$wgAutoloadClasses['MV_ParserCache'] = dirname(__FILE__) . '/MV_ParserCache.php';
57 -$wgAutoloadClasses['MV_MagicWords'] = dirname(__FILE__) . '/MV_MagicWords.php';
5828
5929 $markerList = array();
6030
@@ -70,32 +40,121 @@
7141 $smwgNamespacesWithSemanticLinks[MV_NS_SEQUENCE] = true;
7242 $smwgNamespacesWithSemanticLinks[MV_NS_SEQUENCE_TALK] = false;
7343 $smwgNamespacesWithSemanticLinks[MV_NS_MVD] = true;
74 - $smwgNamespacesWithSemanticLinks[MV_NS_MVD_TALK] = false;
 44+ $smwgNamespacesWithSemanticLinks[MV_NS_MVD_TALK] = false;
 45+
7546 return true;
7647 }
7748 function mvSetupExtension(){
7849 global $mvVersion, $mvNamespace, $mvgIP, $wgHooks, $wgExtensionCredits, $mvMasterStore,
7950 $wgParser, $mvArticlePath, $mvgScriptPath, $wgServer, $wgExtensionFunctions,$markerList,
80 - $mvEnableAutoComplete, $mvEnableJSLinkBack, $mvEnableJSMVDrewrite;
 51+ $mvEnableAutoComplete, $mvEnableJSLinkBack, $mvEnableJSMVDrewrite, $wgAutoloadClasses, $wgSpecialPages;
8152
8253
8354 mvfInitMessages();
8455 //add header for autoComplete if enabled:
8556 if($mvEnableAutoComplete || $mvEnableJSLinkBack || $mvEnableJSMVDrewrite ){
8657 mvfAutoAllPageHeader();
87 - }
 58+ }
8859
 60+ /********************************
 61+ * Ajax Hooks
 62+ *********************************/
 63+ $wgAjaxExportList[] = 'mv_auto_complete_all';
 64+ $wgAjaxExportList[] = 'mv_auto_complete_person';
 65+ $wgAjaxExportList[] = 'mv_auto_complete_stream_name';
 66+ $wgAjaxExportList[] = 'mv_helpers_auto_complete';
 67+
 68+ $wgAjaxExportList[] = 'mv_disp_mvd';
 69+
 70+ $wgAjaxExportList[] = 'mv_add_disp';
 71+ $wgAjaxExportList[] = 'mv_remove_mvd';
 72+ $wgAjaxExportList[] = 'mv_disp_remove_mvd';
 73+
 74+ $wgAjaxExportList[] = 'mv_edit_disp';
 75+ $wgAjaxExportList[] = 'mv_edit_preview';
 76+ $wgAjaxExportList[] = 'mv_edit_submit';
 77+ $wgAjaxExportList[] = 'mv_edit_sequence_submit';
 78+ $wgAjaxExportList[] = 'mv_seqtool_disp';
 79+
 80+ $wgAjaxExportList[] = 'mv_history_disp';
 81+ $wgAjaxExportList[] = 'mv_adjust_disp';
 82+ $wgAjaxExportList[] = 'mv_adjust_submit';
 83+
 84+ //search interface exported functions:
 85+ $wgAjaxExportList[] = 'mv_expand_wt';
 86+ $wgAjaxExportList[] = 'mv_pl_wt';
 87+ $wgAjaxExportList[] = 'mv_submit_remove';
 88+ $wgAjaxExportList[] = 'mv_tool_disp';
 89+ $wgAjaxExportList[] = 'mv_date_obj';
 90+
 91+ //media serving
 92+ $wgAjaxExportList[] = 'mv_frame_server';
 93+
8994 /**********************************************/
 95+ /***** register autoLoad Classes: *****/
 96+ /**********************************************/
 97+ //setup autoload classes:
 98+ $wgAutoloadClasses['MV_Overlay'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_Overlay.php';
 99+ $wgAutoloadClasses['MV_Component'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_Component.php';
 100+
 101+ $wgAutoloadClasses['MV_MetavidInterface'] = dirname(__FILE__) .'/MV_MetavidInterface/MV_MetavidInterface.php';
 102+ $wgAutoloadClasses['MV_SequencePlayer'] = dirname(__FILE__) .'/MV_MetavidInterface/MV_SequencePlayer.php';
 103+ $wgAutoloadClasses['MV_SequenceTools'] = dirname(__FILE__) .'/MV_MetavidInterface/MV_SequenceTools.php';
 104+ $wgAutoloadClasses['MV_SequenceTimeline'] = dirname(__FILE__) .'/MV_MetavidInterface/MV_SequenceTimeline.php';
 105+ $wgAutoloadClasses['MV_VideoPlayer'] = dirname(__FILE__) .'/MV_MetavidInterface/MV_VideoPlayer.php';
 106+ $wgAutoloadClasses['MV_Tools'] = dirname(__FILE__) .'/MV_MetavidInterface/MV_Tools.php';
 107+ $wgAutoloadClasses['MV_EditPageAjax'] = dirname(__FILE__) .'/MV_MetavidInterface/MV_EditPageAjax.php';
 108+
 109+ $wgAutoloadClasses['MV_CategoryPage'] = dirname(__FILE__) .'/articlepages/MV_CategoryPage.php';
 110+ $wgAutoloadClasses['MV_SequencePage'] = dirname(__FILE__) .'/articlepages/MV_SequencePage.php';
 111+ $wgAutoloadClasses['MV_StreamPage'] = dirname(__FILE__) .'/articlepages/MV_StreamPage.php';
 112+ $wgAutoloadClasses['MV_EditDataPage'] = $wgAutoloadClasses['MV_DataPage'] = dirname(__FILE__) . '/articlepages/MV_DataPage.php';
 113+ $wgAutoloadClasses['MV_EditStreamPage'] = dirname(__FILE__) .'/MV_EditStreamPage.php';
 114+
 115+
 116+ $wgAutoloadClasses['MV_Title'] = dirname(__FILE__) . '/MV_Title.php';
 117+ $wgAutoloadClasses['MV_Index'] = dirname(__FILE__) . '/MV_Index.php';
 118+ $wgAutoloadClasses['MV_ImageGallery'] = dirname(__FILE__) . '/MV_ImageGallery.php';
 119+ $wgAutoloadClasses['MV_Image'] = dirname(__FILE__) . '/MV_Image.php';
 120+ $wgAutoloadClasses['MV_Stream'] = dirname(__FILE__) .'/MV_Stream.php';
 121+ $wgAutoloadClasses['MV_StreamFile'] = dirname(__FILE__) . '/MV_StreamFile.php';
 122+ $wgAutoloadClasses['MV_StreamImage'] = dirname(__FILE__) . '/MV_StreamImage.php';
 123+ $wgAutoloadClasses['MV_ParserCache'] = dirname(__FILE__) . '/MV_ParserCache.php';
 124+ $wgAutoloadClasses['MV_MagicWords'] = dirname(__FILE__) . '/MV_MagicWords.php';
 125+
 126+ /**********************************************/
90127 /***** register special pages hooks *****/
91128 /**********************************************/
92 - //@@todo shift over to extAddSpecial page (to avoid loading every time)
93 - require_once( dirname(__FILE__) . '/specials/MV_SpecialCRUDStream.php');
94 - require_once( dirname(__FILE__) . '/specials/MV_SpecialListStreams.php');
95 - require_once( dirname(__FILE__) . '/specials/MV_SpecialExport.php');
 129+ $wgAutoloadClasses['MV_SpecialCRUDStream'] = dirname(__FILE__) . '/specials/MV_SpecialCRUDStream.php';
 130+ $wgSpecialPages['Mv_Add_Stream'] = array('MV_SpecialCRUDStream');
 131+
 132+ $wgAutoloadClasses['MV_SpecialListStreams'] = dirname(__FILE__) . '/specials/MV_SpecialListStreams.php';
 133+ $wgSpecialPages['Mv_List_Streams'] = array('MV_SpecialListStreams');
 134+
 135+ /* special export views */
 136+ $wgAutoloadClasses['MV_SpecialExport'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
 137+
 138+ $wgAutoloadClasses['MvVideoFeed'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
 139+ $wgAutoloadClasses['MvExportStream'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
 140+ $wgAutoloadClasses['MvExportSequence'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
 141+ $wgAutoloadClasses['MvExportSearch'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
 142+ $wgAutoloadClasses['MvExportAsk'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
 143+
 144+ $wgSpecialPages['MvVideoFeed'] = array('MvVideoFeed');
 145+ $wgSpecialPages['MvExportStream'] = array('MvExportStream');
 146+ $wgSpecialPages['MvExportSequence'] = array('MvExportSequence');
 147+ $wgSpecialPages['MvExportSearch'] = array('MvExportSearch');
 148+ $wgSpecialPages['MvExportAsk'] = array('MvExportAsk');
 149+
 150+ $wgAutoloadClasses['MV_SpecialMediaSearch'] = dirname(__FILE__) . '/specials/MV_SpecialMediaSearch.php';
 151+ $wgSpecialPages['Mv_List_Streams'] = array('MV_SpecialListStreams');
 152+
 153+ //require_once( dirname(__FILE__) . '/specials/MV_SpecialCRUDStream.php');
 154+ //require_once( dirname(__FILE__) . '/specials/MV_SpecialListStreams.php');
 155+ //require_once( dirname(__FILE__) . '/specials/MV_SpecialExport.php');
96156 require_once( dirname(__FILE__) . '/specials/MV_SpecialMediaSearch.php');
97157 require_once( dirname(__FILE__) . '/specials/MV_SpecialMVAdmin.php');
98 -
99 -
 158+
100159 /**********************************************/
101160 /***** register hooks *****/
102161 /**********************************************/
@@ -148,20 +207,6 @@
149208 $mvMagicWords = new MV_MagicWords($arg_list);
150209 return array($mvMagicWords->renderMagic(), 'noparse'=>true, 'isHTML'=>true);
151210 }
152 -/*function mvMagicParserFunction_Magic( &$magicWords, $langCode ) {
153 - # Add the magic word
154 - # The first array element is case sensitive, in this case it is not case sensitive
155 - # All remaining elements are synonyms for our parser function
156 - $magicWords['example'] = array( 0, 'example' );
157 - # unless we return true, other parser functions extensions won't get loaded.
158 - return true;
159 -}
160 -
161 -function mvMagicParserFunction_Render( &$parser, $param1 = '', $param2 = '' ) {
162 - $arg_list = func_get_args();
163 - $mvMagic = new MV_MagicWords($arg_list);
164 - return $mvMagic->renderMagic();
165 -}*/
166211
167212 /**********************************************/
168213 /***** Header modifications *****/
@@ -170,24 +215,26 @@
171216 * header script to be added to all pages:
172217 * enables linkback and autocomplete for search
173218 */
174 - function mvfAutoAllPageHeader(){
175 - global $mvgScriptPath, $wgJsMimeType, $wgOut;
176 - /* (moved to on_dom ready) but here as well*/
177 - $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/jquery-1.2.1.js\"></script>");
178 - $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.autocomplete.js\"></script>");
179 - $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.hoverIntent.js\"></script>");
180 -
181 - $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/mv_embed.js\"></script>");
182 - $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_allpages.js\"></script>");
183 -
184 - $mvCssUrl = $mvgScriptPath . '/skins/mv_custom.css';
185 - $wgOut->addLink(array(
186 - 'rel' => 'stylesheet',
187 - 'type' => 'text/css',
188 - 'media' => 'all',
189 - 'href' => $mvCssUrl
190 - ));
191 - }
 219+function mvfAutoAllPageHeader(){
 220+ global $mvgScriptPath, $wgJsMimeType, $wgOut;
 221+ $mvgScriptPath = htmlspecialchars( $mvgScriptPath );
 222+ $wgJsMimeType = htmlspecialchars( $wgJsMimeType) ;
 223+ /* (moved to on_dom ready) but here as well*/
 224+ $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/jquery-1.2.1.js\"></script>");
 225+ $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.autocomplete.js\"></script>");
 226+ $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.hoverIntent.js\"></script>");
 227+
 228+ $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/mv_embed.js\"></script>");
 229+ $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_allpages.js\"></script>");
 230+
 231+ $mvCssUrl = $mvgScriptPath . '/skins/mv_custom.css';
 232+ $wgOut->addLink(array(
 233+ 'rel' => 'stylesheet',
 234+ 'type' => 'text/css',
 235+ 'media' => 'all',
 236+ 'href' => $mvCssUrl
 237+ ));
 238+}
192239 /**
193240 * This method is in charge of inserting additional CSS, JScript, and meta tags
194241 * into the html header of each page. It is called by pages
@@ -376,40 +423,8 @@
377424 $wgMessageCache->addMessages($messages[$key], $key);
378425 }
379426 }
380 -/*
381 - * Ajax Hooks
382 - */
383 -$wgAjaxExportList[] = 'mv_auto_complete_all';
384 -$wgAjaxExportList[] = 'mv_auto_complete_person';
385 -$wgAjaxExportList[] = 'mv_auto_complete_stream_name';
386 -$wgAjaxExportList[] = 'mv_helpers_auto_complete';
387427
388 -$wgAjaxExportList[] = 'mv_disp_mvd';
389428
390 -$wgAjaxExportList[] = 'mv_add_disp';
391 -$wgAjaxExportList[] = 'mv_remove_mvd';
392 -$wgAjaxExportList[] = 'mv_disp_remove_mvd';
393 -
394 -$wgAjaxExportList[] = 'mv_edit_disp';
395 -$wgAjaxExportList[] = 'mv_edit_preview';
396 -$wgAjaxExportList[] = 'mv_edit_submit';
397 -$wgAjaxExportList[] = 'mv_edit_sequence_submit';
398 -$wgAjaxExportList[] = 'mv_seqtool_disp';
399 -
400 -$wgAjaxExportList[] = 'mv_history_disp';
401 -$wgAjaxExportList[] = 'mv_adjust_disp';
402 -$wgAjaxExportList[] = 'mv_adjust_submit';
403 -
404 -//search interface exported functions:
405 -$wgAjaxExportList[] = 'mv_expand_wt';
406 -$wgAjaxExportList[] = 'mv_pl_wt';
407 -$wgAjaxExportList[] = 'mv_submit_remove';
408 -$wgAjaxExportList[] = 'mv_tool_disp';
409 -$wgAjaxExportList[] = 'mv_date_obj';
410 -
411 -//media serving
412 -$wgAjaxExportList[] = 'mv_frame_server';
413 -
414429 /*
415430 * Utility functions:
416431 */
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_EditStreamPage.php
@@ -38,20 +38,23 @@
3939 }
4040 /*put thrown together quickly... could clean up/simplify*/
4141 function displayEditStreamFiles(){
42 - global $wgOut, $wgTitle,$wgScriptPath,$wgRequest;
 42+ global $wgOut, $wgTitle,$wgScriptPath,$wgRequest, $wgUser;
4343 $html='';
4444
4545 $streamFiles = $this->mArticle->mvTitle->mvStream->getFileList();
4646 //proccess the requested changes
4747 $this->proccessReq($streamFiles);
48 - if($this->status_error!='')$html.='<span class="error">'.$this->status_error.'</span><br />';
 48+ if($this->status_error!='')$html.='<span class="error">'.htmlspecialchars($this->status_error).'</span><br />';
4949 if($this->status_ok!='')$html.=$this->status_ok . '<br />';
5050
5151 if(count($streamFiles)==0){
5252 $html.='<b>'.wfMsg('mv_no_stream_files').'</b>';
5353 }else{
54 - $html.='<form action="'.$wgRequest->getRequestURL().'" method="POST">';
 54+ $html.='<form action="'.htmlspecialchars($wgRequest->getRequestURL()).'" method="POST">';
5555 $html.='<input type="hidden" name="mv_action" value="edit_stream_files">';
 56+
 57+ $html.='<input type="hidden" name="wpEditToken" value="'.htmlspecialchars($wgUser->editToken()).'"';
 58+
5659 $html.= '<fieldset><legend>'.wfMsg('mv_file_list').'</legend>' . "\n";
5760 $html.= '<table width="600" border="0">';
5861 $html.='</tr><tr>';
@@ -62,19 +65,19 @@
6366 $outHeader=false;
6467 }
6568 $html.='<tr><td colspan=4>';
66 - $html.='<input type="submit" value="'.wfMsg('mv_save_changes').'">';
 69+ $html.='<input type="submit" value="'. htmlspecialchars(wfMsg('mv_save_changes')).'">';
6770 $html.='</td></tr>';
6871 $html .='</table></fieldset>';
6972 $html.='</form>';
7073 }
7174 //add new stream:
72 - $html.='<form action="'.$wgRequest->getRequestURL().'" method="POST">';
 75+ $html.='<form action="'.htmlspecialchars($wgRequest->getRequestURL()).'" method="POST">';
7376 $html.='<input type="hidden" name="mv_action" value="new_stream_file">';
7477 $html.= '<fieldset><legend>'.wfMsg('mv_add_stream_file').'</legend>' . "\n";
7578 $html.= '<table width="600" border="0">';
7679 $html.= $this->getStreamFileForm(array('id'=>'new'));
7780 $html.='<tr><td>';
78 - $html.='<input type="submit" value="'.wfMsg('mv_add_stream_file').'">';
 81+ $html.='<input type="submit" value="'.htmlspecialchars(wfMsg('mv_add_stream_file')).'">';
7982 $html.='</td></tr>';
8083 $html .='</table></fieldset>';
8184 $html .='</form>';
@@ -83,9 +86,14 @@
8487 }
8588 function proccessReq(& $streamFiles){
8689 global $wgRequest, $wgUser;
 90+
8791 //make sure the user can edit streams:
8892 if(!$wgUser->isAllowed('mv_edit_stream'))return ;
89 -
 93+
 94+ //confirm the edit token:
 95+ if(!$wgUser->matchEditToken($wgRequest->getVal('wpEditToken')))return ;
 96+
 97+
9098 $this->mv_action = $wgRequest->getVal('mv_action');
9199 if($this->mv_action=='new_stream_file'){
92100 //@@todo a bit more input scrubbing:
@@ -148,19 +156,19 @@
149157 if($remove_link){
150158 global $wgRequest;
151159 $html.='<td><a title="'.wfMsg('mv_delete_stream_file').'"' .
152 - ' href="'.$wgRequest->getRequestURL().'&mv_action=rm_stream_file&rid='.$sf['id'].'"><img src="'.$mvgScriptPath.'/skins/images/delete.png"></a></td>';
 160+ ' href="'.$wgRequest->getRequestURL().'&mv_action=rm_stream_file&rid='.htmlspecialchars($sf['id']).'"><img src="'.htmlspecialchars($mvgScriptPath).'/skins/images/delete.png"></a></td>';
153161 }
154 - $html.='<td><input type="text" name="sf_'.$sf['id'].'[file_desc_msg]" value="'.$sf['file_desc_msg'].'" maxlength="60" size="20" /></td>';
155 - $html.='<td><input type="text" name="sf_'.$sf['id'].'[duration]" value="'.$sf['duration'].'" maxlength="11" size="7" /></td>';
156 - $html.='<td><input type="text" name="sf_'.$sf['id'].'[base_offset]" value="'.$sf['base_offset'].'" maxlength="11" size="7" /></td>';
157 - $html.='<td><select name="sf_'.$sf['id'].'[path_type]">';
 162+ $html.='<td><input type="text" name="sf_'.htmlspecialchars($sf['id']).'[file_desc_msg]" value="'.htmlspecialchars($sf['file_desc_msg']).'" maxlength="60" size="20" /></td>';
 163+ $html.='<td><input type="text" name="sf_'.htmlspecialchars($sf['id']).'[duration]" value="'.htmlspecialchars($sf['duration']).'" maxlength="11" size="7" /></td>';
 164+ $html.='<td><input type="text" name="sf_'.htmlspecialchars($sf['id']).'[base_offset]" value="'.htmlspecialchars($sf['base_offset']).'" maxlength="11" size="7" /></td>';
 165+ $html.='<td><select name="sf_'.htmlspecialchars($sf['id']).'[path_type]">';
158166 $sel=($sf['path_type']=='url_anx')?' selected':'';
159167 $html.='<option value="url_anx"'.$sel.'>'.wfMsg('mv_path_type_url_anx').'</option>' .
160168 $sel=($sf['path_type']=='wiki_title')?' selected':'';
161169 $html.='<option value="wiki_title"'.$sel.'>'.wfMsg('mv_path_type_wiki_title').'</option>' .
162170 '</select></td>';
163 - $html.='<td><input type="text" name="sf_'.$sf['id'].'[path]" value="'.$sf['path'].'" maxlength="250" size="50" />' .
164 - '<input type="hidden" name="sf_'.$sf['id'].'[stream_id]" value="'.$sf['stream_id'].'">'.
 171+ $html.='<td><input type="text" name="sf_'.htmlspecialchars($sf['id']).'[path]" value="'.htmlspecialchars($sf['path']).'" maxlength="250" size="50" />' .
 172+ '<input type="hidden" name="sf_'.htmlspecialchars($sf['id']).'[stream_id]" value="'.htmlspecialchars($sf['stream_id']).'">'.
165173 '</td>';
166174 $html.='</tr>';
167175 return $html;
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MagicWords.php
@@ -29,8 +29,12 @@
3030 if(strpos($arg,'=')===false){
3131 //get param via index order (not as reliable as param=value mode)
3232 switch($inx){
33 - case '0':$this->params['format']=$arg;break;
34 - case '1':$this->params['num_results']=$arg;break;
 33+ case '0':
 34+ $this->params['format']=$arg;
 35+ break;
 36+ case '1':
 37+ $this->params['num_results']=$arg;
 38+ break;
3539 }
3640 }else{
3741 list($arg_type, $arg_value) = split('=',$arg);
@@ -138,7 +142,6 @@
139143 $title_span,
140144 'tl=1') .
141145 '</span>';
142 -
143146 //try to get metadata from anno_en first.
144147 //@@todo maybe the following metadata grabbing could be abstracted to a single function in mv_index
145148 $mvd_result = MV_Index::getMVDInRange(
@@ -148,7 +151,7 @@
149152 $mvd_type='anno_en',
150153 $getText=true,
151154 $smw_properties=array('Speech_by', 'Bill'),
152 - $limit='LIMIT 0,1'
 155+ $limit='1'
153156 );
154157 if($dbr->numRows($mvd_result)!=0){
155158 $mvd_row = $dbr->fetchObject($mvd_result);
@@ -180,11 +183,9 @@
181184 $coma=', ';
182185 }
183186 $o.='</span>';
184 - }
185 -
 187+ }
186188 }
187 - $o.='</li>';
188 -
 189+ $o.='</li>';
189190 }
190191 $o.='</ul><div style="clear:both"></div>';
191192 }
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_ImageGallery.php
@@ -29,7 +29,7 @@
3030 $this->mAttribs );
3131 $s = Xml::openElement( 'table', $attribs );
3232 if( $this->mCaption )
33 - $s .= "\n\t<caption>{$this->mCaption}</caption>";
 33+ $s .= "\n\t<caption>".htmlspecialchars($this->mCaption)."</caption>";
3434
3535 $params = array( 'width' => $this->mWidths, 'height' => $this->mHeights );
3636 $i = 0;
@@ -61,24 +61,23 @@
6262 mvfAddHTMLHeader('embed');
6363 //print "img url: " . $mvTitle->getStreamImageURL();
6464 $thumbhtml = "\n\t\t\t".
65 - '<div class="thumb" style="padding: 4px 0; width: ' .($this->mWidths+5).'px;">'
 65+ '<div class="thumb" style="padding: 4px 0; width: ' .htmlspecialchars($this->mWidths+5).'px;">'
6666 # Auto-margin centering for block-level elements. Needed now that we have video
6767 # handlers since they may emit block-level elements as opposed to simple <img> tags.
6868 # ref http://css-discuss.incutio.com/?page=CenteringBlockElement
69 - . '<div style="margin-left: auto; margin-right: auto; width: ' .$this->mWidths.'px;">'
 69+ . '<div style="margin-left: auto; margin-right: auto; width: ' .htmlspecialchars($this->mWidths).'px;">'
7070 . $mvTitle->getEmbedVideoHtml('', $vidRes)
7171 //. '<img width="'.$this->mWidths.'" src="'.$mvTitle->getStreamImageURL() . '">'
7272 . '</div>' .
73 - '<span style="clear:both"></div>'.
 73+ '</div>'.
 74+ '<div style="clear:both;"></div>'.
7475 //@@todo clean up link
7576 '<span class="gallerytext" style="float:left">'.
7677 $sk->makeKnownLinkObj( $nt, $mvTitle->getStreamNameText().' '. $mvTitle->getTimeDesc() ) .
7778 '</span>'.
78 - '</div>';
79 -
 79+ '</div>';
8080 $nb = '';
81 - $textlink='';
82 -
 81+ $textlink='';
8382 }else{
8483
8584 if( $nt->getNamespace() != NS_IMAGE || !$img ) {
@@ -97,11 +96,11 @@
9897 $vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2;
9998
10099 $thumbhtml = "\n\t\t\t".
101 - '<div class="thumb" style="padding: ' . $vpad . 'px 0; width: ' .($this->mWidths+30).'px;">'
 100+ '<div class="thumb" style="padding: ' . htmlspecialchars($vpad) . 'px 0; width: ' .htmlspecialchars($this->mWidths+30).'px;">'
102101 # Auto-margin centering for block-level elements. Needed now that we have video
103102 # handlers since they may emit block-level elements as opposed to simple <img> tags.
104103 # ref http://css-discuss.incutio.com/?page=CenteringBlockElement
105 - . '<div style="margin-left: auto; margin-right: auto; width: ' .$this->mWidths.'px;">'
 104+ . '<div style="margin-left: auto; margin-right: auto; width: ' .htmlspecialchars($this->mWidths).'px;">'
106105 . $thumb->toHtml( array( 'desc-link' => true ) ) . '</div></div>';
107106
108107 // Call parser transform hook
@@ -140,7 +139,7 @@
141140 "\n\t\t" . '<td><div class="gallerybox" style="width: '.($this->mWidths+10).'px;">'
142141 . $thumbhtml
143142 . "\n\t\t\t" . '<div class="gallerytext">' . "\n"
144 - . $textlink . $text . $nb
 143+ . $textlink . htmlspecialchars($text) . $nb
145144 . "\n\t\t\t</div>"
146145 . "\n\t\t</div></td>";
147146 if ( $i % $this->mPerRow == $this->mPerRow - 1 ) {
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_Index.php
@@ -43,10 +43,9 @@
4444 * contained_in_range ...include only meta that are contained in the given range
4545 * start_or_end_in_range ...include only meta that start or end in the given range
4646 */
47 - function getNearCount($range_offset='', $options=array()){
 47+ /*function getNearCount($range_offset='', $options=array()){
4848 global $mvDefaultClipLength, $mvIndexTableName;
49 - if($range_offset=='')$range_offset=$mvDefaultClipLength;
50 -
 49+ if($range_offset=='')$range_offset=$mvDefaultClipLength;
5150 $dbr =& wfGetDB(DB_SLAVE);
5251 //set up the count sql query:
5352 $sql = "SELECT COUNT(1) as `count` FROM {$dbr->tableName($mvIndexTableName)} " .
@@ -83,87 +82,106 @@
8483 $row = $dbr->fetchObject( $result );
8584 //print_r($row);
8685 return $row->count;
87 - }
 86+ }*/
8887 function countMVDInRange($stream_id, $start_time=null, $end_time=null, $mvd_type='all'){
89 - global $mvIndexTableName, $mvDefaultClipLength;
 88+ global $mvDefaultClipLength;
9089 $dbr =& wfGetDB(DB_SLAVE);
91 - $sql = "SELECT COUNT(1) as `count` " .
92 - "FROM {$dbr->tableName($mvIndexTableName)} " .
93 - "WHERE `stream_id`={$stream_id} ";
94 - if($mvd_type!='all'){
95 - $sql.="AND `mvd_type`='{$mvd_type}' ";
96 - }
97 - //get any data in rage:
98 - if($end_time)$sql.=" AND `start_time` <= " . $end_time;
99 - if($start_time)$sql.=" AND `end_time` >= " . $start_time;
100 - $result =& $dbr->query( $sql, 'MV_Index:countMVDInRange');
101 - $row = $dbr->fetchObject($result);
102 - return $row->count;
 90+
 91+ $cond=array('stream_id'=>$stream_id);
 92+ if($end_time)
 93+ $cond[]='AND start_time <= '. $dbr->addQuotes($end_time);
 94+ if($start_time)
 95+ $cond[]='AND end_time >= '. $dbr->addQuotes($start_time);
 96+ return $dbr->selectField('mv_mvd_index', 'COUNT(*)', $cond, __METHOD__ );
10397 }
10498 /*
10599 * getMVDInRange returns the mvd titles that are in the given range
106100 * param list got kind of crazy long... @@todo re-factor int a request object or something cleaner
107101 */
108 - function getMVDInRange($stream_id, $start_time=null, $end_time=null, $mvd_type='all',$getText=false,$smw_properties='', $limit='LIMIT 0, 200'){
 102+ function getMVDInRange($stream_id, $start_time=null, $end_time=null, $mvd_type='all',$getText=false,$smw_properties='', $limit='200'){
109103 global $mvIndexTableName, $mvDefaultClipLength;
110 - $dbr =& wfGetDB(DB_SLAVE);
 104+ $dbr =& wfGetDB(DB_SLAVE);
 105+ //set up select vars:
 106+ $conds=$options=$vars=array();
 107+ $from_tables ='';
 108+ //
111109 //set mvd_type if empty:
112110 if($mvd_type==null)$mvd_type='all';
113111 if($start_time<0)$start_time=0;
 112+ //add base select vars:
 113+ $vars= array('mv_page_id as id', 'mvd_type', 'wiki_title', 'stream_id', 'start_time', 'end_time');
 114+ //add in base from:
 115+ $from_tables.= $dbr->tableName('mv_mvd_index');
 116+ if($smw_properties!=''){
 117+ if(!isset($options['STRAIGHT_JOIN']))
 118+ $options['STRAIGHT_JOIN']='';
 119+ if(!is_array($smw_properties))
 120+ $smw_properties = explode(',',$smw_properties);
 121+ foreach($smw_properties as $prop_name){
 122+ $vars[] = mysql_escape_string($prop_name).'.object_title as '.mysql_escape_string($prop_name);
 123+ $from_tables.=' LEFT JOIN '. $dbr->tableName('smw_relations') .
 124+ ' as ' . mysql_escape_string($prop_name) .
 125+ ' ON (' . $dbr->tableName('mv_mvd_index') . '.mv_page_id'.
 126+ ' = ' . mysql_escape_string($prop_name) . '.subject_id'.
 127+ ' AND '. mysql_escape_string($prop_name).'.relation_title'.
 128+ ' = ' . mysql_escape_string($prop_name) . ')';
 129+ }
 130+ }
 131+ $conds = array('stream_id'=>$stream_id);
 132+ if($mvd_type!='all'){
 133+ $mvd_type=(is_object($mvd_type))?get_object_vars($mvd_type):$mvd_type;
 134+ if(is_array($mvd_type)){
 135+ $mvd_type_cond = '';
 136+ foreach($mvd_type as $mtype){
 137+ //@@todo confirm its a valid mvd_type:
 138+ $mvd_type_cond.= $or."mvd_type=".$dbr->addQuotes($mtype);
 139+ $or=' OR ';
 140+ }
 141+ }else if(is_string($mvd_type)){
 142+ $mvd_type_cond = $mvd_type;
 143+ }
 144+ $conds[] = $mvd_type_cond;
 145+ }
 146+ if($end_time)
 147+ $cond[]='AND start_time <= '. $dbr->addQuotes($end_time);
 148+ if($start_time)
 149+ $cond[]='AND end_time >= '. $dbr->addQuotes($start_time);
114150
115 - $sql_sel = "SELECT `mv_page_id` as `id`, `mvd_type`, `wiki_title`, `stream_id`, `start_time`, `end_time` ";
116 - $sql_from=" FROM {$dbr->tableName($mvIndexTableName)} ";
117 - if($smw_properties!=''){
118 - $smw_properties = (is_string($smw_properties))?array($smw_properties):$smw_properties;
119 - foreach($smw_properties as $prop_name){
120 - $sql_sel.=", `$prop_name`.`object_title` as `$prop_name`";
121 - $sql_from.="LEFT JOIN `smw_relations` as `$prop_name` ON (`mv_mvd_index`.`mv_page_id`=`$prop_name`.`subject_id` " .
122 - "AND `$prop_name`.`relation_title`='$prop_name') ";
123 - }
124 - }
125 - $sql = $sql_sel . $sql_from;
126 - $sql.= "WHERE `stream_id`={$stream_id} ";
127 - if($mvd_type!='all'){
128 - $mvd_type=(is_object($mvd_type))?get_object_vars($mvd_type):$mvd_type;
129 - //check if mvd_type is array:
130 - if(is_array($mvd_type)){
131 - $sql.=' AND (';
132 - $or='';
133 - foreach($mvd_type as $mtype){
134 - //@@todo confirm its a valid mvd_type:
135 - $sql.=$or."`mvd_type`='{$mtype}' ";
136 - $or='OR ';
137 - }
138 - $sql.=')';
139 - }else{
140 - //@@todo confirm its a valid mvd_type:
141 - $sql.="AND `mvd_type`='{$mvd_type}' ";
142 - }
143 - }
144 - //print $sql;
145 - //get any data that covers this rage:
146 - if($end_time)$sql.=" AND `start_time` <= " . $end_time;
147 - if($start_time)$sql.=" AND `end_time` >= " . $start_time;
148 - //add in ordering
149 - $sql.=' ORDER BY `start_time` ASC ';
150 - //add in limit of 200 by default for now
151 - $sql.=$limit;
 151+ //add in ordering
 152+ $options['ORDER BY']= 'start_time ASC';
 153+ //add in limit
 154+ $options['LIMIT'] = $limit;
 155+ //run query:
 156+ $result = $dbr->select( $from_tables,
 157+ $vars,
 158+ $conds,
 159+ __METHOD__,
 160+ $options);
 161+ /*print $dbr->lastQuery();
 162+ die;*/
152163 //echo $sql;
153 - $result =& $dbr->query( $sql, 'MV_Index:time_index_query');
 164+ //$result =& $dbr->query( $sql, 'MV_Index:time_index_query');
154165 return $result;
155166 }
156167 /*@@todo figure another way to get at this data...this is not a very fast query: */
157168 function getMVDTypeInRange($stream_id, $start_time=null, $end_time=null){
158 - global $mvIndexTableName;
159 - $dbr =& wfGetDB(DB_SLAVE);
160 - $sql = "SELECT COUNT(*) as `count`, `mvd_type`";
161 - $sql.= " FROM {$dbr->tableName($mvIndexTableName)} " .
162 - " WHERE `stream_id` =".$stream_id;
163 - if($end_time)$sql.=" AND `start_time` <= " . $end_time;
164 - if($start_time)$sql.=" AND `end_time` >= " . $start_time;
165 - $sql.= " GROUP BY `mvd_type`";
166 - $result = & $dbr->query( $sql, 'MV_Index:time_mvd_type_query');
167 - return $result;
 169+ $dbr =& wfGetDB(DB_SLAVE);
 170+ //init vars
 171+ $from_tables=$vars= $conds= $options=array();
 172+
 173+ $from_tables = $dbr->tableName('mv_mvd_index');
 174+ $vars = 'COUNT(*) as count, mvd_type';
 175+ $conds = array('stream_id'=>$stream_id);
 176+ if($end_time)
 177+ $cond[] = ' AND start_time <= '. $dbr->addQuotes($end_time);
 178+ if($start_time)
 179+ $cond[] = ' AND end_time >= '. $dbr->addQuotes($start_time);
 180+ $options['GROUP BY'] = 'mvd_type';
 181+ return $dbr->select( $from_tables,
 182+ $vars,
 183+ $conds,
 184+ __METHOD__,
 185+ $options); ;
168186 }
169187 function remove_by_stream_id($stream_id){
170188 global $mvIndexTableName;
@@ -185,25 +203,30 @@
186204 $wgRequest, $mvDo_SQL_CALC_FOUND_ROWS, $mvMediaSearchResultsLimit;
187205
188206 global $mvSpokenByInSearchResult, $mvCategoryInSearchResult, $mvBillInSearchResult;
189 -
 207+
 208+ //init vars
 209+ $from_tables=$vars= $conds= $options=array();
190210 $dbr =& wfGetDB(DB_SLAVE);
191211 //organize the queries (group full-text searches and category/attributes)
192212 //if the attribute is not a numerical just add it to the fulltext query
193 - $ftq_match_asql=$last_person_aon=$ftq_match=$ftq=$snq=$toplq_cat=$date_range_join=$date_range_where=$asql=''; //top query and full text query =''
 213+ //$ftq_match_asql=$last_person_aon=$ftq_match=$ftq=$snq=$toplq_cat=$date_range_join=$date_range_where=$asql=''; //top query and full text query =''
194214 if($filters=='')return array();
195215
196 - $selOpt = ($mvDo_SQL_CALC_FOUND_ROWS)?'SQL_CALC_FOUND_ROWS':'';
 216+ //$selOpt = ($mvDo_SQL_CALC_FOUND_ROWS)?'SQL_CALC_FOUND_ROWS':'';
 217+ if( $mvDo_SQL_CALC_FOUND_ROWS)
 218+ $options['SQL_CALC_FOUND_ROWS']=true;
197219
198 - list( $this->limit, $this->offset ) = $wgRequest->getLimitOffset( 20, 'searchlimit' );
 220+ //set limit offset:
 221+ list( $this->limit, $this->offset ) = $wgRequest->getLimitOffset( 20, 'searchlimit' );
199222 if($this->limit > $mvMediaSearchResultsLimit)$this->limit = $mvMediaSearchResultsLimit;
200223
201 - $this->order = strtolower($wgRequest->getVal('order'));
 224+ $this->order = strtolower($wgRequest->getVal('order'));
202225 //force order type:
203226 if( !($this->order=='relevent' || $this->order=='recent' || $this->order=='viewed') )$this->order='relevent';
204227
205228
206229 $group_spoken=true;
207 - $categoryTable = $dbr->tableName( 'categorylinks');
 230+ //$categoryTable = ;
208231 foreach($filters as $f){
209232 //proocc and or for fulltext:
210233 if(!isset($f['a']))$f['a']='and';
@@ -221,12 +244,13 @@
222245 $group_spoken=false;
223246 }
224247 //full text based semantic query:
225 - $ftq.=' '.$aon.'"spoken by '.mysql_escape_string($f['v']).'"';
 248+ $ftq.=' '.$aon. $dbr->addQuotes('spoken by '. $f['v']);
226249 //table based query:
227250 $last_person_aon=$aon;
 251+ //$conds[]=
228252 break;
229253 case 'match':
230 - $ftq_match.=' '.$aon.'"'.mysql_escape_string($f['v']).'"';
 254+ $ftq_match.=' '.$aon.'"'.$dbr->addQuotes($f['v']).'"';
231255 //only need to split out ftq match if spoken by is more than one
232256 if($ftq_match_asql!='')
233257 $ftq_match_asql = $asql;
@@ -234,7 +258,7 @@
235259 //top level queries (sets up time ranges )
236260 case 'category':
237261 //full text based category query:
238 - $toplq.=' '.$aon.'"category '.mysql_escape_string($f['v']).'" ';
 262+ $toplq.=' '.$aon.'"category '.$dbr->addQuotes($f['v']).'" ';
239263 //$ftq.=' '.$aon.'category:'.mysql_escape_string($f['v']);
240264
241265 //table based query:
@@ -243,19 +267,19 @@
244268 case 'or':$toplq_cat='OR';break;
245269 case 'not':$toplq_cat='NOT';break;
246270 }
247 - $toplq_cat.=" $categoryTable.`cl_to`='".mysql_escape_string($f['v'])."'";
 271+ $toplq_cat.=$dbr->tableName( 'categorylinks').'.cl_to='.$dbr->addQuotes($f['v']);
248272 break;
249273 case 'date_range':
250274 $date_range_join = ' JOIN `mv_streams` ' .
251 - 'ON `'.$mvIndexTableName.'`.`stream_id` =`mv_streams`.`id` ';
 275+ 'ON mv_mvd_index.stream_id =mv_streams.id ';
252276
253277 list($month, $day, $year) = explode('/',$f['vs']);
254278 $sts = mktime(0,0,0,$month, $day, $year);
255279 list($month, $day, $year) = explode('/',$f['ve']);
256280 $ets = mktime(0,0,0,$month, $day+1, $year); //(the start of the next day)
257281 $date_range_where.= '( `mv_streams`.`date_start_time` > '
258 - . mysql_escape_string($sts) .
259 - ' AND `mv_streams`.`date_start_time` < '. mysql_escape_string($ets) .
 282+ . $dbr->addQuotes($sts) .
 283+ ' AND `mv_streams`.`date_start_time` < '. $dbr->addQuotes($ets) .
260284 ')';
261285 $date_range_andor = ' '.$asql.' ';
262286 break;
@@ -270,38 +294,76 @@
271295 //get stream name:
272296 //print "f: " . $f['v'];
273297 $stream =& mvGetMVStream($f['v']);
274 - $snq.=" `stream_id` = {$stream->getStreamId()} ";
 298+ $snq.=" stream_id = ". $dbr->addQuotes($stream->getStreamId());
275299 break;
276300 case 'smw_property':
277 - //more complicated query work needed ;)
 301+ //more complicated query work needed
278302 break;
279303 }
280304 }
281 - $searchindexTable = $dbr->tableName( 'searchindex' );
 305+ //$searchindexTable = $dbr->tableName( 'searchindex' );
282306
283307 //a join operation to restrict search results to streams with files
284 - $join_streams_with_low_ogg_sql = "JOIN `$mvStreamFilesTable` ON (`$mvIndexTableName`.`stream_id` = `$mvStreamFilesTable`.`stream_id` AND `$mvStreamFilesTable`.`file_desc_msg`='mv_ogg_low_quality') ";
 308+ //$join_streams_with_low_ogg_sql = "JOIN `$mvStreamFilesTable` ON (`$mvIndexTableName`.`stream_id` = `$mvStreamFilesTable`.`stream_id` AND `$mvStreamFilesTable`.`file_desc_msg`='mv_ogg_low_quality') ";
285309
286310 //add the top query to the base query:
287311 $ftq.=$toplq;
288 - $sql = "SELECT $selOpt `mv_page_id` as `id`,`$mvIndexTableName`.`stream_id`,
 312+ /*$sql = "SELECT $selOpt `mv_page_id` as `id`,`$mvIndexTableName`.`stream_id`,
289313 (`$mvStreamTable`.`date_start_time`+`start_time`) AS `mvd_date_start_time`,
290314 `start_time`,`end_time`, `view_count`,`wiki_title`, $searchindexTable.`si_text` AS `text` ";
291 - if($mvSpokenByInSearchResult)$sql.=",`smw_relations`.`object_title` as `spoken_by` ";
292 - $sql.="FROM `$mvIndexTableName`
 315+ */
 316+ $vars = "mv_page_id as id,". $dbr->tableName('mv_mvd_index').'.stream_id,
 317+ ('.$dbr->tableName('mv_streams').'.date_start_time+'.$dbr->tableName('mv_mvd_index').
 318+ '.start_time) AS mvd_date_start_time, '.
 319+ 'start_time, end_time, view_count, wiki_title,'.
 320+ $dbr->tableName( 'searchindex' ).'.si_text AS text ';
 321+
 322+ if($mvSpokenByInSearchResult)
 323+ $vars.=', smw_relations.object_title as spoken_by ';
 324+
 325+ /*$sql.="FROM `$mvIndexTableName`
293326 JOIN $searchindexTable ON `$mvIndexTableName`.`mv_page_id` = $searchindexTable.`si_page`
294327 LEFT JOIN $mvStreamTable ON `$mvIndexTableName`.`stream_id`=$mvStreamTable.`id`
295328 $join_streams_with_low_ogg_sql
296 - $date_range_join ";
 329+ $date_range_join ";*/
 330+ $from_table[]=$dbr->tableName('mv_mvd_index') ;
 331+ $from_table[]='JOIN '.$dbr->tableName( 'searchindex' ).
 332+ ' ON ' .
 333+ $dbr->tableName('mv_mvd_index').'.mv_page_id = '.
 334+ $dbr->tableName( 'searchindex' ).'.si_page';
 335+
 336+ $from_table[]='LEFT JOIN '. $dbr->tableName('mv_streams').
 337+ ' ON ' .
 338+ $dbr->tableName('mv_mvd_index').'.stream_id = ' .
 339+ $dbr->tableName('mv_streams').'.id';
 340+ //restrict to streams with valid $mvDefaultVideoQualityKey files:
 341+ global $mvDefaultVideoQualityKey;
 342+ $from_table[]= 'JOIN '. $dbr->tableName('mv_stream_files').
 343+ ' ON ' .
 344+ '( '.$dbr->tableName('mv_mvd_index').'.stream_id = '.
 345+ $dbr->tableName('mv_streams').'.stream_id '.
 346+ ' AND '. $dbr->tableName('mv_stream_files').'.file_desc_msg = '.
 347+ $dbr->addQuotes($mvDefaultVideoQualityKey).
 348+ ') ';
297349
298350 //include spoken by relation in results (LEFT JOIN should not be *that* costly )
299351 if($mvSpokenByInSearchResult){
300 - $sql.="LEFT JOIN `smw_relations` ON (`mv_mvd_index`.`mv_page_id`=`smw_relations`.`subject_id` " .
301 - "AND `smw_relations`.`relation_title`='Spoken_By') ";
 352+ /*$sql.="LEFT JOIN `smw_relations` ON (`mv_mvd_index`.`mv_page_id`=`smw_relations`.`subject_id` " .
 353+ "AND `smw_relations`.`relation_title`='Spoken_By') ";*/
 354+ $from_table[]='LEFT JOIN '.$dbr->tableName('smw_relations').
 355+ ' ON ' .
 356+ '( '.$dbr->tableName('mv_mvd_index').'.mv_page_id = '.
 357+ $dbr->tableName('smw_relations').'.subject_id '.
 358+ ' AND '.$dbr->tableName('smw_relations').'.relation_title = \'Spoken_By\''.
 359+ ')';
302360 }
303 - $sql.="WHERE ";
304 - $sql.=" ( `{$mvIndexTableName}`.`mvd_type`='ht_en' OR `{$mvIndexTableName}`.`mvd_type`='anno_en') AND" ;
305 - $sql.=" $snq ";
 361+ //$sql.="WHERE ";
 362+ //$sql.=" ( `{$mvIndexTableName}`.`mvd_type`='ht_en' OR `{$mvIndexTableName}`.`mvd_type`='anno_en') AND" ;
 363+ $conds[]= '( '.$dbr->tableName('mv_mvd_index') . '.mvd_type = \'ht_en\' '.
 364+ ' OR '. $dbr->tableName('mv_mvd_index') . 'mvd_type=\'anno_en\' )';
 365+
 366+ //$sql.=" $snq ";
 367+ $conds[]= $snq;
306368 //limit to ht_en & anno_en (for now) (future allow selection
307369
308370 $two_part_anor='';
@@ -338,6 +400,13 @@
339401 //echo $this->order;
340402 $sql.="LIMIT {$this->offset}, {$this->limit} ";
341403
 404+
 405+ $result = $dbr->select( $from_tables,
 406+ $vars,
 407+ $conds,
 408+ __METHOD__,
 409+ $options);
 410+
342411 //echo "SQL:".$sql." \n";
343412 //die;
344413 $result = $dbr->query($sql, 'MV_Index:doFiltersQuery_base');
@@ -701,7 +770,7 @@
702771 $sql.=" AND `end_time` >= '" . $range['e'] . '\' ) ';
703772 $or = ' OR ';
704773 }
705 - }
 774+ }
706775 $sql.=') LIMIT 0, 200';
707776 //merge category info back into base results:
708777 $result = $dbr->query($sql, 'MV_Index:doCategorySearchResult');
Index: branches/MetavidWiki-exp/MetavidWiki/includes/specials/MV_SpecialCRUDStream.php
@@ -17,7 +17,7 @@
1818 //global $IP;
1919 //require_once( "$IP/includes/SpecialPage.php" );
2020
21 -function doSpecialAddStream() {
 21+/*function doSpecialAddStream() {
2222 $MV_SpecialAddStream = new MV_SpecialCRUDStream('add');
2323 $MV_SpecialAddStream->execute();
2424 }
@@ -28,10 +28,12 @@
2929
3030 SpecialPage::addPage( new SpecialPage('Mv_Add_Stream','',true,'doSpecialAddStream',false) );
3131 SpecialPage::addPage( new SpecialPage('Mv_Edit_Stream','',true,'doSpecialEditStream',false) );
32 -
33 -class MV_SpecialCRUDStream {
34 - function __construct($mode){
35 - $this->mode = $mode;
 32+*/
 33+/* @@TODO depreciate in favor of oggFile -> stream setup */
 34+class MV_SpecialCRUDStream extends SpecialPage{
 35+ function __construct($mode='add'){
 36+ parent::__construct('Mv_Add_Stream');
 37+ $this->mode='add';
3638 }
3739 function execute() {
3840 global $wgRequest, $wgOut, $wgUser, $mvStream_name, $mvgIP;
@@ -103,9 +105,9 @@
104106 }else{
105107 $html.= wfMsg('mv_add_stream_docu', $docutitle->getFullURL()) . "\n";
106108 }
107 - $html.= '<form name="add_stream" action="' . $spectitle->escapeLocalURL() . '" method="post" enctype="multipart/form-data">';
 109+ $html.= '<form name="add_stream" action="' . htmlspecialchars($spectitle->escapeLocalURL()) . '" method="post" enctype="multipart/form-data">';
108110 $html.= '<fieldset><legend>'.wfMsg('mv_add_stream').'</legend>' . "\n" .
109 - '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>' ;
 111+ '<input type="hidden" name="title" value="' . htmlspecialchars($spectitle->getPrefixedText()) . '"/>' ;
110112 $html.= '<table width="600" border="0">'.
111113 '<tr>';
112114
@@ -120,7 +122,7 @@
121123 '<option value="">Select Stream Type</option>'. "\n";
122124 foreach($this->_allowedStreamTypeArray as $type=>$na){
123125 $sel= ($type==$this->stream_type)?'selected':'';
124 - $html.='<option value="'.$type.'" ' .$sel . '>'.wfMsg('mv_'.$type).'</option>'."\n";
 126+ $html.='<option value="'.htmlspecialchars($type).'" ' . htmlspecialchars($sel) . '>'.wfMsg('mv_'.$type).'</option>'."\n";
125127 }
126128 $html.= '</select></tr>'."\n";
127129 $html.= '<tr><td valign="top"><i>' .wfMsg('mv_label_stream_desc') .'</i>:</td><td>';
@@ -130,10 +132,10 @@
131133 }else{
132134 $token = EDIT_TOKEN_SUFFIX;
133135 }
134 - $html .= "\n<input type='hidden' value=\"$token\"$docutitle name=\"wpEditToken\" />\n";
 136+ $html .= "\n<input type='hidden' value=\"$token\" name=\"wpEditToken\" />\n";
135137 //output the text area:
136 - $html .= '<textarea tabindex="1" accesskey="," name="stream_desc" id="stream_desc" rows=6 cols=5>'.$this->stream_desc .'</textarea>' . "\n";
137 - $html .= '<br /><input type="submit" value="' . wfMsg('mv_add_stream_submit') . "\"/>\n</form>";
 138+ $html .= '<textarea tabindex="1" accesskey="," name="stream_desc" id="stream_desc" rows=6 cols=40>'.htmlspecialchars($this->stream_desc) .'</textarea>' . "\n";
 139+ $html .= '<br /><input type="submit" value="' . htmlspecialchars(wfMsg('mv_add_stream_submit')) . "\"/>\n</form>";
138140
139141 $html .= '</td></tr></table>';
140142 $html .='</fieldset>';
@@ -166,8 +168,8 @@
167169 $html.= '<table width="600" border="0">';
168170 foreach($stream_files as $sf){
169171 $html.='<tr>';
170 - $html.='<td width="150">'.$sf->getFullURL().'</td>';
171 - $html.='<td>'.$sf->get_desc().'</td>';
 172+ $html.='<td width="150">'.htmlspecialchars($sf->getFullURL()).'</td>';
 173+ $html.='<td>'.htmlspecialchars($sf->get_desc()).'</td>';
172174 $html.='</tr>';
173175 }
174176 $html .='</table></fieldset>';
@@ -199,7 +201,7 @@
200202 if ( $success ) {
201203 //stream inserted succesfully report to output
202204 $streamLink = $sk->makeLinkObj( $streamTitle, $this->stream_name );
203 - $out='stream '.$streamLink.' added';
 205+ $out='stream '.htmlspecialchars($streamLink).' added';
204206
205207 } else {
206208 $out=wfMsg('mv_error_stream_insert');
@@ -235,7 +237,7 @@
236238 }
237239
238240 }
239 - }
 241+ }
240242 return $this->_allowedStreamTypeArray;
241243 }
242244
Index: branches/MetavidWiki-exp/MetavidWiki/includes/specials/MV_SpecialListStreams.php
@@ -13,16 +13,25 @@
1414 if (!defined('MEDIAWIKI')) die();
1515
1616
17 -function doSpecialListStreams($par = null) {
 17+/*function doSpecialListStreams($par = null) {
1818 list( $limit, $offset ) = wfCheckLimits();
1919 $rep = new MV_SpecialListStreams();
2020 return $rep->doQuery( $offset, $limit );
2121 }
22 -
2322 SpecialPage::addPage( new SpecialPage('Mv_List_Streams','',true,'doSpecialListStreams',false) );
 23+*/
 24+class MV_SpecialListStreams extends SpecialPage {
 25+ public function __construct() {
 26+ parent::__construct('Mv_List_Streams');
 27+ }
 28+ function execute() {
 29+ list( $limit, $offset ) = wfCheckLimits();
 30+ $rep = new MV_SpecialQueryStreams();
 31+ return $rep->doQuery( $offset, $limit );
 32+ }
 33+}
 34+class MV_SpecialQueryStreams extends QueryPage {
2435
25 -class MV_SpecialListStreams extends QueryPage {
26 -
2736 function getName() {
2837 return "MV_List_Streams";
2938 }
@@ -78,7 +87,7 @@
7988 $result->title = strtoupper($result->title[0]) . substr($result->title, 1);
8089 $img_url = $mvImageArchive . $result->title . '?size=icon&time=0:00:00';
8190 $img_url = MV_StreamImage::getStreamImageURL($result->stream_id, '0:00:00', 'icon', true);
82 - $img_html = '<img src="'.$img_url . '" width="80" height="60">';
 91+ $img_html = '<img src="'. htmlspecialchars($img_url) . '" width="80" height="60">';
8392
8493
8594 $title = Title::makeTitle( MV_NS_STREAM, $result->title );
Index: branches/MetavidWiki-exp/MetavidWiki/includes/specials/MV_SpecialMVAdmin.php
@@ -63,7 +63,8 @@
6464 ob_start();
6565 print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\" dir=\"ltr\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Setting up Storage for Metavid Wiki</title></head><body>";
6666 header( "Content-type: text/html; charset=UTF-8" );
67 -
 67+
 68+ //@@TODOD broken since not valid entry points for web scripts:
6869 global $botUserName, $valid_attributes, $states_ary;
6970 require_once("$mvgIP/maintenance/metavid2mvWiki.inc.php");
7071 require_once("$mvgIP/maintenance/maintenance_util.inc.php");
Index: branches/MetavidWiki-exp/MetavidWiki/includes/specials/MV_SpecialExport.php
@@ -19,26 +19,48 @@
2020 if (!defined('MEDIAWIKI')) die();
2121
2222 global $IP, $smwgIP;
23 -//export types:
24 -function doExportStream($par = null){$MvSpecialExport = new MV_SpecialExport('stream',$par);}
25 -function doExportCat($par = null){$MvSpecialExport = new MV_SpecialExport('category',$par);}
26 -function doExportSeq($par = null){$MvSpecialExport = new MV_SpecialExport('sequence',$par);}
27 -function doExportSearch($par = null){$MvSpecialExport = new MV_SpecialExport('search',$par);}
28 -function doExportAsk($par =null){$MvSpecialExport = new MV_SpecialExport('ask',$par);}
 23+//all the special pages handled by this master Special Export (could reactor into individual classes if we want to)
 24+class MvVideoFeed extends SpecialPage{
 25+ function __construct(){
 26+ parent::__construct('MvVideoFeed');
 27+ $MvSpecialExport = new MV_SpecialExport('category');
 28+ }
 29+}
 30+class MvExportStream extends SpecialPage{
 31+ function __construct(){
 32+ parent::__construct('MvExportStream');
 33+ $MvSpecialExport = new MV_SpecialExport('stream');
 34+ }
 35+}
 36+class MvExportSequence extends SpecialPage{
 37+ function __construct(){
 38+ parent::__construct('MvExportSequence');
 39+ $MvSpecialExport = new MV_SpecialExport('sequence');
 40+ }
 41+}
 42+class MvExportSearch extends SpecialPage{
 43+ function __construct(){
 44+ parent::__construct('MvExportSearch');
 45+ $MvSpecialExport = new MV_SpecialExport('search');
 46+ }
 47+}
 48+class MvExportAsk extends SpecialPage{
 49+ function __construct(){
 50+ parent::__construct('MvExportSearch');
 51+ $MvSpecialExport = new MvExportAsk('ask');
 52+ }
 53+}
 54+function wfSpecialMvExportStream(){
 55+ return true;
 56+}
2957
30 -SpecialPage::addPage( new SpecialPage('MvVideoFeed','',true,'doExportCat',false) );
31 -SpecialPage::addPage( new SpecialPage('MvExportStream','',true,'doExportStream',false) );
32 -SpecialPage::addPage( new SpecialPage('MvExportSequence','',true,'doExportSeq',false) );
33 -SpecialPage::addPage( new SpecialPage('MvExportSearch','',true,'doExportSearch',false) );
34 -SpecialPage::addPage( new SpecialPage('MvExportAsk','',true,'doExportAsk',false) );
35 -
3658 //extend supported feed types:
3759 $wgFeedClasses['cmml']='CmmlFeed';
3860 $wgFeedClasses['podcast']='PodcastFeed';
3961
4062 class MV_SpecialExport {
4163 var $feed = null;
42 - function __construct($export_type, $par){
 64+ function __construct($export_type, $par=''){
4365 $this->export_type=$export_type;
4466 $this->par = $par;
4567 $this->execute();
@@ -52,8 +74,11 @@
5375 $error_page = '';
5476 switch($this->export_type){
5577 case 'stream':
56 - $this->stream_name = $wgRequest->getVal('stream_name');
57 - if($this->stream_name=='')$error_page.=wfMsg('edit_stream_missing').", ";
 78+ $this->stream_name = $wgRequest->getVal('stream_name');
 79+
 80+ if($this->stream_name=='')
 81+ $error_page.=wfMsg('edit_stream_missing').", ";
 82+
5883 $this->req_time = $wgRequest->getVal('t');
5984
6085 switch($this->feed_format ){
@@ -102,8 +127,8 @@
103128 header('Content-Type: text/xml');
104129 $o='<?xml version="1.0" encoding="UTF-8"?>'."\n";
105130 $o.='<playlist version="1" xmlns="http://xspf.org/ns/0/">'."\n";
106 - $o.=' <title>'.$seqTitle->getText().'</title>'."\n";
107 - $o.=' <info>'.$seqTitle->getFullURL().'</info>'."\n";
 131+ $o.=' <title>'.htmlentities($seqTitle->getText()).'</title>'."\n";
 132+ $o.=' <info>'.htmlentities($seqTitle->getFullURL()).'</info>'."\n";
108133 $o.=' <trackList>'."\n";
109134 $seqArticle->parsePlaylist();
110135 foreach($seqArticle->clips as $clip){
@@ -174,7 +199,6 @@
175200 xmlns:html="http://www.w3.org/1999/xhtml"
176201 elementFormDefault="qualified"
177202 attributeFormDefault="unqualified">
178 -
179203 </xs:schema>
180204 */
181205 ?>
@@ -196,7 +220,7 @@
197221 'start="npt:'.htmlentities($this->mvTitle->getStartTime()).'"'.
198222 ' end="npt:'.htmlentities($this->mvTitle->getEndTime()).'"':'';
199223 ?>
200 - <mediaSource id="<?php echo htmlentities($file->getNameKey())?>"<?php echo $dAttr?> src="<?php echo $dSrc?>" title="<?php echo htmlentities($file->get_desc())?>" content-type="<?php echo htmlentities($file->getContentType())?>" <?php echo $startendattr?>/>
 224+ <mediaSource id="<?php echo htmlentities($file->getNameKey())?>"<?php echo $dAttr?> src="<?php echo htmlentities($dSrc)?>" title="<?php echo htmlentities($file->get_desc())?>" content-type="<?php echo htmlentities($file->getContentType())?>" <?php echo $startendattr?>/>
201225 <?}?>
202226 </switch>
203227 </track>
@@ -212,7 +236,7 @@
213237 //for now make ht_en the default layer
214238 $default_attr = (strtolower($row->mvd_type)=='ht_en')?'default="true"':'';
215239 ?>
216 - <mediaSource id="<?php echo $row->mvd_type?>" title="<?php echo wfMsg($row->mvd_type)?>" <?php echo $default_attr?> inline="<?php echo $inline?>" lang="en" content-type="text/cmml" src="<?php echo htmlentities($clink)?>">
 240+ <mediaSource id="<?php echo htmlentities($row->mvd_type)?>" title="<?php echo wfMsg($row->mvd_type)?>" <?php echo $default_attr?> inline="<?php echo htmlentities($inline)?>" lang="en" content-type="text/cmml" src="<?php echo htmlentities($clink)?>">
217241 <? //output inline cmml (if requested):
218242 if($inline=='true'){
219243 $this->get_stream_cmml(true, $row->mvd_type);
@@ -268,7 +292,7 @@
269293
270294 if(!isset($tracks[$mvd->mvd_type]))$tracks[$mvd->mvd_type]='';
271295 $tracks[$mvd->mvd_type].='
272 - <'.$ns.'clip id="mvd_'.$mvd->id.'" start="npt:'.seconds2ntp($mvd->start_time).'" end="npt:'.seconds2ntp($mvd->end_time).'">
 296+ <'.$ns.'clip id="mvd_'.htmlentities($mvd->id).'" start="npt:'.htmlentities(seconds2ntp($mvd->start_time)).'" end="npt:'.htmlentities(seconds2ntp($mvd->end_time)).'">
273297 <'.$ns.'img src="'.htmlentities($streamTitle->getFullStreamImageURL(null, seconds2ntp($mvd->start_time))).'"/>
274298 <'.$ns.'body><![CDATA[
275299 '. $MV_Overlay->getMVDhtml($mvd, $absolute_links=true).'
@@ -279,8 +303,10 @@
280304 }
281305 if($encap)print '<cmml_set>';
282306 //based on: http://trac.annodex.net/wiki/CmmlChanges
283 - foreach($tracks as $role=>$body_string){ ?>
284 - <cmml lang="en" id="<?php echo $role?>" role="<?php echo wfMsg($role)?>" xmlns="http://svn.annodex.net/standards/cmml_2_0.dtd">
 307+ foreach($tracks as $role=>$body_string){
 308+ $ns = htmlentities($ns);
 309+ ?>
 310+ <cmml lang="en" id="<?php echo htmlentities($role)?>" role="<?php echo wfMsg($role)?>" xmlns="http://svn.annodex.net/standards/cmml_2_0.dtd">
285311 <<?php echo $ns?>head>
286312 <<?php echo $ns?>title><?php echo wfMsg($role)?></<?php echo $ns?>title>
287313 <<?php echo $ns?>meta name="description" content="<?php echo htmlentities(wfMsg($role.'_desc'))?>"></<?php echo $ns?>meta>
@@ -460,7 +486,7 @@
461487 }
462488 $desc_xml ='<![CDATA[
463489 <center class="mv_rss_view_only">
464 - <a href="'.$mStreamTitle->getFullUrl().'"><img src="'.$thumb_ref.'" border="0" /></a>
 490+ <a href="'.htmlspecialchars($mStreamTitle->getFullUrl()).'"><img src="'.htmlspecialchars($thumb_ref).'" border="0" /></a>
465491 </center>
466492 <br />'.
467493 $desc_html.
Index: branches/MetavidWiki-exp/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php
@@ -1,5 +1,4 @@
22 <?php
3 -
43 /*
54 * Created on Jul 26, 2007
65 *
@@ -252,7 +251,7 @@
253252 'query_key' => $this->getFilterDesc($query_key = true
254253 ), 'time' => time()), 'Database::searchDigestInsert');
255254 //make sure the query key exists and is updated
256 - //@@todo I think we can do a INSERT IF non found here?
 255+ //@@todo I think we can do a INSERT IF not found here?
257256 $res = $dbr->select('mv_query_key_lookup', array (
258257 'filters'
259258 ), array (
@@ -316,6 +315,7 @@
317316 wfMsg('mv_results_found', $rs, $re, number_format($this->numResultsFound)) .
318317 '</li>';
319318 }
 319+ $prevnext='';
320320 //pagging
321321 if ($this->numResultsFound > $this->limit) {
322322 $prevnext = mvViewPrevNext($this->offset, $this->limit, SpecialPage :: getTitleFor('MediaSearch'), $this->get_httpd_filters_query(), ($this->num < $this->limit));
@@ -354,10 +354,8 @@
355355
356356 //output results:
357357 //collect categories and people for sidebarbucket
358 - //@@todo a better version would collect
359358 $sideBarLinkBucket = array ();
360 - $o .= '
361 - <ul id="results">';
 359+ $o .= ' <ul id="results">';
362360 foreach ($this->results as $inx => & $mvd) {
363361 $mvTitle = new MV_Title($mvd->wiki_title);
364362 $mvd_cnt_links = '';
@@ -394,32 +392,37 @@
395393 }
396394 //link directly to the current range:
397395 $mvStreamTitle = Title :: MakeTitle(MV_NS_STREAM, $mvTitle->getNearStreamName($extra_range = '0'));
398 - //$mvTitle->getStreamName() .'/'.$mvTitle->getStartTime() .'/'. $mvTitle->getEndTime() );
399 - $head_link = $sk->makeKnownLinkObj($mvStreamTitle, $mvTitle->getStreamNameText() . ' :: ' . $mvTitle->getTimeDesc());
400 - $img_link = $sk->makeKnownLinkObj($mvStreamTitle, '<img alt="image for ' . $mvTitle->getStreamNameText() . ' ' . $mvTitle->getTimeDesc() . '" src="' . $mvTitle->getStreamImageURL('small') . '"/>');
 396+ //$mvTitle->getStreamName() .'/'.$mvTitle->getStartTime() .'/'. $mvTitle->getEndTime() );
401397 $mvd_text = $mvd->text;
402398
403399 $o .= '<li class="result">
404 - <span class="vid_img" id="mvimg_' . $mvd->id . '">
405 - ' . $img_link . '
406 - </span>
407 - <div class="result_description">
408 - <h4>' . $head_link . '</h4>
409 - <p>Matching Phrase:' . $this->termHighlight($mvd->text, implode('|', $this->getTerms()), 1, 100) . ' </p>
410 - <span class="by">' . $mvd_cnt_links . '</span>
411 - <span class="by">' . $mvd_cat_links . '</span>
412 - <span class="by">' . $mvd_bill_links . '</span>
413 - </div>
414 - <div class="result_meta">
415 - <span class="views">Views: ' . $mvd->view_count . '</span>
416 - <span class="duration">' . wfMsg('mv_duration_label') . ':' . $mvTitle->getSegmentDurationNTP($short_time = true) . '</span>
417 - <span class="comments">Comments: NYA</span>
418 - <span class="playinline"><a href="javascript:mv_pl(\'' . $mvd->id . '\')">' .
 400+ <span class="vid_img" id="mvimg_' . htmlspecialchars($mvd->id) . '">
 401+ ' . $sk->makeKnownLinkObj($mvStreamTitle,
 402+ '<img alt="image for ' . htmlspecialchars($mvTitle->getStreamNameText()) .
 403+ ' ' . $mvTitle->getTimeDesc() . '" src="' . $mvTitle->getStreamImageURL('small') .
 404+ '"/>') . '
 405+ </span>
 406+ <div class="result_description">
 407+ <h4>' .
 408+ $sk->makeKnownLinkObj($mvStreamTitle, $mvTitle->getStreamNameText() .
 409+ ' :: ' . $mvTitle->getTimeDesc()) .
 410+ '</h4>
 411+ <p>Matching Phrase:' . $this->termHighlight($mvd->text, implode('|', $this->getTerms()), 1, 100) . ' </p>
 412+ <span class="by">' . $mvd_cnt_links . '</span>
 413+ <span class="by">' . $mvd_cat_links . '</span>
 414+ <span class="by">' . $mvd_bill_links . '</span>
 415+ </div>
 416+ <div class="result_meta">
 417+ <span class="views">Views: ' . htmlspecialchars($mvd->view_count) . '</span>
 418+ <span class="duration">' . wfMsg('mv_duration_label') . ':' . htmlspecialchars($mvTitle->getSegmentDurationNTP($short_time = true)) . '</span>
 419+ <span class="comments">Comments: NYA</span>
 420+ <span class="playinline"><a href="javascript:mv_pl(\'' . htmlspecialchars($mvd->id) . '\')">' .
419421 wfMsg('mv_play_inline') . '</a></span>
420422 </div>
421423 </li>';
422424 }
423425 $o .= '</ul>';
 426+ //add in prev-next at bottom too:
424427 $o .= '<li class="prevnext">' . $prevnext . '</li>';
425428 $o .= '</div>';
426429 if(!$show_sidebar)return $o;
@@ -429,7 +432,6 @@
430433 <div id="searchSideBarTop">
431434 </div>
432435 <div class="suggestionsBox" id="searchSideBarInner">';
433 -
434436 //look for people matches max of 3
435437 $first_block = ' first_block';
436438 $matches = 0;
@@ -458,9 +460,9 @@
459461 //get categories
460462 $category_out = MV_SpecialMediaSearch :: auto_complete_search_categories($this->unified_term_search, 3, 'block_html', $matches);
461463 if ($category_out != '' || count($sideBarLinkBucket['category']) != 0) {
462 - $o .= "<div class=\"block{$first_block}\">
463 - <h6>" . wfMsg('mv_category_results') . "</h6>
464 - </div>";
 464+ $o .= '<div class="block'.htmlspecialchars($first_block).'\">
 465+ <h6>' . wfMsg('mv_category_results') . '</h6>
 466+ </div>';
465467 $o .= '<div class="block wide_block">' . $category_out;
466468 if (isset ($sideBarLinkBucket['category'])) {
467469 $cAry = & $sideBarLinkBucket['category'];
@@ -481,9 +483,9 @@
482484 $bill_out = MV_SpecialMediaSearch :: auto_complete_category('Bill', $this->unified_term_search, 3, 'block_html', $matches);
483485 if ($bill_out != '' || count($sideBarLinkBucket['bill']) != 0) {
484486 global $wgContLang;
485 - $o .= "<div class=\"block{$first_block}\">
486 - <h6>" . wfMsg('mv_bill_results') . "</h6>
487 - </div>";
 487+ $o .= '<div class=\"block '.htmlspecialchars($first_block).'">
 488+ <h6>' . wfMsg('mv_bill_results') . '</h6>
 489+ </div>';
488490 $o .= '<div class="block wide_block">' . $bill_out;
489491 if ($sideBarLinkBucket['bill']) {
490492 $bAry = & $sideBarLinkBucket['bill'];
@@ -528,8 +530,8 @@
529531 } else {
530532 if ($this->outputInlineHeader) {
531533 $o .= '<h2>
532 - <span class="mw-headline">' . wfMsg('mv_media_matches') . '</span>
533 - </h2>';
 534+ <span class="mw-headline">' . wfMsg('mv_media_matches') . '</span>
 535+ </h2>';
534536 $title = Title :: MakeTitle(NS_SPECIAL, 'MediaSearch');
535537 $o .= $sk->makeKnownLinkObj($title, wfMsg('mv_advaced_search'), $this->get_httpd_filters_query());
536538 }
@@ -566,10 +568,10 @@
567569 //'<img src="'. $mvgScriptPath . '/skins/images/film.png">'
568570 //$mvd_out .= '<div class="mv_rtdesc" title="' . wfMsg('mv_expand_play') . '" '.
569571 // '> ';
570 - $mvd_out .= '<img style="float:left;width:84px;cursor:pointer;border:solid #' . $bgcolor . '" ' .
571 - ' onclick="mv_ex(\'' . $mvd->id . '\')" width="80" height="60" src="' . $mvTitle->getStreamImageURL('icon') . '">';
 572+ $mvd_out .= '<img style="float:left;width:84px;cursor:pointer;border:solid #' .htmlspecialchars($bgcolor) . '" ' .
 573+ ' onclick="mv_ex(\'' . htmlspecialchars($mvd->id) . '\')" width="80" height="60" src="' . htmlspecialchars($mvTitle->getStreamImageURL('icon')) . '">';
572574 $mvd_out .= '</div>';
573 - $mvd_out .= '<b>' . $mvTitle->getTimeDesc() . '</b>&nbsp;';
 575+ $mvd_out .= '<b>' . htmlspecialchars($mvTitle->getTimeDesc()) . '</b>&nbsp;';
574576 $mvd_cnt_links = '';
575577 if (isset ($mvd->spoken_by)) {
576578 $ptitle = Title :: MakeTitle(NS_MAIN, $mvd->spoken_by);
@@ -578,24 +580,24 @@
579581 }
580582 if ($this->outputSeqLinks == true) {
581583 $mvd_cnt_links .= '&nbsp;<a href="javascript:mv_add_to_seq({mvclip:\'' .
582 - $mvTitle->getStreamName() . '/' . $mvTitle->getTimeRequest() . '\',' .
583 - 'src:\'' . $mvTitle->getWebStreamURL() . '\',' .
584 - 'img_url:\'' . $mvTitle->getStreamImageURL() . '\'})">' .
 584+ htmlspecialchars($mvTitle->getStreamName()) . '/' . htmlspecialchars($mvTitle->getTimeRequest()) . '\',' .
 585+ 'src:\'' .htmlspecialchars($mvTitle->getWebStreamURL()) . '\',' .
 586+ 'img_url:\'' . htmlspecialchars($mvTitle->getStreamImageURL()) . '\'})">' .
585587 '<img style="cursor:pointer;" ' .
586588 'title="' . wfMsg('mv_seq_add_end') . '" ' .
587589 'src="' . $mvgScriptPath . '/skins/mv_embed/images/application_side_expand.png">' . wfMsg('mv_seq_add_end') . '</a>';
588590 }
589 - $mvd_cnt_links .= '<a title="' . wfMsg('mv_expand_play') . '" href="javascript:mv_ex(\'' . $mvd->id . '\')">' .
590 - '<img id="mv_img_ex_' . $mvd->id . '" src="' . $mvgScriptPath . '/skins/images/closed.png">' .
591 - '<span id="mv_watch_clip_' . $mvd->id . '">' . wfMsg('mv_watch_clip') . '</span>' .
592 - '<span style="display:none;" id="mv_close_clip_' . $mvd->id . '">' . wfMsg('mv_close_clip') . '</span>' .
 591+ $mvd_cnt_links .= '<a title="' . htmlspecialchars(wfMsg('mv_expand_play')) . '" href="javascript:mv_ex(\'' . $mvd->id . '\')">' .
 592+ '<img id="mv_img_ex_' . htmlspecialchars($mvd->id) . '" src="' . htmlspecialchars($mvgScriptPath) . '/skins/images/closed.png">' .
 593+ '<span id="mv_watch_clip_' . htmlspecialchars($mvd->id) . '">' . wfMsg('mv_watch_clip') . '</span>' .
 594+ '<span style="display:none;" id="mv_close_clip_' . htmlspecialchars($mvd->id) . '">' . wfMsg('mv_close_clip') . '</span>' .
593595 '</a>' .
594596 '&nbsp;&nbsp;';
595597 //output control links:
596598 //make stream title link:
597599 $mvStreamTitle = Title :: MakeTitle(MV_NS_STREAM, $mvTitle->getNearStreamName());
598600 //$mvTitle->getStreamName() .'/'.$mvTitle->getStartTime() .'/'. $mvTitle->getEndTime() );
599 - $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') . '" ');
 601+ $mvd_cnt_links .= $sk->makeKnownLinkObj($mvStreamTitle, '<img border="1" src="' . $mvgScriptPath . '/skins/images/run_mv_stream.png"> ' . wfMsg('mv_improve_transcript'), '', '', '', '', ' title="' . htmlspecialchars(wfMsg('mv_view_in_stream_interface')) . '" ');
600602 $mvd_cnt_links .= '<br>';
601603 //$title = MakeTitle::()
602604 //don't inclue link to wiki page (too confusing)
@@ -603,7 +605,7 @@
604606 $mvdTitle = Title :: MakeTitle(MV_NS_MVD, $mvd->wiki_title);
605607 //$mvd_out .= $sk->makeKnownLinkObj($mvdTitle, '<img border="0" src="' . $mvgScriptPath . '/skins/images/run_mediawiki.png">', '', '', '', '', ' title="' . wfMsg('mv_view_wiki_page') . '" ');
606608
607 - $mvd_out .= '<span id="mvr_desc_' . $mvd->id . '">';
 609+ $mvd_out .= '<span id="mvr_desc_' . htmlspecialchars($mvd->id) . '">';
608610
609611 if (!isset ($mvd->toplq))
610612 $mvd->toplq = false;
@@ -645,7 +647,7 @@
646648 $mvd_out .= '</span>';
647649 $mvd_out .= '<br>' . $mvd_cnt_links;
648650 $mvd_out .= '<div style="display:block;clear:both;padding-top:4px;padding-bottom:4px;"/>';
649 - $mvd_out .= '<div id="mvr_' . $mvd->id . '" style="display:none;background:#' . $bgcolor . ';" ></div>';
 651+ $mvd_out .= '<div id="mvr_' . htmlspecialchars($mvd->id) . '" style="display:none;background:#' . htmlspecialchars($bgcolor) . ';" ></div>';
650652 }
651653 $stream_out .= $mvd_out;
652654 /*if(count($srange['rows'])!=1){
@@ -663,10 +665,10 @@
664666 $mvTitle->getStreamName() .
665667 '" align="left" src="'.$mvgScriptPath.'/skins/mv_embed/images/vid_play_sm.png">';
666668 */
667 - $o .= '<h3>' . $mvTitle->getStreamNameText();
 669+ $o .= '<h3>' . htmlspecialchars($mvTitle->getStreamNameText());
668670 $o .= ($matches == 1) ? wfMsg('mv_match_text_one') : wfMsg('mv_match_text', $matches);
669671 $o .= '</h3>';
670 - $o .= '<div id="mv_stream_' . $stream_id . '">' . $stream_out . '</div>';
 672+ $o .= '<div id="mv_stream_' . htmlspecialchars($stream_id) . '">' . $stream_out . '</div>';
671673 }
672674 if ($this->outputContainer)
673675 $o .= '</div>';
@@ -772,7 +774,7 @@
773775 //validate title and load stream ref:
774776 if ($mvTitle->validRequestTitle()) {
775777 list ($vWidth, $vHeight) = explode('x', $mvDefaultSearchVideoPlaybackRes);
776 - $embedHTML = '<span style="float:left;width:' . ($vWidth +20) . 'px">' .
 778+ $embedHTML = '<span style="float:left;width:' . htmlspecialchars($vWidth +20) . 'px">' .
777779 $mvTitle->getEmbedVideoHtml('vid_' . $mvd_id, $mvDefaultSearchVideoPlaybackRes, '', $autoplay = true) .
778780 '</span>';
779781 $wgOut->clearHTML();
@@ -816,12 +818,12 @@
817819 $filter['a'] = '';
818820
819821 //output the master selecter per line:
820 - $s .= '<span id="mvs_' . $i . '"><p>';
 822+ $s .= '<span id="mvs_' . htmlspecialchars($i) . '">';
821823 $s .= '&nbsp;&nbsp;';
822824 //selctor (don't display if i==0')
823825 $s .= $this->selector($i, 'a', $filter['a'], ($i == 0) ? false : true);
824826 $s .= $this->selector($i, 't', $filter['t']); //type selector
825 - $s .= '<span id="mvs_' . $i . '_tc">';
 827+ $s .= '<span id="mvs_' . htmlspecialchars($i) . '_tc">';
826828 switch ($filter['t']) {
827829 case 'match' :
828830 $s .= $this->text_entry($i, 'v', $filter['v'], 'mv_hl_text');
@@ -831,11 +833,13 @@
832834 $s .= $this->text_entry($i, 'v', $filter['v']);
833835 break;
834836 case 'date_range' :
835 - $s .= wfMsg('mv_time_separator', $this->text_entry($i, 'vs', $filter['vs'], 'date-pick_' . $i, 'id="vs_' . $i . '"'), $this->text_entry($i, 've', $filter['ve'], 'date-pick_' . $i, 'id="ve_' . $i . '"'));
 837+ $s .= wfMsg('mv_time_separator', $this->text_entry($i, 'vs', $filter['vs'], 'date-pick_' . $i, array('id'=>'vs_' . $i )),
 838+ $this->text_entry($i, 've', $filter['ve'], 'date-pick_' . $i, array('id'=>'ve_' . $i )));
836839 //also output dateObj (if not already output):
837840 if (!$dateObjOut) {
838841 global $wgOut;
839842 //add all date scripts:
 843+ $mvgScriptPath = htmlspecialchars($mvgScriptPath);
840844 $wgOut->addScript("\n" .
841845 '<!-- required plugins -->
842846 <script type="text/javascript" src="' . $mvgScriptPath . '/skins/mv_embed/jquery/plugins/date.js"></script>
@@ -871,16 +875,16 @@
872876 //reference remove
873877 $s .= '<a id="mv_ref_remove" style="display:none;" ' .
874878 'href="">' .
875 - '<img title="' . wfMsg('mv_remove_filter') . '" ' .
 879+ '<img title="' . htmlspecialchars( wfMsg('mv_remove_filter') ) . '" ' .
876880 'src="' . $mvgScriptPath . '/skins/images/cog_delete.png"></a>';
877881
878882 //ref missing person image ref:
879883 $s .= $this->get_ref_person();
880884
881885 //add link:
882 - $s .= '<a style="text-decoration:none;" href="javascript:mv_add_filter();">' .
883 - '<img border="0" title="' . wfMsg('mv_add_filter') . '" ' .
884 - 'src="' . $mvgScriptPath . '/skins/images/cog_add.png"> '.wfMsg('mv_add_filter').'</a> ';
 886+ $s .= '<a href="javascript:mv_add_filter();">' .
 887+ '<img border="0" title="' . htmlspecialchars( wfMsg('mv_add_filter') ) . '" ' .
 888+ 'src="' . $mvgScriptPath . '/skins/images/cog_add.png"></a> ';
885889
886890 /*$s .= '<input id="mv_do_search" type="submit" ' .
887891 ' value="' . wfMsg('mv_run_search') . '">';*/
@@ -912,11 +916,11 @@
913917 foreach ($this->filters as $inx => $f) {
914918 if ($inx != 0)
915919 $a = ' ' . wfMsg('mv_search_' . $f['a']) . ' ';
916 - $o .= ($query_key) ? $a : $a . wfMsg('mv_' . $f['t']) . ' ';
 920+ $o .= ($query_key) ? $a : $a . wfMsg('mv_' . $f['t']) . ' ';
917921 if ($f['t'] == 'date_range') { //handle special case of date range:
918 - $o .= wfMsg('mv_time_separator', $bo . $f['vs'] . $bc, $bo . $f['ve'] . $bc);
 922+ $o .= wfMsg('mv_time_separator', $bo . htmlspecialchars($f['vs']) . $bc, $bo . htmlspecialchars($f['ve']) . $bc);
919923 } else {
920 - $o .= $bo . str_replace('_', ' ', $f['v']) . $bc;
 924+ $o .= $bo . str_replace('_', ' ', htmlspecialchars($f['v'])) . $bc;
921925 }
922926 }
923927 return $o;
@@ -943,17 +947,20 @@
944948 $img = wfLocalFile($imgTitle);
945949 }
946950 //print "title is: " .$imgTitle->getDBkey() ."IMAGE IS: " . $img->getURL();
947 -
948 - return '<span class="mv_person_ac" id="mv_person' . $inx . '" style="display:' . $disp . ';width:90px;">' .
949 - '<img id="mv_person_img' . $inx . '" style="padding:2px;" src="' . $img->getURL() . '" width="44">' .
 951+ $inx = htmlspecialchars($inx);
 952+ return '<span class="mv_person_ac" id="mv_person' . $inx . '" style="display:' . htmlspecialchars($disp) . ';width:90px;">' .
 953+ '<img id="mv_person_img' . $inx . '" style="padding:2px;" src="' . htmlspecialchars($img->getURL()) . '" width="44">' .
950954 '<input id="mv_person_input' . $inx . '" class="mv_search_text" style="font-size: 12px;" size="9" ' .
951 - 'type="text" name="' . $tname . '" value="' . $person_name . '" autocomplete="off">' .
 955+ 'type="text" name="' . htmlspecialchars($tname) . '" value="' . htmlspecialchars($person_name) . '" autocomplete="off">' .
952956 '<div id="mv_person_choices' . $inx . '" class="autocomplete"></div>' .
953957 '</span>';
954958 }
955959 function selector($i, $key, $selected = '', $display = true) {
956960 $disp = ($display) ? '' : 'display:none;';
957 - $s = '<select id="mvsel_' . $key . '_' . $i . '" class="mv_search_select" style="font-size: 12px;' . $disp . '" name="f[' . $i . '][' . $key . ']" >' . "\n";
 961+ $s = '<select id="mvsel_' . htmlspecialchars($key) . '_' .
 962+ htmlspecialchars($i) . '" class="mv_search_select" style="font-size: 12px;' .
 963+ htmlspecialchars($disp) . '" name="f[' . htmlspecialchars($i) . '][' .
 964+ htmlspecialchars($key) . ']" >' . "\n";
958965 $items = ($key == 't') ? $this->sel_filter_types : $this->sel_filter_andor;
959966 if ($key == 'a' && $selected == '')
960967 $selected = 'and';
@@ -963,17 +970,20 @@
964971 $s .= '<option value="na" ' . $sel . '>' . wfMsg('mv_search_sel_' . $key) . '</option>' . "\n";
965972 foreach ($items as $item) {
966973 $sel = ($selected == $item) ? $sel = 'selected' : '';
967 - $s .= '<option value="' . $item . '" ' . $sel . '>' . wfMsg('mv_search_' . $item) . '</option>' . "\n";
 974+ $s .= '<option value="' . htmlspecialchars($item) . '" ' . $sel . '>' . wfMsg('mv_search_' . $item) . '</option>' . "\n";
968975 }
969976 $s .= '</select>';
970977 return $s;
971978 }
972979 //could be a suggest:
973 - function text_entry($i, $key, $val = '', $more_class = '', $more_attr = '') {
 980+ function text_entry($i, $key, $val = '', $more_class = '', $more_attr = array()) {
974981 if ($more_class != '')
975982 $more_class = ' ' . $more_class;
976 - $s = '<input ' . $more_attr . ' class="mv_search_text' . $more_class . '" style="font-size: 12px;" onchange=""
977 - size="9" type="text" name="f[' . $i . '][' . $key . ']" value="' . $val . '">';
 983+ foreach($more_attr as $k=>$v){
 984+ $more_attr_out.=' '.htmlspecialchars($k).'="'.$v.'"';
 985+ }
 986+ $s = '<input ' . $more_attr_out . ' class="mv_search_text' . htmlspecialchars($more_class) . '" style="font-size: 12px;" onchange=""
 987+ size="9" type="text" name="f[' . htmlspecialchars($i) . '][' . htmlspecialchars($key) . ']" value="' . htmlspecialchars($val) . '">';
978988 return $s;
979989 }
980990 /*again here is some possibly metavid congress archive specific stuff:*/
Index: branches/MetavidWiki-exp/MetavidWiki/includes/articlepages/MV_CategoryPage.php
@@ -12,6 +12,9 @@
1313 //$wgHooks['CategoryPageView'][] = 'fnMyHook';
1414 //display all MVD category members as thumbnails...
1515 //display link to rss/playlist
 16+
 17+if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
 18+
1619 class MV_CategoryPage extends CategoryPage{
1720 function closeShowCategory() {
1821 global $wgOut, $wgRequest;
Index: branches/MetavidWiki-exp/MetavidWiki/includes/articlepages/MV_SequencePage.php
@@ -12,12 +12,11 @@
1313 * redirects the user to the sequence interface.
1414 */
1515 //sequence just adds some sequence hooks:
16 -
 16+if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
 17+
1718 define('SEQUENCE_TAG', 'sequence');
18 -
1919
20 -
21 - class MV_SequencePage extends Article{
 20+class MV_SequencePage extends Article{
2221 var $outMode='page';
2322 var $clips=array();
2423 function __construct($title){
@@ -127,7 +126,7 @@
128127 }
129128
130129 $vidtag = '<div id="file" class="fullImageLink"><playlist';
131 - $vidtag.=' width="400" height="300" src="'.$title_url.'">';
 130+ $vidtag.=' width="400" height="300" src="'.htmlspecialchars($title_url).'">';
132131 $vidtag.='</playlist></div><hr>';
133132
134133 $marker = "xx-marker".count($markerList)."-xx";
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_Title.php
@@ -202,8 +202,8 @@
203203 if($this->getStartTime() && $this->getEndTime()){
204204 if($span_separated){
205205 return wfMsg('mv_time_separator',
206 - '<span class="mv_start_time">'.$this->getStartTime().'</span>',
207 - '<span class="mv_end_time">'.$this->getEndTime()).'</span>';
 206+ '<span class="mv_start_time">'.htmlspecialchars($this->getStartTime()).'</span>',
 207+ '<span class="mv_end_time">'.htmlspecialchars($this->getEndTime())).'</span>';
208208 }else{
209209 return wfMsg('mv_time_separator', $this->getStartTime(), $this->getEndTime());
210210 }
Index: branches/MetavidWiki-exp/MetavidWiki/skins/images/add.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: branches/MetavidWiki-exp/MetavidWiki/skins/images/add.png
___________________________________________________________________
Added: svn:mime-type
211211 + application/octet-stream
Index: branches/MetavidWiki-exp/MetavidWiki/skins/mv_stream.js
@@ -478,7 +478,7 @@
479479 }
480480 //add category and empty input (@@todo make cat_ns multi-lengual friendly
481481 var cat_ns="Category:"
482 - if($j(input_item).val().indexOf(cat_ns==0)){
 482+ if($j(input_item).val().indexOf(cat_ns)==0){
483483 mv_add_category(mvd_id, $j(input_item).val().substr(cat_ns.length));
484484 $j(input_item).val('');
485485 }
@@ -502,7 +502,7 @@
503503 if(cat_name=='')return false;
504504 var currentDate = new Date()
505505 var unique_inx = currentDate.getUTCMilliseconds();
506 - $j('#mv_ext_cat_container_'+mvd_id).append('<span id="ext_cat_'+unique_inx+'"><input value="'+cat_name+'" type="hidden" style="display:none;" name="ext_cat[]" class="mv_ext_cat">'+
 506+ $j('#mv_ext_cat_container_'+mvd_id).append('<span id="ext_cat_'+unique_inx+'"><input value="'+cat_name+'" type="hidden" style="display:none;" name="ext_cat_'+unique_inx+'" class="mv_ext_cat">'+
507507 cat_name.replace(/_/g," ") +
508508 '<a href="#" onclick="$j(\'#ext_cat_'+unique_inx+'\').fadeOut(\'fast\').remove();return false;">'+
509509 '<img border="0" src="'+mvgScriptPath+'/skins/images/delete.png">'+
Index: branches/MetavidWiki-exp/MetavidWiki/skins/mv_embed/cortado_iframe.php
@@ -6,7 +6,7 @@
77 */
88 //load the http GETS:
99
10 -
 10+$video='';
1111 $error='';
1212 if(!function_exists('filter_input')){
1313 error_out('you version of php lacks <b>filter_input()</b> function</br>');
Index: branches/MetavidWiki-exp/MetavidWiki/skins/mv_embed/mv_data_proxy.php
@@ -8,7 +8,7 @@
99 */
1010
1111 //NOTE THIS IS DISABLED BY DEFAULT simply comment out the line below to enable;
12 -//die('note mv_data_proxy is disabled by default');
 12+die('note mv_data_proxy is disabled by default');
1313 if(isset($_POST['url'])){
1414 $req_url = $_POST['url'];
1515 }else{

Status & tagging log