Seite 1 von 1

short urls und rss feed

Verfasst: 04.10.2004, 22:46
von austrian-i
ich habe ein phpbb-forum, wo der der short url mod und ein rss feed eingebaut sind.

wie muss ich den rss feed (siehe unten) bzw. die htaccess anpassen, damit im rss feed keine dynamischen urls auftauchen, sondern die statischen??

bin damit sehr überfordert und für jede hilfe dankbar!

Code: Alles auswählen

<?php
/***************************************************************************
*				   rss.php
*			     -------------------
*   begin		 &#58; Monday, July 7, 2003
*   notes		 &#58; This code is based on the work of the original
*			   developer below.  Portions of this code
*			   'borrowed' from phpbb_fetch_posts, an
*			   untitled rdf content syndicator posted at
*			   phpbb.com, and phpbb itself.
*   email		 &#58; rss@wickedwisdom.com
*
*
*   $Id&#58; rss.php,v 2.0.1 2003/07/17 10&#58;11&#58;00 nschindler Exp $
*
*
***************************************************************************/

/***************************************************************************
*				   rdf.php
*			     -------------------
*   begin		 &#58; Saturday, Mar 2, 2002
*   copyright		 &#58; &#40;C&#41; 2002 Matthijs van de Water
*				    Sascha Carlin
*   email		 &#58; phpbb@matthijs.net
*			   sc@itst.org
*
*   $Id&#58; rdf.php,v 1.3.1 2003/02/16 14&#58;43&#58;11 mvdwater Exp $
*
*
***************************************************************************/

/***************************************************************************
*
*   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
*   &#40;at your option&#41; any later version.
*
***************************************************************************/

//
// BEGIN Configuration
//
// Set the relative path from this file to your phpBB root folder
$phpbb_root_path = './';
// How many posts do you want to returnd &#40;count&#41;?  Specified in the URL with "c=".  Defaults to 15, upper limit of 50.
$count = &#40; isset&#40;$HTTP_GET_VARS&#91;'c'&#93;&#41; &#41; ? intval&#40;$HTTP_GET_VARS&#91;'c'&#93;&#41; &#58; 30;
$count = &#40; $count == 0 &#41; ? 15 &#58; $count;
$count = &#40; $count > 50 &#41; ? 50 &#58; $count;
// Which forum do you want posts from &#40;forum_id&#41;?  specified in the url with "f=".  Defaults to all &#40;public&#41; forums.
$forum_id = &#40; isset&#40;$HTTP_GET_VARS&#91;'f'&#93;&#41; &#41; ? intval&#40;$HTTP_GET_VARS&#91;'f'&#93;&#41; &#58; 1;
$sql_forum_where = &#40; !empty&#40;$forum_id&#41; &#41; ? ' AND f.forum_id IN&#40;1,2,3,14,7,9,5&#41; ' &#58; ' ';
// Return topics only, or all posts?  Specified in the URL with "t=".  Defaults to all posts &#40;0&#41;.
$topics_only = &#40;isset&#40;$HTTP_GET_VARS&#91;'t'&#93;&#41; &#41; ? intval&#40;$HTTP_GET_VARS&#91;'t'&#93;&#41; &#58; 0;
$sql_topics_only_where = '';
if &#40; $topics_only == 1 &#41;
&#123;
	$sql_topics_only_where = 'AND p.post_id = t.topic_first_post_id';
&#125;
//
// END Configuration
//

//
// BEGIN Includes of phpBB scripts
//
define &#40;'IN_PHPBB', true&#41;;
include&#40;$phpbb_root_path . 'extension.inc'&#41;;
include&#40;$phpbb_root_path . 'common.'.$phpEx&#41;;
include&#40;$phpbb_root_path . 'includes/bbcode.'.$phpEx&#41;;
//
// END Includes of phpBB scripts
//

//
// BEGIN Session management
//
$userdata = session_pagestart&#40;$user_ip, PAGE_INDEX&#41;;
init_userprefs&#40;$userdata&#41;;
//
// End session management
//

//
// BEGIN Create main board information &#40;some code borrowed from functions_post.php&#41;
//
// Build URL components
$script_name = preg_replace&#40;'/^\/?&#40;.*?&#41;\/?$/', '\1', trim&#40;$board_config&#91;'script_path'&#93;&#41;&#41;;
$viewpost = &#40; $script_name != '' &#41; ? $script_name . '/viewtopic.' . $phpEx &#58; 'viewtopic.'. $phpEx;
$index = &#40; $script_name != '' &#41; ? $script_name . '/index.' . $phpEx &#58; 'index.'. $phpEx;
$server_name = trim&#40;$board_config&#91;'server_name'&#93;&#41;;
$server_protocol = &#40; $board_config&#91;'cookie_secure'&#93; &#41; ? 'https&#58;//' &#58; 'http&#58;//';
$server_port = &#40; $board_config&#91;'server_port'&#93; <> 80 &#41; ? '&#58;' . trim&#40;$board_config&#91;'server_port'&#93;&#41; . '/' &#58; '/';
// Assemble URL components
$index_url = $server_protocol . $server_name . $server_port . $script_name . '/';
$viewpost_url = $server_protocol . $server_name . $server_port . $viewpost;
// Reformat site name and description
$site_name = strip_tags&#40;$board_config&#91;'sitename'&#93;&#41;;
$site_description = strip_tags&#40;$board_config&#91;'site_desc'&#93;&#41;;
// Set the fully qualified url to your smilies folder
$smilies_path = $board_config&#91;'smilies_path'&#93;;
$smilies_url = $index_url . $smilies_path;
$smilies_path = preg_replace&#40;"/\//", "\/", $smilies_path&#41;;
//
// END Create main board information
//

