| 1 | 1108 | Ruebenwurz | <?php
 | 
      
        | 2 | 1289 | kweitzel | /**
 | 
      
        | 3 |  |  |  *
 | 
      
        | 4 |  |  |  * @category        modules
 | 
      
        | 5 |  |  |  * @package         news
 | 
      
        | 6 |  |  |  * @author          WebsiteBaker Project
 | 
      
        | 7 |  |  |  * @copyright       2004-2009, Ryan Djurovich
 | 
      
        | 8 |  |  |  * @copyright       2009-2010, 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 4.3.4 and higher
 | 
      
        | 13 |  |  |  * @version         $Id$
 | 
      
        | 14 |  |  |  * @filesource		$HeadURL$
 | 
      
        | 15 |  |  |  * @lastmodified    $Date$
 | 
      
        | 16 |  |  |  *
 | 
      
        | 17 |  |  |  */
 | 
      
        | 18 | 1108 | Ruebenwurz | 
 | 
      
        | 19 |  |  | // Make sure page cannot be accessed directly
 | 
      
        | 20 | 1289 | kweitzel | if(!defined('WB_URL')) {
 | 
      
        | 21 | 1108 | Ruebenwurz | 	header('Location: ../index.php');
 | 
      
        | 22 |  |  | 	exit(0);
 | 
      
        | 23 |  |  | }
 | 
      
        | 24 |  |  | 
 | 
      
        | 25 | 1289 | kweitzel | /* check if frontend.css file needs to be included into the <body></body> of page  */
 | 
      
        | 26 | 1108 | Ruebenwurz | if ( (!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) && file_exists(WB_PATH .'/modules/news/frontend.css')) {
 | 
      
        | 27 |  |  | 	echo '<style type="text/css">';
 | 
      
        | 28 |  |  | 	include(WB_PATH .'/modules/news/frontend.css');
 | 
      
        | 29 |  |  | 	echo "\n</style>\n";
 | 
      
        | 30 |  |  | }
 | 
      
        | 31 |  |  | 
 | 
      
        | 32 |  |  | // check if module language file exists for the language set by the user (e.g. DE, EN)
 | 
      
        | 33 | 1289 | kweitzel | if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php'))
 | 
      
        | 34 |  |  | {
 | 
      
        | 35 | 1108 | Ruebenwurz | 	// no module language file exists for the language set by the user, include default module language file EN.php
 | 
      
        | 36 |  |  | 	require_once(WB_PATH .'/modules/news/languages/EN.php');
 | 
      
        | 37 | 1289 | kweitzel | }
 | 
      
        | 38 |  |  | else
 | 
      
        | 39 |  |  | {
 | 
      
        | 40 | 1108 | Ruebenwurz | 	// a module language file exists for the language defined by the user, load it
 | 
      
        | 41 |  |  | 	require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php');
 | 
      
        | 42 |  |  | }
 | 
      
        | 43 |  |  | 
 | 
      
        | 44 |  |  | require_once(WB_PATH.'/include/captcha/captcha.php');
 | 
      
        | 45 |  |  | 
 | 
      
        | 46 |  |  | // Get comments page template details from db
 | 
      
        | 47 |  |  | $query_settings = $database->query("SELECT comments_page,use_captcha,commenting FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
 | 
      
        | 48 | 1289 | kweitzel | if($query_settings->numRows() == 0)
 | 
      
        | 49 |  |  | {
 | 
      
        | 50 | 1108 | Ruebenwurz | 	header("Location: ".WB_URL.PAGES_DIRECTORY."");
 | 
      
        | 51 | 1289 | kweitzel | 	exit( 0 );
 | 
      
        | 52 |  |  | }
 | 
      
        | 53 |  |  | else
 | 
      
        | 54 |  |  | {
 | 
      
        | 55 | 1108 | Ruebenwurz | 	$settings = $query_settings->fetchRow();
 | 
      
        | 56 |  |  | 
 | 
      
        | 57 |  |  | 	// Print comments page
 | 
      
        | 58 |  |  | 	$vars = array('[POST_TITLE]','[TEXT_COMMENT]');
 | 
      
        | 59 |  |  | 	$values = array(POST_TITLE, $MOD_NEWS['TEXT_COMMENT']);
 | 
      
        | 60 |  |  | 	echo str_replace($vars, $values, ($settings['comments_page']));
 | 
      
        | 61 |  |  | 	?>
 | 
      
        | 62 |  |  | 	<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">
 | 
      
        | 63 |  |  | 	<?php if(ENABLED_ASP) { // add some honeypot-fields
 | 
      
        | 64 |  |  | 	?>
 | 
      
        | 65 |  |  | 	<input type="hidden" name="submitted_when" value="<?php $t=time(); echo $t; $_SESSION['submitted_when']=$t; ?>" />
 | 
      
        | 66 |  |  | 	<p class="nixhier">
 | 
      
        | 67 |  |  | 	email address:
 | 
      
        | 68 |  |  | 	<label for="email">Leave this field email blank:</label>
 | 
      
        | 69 |  |  | 	<input id="email" name="email" size="60" value="" /><br />
 | 
      
        | 70 |  |  | 	Homepage:
 | 
      
        | 71 |  |  | 	<label for="homepage">Leave this field homepage blank:</label>
 | 
      
        | 72 |  |  | 	<input id="homepage" name="homepage" size="60" value="" /><br />
 | 
      
        | 73 |  |  | 	URL:
 | 
      
        | 74 |  |  | 	<label for="url">Leave this field url blank:</label>
 | 
      
        | 75 |  |  | 	<input id="url" name="url" size="60" value="" /><br />
 | 
      
        | 76 |  |  | 	Comment:
 | 
      
        | 77 |  |  | 	<label for="comment">Leave this field comment blank:</label>
 | 
      
        | 78 |  |  | 	<input id="comment" name="comment" size="60" value="" /><br />
 | 
      
        | 79 |  |  | 	</p>
 | 
      
        | 80 |  |  | 	<?php }
 | 
      
        | 81 |  |  | 	?>
 | 
      
        | 82 |  |  | 	<?php echo $TEXT['TITLE']; ?>:
 | 
      
        | 83 |  |  | 	<br />
 | 
      
        | 84 |  |  | 	<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']); } ?> />
 | 
      
        | 85 |  |  | 	<br /><br />
 | 
      
        | 86 |  |  | 	<?php echo $TEXT['COMMENT'];
 | 
      
        | 87 |  |  | 	?>:
 | 
      
        | 88 |  |  | 	<br />
 | 
      
        | 89 |  |  | 	<?php if(ENABLED_ASP) { ?>
 | 
      
        | 90 | 1289 | kweitzel | 		<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>
 | 
      
        | 91 | 1108 | Ruebenwurz | 	<?php } else { ?>
 | 
      
        | 92 |  |  | 		<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>
 | 
      
        | 93 |  |  | 	<?php } ?>
 | 
      
        | 94 |  |  | 	<br /><br />
 | 
      
        | 95 |  |  | 	<?php
 | 
      
        | 96 |  |  | 	if(isset($_SESSION['captcha_error'])) {
 | 
      
        | 97 |  |  | 		echo '<font color="#FF0000">'.$_SESSION['captcha_error'].'</font><br />';
 | 
      
        | 98 |  |  | 		$_SESSION['captcha_retry_news'] = true;
 | 
      
        | 99 |  |  | 	}
 | 
      
        | 100 |  |  | 	// Captcha
 | 
      
        | 101 |  |  | 	if($settings['use_captcha']) {
 | 
      
        | 102 |  |  | 	?>
 | 
      
        | 103 |  |  | 	<table cellpadding="2" cellspacing="0" border="0">
 | 
      
        | 104 |  |  | 	<tr>
 | 
      
        | 105 |  |  | 		<td><?php echo $TEXT['VERIFICATION']; ?>:</td>
 | 
      
        | 106 |  |  | 		<td><?php call_captcha(); ?></td>
 | 
      
        | 107 | 1289 | kweitzel | 	</tr>
 | 
      
        | 108 |  |  |     </table>
 | 
      
        | 109 | 1108 | Ruebenwurz | 	<?php
 | 
      
        | 110 |  |  | 	if(isset($_SESSION['captcha_error'])) {
 | 
      
        | 111 |  |  | 		unset($_SESSION['captcha_error']);
 | 
      
        | 112 |  |  | 		?><script>document.comment.captcha.focus();</script><?php
 | 
      
        | 113 |  |  | 	}?>
 | 
      
        | 114 |  |  | 	<?php
 | 
      
        | 115 |  |  | 	}
 | 
      
        | 116 |  |  | 	?>
 | 
      
        | 117 | 1289 | kweitzel | 	<table class="news-table">
 | 
      
        | 118 |  |  | 	<tr>
 | 
      
        | 119 |  |  | 	    <td>
 | 
      
        | 120 |  |  |             <input type="submit" name="submit" value="<?php echo $MOD_NEWS['TEXT_ADD_COMMENT']; ?>" />
 | 
      
        | 121 |  |  |         </td>
 | 
      
        | 122 |  |  |         <td>
 | 
      
        | 123 |  |  | 		    <input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="history.go(-1)"  />
 | 
      
        | 124 |  |  |         </td>
 | 
      
        | 125 |  |  | 	</tr>
 | 
      
        | 126 |  |  |     </table>
 | 
      
        | 127 |  |  | 	</form>
 | 
      
        | 128 | 1108 | Ruebenwurz | 	<?php
 | 
      
        | 129 |  |  | }
 | 
      
        | 130 |  |  | 
 | 
      
        | 131 | 901 | Ruebenwurz | ?>
 |