Project

General

Profile

1
<?php
2

    
3
// $Id: view.php 1209 2009-12-08 06:18:20Z Luisehahne $
4

    
5
/**
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

    
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

    
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

    
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

    
24
 * @category   frontend
25
 * @package    modules
26
 * @author(s)  Dietmar W?llbrink <Luisehahne>, Dietrich Roland Pehlke <Aldus>
27
 * @platform   WB 2.8.0
28
 * @require    PHP 5.2.11
29
 * @license    http://www.gnu.org/licenses/gpl.html
30
 * @link       http://project.websitebaker2.org/browser/branches/2.8.x/wb/modules/news
31

    
32
*/
33

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

    
37
// load module language file
38
$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
39
require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
40

    
41
//overwrite php.ini on Apache servers for valid SESSION ID Separator
42
if(function_exists('ini_set')) {
43
	ini_set('arg_separator.output', '&amp;');
44
}
45

    
46
// Check if there is a start point defined
47
if(isset($_GET['p']) AND is_numeric($_GET['p']) AND $_GET['p'] >= 0)
48
{
49
	$position = $_GET['p'];
50
}
51
else
52
{
53
	$position = 0;
54
}
55

    
56
// Get user's username, display name, email, and id - needed for insertion into post info
57
$users = array();
58
$query_users = $database->query("SELECT user_id,username,display_name,email FROM ".TABLE_PREFIX."users");
59
if($query_users->numRows() > 0)
60
{
61
	while($user = $query_users->fetchRow())
62
    {
63
		// Insert user info into users array
64
		$user_id = $user['user_id'];
65
		$users[$user_id]['username'] = $user['username'];
66
		$users[$user_id]['display_name'] = $user['display_name'];
67
		$users[$user_id]['email'] = $user['email'];
68
	}
69
}
70
// Get groups (title, if they are active, and their image [if one has been uploaded])
71
if (isset($groups))
72
{
73
   unset($groups);
74
}
75

    
76
$groups[0]['title'] = '';
77
$groups[0]['active'] = true;
78
$groups[0]['image'] = '';
79

    
80
$query_users = $database->query("SELECT group_id,title,active FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
81
if($query_users->numRows() > 0)
82
{
83
	while($group = $query_users->fetchRow())
84
    {
85
		// Insert user info into users array
86
		$group_id = $group['group_id'];
87
		$groups[$group_id]['title'] = ($group['title']);
88
		$groups[$group_id]['active'] = $group['active'];
89
		if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg'))
90
        {
91
			$groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';
92
		}
93
        else
94
        {
95
			$groups[$group_id]['image'] = '';
96
		}
97
	}
98
}
99

    
100

    
101

    
102
// Check if we should show the main page or a post itself
103
if(!defined('POST_ID') OR !is_numeric(POST_ID))
104
{
105

    
106
	// Check if we should only list posts from a certain group
107
	if(isset($_GET['g']) AND is_numeric($_GET['g']))
108
    {
109
		$query_extra = " AND group_id = '".$_GET['g']."'";
110
	}
111
    else
112
    {
113
		$query_extra = '';
114
	}
115

    
116
	// Check if we should only list posts from a certain group
117
	if(isset($_GET['g']) AND is_numeric($_GET['g']))
118
    {
119
		$query_extra = " AND group_id = '".$_GET['g']."'";
120
	}
121
    else
122
    {
123
		$query_extra = '';
124
	}
125

    
126
	// Get settings
127
	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
128
	if($query_settings->numRows() > 0)
129
    {
130
		$fetch_settings = $query_settings->fetchRow();
131
		$setting_header = ($fetch_settings['header']);
132
		$setting_post_loop = ($fetch_settings['post_loop']);
133
		$setting_footer = ($fetch_settings['footer']);
134
		$setting_posts_per_page = $fetch_settings['posts_per_page'];
135
	}
136
    else
137
    {
138
		$setting_header = '';
139
		$setting_post_loop = '';
140
		$setting_footer = '';
141
		$setting_posts_per_page = '';
142
	}
143

    
144
	$t = time();
145
	// Get total number of posts
146
	$query_total_num = $database->query("SELECT post_id, section_id FROM ".TABLE_PREFIX."mod_news_posts
147
		WHERE section_id = '$section_id' AND active = '1' AND title != '' $query_extra
148
		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)");
149
	$total_num = $query_total_num->numRows();
150

    
151
	// Work-out if we need to add limit code to sql
152
	if($setting_posts_per_page != 0)
153
    {
154
		$limit_sql = " LIMIT $position, $setting_posts_per_page";
155
	}
156
    else
157
    {
158
		$limit_sql = "";
159
	}
160

    
161
	// Query posts (for this page)
162
	$query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
163
		WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra
164
		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)
165
		ORDER BY position DESC".$limit_sql);
166
	$num_posts = $query_posts->numRows();
167

    
168
	// Create previous and next links
169
	if($setting_posts_per_page != 0)
170
    {
171
		if($position > 0)
172
        {
173
			if(isset($_GET['g']) AND is_numeric($_GET['g']))
174
            {
175
				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&amp;g='.$_GET['g'].'">&lt;&lt; ';
176
			}
177
            else
178
            {
179
				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'">&lt;&lt; ';
180
			}
181
			$pl_append = '</a>';
182
			$previous_link = $pl_prepend.$TEXT['PREVIOUS'].$pl_append;
183
			$previous_page_link = $pl_prepend.$TEXT['PREVIOUS_PAGE'].$pl_append;
184
		}
185
        else
186
        {
187
			$previous_link = '';
188
			$previous_page_link = '';
189
		}
190
		if($position + $setting_posts_per_page >= $total_num)
191
        {
192
			$next_link = '';
193
			$next_page_link = '';
194
		}
195
        else
196
        {
197
			if(isset($_GET['g']) AND is_numeric($_GET['g']))
198
            {
199
				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&amp;g='.$_GET['g'].'"> ';
200
			}
201
            else
202
            {
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
		}
213
        else
214
        {
215
			$num_of = $position+$setting_posts_per_page;
216
		}
217

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

    
227
	if ($num_posts === 0)
228
    {
229
		$setting_header = '';
230
		$setting_post_loop = '';
231
		$setting_footer = '';
232
		$setting_posts_per_page = '';
233
	}
234

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

    
274
				$publ_date = date(DATE_FORMAT,$post['published_when']);
275
				$publ_time = date(TIME_FORMAT,$post['published_when']);
276

    
277
				// Work-out the post link
278
				$post_link = page_link($post['link']);
279

    
280
                $post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
281
                if(file_exists($post_link_path))
282
                {
283
    				$create_date = date(DATE_FORMAT, filectime ( $post_link_path ));
284
    				$create_time = date(TIME_FORMAT, filectime ( $post_link_path ));
285
                }
286
                else
287
                {
288
                    $create_date = $publ_date;
289
                    $create_time = $publ_time;
290
                }
291

    
292
				if(isset($_GET['p']) AND $position > 0)
293
                {
294
					$post_link .= '?p='.$position;
295
				}
296
				if(isset($_GET['g']) AND is_numeric($_GET['g']))
297
                {
298
					if(isset($_GET['p']) AND $position > 0) { $post_link .= '&amp;'; } else { $post_link .= '?'; }
299
                    {
300
					$post_link .= 'g='.$_GET['g'];
301
                    }
302
				}
303

    
304
				// Get group id, title, and image
305
				$group_id = $post['group_id'];
306
				$group_title = $groups[$group_id]['title'];
307
				$group_image = $groups[$group_id]['image'];
308
				$display_image = ($group_image == '') ? "none" : "inherit";
309
				$display_group = ($group_id == 0) ? 'none' : 'inherit';
310

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

    
313
				// Replace [wblink--PAGE_ID--] with real link
314
				$short = ($post['content_short']);
315
				$wb->preprocess($short);
316

    
317
				// Replace vars with values
318
				$post_long_len = strlen($post['content_long']);
319
				$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]');
320
				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
321
                {
322
					if($post_long_len < 9)
323
                    {
324
						$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, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '', 'hidden');
325
					}
326
                    else
327
                    {
328
					   	$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');
329
					}
330
				}
331
                else
332
                {
333
					if($post_long_len < 9)
334
                    {
335
						$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, $publ_date, $publ_time, '', '', '', '', '','hidden');
336
					}
337
                    else
338
                    {
339
						$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');
340
					}
341
				}
