#!/usr/local/bin/perl -I../lib use strict; use TH::Debugger; use TH::Template; use TH::Auth; use TH::DB; use URI::Escape; use TH::CGI; use TH::FileAdmin; my $cgi= new TH::CGI; my (%in,%exec); foreach my $param($cgi->param()){ $in{$param}=$cgi->param($param); $exec{$param}=$in{$param}; } print $cgi->header; unless ($in{article}){ exit print "No article"; } unless ($in{class}){ exit print "No class"; } my ($article_dir,$article_file)=split(/\//,$in{article}); my $is_archive = 0; if(($exec{class} eq 'articles') || ($exec{'class'} eq 'hot_topics')){ if($article_file =~ /^([\d]{4})/){ my $article_year = $1; my ($now_sec,$now_min,$now_hour,$now_mday,$now_mon,$now_year,$now_wday,$now_yday,$now_isdst) =localtime(time()); $now_year += 1900; if($article_year < $now_year){ $is_archive = 1; } } } my $fa=new FileAdmin(\%exec,$cgi,'','',$exec{class},$article_dir,$is_archive); $fa->{PATH}="data/$exec{class}"; my $templater=new Template(\%exec,$cgi); $fa->get_kids($article_dir); $fa->set_em_display_names($article_dir); $exec{cat_name}=$fa->{CAP_NAMES}->{$article_dir}; $exec{article_contents}=$fa->fetch_article_contents($article_file,$article_dir); my @kids=sort {$fa->{RAW_DATE}->{$article_dir}->{$b} cmp $fa->{RAW_DATE}->{$article_dir}->{$a}} @{$fa->{KIDS}->{$article_dir}}; foreach my $kid(@kids){ if ($kid eq $article_file){ $exec{article_title}=$fa->{TITLE}->{$article_dir}->{$kid}; next; } my $filename="view_article.cgi?class=$exec{class}&article=$article_dir/$kid"; $exec{sibs}.= qq|
  • $fa->{TITLE}->{$article_dir}->{$kid}
  • |; } if(! $is_archive){ $fa->set_em_display_names($exec{class}); if($exec{class} ne 'newsletter_back_issues'){ $exec{sibs}.= qq|
  • For more articles, see the $fa->{CAP_NAMES}->{$exec{class}} ARCHIVE
  • |; } } $exec{'page_title'}=$exec{article_title}; $exec{'page_title'} =~ s@<[^>]+>@@g; my $template='view_article.html'; $templater->jam_page($template);; $exec{content}=$templater->evaluate; foreach my $class('newsletter_back_issues','articles','hot_topics','search'){ if ($class eq $exec{class}){ $exec{bullets}->{$class}='class="sidenav_selected"'; } else{ $exec{bullets}->{$class}=""; } } $exec{nav_on}= $exec{class}; $exec{header}="Message Center"; $exec{sub_header}=qq||; my $template="main_articles.html"; $templater->jam_page($template); print $templater->evaluate;