Project

General

Profile

1
<?php
2
/*
3
*
4
*                       About WebsiteBaker
5
*
6
* Website Baker is a PHP-based Content Management System (CMS)
7
* designed with one goal in mind: to enable its users to produce websites
8
* with ease.
9
*
10
*                       LICENSE INFORMATION
11
*
12
* WebsiteBaker is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU General Public License
14
* as published by the Free Software Foundation; either version 2
15
* of the License, or (at your option) any later version.
16
*
17
* WebsiteBaker is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20
* See the GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
*
26
*                   WebsiteBaker Extra Information
27
*
28
*
29
*/
30
/**
31
 *
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: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/news/view.php $
38
 * @author          Ryan Djurovich
39
 * @copyright       2004-2009, Ryan Djurovich
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: view.php 1258 2010-01-21 02:26:08Z Luisehahne $
47
 * @platform        WebsiteBaker 2.8.x
48
 * @requirements    PHP 4.3.4 and higher
49
 * @lastmodified    $Date: 2010-01-21 03:26:08 +0100 (Thu, 21 Jan 2010) $
50
 *
51
 */
52

    
53
// Must include code to stop this file being access directly
54
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
55

    
56
// load module language file
57
$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
58
require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
59

    
60
//overwrite php.ini on Apache servers for valid SESSION ID Separator
61
if(function_exists('ini_set'))
62
{
63
	ini_set('arg_separator.output', '&amp;');
64
}
65

    
66
// Check if there is a start point defined
67
if(isset($_GET['p']) AND is_numeric($_GET['p']) AND $_GET['p'] >= 0)
68
{
69
	$position = $_GET['p'];
70
} else {
71
	$position = 0;
72
}
73

    
74
// Get user's username, display name, email, and id - needed for insertion into post info
75
$users = array();
76
$query_users = $database->query("SELECT user_id,username,display_name,email FROM ".TABLE_PREFIX."users");
77
if($query_users->numRows() > 0)
78
{
79
	while( false != ($user = $query_users->fetchRow()) )
80
    {
81
		// Insert user info into users array
82
		$user_id = $user['user_id'];
83
		$users[$user_id]['username'] = $user['username'];
84
		$users[$user_id]['display_name'] = $user['display_name'];
85
		$users[$user_id]['email'] = $user['email'];
86
	}
87
}
88
// Get groups (title, if they are active, and their image [if one has been uploaded])
89
if (isset($groups))
90
{
91
   unset($groups);
92
}
93

    
94
$groups[0]['title'] = '';
95
$groups[0]['active'] = true;
96
$groups[0]['image'] = '';
97

    
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");
99
if($query_users->numRows() > 0)
100
{
101
	while( false != ($group = $query_users->fetchRow()) )
102
    {
103
		// Insert user info into users array
104
		$group_id = $group['group_id'];
105
		$groups[$group_id]['title'] = ($group['title']);
106
		$groups[$group_id]['active'] = $group['active'];
107
		if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg'))
108
        {
109
			$groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';
110
		} else {
111
			$groups[$group_id]['image'] = '';
112
		}
113
	}
114
}
115

    
116

    
117

    
118
// Check if we should show the main page or a post itself
119
if(!defined('POST_ID') OR !is_numeric(POST_ID))
120
{
121

    
122
	// Check if we should only list posts from a certain group
123
	if(isset($_GET['g']) AND is_numeric($_GET['g']))
124
    {
125
		$query_extra = " AND group_id = '".$_GET['g']."'";
126
	} else {
127
		$query_extra = '';
128
	}
129

    
130
	// Check if we should only list posts from a certain group
131
	if(isset($_GET['g']) AND is_numeric($_GET['g']))
132
    {
133
		$query_extra = " AND group_id = '".$_GET['g']."'";
134
	} else {
135
		$query_extra = '';
136
	}
137

    
138
	// Get settings
139
	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
140
	if($query_settings->numRows() > 0)
141
    {
142
		$fetch_settings = $query_settings->fetchRow();
143
		$setting_header = ($fetch_settings['header']);
144
		$setting_post_loop = ($fetch_settings['post_loop']);
145
		$setting_footer = ($fetch_settings['footer']);
146
		$setting_posts_per_page = $fetch_settings['posts_per_page'];
147
	} else {
148
		$setting_header = '';
149
		$setting_post_loop = '';
150
		$setting_footer = '';
151
		$setting_posts_per_page = '';
152
	}
153

    
154
	$t = time();
155
	// Get total number of posts
156
	$query_total_num = $database->query("SELECT post_id, section_id FROM ".TABLE_PREFIX."mod_news_posts
157
		WHERE section_id = '$section_id' AND active = '1' AND title != '' $query_extra
158
		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)");
159
	$total_num = $query_total_num->numRows();
160

    
161
	// Work-out if we need to add limit code to sql
162
	if($setting_posts_per_page != 0)
163
    {
164
		$limit_sql = " LIMIT $position, $setting_posts_per_page";
165
	} else {
166
		$limit_sql = "";
167
	}
168

    
169
	// Query posts (for this page)
170
	$query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
171
		WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra
172
		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)
