2 <%require('whois/whois') %>
3 <div id="title-header">
4 <span class="header">Quickvote</span>
5 <span class="subheader">Voters</span>
8 <div class="clear-div"></div>
10 <%= @map.div(:width => 550, :height => 400) %>
12 <table class="voterbox">
15 <th>Organization Name</th>
17 <% for voter in @election.voters %>
18 <% next unless voter.voted? %>
21 <% raise ArgumentError.new, "Local Server" if voter.ipaddress == "127.0.0.1" %>
22 <% raise ArgumentError.new, "XML-RPC Voter" if voter.ipaddress == "XMLRPC Request" %>
23 <% # Test for intranet addresses to avoid untimely DNS timeouts.
24 # Of course the last regex is horrible; matches a few extra IP's that aren't intranet
25 raise ArgumentError.new, "Intranet: #{voter.ipaddress}" if voter.ipaddress =~
26 /^192\.168/ or voter.ipaddress =~ /^10\./ or voter.ipaddress =~ /^169\.254/ or
27 voter.ipaddress =~ /^172\.[1-3]/
30 if defined? Cache and w=Cache.get("WHOIS:#{voter.ipaddress}")
32 w= Whois::Whois.new(IPAddr.new(voter.ipaddress),true)
34 Cache.set("WHOIS:#{voter.ipaddress}", w)
36 w= Whois::Whois.new(IPAddr.new(voter.ipaddress),true)
41 <%=h((w.host == nil or w.host.empty?) ? voter.ipaddress : w.host.reverse.slice(0,30).reverse)%>
44 <%org=(w.all.grep(/^(OrgName|org-name)/)[0] or "").sub(/^(OrgName|org-name)\:/,'').strip+" - "+ (w.all.grep(/^(NetName|netname)/)[0] or "").sub(/^(NetName|netname)\:/,'').strip %>
45 <% if org =~ /asdfasdf/ %>
46 <%= "No additional information" %>
51 <% rescue ArgumentError => err %>
55 <% rescue NoMethodError %>