public function index() { if (!$this->wg->User->isAllowed('gameguidescontent')) { $this->displayRestrictionError(); return false; // skip rendering } $this->wg->Out->addStyle('extensions/wikia/GameGuides/css/GameGuidesContentManagmentTool.scss'); $this->response->setTemplateEngine(WikiaResponse::TEMPLATE_ENGINE_MUSTACHE); $title = wfMsg('wikiagameguides-content-title'); $this->wg->Out->setPageTitle($title); $this->wg->Out->setHTMLTitle($title); $this->response->setVal('game_guides_have_moved', wfMessage('wikiagameguides-content-have-been-deprecated-by')->params(SkinTemplate::makeSpecialUrl(self::CURATED_CONTENT), SpecialPage::getTitleFor(self::CURATED_CONTENT))->text()); return true; }
static function addSourceTracking( &$personal_urls, &$title ) { global $wgRequest, $wgUser, $wgServer, $wgSecureLogin; // Generate source tracking parameters $sourceAction = $wgRequest->getVal( 'action' ); $sourceNS = $title->getNamespace(); $sourceArticle = $title->getArticleID(); $loggedin = $wgUser->isLoggedIn(); $thispage = $title->getPrefixedDBkey(); $thisurl = $title->getPrefixedURL(); $query = array(); if ( !$wgRequest->wasPosted() ) { $query = $wgRequest->getValues(); unset( $query['title'] ); unset( $query['returnto'] ); unset( $query['returntoquery'] ); } $thisquery = wfUrlencode( wfArrayToCGI( $query ) ); // Get the returnto and returntoquery parameters from the query string // or fall back on $this->thisurl or $this->thisquery // We can't use getVal()'s default value feature here because // stuff from $wgRequest needs to be escaped, but thisurl and thisquery // are already escaped. $page = $wgRequest->getVal( 'returnto' ); if ( !is_null( $page ) ) { $page = wfUrlencode( $page ); } else { $page = $thisurl; } $query = $wgRequest->getVal( 'returntoquery' ); if ( !is_null( $query ) ) { $query = wfUrlencode( $query ); } else { $query = $thisquery; } $returnto = "returnto=$page"; if ( $query != '' ) { $returnto .= "&returntoquery=$query"; } if (isset ( $personal_urls['login'] ) ) { $login_url = $personal_urls['login']; $login_url['href'] = $login_url['href']."&source_action=$sourceAction&source_ns=$sourceNS&source_article=$sourceArticle"; $personal_urls['login'] = $login_url; } if ( isset ( $personal_urls['anonlogin'] ) ) { $login_url = $personal_urls['anonlogin']; $login_url['href'] = $login_url['href']."&source_action=$sourceAction&source_ns=$sourceNS&source_article=$sourceArticle"; $personal_urls['anonlogin'] = $login_url; } if ( isset ( $personal_urls['createaccount'] ) ) { $page = $wgRequest->getVal( 'returnto' ); $is_signup = $wgRequest->getText( 'type' ) == "signup"; $createaccount_url = array( 'text' => wfMsg( 'createaccount' ), 'href' => SkinTemplate::makeSpecialUrl( 'UserSignup', "$returnto&type=signup&wpSourceAction=$sourceAction&wpSourceNS=$sourceNS&wpSourceArticle=$sourceArticle" ), 'active' => $title->isSpecial( 'Userlogin' ) && $is_signup ); if ( substr( $wgServer, 0, 5 ) === 'http:' && $wgSecureLogin ) { $title = SpecialPage::getTitleFor( 'UserSignup' ); $https_url = preg_replace( '/^http:/', 'https:', $title->getFullURL( "type=signup" ) ); $createaccount_url['href'] = $https_url; $createaccount_url['class'] = 'link-https'; } $personal_urls['createaccount'] = $createaccount_url; } return true; }
function renderRenderingPage() { global $wgLang, $wgOut, $wgRequest; $response = self::mwServeCommand('render_status', array('collection_id' => $wgRequest->getVal('collection_id'), 'writer' => $wgRequest->getVal('writer'))); if (!$response) { return; // FIXME? } $this->setHeaders(); $return_to = $wgRequest->getVal('return_to'); $query = 'collection_id=' . urlencode($response['collection_id']) . '&writer=' . urlencode($response['writer']) . '&return_to=' . urlencode($return_to); switch ($response['state']) { case 'progress': $url = htmlspecialchars(SkinTemplate::makeSpecialUrl('Book', 'bookcmd=rendering&' . $query)); $wgOut->addHeadItem('refresh-nojs', '<noscript><meta http-equiv="refresh" content="2" /></noscript>'); $wgOut->addInlineScript('var collection_id = "' . urlencode($response['collection_id']) . '";'); $wgOut->addInlineScript('var writer = "' . urlencode($response['writer']) . '";'); $wgOut->addInlineScript('var collection_rendering = true;'); $wgOut->addModules('ext.collection'); $wgOut->setPageTitle(wfMsg('coll-rendering_title')); if (isset($response['status']['status']) && $response['status']['status']) { $statusText = $response['status']['status']; if (isset($response['status']['article']) && $response['status']['article']) { $statusText .= ' ' . wfMsg('coll-rendering_article', $response['status']['article']); } elseif (isset($response['status']['page']) && $response['status']['page']) { $statusText .= ' ' . wfMsg('coll-rendering_page', $wgLang->formatNum($response['status']['page'])); } $status = wfMsg('coll-rendering_status', $statusText); } else { $status = ''; } $template = new CollectionRenderingTemplate(); $template->set('status', $status); if (!isset($response['status']['progress'])) { $response['status']['progress'] = 1.0; } $template->set('progress', $response['status']['progress']); $wgOut->addTemplate($template); break; case 'finished': $wgOut->setPageTitle(wfMsg('coll-rendering_finished_title')); $template = new CollectionFinishedTemplate(); $template->set('download_url', wfExpandUrl(SkinTemplate::makeSpecialUrl('Book', 'bookcmd=download&' . $query), PROTO_CURRENT)); $template->set('is_cached', $wgRequest->getVal('is_cached')); $template->set('query', $query); $template->set('return_to', $return_to); $wgOut->addTemplate($template); break; default: $wgOut->addWikiText('state: ' . $response['state']); } }
/** * Backend of several following SAJAX function handlers... * @param String $action provided by the specific handlers internally * @param String $article title passed in from client * @return AjaxResponse with JSON-encoded array including HTML fragment. */ function wfCollectionSuggestAction($action, $article) { $json = new Services_JSON(); $result = CollectionSuggest::refresh($action, $article); $undoLink = Xml::element('a', array('href' => SkinTemplate::makeSpecialUrl('Book', array('bookcmd' => 'suggest', 'undo' => $action, 'arttitle' => $article)), 'onclick' => "collectionSuggestCall('UndoArticle'," . Xml::encodeJsVar(array($action, $article)) . "); return false;", 'title' => wfMsg('coll-suggest_undo_tooltip')), wfMsg('coll-suggest_undo')); $result['last_action'] = wfMsg("coll-suggest_article_{$action}", htmlspecialchars($article), $undoLink); $result['collection'] = CollectionSession::getCollection(); $r = new AjaxResponse($json->encode($result)); $r->setContentType('application/json'); return $r; }
function getMemberList() { $mediapath = $GLOBALS['wgScriptPath'] . '/extensions/Collection/images/'; $coll = $this->data['collection']; $out = ''; $num = count($coll['items']); if ($num == 0) { $out .= "<li>" . wfMsgHtml('coll-suggest_empty') . "</li>"; } for ($i = 0; $i < $num; $i++) { $artName = $coll['items'][$i]['title']; if ($coll['items'][$i]['type'] == 'article') { $out .= '<li><a href="' . htmlspecialchars(SkinTemplate::makeSpecialUrl('Book', array('bookcmd' => 'suggest', 'remove' => $artName))) . '" onclick="' . htmlspecialchars('collectionSuggestCall("RemoveArticle", ' . Xml::encodeJsVar(array($artName)) . '); return false;') . '" title="' . wfMsgHtml('coll-remove_this_page') . '"><img src="' . htmlspecialchars($mediapath . 'remove.png') . '" width="10" height="10" alt=""></a> '; $out .= '<a href="' . htmlspecialchars($coll['items'][$i]['url']) . '" title="' . htmlspecialchars($artName) . '">' . htmlspecialchars($artName) . '</a></li>'; } } return $out; }