173
		ORDER BY position DESC".$limit_sql);
174
	$num_posts = $query_posts->numRows();
175

    
176
	// Create previous and next links
177
	if($setting_posts_per_page != 0)
178
    {
179
		if($position > 0)
180
        {
181
			if(isset($_GET['g']) AND is_numeric($_GET['g']))
182
            {
183
				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&amp;g='.$_GET['g'].'">&lt;&lt; ';
184
			} else {
185
				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'">&lt;&lt; ';
186
			}
187
			$pl_append = '</a>';
188
			$previous_link = $pl_prepend.$TEXT['PREVIOUS'].$pl_append;
189
			$previous_page_link = $pl_prepend.$TEXT['PREVIOUS_PAGE'].$pl_append;
190
		} else {
191
			$previous_link = '';
192
			$previous_page_link = '';
193
		}
194
		if($position + $setting_posts_per_page >= $total_num)
195
        {
196
			$next_link = '';
197
			$next_page_link = '';
198
		} else {
199
			if(isset($_GET['g']) AND is_numeric($_GET['g']))
200
            {
201
				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&amp;g='.$_GET['g'].'"> ';
202
			} else {
203
				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'"> ';
204
			}
205
			$nl_append = ' &gt;&gt;</a>';
206
			$next_link = $nl_prepend.$TEXT['NEXT'].$nl_append;
207
			$next_page_link = $nl_prepend.$TEXT['NEXT_PAGE'].$nl_append;
208
		}
209
		if($position+$setting_posts_per_page > $total_num)
210
        {
211
			$num_of = $position+$num_posts;
212
		} else {
213
			$num_of = $position+$setting_posts_per_page;
214
		}
215

    
216
		$out_of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OUT_OF']).' '.$total_num;
217
		$of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OF']).' '.$total_num;
218
		$display_previous_next_links = '';
219
	} else {
220
		$display_previous_next_links = 'none';
221
	}
222

    
223
	if ($num_posts === 0)
224
    {
225
		$setting_header = '';
226
		$setting_post_loop = '';
227
		$setting_footer = '';
228
		$setting_posts_per_page = '';
229
	}
230

    
231
	// Print header
232
	if($display_previous_next_links == 'none')
233
    {
234
		print  str_replace( array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'),
235
                            array('','','','','','', $display_previous_next_links), $setting_header);
236
	} else {
237
		print str_replace(  array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'),
238
                            array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_header);
239
	}
240
	if($num_posts > 0)