342
				print str_replace($vars, $values, $setting_post_loop);
343
			}
344
		}
345
	}
346
    // Print footer
347
    if($display_previous_next_links == 'none')
348
    {
349
    	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);
350
    }
351
    else
352
    {
353
    	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);
354
    }
355

    
356
}
357
elseif(defined('POST_ID') AND is_numeric(POST_ID))
358
{
359

    
360
  // print '<h2>'.POST_ID.'/'.PAGE_ID.'/'.POST_SECTION.'</h2>';
361
  if(defined('POST_SECTION') AND POST_SECTION == $section_id)
362
  {
363
	// Get settings
364
	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
365
	if($query_settings->numRows() > 0)
366
    {
367
		$fetch_settings = $query_settings->fetchRow();
368
		$setting_post_header = ($fetch_settings['post_header']);
369
		$setting_post_footer = ($fetch_settings['post_footer']);
370
		$setting_comments_header = ($fetch_settings['comments_header']);
371
		$setting_comments_loop = ($fetch_settings['comments_loop']);
372
		$setting_comments_footer = ($fetch_settings['comments_footer']);
373
	} else
374
    {
375
		$setting_post_header = '';
376
		$setting_post_footer = '';
377
		$setting_comments_header = '';
378
		$setting_comments_loop = '';
379
		$setting_comments_footer = '';
380
    }
381
	// Get page info
382
	$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".PAGE_ID."'");
383
	if($query_page->numRows() > 0)
384
    {
385
		$page = $query_page->fetchRow();
386
		$page_link = page_link($page['link']);
387
		if(isset($_GET['p']) AND $position > 0)
388
        {
389
			$page_link .= '?p='.$_GET['p'];
390
		}
391
		if(isset($_GET['g']) AND is_numeric($_GET['g']))
392
        {
393
			if(isset($_GET['p']) AND $position > 0) { $page_link .= '&amp;'; } else { $page_link .= '?'; }
394
			$page_link .= 'g='.$_GET['g'];
395
		}
396
	}
397
    else
398
    {
399
		exit($MESSAGE['PAGES']['NOT_FOUND']);
400
	}
401

    
402
	// Get post info
403
	$t = time();
404
	$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
405
		WHERE post_id = '".POST_ID."' AND active = '1'
406
		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)
407
	");
408

    
409
	if($query_post->numRows() > 0)
410
    {
411
		$post = $query_post->fetchRow();
412
		if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
413
        { // Make sure parent group is active
414
			$uid = $post['posted_by']; // User who last modified the post
415
			// Workout date and time of last modified post
416
			if ($post['published_when'] === '0') $post['published_when'] = time();
417
			if ($post['published_when'] > $post['posted_when'])
418
            {
419
				$post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);
420
				$post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);
421
			}
422
            else
423
            {
424
				$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
425
				$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
426
			}
427

    
428
			$publ_date = date(DATE_FORMAT,$post['published_when']);
429
			$publ_time = date(TIME_FORMAT,$post['published_when']);
430

    
431
				// Work-out the post link
432
				$post_link = page_link($post['link']);
433

    
434
                $post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
435
                if(file_exists($post_link_path))
436
                {
437
    				$create_date = date(DATE_FORMAT, filectime ( $post_link_path ));
438
    				$create_time = date(TIME_FORMAT, filectime ( $post_link_path ));
439
                }
440
                else
441
                {
442
                    $create_date = $publ_date;
443
                    $create_time = $publ_time;
444
                }
445
			// Get group id, title, and image
446
			$group_id = $post['group_id'];
447
			$group_title = $groups[$group_id]['title'];
448
			$group_image = $groups[$group_id]['image'];
449
			$display_image = ($group_image == '') ? "none" : "inherit";
450
			$display_group = ($group_id == 0) ? 'none' : 'inherit';
451

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

    
454
			$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]');
