<?php
// -----------------------------------------------------------------------
//
// $Id: read.php 170 2012-03-30 09:55:18Z raoul $
//
// Copyright (C) 2003-2012 Raoul Proença
// License: GNU GPL version 3 (see copying.txt file)
// Website: http://www.gnew.fr/
//
// -----------------------------------------------------------------------
//
// 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 3 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.
//
// -----------------------------------------------------------------------
include('./../includes/common.php');
page_header($lang['ARTICLES_READ_TITLE']);
if (isset($_GET['article_id']))
{
$sql->query('SELECT ' . TABLE_ARTICLES . '.article_date, ' . TABLE_ARTICLES . '.article_subject, ' . TABLE_ARTICLES . '.article_text, ' . TABLE_USERS . '.user_id, ' . TABLE_USERS . '.user_name
FROM ' . TABLE_ARTICLES . ', ' . TABLE_USERS . '
WHERE ' . TABLE_ARTICLES . '.user_id = ' . TABLE_USERS . '.user_id
AND ' . TABLE_ARTICLES . '.article_id = ' . $_GET['article_id']);
$table_articles = $sql->fetch();
// Check article
if (!$table_articles['article_subject'])
{
error_template($lang['ARTICLES_READ_ERROR']);
}
else
{
$date_format = get_date_format();
$date_offset = get_date_offset();
$article_date = date($date_format, ($table_articles['article_date'] + $date_offset));
$article_text = undo_escape_sequences($table_articles['article_text']);
$template->set_file('read', 'articles/read.htpl');
$template->set_var(array('ARTICLE_RELEASE' => sprintf($lang['ARTICLES_READ_RELEASE'], $table_articles['user_id'], $table_articles['user_name'], $article_date),
'ARTICLE_SUBJECT' => $table_articles['article_subject'],
'ARTICLE_TEXT' => $article_text,
'BACK_HOME' => $lang['BACK_HOME']));
$template->parse('read');
}
}
else
{
error_template($lang['ARTICLES_READ_ERROR']);
}
page_footer();
?>