Revision 1258
Added by Dietmar almost 15 years ago
view.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
/**************************************************************************** |
|
3 |
* SVN Version information: |
|
2 |
/* |
|
4 | 3 |
* |
5 |
* $Id$
|
|
4 |
* About WebsiteBaker
|
|
6 | 5 |
* |
7 |
***************************************************************************** |
|
8 |
* WebsiteBaker |
|
9 |
* |
|
10 |
* WebsiteBaker Project <http://www.websitebaker2.org/> |
|
11 |
* Copyright (C) 2009, Website Baker Org. e.V. |
|
12 |
* http://start.websitebaker2.org/impressum-datenschutz.php |
|
13 |
* Copyright (C) 2004-2009, Ryan Djurovich |
|
14 |
* |
|
15 |
* About WebsiteBaker |
|
16 |
* |
|
17 | 6 |
* Website Baker is a PHP-based Content Management System (CMS) |
18 | 7 |
* designed with one goal in mind: to enable its users to produce websites |
19 | 8 |
* with ease. |
20 | 9 |
* |
21 |
*****************************************************************************
|
|
10 |
* LICENSE INFORMATION
|
|
22 | 11 |
* |
23 |
***************************************************************************** |
|
24 |
* LICENSE INFORMATION |
|
25 |
* |
|
26 | 12 |
* WebsiteBaker is free software; you can redistribute it and/or |
27 | 13 |
* modify it under the terms of the GNU General Public License |
28 | 14 |
* as published by the Free Software Foundation; either version 2 |
... | ... | |
36 | 22 |
* You should have received a copy of the GNU General Public License |
37 | 23 |
* along with this program; if not, write to the Free Software |
38 | 24 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
39 |
**************************************************************************** |
|
40 | 25 |
* |
41 | 26 |
* WebsiteBaker Extra Information |
42 | 27 |
* |
43 | 28 |
* |
44 |
* |
|
45 |
* |
|
46 |
*****************************************************************************/ |
|
29 |
*/ |
|
47 | 30 |
/** |
48 | 31 |
* |
49 |
* @category modules |
|
50 |
* @package news |
|
51 |
* @author Ryan Djurovich |
|
52 |
* @copyright 2004-2009, Ryan Djurovich |
|
53 |
* @copyright 2009, Website Baker Org. e.V. |
|
54 |
* @version $Id$ |
|
55 |
* @platform WebsiteBaker 2.8.x |
|
56 |
* @requirements >= PHP 4.3.4 |
|
57 |
* @license http://www.gnu.org/licenses/gpl.html |
|
32 |
* @category modules |
|
33 |
* @package news |
|
34 |
* @author Ryan Djurovich |
|
35 |
* @copyright 2004-2009, Ryan Djurovich |
|
36 |
* @copyright 2009-2010, Website Baker Org. e.V. |
|
37 |
* @filesource $HeadURL$ |
|
38 |
* @author Ryan Djurovich |
|
39 |
* @copyright 2004-2009, Ryan Djurovich |
|
58 | 40 |
* |
41 |
* @author WebsiteBaker Project |
|
42 |
* @link http://www.websitebaker2.org/ |
|
43 |
* @copyright 2009-2010, Website Baker Org. e.V. |
|
44 |
* @link http://start.websitebaker2.org/impressum-datenschutz.php |
|
45 |
* @license http://www.gnu.org/licenses/gpl.html |
|
46 |
* @version $Id$ |
|
47 |
* @platform WebsiteBaker 2.8.x |
|
48 |
* @requirements PHP 4.3.4 and higher |
|
49 |
* @lastmodified $Date$ |
|
50 |
* |
|
59 | 51 |
*/ |
60 | 52 |
|
61 | 53 |
// Must include code to stop this file being access directly |
... | ... | |
66 | 58 |
require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang ); |
67 | 59 |
|
68 | 60 |
//overwrite php.ini on Apache servers for valid SESSION ID Separator |
69 |
if(function_exists('ini_set')) { |
|
61 |
if(function_exists('ini_set')) |
|
62 |
{ |
|
70 | 63 |
ini_set('arg_separator.output', '&'); |
71 | 64 |
} |
72 | 65 |
|
... | ... | |
74 | 67 |
if(isset($_GET['p']) AND is_numeric($_GET['p']) AND $_GET['p'] >= 0) |
75 | 68 |
{ |
76 | 69 |
$position = $_GET['p']; |
77 |
} |
|
78 |
else |
|
79 |
{ |
|
70 |
} else { |
|
80 | 71 |
$position = 0; |
81 | 72 |
} |
82 | 73 |
|
... | ... | |
85 | 76 |
$query_users = $database->query("SELECT user_id,username,display_name,email FROM ".TABLE_PREFIX."users"); |
86 | 77 |
if($query_users->numRows() > 0) |
87 | 78 |
{ |
88 |
while($user = $query_users->fetchRow())
|
|
79 |
while( false != ($user = $query_users->fetchRow()) )
|
|
89 | 80 |
{ |
90 | 81 |
// Insert user info into users array |
91 | 82 |
$user_id = $user['user_id']; |
... | ... | |
107 | 98 |
$query_users = $database->query("SELECT group_id,title,active FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC"); |
108 | 99 |
if($query_users->numRows() > 0) |
109 | 100 |
{ |
110 |
while($group = $query_users->fetchRow())
|
|
101 |
while( false != ($group = $query_users->fetchRow()) )
|
|
111 | 102 |
{ |
112 | 103 |
// Insert user info into users array |
113 | 104 |
$group_id = $group['group_id']; |
... | ... | |
116 | 107 |
if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) |
117 | 108 |
{ |
118 | 109 |
$groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg'; |
119 |
} |
|
120 |
else |
|
121 |
{ |
|
110 |
} else { |
|
122 | 111 |
$groups[$group_id]['image'] = ''; |
123 | 112 |
} |
124 | 113 |
} |
... | ... | |
134 | 123 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) |
135 | 124 |
{ |
136 | 125 |
$query_extra = " AND group_id = '".$_GET['g']."'"; |
137 |
} |
|
138 |
else |
|
139 |
{ |
|
126 |
} else { |
|
140 | 127 |
$query_extra = ''; |
141 | 128 |
} |
142 | 129 |
|
... | ... | |
144 | 131 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) |
145 | 132 |
{ |
146 | 133 |
$query_extra = " AND group_id = '".$_GET['g']."'"; |
147 |
} |
|
148 |
else |
|
149 |
{ |
|
134 |
} else { |
|
150 | 135 |
$query_extra = ''; |
151 | 136 |
} |
152 | 137 |
|
... | ... | |
159 | 144 |
$setting_post_loop = ($fetch_settings['post_loop']); |
160 | 145 |
$setting_footer = ($fetch_settings['footer']); |
161 | 146 |
$setting_posts_per_page = $fetch_settings['posts_per_page']; |
162 |
} |
|
163 |
else |
|
164 |
{ |
|
147 |
} else { |
|
165 | 148 |
$setting_header = ''; |
166 | 149 |
$setting_post_loop = ''; |
167 | 150 |
$setting_footer = ''; |
... | ... | |
179 | 162 |
if($setting_posts_per_page != 0) |
180 | 163 |
{ |
181 | 164 |
$limit_sql = " LIMIT $position, $setting_posts_per_page"; |
182 |
} |
|
183 |
else |
|
184 |
{ |
|
165 |
} else { |
|
185 | 166 |
$limit_sql = ""; |
186 | 167 |
} |
187 | 168 |
|
... | ... | |
200 | 181 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) |
201 | 182 |
{ |
202 | 183 |
$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&g='.$_GET['g'].'"><< '; |
203 |
} |
|
204 |
else |
|
205 |
{ |
|
184 |
} else { |
|
206 | 185 |
$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'"><< '; |
207 | 186 |
} |
208 | 187 |
$pl_append = '</a>'; |
209 | 188 |
$previous_link = $pl_prepend.$TEXT['PREVIOUS'].$pl_append; |
210 | 189 |
$previous_page_link = $pl_prepend.$TEXT['PREVIOUS_PAGE'].$pl_append; |
211 |
} |
|
212 |
else |
|
213 |
{ |
|
190 |
} else { |
|
214 | 191 |
$previous_link = ''; |
215 | 192 |
$previous_page_link = ''; |
216 | 193 |
} |
... | ... | |
218 | 195 |
{ |
219 | 196 |
$next_link = ''; |
220 | 197 |
$next_page_link = ''; |
221 |
} |
|
222 |
else |
|
223 |
{ |
|
198 |
} else { |
|
224 | 199 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) |
225 | 200 |
{ |
226 | 201 |
$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&g='.$_GET['g'].'"> '; |
227 |
} |
|
228 |
else |
|
229 |
{ |
|
202 |
} else { |
|
230 | 203 |
$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'"> '; |
231 | 204 |
} |
232 | 205 |
$nl_append = ' >></a>'; |
... | ... | |
236 | 209 |
if($position+$setting_posts_per_page > $total_num) |
237 | 210 |
{ |
238 | 211 |
$num_of = $position+$num_posts; |
239 |
} |
|
240 |
else |
|
241 |
{ |
|
212 |
} else { |
|
242 | 213 |
$num_of = $position+$setting_posts_per_page; |
243 | 214 |
} |
244 | 215 |
|
245 | 216 |
$out_of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OUT_OF']).' '.$total_num; |
246 | 217 |
$of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OF']).' '.$total_num; |
247 | 218 |
$display_previous_next_links = ''; |
248 |
} |
|
249 |
else |
|
250 |
{ |
|
219 |
} else { |
|
251 | 220 |
$display_previous_next_links = 'none'; |
252 | 221 |
} |
253 | 222 |
|
... | ... | |
264 | 233 |
{ |
265 | 234 |
print str_replace( array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), |
266 | 235 |
array('','','','','','', $display_previous_next_links), $setting_header); |
267 |
} |
|
268 |
else |
|
269 |
{ |
|
236 |
} else { |
|
270 | 237 |
print str_replace( array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), |
271 | 238 |
array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_header); |
272 | 239 |
} |
... | ... | |
280 | 247 |
</div> |
281 | 248 |
<?php |
282 | 249 |
} |
283 |
while($post = $query_posts->fetchRow())
|
|
250 |
while( false != ($post = $query_posts->fetchRow()) )
|
|
284 | 251 |
{ |
285 | 252 |
if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) |
286 | 253 |
{ // Make sure parent group is active |
... | ... | |
291 | 258 |
{ |
292 | 259 |
$post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE); |
293 | 260 |
$post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE); |
294 |
} |
|
295 |
else |
|
296 |
{ |
|
261 |
} else { |
|
297 | 262 |
$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE); |
298 | 263 |
$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE); |
299 | 264 |
} |
... | ... | |
307 | 272 |
$post_link_path = str_replace(WB_URL, WB_PATH,$post_link); |
308 | 273 |
if(file_exists($post_link_path)) |
309 | 274 |
{ |
310 |
$create_date = date(DATE_FORMAT, filectime ( $post_link_path )); |
|
311 |
$create_time = date(TIME_FORMAT, filectime ( $post_link_path )); |
|
312 |
} |
|
313 |
else |
|
314 |
{ |
|
275 |
$create_date = date(DATE_FORMAT, filemtime ( $post_link_path )); |
|
276 |
$create_time = date(TIME_FORMAT, filemtime ( $post_link_path )); |
|
277 |
} else { |
|
315 | 278 |
$create_date = $publ_date; |
316 | 279 |
$create_time = $publ_time; |
317 | 280 |
} |
... | ... | |
349 | 312 |
if($post_long_len < 9) |
350 | 313 |
{ |
351 | 314 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;', $post_date, $post_time, $create_date, $create_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '', 'hidden'); |
352 |
} |
|
353 |
else |
|
354 |
{ |
|
315 |
} else { |
|
355 | 316 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $create_date, $create_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $MOD_NEWS['TEXT_READ_MORE'], 'visible'); |
356 | 317 |
} |
357 |
} |
|
358 |
else |
|
359 |
{ |
|
318 |
} else { |
|
360 | 319 |
if($post_long_len < 9) |
361 | 320 |
{ |
362 | 321 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;', $post_date, $post_time, $create_date, $create_time, $publ_date, $publ_time, '', '', '', '', '','hidden'); |
363 |
} |
|
364 |
else |
|
365 |
{ |
|
322 |
} else { |
|
366 | 323 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $create_date, $create_time, $publ_date, $publ_time, '', '', '', '', $MOD_NEWS['TEXT_READ_MORE'],'visible'); |
367 | 324 |
} |
368 | 325 |
} |
... | ... | |
397 | 354 |
$setting_comments_header = ($fetch_settings['comments_header']); |
398 | 355 |
$setting_comments_loop = ($fetch_settings['comments_loop']); |
399 | 356 |
$setting_comments_footer = ($fetch_settings['comments_footer']); |
400 |
} else |
|
401 |
{ |
|
357 |
} else { |
|
402 | 358 |
$setting_post_header = ''; |
403 | 359 |
$setting_post_footer = ''; |
404 | 360 |
$setting_comments_header = ''; |
... | ... | |
420 | 376 |
if(isset($_GET['p']) AND $position > 0) { $page_link .= '&'; } else { $page_link .= '?'; } |
421 | 377 |
$page_link .= 'g='.$_GET['g']; |
422 | 378 |
} |
423 |
} |
|
424 |
else |
|
425 |
{ |
|
379 |
} else { |
|
426 | 380 |
exit($MESSAGE['PAGES']['NOT_FOUND']); |
427 | 381 |
} |
428 | 382 |
|
... | ... | |
430 | 384 |
$t = time(); |
431 | 385 |
$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts |
432 | 386 |
WHERE post_id = '".POST_ID."' AND active = '1' |
433 |
AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t) |
|
434 |
"); |
|
387 |
AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)"); |
|
435 | 388 |
|
436 | 389 |
if($query_post->numRows() > 0) |
437 | 390 |
{ |
... | ... | |
461 | 414 |
$post_link_path = str_replace(WB_URL, WB_PATH,$post_link); |
462 | 415 |
if(file_exists($post_link_path)) |
463 | 416 |
{ |
464 |
$create_date = date(DATE_FORMAT, filectime ( $post_link_path )); |
|
465 |
$create_time = date(TIME_FORMAT, filectime ( $post_link_path )); |
|
466 |
} |
|
467 |
else |
|
468 |
{ |
|
417 |
$create_date = date(DATE_FORMAT, filemtime ( $post_link_path )); |
|
418 |
$create_time = date(TIME_FORMAT, filemtime ( $post_link_path )); |
|
419 |
} else { |
|
469 | 420 |
$create_date = $publ_date; |
470 | 421 |
$create_time = $publ_time; |
471 | 422 |
} |
... | ... | |
484 | 435 |
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') |
485 | 436 |
{ |
486 | 437 |
$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, $create_date, $create_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']); |
487 |
} |
|
488 |
else |
|
489 |
{ |
|
438 |
} else { |
|
490 | 439 |
$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, $create_date, $create_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], '', '', '', ''); |
491 | 440 |
} |
492 | 441 |
|
493 | 442 |
$post_long = ($post['content_long']); |
494 | 443 |
} |
495 |
} |
|
496 |
else |
|
497 |
{ |
|
444 |
} else { |
|
498 | 445 |
$wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], "javascript: history.go(-1);", false); |
499 | 446 |
exit(0); |
500 | 447 |
} |
... | ... | |
520 | 467 |
|
521 | 468 |
// Query for comments |
522 | 469 |
$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"); |
523 |
if($query_comments->numRows() > 0) { |
|
524 |
while($comment = $query_comments->fetchRow()) { |
|
470 |
if($query_comments->numRows() > 0) |
|
471 |
{ |
|
472 |
while( false != ($comment = $query_comments->fetchRow()) ) |
|
473 |
{ |
|
525 | 474 |
// Display Comments without slashes, but with new-line characters |
526 | 475 |
$comment['comment'] = nl2br($wb->strip_slashes($comment['comment'])); |
527 | 476 |
$comment['title'] = $wb->strip_slashes($comment['title']); |
... | ... | |
530 | 479 |
$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE); |
531 | 480 |
$uid = $comment['commented_by']; |
532 | 481 |
$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]'); |
533 |
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') { |
|
482 |
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') |
|
483 |
{ |
|
534 | 484 |
$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'])); |
535 | 485 |
} else { |
536 | 486 |
$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'], ''); |
... | ... | |
542 | 492 |
$content = ''; |
543 | 493 |
if(isset($TEXT['NONE_FOUND'])) { |
544 | 494 |
$content .= '<tr><td>'.$TEXT['NONE_FOUND'].'<br /></td></tr>'; |
545 |
} |
|
546 |
else |
|
547 |
{ |
|
495 |
} else { |
|
548 | 496 |
$content .= '<tr><td>None Found<br /></td></tr>'; |
549 | 497 |
} |
550 | 498 |
print $content; |
... | ... | |
557 | 505 |
|
558 | 506 |
} |
559 | 507 |
|
560 |
} |
|
508 |
}
|
|
561 | 509 |
|
562 |
if(ENABLED_ASP) { |
|
510 |
if(ENABLED_ASP) |
|
511 |
{ |
|
563 | 512 |
$_SESSION['comes_from_view'] = POST_ID; |
564 | 513 |
$_SESSION['comes_from_view_time'] = time(); |
565 | 514 |
} |
566 | 515 |
Also available in: Unified diff
update few header info