Project

General

Profile

1
<?php
2

    
3
// $Id: comment_page.php 762 2008-03-24 15:30:19Z thorn $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2008, 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
*/
25

    
26
// Make sure page cannot be accessed directly
27
if(!defined('WB_URL')) { 
28
	header('Location: ../index.php');
29
	exit(0);
30
}
31

    
32
require_once(WB_PATH.'/include/captcha/captcha.php');
33

    
34
// Get comments page template details from db
35
$query_settings = $database->query("SELECT comments_page,use_captcha,commenting FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
36
if($query_settings->numRows() == 0) {
37
	header("Location: ".WB_URL.PAGES_DIRECTORY."");
38
	exit(0);
39
} else {
40
	$settings = $query_settings->fetchRow();
41

    
42
	// Print comments page
43
	echo str_replace('[POST_TITLE]', POST_TITLE, ($settings['comments_page']));
44
	?>
45
	<form name="comment" action="<?php echo WB_URL.'/modules/news/submit_comment.php?page_id='.PAGE_ID.'&section_id='.SECTION_ID.'&post_id='.POST_ID; ?>" method="post">
46
	<?php if(ENABLED_ASP) { // add some honeypot-fields
47
	?>
48
	<input type="hidden" name="submitted_when" value="<?php $t=time(); echo $t; $_SESSION['submitted_when']=$t; ?>" />
49
	<p class="nixhier">
50
	email address:
51
	<label for="email">Leave this field email blank:</label>
52
	<input id="email" name="email" size="60" value="" /><br />
53
	Homepage:
54
	<label for="homepage">Leave this field homepage blank:</label>
55
	<input id="homepage" name="homepage" size="60" value="" /><br />
56
	URL:
57
	<label for="url">Leave this field url blank:</label>
58
	<input id="url" name="url" size="60" value="" /><br />
59
	Comment:
60
	<label for="comment">Leave this field comment blank:</label>
61
	<input id="comment" name="comment" size="60" value="" /><br />
62
	</p>
63
	<?php }
64
	?>
65
	<?php echo $TEXT['TITLE']; ?>:
66
	<br />
67
	<input type="text" name="title" maxlength="255" style="width: 90%;"<?php if(isset($_SESSION['comment_title'])) { echo ' value="'.$_SESSION['comment_title'].'"'; unset($_SESSION['comment_title']); } ?> />
68
	<br /><br />
69
	<?php echo $TEXT['COMMENT']; 
70
	?>:
71
	<br />
72
	<?php if(ENABLED_ASP) { ?>
73
		<textarea name="c0mment_<?php echo date('W'); ?>" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
74
	<?php } else { ?>
75
		<textarea name="comment" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
76
	<?php } ?>
77
	<br /><br />
78
	<?php
79
	if(isset($_SESSION['captcha_error'])) {
80
		echo '<font color="#FF0000">'.$_SESSION['captcha_error'].'</font><br />';
81
		$_SESSION['captcha_retry_news'] = true;
82
	}
83
	// Captcha
84
	if($settings['use_captcha']) {
85
	?>
86
	<table cellpadding="2" cellspacing="0" border="0">
87
	<tr>
88
		<td><?php echo $TEXT['VERIFICATION']; ?>:</td>
89
		<td><?php call_captcha(); ?></td>
90
	</tr></table>
91
	<br />
92
	<?php
93
	if(isset($_SESSION['captcha_error'])) {
94
		unset($_SESSION['captcha_error']);
95
		?><script>document.comment.captcha.focus();</script><?php
96
	}?>
97
	<?php
98
	}
99
	?>
100
	<input type="submit" name="submit" value="<?php echo $TEXT['ADD']; ?> <?php echo $TEXT['COMMENT']; ?>" />
101
	</form>	
102
	<?php
103
}
104

    
105
?>
(6-6/30)