[2.0.7] Printer-friendly topic mod

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
48
45%
Very Good
26
25%
Good
11
10%
Fair
9
8%
Poor
12
11%
 
Total votes: 106

WebSnail
Registered User
Posts: 524
Joined: Sun Nov 11, 2001 2:20 pm
Location: South Yorkshire, UK
Contact:

Re: [2.0.7] Printer-friendly topic mod

Post by WebSnail » Sun Apr 15, 2007 8:47 pm

Dogs and things wrote: So how should the code look like?

The original line you propose to alter looks like this:

Code: Select all

	LIMIT $start, ".(isset($finish)? ((($finish - $start) > 0)? ($finish - $start): -$finish): $board_config['posts_per_page']);
What should I turn that into?


If you look for this:

Original phpBB2:

Code: Select all

	ORDER BY p.post_time $post_time_order
	LIMIT $start, ".$board_config['posts_per_page'];
Modified 1.0.8 Printer-friendly topic mod:

Code: Select all

	ORDER BY p.post_time $post_time_order
	LIMIT $start, ".(isset($finish)? ((($finish - $start) > 0)? ($finish - $start): -$finish): $board_config['posts_per_page']);

Code: Select all

	ORDER BY p.post_time $post_time_order ";
//MOD printer-friendly
// $sql .= " LIMIT $start, ".$board_config['posts_per_page'];
$start = intval($start);
if (isset($finish)) {
	$fin = (($finish - $start) > 0) ? (intval($finish) - $start) : -(intval($finish));
} else {
	$fin = $board_config['posts_per_page'];
}
$sql .= " LIMIT $start, $fin";
//MOD END printer-friendly
I think that's about right... I have various other mods that clash a little that require more tweaking and that code above could be tweaked a little too but it should work..

Hope that helps.



NB: The reason I've intval()'d the values is to stop any sql injection from getting through.
Last edited by WebSnail on Sun Apr 15, 2007 10:16 pm, edited 2 times in total.

User avatar
Dogs and things
Registered User
Posts: 2114
Joined: Fri Sep 01, 2006 9:04 am
Location: Spain
Contact:

Re: [2.0.7] Printer-friendly topic mod

Post by Dogs and things » Sun Apr 15, 2007 8:54 pm

Well okay,

I got it.

Thanks for this, I hope you´re right and no probs will arise due this modification ´cause I applied it just now. ;)
For phpBB2 support visit phpBB2refugees.

WebSnail
Registered User
Posts: 524
Joined: Sun Nov 11, 2001 2:20 pm
Location: South Yorkshire, UK
Contact:

Re: [2.0.7] Printer-friendly topic mod

Post by WebSnail » Sun Apr 15, 2007 10:04 pm

Dogs and things wrote: Well okay,

I got it.

Thanks for this, I hope you´re right and no probs will arise due this modification ´cause I applied it just now. ;)

Ah... well I've been playing a little and just discovered that there is a problem so be ready to re-edit..

it seems that the $finish value can sometimes be negative which would be borked if intval()'d so I'm finding a better way...


EDIT: Ok... I've fixed the problem and updated my code in all my posts but if anyone used the original version then you'll need to re-edit your code accordingly.

Where I went wrong was in using the variable $finish as part of the limit statement.. To fix the issue use of an alternative or temporary variable ie: $fin, means I don't bugger up the correct value for $finish which is dealt with later. Hope that makes sense. ;)

User avatar
Dogs and things
Registered User
Posts: 2114
Joined: Fri Sep 01, 2006 9:04 am
Location: Spain
Contact:

Re: [2.0.7] Printer-friendly topic mod

Post by Dogs and things » Sun Apr 15, 2007 11:36 pm

To be honest,

I don´t understand a single $ of what you´re saying but I trust you know what you´re doing. :razz:
For phpBB2 support visit phpBB2refugees.

User avatar
Dogs and things
Registered User
Posts: 2114
Joined: Fri Sep 01, 2006 9:04 am
Location: Spain
Contact:

Re: [2.0.7] Printer-friendly topic mod

Post by Dogs and things » Mon Apr 16, 2007 8:40 am

