Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         news
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: comment_page.php 1868 2013-02-19 21:07:19Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/news/comment_page.php $
14
 * @lastmodified    $Date: 2013-02-19 22:07:19 +0100 (Tue, 19 Feb 2013) $
15
 *
16
 */
17

    
18
// Must include code to stop this file being access directly
19
/* -------------------------------------------------------- */
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>');
24
}
25
/* -------------------------------------------------------- */
26

    
27
/* check if frontend.css file needs to be included into the <body></body> of page  */
28
if ( (!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) && file_exists(WB_PATH .'/modules/news/frontend.css')) {
29
	echo '<style type="text/css">';
30
	include(WB_PATH .'/modules/news/frontend.css');
31
	echo "\n</style>\n";
32
}
33

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

    
46
require_once(WB_PATH.'/include/captcha/captcha.php');
47

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

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