/$pod_killmozzie/gi;
# 1.75
$pod_line =~ s//$pod_killmozzie/gi;
}
# 1.75
$pod_line =~ s/\"img\//\"http:\/\/dmoz\.org\/img\//gi;
$pod_line =~ s/\"\/img\//\"http:\/\/dmoz\.org\/img\//gi;
# 1.76
$pod_line =~ s/
~;
if (!($pod_topic)) {
$pod_output="$pod_output\n";
}
if ($pod_debug) { print "Leaving: pod_amazon \n"; };
}
sub pod_read_headers {
## This function rips out all the possible parameters which could
## have been sent to this script in the cgi call. These must be
## retained in case they need to be sent to Dmoz.org
if ($pod_debug) { print "Entering: pod_read_headers \n"; };
$pod_cgi_all=$pod_q->param("all");
$pod_cgi_ax=$pod_q->param("a.x");
$pod_cgi_affiliation=$pod_q->param("affiliation");
$pod_cgi_cat=$pod_q->param("cat");
$pod_cgi_co=$pod_q->param("co");
$pod_cgi_comments=$pod_q->param("comments");
$pod_cgi_cp=$pod_q->param("cp");
$pod_cgi_description=$pod_q->param("description");
$pod_cgi_des_one=$pod_q->param("des1");
$pod_cgi_des_two=$pod_q->param("des2");
$pod_cgi_des_three=$pod_q->param("des3");
$pod_cgi_desc=$pod_q->param("desc");
$pod_cgi_direct=$pod_q->param("direct");
$pod_cgi_email=$pod_q->param("email");
$pod_cgi_emailaddr=$pod_q->param("emailaddr");
$pod_cgi_firstname=$pod_q->param("firstname");
$pod_cgi_fo=$pod_q->param("fo");
$pod_cgi_id=$pod_q->param("id");
$pod_cgi_index=$pod_q->param("index");
$pod_cgi_jsites=$pod_q->param("jsites");
$pod_cgi_jstart=$pod_q->param("jstart");
$pod_cgi_lastname=$pod_q->param("lastname");
$pod_cgi_lk=$pod_q->param("lk");
$pod_cgi_morecat=$pod_q->param("morecat");
if ($pod_dir =~ /morecat/) { $pod_cgi_morecat = 1; }
$pod_cgi_newurl=$pod_q->param("newurl");
$pod_cgi_password=$pod_q->param("password");
$pod_cgi_passverify=$pod_q->param("passverify");
$pod_cgi_reason=$pod_q->param("reason");
$pod_cgi_start = $pod_q->param("start");
$pod_cgi_search = $pod_q->param("search");
if (($pod_dir =~ /search/) && (!($pod_dir =~ /srp/))) {
$pod_trg=rindex($pod_dir, "search");
$pod_tre=index($pod_dir,"=",$pod_trg);
$pod_cgi_search=substr($pod_dir,$pod_tre+1);
}
$pod_cgi_search=~ s/\`//g;
$pod_cgi_search=~ s/\'//g;
$pod_cgi_so=$pod_q->param("so");
$pod_cgi_title=$pod_q->param("title");
$pod_cgi_tit_one=$pod_q->param("tit1");
$pod_cgi_tit_two=$pod_q->param("tit2");
$pod_cgi_tit_three=$pod_q->param("tit3");
$pod_cgi_url=$pod_q->param("url");
$pod_cgi_url_one=$pod_q->param("url1");
$pod_cgi_url_two=$pod_q->param("url2");
$pod_cgi_url_three=$pod_q->param("url3");
$pod_cgi_user=$pod_q->param("user");
$pod_cgi_username=$pod_q->param("username");
$pod_cgi_where=$pod_q->param("where");
# The following two lines allow you to pass an alternative
# inital category by passing the variable pod_debug_path
$pod_cgi_debug_dir=$pod_q->param("pod_debug_path");
if ($pod_cgi_debug_dir) { $pod_dir=$pod_cgi_debug_dir; };
if ($pod_debug) { print "Leaving: pod_read_headers \n"; };
}
sub pod_get_first_page {
## Fetch the pages from the Dmoz server, but re-write the URLs of certain
## ones so we fetch the correct page.
if ($pod_debug) { print "Entering pod_get_first_page \n"; };
my $pod_gfp_toget = 0;
$pod_cgi_search =~ s/ /+/g;
if ($pod_dir =~ /\/osearch/) {
$pod_url = "http://search.dmoz.org/cgi-bin/osearch\?search\=$pod_cgi_search";
if ($pod_cgi_start) { $pod_url = $pod_url . "&start=$pod_cgi_start"; }
if ($pod_cgi_fo) { $pod_url = $pod_url . "&fo=$pod_cgi_fo"; }
if ($pod_cgi_so) { $pod_url = $pod_url . "&so=$pod_cgi_so"; }
if ($pod_cgi_co) { $pod_url = $pod_url . "&co=$pod_cgi_co"; }
if ($pod_cgi_ax) { $pod_url = $pod_url . "&a.x=$pod_cgi_ax";}
} elsif (($pod_cgi_search) && (not($pod_cgi_jstart)) && (!($pod_cgi_morecat))) {
$pod_url = "http://search.dmoz.org/cgi-bin/search\?search\=$pod_cgi_search&a.x=$pod_cgi_ax";
} elsif (($pod_cgi_jstart > 0) && (!($pod_cgi_morecat))) {
$pod_url = "http://search.dmoz.org/cgi-bin/search\?cp=$pod_cgi_cp&search\=$pod_cgi_search&a.x=$pod_cgi_ax&jstart=$pod_cgi_jstart";
} elsif ($pod_cgi_morecat > 0) {
$pod_url = "http://search.dmoz.org/cgi-bin/search\?search\=$pod_cgi_search&a.x=$pod_cgi_ax&morecat=$pod_cgi_morecat";
} elsif ($pod_dir =~ "/searchguide.html") {
$pod_url ="http://search.dmoz.org/searchguide.html";
} elsif ($pod_dir =~ "/cgi-bin/add2.cgi") {
$pod_gfp_toget=1;
} elsif ($pod_dir =~ "/cgi-bin/update2.cgi") {
$pod_gfp_toget=2;
} elsif ($pod_dir =~ "/cgi-bin/update3.cgi") {
$pod_gfp_toget=3;
} elsif ($pod_dir =~ "/cgi-bin/apply2.cgi") {
$pod_gfp_toget=4;
} elsif ($pod_dir =~ "/cgi-bin/forgot.cgi") {
$pod_gfp_toget=5;
} elsif (($pod_dir =~ "/rdf/") && ($pod_dir =~ ".gz")) {
# Handle RDF dumps
$pod_validpage=2;
$pod_url=$pod_which_dir.$pod_dir;
} else {
$pod_url = $pod_which_dir . $pod_dir;
if ($pod_cgi_jsites) { $pod_url = $pod_url . "&jsites=$pod_cgi_jsites"; }
if ($pod_cgi_jstart) { $pod_url = $pod_url . "&jstart=$pod_cgi_jstart"; }
if ($pod_cgi_start) { $pod_url = $pod_url . "&start=$pod_cgi_start"; }
if ($pod_cgi_fo) { $pod_url = $pod_url . "&fo=$pod_cgi_fo"; }
if ($pod_cgi_so) { $pod_url = $pod_url . "&so=$pod_cgi_so"; }
if ($pod_cgi_co) { $pod_url = $pod_url . "&co=$pod_cgi_co"; }
if ($pod_cgi_search) { $pod_url = $pod_url . "&search=$pod_cgi_search"; }
if ($pod_morecat) { $pod_url = $pod_url . "&morecat=$pod_morecat"; }
}
if ($pod_gfp_toget > 0) {
$pod_url=$pod_which_dir.$pod_dir;
}
# Don't escape out the URL yet...
# Sometimes (for example, in conjunction with the search system) it
# returns 404.
# $pod_url=&pod_escape($pod_url);
if ($pod_debug) { print "Parsed URL: $pod_url \n"; };
if ($pod_validpage==0) {
# 1.90
my $rand_num = ""; srand(time ^ $$);
$rand_num = int(rand(50));
my $br_ver = "";
if ($rand_num gt 30) { $br_ver = "5";
} elsif ($rand_num lt 20) { $br_ver = "01";
} else { $br_ver = "0"; }
my $pod_ua = LWP::UserAgent->new();
$ag_ver = "Mozilla/4.0 (compatible; MSIE 5." . $br_ver . "; Windows 98)";
$pod_ua->agent($ag_ver);
# my $pod_ua =new LWP::UserAgent;
# $pod_ua->agent("$pod_useragent");
if (defined($pod_proxy)) {
$pod_ua->proxy('http',$pod_proxy);
}
my $pod_req; my $tmp_text;
if ($pod_gfp_toget==0) {
$pod_req = new HTTP::Request('GET',$pod_url);
$pod_req->content_type('application/x-www-form-urlencoded');
} else {
$pod_req = new HTTP::Request('POST',$pod_url);
$pod_req->content_type('application/x-www-form-urlencoded');
if ($pod_gfp_toget==1) {
$tmp_text="index=$pod_cgi_index&where=$pod_cgi_where".
"&url=$pod_cgi_url&title=$pod_cgi_title&".
"description=$pod_cgi_description&email=$pod_cgi_email";
} elsif ($pod_gfp_toget==2) {
$tmp_text="lk=$pod_cgi_lk&id=&pod_cgi_id&where=$pod_cgi_where".
"&url=$pod_cgi_url";
} elsif ($pod_gfp_toget==3) {
$tmp_text="where=$pod_cgi_where&direct=$pod_cgi_direct".
"&url=$pod_cgi_url&lk=$pod_cgi_lk&id=$pod_cgi_id".
"&newurl=$pod_cgi_newurl&title=$pod_cgi_title".
"&desc=$pod_cgi_desc&emailaddr=$pod_cgi_emailaddr".
"&reason=$pod_cgi_reason";
} elsif ($pod_gfp_toget==4) {
$tmp_text="where=$pod_cgi_where&id=$pod_cgi_id&lk=$pod_cgi_lk".
"&firstname=$pod_cgi_firstname&lastname=$pod_cgi_lastname".
"&emailaddr=$pod_cgi_emailaddr&username=$pod_cgi_username".
"&password=$pod_cgi_password&passverify=$pod_cgi_passverify".
"&comments=$pod_cgi_comments&affiliation=$pod_cgi_affiliation".
"&url1=$pod_cgi_url_one&tit1=$pod_cgi_tit_one".
"&des1=$pod_cgi_des_one".
"&url2=$pod_cgi_url_two&tit1=$pod_cgi_tit_two".
"&des1=$pod_cgi_des_two".
"&url3=$pod_cgi_url_three&tit1=$pod_cgi_tit_three".
"&des1=$pod_cgi_des_three";
} elsif ($pod_gfp_toget==5) {
$tmp_text="user=$pod_cgi_user";
}
$pod_req->content($tmp_text);
}
$pod_req->header('Referer',"$pod_referer");
if ($pod_debug) {
print " URL fetching: $pod_url \n";
if ($pod_gfp_toget==0) { print "Getting... \n"; } else
{ print "POSTing... \n$tmp_text \n"; }
print " \n";
}
my $pod_res = $pod_ua->request($pod_req);
# Check the outcome of the response
$pod_base=$pod_res->base;
if ($pod_res->is_success) {
$pod_cgi_content = $pod_res -> content();
} else {
$pod_validpage=1;
$pod_status=$pod_res->status_line;
$pod_output="$pod_outputPOD encountered the following error while trying to run: $pod_status\n";
$pod_output="$pod_output Attempted retrieval URL: $pod_url\n\n";
}
} else {
# a redirect
$pod_cgi_content=$pod_url;
if ($pod_debug) {
print " Redirecting to: $pod_url \n";
}
}
if ($pod_debug) { print "Leaving: pod_get_first_page \n"; };
return $pod_cgi_content;
}
sub pod_log_search {
if ($pod_debug) { print "Entering pod_log_search \n"; };
my $pod_searchwords = shift(@_);
my $pod_month_day; my $pod_month_year; my $pod_year;
my @pod_months=('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
($pod_month_day,$pod_month_year,$pod_year)=(localtime)[3,4,5];
$pod_year+=1900;
if ($pod_month_day<10) { $pod_month_day="0$pod_month_day"; }
$datej = "$pod_month_day $pod_months[$pod_month_year] $pod_year";
open (WRITEIT, ">>$pod_logging");
flock(WRITEIT, LOCK_EX);
seek (WRITEIT, 0,2);
print WRITEIT "$datej|$pod_searchwords\n";
close(WRITEIT);
if ($pod_debug) { print "Leaving pod_log_search \n"; };
}
sub pod_international {
# Internationalization mod contributed by:
# Scott Stevenson in 1999 extra_lovin@yahoo.com
if (($pod_line =~ /%/) && ($pod_line =~///;
if ($pod_line =~ ///;
$pod_output="$pod_output";
} else {
$pod_output="$pod_output";
}
}
}
sub pod_timout {
}
1;
|