//
// ------------------------------------------------------------------------ //
// 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, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// 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. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
include "../../mainfile.php";
include_once "class/class.newsstory.php";
foreach ($HTTP_POST_VARS as $k => $v) {
${$k} = $v;
}
$storyid = (isset($HTTP_GET_VARS['storyid'])) ? $HTTP_GET_VARS['storyid'] : 0;
$storyid = intval($storyid);
if (empty($storyid)) {
redirect_header("index.php",2,_NW_BD_NOSTORY);
exit();
}
#if( isset($_SESSION['mobile']) && $_SESSION['mobile']!="si")
#{
$xoopsOption['template_main'] = 'bdnews_article.html';
include_once XOOPS_ROOT_PATH.'/header.php';
#}else
#{
# $xoopsOption['template_main'] = 'bdnews_article.html';
#$xoopsOption['template_main'] = 'bdnews_article_mobile.html';
#}
$myts =& MyTextSanitizer::getInstance();
// set comment mode if not set
$article = new NewsStory($storyid);
if ( $article->published() == 0 || $article->published() > time() ) {
redirect_header('index.php', 2, _NW_BD_NOSTORY);
exit();
}
$storypage = isset($HTTP_GET_VARS['page']) ? intval($HTTP_GET_VARS['page']) : 0;
// update counter only when viewing top page
if (empty($HTTP_GET_VARS['com_id']) && $storypage == 0) {
$article->updateCounter();
}
$story['id'] = $storyid;
$story['posttime'] = formatTimestamp($article->created());
//bd category
//$story['title'] = $article->textlink()." : ".$article->title();
$story['title'] = $article->title();
#hack SEO link
include "../../mie_funzioni.php";
$real_link = $_SERVER['REQUEST_URI'];
$seo_link = $storyid."-".seo_link($article->title());
$seo_full_link = XOOPS_URL."/modules/bdnews/".$seo_link;
$seo_link_pdn = "/modules/bdnews/".$seo_link;
$seo_real_full_link = XOOPS_URL."/notizie/".$seo_link;
$real_link2 = substr($real_link,9); # tolgo /notizie/
$seo_link_pdn2 = substr($seo_link_pdn,16); # tolgo /modules/bdnews/
if( ($storypage==0) && ($real_link2 != $seo_link_pdn2) )
{
if( !(isset($_SESSION['articolo_id'])) || ($_SESSION['articolo_id']!=$storyid) )
{
$_SESSION['articolo_id'] = $storyid;
header("Location: $seo_real_full_link");
}
$dove = "DENTRO";
}else{$dove = "FUORI";}
#debug:
$debug = false;
if($debug)
{
echo "";
}
#/hack SEO link
$story['category_title'] = "".$article->newscategory->topic_title."";
$story['topic_title'] = "".$article->newstopic->topic_title."";
//--/bd
$story['text'] = $article->hometext();
$bodytext = $article->bodytext();
# FB hack:
$descrizione = controlli($story['text']);
function controlli($stringa)
{
$stringa = htmlentities(trim($stringa));
return $stringa;
}
if ( trim($bodytext) != '' ) {
$articletext = explode("[pagebreak]", $bodytext);
$story_pages = count($articletext);
if ($story_pages > 1) {
include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
$pagenav = new XoopsPageNav($story_pages, 1, $storypage, 'page', 'storyid='.$storyid);
$xoopsTpl->assign('pagenav', $pagenav->renderNav());
//$xoopsTpl->assign('pagenav', $pagenav->renderImageNav());
if ($storypage == 0) {
$story['text'] = $story['text'].'
'.$articletext[$storypage];
} else {
$story['text'] = $articletext[$storypage];
}
} else {
$story['text'] = $story['text'].'
'.$bodytext;
}
}
$story['poster'] = $article->uname();
if ( $story['poster'] ) {
$story['posterid'] = $article->uid();
$story['poster'] = ''.$story['poster'].'';
} else {
$story['poster'] = '';
$story['posterid'] = 0;
$story['poster'] = $xoopsConfig['anonymous'];
}
$story['morelink'] = '';
$story['adminlink'] = '';
unset($isadmin);
if ( $xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid')) ) {
$isadmin = true;
$story['adminlink'] = $article->adminlink();
}
$story['topicid'] = $article->topicid();
$story['imglink'] = '';
$story['align'] = '';
if ( $article->topicdisplay() ) {
$story['imglink'] = $article->imglink();
$story['align'] = $article->topicalign();
}
$story['hits'] = $article->counter();
$story['mail_link'] = 'mailto:?subject='.sprintf(_NW_BD_INTARTICLE,$xoopsConfig['sitename']).'&body='.sprintf(_NW_BD_INTARTFOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/bdnews/article.php?storyid='.$article->storyid();
$xoopsTpl->assign('story', $story);
$xoopsTpl->assign('lang_printerpage', _NW_BD_PRINTERFRIENDLY);
$xoopsTpl->assign('lang_sendstory', _NW_BD_SENDSTORY);
$xoopsTpl->assign('lang_on', _ON);
$xoopsTpl->assign('lang_postedby', _POSTEDBY);
$xoopsTpl->assign('lang_reads', _READS);
$xoopsTpl->assign('mail_link', 'mailto:?subject='.sprintf(_NW_BD_INTARTICLE,$xoopsConfig['sitename']).'&body='.sprintf(_NW_BD_INTARTFOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/bdnews/article.php?storyid='.$article->storyid());
# inizio FB hack
$xoopsTpl->assign('link_pagina', $seo_real_full_link);
$seo_real_full_link_encoded = urlencode($seo_real_full_link);
$titolo_per_social = urlencode(titoli_encoded($article->title())); # in mie_funzioni.php
$xoopsTpl->assign('link_pagina_encoded', $seo_real_full_link_encoded);
$xoopsTpl->assign('titolo_pagina_encoded', $titolo_per_social);
$xoopsTpl->assign('xoops_module_header', $xoopsTpl->get_template_vars('xoops_module_header')."\n