/** * Get SD title for a PE given by its type and ID * * @param array(int, int) $pe PE type and ID * @return Title */ public static function getSDTitle($pe) { // FIXME Do we need to disable title patch? // $etc = haclfDisableTitlePatch(); $peName = IACLDefinition::peNameForID($pe[0], $pe[1]); if ($peName !== NULL) { return Title::newFromText(IACLDefinition::nameOfSD($pe[0], $peName)); } return NULL; // haclfRestoreTitlePatch($etc); }
/** * "Real" ACL list, loaded using AJAX */ static function haclAcllist($t, $n, $offset = 0, $limit = 10) { global $wgScript, $wgTitle, $haclgHaloScriptPath, $haclgContLang, $wgUser; haclCheckScriptPath(); // Load data $spec = SpecialPage::getTitleFor('IntraACL'); $titles = IACLStorage::get('SD')->getSDPages($t, $n, NULL, $offset, $limit, $total); $defs = IACLDefinition::newFromTitles($titles); // Build SD data for template $lists = array(); foreach ($titles as $k => $sd) { $d = array('name' => $sd->getText(), 'real' => $sd->getText(), 'editlink' => $spec->getLocalUrl(array('action' => 'acl', 'sd' => $sd->getText())), 'viewlink' => $sd->getLocalUrl(), 'single' => NULL); $pe = IACLDefinition::nameOfPE($sd); $d['type'] = IACL::$typeToName[$pe[0]]; $d['real'] = $pe[1]; // Single SD inclusion if (isset($defs[$k]) && !empty($defs[$k]['single_child'])) { $s = $defs[$k]['single_child']; $name = IACLDefinition::peNameForID($s[0], $s[1]); $d['single'] = Title::newFromText(IACLDefinition::nameOfSD($s[0], $name)); $d['singletype'] = IACL::$typeToName[$s[0]]; $d['singlename'] = $name; $d['singlelink'] = $d['single']->getLocalUrl(); $d['singletip'] = wfMsg('hacl_acllist_hint_single', $d['real'], $d['single']->getPrefixedText()); } $lists[$d['type']][] = $d; } // Next and previous page links $pageurl = Title::makeTitleSafe(NS_SPECIAL, 'IntraACL')->getLocalUrl(array('types' => $t, 'filter' => $n, 'limit' => $limit)); $nextpage = $prevpage = false; if ($total > $limit + $offset) { $nextpage = $pageurl . '&offset=' . intval($offset + $limit); } if ($offset >= $limit) { $prevpage = $pageurl . '&offset=' . intval($offset - $limit); } // Run template ob_start(); require dirname(__FILE__) . '/../templates/HACL_ACLListContents.tpl.php'; $html = ob_get_contents(); ob_end_clean(); return $html; }