$c::sect{$section}[0] headlines ); $bg = "#FFFCE9"; for($n=0;$n $basket[$n][0] $basket[$n][5] $post_date ); } $output .= qq( ); $output .= &c::search_box(); ###### $Template_file = "/home/radish/www/htdocs/stories/tpl_stories.html"; $tpl = HTML::Template->new( type => 'filename', source => $Template_file, die_on_bad_params => 0, ); $tpl->param( menu => '', skyscraper => '', story => $output, list => 1, ); print $tpl->output; ###### } ################### sub display { #$permanently_public = &c::public_check($data{'id'}); $permanently_public = 1; $disp_id = $data{'id'}; my ($f,$links); #+++++++++++++++++++++++++++++++++ my $sth = $dbh->prepare('select body,section,jd,id from qco where id=?'); $sth->execute($disp_id); while(@data = $sth->fetchrow_array) { $body = $data[0]; $body =~ s/ / /g; $body =~ s/

/

/g; $story{'section'} = $data[1]; $story{'jd'} = $data[2]; $story{'id'} = $data[3]; } $sth->finish; #+++++++++++++++++++++++++++++++++ for(@c::columns){ ($a,$story{$_},$b) = ($body =~ m/()(.*)()/); } ($a,$story{'photo_id'},$b) = ($body =~ m/( )(.*)()/); @datestuff = split("Print publication date: ",$story{'date'}); if(!$datestuff[1]){ @datestuff = split("Print publication date: ",$story{'date'}); } $print_date = &c::get_reformatted_date($datestuff[1]); $story{'date'} =~ s^$datestuff[1]^$print_date^; $story{'date'} = qq( $story{'date'} ); @loop = &assign_photo_info(%story); unless(!$story{'colcredit'}){$story{'colcredit'} = qq( );} @imgs=($story{'body'} =~ m|src\s*=\s*\"([^\"]+)\"|ig); #for(@imgs){$story{'body'} =~ s/$_/\L$_/g} $story{'body'} =~ s/^ //; $hcolor = "#333E79"; $hfontcolor = "#ffffff"; #highlight query in content @query_words = &c::get_query_words($data{'query'}); for(@query_words){ $story{'body'} = &c::highlight_content($_,$story{'body'}); } #$output = qq( $date

