Revision 1108
Added by Matthias about 16 years ago
| trunk/CHANGELOG | ||
|---|---|---|
| 12 | 12 | 
     | 
| 13 | 13 | 
    ------------------------------------- 2.8.0 -------------------------------------  | 
| 14 | 14 | 
    6-Aug-2009 Matthias Gallas  | 
| 15 | 
    # Fixed again some bugs in news modul (ticket #756) (Thanks to Aldus and Luisehahne)  | 
|
| 15 | 16 | 
    # Fixed bug that frontend.js, frontend.css and frontend_body.js are not used  | 
| 16 | 17 | 
    from snippets (ticket #764) (Thanks to Luisehahne)  | 
| 17 | 18 | 
    + Added new function 'register_frontend_modfiles_body' to default templates  | 
| trunk/wb/modules/news/modify_post.php | ||
|---|---|---|
| 42 | 42 | 
     | 
| 43 | 43 | 
    if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
   | 
| 44 | 44 | 
    	function show_wysiwyg_editor($name,$id,$content,$width,$height) {
   | 
| 45 | 
    echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';  | 
|
| 45 | 
    		echo '<textarea name="'.$name.'" id="'.$id.'" rows="10" cols="1" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
   | 
|
| 46 | 46 | 
    }  | 
| 47 | 47 | 
    } else {
   | 
| 48 | 48 | 
    	$id_list=array("short","long");
   | 
| trunk/wb/modules/news/comment_page.php | ||
|---|---|---|
| 1 | 
    <?php  | 
|
| 2 | 
     | 
|
| 3 | 
    // $Id$  | 
|
| 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 | 
    //overwrite php.ini on Apache servers for valid SESSION ID Separator  | 
|
| 33 | 
    if(function_exists('ini_set')) {
   | 
|
| 34 | 
    	ini_set('arg_separator.output', '&');
   | 
|
| 35 | 
    }  | 
|
| 36 | 
     | 
|
| 37 | 
    // check if frontend.css file needs to be included into the <body></body> of page  | 
|
| 38 | 
    if ( (!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) && file_exists(WB_PATH .'/modules/news/frontend.css')) {
   | 
|
| 39 | 
    echo '<style type="text/css">';  | 
|
| 40 | 
    include(WB_PATH .'/modules/news/frontend.css');  | 
|
| 41 | 
    echo "\n</style>\n";  | 
|
| 42 | 
    }  | 
|
| 43 | 
     | 
|
| 44 | 
    // check if module language file exists for the language set by the user (e.g. DE, EN)  | 
|
| 45 | 
    if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) {
   | 
|
| 46 | 
    // no module language file exists for the language set by the user, include default module language file EN.php  | 
|
| 47 | 
    require_once(WB_PATH .'/modules/news/languages/EN.php');  | 
|
| 48 | 
    } else {
   | 
|
| 49 | 
    // a module language file exists for the language defined by the user, load it  | 
|
| 50 | 
    require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php');  | 
|
| 51 | 
    }  | 
|
| 52 | 
     | 
|
| 53 | 
    require_once(WB_PATH.'/include/captcha/captcha.php');  | 
|
| 54 | 
     | 
|
| 55 | 
    // Get comments page template details from db  | 
|
| 56 | 
    $query_settings = $database->query("SELECT comments_page,use_captcha,commenting FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
   | 
|
| 57 | 
    if($query_settings->numRows() == 0) {
   | 
|
| 58 | 
    	header("Location: ".WB_URL.PAGES_DIRECTORY."");
   | 
|
| 59 | 
    exit(0);  | 
|
| 60 | 
    } else {
   | 
|
| 61 | 
    $settings = $query_settings->fetchRow();  | 
|
| 62 | 
     | 
|
| 63 | 
    // Print comments page  | 
|
| 64 | 
    	$vars = array('[POST_TITLE]','[TEXT_COMMENT]');
   | 
|
| 65 | 
    $values = array(POST_TITLE, $MOD_NEWS['TEXT_COMMENT']);  | 
|
| 66 | 
    echo str_replace($vars, $values, ($settings['comments_page']));  | 
|
| 67 | 
    ?>  | 
|
| 68 | 
    <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">  | 
|
| 69 | 
    	<?php if(ENABLED_ASP) { // add some honeypot-fields
   | 
|
| 70 | 
    ?>  | 
|
| 71 | 
    <input type="hidden" name="submitted_when" value="<?php $t=time(); echo $t; $_SESSION['submitted_when']=$t; ?>" />  | 
|
| 72 | 
    <p class="nixhier">  | 
|
| 73 | 
    email address:  | 
|
| 74 | 
    <label for="email">Leave this field email blank:</label>  | 
|
| 75 | 
    <input id="email" name="email" size="60" value="" /><br />  | 
|
| 76 | 
    Homepage:  | 
|
| 77 | 
    <label for="homepage">Leave this field homepage blank:</label>  | 
|
| 78 | 
    <input id="homepage" name="homepage" size="60" value="" /><br />  | 
|
| 79 | 
    URL:  | 
|
| 80 | 
    <label for="url">Leave this field url blank:</label>  | 
|
| 81 | 
    <input id="url" name="url" size="60" value="" /><br />  | 
|
| 82 | 
    Comment:  | 
|
| 83 | 
    <label for="comment">Leave this field comment blank:</label>  | 
|
| 84 | 
    <input id="comment" name="comment" size="60" value="" /><br />  | 
|
| 85 | 
    </p>  | 
|
| 86 | 
    <?php }  | 
|
| 87 | 
    ?>  | 
|
| 88 | 
    <?php echo $TEXT['TITLE']; ?>:  | 
|
| 89 | 
    <br />  | 
|
| 90 | 
    	<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']); } ?> />
   | 
|
| 91 | 
    <br /><br />  | 
|
| 92 | 
    <?php echo $TEXT['COMMENT'];  | 
|
| 93 | 
    ?>:  | 
|
| 94 | 
    <br />  | 
|
| 95 | 
    	<?php if(ENABLED_ASP) { ?>
   | 
|
| 96 | 
    		<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>
   | 
|
| 97 | 
    	<?php } else { ?>
   | 
|
| 98 | 
    		<textarea name="comment" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
   | 
|
| 99 | 
    <?php } ?>  | 
|
| 100 | 
    <br /><br />  | 
|
| 101 | 
    <?php  | 
|
| 102 | 
    	if(isset($_SESSION['captcha_error'])) {
   | 
|
| 103 | 
    echo '<font color="#FF0000">'.$_SESSION['captcha_error'].'</font><br />';  | 
|
| 104 | 
    $_SESSION['captcha_retry_news'] = true;  | 
|
| 105 | 
    }  | 
|
| 106 | 
    // Captcha  | 
|
| 107 | 
    	if($settings['use_captcha']) {
   | 
|
| 108 | 
    ?>  | 
|
| 109 | 
    <table cellpadding="2" cellspacing="0" border="0">  | 
|
| 110 | 
    <tr>  | 
|
| 111 | 
    <td><?php echo $TEXT['VERIFICATION']; ?>:</td>  | 
|
| 112 | 
    <td><?php call_captcha(); ?></td>  | 
|
| 113 | 
    </tr></table>  | 
|
| 114 | 
    <br />  | 
|
| 115 | 
    <?php  | 
|
| 116 | 
    	if(isset($_SESSION['captcha_error'])) {
   | 
|
| 117 | 
    unset($_SESSION['captcha_error']);  | 
|
| 118 | 
    ?><script>document.comment.captcha.focus();</script><?php  | 
|
| 119 | 
    }?>  | 
|
| 120 | 
    <?php  | 
|
| 121 | 
    }  | 
|
| 122 | 
    ?>  | 
|
| 123 | 
    <input type="submit" name="submit" value="<?php echo $MOD_NEWS['TEXT_ADD_COMMENT']; ?>" />  | 
|
| 124 | 
    </form>  | 
|
| 125 | 
    <?php  | 
|
| 126 | 
    }  | 
|
| 127 | 
     | 
|
| 1 | 
    <?php
   | 
|
| 2 | 
     | 
|
| 3 | 
    // $Id$
   | 
|
| 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 | 
    //overwrite php.ini on Apache servers for valid SESSION ID Separator
   | 
|
| 33 | 
    if(function_exists('ini_set')) {
   | 
|
| 34 | 
    	ini_set('arg_separator.output', '&');
   | 
|
| 35 | 
    }
   | 
|
| 36 | 
     | 
|
| 37 | 
    // check if frontend.css file needs to be included into the <body></body> of page
   | 
|
| 38 | 
    if ( (!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) && file_exists(WB_PATH .'/modules/news/frontend.css')) {
   | 
|
| 39 | 
    	echo '<style type="text/css">';
   | 
|
| 40 | 
    	include(WB_PATH .'/modules/news/frontend.css');
   | 
|
| 41 | 
    	echo "\n</style>\n";
   | 
|
| 42 | 
    }
   | 
|
| 43 | 
     | 
|
| 44 | 
    // check if module language file exists for the language set by the user (e.g. DE, EN)
   | 
|
| 45 | 
    if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) {
   | 
|
| 46 | 
    	// no module language file exists for the language set by the user, include default module language file EN.php
   | 
|
| 47 | 
    	require_once(WB_PATH .'/modules/news/languages/EN.php');
   | 
|
| 48 | 
    } else {
   | 
|
| 49 | 
    	// a module language file exists for the language defined by the user, load it
   | 
|
| 50 | 
    	require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php');
   | 
|
| 51 | 
    }
   | 
|
| 52 | 
     | 
|
| 53 | 
    require_once(WB_PATH.'/include/captcha/captcha.php');
   | 
|
| 54 | 
     | 
|
| 55 | 
    // Get comments page template details from db
   | 
