<?php
require_once ( 'includes/application_top.php' );
@include_once ( DIR_WS_LANGUAGES . $language . '/' . FILENAME_ARTICLE_INFO);
$article_info_query_sql = "
SELECT
a.articles_id,
att.topics_id,
a.articles_date_added,
a.articles_date_available,
a.authors_id,
ad.articles_name,
ad.articles_head_title_tag,
ad.articles_head_desc_tag,
ad.articles_head_keywords_tag,
ad.articles_description,
ad.articles_url
FROM
" . TABLE_ARTICLES . " a,
" . TABLE_ARTICLES_DESCRIPTION . " ad,
" . TABLE_ARTICLES_TO_TOPICS . " att
WHERE
( a.articles_status = '1' OR a.articles_status = '2' )
AND a.articles_id = '" . (int)$_GET['articles_id'] . "'
AND ad.articles_id = a.articles_id
AND a.articles_id = att.articles_id
AND ad.language_id = '" . (int)$languages_id . "'
AND (a.articles_date_available IS NULL OR a.articles_date_available <= CURDATE() )
";
$article_info_query = tep_db_query($article_info_query_sql);
$breadcrumb->add(HEADING_TITLE, tep_href_link(FILENAME_ARTICLE_INFO, '', 'NONSSL'));
$content = CONTENT_ARTICLES;
if ( 0 < tep_db_num_rows($article_info_query) ) {
$article_info = tep_db_fetch_array($article_info_query);
tep_db_query('UPDATE ' . TABLE_ARTICLES_DESCRIPTION . " set articles_viewed = articles_viewed+1 where articles_id = '" . (int)$_GET['articles_id'] . "' and language_id = '" . (int)$languages_id . "'");
if ( DISPLAY_AUTHOR_ARTICLE_LISTING == 'true' && 0 != $article_info['topics_id'] ) {
$article_author_query_sql = "
SELECT
*
FROM
" . TABLE_AUTHORS . " au,
" . TABLE_AUTHORS_INFO . " aui
WHERE
au.authors_id = aui.authors_id
AND au.authors_id = '{$article_info['authors_id']}'";
$article_author_query = tep_db_query($article_author_query_sql);
if ( 0 < tep_db_num_rows($article_author_query) ) {
$article_author = tep_db_fetch_array($article_author_query);
$article_info['authors_name'] = $article_author['authors_name'];
$article_info['authors_url'] = tep_href_link(FILENAME_ARTICLES,'authors_id=' . $articles_author_id);
} else {
$article_info['authors_name'] = 'Unknown';
}
}
if ( 0 == $article_info['topics_id'] ) {
$smarty->assign('DISPLAY_AUTHOR_ARTICLE_LISTING', 'false');
$smarty->assign('DISPLAY_TOPIC_ARTICLE_LISTING', 'false');
$smarty->assign('DISPLAY_ABSTRACT_ARTICLE_LISTING', 'false');
$smarty->assign('DISPLAY_DATE_ADDED_ARTICLE_LISTING', 'false');
$smarty->assign('DISPLAY_ABSTRACT_ARTICLE_LISTING', 'false');
} else {
$smarty->assign('DISPLAY_AUTHOR_ARTICLE_LISTING', DISPLAY_AUTHOR_ARTICLE_LISTING);
$smarty->assign('DISPLAY_TOPIC_ARTICLE_LISTING', DISPLAY_TOPIC_ARTICLE_LISTING);
$smarty->assign('DISPLAY_ABSTRACT_ARTICLE_LISTING', DISPLAY_ABSTRACT_ARTICLE_LISTING);
$smarty->assign('DISPLAY_DATE_ADDED_ARTICLE_LISTING', DISPLAY_DATE_ADDED_ARTICLE_LISTING);
$smarty->assign('DISPLAY_ABSTRACT_ARTICLE_LISTING', DISPLAY_ABSTRACT_ARTICLE_LISTING);
}
$smarty->assign('TEXT_BY', TEXT_BY);
$smarty->assign('TEXT_TOPIC', TEXT_TOPIC);
$smarty->assign('TEXT_DATE_ADDED', TEXT_DATE_ADDED);
$smarty->assign('TEXT_ARTICLES_BY', TEXT_ARTICLES_BY);
$article_info['articles_description'] = stripslashes($article_info['articles_description']);
$article_info['articles_name'] = $article_info['articles_name'];
### MODULES
$available_modules = array(
'MODULE_CONTACT_US' => 'contact_us.php',
'MODULE_SITE_MAP' => 'site_map.php',
'MODULE_PRODUCTS_CATALOG' => 'products_catalog.php'
);
if ( is_array($available_modules) ) {
foreach ( $available_modules as $module_key => $module_file ) {
if ( stristr($article_info['articles_description'], $module_key) ) {
require_once (DIR_WS_MODULES.$module_file);
list($module_name, $module_ext) = explode('.', $module_file);
$article_info['articles_description'] = str_replace('{:'.$module_key.':}', $module_content, $article_info['articles_description']);
}
}
}
### MODULES END
if (tep_not_null($article_info['articles_url'])) {
$article_info['articles_url'] = sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($article_info['articles_url']), 'NONSSL', true, false));
}
if ( $article_info['articles_date_available'] > date('Y-m-d H:i:s') ) {
$article_info['articles_date_available'] = sprintf(TEXT_DATE_AVAILABLE, tep_date_long($article_info['articles_date_available']));
} else {
$article_info['articles_date_available'] = sprintf(TEXT_DATE_ADDED, tep_date_long($article_info['articles_date_added']));
}
if (ENABLE_ARTICLE_REVIEWS == 'true' ) {
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_ARTICLE_REVIEWS . " where articles_id = '" . (int)$_GET['articles_id'] . "' and approved = '1'");
$reviews = tep_db_fetch_array($reviews_query);
$article_info['articles_current_reviews'] = TEXT_CURRENT_REVIEWS . ' ' . $reviews['count'];
$article_info['articles_reviews_count'] = $reviews['count'];
if ( $article_info['articles_reviews_count'] <= 0 ) {
$article_info['url_reviews_write'] = tep_href_link(FILENAME_ARTICLE_REVIEWS_WRITE, tep_get_all_get_params());
} else {
$article_info['url_reviews'] = tep_href_link(FILENAME_ARTICLE_REVIEWS, tep_get_all_get_params());
}
}
$smarty->assign('_ARTICLE', $article_info);
$smarty->assign('HEADER_TITLE', $article_info['articles_name']);
$smarty->assign('IMAGE_BUTTON_WRITE_REVIEW', IMAGE_BUTTON_WRITE_REVIEW);
$smarty->assign('IMAGE_BUTTON_REVIEWS', IMAGE_BUTTON_REVIEWS);
$page_content = $smarty->fetch('articles_info.tpl' );
} else {
$smarty->assign('HEADER_TITLE', HEADING_ARTICLE_NOT_FOUND);
$page_content = $smarty->fetch('articles_info_empty.tpl' );
}
$smarty->assign('page_content', $page_content);
require_once ( DIR_WS_INCLUDES . 'meta_tags.php' );
require_once ( DIR_WS_INCLUDES . 'application_bottom.php' );
$smarty->display('common/page.tpl' );
?>