241
    {
242
		if($query_extra != '')
243
        {
244
			?>
245
			<div class="selected-group-title">
246
				<?php print '<a href="'.htmlspecialchars(strip_tags($_SERVER['PHP_SELF'])).'">'.PAGE_TITLE.'</a> &gt;&gt; '.$groups[$_GET['g']]['title']; ?>
247
			</div>
248
			<?php
249
		}
250
		while( false != ($post = $query_posts->fetchRow()) )
251
        {
252
			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
253
            { // Make sure parent group is active
254
				$uid = $post['posted_by']; // User who last modified the post
255
				// Workout date and time of last modified post
256
				if ($post['published_when'] === '0') $post['published_when'] = time();
257
				if ($post['published_when'] > $post['posted_when'])
258
                {
259
					$post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);
260
					$post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);
261
				} else {
262
					$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
263
					$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
264
				}
265

    
266
				$publ_date = date(DATE_FORMAT,$post['published_when']);
267
				$publ_time = date(TIME_FORMAT,$post['published_when']);
268

    
269
				// Work-out the post link
270
				$post_link = page_link($post['link']);
271

    
272
                $post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
273
                if(file_exists($post_link_path))
274
                {
275
    				$create_date = date(DATE_FORMAT, filemtime ( $post_link_path ));
276
    				$create_time = date(TIME_FORMAT, filemtime ( $post_link_path ));
277
                } else {
278
                    $create_date = $publ_date;
279
                    $create_time = $publ_time;
280
                }
281

    
282
				if(isset($_GET['p']) AND $position > 0)
283
                {
284
					$post_link .= '?p='.$position;
285
				}
286
				if(isset($_GET['g']) AND is_numeric($_GET['g']))
287
                {
288
					if(isset($_GET['p']) AND $position > 0) { $post_link .= '&amp;'; } else { $post_link .= '?'; }
289
                    {
290
					$post_link .= 'g='.$_GET['g'];
291
                    }
292
				}
293

    
294
				// Get group id, title, and image
295
				$group_id = $post['group_id'];
296
				$group_title = $groups[$group_id]['title'];
297
				$group_image = $groups[$group_id]['image'];
298
				$display_image = ($group_image == '') ? "none" : "inherit";
299
				$display_group = ($group_id == 0) ? 'none' : 'inherit';
300

    
301
				if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";
302

    
303
				// Replace [wblink--PAGE_ID--] with real link
304
				$short = ($post['content_short']);
305
				$wb->preprocess($short);
306

    
307
				// Replace vars with values
308
				$post_long_len = strlen($post['content_long']);
309
				$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[MODI_DATE]', '[MODI_TIME]', '[CREATED_DATE]', '[CREATED_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]','[SHOW_READ_MORE]');
310
				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
311
                {
312
					if($post_long_len < 9)
313
                    {
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');
315
					} else {
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');
317
					}
318
				} else {
319
					if($post_long_len < 9)
320
                    {
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');
322
					} else {
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');
324
					}
325
				}
326
				print str_replace($vars, $values, $setting_post_loop);
327
			}
328
		}
329
	}
330
    // Print footer
331
    if($display_previous_next_links == 'none')
332
    {
333
    	print  str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array('','','','','','', $display_previous_next_links), $setting_footer);
334
    }
335
    else
336
    {
337
    	print str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_footer);
338
    }
339

    
340
}
341
elseif(defined('POST_ID') AND is_numeric(POST_ID))
342
{
343

    
344
  // print '<h2>'.POST_ID.'/'.PAGE_ID.'/'.POST_SECTION.'</h2>';
345
  if(defined('POST_SECTION') AND POST_SECTION == $section_id)
346
  {
347
	// Get settings
348
	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
349
	if($query_settings->numRows() > 0)
350
    {
351
		$fetch_settings = $query_settings->fetchRow();
352
		$setting_post_header = ($fetch_settings['post_header']);
353
		$setting_post_footer = ($fetch_settings['post_footer']);
354
		$setting_comments_header = ($fetch_settings['comments_header']);
355
		$setting_comments_loop = ($fetch_settings['comments_loop']);
356
		$setting_comments_footer = ($fetch_settings['comments_footer']);
357
	} else {
358
		$setting_post_header = '';
359
		$setting_post_footer = '';
360
		$setting_comments_header = '';
361
		$setting_comments_loop = '';
362
		$setting_comments_footer = '';
363
    }
364
	// Get page info
365
	$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".PAGE_ID."'");
366
	if($query_page->numRows() > 0)
367
    {
368
		$page = $query_page->fetchRow();
369
		$page_link = page_link($page['link']);
370
		if(isset($_GET['p']) AND $position > 0)
371
        {
372
			$page_link .= '?p='.$_GET['p'];
373
		}
374
		if(isset($_GET['g']) AND is_numeric($_GET['g']))
375
        {
376
			if(isset($_GET['p']) AND $position > 0) { $page_link .= '&amp;'; } else { $page_link .= '?'; }
377
			$page_link .= 'g='.$_GET['g'];
378
		}
379
	} else {
380
		exit($MESSAGE['PAGES']['NOT_FOUND']);
381
	}
382

    
383
	// Get post info
384
	$t = time();
385
	$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
386
		WHERE post_id = '".POST_ID."' AND active = '1'
387
		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)");
388

    
389
	if($query_post->numRows() > 0)
390
    {
391
		$post = $query_post->fetchRow();
392
		if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
393
        { // Make sure parent group is active
394
			$uid = $post['posted_by']; // User who last modified the post
395
			// Workout date and time of last modified post
396
			if ($post['published_when'] === '0') $post['published_when'] = time();
397
			if ($post['published_when'] > $post['posted_when'])
398
            {
399
				$post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);
400
				$post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);
401
			}
402
            else
403
            {
404
				$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
405
				$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
406
			}
407

    
408
			$publ_date = date(DATE_FORMAT,$post['published_when']);
409
			$publ_time = date(TIME_FORMAT,$post['published_when']);
410

    
411
				// Work-out the post link
412
				$post_link = page_link($post['link']);
413

    
414
                $post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
415
                if(file_exists($post_link_path))
416
                {
417
    				$create_date = date(DATE_FORMAT, filemtime ( $post_link_path ));
418
    				$create_time = date(TIME_FORMAT, filemtime ( $post_link_path ));
419
                } else {
420
                    $create_date = $publ_date;
421
                    $create_time = $publ_time;
422
                }
423
			// Get group id, title, and image
424
			$group_id = $post['group_id'];
425
			$group_title = $groups[$group_id]['title'];
426
			$group_image = $groups[$group_id]['image'];
427
			$display_image = ($group_image == '') ? "none" : "inherit";
428
			$display_group = ($group_id == 0) ? 'none' : 'inherit';
429

    
430
			if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";
431

    
432
			$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]', '[CREATED_DATE]', '[CREATED_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[TEXT_POSTED_BY]', '[TEXT_ON]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]');