|
| 56 | 
    $query_settings = $database->query("SELECT comments_page,use_captcha,commenting FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
   | 
|
| 57 | 
    if($query_settings->numRows() == 0) {
   | 
|
| 58 | 
    	header("Location: ".WB_URL.PAGES_DIRECTORY."");
   | 
|
| 59 | 
    	exit(0);
   | 
|
| 60 | 
    } else {
   | 
|
| 61 | 
    	$settings = $query_settings->fetchRow();
   | 
|
| 62 | 
     | 
|
| 63 | 
    	// Print comments page
   | 
|
| 64 | 
    	$vars = array('[POST_TITLE]','[TEXT_COMMENT]');
   | 
|
| 65 | 
    	$values = array(POST_TITLE, $MOD_NEWS['TEXT_COMMENT']);
   | 
|
| 66 | 
    	echo str_replace($vars, $values, ($settings['comments_page']));
   | 
|
| 67 | 
    	?>
   | 
|
| 68 | 
    	<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">
   | 
|
| 69 | 
    	<?php if(ENABLED_ASP) { // add some honeypot-fields
   | 
|
| 70 | 
    	?>
   | 
|
| 71 | 
    	<input type="hidden" name="submitted_when" value="<?php $t=time(); echo $t; $_SESSION['submitted_when']=$t; ?>" />
   | 
|
| 72 | 
    	<p class="nixhier">
   | 
|
| 73 | 
    	email address:
   | 
|
| 74 | 
    	<label for="email">Leave this field email blank:</label>
   | 
|
| 75 | 
    	<input id="email" name="email" size="60" value="" /><br />
   | 
|
| 76 | 
    	Homepage:
   | 
|
| 77 | 
    	<label for="homepage">Leave this field homepage blank:</label>
   | 
|
| 78 | 
    	<input id="homepage" name="homepage" size="60" value="" /><br />
   | 
|
| 79 | 
    	URL:
   | 
|
| 80 | 
    	<label for="url">Leave this field url blank:</label>
   | 
|
| 81 | 
    	<input id="url" name="url" size="60" value="" /><br />
   | 
|
| 82 | 
    	Comment:
   | 
|
| 83 | 
    	<label for="comment">Leave this field comment blank:</label>
   | 
|
| 84 | 
    	<input id="comment" name="comment" size="60" value="" /><br />
   | 
|
| 85 | 
    	</p>
   | 
|
| 86 | 
    	<?php }
   | 
|
| 87 | 
    	?>
   | 
|
| 88 | 
    	<?php echo $TEXT['TITLE']; ?>:
   | 
|
| 89 | 
    	<br />
   | 
|
| 90 | 
    	<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']); } ?> />
   | 
|
| 91 | 
    	<br /><br />
   | 
|
| 92 | 
    	<?php echo $TEXT['COMMENT']; 
   | 
|
| 93 | 
    	?>:
   | 
|
| 94 | 
    	<br />
   | 
|
| 95 | 
    	<?php if(ENABLED_ASP) { ?>
   | 
|
| 96 | 
    		<textarea name="c0mment_<?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>
   | 
|
| 97 | 
    	<?php } else { ?>
   | 
|
| 98 | 
    		<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>
   | 
|
| 99 | 
    	<?php } ?>
   | 
|
| 100 | 
    	<br /><br />
   | 
|
| 101 | 
    	<?php
   | 
|
| 102 | 
    	if(isset($_SESSION['captcha_error'])) {
   | 
|
| 103 | 
    		echo '<font color="#FF0000">'.$_SESSION['captcha_error'].'</font><br />';
   | 
|
| 104 | 
    		$_SESSION['captcha_retry_news'] = true;
   | 
|
| 105 | 
    	}
   | 
|
| 106 | 
    	// Captcha
   | 
|
| 107 | 
    	if($settings['use_captcha']) {
   | 
|
| 108 | 
    	?>
   | 
|
| 109 | 
    	<table cellpadding="2" cellspacing="0" border="0">
   | 
|
| 110 | 
    	<tr>
   | 
|
| 111 | 
    		<td><?php echo $TEXT['VERIFICATION']; ?>:</td>
   | 
|
| 112 | 
    		<td><?php call_captcha(); ?></td>
   | 
|
| 113 | 
    	</tr></table>
   | 
|
| 114 | 
    	<br />
   | 
|
| 115 | 
    	<?php
   | 
|
| 116 | 
    	if(isset($_SESSION['captcha_error'])) {
   | 
|
| 117 | 
    		unset($_SESSION['captcha_error']);
   | 
|
| 118 | 
    		?><script>document.comment.captcha.focus();</script><?php
   | 
|
| 119 | 
    	}?>
   | 
|
| 120 | 
    	<?php
   | 
|
| 121 | 
    	}
   | 
|
| 122 | 
    	?>
   | 
|
| 123 | 
    	<input type="submit" name="submit" value="<?php echo $MOD_NEWS['TEXT_ADD_COMMENT']; ?>" />
   | 
|
| 124 | 
    	</form>	
   | 
|
| 125 | 
    	<?php
   | 
|
| 126 | 
    }
   | 
|
| 127 | 
     | 
|
| 128 | 128 | 
    ?>  | 
| trunk/wb/modules/news/modify_settings.php | ||
|---|---|---|
| 77 | 77 | 
    <tr>  | 
| 78 | 78 | 
    <td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td>  | 
| 79 | 79 | 
    <td class="setting_value">  | 
| 80 | 
    <textarea name="header" style="width: 98%; height: 80px;"><?php echo ($fetch_content['header']); ?></textarea>  | 
|
| 80 | 
    				<textarea name="header" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo ($fetch_content['header']); ?></textarea>
   | 
|
| 81 | 81 | 
    </td>  | 
| 82 | 82 | 
    </tr>  | 
| 83 | 83 | 
    <tr>  | 
| 84 | 84 | 
    <td class="setting_name"><?php echo $TEXT['POST'].' '.$TEXT['LOOP']; ?>:</td>  | 
| 85 | 85 | 
    <td class="setting_value">  | 
| 86 | 
    <textarea name="post_loop" style="width: 98%; height: 60px;"><?php echo ($fetch_content['post_loop']); ?></textarea>  | 
|
| 86 | 
    				<textarea name="post_loop" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo ($fetch_content['post_loop']); ?></textarea>
   | 
|
| 87 | 87 | 
    </td>  | 
| 88 | 88 | 
    </tr>  | 
| 89 | 89 | 
    <tr>  | 
| 90 | 90 | 
    <td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>  | 
| 91 | 91 | 
    <td class="setting_value">  | 
| 92 | 
    <textarea name="footer" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['footer'])); ?></textarea>  | 
|
| 92 | 
    				<textarea name="footer" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['footer'])); ?></textarea>
   | 
|
| 93 | 93 | 
    </td>  | 
| 94 | 94 | 
    </tr>  | 
| 95 | 95 | 
    <tr>  | 
| 96 | 96 | 
    <td class="setting_name"><?php echo $TEXT['POST_HEADER']; ?>:</td>  | 
| 97 | 97 | 
    <td class="setting_value">  | 
| 98 | 
    <textarea name="post_header" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_header'])); ?></textarea>  | 
|
| 98 | 
    				<textarea name="post_header" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_header'])); ?></textarea>
   | 
|
| 99 | 99 | 
    </td>  | 
| 100 | 100 | 
    </tr>  | 
| 101 | 101 | 
    <tr>  | 
| 102 | 102 | 
    <td class="setting_name"><?php echo $TEXT['POST_FOOTER']; ?>:</td>  | 
| 103 | 103 | 
    <td class="setting_value">  | 
| 104 | 
    <textarea name="post_footer" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_footer'])); ?></textarea>  | 
|
| 104 | 
    				<textarea name="post_footer" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_footer'])); ?></textarea>
   | 
|
| 105 | 105 | 
    </td>  | 
| 106 | 106 | 
    </tr>  | 
| 107 | 107 | 
    <tr>  | 
| ... | ... | |
| 166 | 166 | 
    <tr>  | 
| 167 | 167 | 
    <td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['HEADER']; ?>:</td>  | 
| 168 | 168 | 
    <td class="setting_value">  | 
| 169 | 
    <textarea name="comments_header" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_header'])); ?></textarea>  | 
|
| 169 | 
    				<textarea name="comments_header" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_header'])); ?></textarea>
   | 
|
| 170 | 170 | 
    </td>  | 
| 171 | 171 | 
    </tr>  | 
| 172 | 172 | 
    <tr>  | 
| 173 | 173 | 
    <td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['LOOP']; ?>:</td>  | 
| 174 | 174 | 
    <td class="setting_value">  | 
| 175 | 
    <textarea name="comments_loop" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_loop'])); ?></textarea>  | 
|
| 175 | 
    				<textarea name="comments_loop" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_loop'])); ?></textarea>
   | 
|
| 176 | 176 | 
    </td>  | 
| 177 | 177 | 
    </tr>  | 
| 178 | 178 | 
    <tr>  | 
| 179 | 179 | 
    <td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['FOOTER']; ?>:</td>  | 
| 180 | 180 | 
    <td class="setting_value">  | 
| 181 | 
    <textarea name="comments_footer" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_footer'])); ?></textarea>  | 
|
| 181 | 
    				<textarea name="comments_footer" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_footer'])); ?></textarea>
   | 
|
| 182 | 182 | 
    </td>  | 
| 183 | 183 | 
    </tr>  | 
| 184 | 184 | 
    <tr>  | 
| 185 | 185 | 
    <td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['PAGE']; ?>:</td>  | 
| 186 | 186 | 
    <td class="setting_value">  | 
| 187 | 
    <textarea name="comments_page" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_page'])); ?></textarea>  | 
|
| 187 | 
    				<textarea name="comments_page" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_page'])); ?></textarea>
   | 
|
| 188 | 188 | 
    </td>  | 
| 189 | 189 | 
    </tr>  | 
| 190 | 190 | 
    </table>  | 
| 191 | 191 | 
    <table cellpadding="0" cellspacing="0" border="0" width="100%">  | 
| 192 | 192 | 
    <tr>  | 
| 193 | 193 | 
    <td align="left">  | 
| 194 | 
    <input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;">  | 
|
| 194 | 
    				<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
   | 
|
| 195 | 195 | 
    </td>  | 
| 196 | 196 | 
    <td align="right">  | 
| 197 | 197 | 
    <input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />  | 
| trunk/wb/modules/news/modify_comment.php | ||
|---|---|---|
| 1 | 
    <?php  | 
|
| 2 | 
     | 
|
| 3 | 
    // $Id$  | 
|
| 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 | 
    require('../../config.php');
   | 
|
| 27 | 
     | 
|
| 28 | 
    // Get id  | 
|
| 29 | 
    if(!isset($_GET['comment_id']) OR !is_numeric($_GET['comment_id'])) {
   | 
|
| 30 | 
    	header("Location: ".ADMIN_URL."/pages/index.php");
   | 
|
| 31 | 
    exit(0);  | 
|
| 32 | 
    } else {
   | 
|
| 33 | 
    $comment_id = $_GET['comment_id'];  | 
|
| 34 | 
    }  | 
|
| 35 | 
     | 
|
| 36 | 
    // Include WB admin wrapper script  | 
|
| 37 | 
    require(WB_PATH.'/modules/admin.php');  | 
|
| 38 | 
     | 
|
| 39 | 
    // Get header and footer  | 
|
| 40 | 
    $query_content = $database->query("SELECT post_id,title,comment FROM ".TABLE_PREFIX."mod_news_comments WHERE comment_id = '$comment_id'");
   | 
|
| 41 | 
    $fetch_content = $query_content->fetchRow();  | 
