/** * Dispatched from execute(); */ private function processParameter($sParameter) { try { $this->oRequestedTitle = Title::newFromText($sParameter); /*if( !$this->oRequestedTitle->exists() && $this->oRequestedTitle->getNamespace() != NS_SPECIAL ) { //!$this->mRequestedTitle->isSpecialPage() does not work in MW 1.13 throw new Exception( 'error-requested-title-does-not-exist' ); }*/ //Get relevant page props $dbr = wfGetDB(DB_SLAVE); $res = $dbr->selectField('page_props', 'pp_value', array('pp_propname' => 'bs-universalexport-params', 'pp_page' => $this->oRequestedTitle->getArticleID())); if ($res != false) { $res = FormatJson::decode($res, true); if (is_array($res)) { $this->aParams = array_merge($this->aParams, $res); } } BsUniversalExportHelper::getParamsFromQueryString($this->aParams); //Title::userCan always returns false on special pages (exept for createaccount action) if ($this->oRequestedTitle->getNamespace() === NS_SPECIAL) { if ($this->getUser()->isAllowed('universalexport-export') !== true) { throw new Exception('bs-universalexport-error-permission'); } } elseif ($this->oRequestedTitle->userCan('universalexport-export') === false) { throw new Exception('bs-universalexport-error-permission'); } // TODO RBV (24.01.11 17:37): array_intersect(), may be better? $aCategoryNames = BsUniversalExportHelper::getCategoriesForTitle($this->oRequestedTitle); foreach ($aCategoryNames as $sCategoryName) { if (in_array($sCategoryName, $this->aCategoryBlacklist)) { throw new Exception('bs-universalexport-error-requested-title-in-category-blacklist'); } } BsUniversalExportHelper::checkPermissionForTitle($this->oRequestedTitle, $this->aParams); //Throws Exception $sModuleKey = $this->aParams['module']; if (!isset($this->aModules[$sModuleKey]) || !$this->aModules[$sModuleKey] instanceof BsUniversalExportModule) { throw new Exception('bs-universalexport-error-requested-export-module-not-found'); } $oExportModule = $this->aModules[$sModuleKey]; $aFile = $oExportModule->createExportFile($this); $this->returnFile($aFile); } catch (Exception $oException) { //Display Exception-Message and Stacktrace $this->oOutputPage->setPageTitle(wfMessage('bs-universalexport-page-title-on-error')->text()); $oExceptionView = new ViewException($oException); $this->oOutputPage->addHtml($oExceptionView->execute()); } }