Example #1
0
 /**
  * NGあぼーんチェック
  */
 public function ngAbornCheck($code, $resfield, $ic = false)
 {
     global $ngaborns;
     //$GLOBALS['debug'] && $GLOBALS['profiler']->enterSection('ngAbornCheck()');
     if (isset($ngaborns[$code]['data']) && is_array($ngaborns[$code]['data'])) {
         // +Wiki:BEあぼーん
         if ($code == 'aborn_be' || $code == 'ng_be') {
             // プロフィールIDを抜き出す
             if (preg_match('/BE:(\\d+)/', $resfield, $matches)) {
                 $beId = P2UtilWiki::calcBeId((int) $matches[1]);
                 if ($beId === 0) {
                     return false;
                 }
                 $resfield = (string) $beId;
             } else {
                 return false;
             }
         }
         $bbs = $this->thread->bbs;
         $title = $this->thread->ttitle_hc;
         foreach ($ngaborns[$code]['data'] as $k => $v) {
             // 板チェック
             if (isset($v['bbs']) && in_array($bbs, $v['bbs']) == false) {
                 continue;
             }
             // タイトルチェック
             if (isset($v['title']) && stripos($title, $v['title']) === false) {
                 continue;
             }
             // ワードチェック
             // 正規表現
             if ($v['regex']) {
                 $re_method = $v['regex'];
                 /*if ($re_method($v['word'], $resfield, $matches)) {
                       $this->ngAbornUpdate($code, $k);
                       //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('ngAbornCheck()');
                       return p2h($matches[0]);
                   }*/
                 if ($re_method($v['word'], $resfield)) {
                     $this->ngAbornUpdate($code, $k);
                     //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('ngAbornCheck()');
                     return $v['cond'];
                 }
                 // +Wiki:BEあぼーん(完全一致)
             } elseif ($code == 'aborn_be' || $code == 'ng_be') {
                 if ($resfield == $v['word']) {
                     $this->ngAbornUpdate($code, $k);
                     //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('ngAbornCheck()');
                     return $v['cond'];
                 }
                 // 大文字小文字を無視
             } elseif ($ic || $v['ignorecase']) {
                 if (stripos($resfield, $v['word']) !== false) {
                     $this->ngAbornUpdate($code, $k);
                     //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('ngAbornCheck()');
                     return $v['cond'];
                 }
                 // 単純に文字列が含まれるかどうかをチェック
             } else {
                 if (strpos($resfield, $v['word']) !== false) {
                     $this->ngAbornUpdate($code, $k);
                     //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('ngAbornCheck()');
                     return $v['cond'];
                 }
             }
         }
     }
     //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('ngAbornCheck()');
     return false;
 }
Example #2
0
}
if ($popup == 1 || $_conf['expack.spm.ngaborn_confirm'] == 0) {
    $_GET['popup'] = 2;
    $aThread = new ThreadRead();
    $aThread->setThreadPathInfo($host, $bbs, $key);
    $aThread->readDat($aThread->keydat);
    $resar = $aThread->explodeDatLine($aThread->datlines[$resnum - 1]);
    $resar = array_map('trim', $resar);
    $resar = array_map('strip_tags', $resar);
    if (preg_match('/ID: ?([^ ]+?)(?= |$)/', $resar[2], $idar)) {
        $aborn_id = $idar[1];
    } else {
        $aborn_id = '';
    }
    // +Wiki:BEあぼーん
    $aborn_be = preg_match('/BE:(\\d+)/', $resar[2], $idar) ? P2UtilWiki::calcBeId($idar[1]) : '';
    if ($_conf['expack.spm.ngaborn_confirm'] == 0 && !isset($aborn_str)) {
        if ($mode == 'aborn_res') {
            $aborn_str = $host . '/' . $bbs . '/' . $key . '/' . $resnum;
        } elseif (strpos($mode, '_name') !== false) {
            $aborn_str = $resar[0];
        } elseif (strpos($mode, '_mail') !== false) {
            $aborn_str = $resar[1];
        } elseif (strpos($mode, '_id') !== false) {
            $aborn_str = $aborn_id;
        } elseif (strpos($mode, '_msg') !== false) {
            $popup = 1;
            // +Wiki:BEあぼーん
        } elseif (strstr($mode, '_be')) {
            $aborn_str = $aborn_be;
        }