#!/usr/bin/perl -- #-------------------------------------------------------------------------------------# # # # ###### # ### ######### # ## ## # ### ### # ###### # ### # #* ##### ### ### # ## ## # #### # ### ### # ## # # # # # ### ### # ## # # # # ## ### ### # # # #- PRINT IT addon by: -# #- -# #- Kristjan Kolde - kolde@hot.ee - ICQ: 111059060 - http://www.npfactory.f2s.com/ -# #- -# #- Check out NewsPro Factory, the best place for NP users/addons/mods/tutorials and -# #- much more. -# #-------------------------------------------------------------------------------------# # For instructions please read the readme file or dowload it at my addons page. # #-------------------------------------------------------------------------------------# $VNSub = 'DoPrinterFriendlyHTML'; # Subrutin for the news, usually should be # # DoPrinterFriendlyHTML # $VNTmpl = 'printit.tmpl'; # Template file for printing (normal printit.tmpl)# $abspath= '.'; # Absoulte path to NewsPro if in same dir, leave "." # #-------------------------------------------------------------------------------------# # You should not edit nothing belove #-------------------------------------------------------------------------------------# eval { &main; }; sub DoPrinterFriendlyHTML { $newshtml = qq~ ~; if ($newscat) { $newshtml .= qq~ $newscat - ~; } $newshtml .= qq~ $newssubject

Enviada por: $newsname [$newsemail] el $newsdate
PUERTO MADRYN

~; if ($newssnippit) { $newshtml .= qq~\n$newssnippit~; } if ($newssnippit & $newstext) {$newshtml .= qq~\n

~;} if ($newstext) { $newshtml .= qq~\n$newstext~; } $newshtml .= qq~\n
~; } sub main { # Microsoft servers. Try and be compatible... if ($IIS != 2) { if ($IIS == 0) { if ($ENV{'SERVER_SOFTWARE'} =~ m!IIS!) { $IIS = 1 } } if (($IIS) && ($0 =~ m!(.*)(\\|\/)!)) { chdir($1); } if ($IIS == 1) { print "HTTP/1.0 200 OK\n"; } } # That's over! # Server problem workaround #1 if ($abspath) { push(@INC, $abspath); } require "npconfig.pl"; require "ndisplay.pl"; require "nplib.pl"; ReadForm(); SubmitFormFields(); push(@formfields, 'newstext'); unless ($scripturl) { $scripturl = &GetScriptURL; } ReadConfigInfo(); if (query_string() =~ /^print/) { &ShowNews; } } sub ShowNews { print header(); local ($content) = ""; $OnlyNewNews = 0; query_string() =~ /^print(\S+)/; $newsparam = $1; if ($newsparam ne "") { &loadND; $newsnum = @NewsData; if ($newsparam eq "all") { $newsstart = 0; $newsend = $newsnum - 1; } elsif ($newsparam =~ /item(\d+)/) { $newsstart = $1; $newsend = $newsstart; } elsif ($newsparam =~ /(\S+)/) { $nid = $1; $nid =~ s/\_/\,/g; $nid =~ s/[^\d,]//g; $newsstart = $NewsID{$nid}; $newsend = $newsstart; } else { $newsparam =~ /start(\d+)end(\d+)/; $newsstart = $1; $newsend = $2; } if (($newsstart < 0) || ($newsstart >= $newsnum) || ($newsend < $newsstart) || ($newsend >= $newsnum) || !defined $newsstart) { } $newscount = $newsend; while ($newscount >= $newsstart) { &getNDvar($newscount); $newsnum = $newscount; $DynamicPage = 1; &{$VNSub}; $content .= $newshtml; $newscount--; } if ($newsstart == $newsend) { $gptitle = $newssubject; } &GenPage($gptitle, $content); } } sub GenPage { my $title = shift; my $content = shift; if ($abspath) { NPopen(TMPL, "$abspath/$VNTmpl"); } else { NPopen(TMPL, "$VNTmpl"); } @tmpl = ; close(TMPL); $tmpl = join('', @tmpl); $tmpl =~ s///g; $tmpl =~ s/]+)>/${$1}/gi; $tmpl =~ s/]+)>/${\(HTMLtoText(${$1}))}/g; $tmpl =~ s/<\!--#include file\s*?=\s*?"(\S+?)"\s*?-->/${\(VNFileLoad($1))}/gi; $tmpl =~ s//$title/g; $tmpl =~ s//$newsid/g; $tmpl =~ s//$content/; $tmpl =~ s//$newscat/; $tmpl =~ s//$newscat/; $tmpl =~ s//${\(HTMLtoText($content))}/g; print $tmpl; } sub NPopen { my $handle = shift; my $path = shift; $path =~ s/([\&;\`'\|\"*\?\~\^\(\)\[\]\{\}\$\n\r])//g; open($handle, $path) || return 1; } ############### THE END #################