This code gave me a problem so I got rid of it.

Code: Select all

Could not obtain post/user information.

DEBUG MODE

SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, u.user_helpfulpoints, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid FROM phpbb_posts p, phpbb_users u, phpbb_posts_text pt WHERE p.topic_id = 683 AND pt.post_id = p.post_id AND u.user_id = p.poster_id ORDER BY p.post_time ASC LIMIT 0, 15

Line : 766
File : viewtopic.php
For phpBB2 support visit phpBB2refugees.

msalami
Registered User
Posts: 2
Joined: Tue Mar 27, 2007 7:55 pm

Re: [2.0.7] Printer-friendly topic mod HELP!

Post by msalami » Thu Apr 26, 2007 8:52 pm

Howdy! I am trying to install this mod but cannot find instructions for it anywhere!! Can anyone help? I have downloaded the package and don't seem to find them anywhere within the folders.

If anyone could offer assistance it is greatly appreciated! :)

Thank you!
Michele

User avatar
Dogs and things
Registered User
Posts: 2114
Joined: Fri Sep 01, 2006 9:04 am
Location: Spain
Contact:

Re: [2.0.7] Printer-friendly topic mod

Post by Dogs and things » Thu Apr 26, 2007 9:38 pm

Look for a file named install. :razz:
For phpBB2 support visit phpBB2refugees.

Bullmax
Registered User
Posts: 2011
Joined: Fri Jan 30, 2004 3:36 pm

Re:

Post by Bullmax » Thu Apr 26, 2007 10:00 pm

Dogs and things wrote: Hello,

I don´t seem to be able to find how/where I can increase font-size in the printable version of the topic. Does anybody know how to do this?

**EDIT** As usual, I asked too quickly. I just found out that in printer_header.tpl there is the .css. After some trial and error editing I found the right thingies to be edited. It´s changing things like:

Code: Select all

{T_FONTSIZE3}px; }
into:

Code: Select all

14px; 
Greetings. :wink:


Back on page 29 of this topic there is also this which is a nice addition to the mod:
CaqKa wrote:
seleleth wrote: So many requests for the font to not change in the printable version and I couldn't find an answer until page 17 of this thread! Thanks mattbugz for clueing me into the fix for the changed font.

I made some serious cosmetics changes to this mod. I'm gonna be lazy and skip on explaining all of them. But here is a sample of the new layout:

Image

Two files need to be changed to the following code:

templates/subSilver/printer_header.tpl:

Code: Select all

<!-- DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" -->
<!-- <html xmlns="http://www.w3.org/1999/xhtml"> -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{S_CONTENT_DIRECTION}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}"  />
<meta http-equiv="Content-Style-Type" content="text/css" />
<style type="text/css">
<!--
-->
</style>
{META}
<title>{SITENAME} :: {PAGE_TITLE}</title>
<style type="text/css">

/* Pre block */
pre {
white-space: -moz-pre-wrap; /* Mozilla, supported since 1999 */
white-space: -pre-wrap; /* Opera 4 - 6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 - Text module (Candidate Recommendation) http://www.w3.org/TR/css3-text/#white-space */
font-family: Verdana, Arial, Helvetica, sans-serif;
}
</style>
<!--[if gte IE 5]>
	<style type="text/css">
	pre {
	white-space: normal;
	word-wrap: break-word;
	width="100%"; /* this assures that page 'haslayout' for IE so that you skip the IE bug where characters get repeated */
	}
	</style>
<![endif]-->
<style type="text/css">
/* end of Pre block */

<!--

body { 
	background-color: white;
}

/* The largest text used in the index page title and toptic title etc. */
.maintitle	{
			font-weight: bold; font-size: 22px; font-family: "{T_FONTFACE1}",{T_FONTFACE1};
			text-decoration: none; line-height : 120%; color : {T_BODY_TEXT};
}

