#!/usr/bin/perl use strict; use FFI::Setup; use FFI::CommonLib; use Data::Dumper; &main; sub main { # for some reason on 404 internal redirects the form doesn't always get parsed correctly my $form = &FFI::CommonLib::get_cgi_vars({input => ($ENV{REQUEST_URI} =~ /\?(.+)$/) }); my $host = $ENV{HTTP_HOST}; # some subdomains (e.g., club.alt.com) are linked to affiliate ids my $GLOBAL_TEMP=package_setup('GlobalLib', $form); if (exists $ENV{SESSION} && ref $ENV{SESSION} && !$ENV{SESSION}->get('anon')) { return FFI::CommonLib::redirect($GLOBAL_TEMP,'/p/main.cgi'); } foreach my $sub (keys %{$GLOBAL_TEMP->{SUBDOMAIN_AFFILIATE_MAPS}}) { if ($host =~ /^$sub\./i) { $form->{pid} = $GLOBAL_TEMP->{SUBDOMAIN_AFFILIATE_MAPS}{$sub}; } } my $GLOBAL=package_setup('GlobalLib', $form); if ($GLOBAL->{SITE} eq 'cams' && $ENV{REDIRECT_STATUS} == 404) { my ($model) = $ENV{REQUEST_URI} =~ m/^\/([a-z0-9]+)/i; if ($model ne '' ) { my $d = $GLOBAL->load_stream_info({ stream => $model, no_random => 0 }); if (ref($d) && defined $d->{online}) { my $url = $GLOBAL->link({ url => 'cams/view.cgi', args => "action=bio&stream=$model", no_print => 1 }); return &FFI::CommonLib::redirect($GLOBAL,$url); } } } if ( $host =~ /(affiliates|webmasters?)\.streamray\.com/ || $host =~ /(www|webmasters?)\.legendarylars\.com/ ) { return &FFI::CommonLib::redirect($GLOBAL,$GLOBAL->link( { url => 'partners/main.cgi', no_print => 1, args => 'site=cams&pid=' . $GLOBAL->{PID} } )); } if ( index($host,'banners') > -1 ) { return &FFI::CommonLib::redirect($GLOBAL,"http://$host/banners/index.cgi"); } if ( index($host,'messenger') > -1 ) { return &FFI::CommonLib::redirect($GLOBAL,"http://$host/go/page/flash_imc.html"); } # Only do this translation if http://cash.domain... not any random cobrand that happens to have "cash" in the name unless ($GLOBAL->{DOMAIN} =~ /cash/ ) { if ($host =~ m|://cash\.| ) { return &FFI::CommonLib::redirect($GLOBAL,"http://$GLOBAL->{DOMAIN}/cash"); } } if ($GLOBAL->{SITE} eq 'grad') { return &FFI::CommonLib::redirect($GLOBAL,$GLOBAL->link({url=>'grad/main.cgi', args=>'start=1', no_print=>1})); } # this would also catch ppm since there was no ^ or $ in the pattern if ($GLOBAL->{SITE} =~ /^(lmp|lmgp|lmnp|pp|ecards|xcards|fp)$/) { my $link_co = '?'; my $count = 0; foreach my $k (keys %{$form}) { if ($count) { $link_co .= "\&"; } $link_co .= "$k=$$form{$k}"; $count++; } if( index($GLOBAL->{SITE},'lm') == 0 ) { return &FFI::CommonLib::redirect($GLOBAL,$GLOBAL->link({url=>'photovote/main.cgi', args=>"$link_co", no_print=>1})); } elsif ( $GLOBAL->{SITE} eq 'pp' ) { return &FFI::CommonLib::redirect($GLOBAL,$GLOBAL->link({url=>'postpic/index.cgi', args=>"$link_co", no_print=>1})); } elsif ( index($GLOBAL->{SITE},'cards') >= 0 ) { return &FFI::CommonLib::redirect($GLOBAL,$GLOBAL->link({url=>'cards/cards.cgi', args=>"$link_co", no_print=>1})); } elsif ( $GLOBAL->{SITE} eq 'fp' ) { my $handle=$$form{pageid}; my $server='friendpages.com'; my $host=$$form{host} || $ENV{HTTP_HOST}; # form for debugging $host=lc $host; $host=~s/^www\.//i; unless( $form->{pageid} ) { foreach my $domain ('friendpages.com','friendpage.com','friendspage.com','friendspages.com') { if ($host=~/(.+)\.$domain$/) { $handle ||= $1; last; } } } if ($handle) { return &FFI::CommonLib::redirect($GLOBAL,$GLOBAL->link({url=>'pages/cover.cgi', relative_no_domain=>1, args=>"pageid=$handle", no_print=>1})); } else { return &FFI::CommonLib::redirect($GLOBAL,$GLOBAL->link({url=>'page.cgi', relative_no_domain=>1, args=>'start=1', no_print=>1})); } } elsif ( $GLOBAL->{SITE} eq 'astro') { return &FFI::CommonLib::redirect($GLOBAL,$GLOBAL->link({url=>'page.cgi', no_print=>1})); } } if ($GLOBAL->{SITE} eq 'ffadult') { if ($host =~ /store/i) { return &FFI::CommonLib::redirect($GLOBAL,"http://www.gamelink.com/gl/main.asp?src=aff&ref=affinder"); } } elsif ($GLOBAL->{SITE} eq 'bdsm') { if ($host =~ /store/i) { return &FFI::CommonLib::redirect($GLOBAL,"http://alt.com/".$GLOBAL->link({url=>'page.cgi', args=>'p=site_store', no_print=>1})); } } if ($ENV{MOD_PERL}) { #just in case they were at aff and went to hotmatch/passion delete($GLOBAL->{COBRAND}); $GLOBAL->print_cover_page(); return; } else { return &FFI::CommonLib::redirect($GLOBAL,"http://$GLOBAL->{DOMAIN}/".$GLOBAL->link({url=>'page.cgi', no_print=>1})); } }