Project

General

Profile

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

    
19

    
20
// Must include code to stop this file being access directly
21
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
22

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

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

    
42
require_once(WB_PATH.'/include/captcha/captcha.php');
43

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

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

    
129
?>
(6-6/31)