Seite 2 von 6

Verfasst: 27.10.2003 13:24
von Helmut71
ich frage einfach nochmals: Hat jemand den Mod zufällig?

Habe marmo auch schon angeschrieben..bis jetzt ohne Erfolg.

Denke aber doch, dass jemand den Mod noch hat und ihn mir vielleicht mailen kann!?

Verfasst: 27.10.2003 15:07
von AmigaLink
Ich habe auch noch keine Antwort von marmo. :cry:

Verfasst: 27.10.2003 17:04
von Helmut71
ich hoffe, marmo lässt uns nicht hängen.

Der Mod für einzelne Beiträge würde gerade bei meinem Board viel mehr Sinn machen als der für topics. :o

Verfasst: 27.10.2003 19:58
von Zaubi
ich hatte mir grade den printer topic in der neusten version eingebaut,
aber der ist viel besser.
wäre ich auch interessiert dran. ;) ....

winkeeeee

Verfasst: 29.10.2003 06:36
von Helmut71
Hallo!


Habe gestern den modifizierten print topc Mod bekommen, der dadurch zum print_message-Mod wird:

Ich poste ihn mal:

zuerst die print_message.php

Code: Alles auswählen

<?php
/***************************************************************************
 *                               printview.php
 *                            -------------------
 *  MOD add-on page. Contains GPL code copyright of phpBB group.
 *  Author: Adam Ismay
 *  Version: 1.1 - 20th March 2002 - RC4 fix
 *  Version: 1.0 - 3rd March 2002
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes_main/bbcode_print.'.$phpEx);

//
// gzip_compression
//
$do_gzip_compress = FALSE;
if($board_config['gzip_compress'])
{
    $phpver = phpversion();

    if($phpver >= "4.0.4pl1")
    {
        if(extension_loaded("zlib"))
        {
            ob_start("ob_gzhandler");
        }
    }
    else if($phpver > "4.0")
    {
        if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip'))
        {
            if(extension_loaded("zlib"))
            {
                $do_gzip_compress = TRUE;
                ob_start();
                ob_implicit_flush(0);

                header("Content-Encoding: gzip");
            }
        }
    }
}

header ("Cache-Control: no-store, no-cache, must-revalidate");
header ("Cache-Control: pre-check=0, post-check=0, max-age=0", false);
header ("Pragma: no-cache");
header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

//
// Start session management
//
$section_id = '0';
$userdata = session_pagestart($user_ip, $section_id, 0);
//$userdata = session_pagestart($user_ip, 0);
init_userprefs($userdata);
//
// End session management
//

// Make sure a topic id was passed
if(isset($HTTP_GET_VARS[POST_POST_URL]))
{
    $post_id = intval($HTTP_GET_VARS[POST_POST_URL]);
}
else if(isset($HTTP_GET_VARS['post']))
{
    $post_id = intval($HTTP_GET_VARS['post']);
}

if( !isset($post_id) )
{
    message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}

if(isset($HTTP_GET_VARS[POST_TOPIC_URL]))
{
    $topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]);
}
else if(isset($HTTP_GET_VARS['topic']))
{
    $topic_id = intval($HTTP_GET_VARS['topic']);
}

if( !isset($topic_id) )
{
    message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}

$template->set_filenames(array(
    "body" => "viewtopic_print_message.tpl")
);

$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read
    FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
    WHERE t.topic_id = " . $topic_id . "
        AND f.forum_id = t.forum_id
        $order_sql";
if( !($result = $db->sql_query($sql)) )
{
    message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql);
}

if( !($forum_row = $db->sql_fetchrow($result)) )
{
    message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
$forum_id = $forum_row['forum_id'];
$forum_name = $forum_row['forum_name'];
$topic_title = $forum_row['topic_title'];
$topic_time = $forum_row['topic_time'];


//
// Start auth check
//
$is_auth = array();
$is_auth = auth(AUTH_READ, $forum_id, $userdata, $forum_row);

if( !$is_auth['auth_read'] )
{
    if ( !$userdata['session_logged_in'] )
    {
        $redirect = "t=" . $topic_id;
        header("Location: " . append_sid("login.$phpEx?redirect=printview.$phpEx&$redirect", true));
    }

    $message = sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);

    message_die(GENERAL_MESSAGE, $message);
}
//
// End auth check
//

//
// Right we have auth checked and a topic id so we can fetch the topic data.
//


$sql = "SELECT p.*, pt.post_text, pt.post_subject, pt.bbcode_uid, 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
    FROM " . POSTS_TABLE . " p,  " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u
    WHERE p.post_id = $post_id
        AND pt.post_id = p.post_id
        AND u.user_id = p.poster_id
        LIMIT 1";
if(!$result = $db->sql_query($sql))
{
    message_die(GENERAL_ERROR, "Couldn't obtain post/user information.", "", __LINE__, __FILE__, $sql);
}

if(!$total_posts = $db->sql_numrows($result))
{
    message_die(GENERAL_MESSAGE, $lang['No_posts_topic']);
}
$postrow = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);

//
// Define censored word matches
//
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);

//
// Censor topic title
//
if( count($orig_word) )
{
    $topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
}


//
// Loop through the posts
//
for($i = 0; $i < $total_posts; $i++)
{

    $poster_id = $postrow[$i]['user_id'];
    $poster = $postrow[$i]['username'];

    $post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']);
    $post_subject = ( $postrow[$i]['post_subject'] != "" ) ? $postrow[$i]['post_subject'] : "";

    $message = $postrow[$i]['post_text'];
    $bbcode_uid = $postrow[$i]['bbcode_uid'];

    // Dont want any HTML on printview
    if( $postrow[$i]['enable_html'] )
    {
        $message = preg_replace("#(<)([\/]?.*?)(>)#is", "<\\2>", $message);
    }
    // But BBcode, links and smilies are OK, possible revision in future version?
    if( $bbcode_uid != "" )
    {
        $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace("/\:[0-9a-z\:]+\]/si", "]", $message);
    }
    $message = make_clickable($message);
     //
    // Replace naughty words
    //
    if( count($orig_word) )
    {
        $post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
        $message = preg_replace($orig_word, $replacement_word, $message);
    }
    if( $board_config['allow_smilies'] )
    {
        if( $postrow[$i]['enable_smilies'] )
        {
            $message = smilies_pass($message);
        }
    }
    $message = str_replace("\n", "\n<br />\n", $message);

     $template->assign_block_vars("postrow", array(
          "POSTER_NAME" => $poster,
          "POST_DATE" => $post_date,
        "POST_SUBJECT" => $post_subject,
        "MESSAGE" => $message)
    );
}


//
// Set up all the other template variables
//
$page_title = $lang['View_topic'] ." - $topic_title";
$template->assign_vars(array(
    "FORUM_ID" => $forum_id,
    "FORUM_NAME" => $forum_name,
    "TOPIC_ID" => $topic_id,
    "TOPIC_TITLE" => $topic_title,
    "SITENAME" => $board_config['sitename'],
    "SITE_DESCRIPTION" => $board_config['site_desc'],
    "PAGE_TITLE" => $page_title,
    "L_POSTED" => $lang['Posted'],
    "L_POST_SUBJECT" => $lang['Post_subject'],
    "L_POSTED" => $lang['Posted'],
    "L_AUTHOR" => $lang['Author'],
    "L_SUBJECT" => $lang['Subject'],
    "L_MESSAGE" => $lang['Message'],
    "L_FORUM" => $lang['Forum'],
    "PHPBB_VERSION" => "2.0 " . $board_config['version'],
    "T_FONTFACE1" => $theme['fontface1'],
    "T_FONTSIZE2" => $theme['fontsize2'],
    "S_CONTENT_DIRECTION" => $lang['DIRECTION'],
    "S_CONTENT_ENCODING" => $lang['ENCODING'],
    "S_TIMEZONE" => sprintf($lang['All_times'], $lang[$board_config['board_timezone']]),
    "L_TOPICS" => $lang['Topics'])
);
//
// Right, thats got it all, send out to template.
//
$template->pparse("body");
$db->sql_close();
//
// Compress buffered output if required
// and send to browser
//
if($do_gzip_compress)
{
    //
    // Borrowed from php.net!
    //
    $gzip_contents = ob_get_contents();
    ob_end_clean();

    $gzip_size = strlen($gzip_contents);
    $gzip_crc = crc32($gzip_contents);

    $gzip_contents = gzcompress($gzip_contents, 9);
    $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);

    echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
    echo $gzip_contents;
    echo pack("V", $gzip_crc);
    echo pack("V", $gzip_size);
}

exit;
?>
Jetzt die viewtopic_print_message.tpl (hier müssen ein paar Veränderungen bezüglich eures templates rein)

Code: Alles auswählen

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" -->
<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">
<title>{SITENAME} :: {PAGE_TITLE}</title>
<style type="text/css">
<!--
body {
    font-family: {T_FONTFACE1};
    font-size: 12px ;
    letter-spacing: 1px;
}
/* Quote & Code blocks */
.code, .quote, .php {
    font-size: 11px;
	border: black; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px
}
.Forum {
    font-weight : bold;
    font-size: 18px;
}
.Topic {
    font-weight : bold;
    font-size: 14px;
}
.genmed {
    font-size: 12px;
}
hr.sep	{ height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}