|
| 42 | 
     | 
|
| 43 | 
    ?>  | 
|
| 44 | 
     | 
|
| 45 | 
    <h2><?php echo $TEXT['MODIFY'].' '.$TEXT['COMMENT']; ?></h2>  | 
|
| 46 | 
     | 
|
| 47 | 
    <form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_comment.php" method="post" style="margin: 0;">  | 
|
| 48 | 
     | 
|
| 49 | 
    <input type="hidden" name="section_id" value="<?php echo $section_id; ?>">  | 
|
| 50 | 
    <input type="hidden" name="page_id" value="<?php echo $page_id; ?>">  | 
|
| 51 | 
    <input type="hidden" name="post_id" value="<?php echo $fetch_content['post_id']; ?>">  | 
|
| 52 | 
    <input type="hidden" name="comment_id" value="<?php echo $comment_id; ?>">  | 
|
| 53 | 
     | 
|
| 54 | 
    <table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">  | 
|
| 55 | 
    <tr>  | 
|
| 56 | 
    <td width="80"><?php echo $TEXT['TITLE']; ?>:</td>  | 
|
| 57 | 
    <td>  | 
|
| 58 | 
    <input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />  | 
|
| 59 | 
    </td>  | 
|
| 60 | 
    </tr>  | 
|
| 61 | 
    <tr>  | 
|
| 62 | 
    <td valign="top"><?php echo $TEXT['COMMENT']; ?>:</td>  | 
|
| 63 | 
    <td>  | 
|
| 64 | 
    		<textarea name="comment" style="width: 98%; height: 150px;"><?php echo (htmlspecialchars($fetch_content['comment'])); ?></textarea>
   | 
|
| 65 | 
    </td>  | 
|
| 66 | 
    </tr>  | 
|
| 67 | 
    </table>  | 
|
| 68 | 
     | 
|
| 69 | 
    <table cellpadding="0" cellspacing="0" border="0" width="100%">  | 
|
| 70 | 
    <tr>  | 
|
| 71 | 
    <td align="left">  | 
|
| 72 | 
    <input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form>  | 
|
| 73 | 
    </td>  | 
|
| 74 | 
    <td align="right">  | 
|
| 75 | 
    <input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&post_id=<?php echo $fetch_content['post_id']; ?>';" style="width: 100px; margin-top: 5px;" />  | 
|
| 76 | 
    </td>  | 
|
| 77 | 
    </tr>  | 
|
| 78 | 
    </table>  | 
|
| 79 | 
     | 
|
| 80 | 
     | 
|
| 81 | 
    <?php  | 
|
| 82 | 
     | 
|
| 83 | 
    // Print admin footer  | 
|
| 84 | 
    $admin->print_footer();  | 
|
| 85 | 
     | 
|
| 1 | 
    <?php
   | 
|
| 2 | 
     | 
|
| 3 | 
    // $Id$
   | 
|
| 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 | 
    require('../../config.php');
   | 
|
| 27 | 
     | 
|
| 28 | 
    // Get id
   | 
|
| 29 | 
    if(!isset($_GET['comment_id']) OR !is_numeric($_GET['comment_id'])) {
   | 
|
| 30 | 
    	header("Location: ".ADMIN_URL."/pages/index.php");
   | 
|
| 31 | 
    	exit(0);
   | 
|
| 32 | 
    } else {
   | 
|
| 33 | 
    	$comment_id = $_GET['comment_id'];
   | 
|
| 34 | 
    }
   | 
|
| 35 | 
     | 
|
| 36 | 
    // Include WB admin wrapper script
   | 
|
| 37 | 
    require(WB_PATH.'/modules/admin.php');
   | 
|
| 38 | 
     | 
|
| 39 | 
    // Get header and footer
   | 
|
| 40 | 
    $query_content = $database->query("SELECT post_id,title,comment FROM ".TABLE_PREFIX."mod_news_comments WHERE comment_id = '$comment_id'");
   | 
|
| 41 | 
    $fetch_content = $query_content->fetchRow();
   | 
|
| 42 | 
     | 
|
| 43 | 
    ?>
   | 
|
| 44 | 
     | 
|
| 45 | 
    <h2><?php echo $TEXT['MODIFY'].' '.$TEXT['COMMENT']; ?></h2>
   | 
|
| 46 | 
     | 
|
| 47 | 
    <form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_comment.php" method="post" style="margin: 0;">
   | 
|
| 48 | 
     | 
|
| 49 | 
    <input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
   | 
|
| 50 | 
    <input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
   | 
|
| 51 | 
    <input type="hidden" name="post_id" value="<?php echo $fetch_content['post_id']; ?>">
   | 
|
| 52 | 
    <input type="hidden" name="comment_id" value="<?php echo $comment_id; ?>">
   | 
|
| 53 | 
     | 
|
| 54 | 
    <table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
   | 
|
| 55 | 
    <tr>
   | 
|
| 56 | 
    	<td width="80"><?php echo $TEXT['TITLE']; ?>:</td>
   | 
|
| 57 | 
    	<td>
   | 
|
| 58 | 
    		<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
   | 
|
| 59 | 
    	</td>
   | 
|
| 60 | 
    </tr>
   | 
|
| 61 | 
    <tr>
   | 
|
| 62 | 
    	<td valign="top"><?php echo $TEXT['COMMENT']; ?>:</td>
   | 
|
| 63 | 
    	<td>
   | 
|
| 64 | 
    		<textarea name="comment" rows="10" cols="1" style="width: 98%; height: 150px;"><?php echo (htmlspecialchars($fetch_content['comment'])); ?></textarea>
   | 
|
| 65 | 
    	</td>
   | 
|
| 66 | 
    </tr>
   | 
|
| 67 | 
    </table>
   | 
|
| 68 | 
     | 
|
| 69 | 
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
   | 
|
| 70 | 
    <tr>
   | 
|
| 71 | 
    	<td align="left">
   | 
|
| 72 | 
    		<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form>
   | 
|
| 73 | 
    	</td>
   | 
|
| 74 | 
    	<td align="right">
   | 
|
| 75 | 
    		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&post_id=<?php echo $fetch_content['post_id']; ?>';" style="width: 100px; margin-top: 5px;" />
   | 
|
| 76 | 
    	</td>
   | 
|
| 77 | 
    </tr>
   | 
|
| 78 | 
    </table>
   | 
|
| 79 | 
     | 
|
| 80 | 
     | 
|
| 81 | 
    <?php
   | 
|
| 82 | 
     | 
|
| 83 | 
    // Print admin footer
   | 
|
| 84 | 
    $admin->print_footer();
   | 
|
| 85 | 
     | 
|
| 86 | 86 | 
    ?>  | 
| trunk/wb/modules/news/view.php | ||
|---|---|---|
| 1 | 
    <?php  | 
|
| 2 | 
     | 
|
| 3 | 
    // $Id$  | 
|
| 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 | 
    // Must include code to stop this file being access directly  | 
|
| 27 | 
    if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
   | 
|
| 28 | 
     | 
|
| 29 | 
    // check if frontend.css file needs to be included into the <body></body> of view.php  | 
|
| 30 | 
    if((!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) &&  file_exists(WB_PATH .'/modules/news/frontend.css')) {
   | 
|
| 31 | 
    echo '<style type="text/css">';  | 
|
| 32 | 
    include(WB_PATH .'/modules/news/frontend.css');  | 
|
| 33 | 
    echo "\n</style>\n";  | 
|
| 34 | 
    }  | 
|
| 35 | 
     | 
|
| 36 | 
    // check if module language file exists for the language set by the user (e.g. DE, EN)  | 
|
| 37 | 
    if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) {
   | 
|
| 38 | 
    // no module language file exists for the language set by the user, include default module language file EN.php  | 
|
| 39 | 
    require_once(WB_PATH .'/modules/news/languages/EN.php');  | 
|
| 40 | 
    } else {
   | 
|
| 41 | 
    // a module language file exists for the language defined by the user, load it  | 
|
| 42 | 
    require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php');  | 
|
| 43 | 
    }  | 
|
| 44 | 
     | 
|
| 45 | 
    //overwrite php.ini on Apache servers for valid SESSION ID Separator  | 
|
| 46 | 
    if(function_exists('ini_set')) {
   | 
|
| 47 | 
    	ini_set('arg_separator.output', '&');
   | 
|
| 48 | 
    }  | 
|
| 49 | 
     | 
|
| 50 | 
    // Check if there is a start point defined  | 
|
| 51 | 
    if(isset($_GET['p']) AND is_numeric($_GET['p']) AND $_GET['p'] >= 0) {
   | 
|
| 52 | 
    $position = $_GET['p'];  | 
|
| 53 | 
    } else {
   | 
|
| 54 | 
    $position = 0;  | 
|
| 55 | 
    }  | 
|
| 56 | 
     | 
|
| 57 | 
    // Get user's username, display name, email, and id - needed for insertion into post info  | 
|
| 58 | 
    $users = array();  | 
|
| 59 | 
    $query_users = $database->query("SELECT user_id,username,display_name,email FROM ".TABLE_PREFIX."users");
   | 
|
| 60 | 
    if($query_users->numRows() > 0) {
   | 
|
| 61 | 
    	while($user = $query_users->fetchRow()) {
   | 
|
| 62 | 
    // Insert user info into users array  | 
|
| 63 | 
    $user_id = $user['user_id'];  | 
|
| 64 | 
    $users[$user_id]['username'] = $user['username'];  | 
|
| 65 | 
    $users[$user_id]['display_name'] = $user['display_name'];  | 
|
| 66 | 
    $users[$user_id]['email'] = $user['email'];  | 
|
| 67 | 
    }  | 
|
| 68 | 
    }  | 
|
| 69 | 
     | 
|
| 70 | 
    // Get groups (title, if they are active, and their image [if one has been uploaded])  | 
|
| 71 | 
    if (isset($groups)) {
   | 
|
| 72 | 
    unset($groups);  | 
|
| 73 | 
    }  | 
|
| 74 | 
    $groups[0]['title'] = '';  | 
|
| 75 | 
    $groups[0]['active'] = true;  | 
|
| 76 | 
    $groups[0]['image'] = '';  | 
|
| 77 | 
    $query_users = $database->query("SELECT group_id,title,active FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
   | 
|
| 78 | 
    if($query_users->numRows() > 0) {
   | 
|
| 79 | 
    	while($group = $query_users->fetchRow()) {
   | 
|
| 80 | 
    // Insert user info into users array  | 
|
| 81 | 
    $group_id = $group['group_id'];  | 
|
| 82 | 
    $groups[$group_id]['title'] = ($group['title']);  | 
|
| 83 | 
    $groups[$group_id]['active'] = $group['active'];  | 
|
| 84 | 
    		if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) {
   | 
|
| 85 | 
    $groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';  | 
|
| 86 | 
    		} else {
   | 
|
| 87 | 
    $groups[$group_id]['image'] = '';  | 
|
| 88 | 
    }  | 
|
| 89 | 
    }  | 
|
| 90 | 
    }  | 