/* General text */
.gen { font-family: {T_FONTFACE1}; font-size : {T_FONTSIZE3}px; }
.genmed { font-family: {T_FONTFACE1}; font-size : {T_FONTSIZE2}px; }
.gensmall { font-family: {T_FONTFACE1}; font-size : {T_FONTSIZE1}px; }
.gen,.genmed,.gensmall { color : black; }
a.gen,a.genmed,a.gensmall { color: black; text-decoration: none; }
a.gen:hover,a.genmed:hover,a.gensmall:hover	{ color: {T_BODY_HLINK}; text-decoration: underline; }

/* Forum category titles */
.cattitle		{ font-family: {T_FONTFACE1}; font-weight: bold; font-size: {T_FONTSIZE3}px ; letter-spacing: 1px; color : black}
a.cattitle		{ text-decoration: none; color : black; }
a.cattitle:hover{ text-decoration: underline; }

/* Forum title: Text and link to the forums used in: index.php */
.forumlink		{ font-family: {T_FONTFACE1}; font-weight: bold; font-size: {T_FONTSIZE3}px; color : black; }
a.forumlink 	{ text-decoration: none; color : black; }
a.forumlink:hover{ text-decoration: underline; color : black; }

/* Used for the navigation text, (Page 1,2,3 etc) and the navigation bar when in a forum */
.nav			{ font-family: {T_FONTFACE1}; font-weight: bold; font-size: {T_FONTSIZE2}px; color : black;}
a.nav			{ text-decoration: none; color : black; }
a.nav:hover		{ text-decoration: underline; }

/* titles for the topics: could specify viewed link colour too */
.topictitle			{ font-family: {T_FONTFACE1}; font-weight: bold; font-size: {T_FONTSIZE2}px; color : black; }
a.topictitle:link   { text-decoration: none; color : black; }
a.topictitle:visited { text-decoration: none; color : black; }
a.topictitle:hover	{ text-decoration: underline; color : {T_BODY_HLINK}; }

/* Name of poster in viewmsg.php and viewtopic.php and other places */
.name			{ font-family: {T_FONTFACE1}; font-size : {T_FONTSIZE2}px; color : black;}

/* Location, number of posts, post date etc */
.postdetails		{ font-family: {T_FONTFACE1}; font-size : {T_FONTSIZE1}px; color : black; }

/* The content of the posts (body of text) */
.postbody { font-family: {T_FONTFACE1}; font-size : {T_FONTSIZE3}px; line-height: 18px}
a.postlink:link	{ text-decoration: none; color : black }
a.postlink:visited { text-decoration: none; color : black; }
a.postlink:hover { text-decoration: underline; color : {T_BODY_HLINK}}

/* Quote & Code blocks */
.code { 
	font-family: {T_FONTFACE1}; font-size: {T_FONTSIZE2}px; color: black;
	background-color: white; border: black; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px
}

.quote {
	font-family: {T_FONTFACE1}; font-size: {T_FONTSIZE2}px; color: black; line-height: 125%;
	background-color: white; border: black; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px
}

/* Copyright and bottom info */
.copyright		{ font-size: {T_FONTSIZE1}px; font-family: {T_FONTFACE1}; color: black; letter-spacing: -1px;}
a.copyright		{ color: black; text-decoration: none;}
a.copyright:hover { color: {T_BODY_TEXT}; text-decoration: underline;}


/* The text input fields background colour */
input.post, textarea.post, select {
	background-color : white;
}

input { text-indent : 2px; }