-->
</style>
</head>
<body>
<span class="Forum"><div align="center">{SITENAME}</div></span><br />
<span class="Topic">{FORUM_NAME} - {TOPIC_TITLE}</span><br />

  <!-- BEGIN postrow -->
   <hr />
  <b>{postrow.POSTER_NAME}</b> - {postrow.POST_DATE}<br />
  <b>{L_POST_SUBJECT}: </b>{postrow.POST_SUBJECT}<hr width=95% class="sep"/>
  {postrow.MESSAGE}
  <!-- END postrow -->
  <hr />
  <div align="center">{S_TIMEZONE}
    <br />
    <b>Design and Modifications (additional scripting and bug fixes) by <a href="http://www.tl-networks.com/" target="_blank" class="copyright">TL Networks</a>
    <br />Template-Version 2.1.0 &copy; 2002 <a href="http://www.tl-networks.com/" target="_blank" class="copyright">TL Networks</a></b>
    <br />based on phpBB
  </div>
</body>
</html>
Die viewtopic.php soll wie folgt geändert werden:

Suche in viewtopic.php:

'SIGNATURE' => $user_sig,


Danach einfügen:

// Begin Printable Page MOD
'L_PRINT_MESSAGE' => $lang['Print_Message'],
'U_PRINT_MESSAGE' => append_sid("print_message.$phpEx?" .
POST_TOPIC_URL . "=$topic_id&" . POST_POST_URL . "=" .
$postrow[$i]['post_id']),
// End Printable Page MOD



