// // ------------------------------------------------------------------------- // // 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 // // ------------------------------------------------------------------------ // /** * Print an article * * This page is used to print an article. The advantage of this script is that you * only see the article and nothing else. * * @package News * @author Xoops Modules Dev Team * @copyright (c) The Xoops Project - www.xoops.org * * Parameters received by this page : * @page_param int storyid Id of news to print * * @page_title Story's title - Printer Friendly Page - Topic's title - Site's name * * @template_name This page does not use any template * */ include_once 'header.php'; include_once NW_MODULE_PATH . '/class/class.newsstory.php'; include_once NW_MODULE_PATH . '/include/functions.php'; $storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0; if ( empty($storyid) ) { redirect_header(NW_MODULE_URL . '/index.php',2,_MA_NW_NOSTORY); } $sql = "SELECT a.topic_title, b.title FROM ".$GLOBALS['xoopsDB']->prefix('nw_stories')." b INNER JOIN ".$GLOBALS['xoopsDB']->prefix('nw_topics')." a on b.topicid = a.topic_id where b.storyid = $storyid"; $ret = $GLOBALS['xoopsDB']->query($sql); $row = $GLOBALS['xoopsDB']->fetchArray($ret); $url = XOOPS_URL."/".$GLOBALS['xoopsModuleConfig']['seopath']."/".xoops_sef($row['topic_title'])."/".xoops_sef($row['title'])."/print,".$_REQUEST['storyid'].$GLOBALS['xoopsModuleConfig']['seo_endofurl']; if (!strpos($url, $_SERVER['REQUEST_URI'])&&$GLOBALS['xoopsModuleConfig']['seo_enable']==1) { header( "HTTP/1.1 301 Moved Permanently" ); header( "Location: $url"); exit(0); } // Verify that the article is published $story = new nw_NewsStory($storyid); // Not yet published if ( $story->published() == 0 || $story->published() > time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } // Expired if ( $story->expired() != 0 && $story->expired() < time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } // Verify permissions $gperm_handler =& xoops_gethandler('groupperm'); if (is_object($xoopsUser)) { $groups = $xoopsUser->getGroups(); } else { $groups = XOOPS_GROUP_ANONYMOUS; } if (!$gperm_handler->checkRight('nw_view', $story->topicid(), $groups, $xoopsModule->getVar('mid'))) { redirect_header(NW_MODULE_URL . '/index.php', 3, _NOPERM); exit(); } $xoops_meta_keywords=''; $xoops_meta_description=''; if(trim($story->keywords()) != '') { $xoops_meta_keywords = $story->keywords(); } else { $xoops_meta_keywords = nw_createmeta_keywords($story->hometext().' '.$story->bodytext()); } if(trim($story->description())!='') { $xoops_meta_description = $story->description(); } else { $xoops_meta_description=strip_tags($story->title()); } function PrintPage() { global $xoopsConfig, $xoopsModule, $story, $xoops_meta_keywords,$xoops_meta_description; $myts =& MyTextSanitizer::getInstance(); $datetime = formatTimestamp($story->published(),nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME)); ?> \n"; echo ''.$myts->htmlSpecialChars($story->title()) . ' - ' . _MA_NW_PRINTER . ' - ' . $myts->htmlSpecialChars($story->topic_title()) . ' - ' . $xoopsConfig['sitename'].''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $supplemental = ''; if(nw_getmoduleoption('footNoteLinks', NW_MODULE_DIR_NAME)) { $supplemental = "footnoteLinks('content','content'); "; ?> '; echo '
'; echo '


'.$story->title().'

'._MA_NW_DATE.' '.$datetime.' | '._MA_NW_TOPICC.' '.$myts->htmlSpecialChars($story->topic_title()).'

'.$story->hometext().'
'; $bodytext = $story->bodytext(); $bodytext = str_replace('[pagebreak]',"
",$bodytext); if ( $bodytext != '' ){ echo $bodytext.'

'; } echo '


'; printf(_MA_NW_THISCOMESFROM,htmlspecialchars($xoopsConfig['sitename'],ENT_QUOTES)); echo '
'.XOOPS_URL.'

'._MA_NW_URLFORSTORY.'
' . NW_MODULE_URL . '/article.php?storyid='.$story->storyid().'
'; } PrintPage(); ?>