#!/usr/bin/perl use vars qw(%s %w $g_findgift_com $g_opt_ab_subs); use Data::Dumper; my $page_name = $ENV{'PATH_INFO'}; $page_name =~ s/\///g; if ($page_name eq '') { $page_name = 'HomePage'; # These "subdirectories" need to be mapped in the Apache conf file because each has several static pages below it. # If someone requests one of these directories with no page specified, it should NOT display the home page. if (($ENV{'SCRIPT_URI'} =~ m|Services/$|i) || ($ENV{'SCRIPT_URI'} =~ m|Members/$|i)) { open(F, '/www/findgift.com/html/error.html'); my @data = ; print "Content-type: text/html\n"; print "Status: 404 Not Found\n\n"; print @data; exit(0); } } #### Do test for new style static pages #### my %new_pages = ( 'Birthstones' => 1, 'Bookmarks-Upgrade' => 1, 'Crystal-Ball' => 1, 'Email-Gifts' => 1, 'FindGift-Deals' => 1, 'Flower-Meanings' => 1, 'Get-Password' => 1, 'Reset-Password' => 1, 'Gift-Idea-Bookmarks' => 1, 'Gift-Ideas' => 1, 'Gift-Registry' => 1, 'Gift-Registry-Help' => 1, 'Gift-Registry-Info' => 1, 'Gift-Wizard' => 1, 'Holidays-2008' => 1, 'Holidays-2009' => 1, 'Holidays-2010' => 1, 'Holidays-2011' => 1, 'Holidays-2012' => 1, 'Holidays-2013' => 1, 'Holidays-2014' => 1, 'Holidays-2015' => 1, 'Holidays-2016' => 1, 'Holidays-2017' => 1, 'Giftworthy-Holidays' => 1, 'HomePage' => 1, 'Login' => 1, 'Monthly-Flowers' => 1, 'Registry-Network' => 1, 'Registry-Sign-Up' => 1, 'Sign-Up' => 1, 'Zodiac' => 1, 'Additional-Resources' => 1, ); my %special_capitalizations = ( 'fg-logos' => 'FG-Logos', 'fg-history' => 'FG-History', 'terms-and-conditions' => 'Terms-and-Conditions', ); if (defined($special_capitalizations{$page_name})) { $page_name = $special_capitalizations{$page_name}; } else { $page_name =~ s/[Ff]ind[Gg]ift/FindGift/g; $page_name =~ s/^([a-z])/uc($1)/e; $page_name =~ s/(\-[a-z])/uc($1)/eg; } if (defined($new_pages{$page_name})) { require '/www/findgift.com/cgi-bin/modules/Init_Web_Env.pl'; require '/www/findgift.com/cgi-bin/pages/' . $page_name . '.pl'; &html_page_content(); exit(0); } #endif #### Not a new page, do it the old way #### require '/www/findgift.com/cgi-bin/modules/Init_Env.pl'; &bz_init_env_variables; my $query = CGI::new(); my $page_file = '/www/findgift.com/cgi-bin/pages/' . $page_name . '.pl'; #use IO::File; #my $fh = new IO::File; #$fh->open(">> /tmp/test.log") or die "myfile: $!"; #print $fh "test"; #print $fh $page_file; #$fh->close; if (-e $page_file) { require '/www/findgift.com/cgi-bin/pages/' . $page_name . '.pl'; } else { $page_name = join '-', (map {ucfirst} (split /\-/, $page_name)); $page_file = '/www/findgift.com/cgi-bin/pages/' . $page_name . '.pl'; if (-e $page_file) { require '/www/findgift.com/cgi-bin/pages/' . $page_name . '.pl'; } else { print $query->redirect("$g_findgift_com"); exit(0); } } my $member_id = &bz_check_member_cookie($query); my $path = &bz_define_path($prefix); my $meta_title = &bz_define_page_title; my $meta_description = &bz_define_page_description; my $meta_keywords = &bz_define_page_keywords; my $javascript = &bz_define_page_javascript; my $section_id = &bz_define_section_id; my $page_id = &bz_define_page_id; #### $q, $act, $mem, $reg, $sec_id, $page_id, $page_num, $price, $s_cat, $s_occ, $s_rcp, $win, $t_gifts, $amt, $search_str my $cookie = &bz_log_activity($query, 'View', $member_id, '', $section_id, $page_id); my $subpage = &bz_define_page_content($query, $member_id, $cookie); my $page; if ($subpage eq 'Custom_Page') { $page = &bz_define_page_content_custom($query, $member_id, $cookie); } else { $page = &bz_make_page($query, $member_id, $subpage, $path, $meta_title, $meta_description, $meta_keywords, $javascript); } print $page; exit(0); ########################################################### ###### S U B R O U T I N E S ###### ###########################################################