455
			$post_short=$post['content_short'];
456
			$wb->preprocess($post_short);
457
			if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
458
            {
459
				$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']);
460
			}
461
            else
462
            {
463
				$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'], '', '', '', '');
464
			}
465

    
466
			$post_long = ($post['content_long']);
467
		}
468
	}
469
    else
470
    {
471
	    	$wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], "javascript: history.go(-1);", false);
472
	    	exit(0);
473
	}
474

    
475
	// Print post header
476
	print str_replace($vars, $values, $setting_post_header);
477

    
478
	// Replace [wblink--PAGE_ID--] with real link
479
  	$wb->preprocess($post_long);
480
	// Print long
481
	print $post_long;
482

    
483
	// Print post footer
484
	print str_replace($vars, $values, $setting_post_footer);
485

    
486
	// Show comments section if we have to
487
	if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public')
488
    {
489
		// Print comments header
490
		$vars = array('[ADD_COMMENT_URL]','[TEXT_COMMENTS]');
491
		$values = array(WB_URL.'/modules/news/comment.php?post_id='.POST_ID.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);
492
		print str_replace($vars, $values, $setting_comments_header);
493

    
494
		// Query for comments
495
		$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");
496
		if($query_comments->numRows() > 0) {
497
			while($comment = $query_comments->fetchRow()) {
498
				// Display Comments without slashes, but with new-line characters
499
				$comment['comment'] = nl2br($wb->strip_slashes($comment['comment']));
500
				$comment['title'] = $wb->strip_slashes($comment['title']);
501
				// Print comments loop
502
				$commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
503
				$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
504
				$uid = $comment['commented_by'];
505
				$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
506
				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
507
					$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']));
508
				} else {
509
					$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'], '');
510
				}
511
				print str_replace($vars, $values, $setting_comments_loop);
512
			}
513
		} else {
514
			// Say no comments found
515
			$content = '';
516
			if(isset($TEXT['NONE_FOUND'])) {
517
				$content .= '<tr><td>'.$TEXT['NONE_FOUND'].'<br /></td></tr>';
518
			}
519
            else
520
            {
521
				$content .= '<tr><td>None Found<br /></td></tr>';
522
			}
523
			print $content;
524
		}
525

    
526
		// Print comments footer
527
		$vars = array('[ADD_COMMENT_URL]','[TEXT_ADD_COMMENT]');
528
		$values = array(WB_URL.'/modules/news/comment.php?post_id='.POST_ID.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_ADD_COMMENT']);
529
		print str_replace($vars, $values, $setting_comments_footer);
530

    
531
	}
532

    
533
}
534

    
535
	if(ENABLED_ASP) {
536
		$_SESSION['comes_from_view'] = POST_ID;
537
		$_SESSION['comes_from_view_time'] = time();
538
	}
539

    
540
}
541
?>
(31-31/31)