5 |
5 |
/*
|
6 |
6 |
|
7 |
7 |
Website Baker Project <http://www.websitebaker.org/>
|
8 |
|
Copyright (C) 2004-2009, Ryan Djurovich
|
|
8 |
Copyright (C) 2004-2008, Ryan Djurovich
|
9 |
9 |
|
10 |
10 |
Website Baker is free software; you can redistribute it and/or modify
|
11 |
11 |
it under the terms of the GNU General Public License as published by
|
... | ... | |
24 |
24 |
*/
|
25 |
25 |
|
26 |
26 |
// Must include code to stop this file being access directly
|
27 |
|
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
|
|
27 |
if (defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
|
28 |
28 |
|
29 |
29 |
// check if frontend.css file needs to be included into the <body></body> of view.php
|
30 |
30 |
if((!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) && file_exists(WB_PATH .'/modules/news/frontend.css')) {
|
... | ... | |
33 |
33 |
echo "\n</style>\n";
|
34 |
34 |
}
|
35 |
35 |
|
36 |
|
// check if module language file exists for the language set by the user (e.g. DE, EN)
|
37 |
|
if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) {
|
38 |
|
// no module language file exists for the language set by the user, include default module language file EN.php
|
39 |
|
require_once(WB_PATH .'/modules/news/languages/EN.php');
|
40 |
|
} else {
|
41 |
|
// a module language file exists for the language defined by the user, load it
|
42 |
|
require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php');
|
43 |
|
}
|
|
36 |
/**
|
|
37 |
* Load Language file
|
|
38 |
*/
|
|
39 |
$lang = (dirname(__FILE__))."/languages/". LANGUAGE .".php";
|
|
40 |
require_once ( !file_exists($lang) ? (dirname(__FILE__))."/languages/EN.php" : $lang );
|
44 |
41 |
|
45 |
|
//overwrite php.ini on Apache servers for valid SESSION ID Separator
|
46 |
|
if(function_exists('ini_set')) {
|
47 |
|
ini_set('arg_separator.output', '&');
|
48 |
|
}
|
49 |
|
|
50 |
42 |
// Check if there is a start point defined
|
51 |
43 |
if(isset($_GET['p']) AND is_numeric($_GET['p']) AND $_GET['p'] >= 0) {
|
52 |
44 |
$position = $_GET['p'];
|
... | ... | |
68 |
60 |
}
|
69 |
61 |
|
70 |
62 |
// Get groups (title, if they are active, and their image [if one has been uploaded])
|
71 |
|
if (isset($groups)) {
|
72 |
|
unset($groups);
|
73 |
|
}
|
74 |
63 |
$groups[0]['title'] = '';
|
75 |
64 |
$groups[0]['active'] = true;
|
76 |
65 |
$groups[0]['image'] = '';
|
... | ... | |
139 |
128 |
if($setting_posts_per_page != 0) {
|
140 |
129 |
if($position > 0) {
|
141 |
130 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
|
142 |
|
$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&g='.$_GET['g'].'"><< ';
|
|
131 |
$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&g='.$_GET['g'].'"><< ';
|
143 |
132 |
} else {
|
144 |
|
$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'"><< ';
|
|
133 |
$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'"><< ';
|
145 |
134 |
}
|
146 |
135 |
$pl_append = '</a>';
|
147 |
136 |
$previous_link = $pl_prepend.$TEXT['PREVIOUS'].$pl_append;
|
... | ... | |
155 |
144 |
$next_page_link = '';
|
156 |
145 |
} else {
|
157 |
146 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
|
158 |
|
$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&g='.$_GET['g'].'"> ';
|
|
147 |
$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&g='.$_GET['g'].'"> ';
|
159 |
148 |
} else {
|
160 |
149 |
$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'"> ';
|
161 |
150 |
}
|
162 |
|
$nl_append = ' >></a>';
|
|
151 |
$nl_append = ' >></a>';
|
163 |
152 |
$next_link = $nl_prepend.$TEXT['NEXT'].$nl_append;
|
164 |
153 |
$next_page_link = $nl_prepend.$TEXT['NEXT_PAGE'].$nl_append;
|
165 |
154 |
}
|
... | ... | |
186 |
175 |
if($query_extra != '') {
|
187 |
176 |
?>
|
188 |
177 |
<div class="selected_group_title">
|
189 |
|
<?php echo '<a href="'.htmlspecialchars(strip_tags($_SERVER['PHP_SELF'])).'">'.PAGE_TITLE.'</a> >> '.$groups[$_GET['g']]['title']; ?>
|
|
178 |
<?php echo '<a href="'.htmlspecialchars(strip_tags($_SERVER['PHP_SELF'])).'">'.PAGE_TITLE.'</a> >> '.$groups[$_GET['g']]['title']; ?>
|
190 |
179 |
</div>
|
191 |
180 |
<?php
|
192 |
181 |
}
|
... | ... | |
194 |
183 |
if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
|
195 |
184 |
$uid = $post['posted_by']; // User who last modified the post
|
196 |
185 |
// Workout date and time of last modified post
|
197 |
|
if ($post['published_when'] > $post['posted_when']) {
|
198 |
|
$post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);
|
199 |
|
$post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);
|
200 |
|
} else {
|
201 |
|
$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
|
202 |
|
$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
|
203 |
|
}
|
|
186 |
$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
|
|
187 |
$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
|
204 |
188 |
$publ_date = date(DATE_FORMAT,$post['published_when']);
|
205 |
189 |
$publ_time = date(TIME_FORMAT,$post['published_when']);
|
206 |
190 |
// Work-out the post link
|
... | ... | |
209 |
193 |
$post_link .= '?p='.$position;
|
210 |
194 |
}
|
211 |
195 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
|
212 |
|
if(isset($_GET['p']) AND $position > 0) { $post_link .= '&'; } else { $post_link .= '?'; }
|
|
196 |
if(isset($_GET['p']) AND $position > 0) { $post_link .= '&'; } else { $post_link .= '?'; }
|
213 |
197 |
$post_link .= 'g='.$_GET['g'];
|
214 |
198 |
}
|
215 |
199 |
// Get group id, title, and image
|
... | ... | |
223 |
207 |
$wb->preprocess($short);
|
224 |
208 |
// Replace vars with values
|
225 |
209 |
$post_long_len = strlen($post['content_long']);
|
226 |
|
$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[MODI_DATE]', '[MODI_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]');
|
227 |
|
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
|
228 |
|
if($post_long_len < 9) {
|
229 |
|
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '');
|
230 |
|
} else {
|
231 |
|
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $MOD_NEWS['TEXT_READ_MORE']);
|
232 |
|
}
|
233 |
|
} else {
|
234 |
|
if($post_long_len < 9) {
|
235 |
|
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $publ_time, '', '', '', '', '');
|
236 |
|
} else {
|
237 |
|
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $publ_time, '', '', '', '', $MOD_NEWS['TEXT_READ_MORE']);
|
238 |
|
}
|
239 |
|
}
|
240 |
|
echo str_replace($vars, $values, $setting_post_loop);
|
|
210 |
|
|
211 |
$display_user_info = (isset($users[$uid]['username']) AND $users[$uid]['username'] != '');
|
|
212 |
|
|
213 |
$vars = array(
|
|
214 |
'[PAGE_TITLE]' => PAGE_TITLE,
|
|
215 |
'[GROUP_ID]' => $group_id,
|
|
216 |
'[GROUP_TITLE]' => $group_title,
|
|
217 |
'[GROUP_IMAGE]' => $group_image,
|
|
218 |
'[DISPLAY_GROUP]' => $display_group,
|
|
219 |
'[DISPLAY_IMAGE]' => $display_image,
|
|
220 |
'[TITLE]' => $post['title'],
|
|
221 |
'[SHORT]' => $short,
|
|
222 |
'[LINK]' => $post_link,
|
|
223 |
'[MODI_DATE]' => $post_date,
|
|
224 |
'[MODI_TIME]' => $post_time,
|
|
225 |
'[PUBLISHED_DATE]' => $publ_date,
|
|
226 |
'[PUBLISHED_TIME]' => $publ_time,
|
|
227 |
'[USER_ID]' => $uid,
|
|
228 |
'[USERNAME]' => ( true === $display_user_info ) ? $users[$uid]['username'] : "",
|
|
229 |
'[DISPLAY_NAME]' => ( true === $display_user_info ) ? $users[$uid]['display_name'] : "",
|
|
230 |
'[EMAIL]' => ( true === $display_user_info ) ? $users[$uid]['email'] : "",
|
|
231 |
'[TEXT_READ_MORE]' => ( $post_long_len < 9 ) ? "" : $TEXT['READ_MORE'],
|
|
232 |
'[LAST_CHANGED]' => $MOD_NEWS['LAST_CHANGED'],
|
|
233 |
'[LAST_CHANGED_AT]' => $MOD_NEWS['LAST_CHANGED_AT'],
|
|
234 |
'[POSTET_BY]' => $MOD_NEWS['POSTET_BY'],
|
|
235 |
'[POSTET_ON]' => $MOD_NEWS['POSTET_ON']
|
|
236 |
);
|
|
237 |
|
|
238 |
echo str_replace( array_keys($vars), array_values($vars), $setting_post_loop);
|
241 |
239 |
}
|
242 |
240 |
}
|
243 |
241 |
}
|
... | ... | |
277 |
275 |
$page_link .= '?p='.$_GET['p'];
|
278 |
276 |
}
|
279 |
277 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
|
280 |
|
if(isset($_GET['p']) AND $position > 0) { $page_link .= '&'; } else { $page_link .= '?'; }
|
|
278 |
if(isset($_GET['p']) AND $position > 0) { $page_link .= '&'; } else { $page_link .= '?'; }
|
281 |
279 |
$page_link .= 'g='.$_GET['g'];
|
282 |
280 |
}
|
283 |
281 |
} else {
|
... | ... | |
295 |
293 |
if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
|
296 |
294 |
$uid = $post['posted_by']; // User who last modified the post
|
297 |
295 |
// Workout date and time of last modified post
|
298 |
|
if ($post['published_when'] > $post['posted_when']) {
|
299 |
|
$post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);
|
300 |
|
$post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);
|
301 |
|
} else {
|
302 |
|
$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
|
303 |
|
$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
|
304 |
|
}
|
|
296 |
$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
|
|
297 |
$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
|
305 |
298 |
$publ_date = date(DATE_FORMAT,$post['published_when']);
|
306 |
299 |
$publ_time = date(TIME_FORMAT,$post['published_when']);
|
307 |
300 |
// Get group id, title, and image
|
... | ... | |
310 |
303 |
$group_image = $groups[$group_id]['image'];
|
311 |
304 |
if($group_image == '') { $display_image = 'none'; } else { $display_image = ''; }
|
312 |
305 |
if($group_id == 0) { $display_group = 'none'; } else { $display_group = ''; }
|
313 |
|
$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[BACK]', '[TEXT_BACK]', '[TEXT_LAST_CHANGED]', '[MODI_DATE]', '[TEXT_AT]', '[MODI_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[TEXT_POSTED_BY]', '[TEXT_ON]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]');
|
|
306 |
|
|
307 |
$display_user_info = (isset($users[$uid]['username']) AND $users[$uid]['username'] != '');
|
|
308 |
|
|
309 |
$vars = array(
|
|
310 |
'[PAGE_TITLE]' => PAGE_TITLE,
|
|
311 |
'[GROUP_ID]' => $group_id,
|
|
312 |
'[GROUP_TITLE]' => $group_title,
|
|
313 |
'[GROUP_IMAGE]' => $group_image,
|
|
314 |
'[DISPLAY_GROUP]' => $display_group,
|
|
315 |
'[DISPLAY_IMAGE]' => $display_image,
|
|
316 |
'[TITLE]' => $post['title'],
|
|
317 |
'[SHORT]' => $post_short,
|
|
318 |
'[BACK]' => $page_link,
|
|
319 |
'[MODI_DATE]' => $post_date,
|
|
320 |
'[MODI_TIME]' => $post_time,
|
|
321 |
'[PUBLISHED_DATE]' => $publ_date,
|
|
322 |
'[PUBLISHED_TIME]' => $publ_time,
|
|
323 |
'[USER_ID]' => ( true === $display_user_info ) ? $uid : "",
|
|
324 |
'[USERNAME]' => ( true === $display_user_info ) ? $users[$uid]['username'] : "",
|
|
325 |
'[DISPLAY_NAME]' => ( true === $display_user_info ) ? $users[$uid]['display_name'] : "",
|
|
326 |
'[EMAIL]' => ( true === $display_user_info ) ? $users[$uid]['email'] : "",
|
|
327 |
'[LAST_CHANGED]' => $MOD_NEWS['LAST_CHANGED'],
|
|
328 |
'[LAST_CHANGED_AT]' => $MOD_NEWS['LAST_CHANGED_AT'],
|
|
329 |
'[POSTET_BY]' => $MOD_NEWS['POSTET_BY'],
|
|
330 |
'[POSTET_ON]' => $MOD_NEWS['POSTET_ON']
|
|
331 |
);
|
|
332 |
|
314 |
333 |
$post_short=$post['content_short'];
|
315 |
334 |
$wb->preprocess($post_short);
|
316 |
|
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
|
317 |
|
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $MOD_NEWS['TEXT_BACK'], $MOD_NEWS['TEXT_LAST_CHANGED'], $post_date, $MOD_NEWS['TEXT_AT'], $post_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email']);
|
318 |
|
} else {
|
319 |
|
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $MOD_NEWS['TEXT_BACK'], $MOD_NEWS['TEXT_LAST_CHANGED'], $post_date, $MOD_NEWS['TEXT_AT'], $post_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], '', '', '', '');
|
320 |
|
}
|
321 |
|
$post_long = ($post['content_long']);
|
|
335 |
|
|
336 |
$post_long = $post['content_long'];
|
322 |
337 |
}
|
323 |
338 |
} else {
|
324 |
339 |
$wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], "javascript: history.go(-1);", false);
|
... | ... | |
326 |
341 |
}
|
327 |
342 |
|
328 |
343 |
// Print post header
|
329 |
|
echo str_replace($vars, $values, $setting_post_header);
|
|
344 |
echo str_replace( array_keys($vars), array_values($vars), $setting_post_header);
|
330 |
345 |
|
331 |
346 |
// Replace [wblink--PAGE_ID--] with real link
|
332 |
347 |
$wb->preprocess($post_long);
|
... | ... | |
334 |
349 |
echo $post_long;
|
335 |
350 |
|
336 |
351 |
// Print post footer
|
337 |
|
echo str_replace($vars, $values, $setting_post_footer);
|
|
352 |
echo str_replace( array_keys($vars), array_values($vars), $setting_post_footer);
|
338 |
353 |
|
339 |
354 |
// Show comments section if we have to
|
340 |
355 |
if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public') {
|
341 |
356 |
|
342 |
357 |
// Print comments header
|
343 |
|
$vars = array('[ADD_COMMENT_URL]','[TEXT_COMMENTS]');
|
344 |
|
$values = array(WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);
|
345 |
|
echo str_replace($vars, $values, $setting_comments_header);
|
|
358 |
echo str_replace('[ADD_COMMENT_URL]', WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $setting_comments_header);
|
346 |
359 |
|
347 |
360 |
// Query for comments
|
348 |
361 |
$query_comments = $database->query("SELECT title,comment,commented_when,commented_by FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".POST_ID."' ORDER BY commented_when ASC");
|
... | ... | |
355 |
368 |
$commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
|
356 |
369 |
$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
|
357 |
370 |
$uid = $comment['commented_by'];
|
358 |
|
$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
|
|
371 |
$vars = array('[TITLE]','[COMMENT]','[DATE]','[TIME]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
|
359 |
372 |
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
|
360 |
|
$values = array(($comment['title']), ($comment['comment']), $MOD_NEWS['TEXT_ON'], $commented_date, $MOD_NEWS['TEXT_AT'], $commented_time, $MOD_NEWS['TEXT_BY'], $uid, ($users[$uid]['username']), ($users[$uid]['display_name']), ($users[$uid]['email']));
|
|
373 |
$values = array(($comment['title']), ($comment['comment']), $commented_date, $commented_time, $uid, ($users[$uid]['username']), ($users[$uid]['display_name']), ($users[$uid]['email']));
|
361 |
374 |
} else {
|
362 |
|
$values = array(($comment['title']), ($comment['comment']), $MOD_NEWS['TEXT_ON'], $commented_date, $MOD_NEWS['TEXT_AT'], $commented_time, $MOD_NEWS['TEXT_BY'], '0', strtolower($TEXT['UNKNOWN']), $TEXT['UNKNOWN'], '');
|
|
375 |
$values = array(($comment['title']), ($comment['comment']), $commented_date, $commented_time, '0', strtolower($TEXT['UNKNOWN']), $TEXT['UNKNOWN'], '');
|
363 |
376 |
}
|
364 |
377 |
echo str_replace($vars, $values, $setting_comments_loop);
|
365 |
378 |
}
|
... | ... | |
373 |
386 |
}
|
374 |
387 |
|
375 |
388 |
// Print comments footer
|
376 |
|
$vars = array('[ADD_COMMENT_URL]','[TEXT_ADD_COMMENT]');
|
377 |
|
$values = array(WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $MOD_NEWS['TEXT_ADD_COMMENT']);
|
378 |
|
echo str_replace($vars, $values, $setting_comments_footer);
|
|
389 |
echo str_replace('[ADD_COMMENT_URL]', WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $setting_comments_footer);
|
379 |
390 |
}
|
380 |
391 |
if(ENABLED_ASP) {
|
381 |
392 |
$_SESSION['comes_from_view'] = POST_ID;
|
... | ... | |
383 |
394 |
}
|
384 |
395 |
}
|
385 |
396 |
|
386 |
|
?>
|
|
397 |
?>
|
Bugfix inside news-modul: publish-date isn't display in the detail view.
Modify error.htt template for valid xhtml-output.