<?php
include_once('./_common.php');

if(!AMINA) include_once(AMINA_PATH.'/lib/head.lib.php');

$subject = strtolower($_POST['subject']);
$content = strtolower(strip_tags($_POST['content']));

$filter = explode(",", trim($config['cf_filter']));

for ($i=0; $i<count($filter); $i++) {
    $str = $filter[$i];

    // 제목 필터링 (찾으면 중지)
    $subj = "";
    $pos = strpos($subject, $str);
    if ($pos !== false) {
        $subj = $str;
        break;
    }

    // 내용 필터링 (찾으면 중지)
    $cont = "";
    $pos = strpos($content, $str);
    if ($pos !== false) {
        $cont = $str;
        break;
    }
}

die("{\"subject\":\"$subj\",\"content\":\"$cont\"}");
?>