function set_ip_filter($ip_string)
 {
     $ip_positive_hex_list = array();
     $ip_negative_hex_list = array();
     $ip_string_list = $this->_parse_input_string($ip_string);
     foreach ($ip_string_list as $ip_piece) {
         if (substr($ip_piece, 0, 1) == '!') {
             $ip_piece = substr($ip_piece, 1);
             $ip_hex_list =& $ip_negative_hex_list;
         } else {
             $ip_hex_list =& $ip_positive_hex_list;
         }
         if (ip::is_valid($ip_piece)) {
             if (strpos($ip_piece, '*') !== false) {
                 $ip_hex_list[] = ip::encode_ip(str_replace('*', '255', $ip_piece));
             } else {
                 $ip_hex_list[] = ip::encode_ip($ip_piece);
             }
         } elseif (preg_match('/^([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})[ ]*\\-[ ]*([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})$/', $ip_piece, $ip_match)) {
             foreach (ip::encode_ip_range($ip_match[1], $ip_match[2]) as $ip_range_hex_item) {
                 $ip_hex_list[] = $ip_range_hex_item;
             }
         }
     }
     $positive_conditions = array();
     foreach ($ip_positive_hex_list as $hex_ip) {
         if (preg_match('/(ff\\.)|(\\.ff)/is', chunk_split($hex_ip, 2, '.'))) {
             $value = str_replace('.', '', preg_replace('/(ff\\.)|(\\.ff)/is', '%', chunk_split($hex_ip, 2, "."))) . "'";
         } else {
             $value = $hex_ip;
         }
         $positive_conditions[] = $this->_build_positive_condition('sslog.ip', $value);
     }
     $negative_conditions = array();
     foreach ($ip_negative_hex_list as $hex_ip) {
         if (preg_match('/(ff\\.)|(\\.ff)/is', chunk_split($hex_ip, 2, '.'))) {
             $value = str_replace('.', '', preg_replace('/(ff\\.)|(\\.ff)/is', '%', chunk_split($hex_ip, 2, "."))) . "'";
         } else {
             $value = $hex_ip;
         }
         $negative_conditions[] = $this->_build_negative_condition('sslog.ip', $value);
     }
     $condition = $this->_combine_positive_negative_conditions($positive_conditions, $negative_conditions);
     if ($condition) {
         $this->filter_conditions[] = ' AND ( ' . $condition . ' ) ';
     }
 }
 function set_ip_filter($ip_string)
 {
     $ip_positive_hex_list = array();
     $ip_negative_hex_list = array();
     if (!($ip_string_list = $this->_parse_input_string($ip_string))) {
         return;
     }
     foreach ($ip_string_list as $ip_piece) {
         //we make a temp link with $ip_hex_list
         if (substr($ip_piece, 0, 1) == '!') {
             $ip_piece = substr($ip_piece, 1);
             $ip_hex_list =& $ip_negative_hex_list;
         } else {
             $ip_hex_list =& $ip_positive_hex_list;
         }
         $ip_piece = str_replace('*', '255', $ip_piece);
         if (ip::is_valid($ip_piece)) {
             $ip_hex_list[] = ip::encode_ip($ip_piece);
         } elseif (preg_match('/^([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})[ ]*\\-[ ]*([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})$/', $ip_piece, $ip_match)) {
             foreach (ip::encode_ip_range($ip_match[1], $ip_match[2]) as $ip_range_hex_item) {
                 $ip_hex_list[] = $ip_range_hex_item;
             }
         }
     }
     $positive_conditions = array();
     foreach ($ip_positive_hex_list as $hex_ip) {
         $hex_ip = $this->_process_ip_255_segments($hex_ip);
         $positive_conditions[] = $this->_build_positive_condition('sslog.ip', $hex_ip);
     }
     $negative_conditions = array();
     foreach ($ip_negative_hex_list as $hex_ip) {
         $hex_ip = $this->_process_ip_255_segments($hex_ip);
         $negative_conditions[] = $this->_build_negative_condition('sslog.ip', $hex_ip);
     }
     $condition = $this->_combine_positive_and_negative_conditions($positive_conditions, $negative_conditions);
     if ($condition) {
         $this->filter_conditions[] = ' AND ( ' . $condition . ' ) ';
     }
 }