From 44af2623123cd02a8baa484b69f88af8e6d1782b Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Wed, 20 Nov 2002 23:07:01 +0000 Subject: [PATCH] Got bored so added print topic output view git-svn-id: file:///svn/phpbb/trunk@3071 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/lang_main.php | 1 + phpBB/templates/subSilver/viewtopic_body.html | 9 +- .../templates/subSilver/viewtopic_print.html | 111 ++++++++++++++++++ phpBB/viewtopic.php | 43 ++----- 4 files changed, 127 insertions(+), 37 deletions(-) create mode 100644 phpBB/templates/subSilver/viewtopic_print.html diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index d88b2ce280..091233c269 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -217,6 +217,7 @@ $lang = array_merge($lang, array( 'View_topic' => 'View topic', 'Guest' => 'Guest', 'POST_SUBJECT' => 'Post subject', + 'PRINT_TOPIC' => 'Printable version', 'View_next_topic' => 'View next topic', 'View_previous_topic' => 'View previous topic', 'Submit_vote' => 'Submit Vote', diff --git a/phpBB/templates/subSilver/viewtopic_body.html b/phpBB/templates/subSilver/viewtopic_body.html index bfd0fcbb09..85aebbcc0c 100644 --- a/phpBB/templates/subSilver/viewtopic_body.html +++ b/phpBB/templates/subSilver/viewtopic_body.html @@ -19,7 +19,12 @@ - + @@ -144,7 +149,7 @@
{L_VIEW_PREVIOUS_TOPIC} :: {L_VIEW_NEXT_TOPIC}  + + + + +
 {L_PRINT_TOPIC}{L_VIEW_PREVIOUS_TOPIC} :: {L_VIEW_NEXT_TOPIC} 
- +
{S_WATCH_TOPIC}
{L_RATE_TOPIC}: {S_SELECT_RATING} 
{S_WATCH_TOPIC} {S_AUTH_LIST}
{L_QUICK_MOD}: {S_TOPIC_MOD}
diff --git a/phpBB/templates/subSilver/viewtopic_print.html b/phpBB/templates/subSilver/viewtopic_print.html new file mode 100644 index 0000000000..ffbfb997ec --- /dev/null +++ b/phpBB/templates/subSilver/viewtopic_print.html @@ -0,0 +1,111 @@ + + + + + +{SITENAME} :: {PAGE_TITLE} + + + + + + + + + + + + + + + +
{SITENAME}
{U_FORUM}

{TOPIC_TITLE}
{U_TOPIC}
{PAGE_NUMBER}
+ + + +
+ + + + + + + + + + + + + +
{L_AUTHOR}: {postrow.POSTER_NAME} [ {postrow.POST_DATE} ]
{L_POST_SUBJECT}: {postrow.POST_SUBJECT}

{postrow.MESSAGE}
+ + +
+ + + + + + + + + +
{PAGE_NUMBER}{S_TIMEZONE}
Powered by phpBB {PHPBB_VERSION} © 2002 phpBB Group
http://www.phpbb.com/
+ + + \ No newline at end of file diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 84a5ecd398..38de8a5716 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -42,7 +42,7 @@ $user->start(); // Find topic id if user requested a newer or older topic if (isset($_GET['view']) && empty($post_id)) { - if ($_GET['view'] == 'newest') + if ($_GET['view'] == 'newest' || $_GET['view'] == 'latest') { if ($user->session_id) { @@ -95,38 +95,6 @@ if (isset($_GET['view']) && empty($post_id)) } } -if ($user->data['user_id'] != ANONYMOUS) -{ - if (isset($_POST['rating'])) - { - $sql = "SELECT rating - FROM " . TOPICS_RATINGS_TABLE . " - WHERE topic_id = $topic_id - AND user_id = " . $user->data['user_id']; - $result = $db->sql_query($sql); - - $rating = ($row = $db->sql_fetchrow($result)) ? $row['rating'] : ''; - - if (empty($_POST['rating_value']) && $rating != '') - { - } - else - { - $new_rating = intval($_POST['rating']); - - $sql = ($rating != '') ? "UPDATE " . TOPICS_RATING_TABLE . " SET rating = $new_rating WHERE user_id = " . $user->data['user_id'] . " AND topic_id = $topic_id" : "INSERT INTO " . TOPICS_RATING_TABLE . " (topic_id, user_id, rating) VALUES ($topic_id, " . $user->data['user_id'] . ", $new_rating)"; - } - } - else if (isset($_POST['castvote'])) - { - if (!isset($_POST['vote_id'])) - { - trigger_error($user->lang['No_vote']); - } - } -} - - // Look at this query ... perhaps a re-think? Perhaps store topic ids rather // than last/first post ids and have a redirect at the top of this page // for latest post, newest post for a given topic_id? @@ -415,6 +383,8 @@ $template->assign_block_vars('navlinks', array( $forum_moderators = array(); get_moderators($forum_moderators, $forum_id); +$server_path = (($config['cookie_secure']) ? 'https://' : 'http://' ) . trim($config['server_name']) . (($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/') . trim($config['script_path']) . '/'; + // Send vars to template $template->assign_vars(array( 'FORUM_ID' => $forum_id, @@ -423,7 +393,7 @@ $template->assign_vars(array( 'TOPIC_ID' => $topic_id, 'TOPIC_TITLE' => $topic_title, 'PAGINATION' => $pagination, - 'PAGE_NUMBER' => sprintf($user->lang['Page_of'], (floor($start / $config['posts_per_page']) + 1), ceil($topic_replies / $config['posts_per_page'])), + 'PAGE_NUMBER' => on_page($topic_replies, $config['posts_per_page'], $start), 'MOD_CP' => ($auth->acl_gets('m_', 'a_', $forum_id)) ? sprintf($user->lang['MCP'], '', '') : '', 'MODERATORS' => (sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : $user->lang['None'], @@ -460,9 +430,12 @@ $template->assign_vars(array( 'S_WATCH_TOPIC' => $s_watching_topic, 'U_VIEW_TOPIC' => "viewtopic.$phpEx$SID&t=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=" . $_GET['highlight'], + 'U_TOPIC' => $server_path . 'viewtopic.' . $phpEx . '?t=' . $topic_id, + 'U_FORUM' => $server_path, 'U_VIEW_FORUM' => $view_forum_url, 'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url, 'U_VIEW_NEWER_TOPIC' => $view_next_topic_url, + 'U_PRINT_TOPIC' => "viewtopic.$phpEx$SID&t=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=" . $_GET['highlight'] . "&view=print", 'U_POST_NEW_TOPIC' => $new_topic_url, 'U_POST_REPLY_TOPIC' => $reply_topic_url) ); @@ -926,7 +899,7 @@ $page_title = $user->lang['View_topic'] .' - ' . $topic_title; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( - 'body' => 'viewtopic_body.html') + 'body' => (isset($_GET['view']) && $_GET['view'] == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html') ); make_jumpbox('viewforum.'.$phpEx, $forum_id);