|
| 91 | 
     | 
|
| 92 | 
    // Check if we should show the main page or a post itself  | 
|
| 93 | 
    if(!defined('POST_ID') OR !is_numeric(POST_ID)) {
   | 
|
| 94 | 
     | 
|
| 95 | 
    // Check if we should only list posts from a certain group  | 
|
| 96 | 
    	if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
   | 
|
| 97 | 
    $query_extra = " AND group_id = '".$_GET['g']."'";  | 
|
| 98 | 
    	} else {
   | 
|
| 99 | 
    $query_extra = '';  | 
|
| 100 | 
    }  | 
|
| 101 | 
     | 
|
| 102 | 
    // Get settings  | 
|
| 103 | 
    	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
   | 
|
| 104 | 
    	if($query_settings->numRows() > 0) {
   | 
|
| 105 | 
    $fetch_settings = $query_settings->fetchRow();  | 
|
| 106 | 
    $setting_header = ($fetch_settings['header']);  | 
|
| 107 | 
    $setting_post_loop = ($fetch_settings['post_loop']);  | 
|
| 108 | 
    $setting_footer = ($fetch_settings['footer']);  | 
|
| 109 | 
    $setting_posts_per_page = $fetch_settings['posts_per_page'];  | 
|
| 110 | 
    	} else {
   | 
|
| 111 | 
    $setting_header = '';  | 
|
| 112 | 
    $setting_post_loop = '';  | 
|
| 113 | 
    $setting_footer = '';  | 
|
| 114 | 
    $setting_posts_per_page = '';  | 
|
| 115 | 
    }  | 
|
| 116 | 
     | 
|
| 117 | 
    $t = time();  | 
|
| 118 | 
    // Get total number of posts  | 
|
| 119 | 
    	$query_total_num = $database->query("SELECT post_id FROM ".TABLE_PREFIX."mod_news_posts
   | 
|
| 120 | 
    WHERE section_id = '$section_id' AND active = '1' AND title != '' $query_extra  | 
|
| 121 | 
    AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)");  | 
|
| 122 | 
    $total_num = $query_total_num->numRows();  | 
|
| 123 | 
     | 
|
| 124 | 
    // Work-out if we need to add limit code to sql  | 
|
| 125 | 
    	if($setting_posts_per_page != 0) {
   | 
|
| 126 | 
    $limit_sql = " LIMIT $position,$setting_posts_per_page";  | 
|
| 127 | 
    	} else {
   | 
|
| 128 | 
    $limit_sql = "";  | 
|
| 129 | 
    }  | 
|
| 130 | 
     | 
|
| 131 | 
    // Query posts (for this page)  | 
|
| 132 | 
    	$query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
   | 
|
| 133 | 
    WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra  | 
|
| 134 | 
    AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)  | 
|
| 135 | 
    ORDER BY position DESC".$limit_sql);  | 
|
| 136 | 
    $num_posts = $query_posts->numRows();  | 
|
| 137 | 
     | 
|
| 138 | 
    // Create previous and next links  | 
|
| 139 | 
    	if($setting_posts_per_page != 0) {
   | 
|
| 140 | 
    		if($position > 0) {
   | 
|
| 141 | 
    			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
   | 
|
| 142 | 
    $pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&g='.$_GET['g'].'"><< ';  | 
|
| 143 | 
    			} else {
   | 
|
| 144 | 
    $pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'"><< ';  | 
|
| 145 | 
    }  | 
|
| 146 | 
    $pl_append = '</a>';  | 
|
| 147 | 
    $previous_link = $pl_prepend.$TEXT['PREVIOUS'].$pl_append;  | 
|
| 148 | 
    $previous_page_link = $pl_prepend.$TEXT['PREVIOUS_PAGE'].$pl_append;  | 
|
| 149 | 
    		} else {
   | 
|
| 150 | 
    $previous_link = '';  | 
|
| 151 | 
    $previous_page_link = '';  | 
|
| 152 | 
    }  | 
|
| 153 | 
    		if($position+$setting_posts_per_page >= $total_num) {
   | 
|
| 154 | 
    $next_link = '';  | 
|
| 155 | 
    $next_page_link = '';  | 
|
| 156 | 
    		} else {
   | 
|
| 157 | 
    			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
   | 
|
| 158 | 
    $nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&g='.$_GET['g'].'"> ';  | 
|
| 159 | 
    			} else {
   | 
|
| 160 | 
    $nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'"> ';  | 
|
| 161 | 
    }  | 
|
| 162 | 
    $nl_append = ' >></a>';  | 
|
| 163 | 
    $next_link = $nl_prepend.$TEXT['NEXT'].$nl_append;  | 
|
| 164 | 
    $next_page_link = $nl_prepend.$TEXT['NEXT_PAGE'].$nl_append;  | 
|
| 165 | 
    }  | 
|
| 166 | 
    		if($position+$setting_posts_per_page > $total_num) {
   | 
|
| 167 | 
    $num_of = $position+$num_posts;  | 
|
| 168 | 
    		} else {
   | 
|
| 169 | 
    $num_of = $position+$setting_posts_per_page;  | 
|
| 170 | 
    }  | 
|
| 171 | 
    $out_of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OUT_OF']).' '.$total_num;  | 
|
| 172 | 
    $of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OF']).' '.$total_num;  | 
|
| 173 | 
    $display_previous_next_links = '';  | 
|
| 174 | 
    	} else {
   | 
|
| 175 | 
    $display_previous_next_links = 'none';  | 
|
| 176 | 
    }  | 
|
| 177 | 
     | 
|
| 178 | 
    // Print header  | 
|
| 179 | 
    	if($display_previous_next_links == 'none') {
   | 
|
| 180 | 
    		echo  str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array('','','','','','', $display_previous_next_links), $setting_header);
   | 
|
| 181 | 
    	} else {
   | 
|
| 182 | 
    		echo str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_header);
   | 
|
| 183 | 
    }  | 
|
| 184 | 
     | 
|
| 185 | 
    	if($num_posts > 0) {
   | 
|
| 186 | 
    		if($query_extra != '') {
   | 
|
| 187 | 
    ?>  | 
|
| 188 | 
    <div class="selected_group_title">  | 
|
| 189 | 
    <?php echo '<a href="'.htmlspecialchars(strip_tags($_SERVER['PHP_SELF'])).'">'.PAGE_TITLE.'</a> >> '.$groups[$_GET['g']]['title']; ?>  | 
|
| 190 | 
    </div>  | 
|
| 191 | 
    <?php  | 
|
| 192 | 
    }  | 
|
| 193 | 
    		while($post = $query_posts->fetchRow()) {
   | 
|
| 194 | 
    			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
   | 
|
| 195 | 
    $uid = $post['posted_by']; // User who last modified the post  | 
|
| 196 | 
    // Workout date and time of last modified post  | 
|
| 197 | 
    				if ($post['published_when'] > $post['posted_when']) {
   | 
|
| 198 | 
    $post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);  | 
|
| 199 | 
    $post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);  | 
|
| 200 | 
    				} else {
   | 
|
| 201 | 
    $post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);  | 
|
| 202 | 
    $post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);  | 
|
| 203 | 
    }  | 
|
| 204 | 
    $publ_date = date(DATE_FORMAT,$post['published_when']);  | 
|
| 205 | 
    $publ_time = date(TIME_FORMAT,$post['published_when']);  | 
|
| 206 | 
    // Work-out the post link  | 
|
| 207 | 
    $post_link = page_link($post['link']);  | 
|
| 208 | 
    				if(isset($_GET['p']) AND $position > 0) {
   | 
|
| 209 | 
    $post_link .= '?p='.$position;  | 
|
| 210 | 
    }  | 
|
| 211 | 
    				if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
   | 
|
| 212 | 
    					if(isset($_GET['p']) AND $position > 0) { $post_link .= '&'; } else { $post_link .= '?'; }
   | 
|
| 213 | 
    $post_link .= 'g='.$_GET['g'];  | 
|
| 214 | 
    }  | 
|
| 215 | 
    // Get group id, title, and image  | 
|
| 216 | 
    $group_id = $post['group_id'];  | 
|
| 217 | 
    $group_title = $groups[$group_id]['title'];  | 
|
| 218 | 
    $group_image = $groups[$group_id]['image'];  | 
|
| 219 | 
    $display_image = ($group_image == '') ? "none" : "inherit";  | 
|
| 220 | 
    $display_group = ($group_id == 0) ? 'none' : 'inherit';  | 
|
| 221 | 
    // Replace [wblink--PAGE_ID--] with real link  | 
|
| 222 | 
    $short = ($post['content_short']);  | 
|
| 223 | 
    $wb->preprocess($short);  | 
|
| 224 | 
    // Replace vars with values  | 
|
| 225 | 
    $post_long_len = strlen($post['content_long']);  | 
|
| 226 | 
    				$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[MODI_DATE]', '[MODI_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]','[SHOW_READ_MORE]');
   | 
|
| 227 | 
    				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
   | 
|
| 228 | 
    					if($post_long_len < 9) {
   | 
|
| 229 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;', $post_date, $post_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '', 'none');  | 
|
| 230 | 
    					} else {
   | 
|
| 231 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $MOD_NEWS['TEXT_READ_MORE'], 'visible');  | 
|
| 232 | 
    }  | 
|
| 233 | 
    				} else {
   | 
|
| 234 | 
    					if($post_long_len < 9) {
   | 
|
| 235 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;', $post_date, $post_time, $publ_date, $publ_time, '', '', '', '', '','none');  | 
|
| 236 | 
    					} else {
   | 
|
| 237 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $publ_time, '', '', '', '', $MOD_NEWS['TEXT_READ_MORE'],'visible');  | 
|
| 238 | 
    }  | 
|
| 239 | 
    }  | 
|
| 240 | 
    echo str_replace($vars, $values, $setting_post_loop);  | 
|
| 241 | 
    }  | 
|
| 242 | 
    }  | 
|
| 243 | 
    }  | 
|
| 244 | 
     | 
|
| 245 | 
    // Print footer  | 
|
| 246 | 
    	if($display_previous_next_links == 'none') {
   | 
|
| 247 | 
    		echo  str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array('','','','','','', $display_previous_next_links), $setting_footer);
   | 
|
| 248 | 
    	} else {
   | 
|
| 249 | 
    		echo str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_footer);
   | 
