function proccessReq(&$streamFiles)
 {
     global $wgRequest, $wgUser;
     //make sure the user can edit streams:
     //if(!$wgUser->isAllowed('mv_edit_stream'))return ;
     $this->mv_action = $wgRequest->getVal('mv_action');
     if ($this->mv_action == 'new_stream_file') {
         //@@todo a bit more input scrubbing:
         $newSf = new MV_StreamFile($this->mArticle->mvTitle->mvStream, $_POST['sf_new']);
         //check against existing stream files:
         $doAdd = true;
         foreach ($streamFiles as $sf) {
             if ($sf->file_desc_msg == $newSf->file_desc_msg) {
                 $this->status_error = wfMsg('mv_file_with_same_desc', $newSf->file_desc_msg);
                 $doAdd = false;
             }
         }
         if ($doAdd) {
             $newSf->writeStreamFileDB();
             $streamFiles[] = $newSf;
         }
     } else {
         if ($this->mv_action == 'edit_stream_files') {
             foreach ($streamFiles as $sf) {
                 if ($_POST['sf_' . $sf->id]) {
                     $sf->updateValues($_POST['sf_' . $sf->id]);
                     $sf->writeStreamFileDB();
                 }
             }
             $this->status_ok = wfMsg('mv_updated_stream_files');
         } else {
             if ($this->mv_action == 'rm_stream_file') {
                 $rmID = $wgRequest->getVal('rid');
                 foreach ($streamFiles as $inx => $sf) {
                     if ($sf->id == $rmID) {
                         $sf->deleteStreamFileDB();
                         $this->status_ok = wfMsg('mv_removed_file_stream', $sf->file_desc_msg);
                         unset($streamFiles[$inx]);
                     }
                 }
             } else {
                 if ($this->mv_action == 'add_existing_stream_file') {
                     //todo VALIDATE
                     global $mvStreamFilesTable;
                     $dbw =& wfGetDB(DB_WRITE);
                     $dbw->insert($mvStreamFilesTable, array('file_id' => $_POST['sf_new']['id'], 'stream_id' => $_POST['sf_new']['stream_id']), __METHOD__);
                     //$newSf = new MV_StreamFile($this->mArticle->mvTitle->mvStream);
                     //	$newSf->getStreamFileDB();
                     //$streamFiles[]=$newSf;
                 }
             }
         }
     }
 }
 function proccessReq(&$streamFiles)
 {
     global $wgRequest, $wgUser;
     // make sure the user can edit streams:
     if (!$wgUser->isAllowed('mv_edit_stream')) {
         $this->status_error = wfMsg('add_stream_permission');
         return;
     }
     // confirm the edit token:
     if ($wgRequest->getVal('wpEditToken')) {
         if (!$wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) {
             $this->status_error = wfMsg('token_suffix_mismatch');
             return;
         }
     }
     $stream = $this->mArticle->mvTitle->mvStream;
     $this->mv_action = $wgRequest->getVal('mv_action');
     if ($this->mv_action == 'new_stream_file') {
         // @@todo a bit more input scrubbing:
         $newSf = new MV_StreamFile($stream, $_POST['sf_new']);
         // check against existing stream files:
         $doAdd = true;
         foreach ($streamFiles as $sf) {
             if ($sf->file_desc_msg == $newSf->file_desc_msg) {
                 $this->status_error = wfMsg('mv_file_with_same_desc', $newSf->file_desc_msg);
                 $doAdd = false;
             }
         }
         if ($doAdd) {
             $newSf->writeStreamFileDB();
             $streamFiles[] = $newSf;
         }
         //check if stream length is 0 then update that to the stream-file length
         if ($stream->getDuration() == 0) {
             $stream->duration = $newSf->getDuration();
             $stream->updateStreamDB();
         }
     } elseif ($this->mv_action == 'edit_stream_files') {
         $dur = 0;
         foreach ($streamFiles as $sf) {
             if ($_POST['sf_' . $sf->id]) {
                 $sf->updateValues($_POST['sf_' . $sf->id]);
                 $sf->writeStreamFileDB();
                 if ($sf->getDuration() > $dur) {
                 }
                 $dur = $sf->getDuration();
             }
         }
         //check if stream length is 0 then update that to the stream-file length
         if ($stream->getDuration() == 0) {
             $stream->duration = $dur;
             $stream->updateStreamDB();
         }
         $this->status_ok = wfMsg('mv_updated_stream_files');
     } elseif ($this->mv_action == 'rm_stream_file') {
         $rmID = $wgRequest->getVal('rid');
         foreach ($streamFiles as $inx => $sf) {
             if ($sf->id == $rmID) {
                 $sf->deleteStreamFileDB();
                 $this->status_ok = wfMsg('mv_removed_file_stream', $sf->file_desc_msg);
                 unset($streamFiles[$inx]);
             }
         }
     }
 }