예제 #1
0
파일: target.php 프로젝트: rayku/rayku
function contextTarget($values, $limitation, $op)
{
    $_final_result = false;
    $_matched_keyword = '';
    foreach ($values as $value) {
        $limitation = strtolower($limitation);
        $limitation = trim($limitation);
        $value = strtolower($value);
        $value = trim($value);
        if ($op == '==') {
            $result = $limitation == $value;
        } elseif ($op == '!=') {
            $result = $limitation != $value;
        } elseif ($op == '=~') {
            $result = MAX_stringContains($limitation, $value);
        } elseif ($op == '!~') {
            $result = !MAX_stringContains($limitation, $value);
        }
        if ($result) {
            if (empty($_matched_keyword)) {
                $_matched_keyword = $value;
            } else {
                $_matched_keyword .= "," . $value;
            }
            $_final_result = true;
        }
    }
    return $_matched_keyword;
}
예제 #2
0
/**
 * Returns true if the string contains the start '*' character,
 * false otherwise.
 *
 * @param string $ip A string to check.
 * @return true if the string contains the start '*' character,
 * false otherwise.
 */
function MAX_ipContainsStar($ip)
{
    return MAX_stringContains($ip, '*');
}