//
// BEGIN Initialise template
//
$template->set_filenames&#40;array&#40;
	"body" => "rss_body.tpl"&#41;
&#41;;
//
// END Initialise template
//

//
// BEGIN Assign static variables to template
//
// Variable reassignment for Topic Replies
$l_topic_replies = $lang&#91;'Topic'&#93; . ' ' . $lang&#91;'Replies'&#93;;
$template->assign_vars&#40;array&#40;
	'S_CONTENT_ENCODING' => $lang&#91;'ENCODING'&#93;,
	'BOARD_URL' => $index_url,
	'BOARD_TITLE' => $site_name,
	'BOARD_DESCRIPTION' => $site_description,
	'BOARD_MANAGING_EDITOR' => $board_config&#91;'board_email'&#93;,
	'BOARD_WEBMASTER' => $board_config&#91;'board_email'&#93;,
	'BUILD_DATE' => gmdate&#40;'D, d M Y H&#58;i&#58;s', time&#40;&#41;&#41; . ' GMT', 
	'L_AUTHOR' => $lang&#91;'Author'&#93;,
	'L_POSTED' => $lang&#91;'Posted'&#93;,
	'L_TOPIC_REPLIES' => $l_topic_replies,
	'L_POST' => $lang&#91;'Post'&#93;&#41;
&#41;;
//
// END Assign static variabless to template
//

//
// BEGIN SQL statement to fetch active posts of public forums
//
$sql = "SELECT f.forum_name, t.topic_title, u.user_id, u.username, u.user_sig, u.user_sig_bbcode_uid, p.post_id, pt.post_text, pt.post_subject, pt.bbcode_uid, p.post_time, t.topic_replies, t.topic_first_post_id
	FROM " . FORUMS_TABLE . " AS f, " . TOPICS_TABLE . " AS t, " . USERS_TABLE . " AS u, " . POSTS_TABLE . " AS p, " . POSTS_TEXT_TABLE . " as pt
	WHERE
		t.forum_id = f.forum_id
			AND f.auth_view = " . AUTH_ALL . "
			AND p.poster_id = u.user_id
			AND pt.post_id = p.post_id
			AND p.topic_id = t.topic_id
			$sql_topics_only_where
			$sql_forum_where
	ORDER BY p.post_time DESC LIMIT $count";
$posts_query = $db->sql_query&#40;$sql&#41;;
//
// END SQL statement to fetch active posts of public forums
//

//
// BEGIN Query failure check
//
if &#40; !$posts_query &#41;
&#123;
	message_die&#40;GENERAL_ERROR, "Could not query list of active posts", "", __LINE__, __FILE__, $sql&#41;;
&#125;
else if &#40; !$db->sql_numrows&#40;$posts_query&#41; &#41;
&#123;
	message_die&#40;GENERAL_MESSAGE, $lang&#91;'No_match'&#93;&#41;;
&#125;
else
&#123;
//
// END Query failure check
//

//
// BEGIN "item" loop
//
	while &#40;$post = $db->sql_fetchrow&#40;$posts_query&#41;&#41;
	&#123;

// Variable reassignment and reformatting for post text
$post_text = $post&#91;'post_text'&#93;;
$post_text = str_replace&#40;"\n", "\n<br />\n", $post_text&#41;;
$post_text = bbencode_second_pass&#40;$post_text, $post&#91;'bbcode_uid'&#93;&#41;;
$post_text = smilies_pass&#40;$post_text&#41;;
$post_text = preg_replace&#40;"/$smilies_path/", $smilies_url, $post_text&#41;;
$post_text = make_clickable&#40;$post_text&#41;;
// Variable reassignment and reformatting for user sig
$user_sig = $post&#91;'user_sig'&#93;;
$user_sig = bbencode_second_pass&#40;$user_sig, $post&#91;'user_sig_bbcode_uid'&#93;&#41;;
$user_sig = smilies_pass&#40;$user_sig&#41;;
$user_sig = preg_replace&#40;"/$smilies_path/", $smilies_url, $user_sig&#41;;
$user_sig = make_clickable&#40;$user_sig&#41;;
	if &#40; $user_sig != '' &#41;
&#123;
		$user_sig = '<br />_________________<br />' . str_replace&#40;"\n", "\n<br />\n", $user_sig&#41;;
