Ignore:
Timestamp:
10/03/2009 02:39:59 PM (3 years ago)
Author:
Acinonyx
Message:

[awmn] Fix undefined offset errors, replace correct_ip* functions with ip_to_ranges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/awmn/includes/pages/search/search_suggest.php

    r198 r207  
    44* 
    55* Copyright (C) 2006 John Kolovos <cirrus@awmn.net> 
     6* Copyright (C) 2009 Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr> 
    67* 
    78* This program is free software; you can redistribute it and/or modify 
     
    5657                        } 
    5758                } elseif (is_ip($q, FALSE)) { 
    58                         $where = '(ip_ranges.ip_start >= '.ip2long(correct_ip_min($q, TRUE, 1)).' AND ip_ranges.ip_start <= '.ip2long(correct_ip_max($q, TRUE, 1)).") OR ". 
    59                                                 '(ip_ranges.ip_start >= '.ip2long(correct_ip_min($q, TRUE, 2)).' AND ip_ranges.ip_start <= '.ip2long(correct_ip_max($q, TRUE, 2)).") OR ". 
    60                                                 '(ip_ranges.ip_start >= '.ip2long(correct_ip_min($q, TRUE, 3)).' AND ip_ranges.ip_start <= '.ip2long(correct_ip_max($q, TRUE, 3)).")"; 
     59                        $where = "("; 
     60                        $s_ranges = ip_to_ranges($q,FALSE); 
     61                        foreach ($s_ranges as $s_range) { 
     62                                $where .= "(ip_ranges.ip_start BETWEEN ".ip2long($s_range['min'])." AND ".ip2long($s_range['max']).") OR "; 
     63                        } 
     64                        $where = substr($where, 0, -4).")"; 
    6165                        $this->tpl['ip_search'] = $db->get( 
    6266                                                                                'ip_ranges.ip_start, nodes.id', 
Note: See TracChangeset for help on using the changeset viewer.