|
| 250 | 
    }  | 
|
| 251 | 
     | 
|
| 252 | 
    } elseif(defined('POST_ID') AND is_numeric(POST_ID)) {
   | 
|
| 253 | 
     | 
|
| 254 | 
    // Get settings  | 
|
| 255 | 
    	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
   | 
|
| 256 | 
    	if($query_settings->numRows() > 0) {
   | 
|
| 257 | 
    $fetch_settings = $query_settings->fetchRow();  | 
|
| 258 | 
    $setting_post_header = ($fetch_settings['post_header']);  | 
|
| 259 | 
    $setting_post_footer = ($fetch_settings['post_footer']);  | 
|
| 260 | 
    $setting_comments_header = ($fetch_settings['comments_header']);  | 
|
| 261 | 
    $setting_comments_loop = ($fetch_settings['comments_loop']);  | 
|
| 262 | 
    $setting_comments_footer = ($fetch_settings['comments_footer']);  | 
|
| 263 | 
    	} else {
   | 
|
| 264 | 
    $setting_post_header = '';  | 
|
| 265 | 
    $setting_post_footer = '';  | 
|
| 266 | 
    $setting_comments_header = '';  | 
|
| 267 | 
    $setting_comments_loop = '';  | 
|
| 268 | 
    $setting_comments_footer = '';  | 
|
| 269 | 
    }  | 
|
| 270 | 
     | 
|
| 271 | 
    // Get page info  | 
|
| 272 | 
    	$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".PAGE_ID."'");
   | 
|
| 273 | 
    	if($query_page->numRows() > 0) {
   | 
|
| 274 | 
    $page = $query_page->fetchRow();  | 
|
| 275 | 
    $page_link = page_link($page['link']);  | 
|
| 276 | 
    		if(isset($_GET['p']) AND $position > 0) {
   | 
|
| 277 | 
    $page_link .= '?p='.$_GET['p'];  | 
|
| 278 | 
    }  | 
|
| 279 | 
    		if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
   | 
|
| 280 | 
    			if(isset($_GET['p']) AND $position > 0) { $page_link .= '&'; } else { $page_link .= '?'; }
   | 
|
| 281 | 
    $page_link .= 'g='.$_GET['g'];  | 
|
| 282 | 
    }  | 
|
| 283 | 
    	} else {
   | 
|
| 284 | 
    		exit('Page not found');
   | 
|
| 285 | 
    }  | 
|
| 286 | 
     | 
|
| 287 | 
    // Get post info  | 
|
| 288 | 
    $t = time();  | 
|
| 289 | 
    	$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
   | 
|
| 290 | 
    WHERE post_id = '".POST_ID."' AND active = '1'  | 
|
| 291 | 
    AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)  | 
|
| 292 | 
    ");  | 
|
| 293 | 
    	if($query_post->numRows() > 0) {
   | 
|
| 294 | 
    $post = $query_post->fetchRow();  | 
|
| 295 | 
    		if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
   | 
|
| 296 | 
    $uid = $post['posted_by']; // User who last modified the post  | 
|
| 297 | 
    // Workout date and time of last modified post  | 
|
| 298 | 
    			if ($post['published_when'] > $post['posted_when']) {
   | 
|
| 299 | 
    $post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);  | 
|
| 300 | 
    $post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);  | 
|
| 301 | 
    			} else {
   | 
|
| 302 | 
    $post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);  | 
|
| 303 | 
    $post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);  | 
|
| 304 | 
    }  | 
|
| 305 | 
    $publ_date = date(DATE_FORMAT,$post['published_when']);  | 
|
| 306 | 
    $publ_time = date(TIME_FORMAT,$post['published_when']);  | 
|
| 307 | 
    // Get group id, title, and image  | 
|
| 308 | 
    $group_id = $post['group_id'];  | 
|
| 309 | 
    $group_title = $groups[$group_id]['title'];  | 
|
| 310 | 
    $group_image = $groups[$group_id]['image'];  | 
|
| 311 | 
    $display_image = ($group_image == '') ? "none" : "inherit";  | 
|
| 312 | 
    $display_group = ($group_id == 0) ? 'none' : 'inherit';  | 
|
| 313 | 
    			$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[BACK]', '[TEXT_BACK]', '[TEXT_LAST_CHANGED]', '[MODI_DATE]', '[TEXT_AT]', '[MODI_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[TEXT_POSTED_BY]', '[TEXT_ON]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]');
   | 
|
| 314 | 
    $post_short=$post['content_short'];  | 
|
| 315 | 
    $wb->preprocess($post_short);  | 
|
| 316 | 
    			if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
   | 
|
| 317 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $MOD_NEWS['TEXT_BACK'], $MOD_NEWS['TEXT_LAST_CHANGED'], $post_date, $MOD_NEWS['TEXT_AT'], $post_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email']);  | 
|
| 318 | 
    			} else {
   | 
|
| 319 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $MOD_NEWS['TEXT_BACK'], $MOD_NEWS['TEXT_LAST_CHANGED'], $post_date, $MOD_NEWS['TEXT_AT'], $post_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], '', '', '', '');  | 
|
| 320 | 
    }  | 
|
| 321 | 
    $post_long = ($post['content_long']);  | 
|
| 322 | 
    }  | 
|
| 323 | 
    	} else {
   | 
|
| 324 | 
    $wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], "javascript: history.go(-1);", false);  | 
|
| 325 | 
    exit(0);  | 
|
| 326 | 
    }  | 
|
| 327 | 
     | 
|
| 328 | 
    // Print post header  | 
|
| 329 | 
    echo str_replace($vars, $values, $setting_post_header);  | 
|
| 330 | 
     | 
|
| 331 | 
    // Replace [wblink--PAGE_ID--] with real link  | 
|
| 332 | 
    $wb->preprocess($post_long);  | 
|
| 333 | 
    // Print long  | 
|
| 334 | 
    echo $post_long;  | 
|
| 335 | 
     | 
|
| 336 | 
    // Print post footer  | 
|
| 337 | 
    echo str_replace($vars, $values, $setting_post_footer);  | 
|
| 338 | 
     | 
|
| 339 | 
    // Show comments section if we have to  | 
|
| 340 | 
    	if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public') {
   | 
|
| 341 | 
     | 
|
| 342 | 
    // Print comments header  | 
|
| 343 | 
    		$vars = array('[ADD_COMMENT_URL]','[TEXT_COMMENTS]');
   | 
|
| 344 | 
    $values = array(WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);  | 
|
| 345 | 
    echo str_replace($vars, $values, $setting_comments_header);  | 
|
| 346 | 
     | 
|
| 347 | 
    // Query for comments  | 
|
| 348 | 
    		$query_comments = $database->query("SELECT title,comment,commented_when,commented_by FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".POST_ID."' ORDER BY commented_when ASC");
   | 
|
| 349 | 
    		if($query_comments->numRows() > 0) {
   | 
|
| 350 | 
    			while($comment = $query_comments->fetchRow()) {
   | 
|
| 351 | 
    // Display Comments without slashes, but with new-line characters  | 
|
| 352 | 
    $comment['comment'] = nl2br($wb->strip_slashes($comment['comment']));  | 
|
| 353 | 
    $comment['title'] = $wb->strip_slashes($comment['title']);  | 
|
| 354 | 
    // Print comments loop  | 
|
| 355 | 
    $commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);  | 
|
| 356 | 
    $commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);  | 
|
| 357 | 
    $uid = $comment['commented_by'];  | 
|
| 358 | 
    				$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
   | 
|
| 359 | 
    				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
   | 
|
| 360 | 
    $values = array(($comment['title']), ($comment['comment']), $MOD_NEWS['TEXT_ON'], $commented_date, $MOD_NEWS['TEXT_AT'], $commented_time, $MOD_NEWS['TEXT_BY'], $uid, ($users[$uid]['username']), ($users[$uid]['display_name']), ($users[$uid]['email']));  | 
|
| 361 | 
    				} else {
   | 
|
| 362 | 
    $values = array(($comment['title']), ($comment['comment']), $MOD_NEWS['TEXT_ON'], $commented_date, $MOD_NEWS['TEXT_AT'], $commented_time, $MOD_NEWS['TEXT_BY'], '0', strtolower($TEXT['UNKNOWN']), $TEXT['UNKNOWN'], '');  | 
|
| 363 | 
    }  | 
|
| 364 | 
    echo str_replace($vars, $values, $setting_comments_loop);  | 
|
| 365 | 
    }  | 
|
| 366 | 
    		} else {
   | 
|
| 367 | 
    // Say no comments found  | 
|
| 368 | 
    $content = '';  | 
|
| 369 | 
    			if(isset($TEXT['NONE_FOUND'])) {
   | 
|
| 370 | 
    $content .= '<tr><td>'.$TEXT['NONE_FOUND'].'<br /></td></tr>';  | 
|
| 371 | 
    			} else {
   | 
|
| 372 | 
    $content .= '<tr><td>None Found<br /></td></tr>';  | 
|
| 373 | 
    }  | 
|
| 374 | 
    }  | 
|
| 375 | 
     | 
|
| 376 | 
    // Print comments footer  | 
|
| 377 | 
    		$vars = array('[ADD_COMMENT_URL]','[TEXT_ADD_COMMENT]');
   | 
|
| 378 | 
    $values = array(WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $MOD_NEWS['TEXT_ADD_COMMENT']);  | 
|
| 379 | 
    echo str_replace($vars, $values, $setting_comments_footer);  | 
|
| 380 | 
    }  | 
|
| 381 | 
    	if(ENABLED_ASP) {
   | 
|
| 382 | 
    $_SESSION['comes_from_view'] = POST_ID;  | 
|
| 383 | 
    $_SESSION['comes_from_view_time'] = time();  | 
|
| 384 | 
    }  | 
|
| 385 | 
    }  | 
|
| 386 | 
     | 
|
| 1 | 
    <?php  | 
|
| 2 | 
     | 
|
| 3 | 
    // $Id$  | 
|
| 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 | 
    // Must include code to stop this file being access directly  | 
|
| 27 | 
    if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
   | 
|
| 28 | 
     | 
|
| 29 | 
    // check if frontend.css file needs to be included into the <body></body> of view.php  | 
|
| 30 | 
    if((!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) &&  file_exists(WB_PATH .'/modules/news/frontend.css')) {
   | 
|
| 31 | 
    echo '<style type="text/css">';  | 
|
| 32 | 
    include(WB_PATH .'/modules/news/frontend.css');  | 
|
| 33 | 
    echo "\n</style>\n";  | 
|
| 34 | 
    }  | 
|
| 35 | 
     | 
|
| 36 | 
    // check if module language file exists for the language set by the user (e.g. DE, EN)  | 