$head $byline); if($phot){ $output .= &format_photo(%story); } else{ %ads = &c::get_ads; } if($story{'logo'}){ $output .= qq(

$ads{'top_ad'} ); } elsif(($story{'colcredit'}) && ($story{'photo'} eq ".jpg")){ $output .= qq( $story{'colcredit'} $ads{'top_ad'} ); } else{ $output .= qq($ads{'top_ad'}) if(($story{'photo'} eq ".jpg") || ($story{'photo'} eq ".gif")); } $output .= qq($story{'body'} $story{'copyright'} ); if($story{'section'} eq "obi"){ $obi_dir = &c::get_obi_dir($story{'jd'}); $output =~ s^ This story is available to non-subscribers for a limited time. For instant access to all published stories, including The Dispatch and Rock Island Argus archives, click here.



); #} #$print_link = qq(Printer-friendly Page); if($data{'print'}){ $Template_file = "/home/radish/www/htdocs/stories/tpl_qco_print_stories.html"; } else{ $Template_file = "/home/radish/www/htdocs/stories/tpl_stories.html"; } $tpl = HTML::Template->new( type => 'filename', source => $Template_file, die_on_bad_params => 0, ); $tpl->param( print_link => $print_link, menu => '', skyscraper => '', story => $output, date => $story{'date'}, headline => $story{'head'}, byline => $story{'byline'}, related_stories => &get_related_stories, display_ad_bot => $ads{'bot_ad'}, storyid => $disp_id, comments => 1, comment_sub => ($data{'comment_sub'}?"&comment_sub=".$data{'comment_sub'}:""), ); print $tpl->output; ###### c::increment_clicks($disp_id,'clicks_open'); } ########## sub assign_photo_info{ my @loop; if($story{'photo_id'}){ $story{'photo_id'} =~ s/\,/ /g; @photoids = split(" ",$story{'photo_id'}); foreach $photoid(@photoids){ $sql = qq(select pic_name,folder,photographer,cutline,public,keywords from photog where id=$photoid); my $sth = $dbh->prepare($sql); $sth->execute; while(@data = $sth->fetchrow_array) { my %rows; $rows{'photo'} = $data[0]; $rows{'photofolder'} = $data[1]; $rows{'photocredit'} = $data[2]; $rows{'photocaption'} = $data[3]; $rows{'public'} = $data[4]; $rows{'keywords'} = $data[5]; if($rows{'keywords'} =~ /GRAPHIC/){ $rows{'graphic'} = 1; } %rows = &assign_photo_vars(%rows); push (@loop,\%rows); } } $phot = 1; } else{ $story{'photo'} = "$story{'photo'}.jpg"; $story{'photo'} =~ s/ //g; $story{'photofolder'} =~ s/ //g; if(($story{'photo'} ne ".jpg")&&($story{'photo'} ne ".gif")){ $phot = 1; #we have to see if public can see subfolder pics $subfoldyr = "%$story{'photofolder'}%"; $imgnyme = $story{'photo'}; $imgnyme = substr($imgnyme, 0, -4); $imgnyme = "%$imgnyme%"; my $sth = $dbh->prepare('select public,keywords from photog where (folder like ?) and (pic_name like ?)'); $sth->execute($subfoldyr,$imgnyme); while(@data = $sth->fetchrow_array) { $story{'public'} = $data[0]; $story{'keywords'} = $data[1]; } $sth->finish; } $rows{'photo'} = $story{'photo'}; $rows{'photofolder'} = $story{'photofolder'}; $rows{'photocredit'} = $story{'photocredit'}; $rows{'photocaption'} = $story{'photocaption'}; $rows{'public'} = $story{'public'}; $rows{'keywords'} = $story{'keywords'}; %rows = &assign_photo_vars(%rows); push(@loop,\%rows); } return @loop; } ############ sub format_photo{ %story = @_; if($story{'section'} eq "soc"){ $output .= qq( $story{'photo'} ); } elsif(($story{'photo'} ne ".jpg") && ($story{'photo'} ne ".gif")){ $Template = "/home/radish/www/htdocs/stories/photobox.tpl"; $tpl = HTML::Template->new( type => 'filename', source => $Template, die_on_bad_params => 0, ); $tpl->param( colcredit => $story{'colcredit'}, storyid => $story{'id'}, photoloop => \@loop, top_ad => $ads{'top_ad'}, ); return $tpl->output; } } ########## sub assign_photo_vars { %rows = @_; $rows{'mor_link'} = qq(

More Quad Citians in Kuwait Photos ); my @fldr_stuff; @fldr_stuff = &c::get_week_dir($rows{'photofolder'}); $rows{'weekdir'} = $fldr_stuff[0]; if($fldr_stuff[1]){ if($rows{'public'} eq "a"){ if($rows{'photofolder'} !~ m/gulf/){ $rows{'mor_link'} = qq( More photos from this shoot ); } else{ $rows{'mor_link'} = qq(

More Quad Citians in Kuwait Photos ); } } else{ $rows{'mor_link'} = qq(); } } else{ $rows{'mor_link'} = qq() unless($story{'section'} eq "flk"); } $rows{'photo_gif'} = $rows{'photo'}; $rows{'photo_gif'} =~ s/.jpg/.gif/i unless $rows{'keywords'} =~ /GRAPHIC/; $img_call = get("http://photos.qconline.com/mednails/$fldr_stuff[0]/$rows{'photofolder'}/$rows{'photo_gif'}"); my @img_dims; @img_dims = &c::img_siz($img_call,200); %ads = &c::get_ads($img_dims[1]); unless($rows{'public'} eq "x"){$rows{'photo_link'} = 1} return %rows; } ########## sub get_related_stories { if($story{'related_stories'}){ $story{'related_stories'} =~ s/\,/ /g; @related_ids = split(" ",$story{'related_stories'}); my @loop; for(@related_ids){ $sql = qq(select headline,date from qco where id=$_); my $sth = $dbh->prepare($sql); $sth->execute; while(@data = $sth->fetchrow_array){ my %rows; $rows{'headline'} = $data[0]; $rows{'date'} = $data[1]; $rows{'id'} = $_; push (@loop,\%rows); } } $rTemplate = "/home/radish/www/htdocs/stories/related_stories.tpl"; $rtpl = HTML::Template->new( type => 'filename', source => $rTemplate, die_on_bad_params => 0, ); $rtpl->param( headlines => \@loop, ); return $rtpl->output; } }