Exemplo n.º 1
0
 /**
  * check "bad" words by TextRegex extension
  */
 public static function checkBadWords($sText, $where, $split = false)
 {
     wfProfileIn(__METHOD__);
     if (!wfRunHooks('AutoCreateWiki::checkBadWords', array($sText, $where, $split))) {
         return false;
     }
     // TODO: temporary check for Phalanx (don't perform additional filtering when enabled)
     global $wgEnablePhalanxExt;
     if (!empty($wgEnablePhalanxExt)) {
         return true;
     }
     $allowed = true;
     $oRegexCore = new TextRegexCore("creation", 0);
     if ($oRegexCore instanceof TextRegexCore) {
         $newText = preg_replace("/[^a-z0-9]/i", "", $sText);
         #--
         if ($split == true) {
             $aWordsInText = preg_split("/[\\s,]+/", $newText);
         } else {
             $aWordsInText = array($newText);
         }
         $allowed = $oRegexCore->isAllowedText($aWordsInText, wfMsg('autocreatewiki-regex-error-comment', $where, $sText));
     }
     #---
     wfProfileOut(__METHOD__);
     return $allowed;
 }
Exemplo n.º 2
0
 function showSubpages($err)
 {
     global $wgOut;
     wfProfileIn(__METHOD__);
     $regexCore = new TextRegexCore($this->subPage, 0);
     $subpages = $regexCore->getAllSubpages();
     $action = htmlspecialchars($this->oTitle->getLocalURL("action=addsubpage"));
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("oTitle" => $this->oTitle, "subpages" => $subpages, "token" => $this->mToken, "action" => $action, "err" => $err));
     #---
     $wgOut->addHtml($oTmpl->render("textregex-subpages"));
     wfProfileOut(__METHOD__);
     return 1;
 }