|
| 37 | 
    if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) {
   | 
|
| 38 | 
    // no module language file exists for the language set by the user, include default module language file EN.php  | 
|
| 39 | 
    require_once(WB_PATH .'/modules/news/languages/EN.php');  | 
|
| 40 | 
    } else {
   | 
|
| 41 | 
    // a module language file exists for the language defined by the user, load it  | 
|
| 42 | 
    require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php');  | 
|
| 43 | 
    }  | 
|
| 44 | 
     | 
|
| 45 | 
    //overwrite php.ini on Apache servers for valid SESSION ID Separator  | 
|
| 46 | 
    if(function_exists('ini_set')) {
   | 
|
| 47 | 
    	ini_set('arg_separator.output', '&');
   | 
|
| 48 | 
    }  | 
|
| 49 | 
     | 
|
| 50 | 
    // Check if there is a start point defined  | 
|
| 51 | 
    if(isset($_GET['p']) AND is_numeric($_GET['p']) AND $_GET['p'] >= 0) {
   | 
|
| 52 | 
    $position = $_GET['p'];  | 
|
| 53 | 
    } else {
   | 
|
| 54 | 
    $position = 0;  | 
|
| 55 | 
    }  | 
|
| 56 | 
     | 
|
| 57 | 
    // Get user's username, display name, email, and id - needed for insertion into post info  | 
|
| 58 | 
    $users = array();  | 
|
| 59 | 
    $query_users = $database->query("SELECT user_id,username,display_name,email FROM ".TABLE_PREFIX."users");
   | 
|
| 60 | 
    if($query_users->numRows() > 0) {
   | 
|
| 61 | 
    	while($user = $query_users->fetchRow()) {
   | 
|
| 62 | 
    // Insert user info into users array  | 
|
| 63 | 
    $user_id = $user['user_id'];  | 
|
| 64 | 
    $users[$user_id]['username'] = $user['username'];  | 
|
| 65 | 
    $users[$user_id]['display_name'] = $user['display_name'];  | 
|
| 66 | 
    $users[$user_id]['email'] = $user['email'];  | 
|
| 67 | 
    }  | 
|
| 68 | 
    }  | 
|
| 69 | 
     | 
|
| 70 | 
    // Get groups (title, if they are active, and their image [if one has been uploaded])  | 
|
| 71 | 
    if (isset($groups)) {
   | 
|
| 72 | 
    unset($groups);  | 
|
| 73 | 
    }  | 
|
| 74 | 
    $groups[0]['title'] = '';  | 
|
| 75 | 
    $groups[0]['active'] = true;  | 
|
| 76 | 
    $groups[0]['image'] = '';  | 
|
| 77 | 
    $query_users = $database->query("SELECT group_id,title,active FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
   | 
|
| 78 | 
    if($query_users->numRows() > 0) {
   | 
|
| 79 | 
    	while($group = $query_users->fetchRow()) {
   | 
|
| 80 | 
    // Insert user info into users array  | 
|
| 81 | 
    $group_id = $group['group_id'];  | 
|
| 82 | 
    $groups[$group_id]['title'] = ($group['title']);  | 
|
| 83 | 
    $groups[$group_id]['active'] = $group['active'];  | 
|
| 84 | 
    		if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) {
   | 
|
| 85 | 
    $groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';  | 
|
| 86 | 
    		} else {
   | 
|
| 87 | 
    $groups[$group_id]['image'] = '';  | 
|
| 88 | 
    }  | 
|
| 89 | 
    }  | 
|
| 90 | 
    }  | 
|
| 91 | 
     | 
|
| 92 | 
    // Check if we should show the main page or a post itself  | 
|
| 93 | 
    if(!defined('POST_ID') OR !is_numeric(POST_ID)) {
   | 
|
| 94 | 
     | 
|
| 95 | 
    // Check if we should only list posts from a certain group  | 
|
| 96 | 
    	if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
   | 
|
| 97 | 
    $query_extra = " AND group_id = '".$_GET['g']."'";  | 
|
| 98 | 
    	} else {
   | 
|
| 99 | 
    $query_extra = '';  | 
|
| 100 | 
    }  | 
|
| 101 | 
     | 
|
| 102 | 
    // Get settings  | 
|
| 103 | 
    	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
   | 
|
| 104 | 
    	if($query_settings->numRows() > 0) {
   | 
|
| 105 | 
    $fetch_settings = $query_settings->fetchRow();  | 
|
| 106 | 
    $setting_header = ($fetch_settings['header']);  | 
|
| 107 | 
    $setting_post_loop = ($fetch_settings['post_loop']);  | 
|
| 108 | 
    $setting_footer = ($fetch_settings['footer']);  | 
|
| 109 | 
    $setting_posts_per_page = $fetch_settings['posts_per_page'];  | 
|
| 110 | 
    	} else {
   | 
|
| 111 | 
    $setting_header = '';  | 
|
| 112 | 
    $setting_post_loop = '';  | 
|
| 113 | 
    $setting_footer = '';  | 
|
| 114 | 
    $setting_posts_per_page = '';  | 
|
| 115 | 
    }  | 
|
| 116 | 
     | 
|
| 117 | 
    $t = time();  | 
|
| 118 | 
    // Get total number of posts  | 
|
| 119 | 
    	$query_total_num = $database->query("SELECT post_id FROM ".TABLE_PREFIX."mod_news_posts
   | 
|
| 120 | 
    WHERE section_id = '$section_id' AND active = '1' AND title != '' $query_extra  | 
|
| 121 | 
    AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)");  | 
|
| 122 | 
    $total_num = $query_total_num->numRows();  | 
|
| 123 | 
     | 
|
| 124 | 
    // Work-out if we need to add limit code to sql  | 
|
| 125 | 
    	if($setting_posts_per_page != 0) {
   | 
|
| 126 | 
    $limit_sql = " LIMIT $position,$setting_posts_per_page";  | 
|
| 127 | 
    	} else {
   | 
|
| 128 | 
    $limit_sql = "";  | 
|
| 129 | 
    }  | 
|
| 130 | 
     | 
|
| 131 | 
    // Query posts (for this page)  | 
|
| 132 | 
    	$query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
   | 
|
| 133 | 
    WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra  | 
|
| 134 | 
    AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)  | 
|
| 135 | 
    ORDER BY position DESC".$limit_sql);  | 
|
| 136 | 
    $num_posts = $query_posts->numRows();  | 
|
| 137 | 
     | 
|
| 138 | 
    // Create previous and next links  | 
|
| 139 | 
    	if($setting_posts_per_page != 0) {
   | 
|
| 140 | 
    		if($position > 0) {
   | 
|
| 141 | 
    			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
   | 
|
| 142 | 
    $pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&g='.$_GET['g'].'"><< ';  | 
|
| 143 | 
    			} else {
   | 
|
| 144 | 
    $pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'"><< ';  | 
|
| 145 | 
    }  | 
|
| 146 | 
    $pl_append = '</a>';  | 
|
| 147 | 
    $previous_link = $pl_prepend.$TEXT['PREVIOUS'].$pl_append;  | 
|
| 148 | 
    $previous_page_link = $pl_prepend.$TEXT['PREVIOUS_PAGE'].$pl_append;  | 
|
| 149 | 
    		} else {
   | 
|
| 150 | 
    $previous_link = '';  | 
|
| 151 | 
    $previous_page_link = '';  | 
|
| 152 | 
    }  | 
|
| 153 | 
    		if($position+$setting_posts_per_page >= $total_num) {
   | 
|
| 154 | 
    $next_link = '';  | 
|
| 155 | 
    $next_page_link = '';  | 
|
| 156 | 
    		} else {
   | 
|
| 157 | 
    			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
   | 
|
| 158 | 
    $nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&g='.$_GET['g'].'"> ';  | 
|
| 159 | 
    			} else {
   | 
|
| 160 | 
    $nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'"> ';  | 
|
| 161 | 
    }  | 
|
| 162 | 
    $nl_append = ' >></a>';  | 
|
| 163 | 
    $next_link = $nl_prepend.$TEXT['NEXT'].$nl_append;  | 
|
| 164 | 
    $next_page_link = $nl_prepend.$TEXT['NEXT_PAGE'].$nl_append;  | 
|
| 165 | 
    }  | 
|
| 166 | 
    		if($position+$setting_posts_per_page > $total_num) {
   | 
|
| 167 | 
    $num_of = $position+$num_posts;  | 
|
| 168 | 
    		} else {
   | 
|
| 169 | 
    $num_of = $position+$setting_posts_per_page;  | 
|
| 170 | 
    }  | 
|
| 171 | 
    $out_of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OUT_OF']).' '.$total_num;  | 
|
| 172 | 
    $of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OF']).' '.$total_num;  | 
|
| 173 | 
    $display_previous_next_links = '';  | 
|
| 174 | 
    	} else {
   | 
|
| 175 | 
    $display_previous_next_links = 'none';  | 
|
| 176 | 
    }  | 
|
| 177 | 
     | 
|
| 178 | 
    	if ($num_posts === 0) {
   | 
|
| 179 | 
    $setting_header = '';  | 
|
| 180 | 
    $setting_post_loop = '';  | 
|
| 181 | 
    $setting_footer = '';  | 
|
| 182 | 
    $setting_posts_per_page = '';  | 
|
| 183 | 
     | 
|
| 184 | 
    }  | 
|
| 185 | 
     | 
|
| 186 | 
    // Print header  | 
|
| 187 | 
    	if($display_previous_next_links == 'none') {
   | 
|
| 188 | 
    		echo  str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array('','','','','','', $display_previous_next_links), $setting_header);
   | 
|
| 189 | 
    	} else {
   | 
|
| 190 | 
    		echo str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_header);
   | 
|
| 191 | 
    }  | 
|
| 192 | 
     | 
|
| 193 | 
    	if($num_posts > 0) {
   | 
|
| 194 | 
    		if($query_extra != '') {
   | 
|
| 195 | 
    ?>  | 
|
| 196 | 
    <div class="selected_group_title">  | 
|
| 197 | 
    <?php echo '<a href="'.htmlspecialchars(strip_tags($_SERVER['PHP_SELF'])).'">'.PAGE_TITLE.'</a> >> '.$groups[$_GET['g']]['title']; ?>  | 
|
| 198 | 
    </div>  | 
|
| 199 | 
    <?php  | 
|
| 200 | 
    }  | 
|
| 201 | 
    		while($post = $query_posts->fetchRow()) {
   | 
|
| 202 | 
    			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
   | 
|
| 203 | 
    $uid = $post['posted_by']; // User who last modified the post  | 
|
| 204 | 
    // Workout date and time of last modified post  | 
|
| 205 | 
    if ($post['published_when'] === '0') $post['published_when'] = time();  | 
|
| 206 | 
    				if ($post['published_when'] > $post['posted_when']) {
   | 
|
| 207 | 
    $post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);  | 
|
| 208 | 
    $post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);  | 
|
| 209 | 
    				} else {
   | 
|
| 210 | 
    $post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);  | 
