datum in rss.php
dit is het script
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<?php
//
// 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 (count)? Specified in the URL with "c=". Defaults to 15, upper limit of 50.
$count = ( isset($HTTP_GET_VARS['c']) ) ? intval($HTTP_GET_VARS['c']) : 15;
$count = ( $count == 0 ) ? 15 : $count;
$count = ( $count > 50 ) ? 50 : $count;
// Which forum do you want posts from (forum_id)? specified in the url with "f=". Defaults to all (public) forums.
$forum_id = ( isset($HTTP_GET_VARS['f']) ) ? intval($HTTP_GET_VARS['f']) : '';
$sql_forum_where = ( !empty($forum_id) ) ? ' AND f.forum_id = ' . $forum_id : ' ';
// Return topics only, or all posts? Specified in the URL with "t=". Defaults to all posts (0).
$topics_only = (isset($HTTP_GET_VARS['t']) ) ? intval($HTTP_GET_VARS['t']) : 0;
$sql_topics_only_where = '';
if ( $topics_only == 1 )
{
$sql_topics_only_where = 'AND p.post_id = t.topic_first_post_id';
}
//
// END Configuration
//
//
// BEGIN Includes of phpBB scripts
//
define ('IN_PHPBB', true);
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
//
// END Includes of phpBB scripts
//
//
// BEGIN Session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
//
// BEGIN Create main board information (some code borrowed from functions_post.php)
//
// Build URL components
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
$viewpost = ( $script_name != '' ) ? $script_name . '/viewtopic.' . $phpEx : 'viewtopic.'. $phpEx;
$index = ( $script_name != '' ) ? $script_name . '/index.' . $phpEx : 'index.'. $phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
// 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($board_config['sitename']);
$site_description = strip_tags($board_config['site_desc']);
// Set the fully qualified url to your smilies folder
$smilies_path = $board_config['smilies_path'];
$smilies_url = $index_url . $smilies_path;
$smilies_path = preg_replace("/\//", "\/", $smilies_path);
//
// END Create main board information
//
//
// BEGIN Initialise template
//
$template->set_filenames(array(
"body" => "rss_body.tpl")
);
//
// END Initialise template
//
//
// BEGIN Assign static variables to template
//
// Variable reassignment for Topic Replies
$l_topic_replies = $lang['Topic'] . ' ' . $lang['Replies'];
$template->assign_vars(array(
'S_CONTENT_ENCODING' => $lang['ENCODING'],
'BOARD_URL' => $index_url,
'BOARD_TITLE' => $site_name,
'BOARD_DESCRIPTION' => $site_description,
'BOARD_MANAGING_EDITOR' => $board_config['board_email'],
'BOARD_WEBMASTER' => $board_config['board_email'],
'BUILD_DATE' => gmdate('D, d M Y H:i:s', time()) . ' GMT',
'L_AUTHOR' => $lang['Author'],
'L_POSTED' => $lang['Posted'],
'L_TOPIC_REPLIES' => $l_topic_replies,
'L_POST' => $lang['Post'])
);
//
// 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($sql);
//
// END SQL statement to fetch active posts of public forums
//
//
// BEGIN Query failure check
//
if ( !$posts_query )
{
message_die(GENERAL_ERROR, "Could not query list of active posts", "", __LINE__, __FILE__, $sql);
}
else if ( !$db->sql_numrows($posts_query) )
{
message_die(GENERAL_MESSAGE, $lang['No_match']);
}
else
{
//
// END Query failure check
//
//
// BEGIN "item" loop
//
while ($post = $db->sql_fetchrow($posts_query))
{
// Variable reassignment and reformatting for post text
$post_text = $post['post_text'];
$post_text = str_replace("\n", "\n<br />\n", $post_text);
$post_text = bbencode_second_pass($post_text, $post['bbcode_uid']);
$post_text = smilies_pass($post_text);
$post_text = preg_replace("/$smilies_path/", $smilies_url, $post_text);
$post_text = make_clickable($post_text);
// Variable reassignment and reformatting for user sig
$user_sig = $post['user_sig'];
$user_sig = bbencode_second_pass($user_sig, $post['user_sig_bbcode_uid']);
$user_sig = smilies_pass($user_sig);
$user_sig = preg_replace("/$smilies_path/", $smilies_url, $user_sig);
$user_sig = make_clickable($user_sig);
if ( $user_sig != '' )
{
$user_sig = '<br />_________________<br />' . str_replace("\n", "\n<br />\n", $user_sig);
}
// Variable reassignment and reformatting for post subject
$post_subject = $post['post_subject'];
if ( $post_subject != '' )
{
$post_subject = $lang['Subject'] . ': ' . htmlspecialchars($post_subject) . '<br />';
}
// Variable reassignment for topic title, and show whether it is the start of topic, or a reply
$topic_title = $post['topic_title'];
if ( $post['post_id'] != $post['topic_first_post_id'] )
{
$topic_title = 'RE: ' . $topic_title;
}
// Variable reassignment and reformatting for author
$author = $post['username'];
if ( $post['user_id'] != -1 )
{
$author = '<a href="' . $index_url . 'profile.' . $phpEx . '?mode=viewprofile&u=' . $post['user_id'] . '" target="_blank">'
. $author . '</a>';
}
$author = make_clickable($author);
// Assign "item" variables to template
$template->assign_block_vars('post_item', array(
'POST_URL' => $viewpost_url . '?' . POST_POST_URL . '=' . $post['post_id'] . '#' . $post['post_id'],
'TOPIC_TITLE' => htmlspecialchars($topic_title),
'AUTHOR' => htmlspecialchars($author),
'POST_TIME' => create_date($board_config['default_dateformat'], $post['post_time'], $board_config['board_timezone']).' (GMT ' . $board_config['board_timezone'] . ')',
'POST_SUBJECT' => htmlspecialchars($post_subject),
'FORUM_NAME' => htmlspecialchars($post['forum_name']),
'POST_TEXT' => htmlspecialchars($post_text),
'USER_SIG' => htmlspecialchars($user_sig),
'TOPIC_REPLIES' => $post['topic_replies']
)
);
}
}
//
// END "item" loop
//
//
// BEGIN XML and nocaching headers (copied from page_header.php)
//
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))
{
header ('Cache-Control: no-cache, pre-check=0, post-check=0, max-age=0');
}
else
{
header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header ('Content-Type: text/xml');
//
// End XML and nocaching headers
//
//
// BEGIN Output XML page
//
$template->pparse('body');
//
// END Output XML page
//
?>
//
// 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 (count)? Specified in the URL with "c=". Defaults to 15, upper limit of 50.
$count = ( isset($HTTP_GET_VARS['c']) ) ? intval($HTTP_GET_VARS['c']) : 15;
$count = ( $count == 0 ) ? 15 : $count;
$count = ( $count > 50 ) ? 50 : $count;
// Which forum do you want posts from (forum_id)? specified in the url with "f=". Defaults to all (public) forums.
$forum_id = ( isset($HTTP_GET_VARS['f']) ) ? intval($HTTP_GET_VARS['f']) : '';
$sql_forum_where = ( !empty($forum_id) ) ? ' AND f.forum_id = ' . $forum_id : ' ';
// Return topics only, or all posts? Specified in the URL with "t=". Defaults to all posts (0).
$topics_only = (isset($HTTP_GET_VARS['t']) ) ? intval($HTTP_GET_VARS['t']) : 0;
$sql_topics_only_where = '';
if ( $topics_only == 1 )
{
$sql_topics_only_where = 'AND p.post_id = t.topic_first_post_id';
}
//
// END Configuration
//
//
// BEGIN Includes of phpBB scripts
//
define ('IN_PHPBB', true);
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
//
// END Includes of phpBB scripts
//
//
// BEGIN Session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
//
// BEGIN Create main board information (some code borrowed from functions_post.php)
//
// Build URL components
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
$viewpost = ( $script_name != '' ) ? $script_name . '/viewtopic.' . $phpEx : 'viewtopic.'. $phpEx;
$index = ( $script_name != '' ) ? $script_name . '/index.' . $phpEx : 'index.'. $phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
// 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($board_config['sitename']);
$site_description = strip_tags($board_config['site_desc']);
// Set the fully qualified url to your smilies folder
$smilies_path = $board_config['smilies_path'];
$smilies_url = $index_url . $smilies_path;
$smilies_path = preg_replace("/\//", "\/", $smilies_path);
//
// END Create main board information
//
//
// BEGIN Initialise template
//
$template->set_filenames(array(
"body" => "rss_body.tpl")
);
//
// END Initialise template
//
//
// BEGIN Assign static variables to template
//
// Variable reassignment for Topic Replies
$l_topic_replies = $lang['Topic'] . ' ' . $lang['Replies'];
$template->assign_vars(array(
'S_CONTENT_ENCODING' => $lang['ENCODING'],
'BOARD_URL' => $index_url,
'BOARD_TITLE' => $site_name,
'BOARD_DESCRIPTION' => $site_description,
'BOARD_MANAGING_EDITOR' => $board_config['board_email'],
'BOARD_WEBMASTER' => $board_config['board_email'],
'BUILD_DATE' => gmdate('D, d M Y H:i:s', time()) . ' GMT',
'L_AUTHOR' => $lang['Author'],
'L_POSTED' => $lang['Posted'],
'L_TOPIC_REPLIES' => $l_topic_replies,
'L_POST' => $lang['Post'])
);
//
// 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($sql);
//
// END SQL statement to fetch active posts of public forums
//
//
// BEGIN Query failure check
//
if ( !$posts_query )
{
message_die(GENERAL_ERROR, "Could not query list of active posts", "", __LINE__, __FILE__, $sql);
}
else if ( !$db->sql_numrows($posts_query) )
{
message_die(GENERAL_MESSAGE, $lang['No_match']);
}
else
{
//
// END Query failure check
//
//
// BEGIN "item" loop
//
while ($post = $db->sql_fetchrow($posts_query))
{
// Variable reassignment and reformatting for post text
$post_text = $post['post_text'];
$post_text = str_replace("\n", "\n<br />\n", $post_text);
$post_text = bbencode_second_pass($post_text, $post['bbcode_uid']);
$post_text = smilies_pass($post_text);
$post_text = preg_replace("/$smilies_path/", $smilies_url, $post_text);
$post_text = make_clickable($post_text);
// Variable reassignment and reformatting for user sig
$user_sig = $post['user_sig'];
$user_sig = bbencode_second_pass($user_sig, $post['user_sig_bbcode_uid']);
$user_sig = smilies_pass($user_sig);
$user_sig = preg_replace("/$smilies_path/", $smilies_url, $user_sig);
$user_sig = make_clickable($user_sig);
if ( $user_sig != '' )
{
$user_sig = '<br />_________________<br />' . str_replace("\n", "\n<br />\n", $user_sig);
}
// Variable reassignment and reformatting for post subject
$post_subject = $post['post_subject'];
if ( $post_subject != '' )
{
$post_subject = $lang['Subject'] . ': ' . htmlspecialchars($post_subject) . '<br />';
}
// Variable reassignment for topic title, and show whether it is the start of topic, or a reply
$topic_title = $post['topic_title'];
if ( $post['post_id'] != $post['topic_first_post_id'] )
{
$topic_title = 'RE: ' . $topic_title;
}
// Variable reassignment and reformatting for author
$author = $post['username'];
if ( $post['user_id'] != -1 )
{
$author = '<a href="' . $index_url . 'profile.' . $phpEx . '?mode=viewprofile&u=' . $post['user_id'] . '" target="_blank">'
. $author . '</a>';
}
$author = make_clickable($author);
// Assign "item" variables to template
$template->assign_block_vars('post_item', array(
'POST_URL' => $viewpost_url . '?' . POST_POST_URL . '=' . $post['post_id'] . '#' . $post['post_id'],
'TOPIC_TITLE' => htmlspecialchars($topic_title),
'AUTHOR' => htmlspecialchars($author),
'POST_TIME' => create_date($board_config['default_dateformat'], $post['post_time'], $board_config['board_timezone']).' (GMT ' . $board_config['board_timezone'] . ')',
'POST_SUBJECT' => htmlspecialchars($post_subject),
'FORUM_NAME' => htmlspecialchars($post['forum_name']),
'POST_TEXT' => htmlspecialchars($post_text),
'USER_SIG' => htmlspecialchars($user_sig),
'TOPIC_REPLIES' => $post['topic_replies']
)
);
}
}
//
// END "item" loop
//
//
// BEGIN XML and nocaching headers (copied from page_header.php)
//
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))
{
header ('Cache-Control: no-cache, pre-check=0, post-check=0, max-age=0');
}
else
{
header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header ('Content-Type: text/xml');
//
// End XML and nocaching headers
//
//
// BEGIN Output XML page
//
$template->pparse('body');
//
// END Output XML page
//
?>
Gewijzigd op 17/09/2004 11:23:00 door EviL
* geen goede uitleg van de vraag
* geen formaat geven waarin je de tijd wil hebben
* geen moeite doen om eerst zelf te zoeken
www.php.net/date