Leider fehlen hier (offenbar) die Änderungen in der viewtopic_body.tpl !!!

Wäre toll, wenn dies jemand ausprobiert und die fehlende Zeile hier postet. Müsste zB im Beitrag unterhalb der Grafik für onlien/offline sein (falls vorhanden)

Verfasst: 29.10.2003 14:17
von Helmut71
niemand? :cry:

Verfasst: 29.10.2003 18:36
von Helmut71
ich bin einfach lästig und frage nochmals sehr höflich... :oops:


Ist sicher ein sehr brauchbarer Mod, den viele gut nützen könnten....

...leider blicke ich mich in der view_topic_body.tpl nicht genug durch um das selbst zu schaffen.

Verfasst: 29.10.2003 21:04
von Elo_
An der Stelle wo Du den Link hingesetzt haben möchtest fügst Du in der viewtopic_body.tpl

Code: Alles auswählen

<a href="{U_PRINT_MESSAGE}" target="_blank">{L_PRINT_MESSAGE}</a>
ein.

In der lang_main.php noch eine Zeile ala

Code: Alles auswählen

$lang['Print_Message'] = 'Beitrag drucken';
und fettich.

Elo

Verfasst: 29.10.2003 22:41
von Helmut71
Es ist wie verhext. Was immer ich tue, wo immer ich das einsetze, es wird absolut NICHTS angezeigt...ich mit schon mürbe.

Verfasst: 29.10.2003 23:01
von AmigaLink
Ey Super Klasse!!!
Wo hast Du den jetzt her?
Hat marmo Dir geantwortet???

Wenn ich morgen Zeit bekommen sollte (ich hoffe mal) dann werde ich ihn mal einbaun. Mal schaun ob ich Dir dann noch etwas dazu sagen kann.

Greetz ... Amiga