|
| 211 | 
    $post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);  | 
|
| 212 | 
    }  | 
|
| 213 | 
    $publ_date = date(DATE_FORMAT,$post['published_when']);  | 
|
| 214 | 
    $publ_time = date(TIME_FORMAT,$post['published_when']);  | 
|
| 215 | 
    // Work-out the post link  | 
|
| 216 | 
    $post_link = page_link($post['link']);  | 
|
| 217 | 
    				if(isset($_GET['p']) AND $position > 0) {
   | 
|
| 218 | 
    $post_link .= '?p='.$position;  | 
|
| 219 | 
    }  | 
|
| 220 | 
    				if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
   | 
|
| 221 | 
    					if(isset($_GET['p']) AND $position > 0) { $post_link .= '&'; } else { $post_link .= '?'; }
   | 
|
| 222 | 
    $post_link .= 'g='.$_GET['g'];  | 
|
| 223 | 
    }  | 
|
| 224 | 
    // Get group id, title, and image  | 
|
| 225 | 
    $group_id = $post['group_id'];  | 
|
| 226 | 
    $group_title = $groups[$group_id]['title'];  | 
|
| 227 | 
    $group_image = $groups[$group_id]['image'];  | 
|
| 228 | 
    $display_image = ($group_image == '') ? "none" : "inherit";  | 
|
| 229 | 
    $display_group = ($group_id == 0) ? 'none' : 'inherit';  | 
|
| 230 | 
    if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";  | 
|
| 231 | 
    // Replace [wblink--PAGE_ID--] with real link  | 
|
| 232 | 
    $short = ($post['content_short']);  | 
|
| 233 | 
    $wb->preprocess($short);  | 
|
| 234 | 
    // Replace vars with values  | 
|
| 235 | 
    $post_long_len = strlen($post['content_long']);  | 
|
| 236 | 
    				$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[MODI_DATE]', '[MODI_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]','[SHOW_READ_MORE]');
   | 
|
| 237 | 
    				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
   | 
|
| 238 | 
    					if($post_long_len < 9) {
   | 
|
| 239 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;', $post_date, $post_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '', 'none');  | 
|
| 240 | 
    					} else {
   | 
|
| 241 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $MOD_NEWS['TEXT_READ_MORE'], 'visible');  | 
|
| 242 | 
    }  | 
|
| 243 | 
    				} else {
   | 
|
| 244 | 
    					if($post_long_len < 9) {
   | 
|
| 245 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;', $post_date, $post_time, $publ_date, $publ_time, '', '', '', '', '','none');  | 
|
| 246 | 
    					} else {
   | 
|
| 247 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $publ_time, '', '', '', '', $MOD_NEWS['TEXT_READ_MORE'],'visible');  | 
|
| 248 | 
    }  | 
|
| 249 | 
    }  | 
|
| 250 | 
    echo str_replace($vars, $values, $setting_post_loop);  | 
|
| 251 | 
    }  | 
|
| 252 | 
    }  | 
|
| 253 | 
    }  | 
|
| 254 | 
     | 
|
| 255 | 
    // Print footer  | 
|
| 256 | 
    	if($display_previous_next_links == 'none') {
   | 
|
| 257 | 
    		echo  str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array('','','','','','', $display_previous_next_links), $setting_footer);
   | 
|
| 258 | 
    	} else {
   | 
|
| 259 | 
    		echo str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_footer);
   | 
|
| 260 | 
    }  | 
|
| 261 | 
     | 
|
| 262 | 
    } elseif(defined('POST_ID') AND is_numeric(POST_ID)) {
   | 
|
| 263 | 
     | 
|
| 264 | 
    // Get settings  | 
|
| 265 | 
    	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
   | 
|
| 266 | 
    	if($query_settings->numRows() > 0) {
   | 
|
| 267 | 
    $fetch_settings = $query_settings->fetchRow();  | 
|
| 268 | 
    $setting_post_header = ($fetch_settings['post_header']);  | 
|
| 269 | 
    $setting_post_footer = ($fetch_settings['post_footer']);  | 
|
| 270 | 
    $setting_comments_header = ($fetch_settings['comments_header']);  | 
|
| 271 | 
    $setting_comments_loop = ($fetch_settings['comments_loop']);  | 
|
| 272 | 
    $setting_comments_footer = ($fetch_settings['comments_footer']);  | 
|
| 273 | 
    	} else {
   | 
|
| 274 | 
    $setting_post_header = '';  | 
|
| 275 | 
    $setting_post_footer = '';  | 
|
| 276 | 
    $setting_comments_header = '';  | 
|
| 277 | 
    $setting_comments_loop = '';  | 
|
| 278 | 
    $setting_comments_footer = '';  | 
|
| 279 | 
    }  | 
|
| 280 | 
     | 
|
| 281 | 
    // Get page info  | 
|
| 282 | 
    	$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".PAGE_ID."'");
   | 
|
| 283 | 
    	if($query_page->numRows() > 0) {
   | 
|
| 284 | 
    $page = $query_page->fetchRow();  | 
|
| 285 | 
    $page_link = page_link($page['link']);  | 
|
| 286 | 
    		if(isset($_GET['p']) AND $position > 0) {
   | 
|
| 287 | 
    $page_link .= '?p='.$_GET['p'];  | 
|
| 288 | 
    }  | 
|
| 289 | 
    		if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
   | 
|
| 290 | 
    			if(isset($_GET['p']) AND $position > 0) { $page_link .= '&'; } else { $page_link .= '?'; }
   | 
|
| 291 | 
    $page_link .= 'g='.$_GET['g'];  | 
|
| 292 | 
    }  | 
|
| 293 | 
    	} else {
   | 
|
| 294 | 
    		exit('Page not found');
   | 
|
| 295 | 
    }  | 
|
| 296 | 
     | 
|
| 297 | 
    // Get post info  | 
|
| 298 | 
    $t = time();  | 
|
| 299 | 
    	$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
   | 
|
| 300 | 
    WHERE post_id = '".POST_ID."' AND active = '1'  | 
|
| 301 | 
    AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)  | 
|
| 302 | 
    ");  | 
|
| 303 | 
    	if($query_post->numRows() > 0) {
   | 
|
| 304 | 
    $post = $query_post->fetchRow();  | 
|
| 305 | 
    		if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
   | 
|
| 306 | 
    $uid = $post['posted_by']; // User who last modified the post  | 
|
| 307 | 
    // Workout date and time of last modified post  | 
|
| 308 | 
    if ($post['published_when'] === '0') $post['published_when'] = time();  | 
|
| 309 | 
    			if ($post['published_when'] > $post['posted_when']) {
   | 
|
| 310 | 
    $post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);  | 
|
| 311 | 
    $post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);  | 
|
| 312 | 
    			} else {
   | 
|
| 313 | 
    $post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);  | 
|
| 314 | 
    $post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);  | 
|
| 315 | 
    }  | 
|
| 316 | 
    $publ_date = date(DATE_FORMAT,$post['published_when']);  | 
|
| 317 | 
    $publ_time = date(TIME_FORMAT,$post['published_when']);  | 
|
| 318 | 
    // Get group id, title, and image  | 
|
| 319 | 
    $group_id = $post['group_id'];  | 
|
| 320 | 
    $group_title = $groups[$group_id]['title'];  | 
|
| 321 | 
    $group_image = $groups[$group_id]['image'];  | 
|
| 322 | 
    $display_image = ($group_image == '') ? "none" : "inherit";  | 
|
| 323 | 
    $display_group = ($group_id == 0) ? 'none' : 'inherit';  | 
|
| 324 | 
    if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";  | 
|
| 325 | 
    			$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[BACK]', '[TEXT_BACK]', '[TEXT_LAST_CHANGED]', '[MODI_DATE]', '[TEXT_AT]', '[MODI_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[TEXT_POSTED_BY]', '[TEXT_ON]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]');
   | 
|
| 326 | 
    $post_short=$post['content_short'];  | 
|
| 327 | 
    $wb->preprocess($post_short);  | 
|
| 328 | 
    			if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
   | 
|
| 329 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $MOD_NEWS['TEXT_BACK'], $MOD_NEWS['TEXT_LAST_CHANGED'], $post_date, $MOD_NEWS['TEXT_AT'], $post_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email']);  | 
|
| 330 | 
    			} else {
   | 
|
| 331 | 
    $values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $MOD_NEWS['TEXT_BACK'], $MOD_NEWS['TEXT_LAST_CHANGED'], $post_date, $MOD_NEWS['TEXT_AT'], $post_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], '', '', '', '');  | 
|
| 332 | 
    }  | 
|
| 333 | 
    $post_long = ($post['content_long']);  | 
|
| 334 | 
    }  | 
|
| 335 | 
    	} else {
   | 
|
| 336 | 
    $wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], "javascript: history.go(-1);", false);  | 
|
| 337 | 
    exit(0);  | 
|
| 338 | 
    }  | 
|
| 339 | 
     | 
|
| 340 | 
    // Print post header  | 
|
| 341 | 
    echo str_replace($vars, $values, $setting_post_header);  | 
|
| 342 | 
     | 
|
| 343 | 
    // Replace [wblink--PAGE_ID--] with real link  | 
|
| 344 | 
    $wb->preprocess($post_long);  | 
|
| 345 | 
    // Print long  | 
|
| 346 | 
    echo $post_long;  | 
|
| 347 | 
     | 
|
| 348 | 
    // Print post footer  | 
|
| 349 | 
    echo str_replace($vars, $values, $setting_post_footer);  | 
|
| 350 | 
     | 
|
| 351 | 
    // Show comments section if we have to  | 
|
| 352 | 
    	if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public') {
   | 
|
| 353 | 
     | 
|
| 354 | 
    // Print comments header  | 
|
| 355 | 
    		$vars = array('[ADD_COMMENT_URL]','[TEXT_COMMENTS]');
   | 
|
| 356 | 
    $values = array(WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);  | 
|
| 357 | 
    echo str_replace($vars, $values, $setting_comments_header);  | 
|
| 358 | 
     | 
|
| 359 | 
    // Query for comments  | 
|
| 360 | 
    		$query_comments = $database->query("SELECT title,comment,commented_when,commented_by FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".POST_ID."' ORDER BY commented_when ASC");
   | 
