function onEdit(&$mvd_pages_cache, $mvd_id) { // force update local mvd_page_cache from db: $mvd_pages_cache[$mvd_id] = MV_Index::getMVDbyId($mvd_id); $stream_name = MV_Stream::getStreamNameFromId($this->mvd_pages[$mvd_id]->stream_id); $streamTitle = Title::newFromText($stream_name, MV_NS_STREAM); // clear the cache for the parent stream page: // print "clear parent stream: " . $streamTitle ."\n"; Article::onArticleEdit($streamTitle); }
function edit($textbox1_override = null) { global $wgOut, $wgUser, $wgRequest; $fname = 'MV_EditPage::edit'; wfProfileIn($fname); wfDebug("{$fname}: enter\n"); // this is not an article $wgOut->setArticleFlag(false); $this->importFormData($wgRequest); if ($textbox1_override) { $this->textbox1 = $textbox1_override; } $this->firsttime = false; if ($this->live) { $this->livePreview(); wfProfileOut($fname); return; } $permErrors = $this->mTitle->getUserPermissionsErrors('edit', $wgUser); if (!$this->mTitle->exists()) { $permErrors += array_diff($this->mTitle->getUserPermissionsErrors('create', $wgUser), $permErrors); } # Ignore some permissions errors. $remove = array(); foreach ($permErrors as $error) { if ($this->preview || $this->diff && ($error[0] == 'blockedtext' || $error[0] == 'autoblockedtext')) { // Don't worry about blocks when previewing/diffing $remove[] = $error; } if ($error[0] == 'readonlytext') { if ($this->edit) { $this->formtype = 'preview'; } elseif ($this->save || $this->preview || $this->diff) { $remove[] = $error; } } } # array_diff returns elements in $permErrors that are not in $remove. $permErrors = array_diff($permErrors, $remove); if (!empty($permErrors)) { wfDebug("{$fname}: User can't edit\n"); // limt rows for ajax: $non_ajax_rows = $wgUser->getIntOption('rows'); $wgUser->setOption('rows', 5); $sk = $wgUser->getSkin(); $cancel = '<a href="javascript:mv_disp_mvd(\'' . $this->mTitle->getDBkey() . '\',\'' . $this->mvd_id . '\');">' . wfMsgExt('cancel', array('parseinline')) . '</a>'; // get the stream parent: $mvd = MV_Index::getMVDbyId($this->mvd_id); $stream_name = MV_Stream::getStreamNameFromId($mvd->stream_id); $lTitle = SpecialPage::getTitleFor('Userlogin'); $loginLink = $lTitle->getFullURL('returnto=' . MWNamespace::getCanonicalName(MV_NS_STREAM) . ':' . $stream_name); $wgOut->addHTML(wfMsg('mv_user_cant_edit', $loginLink, $cancel)); $wgOut->readOnlyPage($this->mArticle->getContent(), true, $permErrors); $wgUser->setOption('rows', $non_ajax_rows); wfProfileOut($fname); return; } else { if ($this->save) { $this->formtype = 'save'; } elseif ($this->preview) { $this->formtype = 'preview'; } elseif ($this->diff) { $this->formtype = 'diff'; } else { # First time through $this->firsttime = true; if ($this->previewOnOpen()) { $this->formtype = 'preview'; } else { $this->extractMetaDataFromArticle(); $this->formtype = 'initial'; } } } wfProfileIn("{$fname}-business-end"); $this->isConflict = false; // css / js subpages of user pages get a special treatment $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage(); $this->isWrongCaseCssJsPage = $this->isWrongCaseCssJsPage(); /* Notice that we can't use isDeleted, because it returns true if article is ever deleted * no matter it's current state */ $this->deletedSinceEdit = false; if ($this->edittime != '') { /* Note that we rely on logging table, which hasn't been always there, * but that doesn't matter, because this only applies to brand new * deletes. This is done on every preview and save request. Move it further down * to only perform it on saves */ if ($this->mTitle->isDeleted()) { $this->lastDelete = $this->getLastDelete(); if (!is_null($this->lastDelete)) { $deletetime = $this->lastDelete->log_timestamp; if ($deletetime - $this->starttime > 0) { $this->deletedSinceEdit = true; } } } } # Show applicable editing introductions if ($this->formtype == 'initial' || $this->firsttime) { $this->showIntro(); } if ($this->mTitle->isTalkPage()) { $wgOut->addWikiMsg('talkpagetext'); } # Attempt submission here. This will check for edit conflicts, # and redundantly check for locked database, blocked IPs, etc. # that edit() already checked just in case someone tries to sneak # in the back door with a hand-edited submission URL. // set up commit transaction // $dbw = wfGetDB( DB_MASTER ); // $dbw->begin(); if ('save' == $this->formtype) { if (!$this->attemptSave()) { wfProfileOut("{$fname}-business-end"); wfProfileOut($fname); return; } } // $dbw->commit(); # First time through: get contents, set time for conflict # checking, etc. if ('initial' == $this->formtype || $this->firsttime) { if ($this->initialiseForm() === false) { $this->noSuchSectionPage(); wfProfileOut("{$fname}-business-end"); wfProfileOut($fname); return; } if (!$this->mTitle->getArticleId()) { wfRunHooks('EditFormPreloadText', array(&$this->textbox1, &$this->mTitle)); } } $this->showEditForm(); wfProfileOut("{$fname}-business-end"); wfProfileOut($fname); }
function mv_pl_wt($mvd_id) { global $wgRequest; $mvd = MV_Index::getMVDbyId($mvd_id); $mvTitle = new MV_Title($mvd->wiki_title); return $mvTitle->getEmbedVideoHtml(array('id' => 'vid_' . $mvd_id, 'size' => $wgRequest->getVal('size'), 'autoplay' => true)); }
function expand_wt($mvd_id, $terms_ary) { global $wgOut, $mvgIP; global $mvDefaultSearchVideoPlaybackRes; $mvd = MV_Index::getMVDbyId($mvd_id); if (count($mvd) != 0) { $mvTitle = new MV_Title($mvd->wiki_title); // validate title and load stream ref: if ($mvTitle->validRequestTitle()) { list($vWidth, $vHeight) = explode('x', $mvDefaultSearchVideoPlaybackRes); $embedHTML = '<span style="float:left;width:' . htmlspecialchars($vWidth + 20) . 'px">' . $mvTitle->getEmbedVideoHtml(array('id' => 'vid_' . $mvd_id, 'size' => $mvDefaultSearchVideoPlaybackRes, 'autoplay' => true)) . '</span>'; $wgOut->clearHTML(); $MvOverlay = new MV_Overlay(); $MvOverlay->outputMVD($mvd, $mvTitle); $pageHTML = '<span style="padding-top:10px;float:left;width:450px">' . $wgOut->getHTML() . '</span>'; // return page html: return $embedHTML . $pageHTML . '<div style="clear: both;"/>'; } else { return wfMsg('mvBadMVDtitle'); } } else { return wfMsg('mv_error_mvd_not_found'); } // $title = Title::MakeTitle(MV_NS_MVD, $wiki_title); // $article = new Article($title); // output table with embed left, and content right // return $wgOut->parse($article->getContent()); }