433
			$post_short=$post['content_short'];
434
			$wb->preprocess($post_short);
435
			if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
436
            {
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']);
438
			} else {
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'], '', '', '', '');
440
			}
441

    
442
			$post_long = ($post['content_long']);
443
		}
444
	} else {
445
	    	$wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], "javascript: history.go(-1);", false);
446
	    	exit(0);
447
	}
448

    
449
	// Print post header
450
	print str_replace($vars, $values, $setting_post_header);
451

    
452
	// Replace [wblink--PAGE_ID--] with real link
453
  	$wb->preprocess($post_long);
454
	// Print long
455
	print $post_long;
456

    
457
	// Print post footer
458
	print str_replace($vars, $values, $setting_post_footer);
459

    
460
	// Show comments section if we have to
461
	if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public')
462
    {
463
		// Print comments header
464
		$vars = array('[ADD_COMMENT_URL]','[TEXT_COMMENTS]');
465
		$values = array(WB_URL.'/modules/news/comment.php?post_id='.POST_ID.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);
466
		print str_replace($vars, $values, $setting_comments_header);
467

    
468
		// Query for comments
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");
470
		if($query_comments->numRows() > 0)
471
        {
472
			while( false != ($comment = $query_comments->fetchRow()) )
473
            {
474
				// Display Comments without slashes, but with new-line characters
475
				$comment['comment'] = nl2br($wb->strip_slashes($comment['comment']));
476
				$comment['title'] = $wb->strip_slashes($comment['title']);
477
				// Print comments loop
478
				$commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
479
				$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
480
				$uid = $comment['commented_by'];
481
				$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
482
				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
483
                {
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']));
485
				} else {
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'], '');
487
				}
488
				print str_replace($vars, $values, $setting_comments_loop);
489
			}
490
		} else {
491
			// Say no comments found
492
			$content = '';
493
			if(isset($TEXT['NONE_FOUND'])) {
494
				$content .= '<tr><td>'.$TEXT['NONE_FOUND'].'<br /></td></tr>';
495
			} else {
496
				$content .= '<tr><td>None Found<br /></td></tr>';
497
			}
498
			print $content;
499
		}
500

    
501
		// Print comments footer
502
		$vars = array('[ADD_COMMENT_URL]','[TEXT_ADD_COMMENT]');
503
		$values = array(WB_URL.'/modules/news/comment.php?post_id='.POST_ID.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_ADD_COMMENT']);
504
		print str_replace($vars, $values, $setting_comments_footer);
505

    
506
	}
507

    
508
    }
509

    
510
	if(ENABLED_ASP)
511
    {
512
		$_SESSION['comes_from_view'] = POST_ID;
513
		$_SESSION['comes_from_view_time'] = time();
514
	}
515

    
516
}
517
?>
(31-31/31)