Project

General

Profile

« Previous | Next » 

Revision 1895

Added by Dietmar over 11 years ago

! update jsadmin module and set Version to 1.4.1
! update news module and set Version to 3.8.7

View differences:

view.php
4 4
 * @category        modules
5 5
 * @package         news
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
11 11
 * @requirements    PHP 5.2.2 and higher
12 12
 * @version         $Id$
13
 * @filesource		$HeadURL$
13
 * @filesource      $HeadURL$
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
17 17

  
18
// Must include code to stop this file being access directly
19 18
/* -------------------------------------------------------- */
20
if(defined('WB_PATH') == false)
21
{
22
	// Stop this file being access directly
23
		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
19
// Must include code to stop this file being accessed directly
20
if(!defined('WB_URL')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
24 23
}
25 24
/* -------------------------------------------------------- */
26 25
global $post_id, $post_section,$TEXT,$MESSAGE;
......
30 29
require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
31 30

  
32 31
//overwrite php.ini on Apache servers for valid SESSION ID Separator
33
if(function_exists('ini_set'))
34
{
32
if(function_exists('ini_set')) {
35 33
	ini_set('arg_separator.output', '&amp;');
36 34
}
37 35

  
......
48 46
// Get groups (title, if they are active, and their image [if one has been uploaded])
49 47
if (isset($groups))
50 48
{
51
   unset($groups);
49
	unset($groups);
52 50
}
53 51

  
54 52
$groups[0]['title'] = '';
......
60 58
{
61 59

  
62 60
	while( false != ($group = $query_users->fetchRow()) )
63
    {
61
	{
64 62
		// Insert user info into users array
65 63
		$group_id = $group['group_id'];
66 64
		$groups[$group_id]['title'] = ($group['title']);
67 65
		$groups[$group_id]['active'] = $group['active'];
68
		if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg'))
69
        {
66
		if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) {
70 67
			$groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';
71 68
		} else {
72 69
			$groups[$group_id]['image'] = '';
......
80 77
{
81 78

  
82 79
	// Check if we should only list posts from a certain group
83
	if(isset($_GET['g']) AND is_numeric($_GET['g']))
84
    {
80
	if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
85 81
		$query_extra = 'AND `group_id`='.(int)$_GET['g'].' ';
86 82
	} else {
87 83
		$query_extra = '';
88 84
	}
89 85

  
90 86
	// Check if we should only list posts from a certain group
91
	if(isset($_GET['g']) AND is_numeric($_GET['g']))
92
    {
87
	if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
93 88
		$query_extra = 'AND `group_id`='.(int)$_GET['g'].' ';
94 89
	} else {
95 90
		$query_extra = '';
......
116 111
	$sql .=        'AND (`published_until`=0 OR `published_until`>='.$t.') ';
117 112
	$total_num = intval($database->get_one($sql));
118 113
	// Work-out if we need to add limit code to sql
119
	if($setting_posts_per_page != 0)
120
    {
114
	if($setting_posts_per_page != 0) {
121 115
		$limit_sql = " LIMIT $position, $setting_posts_per_page";
122 116
	} else {
123 117
		$limit_sql = "";
......
132 126

  
133 127
	// Create previous and next links
134 128
	if($setting_posts_per_page != 0)
135
    {
129
	{
136 130
		if($position > 0)
137
        {
138
			if(isset($_GET['g']) AND is_numeric($_GET['g']))
139
            {
131
		{
132
			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
140 133
				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&amp;g='.$_GET['g'].'">&lt;&lt; ';
141 134
			} else {
142 135
				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'">&lt;&lt; ';
......
148 141
			$previous_link = '';
149 142
			$previous_page_link = '';
150 143
		}
151
		if($position + $setting_posts_per_page >= $total_num)
152
        {
144
		if($position + $setting_posts_per_page >= $total_num) {
153 145
			$next_link = '';
154 146
			$next_page_link = '';
155 147
		} else {
156
			if(isset($_GET['g']) AND is_numeric($_GET['g']))
157
            {
148
			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
158 149
				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&amp;g='.$_GET['g'].'"> ';
159 150
			} else {
160 151
				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'"> ';
......
163 154
			$next_link = $nl_prepend.$TEXT['NEXT'].$nl_append;
164 155
			$next_page_link = $nl_prepend.$TEXT['NEXT_PAGE'].$nl_append;
165 156
		}
166
		if($position+$setting_posts_per_page > $total_num)
167
        {
157
		if($position+$setting_posts_per_page > $total_num) {
168 158
			$num_of = $position+$num_posts;
169 159
		} else {
170 160
			$num_of = $position+$setting_posts_per_page;
......
177 167
		$display_previous_next_links = 'none';
178 168
	}
179 169

  
180
	if ($num_posts === 0)
181
    {
170
	if ($num_posts === 0) {
182 171
		$setting_header = '';
183 172
		$setting_post_loop = '';
184 173
		$setting_footer = '';
......
186 175
	}
187 176

  
188 177
	// Print header
189
	if($display_previous_next_links == 'none')
190
    {
178
	if($display_previous_next_links == 'none') {
191 179
		print  str_replace( array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'),
192
                            array('','','','','','', $display_previous_next_links), $setting_header);
180
		                    array('','','','','','', $display_previous_next_links), $setting_header);
193 181
	} else {
194 182
		print str_replace(  array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'),
195
                            array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_header);
183
		                    array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_header);
196 184
	}
197 185
	if($num_posts > 0)
198
    {
186
	{
199 187
		if($query_extra != '')
200
        {
188
		{
201 189
			?>
202 190
			<div class="selected-group-title">
203 191
				<?php print '<a href="'.htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])).'">'.PAGE_TITLE.'</a> &gt;&gt; '.$groups[$_GET['g']]['title']; ?>
......
205 193
			<?php
206 194
		}
207 195
		while( false != ($post = $query_posts->fetchRow()) )
208
        {
196
		{
209 197
			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
210
            { // Make sure parent group is active
198
			{ // Make sure parent group is active
211 199
				$uid = $post['posted_by']; // User who last modified the post
212 200
				// Workout date and time of last modified post
213
				if ($post['published_when'] === '0') $post['published_when'] = time();
214
				if ($post['published_when'] > $post['posted_when'])
215
                {
201
				if ($post['published_when'] === '0'){ $post['published_when'] = time();}
202
				if ($post['published_when'] > $post['posted_when']) {
216 203
					$post_date = date(DATE_FORMAT, $post['published_when']+TIMEZONE);
217 204
					$post_time = date(TIME_FORMAT, $post['published_when']+TIMEZONE);
218 205
				} else {
......
220 207
					$post_time = date(TIME_FORMAT, $post['posted_when']+TIMEZONE);
221 208
				}
222 209

  
223
				$publ_date = date(DATE_FORMAT,$post['published_when']);
224
				$publ_time = date(TIME_FORMAT,$post['published_when']);
210
				$publ_date = date(DATE_FORMAT,$post['published_when']+TIMEZONE);
211
				$publ_time = date(TIME_FORMAT,$post['published_when']+TIMEZONE);
225 212

  
226
				// Work-out the post link
213
// Work-out the post link
227 214
				$post_link = page_link($post['link']);
215
				$post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
216
				$create_date = date(DATE_FORMAT, $post['created_when']+TIMEZONE);
217
				$create_time = date(TIME_FORMAT, $post['created_when']+TIMEZONE);
228 218

  
229
                $post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
230
    			$create_date = date(DATE_FORMAT, $post['created_when']);
231
    			$create_time = date(TIME_FORMAT, $post['created_when']);
232

  
233
				if(isset($_GET['p']) AND $position > 0)
234
                {
219
				if(isset($_GET['p']) AND $position > 0) {
235 220
					$post_link .= '?p='.$position;
236 221
				}
237
				if(isset($_GET['g']) AND is_numeric($_GET['g']))
238
                {
239
					if(isset($_GET['p']) AND $position > 0) { $post_link .= '&amp;'; } else { $post_link .= '?'; }
240
                    {
222
				if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
223
					if(isset($_GET['p']) AND $position > 0) { $post_link .= '&amp;'; } else { $post_link .= '?'; } {
241 224
					$post_link .= 'g='.$_GET['g'];
242
                    }
225
					}
243 226
				}
244 227

  
245 228
				// Get group id, title, and image
......
257 240
				$post_long_len = strlen($post['content_long']);
258 241
				$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]');
259 242
				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
260
                {
261
					if($post_long_len < 9)
262
                    {
243
				{
244
					if($post_long_len < 9) {
263 245
						$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');
264 246
					} else {
265
					   	$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');
247
						$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');
266 248
					}
267 249
				} else {
268
					if($post_long_len < 9)
269
                    {
250
					if($post_long_len < 9) {
270 251
						$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');
271 252
					} else {
272 253
						$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');
......
276 257
			}
277 258
		}
278 259
	}
279
    // Print footer
280
    if($display_previous_next_links == 'none')
281
    {
282
    	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);
283
    }
284
    else
285
    {
286
    	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);
287
    }
260
// Print footer
261
	if($display_previous_next_links == 'none') {
262
		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);
263
	} else {
264
		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);
265
	}
288 266

  
289 267
}
290 268
//elseif(defined('POST_ID') AND is_numeric(POST_ID))
291 269
elseif(isset($post_id) && is_numeric($post_id))
292 270
{
293

  
294
  // print '<h2>'.POST_ID.'/'.PAGE_ID.'/'.POST_SECTION.'</h2>';
271
// print '<h2>'.POST_ID.'/'.PAGE_ID.'/'.POST_SECTION.'</h2>';
295 272
//  if(defined('POST_SECTION') AND POST_SECTION == $section_id)
296
  if(isset($post_section) && ($post_section == $section_id))
297
  {
298
	// Get settings
299
	$setting_post_header = $setting_post_footer = $setting_comments_header
300
	                     = $setting_comments_loop = $setting_comments_footer = '';
301
	$sql  = 'SELECT `post_header`, `post_footer`, `comments_header`, `comments_loop`, `comments_footer` ';
302
	$sql .= 'FROM `'.TABLE_PREFIX.'mod_news_settings` ';
303
	$sql .= 'WHERE `section_id`='.(int)$section_id;
304
	if( ($resSettings = $database->query($sql)) ){
305
		if( ($recSettings = $resSettings->fetchRow()) ) {
306
			foreach($recSettings as $key=>$val){
307
				${'setting_'.$key} = $val;
273
	if(isset($post_section) && ($post_section == $section_id))
274
	{
275
		// Get settings
276
		$setting_post_header = $setting_post_footer = $setting_comments_header
277
		                     = $setting_comments_loop = $setting_comments_footer = '';
278
		$sql  = 'SELECT `post_header`, `post_footer`, `comments_header`, `comments_loop`, `comments_footer` ';
279
		$sql .= 'FROM `'.TABLE_PREFIX.'mod_news_settings` ';
280
		$sql .= 'WHERE `section_id`='.(int)$section_id;
281
		if( ($resSettings = $database->query($sql)) ){
282
			if( ($recSettings = $resSettings->fetchRow()) ) {
283
				foreach($recSettings as $key=>$val){
284
					${'setting_'.$key} = $val;
285
				}
308 286
			}
309 287
		}
310
	}
311
	// Get page info
312
	$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".PAGE_ID."'");
313
	if($query_page->numRows() > 0)
314
    {
315
		$page = $query_page->fetchRow();
316
		$page_link = page_link($page['link']);
317
		if(isset($_GET['p']) AND $position > 0)
318
        {
319
			$page_link .= '?p='.$_GET['p'];
288
// Get page info
289
		$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".PAGE_ID."'");
290
		if($query_page->numRows() > 0) {
291
			$page = $query_page->fetchRow();
292
			$page_link = page_link($page['link']);
293
			if(isset($_GET['p']) AND $position > 0) {
294
				$page_link .= '?p='.$_GET['p'];
295
			}
296
			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
297
				if(isset($_GET['p']) AND $position > 0) { $page_link .= '&amp;'; } else { $page_link .= '?'; }
298
				$page_link .= 'g='.$_GET['g'];
299
			}
300
		} else {
301
			exit($MESSAGE['PAGES_NOT_FOUND']);
320 302
		}
321
		if(isset($_GET['g']) AND is_numeric($_GET['g']))
322
        {
323
			if(isset($_GET['p']) AND $position > 0) { $page_link .= '&amp;'; } else { $page_link .= '?'; }
324
			$page_link .= 'g='.$_GET['g'];
325
		}
326
	} else {
327
		exit($MESSAGE['PAGES']['NOT_FOUND']);
328
	}
329 303

  
330
	// Get post info
331
	$t = time();
332
	$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
333
		WHERE post_id = '".$post_id."' AND active = '1'
334
		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)");
304
		// Get post info
305
		$t = time();
306
		$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
307
			WHERE post_id = '".$post_id."' AND active = '1'
308
			AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)");
335 309

  
336
	if($query_post->numRows() > 0)
337
    {
338
		$post = $query_post->fetchRow();
339
		if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
340
        { // Make sure parent group is active
341
			$uid = $post['posted_by']; // User who last modified the post
342
			// Workout date and time of last modified post
343
			if ($post['published_when'] === '0') $post['published_when'] = time();
344
			if ($post['published_when'] > $post['posted_when'])
345
            {
346
				$post_date = date(DATE_FORMAT, $post['published_when']+TIMEZONE);
347
				$post_time = date(TIME_FORMAT, $post['published_when']+TIMEZONE);
348
			}
349
            else
350
            {
351
				$post_date = date(DATE_FORMAT, $post['posted_when']+TIMEZONE);
352
				$post_time = date(TIME_FORMAT, $post['posted_when']+TIMEZONE);
353
			}
310
		if($query_post->numRows() > 0)
311
		{
312
			$post = $query_post->fetchRow();
313
			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
314
			{ // Make sure parent group is active
315
				$uid = $post['posted_by']; // User who last modified the post
316
				// Workout date and time of last modified post
317
				if ($post['published_when'] === '0'){ $post['published_when'] = time();}
318
				if ($post['published_when'] > $post['posted_when']) {
319
					$post_date = date(DATE_FORMAT, $post['published_when']+TIMEZONE);
320
					$post_time = date(TIME_FORMAT, $post['published_when']+TIMEZONE);
321
				} else {
322
					$post_date = date(DATE_FORMAT, $post['posted_when']+TIMEZONE);
323
					$post_time = date(TIME_FORMAT, $post['posted_when']+TIMEZONE);
324
				}
354 325

  
355
			$publ_date = date(DATE_FORMAT,$post['published_when']);
356
			$publ_time = date(TIME_FORMAT,$post['published_when']);
326
				$publ_date = date(DATE_FORMAT,$post['published_when']+TIMEZONE);
327
				$publ_time = date(TIME_FORMAT,$post['published_when']+TIMEZONE);
357 328

  
358
			// Work-out the post link
359
			$post_link = page_link($post['link']);
329
				// Work-out the post link
330
				$post_link = page_link($post['link']);
360 331

  
361
			$post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
362
			$create_date = date(DATE_FORMAT, $post['created_when']);
363
			$create_time = date(TIME_FORMAT, $post['created_when']);
364
			// Get group id, title, and image
365
			$group_id = $post['group_id'];
366
			$group_title = $groups[$group_id]['title'];
367
			$group_image = $groups[$group_id]['image'];
368
			$display_image = ($group_image == '') ? "none" : "inherit";
369
			$display_group = ($group_id == 0) ? 'none' : 'inherit';
332
				$post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
333
				$create_date = date(DATE_FORMAT, $post['created_when']+TIMEZONE);
334
				$create_time = date(TIME_FORMAT, $post['created_when']+TIMEZONE);
335
				// Get group id, title, and image
336
				$group_id = $post['group_id'];
337
				$group_title = $groups[$group_id]['title'];
338
				$group_image = $groups[$group_id]['image'];
339
				$display_image = ($group_image == '') ? "none" : "inherit";
340
				$display_group = ($group_id == 0) ? 'none' : 'inherit';
370 341

  
371
			if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";
342
				if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";
372 343

  
373
			$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]');
374
			$post_short=$post['content_short'];
375
			if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
376
            {
377
				$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']);
378
			} else {
379
				$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'], '', '', '', '');
344
				$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]');
345
				$post_short=$post['content_short'];
346
				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
347
					$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']);
348
				} else {
349
					$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'], '', '', '', '');
350
				}
351
				// $post_long = ($post['content_long']);
352
				$post_long = ($post['content_long'] != '') ? $post['content_long'] : $post['content_short'];
380 353
			}
381
			// $post_long = ($post['content_long']);
382
			$post_long = ($post['content_long'] != '') ? $post['content_long'] : $post['content_short'];
354
		} else {
355
				$wb->print_error($MESSAGE['FRONTEND_SORRY_NO_ACTIVE_SECTIONS'], 'view.php', false);
383 356
		}
384
	} else {
385
	    	$wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], 'view.php', false);
386
	}
387 357

  
388
	// Print post header
389
	print str_replace($vars, $values, $setting_post_header);
390
	// Print long
391
	print $post_long;
358
		// Print post header
359
		print str_replace($vars, $values, $setting_post_header);
360
		// Print long
361
		print $post_long;
392 362

  
393
	// Print post footer
394
	print str_replace($vars, $values, $setting_post_footer);
363
		// Print post footer
364
		print str_replace($vars, $values, $setting_post_footer);
395 365

  
396
	// Show comments section if we have to
397
	if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public')
398
    {
399
		// Print comments header
400
		$vars = array('[ADD_COMMENT_URL]','[TEXT_COMMENTS]');
401
		// $pid = $admin->getIDKEY(POST_ID);
402
		$values = array(WB_URL.'/modules/news/comment.php?post_id='.$post_id.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);
403
		print str_replace($vars, $values, $setting_comments_header);
366
		// Show comments section if we have to
367
		if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public')
368
		{
369
			// Print comments header
370
			$vars = array('[ADD_COMMENT_URL]','[TEXT_COMMENTS]');
371
			// $pid = $admin->getIDKEY(POST_ID);
372
			$values = array(WB_URL.'/modules/news/comment.php?post_id='.$post_id.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);
373
			print str_replace($vars, $values, $setting_comments_header);
404 374

  
405
		// Query for comments
406
		$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");
407
		if($query_comments->numRows() > 0)
408
        {
409
			while( false != ($comment = $query_comments->fetchRow()) )
410
            {
411
				// Display Comments without slashes, but with new-line characters
412
				$comment['comment'] = nl2br($wb->strip_slashes($comment['comment']));
413
				$comment['title'] = $wb->strip_slashes($comment['title']);
414
				// Print comments loop
415
				$commented_date = date(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
416
				$commented_time = date(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
417
				$uid = $comment['commented_by'];
375
			// Query for comments
376
			$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");
377
			if($query_comments->numRows() > 0)
378
			{
379
				while( false != ($comment = $query_comments->fetchRow()) )
380
				{
381
					// Display Comments without slashes, but with new-line characters
382
					$comment['comment'] = nl2br($wb->strip_slashes($comment['comment']));
383
					$comment['title'] = $wb->strip_slashes($comment['title']);
384
					// Print comments loop
385
					$commented_date = date(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
386
					$commented_time = date(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
387
					$uid = $comment['commented_by'];
388
					$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
389
					if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
390
						$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']));
391
					} else {
392
						$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'], '');
393
					}
394
					print str_replace($vars, $values, $setting_comments_loop);
395
				}
396
			} else {
397
				// Say no comments found
398
				$content = '';
418 399
				$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
419
				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
420
                {
421
					$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']));
422
				} else {
423
					$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'], '');
424
				}
400
				$values = array( '', $MOD_NEWS['NO_COMMENT_FOUND'], '', '', '', '', '', '', '', '');
425 401
				print str_replace($vars, $values, $setting_comments_loop);
426 402
			}
427
		} else {
428
			// Say no comments found
429
			$content = '';
430
			$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
431
			$values = array( '', $MOD_NEWS['NO_COMMENT_FOUND'], '', '', '', '', '', '', '', '');
432
			print str_replace($vars, $values, $setting_comments_loop);
403

  
404
			// Print comments footer
405
			$vars = array('[ADD_COMMENT_URL]','[TEXT_ADD_COMMENT]');
406
			$values = array(WB_URL.'/modules/news/comment.php?post_id='.$post_id.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_ADD_COMMENT']);
407
			print str_replace($vars, $values, $setting_comments_footer);
408

  
433 409
		}
434 410

  
435
		// Print comments footer
436
		$vars = array('[ADD_COMMENT_URL]','[TEXT_ADD_COMMENT]');
437
		$values = array(WB_URL.'/modules/news/comment.php?post_id='.$post_id.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_ADD_COMMENT']);
438
		print str_replace($vars, $values, $setting_comments_footer);
439

  
440 411
	}
441 412

  
442
    }
443

  
444
	if(ENABLED_ASP)
445
    {
413
	if(ENABLED_ASP) {
446 414
		$_SESSION['comes_from_view'] = $post_id;
447 415
		$_SESSION['comes_from_view_time'] = time();
448 416
	}

Also available in: Unified diff