示例#1
0
 function execute($par)
 {
     wfProfileIn(__METHOD__);
     global $wgOut, $wgRequest, $wgExtensionsPath, $wgStylePath;
     global $wgPhalanxSupportedLanguages, $wgUser, $wgTitle;
     // check restrictions
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         wfProfileOut(__METHOD__);
         return;
     }
     $this->setHeaders();
     $wgOut->addStyle("{$wgExtensionsPath}/wikia/Phalanx/css/Phalanx.css");
     $wgOut->addScript("<script type='text/javascript' src='{$wgExtensionsPath}/wikia/Phalanx/js/Phalanx.js'></script>\n");
     $wgOut->addExtensionStyle("{$wgStylePath}/common/wikia_ui/tabs.css");
     $wgOut->setPageTitle(wfMsg('phalanx-title'));
     $template = new EasyTemplate(dirname(__FILE__) . '/templates');
     $pager = new PhalanxPager();
     $listing = $pager->getNavigationBar();
     $listing .= $pager->getBody();
     $listing .= $pager->getNavigationBar();
     $data = $this->prefillForm();
     $template->set_vars(array('expiries' => Phalanx::getExpireValues(), 'languages' => $wgPhalanxSupportedLanguages, 'listing' => $listing, 'data' => $data, 'action' => $wgTitle->getFullURL(), 'showEmail' => $wgUser->isAllowed('phalanxemailblock')));
     $wgOut->addHTML($template->render('phalanx'));
     wfProfileOut(__METHOD__);
 }
 public function formatRow($row)
 {
     $newRow = array();
     foreach ($row as $name => $value) {
         $newRow['p_' . $name] = $value;
     }
     return parent::formatRow((object) $newRow);
 }
 function getPagingQueries()
 {
     $queries = parent::getPagingQueries();
     foreach ($queries as $type => $query) {
         if ($query === false) {
             continue;
         }
         if (!empty($this->pInx)) {
             $query[$this->pInx] = $this->id;
         }
         $queries[$type] = $query;
     }
     return $queries;
 }
 /**
  * Returns current block data
  *
  * @return array
  */
 private function blockDataForForm()
 {
     $data = array();
     $id = $this->wg->Request->getInt('id');
     if ($id > 0) {
         // block edit
         $data = Phalanx::newFromId($id);
         if ($data['type'] & Phalanx::TYPE_EMAIL && !$this->app->wg->User->isAllowed('phalanxemailblock')) {
             // VSTF members should not be able to view email blocks
             $data = [];
         } else {
             $data['type'] = Phalanx::getTypeNames($data['type']);
             $data['checkId'] = $id;
             $data['checkBlocker'] = '';
             return $data;
         }
     }
     // block creation
     $pager = new PhalanxPager();
     $data['checkBlocker'] = $this->wg->Request->getText('wpPhalanxCheckBlocker', '');
     $data['checkId'] = $this->wg->Request->getIntOrNull('id');
     $data['type'] = $pager->getSearchFilter();
     $data['text'] = $this->wg->Request->getText('target', '');
     // prefill the filter content using target URL parameter
     $data['lang'] = '';
     $data['expire'] = '';
     $data['reason'] = '';
     $data['comment'] = '';
     return $data;
 }