Project

General

Profile

1 238 stefan
<?php
2
3
// $Id$
4
5
/*
6
7
 Website Baker Project <http://www.websitebaker.org/>
8 519 Ruebenwurz
 Copyright (C) 2004-2008, Ryan Djurovich
9 238 stefan
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
*/
25
26
// Include config file
27
require('../../config.php');
28
29
// Check if there is a post id
30
if(!isset($_GET['id']) OR !is_numeric($_GET['id'])) {
31
	if(!isset($_POST['post_id']) OR !is_numeric($_POST['post_id'])) {
32
		header('Location: '.WB_URL.'/pages/');
33 286 stefan
		exit(0);
34 238 stefan
	} else {
35
		$post_id = $_POST['post_id'];
36
	}
37
} else {
38
	$post_id = $_GET['id'];
39
}
40
41
// Include database class
42
require_once(WB_PATH.'/framework/class.database.php');
43
$database = new database();
44
45 375 Ruebenwurz
$query_settings = $database->query("SELECT use_captcha FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
46 383 Ruebenwurz
$use_captcha = $query_settings->fetchRow();
47
if($use_captcha['use_captcha']) {
48 375 Ruebenwurz
	$_SESSION['captcha'] = '';
49
	for($i = 0; $i < 5; $i++) {
50
		$_SESSION['captcha'] .= rand(0,9);
51
	}
52
}
53
54 238 stefan
// Query post for page id
55
$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
56
if($query_post->numRows() == 0) {
57
	header('Location: '.WB_URL.'/pages/');
58 286 stefan
	exit(0);
59 238 stefan
} else {
60
	$fetch_post = $query_post->fetchRow();
61
	$page_id = $fetch_post['page_id'];
62
	$section_id = $fetch_post['section_id'];
63
	$post_id = $fetch_post['post_id'];
64
	$post_title = $fetch_post['title'];
65
	define('SECTION_ID', $section_id);
66
	define('POST_ID', $post_id);
67
	define('POST_TITLE', $post_title);
68
	// Get page details
69
	$query_page = $database->query("SELECT parent,page_title,menu_title,keywords,description,visibility FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
70
	if($query_page->numRows() == 0) {
71
		header('Location: '.WB_URL.'/pages/');
72 286 stefan
		exit(0);
73 238 stefan
	} else {
74
		$page = $query_page->fetchRow();
75
		// Required page details
76
		define('PAGE_CONTENT', WB_PATH.'/modules/news/comment_page.php');
77
		// Include index (wrapper) file
78
		require(WB_PATH.'/index.php');
79
	}
80
}
81
82
83 239 stefan
?>