/* This is the line in the posting page which shows the rollover
  help line. This is actually a text box, but if set to be the same
  colour as the background no one will know ;)
*/
.helpline { background-color: #00ffff; border-style: none; }


/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("templates/subSilver/formIE.css"); 
-->
</style>
</head>

<body bgcolor="white" text="black" link="black" vlink="black">
<span class="gen"><a name="top"></a></span>
templates/subSilver/printertopic_body.tpl:

Code: Select all

<table border=0 align=right><tr><td class="postdetails" nowrap>
<form action="{U_VIEW_TOPIC}" method="get">
{L_SELECT_MESSAGES_FROM}<td class="postdetails" nowrap title="{L_BOX1_DESC}">
	#<input class="post" type="text" maxlength="5" size="5" name="start_rel" value="{START_REL}"><td class="postdetails"> {L_SELECT_THROUGH} <td class="postdetails" nowrap title="{L_BOX2_DESC}">
	#<Input class="post" type="text" maxlength="5" size="5" name="finish_rel" value="{FINISH_REL}"><td class="postdetails">
	<input type="hidden" name="t" value="{TOPIC_ID}">
	<input type="hidden" name="printertopic" value="1">
	<input type="submit" name="submit" value="{L_SHOW}" class="mainoption">
	<td class="postdetails" ><a target=_blank title="see the faq section for more help" href="{U_FAQ}">{L_FAQ}</a>
</table>
<span class="postdetails">[<a title="{L_PRINT_DESC}" href="javascript:self.print()">{L_PRINT}</a>]&nbsp;|&nbsp;[<a title="close this window" href="javascript:window.close()">Close</a>]</span><br /><br />
<a class="maintitle" href="{U_VIEW_TOPIC}"><font color=black>{TOPIC_TITLE}</font></a><br />
<span class="nav">{PAGINATION}</span><br />
<span class="nav"><font color=black><a href="{U_INDEX}" class="nav"><font color=black>{SITENAME}</font></a>
	  -> <a href="{U_VIEW_FORUM}" class="nav"><font color=black>{FORUM_NAME}</font></a></font></span>


	{POLL_DISPLAY} 

	<!-- BEGIN postrow -->
	<center><hr width=80%></center>
<span class="name"><a name="{postrow.U_POST_ID}"></a></span><span class="postdetails"><font color=black>{L_AUTHOR}:&nbsp;<b>{postrow.POSTER_NAME}</b>,&nbsp;</font></span><span class="postdetails"><font color=black>{postrow.POSTER_FROM}</font></span>
<a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails"><font color=black>{L_POSTED}: {postrow.POST_DATE}</font><span class="gen"><br>
	<span class="gensmall">&nbsp;&nbsp;&nbsp;&nbsp;—</span><br>

<span class="postbody">{postrow.MESSAGE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}{postrow.ATTACHMENTS}</span></td>
	<!-- END postrow -->
	<span class="gensmall"><center><hr width=80%></center><span>
<span class="nav"><a href="{U_INDEX}" class="nav"><font color=black>{SITENAME}</font></a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav"><font color=black>{FORUM_NAME}</font></a></span>
<br><span class="gensmall">{S_TIMEZONE}</span><span class="nav">{PAGINATION}</span>
</form>

nice.
i just modified the "hr width=80%" to "hr"
seems lovelier.
thanx for the mod.

Tomtebror
Registered User
Posts: 11
Joined: Fri Apr 27, 2007 3:03 pm

Re: [2.0.7] Printer-friendly topic mod

Post by Tomtebror » Fri May 04, 2007 11:50 pm

I just added this mod to my bord, but got a crash between this and Online/Offline Status Images, that resluted in when the printer button was pressed I got greeted by this message:

Fatal error: Call to undefined function: display_online_offline() in viewtopic.php on line 1223

The line it refers to is this:

Code: Select all

// Start Online/Offline Status Images MOD
'STATUS_IMG' => display_online_offline($poster_id, $online_array),
// End Online/Offline Status Images MOD
If I remove thos lines from the Online/Offline mod, then the Printer-friendly topic mod, works like a charm, but then I don't get the Online/Offline Status Image to display at all.

- Anybody that knows their way though the code and can help me fix som that bouth run?

MANY thanks in advance!

Tomtebror
Registered User
Posts: 11
Joined: Fri Apr 27, 2007 3:03 pm

Re: [2.0.7] Printer-friendly topic mod

Post by Tomtebror » Wed May 16, 2007 3:12 pm

Not anyone that can help me to get the "undefined function" to become an "defined function" or even an "ignored function" within the printer-friendly topic mod??

cwallace
Registered User
Posts: 523
Joined: Tue Dec 14, 2004 4:26 am
Location: Fort Wayne, Indiana
Contact:

Re: [2.0.7] Printer-friendly topic mod

Post by cwallace » Sun Jun 24, 2007 6:24 pm

Mine doesn't seem to look right where the PRINT button is on the printable page:

http://www.fortwaynemusic.com/printerMOD.gif

Can you tell me if that is the way it should look? I circled the place I mean.

Thanks,
Chris
http://www.FortWayneMusic.com - Your source for the best in local music and entertainment.

cwallace
Registered User
Posts: 523
Joined: Tue Dec 14, 2004 4:26 am
Location: Fort Wayne, Indiana
Contact:

Re: [2.0.7] Printer-friendly topic mod

Post by cwallace » Tue Jun 26, 2007 3:51 am

Some help with this would be great. I was just on another board where they have this installed and it looks MUCH different that the screens I got. I like it and would love to keep it in place. Don't know if I can with it being broken...from what I can tell anyway...

Chris
http://www.FortWayneMusic.com - Your source for the best in local music and entertainment.

Philthy
Registered User
Posts: 210
Joined: Tue Dec 27, 2005 10:05 am
Location: Dawlish, Devon
Contact:

Re: [2.0.7] Printer-friendly topic mod

Post by Philthy » Tue Aug 21, 2007 5:57 pm

Tomtebror wrote:I just added this mod to my bord, but got a crash between this and Online/Offline Status Images, that resluted in when the printer button was pressed I got greeted by this message:

Fatal error: Call to undefined function: display_online_offline() in viewtopic.php on line 1223

The line it refers to is this:

Code: Select all

// Start Online/Offline Status Images MOD
'STATUS_IMG' => display_online_offline($poster_id, $online_array),
// End Online/Offline Status Images MOD
If I remove thos lines from the Online/Offline mod, then the Printer-friendly topic mod, works like a charm, but then I don't get the Online/Offline Status Image to display at all.

- Anybody that knows their way though the code and can help me fix som that bouth run?

MANY thanks in advance!
I'm getting exactly the same error.
I'm trying to work out how and where to define the function, but frankly my php is sketchy.
Go on ! it's not as steep as it looks.....

Philthy
Registered User
Posts: 210
Joined: Tue Dec 27, 2005 10:05 am
Location: Dawlish, Devon
Contact:

Re: [2.0.7] Printer-friendly topic mod

Post by Philthy » Thu Aug 23, 2007 1:52 am

Tomtebror wrote:I just added this mod to my bord, but got a crash between this and Online/Offline Status Images, that resluted in when the printer button was pressed I got greeted by this message:

Fatal error: Call to undefined function: display_online_offline() in viewtopic.php on line 1223

The line it refers to is this:

Code: Select all

// Start Online/Offline Status Images MOD
'STATUS_IMG' => display_online_offline($poster_id, $online_array),
// End Online/Offline Status Images MOD
If I remove thos lines from the Online/Offline mod, then the Printer-friendly topic mod, works like a charm, but then I don't get the Online/Offline Status Image to display at all.

- Anybody that knows their way though the code and can help me fix som that bouth run?

MANY thanks in advance!
Exreaction sorted this out for me on his own forum.
Thanks

Code: Select all

[OPEN]
includes/page_header_printer.php

#
#-----[ FIND ]---------------------------------------------
#

define('HEADER_INC', TRUE);

#
#-----[ AFTER, ADD ]---------------------------------------
#

// Start Online/Offline Status Images MOD
include($phpbb_root_path . 'includes/online_offline.'.$phpEx);
$online_array = get_online_users();
// End Online/Offline Status Images MOD

SAVE/CLOSE FILE
Go on ! it's not as steep as it looks.....

finlay
Registered User
Posts: 31
Joined: Tue Mar 04, 2003 5:07 pm

Re: [2.0.7] Printer-friendly topic mod

Post by finlay » Wed May 28, 2008 12:54 pm

WARNING: There appears to be a security issue in this MOD!

I installed this MOD some time ago. A few days back i discovered a cached Google copy of a full discussion from a PRIVATE FORUM, rendered via this mod.

I'm investigating the code further, but whereas phpBB treats Google as a Guest and doesn't allow it to 'see' private discussions, this mod appears to allow it in to index private pages!

If you value your private forums and groups, you should take a look at this.

Any further input appreciated.

Post Reply

Return to “[2.0.x] MOD Database Cleanup”

Who is online

Users browsing this forum: No registered users and 4 guests

cron