<?php

if ( ! @include_once( './mainfile.php' ) ) { exit( '!! INCLUDE ERROR. ACCESS DENIED !!' ); }
error_reporting( _E_VALUE );


/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | myPHPNuke Version 188_8 RC2                                          |
// +----------------------------------------------------------------------+
// | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html              |
// +----------------------------------------------------------------------+
// | Support: http://myphpnuke.com/                                       |
// +----------------------------------------------------------------------+
// | Author: myPHPNuke Dev Team                                           |
// +----------------------------------------------------------------------+
// | Copyright: © 2001-2004 myPHPNuke Dev Team                            |
// +----------------------------------------------------------------------+
// $Id: print.php,v 1.9.2.2 2004/04/18 12:45:44 ajvwaay Exp $




/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)            */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/


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


function PrintPage($sid)
{
    global $site_logo, $sitename, $site_font, $datetime, $mpnTables;
    $result=mysql_query("select title, time, hometext, bodytext, topic, notes from ".$mpnTables['stories']." where sid=$sid");
    list($title, $time, $hometext, $bodytext, $topic, $notes) = mysql_fetch_row($result);
    $result2=mysql_query("select topictext from ".$mpnTables['topics']." where topicid=$topic");
    list($topictext) = mysql_fetch_row($result2);

    // Kiril: Start New Sanitizer

    $sanity_ary = compact( 'title', 'hometext', 'bodytext', 'notes', 'topictext' );
    $_SERVER['SAN'] -> slashIT( $sanity_ary );
    extract( $sanity_ary );

    // Adjust Formatting

    if ( $_SERVER['F_LIB'] -> checkPostDate( $time ) )
    {
        $slice_ary = array_slice( $sanity_ary, 1, 3 );
        $_SERVER['SAN'] -> sanitizeLegacyContent( $slice_ary );
    }
    else
    {
        $slice_ary = array_slice( $sanity_ary, 1, 3 );
        $_SERVER['SAN'] -> adjustFormat( $slice_ary, 3, 10 );
    }

    extract( $slice_ary );
    unset( $sanity_ary, $slice_ary );

    // End New Sanitizer

    $time = formatTimestamp($time);

    // Start Output

    echo $_SERVER['F_LIB'] -> generateSAHeader( 'mpnprint', 'mpn_print.css', 'screen,print', $title );

    echo "<body>\n";

    echo "<h1>$title</h1>\n";
    echo "<h2>" . translate( 'A' ) . " $sitename " . translate( 'Article' ) . "</h2>\n";
    echo "<h3>" . _MPN_ROOT_URI . "</h3>\n";
    echo "<br /><br />\n";

    echo "<p class='info'>\n";

        echo "<b>".translate("Date:")."</b> $datetime\n";
        echo "<br />\n";
        echo "<b>".translate("Topic:")."</b> $topictext\n";

    echo "</p>\n";

    echo "<hr /><br />\n";

    echo "<div class='content'>\n";

        echo $hometext;

        echo "<br /><br />\n";

        echo $bodytext;

        echo "<br /><br />\n";

        echo $notes;

    echo "</div>\n";

    echo "<br /><hr /><br />\n";

    echo "<div class='footer'>\n";

        echo "".translate("This article comes from")." $sitename<br />
        <a href=\"" . _MPN_ROOT_URI . "\">" . _MPN_ROOT_URI . "</a><br /><br />
        ".translate("The URL for this story is:")."<br />
        <a href=\"" . _MPN_ROOT_URI . "article.php?sid=$sid\">" . _MPN_ROOT_URI . "article.php?sid=$sid</a>\n";

    echo "</div>\n";

    echo "</body></html>\n";

}

PrintPage($sid);

?>
