2006-12-02 04:36:16 +00:00
< ? php
/*
2017-01-14 17:58:41 +00:00
* e107 website system
*
* Copyright ( C ) 2008 - 2017 e107 Inc ( e107 . org )
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
* Printer Friendly
*
2006-12-02 04:36:16 +00:00
*/
2017-01-14 17:58:41 +00:00
2006-12-02 04:36:16 +00:00
require_once ( " class2.php " );
2012-12-07 09:34:22 +02:00
//include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
2015-02-01 19:16:41 -08:00
2012-12-07 09:34:22 +02:00
e107 :: coreLan ( 'print' );
2009-08-28 15:30:25 +00:00
2008-01-09 22:06:22 +00:00
$qs = explode ( " . " , e_QUERY , 2 );
2006-12-02 04:36:16 +00:00
if ( $qs [ 0 ] == " " ) {
header ( " location: " . e_BASE . " index.php " );
exit ;
}
2016-01-17 16:24:54 -08:00
$CSS = <<< CSS
2016-01-17 16:31:53 -08:00
2016-01-17 16:52:00 -08:00
body { background : #fff; color: #000 }
2016-01-17 16:31:53 -08:00
2016-01-17 16:24:54 -08:00
@ media print {
2016-01-17 16:52:00 -08:00
img {
display : block ;
}
img , table , ul , ol , . code - snippet {
page - break - inside : avoid ;
page - break - before : auto ;
page - break - after : auto ;
}
2016-01-17 16:31:53 -08:00
2016-01-17 16:24:54 -08:00
a [ href ] : after {
content : none ;
}
}
CSS ;
e107 :: css ( 'inline' , $CSS );
2015-02-01 19:16:41 -08:00
define ( 'e_IFRAME' , true );
2006-12-02 04:36:16 +00:00
$source = $qs [ 0 ];
2008-01-09 22:06:22 +00:00
$parms = varset ( $qs [ 1 ], '' );
2006-12-02 04:36:16 +00:00
unset ( $qs );
if ( strpos ( $source , 'plugin:' ) !== FALSE )
{
$plugin = substr ( $source , 7 );
if ( file_exists ( e_PLUGIN . $plugin . " /e_emailprint.php " ))
{
include_once ( e_PLUGIN . $plugin . " /e_emailprint.php " );
2007-01-24 22:34:29 +00:00
$print_text = print_item ( $parms );
// define("e_PAGETITLE", $plugin);
2006-12-02 04:36:16 +00:00
}
else
{
2017-01-14 17:58:41 +00:00
echo LAN_FILE_NOT_FOUND ;
2006-12-02 04:36:16 +00:00
exit ;
}
}
else
{
2016-01-17 16:24:54 -08:00
//$con = new convert;
2017-06-25 23:24:30 +04:00
$query = " SELECT n.*, c.*, u.user_id, u.user_name FROM `#news` AS n LEFT JOIN `#news_category` AS c ON n.news_category = c.category_id LEFT JOIN `#user` AS u ON n.news_author = u.user_id WHERE n.news_id = " . intval ( $parms );
2016-01-17 16:24:54 -08:00
//$sql->db_Select("news", "*", "news_id='{$parms}'");
$sql = e107 :: getDb ();
$sql -> gen ( $query );
$row = $sql -> fetch ();
$newsUrl = e107 :: getUrl () -> create ( 'news/view/item' , $row , 'full=1' );
// extract($row);
// define("e_PAGETITLE", $news_title);
//$news_body = $tp->toHTML($news_body, TRUE, 'BODY');
/*
2008-01-09 22:06:22 +00:00
$news_extended = $tp -> toHTML ( $news_extended , TRUE , 'BODY' );
2006-12-02 04:36:16 +00:00
if ( $news_author == 0 )
{
$a_name = " e107 " ;
$category_name = " e107 welcome message " ;
}
else
{
$sql -> db_Select ( " news_category " , " category_id, category_name " , " category_id=' { $news_category } ' " );
2016-02-14 12:15:55 -08:00
list ( $category_id , $category_name ) = $sql -> db_Fetch ( 'num' );
2006-12-02 04:36:16 +00:00
$sql -> db_Select ( " user " , " user_id, user_name " , " user_id=' { $news_author } ' " );
2016-02-14 12:15:55 -08:00
list ( $a_id , $a_name ) = $sql -> db_Fetch ( 'num' );
2006-12-02 04:36:16 +00:00
}
$news_datestamp = $con -> convert_date ( $news_datestamp , " long " );
2007-02-13 22:27:33 +00:00
$print_text = " <span style= \" font-size: 13px; color: black; font-family: tahoma, verdana, arial, helvetica; text-decoration: none \" >
2016-01-17 16:24:54 -08:00
< h2 > " .LAN_PRINT_135. $news_title . " </ h2 >
2006-12-02 04:36:16 +00:00
< br />
2017-01-14 17:58:41 +00:00
( " .LAN_CATEGORY. " " . $tp->toHTML ( $category_name ,FALSE, " defs " ). " )
2006-12-02 04:36:16 +00:00
< br />
2017-01-14 17:58:41 +00:00
" .LAN_POSTED_BY. " " . $a_name . " < br />
2006-12-02 04:36:16 +00:00
" . $news_datestamp . "
< br />< br /> " .
$news_body ;
2016-01-17 16:24:54 -08:00
if ( ! empty ( $news_extended )){ $print_text .= " <br /><br /> " . $news_extended ; }
if ( ! empty ( $news_extended )){ $print_text .= " <br /><br /> " . $news_extended ; }
if ( ! empty ( $news_source )){ $print_text .= " <br /><br /> " . $news_source ; }
if ( ! empty ( $news_url )){ $print_text .= " <br /> " . $news_url ; }
*/
$tmp = e107 :: getTemplate ( 'news' , 'news' , 'view' );
$template = $tmp [ 'item' ];
unset ( $tmp );
// ob_start();
require_once ( e_HANDLER . " news_class.php " );
$ix = new news ;
$print_text = $ix -> render_newsitem ( $row , 'return' , '' , $template , null );
//$print_text = ob_get_flush();
$print_text .= " <br /><br /><hr /> " .
LAN_PRINT_303 . " <b> " . SITENAME . " </b>
2006-12-02 04:36:16 +00:00
< br />
2016-01-17 16:24:54 -08:00
" . $newsUrl . "
2006-12-02 04:36:16 +00:00
" ;
2015-02-01 23:54:12 -08:00
2006-12-02 04:36:16 +00:00
}
2007-01-24 22:34:29 +00:00
2006-12-02 04:36:16 +00:00
if ( defined ( " TEXTDIRECTION " ) && TEXTDIRECTION == " rtl " ){
$align = 'right' ;
} else {
$align = 'left' ;
}
2007-01-24 22:34:29 +00:00
// Header down here to give us a chance to set a page title
require_once ( HEADERF );
2009-04-16 10:02:03 +00:00
//temporary solution - object of future cahges
if ( is_readable ( THEME . 'print_template.php' ))
{
include_once ( THEME . 'print_template.php' );
echo $tp -> parseTemplate ( $PRINT_TEMPLATE );
}
else
{
echo "
< div style = 'background-color:white' >
2016-01-17 16:24:54 -08:00
< div style = 'text-align:".$align."' > " . $tp->parseTemplate ( " { LOGO : h = 100 } " , TRUE). " </ div >< hr />
2009-04-16 10:02:03 +00:00
< div style = 'text-align:".$align."' > " . $print_text . " </ div >< br />< br />
2016-01-17 16:24:54 -08:00
< form action = '#' >< div class = 'hidden-print' style = 'text-align:center' >< input class = 'btn btn-primary ' type = 'button' value = '".LAN_PRINT_307."' onclick = 'window.print()' /></ div ></ form ></ div > " ;
2009-04-16 10:02:03 +00:00
}
2006-12-02 04:36:16 +00:00
require_once ( FOOTERF );
2017-01-14 17:58:41 +00:00
?>