&#125;
// Variable reassignment and reformatting for post subject
$post_subject = $post&#91;'post_subject'&#93;;
	if &#40; $post_subject != '' &#41;
&#123;
		$post_subject = $lang&#91;'Subject'&#93; . '&#58; ' . htmlspecialchars&#40;$post_subject&#41; . '<br />';
&#125;
// Variable reassignment for topic title, and show whether it is the start of topic, or a reply
$topic_title = $post&#91;'topic_title'&#93;;
if &#40; $post&#91;'post_id'&#93; != $post&#91;'topic_first_post_id'&#93; &#41;
&#123;
	$topic_title = 'RE&#58; ' . $topic_title;
&#125;
// Variable reassignment and reformatting for author
$author = $post&#91;'username'&#93;;
if &#40; $post&#91;'user_id'&#93; != -1 &#41;
&#123;
        $author = '<a href="' . $index_url . 'profile.' . $phpEx . '?mode=viewprofile&u=' . $post&#91;'user_id'&#93; . '" target="_blank">'
 . $author . '</a>';
&#125;
$author = make_clickable&#40;$author&#41;;
// Assign "item" variables to template
		$template->assign_block_vars&#40;'post_item', array&#40;
			'POST_URL' => $viewpost_url . '?' . POST_POST_URL . '=' . $post&#91;'post_id'&#93; . '#' . $post&#91;'post_id'&#93;,
			'TOPIC_TITLE' => htmlspecialchars&#40;$topic_title&#41;,
			'AUTHOR' => htmlspecialchars&#40;$author&#41;,
			'POST_TIME' => create_date&#40;$board_config&#91;'default_dateformat'&#93;, $post&#91;'post_time'&#93;, $board_config&#91;'board_timezone'&#93;&#41;.' &#40;GMT ' . $board_config&#91;'board_timezone'&#93; . '&#41;',
			'POST_SUBJECT' => htmlspecialchars&#40;$post_subject&#41;,
			'FORUM_NAME' => htmlspecialchars&#40;$post&#91;'forum_name'&#93;&#41;,
			'POST_TEXT' => htmlspecialchars&#40;$post_text&#41;,
			'USER_SIG' => htmlspecialchars&#40;$user_sig&#41;,
			'TOPIC_REPLIES' => $post&#91;'topic_replies'&#93;
&#41;
		&#41;;
	&#125;
&#125;
//
// END "item" loop
//

//
// BEGIN XML and nocaching headers &#40;copied from page_header.php&#41;
//
if &#40;!empty&#40;$HTTP_SERVER_VARS&#91;'SERVER_SOFTWARE'&#93;&#41; && strstr&#40;$HTTP_SERVER_VARS&#91;'SERVER_SOFTWARE'&#93;, 'Apache/2'&#41;&#41;
&#123;
	header &#40;'Cache-Control&#58; no-cache, pre-check=0, post-check=0, max-age=0'&#41;;
&#125;
else
&#123;
	header &#40;'Cache-Control&#58; private, pre-check=0, post-check=0, max-age=0'&#41;;
&#125;
header &#40;'Expires&#58; ' . gmdate&#40;'D, d M Y H&#58;i&#58;s', time&#40;&#41;&#41; . ' GMT'&#41;;
header &#40;'Last-Modified&#58; ' . gmdate&#40;'D, d M Y H&#58;i&#58;s'&#41; . ' GMT'&#41;;
header &#40;'Content-Type&#58; text/xml'&#41;;
//
// End XML and nocaching headers
//

//
// BEGIN Output XML page
//
$template->pparse&#40;'body'&#41;;
//
// END Output XML page
//

?>

Verfasst:
von
Content Erstellung von ABAKUS Internet Marketing
Ihre Vorteile:
  • einzigartige Texte
  • suchmaschinenoptimierte Inhalte
  • eine sinnvolle Content-Strategie
  • Beratung und Umsetzung
Jetzt anfragen: 0511 / 300325-0

Verfasst: 04.10.2004, 23:17
von Luckybuy3000
Hallo,

ich find das wirklich nicht so toll, hier ungefragt eine derart lange Datei zu posten. Soll ich meine Session.php auch noch dran hängen. Dann sprengen wir vielleicht das Forum. Hab sogar mehrer sessions.phps anzubieten.Vielleicht macht mir ja dann einer die session ids raus ? Außerdem gibts hier eine Suchfunktion.Dann wurde das Thema auch hier schon angesprochen:
https://www.abakus-internet-marketing.d ... -7556.html

Verfasst: 07.12.2004, 09:48
von hmueller
Hi,

@Luckybuy3000: was hat der Beitrag 7556 mit der Frage in diesem Thema zu tun? Eigentlich gar nichts. Austrian-i fragt, wie er den RSS-Feed mit statischen URLs erzeugen lassen kann (siehe abakus-RSS), im anderen Beitrag geht es um die Anzeige des Feeds auf einer Website.

@austrian-i: mittlerweile eine Lösung gefunden? Würde mich auch interessieren.