Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/print.php
<?php

// File: $Id: print.php,v 1.29 2001/12/08 13:47:15 cverhoef Exp $ $Name:  $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Francisco Burzi
// Purpose of file: Displays a printer friendly (story) page
// ----------------------------------------------------------------------

include 'mainfile.php';
$myts = new MyTextSanitizer; // MyTextSanitizer object

if(!isset($sid)) { exit(); }

// stop ad rob/direct link
$hpurl = strtolower($pnconfig['nukeurl']);
$httpreferer = strtolower(getenv("HTTP_REFERER"));
if (strpos($httpreferer, $hpurl)!=0 || strpos($httpreferer, $hpurl) === false) {
    header("Location: $pnconfig[nukeurl]/modules.php?op=modload&name=News&file=article&sid=$sid");
    exit;
}

function PrintPage($sid) {
    global $datetime, $dbconn, $myts, $pnconfig, $pntable;

    // grab the actual story from the database
    $column = &$pntable['stories_column'];
    $result = $dbconn->Execute("SELECT $column[title],
                                     $column[time],
                                     $column[hometext],
                                     $column[bodytext],
                                     $column[topic],
                                     $column[notes]
                              FROM $pntable[stories] where sid=$sid");
    list($title, $time, $hometext, $bodytext, $topic, $notes) = $result->fields;

    // Increment the read counter
    $column = &$pntable['stories_column'];
    $dbconn->Execute("UPDATE $pntable[stories] SET $column[counter]=$column[counter]+1 WHERE $column[sid]=$sid");

    // grab the topictext for the story
    $column2 = &$pntable['topics_column'];
    $result2 = $dbconn->Execute("SELECT $column2[topictext] from $pntable[topics] where $column2[tid]=$topic");
    list($topictext) = $result2->fields;

    formatTimestamp($time);
    $title = $myts->makeTareaData4Show($title);
    $hometext = $myts->makeTareaData4Show($hometext);
    $bodytext = $myts->makeTareaData4Show($bodytext);
    $notes = $myts->makeTareaData4Show($notes);

    $cWhereIsPerso = WHERE_IS_PERSO;
    
    if ( !(empty($cWhereIsPerso)) )
        { include("modules/NS-Multisites/print.inc.php"); }
    else
        {

    if(is_user($user)) {
        $user2 = base64_decode($user);
        $cookie = explode(":", $user2);
        if($cookie[9]=="") $cookie[9]=$pnconfig['Default_Theme'];
        if(isset($theme)) $cookie[9]=$theme;
        if(!$file=@opendir("themes/$cookie[9]")) {
        $ThemeSel = $pnconfig['Default_Theme'];
        } else {
        $ThemeSel = $cookie[9];
        }
        } else {
        $ThemeSel = $pnconfig['Default_Theme'];
        }

    }

    echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"
        ."<html>"
        ."<head><title>$pnconfig[sitename]</title>";

    if (defined("_CHARSET") && _CHARSET != "") {
        echo "<META HTTP-EQUIV=\"Content-Type\" ".
            "CONTENT=\"text/html; charset="._CHARSET."\">\n";
    }

    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$themesarein."themes/$ThemeSel/style/style.css\">";
    echo "<style type=\"text/css\">"
        ."<!--"
        .".print {  color: #000000; background-color: #FFFFFF}"
        ."-->"
        ."</style>";
    echo "</head>"
    ."<body class=\"print\" bgcolor=\"#FFFFFF\" text=\"#000000\">";
    echo "<center><table border=\"0\"><tr><td><table border=\"0\" width=\"640\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#FFFFFF\">";
    echo "<tr><td>"
    ."<table border=\"0\" width=\"640\" cellpadding=\"20\" cellspacing=\"1\" bgcolor=\"#FFFFFF\">"
        ."<tr><td align=\"center\">"
    ."<img src=\"".WHERE_IS_PERSO."images/$pnconfig[site_logo]\" border=\"0\" alt=\"\">"
        ."<br><br>"
    ."<font class=\"pn-title\">$title</font><br>"
    ."<font class=\"pn-sub\">"._DATE." $datetime<br>"._TOPIC." $topictext</font>"
        ."<br><br>"
        ."</td></tr>"
        ."<tr><td>"
    ."<font class=\"pn-normal\">"
    ."$hometext<br>";

    if ($bodytext != "") {
    echo "$bodytext<br>";
    }
    if ($notes != "") {
    echo "$notes<br>";
    } else {
    echo "<br>";
    }

    echo "</font>"
    ."</td></tr>"
    ."<tr><td align=\"center\">"
    ."<font class=\"pn-normal\">"
    .""._COMESFROM." $pnconfig[sitename]<br>"
    ."<a class=\"pn-normal\" href=\"$pnconfig[nukeurl]\">"
    ."$pnconfig[nukeurl]"
    ."</a>"
    ."<br><br>"
    .""._THEURL.""
    ."<br>"
    ."<a class=\"pn-normal\" href=\"$pnconfig[nukeurl]/modules.php?op=modload&amp;name=News&amp;file=article&amp;sid=$sid\">"
    ."$pnconfig[nukeurl]/modules.php?op=modload&amp;name=News&amp;file=article&amp;sid=$sid"
    ."</a>"
    ."</font>"
    ."</td></tr>"
    ."</table></td></tr></table>"
    ."</td>"
    ."</tr>"
    ."</table>"
    ."</center>"
    ."</body>"
    ."</html>";

}

PrintPage($sid);

?>
Return current item: ProNuke. Postnuke To Oracle