|
| 361 | 
    		if($query_comments->numRows() > 0) {
   | 
|
| 362 | 
    			while($comment = $query_comments->fetchRow()) {
   | 
|
| 363 | 
    // Display Comments without slashes, but with new-line characters  | 
|
| 364 | 
    $comment['comment'] = nl2br($wb->strip_slashes($comment['comment']));  | 
|
| 365 | 
    $comment['title'] = $wb->strip_slashes($comment['title']);  | 
|
| 366 | 
    // Print comments loop  | 
|
| 367 | 
    $commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);  | 
|
| 368 | 
    $commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);  | 
|
| 369 | 
    $uid = $comment['commented_by'];  | 
|
| 370 | 
    				$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
   | 
|
| 371 | 
    				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
   | 
|
| 372 | 
    $values = array(($comment['title']), ($comment['comment']), $MOD_NEWS['TEXT_ON'], $commented_date, $MOD_NEWS['TEXT_AT'], $commented_time, $MOD_NEWS['TEXT_BY'], $uid, ($users[$uid]['username']), ($users[$uid]['display_name']), ($users[$uid]['email']));  | 
|
| 373 | 
    				} else {
   | 
|
| 374 | 
    $values = array(($comment['title']), ($comment['comment']), $MOD_NEWS['TEXT_ON'], $commented_date, $MOD_NEWS['TEXT_AT'], $commented_time, $MOD_NEWS['TEXT_BY'], '0', strtolower($TEXT['UNKNOWN']), $TEXT['UNKNOWN'], '');  | 
|
| 375 | 
    }  | 
|
| 376 | 
    echo str_replace($vars, $values, $setting_comments_loop);  | 
|
| 377 | 
    }  | 
|
| 378 | 
    		} else {
   | 
|
| 379 | 
    // Say no comments found  | 
|
| 380 | 
    $content = '';  | 
|
| 381 | 
    			if(isset($TEXT['NONE_FOUND'])) {
   | 
|
| 382 | 
    $content .= '<tr><td>'.$TEXT['NONE_FOUND'].'<br /></td></tr>';  | 
|
| 383 | 
    			} else {
   | 
|
| 384 | 
    $content .= '<tr><td>None Found<br /></td></tr>';  | 
|
| 385 | 
    }  | 
|
| 386 | 
    }  | 
|
| 387 | 
     | 
|
| 388 | 
    // Print comments footer  | 
|
| 389 | 
    		$vars = array('[ADD_COMMENT_URL]','[TEXT_ADD_COMMENT]');
   | 
|
| 390 | 
    $values = array(WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $MOD_NEWS['TEXT_ADD_COMMENT']);  | 
|
| 391 | 
    echo str_replace($vars, $values, $setting_comments_footer);  | 
|
| 392 | 
    }  | 
|
| 393 | 
    	if(ENABLED_ASP) {
   | 
|
| 394 | 
    $_SESSION['comes_from_view'] = POST_ID;  | 
|
| 395 | 
    $_SESSION['comes_from_view_time'] = time();  | 
|
| 396 | 
    }  | 
|
| 397 | 
    }  | 
|
| 398 | 
     | 
|
| 387 | 399 | 
    ?>  | 
| trunk/wb/modules/news/frontend.css | ||
|---|---|---|
| 29 | 29 | 
    padding-bottom: 15px;  | 
| 30 | 30 | 
    }  | 
| 31 | 31 | 
     | 
| 32 | 
    .comment_title, .comment_text {
   | 
|
| 32 | 
    .comment_title, .comment-text {
   | 
|
| 33 | 33 | 
    border-left: 1px solid #DDDDDD;  | 
| 34 | 34 | 
    }  | 
| 35 | 35 | 
     | 
| ... | ... | |
| 50 | 50 | 
    /*** Don't remove the class nixhier, this is required for ASP ***/  | 
| 51 | 51 | 
    .nixhier {
   | 
| 52 | 52 | 
    display:none;  | 
| 53 | 
    }  | 
|
| 54 | 
     | 
|
| 55 | 
    .loop-header {
   | 
|
| 56 | 
    width: 100%;  | 
|
| 57 | 
    }  | 
|
| 58 | 
     | 
|
| 59 | 
    .page-header {
   | 
|
| 60 | 
    width: 100%;  | 
|
| 61 | 
    }  | 
|
| 62 | 
    .post-header {
   | 
|
| 63 | 
    width: 100%;  | 
|
| 64 | 
    }  | 
|
| 65 | 
     | 
|
| 66 | 
    .page-left {
   | 
|
| 67 | 
    text-align: left;  | 
|
| 68 | 
    }  | 
|
| 69 | 
    .page-center {
   | 
|
| 70 | 
    text-align: center;  | 
|
| 71 | 
    }  | 
|
| 72 | 
     | 
|
| 73 | 
    .page-right {
   | 
|
| 74 | 
    text-align: right;  | 
|
| 75 | 
    }  | 
|
| 76 | 
     | 
|
| 77 | 
    .comment-header {
   | 
|
| 78 | 
    width: 100%;  | 
|
| 79 | 
    }  | 
|
| 80 | 
     | 
|
| 81 | 
    .public-info {
   | 
|
| 82 | 
    text-align: right;  | 
|
| 83 | 
    }  | 
|
| 84 | 
     | 
|
| 85 | 
    .group-page {
   | 
|
| 86 | 
    text-align: center;  | 
|
| 53 | 87 | 
    }  | 
| trunk/wb/modules/news/add.php | ||
|---|---|---|
| 1 | 
    <?php  | 
|
| 2 | 
     | 
|
| 3 | 
    // $Id$  | 
|
| 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 | 
    // Must include code to stop this file being access directly  | 
|
| 27 | 
    if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
   | 
|
| 28 | 
     | 
|
| 29 | 
    $header = '<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"98%\">';  | 
|
| 30 | 
    $post_loop = '<tr class=\"post_top\">  | 
|
| 31 | 
    <td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td>  | 
|
| 32 | 
    <td class=\"post_date\">[PUBLISHED_TIME], [PUBLISHED_DATE]</td>  | 
|
| 33 | 
    </tr>  | 
|
| 34 | 
    <tr>  | 
|
| 35 | 
    <td class=\"post_short\" colspan=\"2\">  | 
|
| 36 | 
    [SHORT]  | 
|
| 37 | 
    <span style=\"visibility:[SHOW_READ_MORE];\"><a href=\"[LINK]\">[TEXT_READ_MORE]</a></span>  | 
|
| 38 | 
    </td>  | 
|
| 39 | 
    </tr>';  | 
|
| 40 | 
    $footer = '</table>  | 
|
| 41 | 
    <table cellpadding="0" cellspacing="0" border="0" width="98%" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]">  | 
|
| 42 | 
    <tr>  | 
|
| 43 | 
    <td width="35%" align="left">[PREVIOUS_PAGE_LINK]</td>  | 
|
| 44 | 
    <td width="30%" align="center">[OF]</td>  | 
|
| 45 | 
    <td width="35%" align="right">[NEXT_PAGE_LINK]</td>  | 
|
| 46 | 
    </tr>  | 
|
| 47 | 
    </table>';  | 
|
| 48 | 
    $post_header = addslashes('<table cellpadding="0" cellspacing="0" border="0" width="98%">
   | 
|
| 49 | 
    <tr>  | 
|
| 50 | 
    <td height="30"><h1>[TITLE]</h1></td>  | 
|
| 51 | 
    <td rowspan="3" style="display: [DISPLAY_IMAGE]"><img src="[GROUP_IMAGE]" alt="[GROUP_TITLE]" /></td>  | 
|
| 52 | 
    </tr>  | 
|
| 53 | 
    <tr>  | 
|
| 54 | 
    <td valign="top"><b>[TEXT_POSTED_BY] [DISPLAY_NAME] ([USERNAME]) [TEXT_ON] [PUBLISHED_DATE]</b></td>  | 
|
| 55 | 
    </tr>  | 
|
| 56 | 
    <tr style="display: [DISPLAY_GROUP]">  | 
|
| 57 | 
    <td valign="top"><a href="[BACK]">[PAGE_TITLE]</a> >> <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>  | 
|
| 58 | 
    </tr>  | 
|
| 59 | 
    </table>');  | 
|
| 60 | 
    $post_footer = '<p>[TEXT_LAST_CHANGED]: [MODI_DATE] [TEXT_AT] [MODI_TIME]</p>  | 
|
| 61 | 
    <a href=\"[BACK]\">[TEXT_BACK]</a>';  | 
|
| 62 | 
    $comments_header = addslashes('<br /><br />
   | 
|
| 63 | 
    <h2>[TEXT_COMMENTS]</h2>  | 
|
| 64 | 
    <table cellpadding="2" cellspacing="0" border="0" width="98%">');  | 
|
| 65 | 
    $comments_loop = addslashes('<tr>
   | 
|
| 66 | 
    <td class="comment_title">[TITLE]</td>  | 
|
| 67 | 
    <td class="comment_info">[TEXT_BY] [DISPLAY_NAME] [TEXT_ON] [DATE] [TEXT_AT] [TIME]</td>  | 
|
| 68 | 
    </tr>  | 
|
| 69 | 
    <tr>  | 
|
| 70 | 
    <td colspan="2" class="comment_text">[COMMENT]</td>  | 
|
| 71 | 
    </tr>');  | 
|
| 72 | 
    $comments_footer = '</table>  | 
|
| 73 | 
    <br /><a href=\"[ADD_COMMENT_URL]\">[TEXT_ADD_COMMENT]</a>';  | 
|
| 74 | 
    $comments_page = '<h1>[TEXT_COMMENT]</h1>  | 
|
| 75 | 
    <h2>[POST_TITLE]</h2>  | 
|
| 76 | 
    <br />';  | 
|
| 77 | 
    $commenting = 'none';  | 
|
| 78 | 
    $use_captcha = true;  | 
|
| 79 | 
    $database->query("INSERT INTO ".TABLE_PREFIX."mod_news_settings (section_id,page_id,header,post_loop,footer,post_header,post_footer,comments_header,comments_loop,comments_footer,comments_page,commenting,use_captcha) VALUES ('$section_id','$page_id','$header','$post_loop','$footer','$post_header','$post_footer','$comments_header','$comments_loop','$comments_footer','$comments_page','$commenting','$use_captcha')");
   | 
|
| 80 | 
     | 
|
| 1 | 
    <?php  | 
|
| 2 | 
     | 
|
| 3 | 
    // $Id$  | 
|
| 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 | 
    // Must include code to stop this file being access directly  | 
|
| 27 | 
    if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
   | 
|
| 28 | 
     | 
|
| 29 | 
    $header = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"loop-header\">'."\n";  | 
|
Also available in: Unified diff
Fixed again some bugs in news modul (ticket #756) (Thanks to Aldus and Luisehahne)