Project

General

Profile

1
<?php
2

    
3
// $Id: comment_page.php 1157 2009-10-09 21:54:57Z 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
*/
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
/* check if frontend.css file needs to be included into the <body></body> of page  */
33
if ( (!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) && file_exists(WB_PATH .'/modules/news/frontend.css')) {
34
	echo '<style type="text/css">';
35
	include(WB_PATH .'/modules/news/frontend.css');
36
	echo "\n</style>\n";
37
}
38

    
39
// check if module language file exists for the language set by the user (e.g. DE, EN)
40
if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php'))
41
{
42
	// no module language file exists for the language set by the user, include default module language file EN.php
43
	require_once(WB_PATH .'/modules/news/languages/EN.php');
44
}
45
else
46
{
47
	// a module language file exists for the language defined by the user, load it
48
	require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php');
49
}
50

    
51
require_once(WB_PATH.'/include/captcha/captcha.php');
52

    
53
// Get comments page template details from db
54
$query_settings = $database->query("SELECT comments_page,use_captcha,commenting FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
55
if($query_settings->numRows() == 0)
56
{
57
	header("Location: ".WB_URL.PAGES_DIRECTORY."");
58
	exit( 0 );
59
}
60
else
61
{
62
	$settings = $query_settings->fetchRow();
63

    
64
	// Print comments page
65
	$vars = array('[POST_TITLE]','[TEXT_COMMENT]');
66
	$values = array(POST_TITLE, $MOD_NEWS['TEXT_COMMENT']);
67
	echo str_replace($vars, $values, ($settings['comments_page']));
68
	?>
69
	<form name="comment" action="<?php echo WB_URL.'/modules/news/submit_comment.php?page_id='.PAGE_ID.'&amp;section_id='.SECTION_ID.'&amp;post_id='.POST_ID; ?>" method="post">
70
	<?php if(ENABLED_ASP) { // add some honeypot-fields
71
	?>
72
	<input type="hidden" name="submitted_when" value="<?php $t=time(); echo $t; $_SESSION['submitted_when']=$t; ?>" />
73
	<p class="nixhier">
74
	email address:
75
	<label for="email">Leave this field email blank:</label>
76
	<input id="email" name="email" size="60" value="" /><br />
77
	Homepage:
78
	<label for="homepage">Leave this field homepage blank:</label>
79
	<input id="homepage" name="homepage" size="60" value="" /><br />
80
	URL:
81
	<label for="url">Leave this field url blank:</label>
82
	<input id="url" name="url" size="60" value="" /><br />
83
	Comment:
84
	<label for="comment">Leave this field comment blank:</label>
85
	<input id="comment" name="comment" size="60" value="" /><br />
86
	</p>
87
	<?php }
88
	?>
89
	<?php echo $TEXT['TITLE']; ?>:
90
	<br />
91
	<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']); } ?> />
92
	<br /><br />
93
	<?php echo $TEXT['COMMENT']; 
94
	?>:
95
	<br />
96
	<?php if(ENABLED_ASP) { ?>
97
		<textarea name="comment_<?php echo date('W'); ?>" rows="10" cols="1" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
98
	<?php } else { ?>
99
		<textarea name="comment" rows="10" cols="1" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
100
	<?php } ?>
101
	<br /><br />
102
	<?php
103
	if(isset($_SESSION['captcha_error'])) {
104
		echo '<font color="#FF0000">'.$_SESSION['captcha_error'].'</font><br />';
105
		$_SESSION['captcha_retry_news'] = true;
106
	}
107
	// Captcha
108
	if($settings['use_captcha']) {
109
	?>
110
	<table cellpadding="2" cellspacing="0" border="0">
111
	<tr>
112
		<td><?php echo $TEXT['VERIFICATION']; ?>:</td>
113
		<td><?php call_captcha(); ?></td>
114
	</tr>
115
    </table>
116
	<?php
117
	if(isset($_SESSION['captcha_error'])) {
118
		unset($_SESSION['captcha_error']);
119
		?><script>document.comment.captcha.focus();</script><?php
120
	}?>
121
	<?php
122
	}
123
	?>
124
	<table class="news-table">
125
	<tr>
126
	    <td>
127
            <input type="submit" name="submit" value="<?php echo $MOD_NEWS['TEXT_ADD_COMMENT']; ?>" />
128
        </td>
129
        <td>
130
		    <input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="history.go(-1)"  />
131
        </td>
132
	</tr>
133
    </table>
134
	</form>
135
	<?php
136
}
137

    
138
?>
(6-6/31)