/** * This function is called from the hook 'EditPage::showEditForm:fields'. * It adds the ACL toolbar to edited pages. */ function haclfAddToolbarForEditPage($editpage, $out) { if ($editpage->mTitle->mNamespace == HACL_NS_ACL) { return true; } $out->addHTML(IACLToolbar::get($editpage->mTitle, !empty($editpage->eNonReadable))); return true; }
function haclSDExists_GetEmbedded($type, $name) { if (!isset(IACL::$nameToType[$type])) { return 'null'; } $type = IACL::$nameToType[$type]; $data = array('exists' => false, 'embedded' => '', 'canon' => false); $sd = IACLDefinition::newFromName($type, $name); if ($sd) { $data['canon'] = $sd['def_title']->getPrefixedText(); if ($sd['rules']) { // FIXME Maybe check page for existence instead of SD rules? $data['exists'] = true; } if ($type == IACL::PE_PAGE) { // Build HTML code for embedded protection toolbar $data['embedded'] = IACLToolbar::getEmbeddedHtml(Title::newFromText($name)->getArticleId(), $sd['pe_type'], $sd['pe_id']); } } return json_encode($data); }