<?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: printfeature.php,v 1.14.2.3 2004/04/18 12:45:44 ajvwaay Exp $




######################################################################
# For printing feature articles
# By: Leonard Teo (leonard@planet3dart.com)
# Modification date: 31 Dec 2000
#
# http://www.planet3dart.com
#
######################################################################


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

PrintPage($artid);

/*******************************************
* Function: generateTime
* Purpose: Takes a mysql DATETIME and spits out a readable date
* dd monthname yyyy
*******************************************/
function generateTime( $timestamp ){
    global $locale;
    $year = substr($timestamp, 0, 4);
    $month = substr($timestamp, 5, 2);
    $day = substr($timestamp, 8, 2);
    setlocale (LC_TIME, "$locale");
    $time = strftime("%d %B %Y", mktime(0, 0, 0, $month, $day, $year) );
    return $time;
} //end function generateTime


/*******************************************
* Function: PrintPage
* Purpose: Prints the page
*******************************************/
function PrintPage($artid)
{
    global $site_logo, $sitename, $site_font, $datetime, $mpnTables;
    $result = mysql_query("select artid, secid, title, author, authoremail, date, content, counter from ".$mpnTables['seccont']." where artid=$artid");
    list($artid, $secid, $title, $author, $authoremail, $timestamp, $content, $counter) = mysql_fetch_row($result);

    mysql_free_result( $result );

    // Kiril: Start New Sanitizer

    $sanity_ary = compact( 'title', 'author', 'authoremail', 'content' );
    $_SERVER['SAN'] -> slashIT( $sanity_ary );
    extract( $sanity_ary );
    unset( $sanity_ary );

    if ( $_SERVER['F_LIB'] -> checkPostDate( $timestamp ) )
    {
        $_SERVER['SAN'] -> sanitizeLegacyContent( $content, NULL, FALSE, FALSE );
    }
    else
    {
        $_SERVER['SAN'] -> adjustFormat( $content, 3, 10 );
    }

    // End New Sanitizer

    // Start Output

    $subtitle = translate( 'A' ) . ' ' . $sitename . ' ' . translate( 'Section Article' );

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

    echo "<body>\n";

    echo "<h1>$title</h1>\n";
    echo "<h2>" . $subtitle . "</h2>\n";
    echo "<h3>" . _MPN_ROOT_URI . "</h3>\n";
    echo "<br /><br />\n";

    // Generate the date

    $articledate = generateTime($timestamp);

    // Print the title

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

        echo "<b>$title</b><br />";

        if ( $author != '' )
        {
            echo "<b>" . translate( 'Author' ) . ":</b> ";

            if ( $authoremail != '' )
            {
                echo "<a href=\"mailto:$authoremail\">$author</a>, ";
            }
            else
            {
                echo "$author</a>, ";
            }
        }

        echo $articledate;

    echo "</p>\n";

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

    // Make sure that the pagebreak tag is removed.
    // Instead of the pagebreak, we show an empty paragraph.

    $content = str_replace( '[pagebreak]', '', $content );

    // This is where the content goes

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

        echo $content;

    echo "</div>\n";

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

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

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

    echo "</div>\n";

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

?>
