<?
function __autoload_my_classes( $classname ){
  $q = explode( '\\' , $classname );
  $c = array_pop( $q );
  $f = 'autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
  if ( $c == 'Savant3' )
  {
    require_once 'autoload/Savant3.php';
    return true;
  }
  if ( $c == 'Securimage' )
  {
    require_once 'resources/securimage/securimage.php';
    return true;
  }
  if ( file_exists( $f ) )
    require_once( $f );
}

spl_autoload_register( '__autoload_my_classes' );

define( 'OPD_DIR' , 'autoload/' );
require( OPD_DIR . 'opd.class.php' );
include 'files/config.php';
date_default_timezone_set('Europe/Warsaw');

session_start();

$db = opdClass::create(
                        array(
                            'dsn' => 'mysql:host=' . $database['host'] . ';dbname=' . $database['name'],
                            'user' => $database['user'] ,
                            'password' => $database['password'] ,
                            'cache' => 'Temp/' ,
                            'debugConsole' => false
                            )
                      );
$db -> query('SET NAMES utf8');

$cache      = new \FileCache;
$securimage = new \Securimage;

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=8" >
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body onLoad="javascript: awindow.print()">
<div style='margin:0 auto; width:620px;'>
<?php
	/* drukowanie artykułu */
	$id       = \System::formGetInt( 'art' );
	$article 	= \article\FArticle::loadArticle( $id );
	echo $article -> drawPrint();
?>
</div>