| 1 | 
        
            1425
         | 
        
            Luisehahne
         | 
        <?php
  | 
      
      
        | 2 | 
        
         | 
        
         | 
        /**
  | 
      
      
        | 3 | 
        
         | 
        
         | 
         *
  | 
      
      
        | 4 | 
        
            1538
         | 
        
            Luisehahne
         | 
         * @category        modules
  | 
      
      
        | 5 | 
        
         | 
        
         | 
         * @package         news
  | 
      
      
        | 6 | 
        
         | 
        
         | 
         * @author          WebsiteBaker Project
  | 
      
      
        | 7 | 
        
            1895
         | 
        
            Luisehahne
         | 
         * @copyright       2009-2013, WebsiteBaker Org. e.V.
  | 
      
      
        | 8 | 
        
         | 
        
         | 
         * @link            http://www.websitebaker2.org/
  | 
      
      
        | 9 | 
        
            1425
         | 
        
            Luisehahne
         | 
         * @license         http://www.gnu.org/licenses/gpl.html
  | 
      
      
        | 10 | 
        
            1538
         | 
        
            Luisehahne
         | 
         * @platform        WebsiteBaker 2.8.x
  | 
      
      
        | 11 | 
        
         | 
        
         | 
         * @requirements    PHP 5.2.2 and higher
  | 
      
      
        | 12 | 
        
            1425
         | 
        
            Luisehahne
         | 
         * @version         $Id$
  | 
      
      
        | 13 | 
        
            1895
         | 
        
            Luisehahne
         | 
         * @filesource      $HeadURL$
  | 
      
      
        | 14 | 
        
            1538
         | 
        
            Luisehahne
         | 
         * @lastmodified    $Date$
  | 
      
      
        | 15 | 
        
            1425
         | 
        
            Luisehahne
         | 
         *
  | 
      
      
        | 16 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 17 | 
        
         | 
        
         | 
        
  | 
      
      
        | 18 | 
        
            1538
         | 
        
            Luisehahne
         | 
        /* -------------------------------------------------------- */
  | 
      
      
        | 19 | 
        
            1895
         | 
        
            Luisehahne
         | 
        // Must include code to stop this file being accessed directly
  | 
      
      
        | 20 | 
        
         | 
        
         | 
        if(!defined('WB_URL')) {
 | 
      
      
        | 21 | 
        
         | 
        
         | 
        	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
  | 
      
      
        | 22 | 
        
         | 
        
         | 
        	throw new IllegalFileException();
  | 
      
      
        | 23 | 
        
            1538
         | 
        
            Luisehahne
         | 
        }
  | 
      
      
        | 24 | 
        
         | 
        
         | 
        /* -------------------------------------------------------- */
  | 
      
      
        | 25 | 
        
            1457
         | 
        
            Luisehahne
         | 
        global $post_id, $post_section,$TEXT,$MESSAGE;
  | 
      
      
        | 26 | 
        
            1425
         | 
        
            Luisehahne
         | 
        // load module language file
  | 
      
      
        | 27 | 
        
         | 
        
         | 
        $lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
  | 
      
      
        | 28 | 
        
         | 
        
         | 
        require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
  | 
      
      
        | 29 | 
        
         | 
        
         | 
        
  | 
      
      
        | 30 | 
        
         | 
        
         | 
        //overwrite php.ini on Apache servers for valid SESSION ID Separator
  | 
      
      
        | 31 | 
        
            1895
         | 
        
            Luisehahne
         | 
        if(function_exists('ini_set')) {
 | 
      
      
        | 32 | 
        
            1425
         | 
        
            Luisehahne
         | 
        	ini_set('arg_separator.output', '&');
 | 
      
      
        | 33 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 34 | 
        
         | 
        
         | 
        
  | 
      
      
        | 35 | 
        
         | 
        
         | 
        // Check if there is a start point defined
  | 
      
      
        | 36 | 
        
            1457
         | 
        
            Luisehahne
         | 
        $position = ( isset($_GET['p']) ? intval($_GET['p']) : 0);
  | 
      
      
        | 37 | 
        
            1425
         | 
        
            Luisehahne
         | 
        // Get user's username, display name, email, and id - needed for insertion into post info
  | 
      
      
        | 38 | 
        
         | 
        
         | 
        $users = array();
  | 
      
      
        | 39 | 
        
            1457
         | 
        
            Luisehahne
         | 
        $sql = 'SELECT `user_id`,`username`,`display_name`,`email` FROM `'.TABLE_PREFIX.'users`';
  | 
      
      
        | 40 | 
        
         | 
        
         | 
        if( ($resUsers = $database->query($sql)) ) {
 | 
      
      
        | 41 | 
        
         | 
        
         | 
        	while( $recUser = $resUsers->fetchRow() ) {
 | 
      
      
        | 42 | 
        
         | 
        
         | 
        		$users[$recUser['user_id']] = $recUser;
  | 
      
      
        | 43 | 
        
            1425
         | 
        
            Luisehahne
         | 
        	}
  | 
      
      
        | 44 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 45 | 
        
         | 
        
         | 
        // Get groups (title, if they are active, and their image [if one has been uploaded])
  | 
      
      
        | 46 | 
        
         | 
        
         | 
        if (isset($groups))
  | 
      
      
        | 47 | 
        
         | 
        
         | 
        {
 | 
      
      
        | 48 | 
        
            1895
         | 
        
            Luisehahne
         | 
        	unset($groups);
  | 
      
      
        | 49 | 
        
            1425
         | 
        
            Luisehahne
         | 
        }
  | 
      
      
        | 50 | 
        
         | 
        
         | 
        
  | 
      
      
        | 51 | 
        
         | 
        
         | 
        $groups[0]['title'] = '';
  | 
      
      
        | 52 | 
        
         | 
        
         | 
        $groups[0]['active'] = true;
  | 
      
      
        | 53 | 
        
         | 
        
         | 
        $groups[0]['image'] = '';
  | 
      
      
        | 54 | 
        
         | 
        
         | 
        
  | 
      
      
        | 55 | 
        
         | 
        
         | 
        $query_users = $database->query("SELECT group_id,title,active FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
 | 
      
      
        | 56 | 
        
            1918
         | 
        
            Luisehahne
         | 
        if($query_users->numRows() > 0){
 | 
      
      
        | 57 | 
        
            1457
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 58 | 
        
            1425
         | 
        
            Luisehahne
         | 
        	while( false != ($group = $query_users->fetchRow()) )
  | 
      
      
        | 59 | 
        
            1895
         | 
        
            Luisehahne
         | 
        	{
 | 
      
      
        | 60 | 
        
            1425
         | 
        
            Luisehahne
         | 
        		// Insert user info into users array
  | 
      
      
        | 61 | 
        
         | 
        
         | 
        		$group_id = $group['group_id'];
  | 
      
      
        | 62 | 
        
         | 
        
         | 
        		$groups[$group_id]['title'] = ($group['title']);
  | 
      
      
        | 63 | 
        
         | 
        
         | 
        		$groups[$group_id]['active'] = $group['active'];
  | 
      
      
        | 64 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) {
 | 
      
      
        | 65 | 
        
            1425
         | 
        
            Luisehahne
         | 
        			$groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';
  | 
      
      
        | 66 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 67 | 
        
         | 
        
         | 
        			$groups[$group_id]['image'] = '';
  | 
      
      
        | 68 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 69 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 70 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 71 | 
        
         | 
        
         | 
        
  | 
      
      
        | 72 | 
        
         | 
        
         | 
        // Check if we should show the main page or a post itself
  | 
      
      
        | 73 | 
        
            1457
         | 
        
            Luisehahne
         | 
        // if(!defined('POST_ID') OR !is_numeric(POST_ID))
 | 
      
      
        | 74 | 
        
            1918
         | 
        
            Luisehahne
         | 
        if(!isset($post_id) || !is_numeric($post_id)){
 | 
      
      
        | 75 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 76 | 
        
         | 
        
         | 
        	// Check if we should only list posts from a certain group
  | 
      
      
        | 77 | 
        
            1895
         | 
        
            Luisehahne
         | 
        	if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
 | 
      
      
        | 78 | 
        
            1457
         | 
        
            Luisehahne
         | 
        		$query_extra = 'AND `group_id`='.(int)$_GET['g'].' ';
  | 
      
      
        | 79 | 
        
            1425
         | 
        
            Luisehahne
         | 
        	} else {
 | 
      
      
        | 80 | 
        
         | 
        
         | 
        		$query_extra = '';
  | 
      
      
        | 81 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 82 | 
        
         | 
        
         | 
        
  | 
      
      
        | 83 | 
        
         | 
        
         | 
        	// Check if we should only list posts from a certain group
  | 
      
      
        | 84 | 
        
            1895
         | 
        
            Luisehahne
         | 
        	if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
 | 
      
      
        | 85 | 
        
            1457
         | 
        
            Luisehahne
         | 
        		$query_extra = 'AND `group_id`='.(int)$_GET['g'].' ';
  | 
      
      
        | 86 | 
        
            1425
         | 
        
            Luisehahne
         | 
        	} else {
 | 
      
      
        | 87 | 
        
         | 
        
         | 
        		$query_extra = '';
  | 
      
      
        | 88 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 89 | 
        
         | 
        
         | 
        
  | 
      
      
        | 90 | 
        
         | 
        
         | 
        	// Get settings
  | 
      
      
        | 91 | 
        
            1457
         | 
        
            Luisehahne
         | 
        	$setting_header = $setting_post_loop = $setting_footer = $setting_posts_per_page = '';
  | 
      
      
        | 92 | 
        
         | 
        
         | 
        	$sql  = 'SELECT `header`, `post_loop`, `footer`, `posts_per_page` ';
  | 
      
      
        | 93 | 
        
         | 
        
         | 
        	$sql .= 'FROM `'.TABLE_PREFIX.'mod_news_settings` ';
  | 
      
      
        | 94 | 
        
         | 
        
         | 
        	$sql .= 'WHERE `section_id`='.(int)$section_id;
  | 
      
      
        | 95 | 
        
         | 
        
         | 
        	if( ($resSettings = $database->query($sql)) ){
 | 
      
      
        | 96 | 
        
         | 
        
         | 
        		if( ($recSettings = $resSettings->fetchRow()) ) {
 | 
      
      
        | 97 | 
        
         | 
        
         | 
        			foreach($recSettings as $key=>$val){
 | 
      
      
        | 98 | 
        
         | 
        
         | 
        				${'setting_'.$key} = $val;
 | 
      
      
        | 99 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 100 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 101 | 
        
            1425
         | 
        
            Luisehahne
         | 
        	}
  | 
      
      
        | 102 | 
        
         | 
        
         | 
        	$t = time();
  | 
      
      
        | 103 | 
        
         | 
        
         | 
        	// Get total number of posts
  | 
      
      
        | 104 | 
        
            1457
         | 
        
            Luisehahne
         | 
        	$sql  = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'mod_news_posts` ';
  | 
      
      
        | 105 | 
        
         | 
        
         | 
        	$sql .= 'WHERE `section_id`='.(int)$section_id.' AND `active`=1 ';
  | 
      
      
        | 106 | 
        
         | 
        
         | 
        	$sql .=        'AND `title`!=\'\' '.$query_extra;
  | 
      
      
        | 107 | 
        
         | 
        
         | 
        	$sql .=        'AND (`published_when`=0 OR `published_when`<='.$t.') ';
  | 
      
      
        | 108 | 
        
         | 
        
         | 
        	$sql .=        'AND (`published_until`=0 OR `published_until`>='.$t.') ';
  | 
      
      
        | 109 | 
        
         | 
        
         | 
        	$total_num = intval($database->get_one($sql));
  | 
      
      
        | 110 | 
        
            1425
         | 
        
            Luisehahne
         | 
        	// Work-out if we need to add limit code to sql
  | 
      
      
        | 111 | 
        
            1895
         | 
        
            Luisehahne
         | 
        	if($setting_posts_per_page != 0) {
 | 
      
      
        | 112 | 
        
            1425
         | 
        
            Luisehahne
         | 
        		$limit_sql = " LIMIT $position, $setting_posts_per_page";
  | 
      
      
        | 113 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 114 | 
        
         | 
        
         | 
        		$limit_sql = "";
  | 
      
      
        | 115 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 116 | 
        
         | 
        
         | 
        
  | 
      
      
        | 117 | 
        
         | 
        
         | 
        	// Query posts (for this page)
  | 
      
      
        | 118 | 
        
         | 
        
         | 
        	$query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
 | 
      
      
        | 119 | 
        
         | 
        
         | 
        		WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra
  | 
      
      
        | 120 | 
        
         | 
        
         | 
        		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)
  | 
      
      
        | 121 | 
        
         | 
        
         | 
        		ORDER BY position DESC".$limit_sql);
  | 
      
      
        | 122 | 
        
         | 
        
         | 
        	$num_posts = $query_posts->numRows();
  | 
      
      
        | 123 | 
        
         | 
        
         | 
        
  | 
      
      
        | 124 | 
        
         | 
        
         | 
        	// Create previous and next links
  | 
      
      
        | 125 | 
        
         | 
        
         | 
        	if($setting_posts_per_page != 0)
  | 
      
      
        | 126 | 
        
            1895
         | 
        
            Luisehahne
         | 
        	{
 | 
      
      
        | 127 | 
        
            1425
         | 
        
            Luisehahne
         | 
        		if($position > 0)
  | 
      
      
        | 128 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		{
 | 
      
      
        | 129 | 
        
         | 
        
         | 
        			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
 | 
      
      
        | 130 | 
        
            1425
         | 
        
            Luisehahne
         | 
        				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&g='.$_GET['g'].'"><< ';
  | 
      
      
        | 131 | 
        
         | 
        
         | 
        			} else {
 | 
      
      
        | 132 | 
        
         | 
        
         | 
        				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'"><< ';
  | 
      
      
        | 133 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 134 | 
        
         | 
        
         | 
        			$pl_append = '</a>';
  | 
      
      
        | 135 | 
        
         | 
        
         | 
        			$previous_link = $pl_prepend.$TEXT['PREVIOUS'].$pl_append;
  | 
      
      
        | 136 | 
        
         | 
        
         | 
        			$previous_page_link = $pl_prepend.$TEXT['PREVIOUS_PAGE'].$pl_append;
  | 
      
      
        | 137 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 138 | 
        
         | 
        
         | 
        			$previous_link = '';
  | 
      
      
        | 139 | 
        
         | 
        
         | 
        			$previous_page_link = '';
  | 
      
      
        | 140 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 141 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		if($position + $setting_posts_per_page >= $total_num) {
 | 
      
      
        | 142 | 
        
            1425
         | 
        
            Luisehahne
         | 
        			$next_link = '';
  | 
      
      
        | 143 | 
        
         | 
        
         | 
        			$next_page_link = '';
  | 
      
      
        | 144 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 145 | 
        
            1895
         | 
        
            Luisehahne
         | 
        			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
 | 
      
      
        | 146 | 
        
            1425
         | 
        
            Luisehahne
         | 
        				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&g='.$_GET['g'].'"> ';
  | 
      
      
        | 147 | 
        
         | 
        
         | 
        			} else {
 | 
      
      
        | 148 | 
        
         | 
        
         | 
        				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'"> ';
  | 
      
      
        | 149 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 150 | 
        
         | 
        
         | 
        			$nl_append = ' >></a>';
  | 
      
      
        | 151 | 
        
         | 
        
         | 
        			$next_link = $nl_prepend.$TEXT['NEXT'].$nl_append;
  | 
      
      
        | 152 | 
        
         | 
        
         | 
        			$next_page_link = $nl_prepend.$TEXT['NEXT_PAGE'].$nl_append;
  | 
      
      
        | 153 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 154 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		if($position+$setting_posts_per_page > $total_num) {
 | 
      
      
        | 155 | 
        
            1425
         | 
        
            Luisehahne
         | 
        			$num_of = $position+$num_posts;
  | 
      
      
        | 156 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 157 | 
        
         | 
        
         | 
        			$num_of = $position+$setting_posts_per_page;
  | 
      
      
        | 158 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 159 | 
        
         | 
        
         | 
        
  | 
      
      
        | 160 | 
        
         | 
        
         | 
        		$out_of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OUT_OF']).' '.$total_num;
  | 
      
      
        | 161 | 
        
         | 
        
         | 
        		$of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OF']).' '.$total_num;
  | 
      
      
        | 162 | 
        
         | 
        
         | 
        		$display_previous_next_links = '';
  | 
      
      
        | 163 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 164 | 
        
         | 
        
         | 
        		$display_previous_next_links = 'none';
  | 
      
      
        | 165 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 166 | 
        
         | 
        
         | 
        
  | 
      
      
        | 167 | 
        
            1895
         | 
        
            Luisehahne
         | 
        	if ($num_posts === 0) {
 | 
      
      
        | 168 | 
        
            1425
         | 
        
            Luisehahne
         | 
        		$setting_header = '';
  | 
      
      
        | 169 | 
        
         | 
        
         | 
        		$setting_post_loop = '';
  | 
      
      
        | 170 | 
        
         | 
        
         | 
        		$setting_footer = '';
  | 
      
      
        | 171 | 
        
         | 
        
         | 
        		$setting_posts_per_page = '';
  | 
      
      
        | 172 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 173 | 
        
         | 
        
         | 
        
  | 
      
      
        | 174 | 
        
         | 
        
         | 
        	// Print header
  | 
      
      
        | 175 | 
        
            1895
         | 
        
            Luisehahne
         | 
        	if($display_previous_next_links == 'none') {
 | 
      
      
        | 176 | 
        
            1425
         | 
        
            Luisehahne
         | 
        		print  str_replace( array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'),
 | 
      
      
        | 177 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		                    array('','','','','','', $display_previous_next_links), $setting_header);
 | 
      
      
        | 178 | 
        
            1425
         | 
        
            Luisehahne
         | 
        	} else {
 | 
      
      
        | 179 | 
        
         | 
        
         | 
        		print str_replace(  array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'),
 | 
      
      
        | 180 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		                    array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_header);
  | 
      
      
        | 181 | 
        
            1425
         | 
        
            Luisehahne
         | 
        	}
  | 
      
      
        | 182 | 
        
         | 
        
         | 
        	if($num_posts > 0)
  | 
      
      
        | 183 | 
        
            1895
         | 
        
            Luisehahne
         | 
        	{
 | 
      
      
        | 184 | 
        
            1425
         | 
        
            Luisehahne
         | 
        		if($query_extra != '')
  | 
      
      
        | 185 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		{
 | 
      
      
        | 186 | 
        
            1425
         | 
        
            Luisehahne
         | 
        			?>
  | 
      
      
        | 187 | 
        
         | 
        
         | 
        			<div class="selected-group-title">
  | 
      
      
        | 188 | 
        
         | 
        
         | 
        				<?php print '<a href="'.htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])).'">'.PAGE_TITLE.'</a> >> '.$groups[$_GET['g']]['title']; ?>
  | 
      
      
        | 189 | 
        
         | 
        
         | 
        			</div>
  | 
      
      
        | 190 | 
        
         | 
        
         | 
        			<?php
  | 
      
      
        | 191 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 192 | 
        
            1918
         | 
        
            Luisehahne
         | 
        		while( false != ($post = $query_posts->fetchRow(MYSQL_ASSOC)) )
  | 
      
      
        | 193 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		{
 | 
      
      
        | 194 | 
        
            1425
         | 
        
            Luisehahne
         | 
        			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
  | 
      
      
        | 195 | 
        
            1895
         | 
        
            Luisehahne
         | 
        			{ // Make sure parent group is active
 | 
      
      
        | 196 | 
        
            1425
         | 
        
            Luisehahne
         | 
        				$uid = $post['posted_by']; // User who last modified the post
  | 
      
      
        | 197 | 
        
         | 
        
         | 
        				// Workout date and time of last modified post
  | 
      
      
        | 198 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				if ($post['published_when'] === '0'){ $post['published_when'] = time();}
 | 
      
      
        | 199 | 
        
         | 
        
         | 
        				if ($post['published_when'] > $post['posted_when']) {
 | 
      
      
        | 200 | 
        
            1457
         | 
        
            Luisehahne
         | 
        					$post_date = date(DATE_FORMAT, $post['published_when']+TIMEZONE);
  | 
      
      
        | 201 | 
        
         | 
        
         | 
        					$post_time = date(TIME_FORMAT, $post['published_when']+TIMEZONE);
  | 
      
      
        | 202 | 
        
            1425
         | 
        
            Luisehahne
         | 
        				} else {
 | 
      
      
        | 203 | 
        
            1457
         | 
        
            Luisehahne
         | 
        					$post_date = date(DATE_FORMAT, $post['posted_when']+TIMEZONE);
  | 
      
      
        | 204 | 
        
         | 
        
         | 
        					$post_time = date(TIME_FORMAT, $post['posted_when']+TIMEZONE);
  | 
      
      
        | 205 | 
        
            1425
         | 
        
            Luisehahne
         | 
        				}
  | 
      
      
        | 206 | 
        
         | 
        
         | 
        
  | 
      
      
        | 207 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				$publ_date = date(DATE_FORMAT,$post['published_when']+TIMEZONE);
  | 
      
      
        | 208 | 
        
         | 
        
         | 
        				$publ_time = date(TIME_FORMAT,$post['published_when']+TIMEZONE);
  | 
      
      
        | 209 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 210 | 
        
            1895
         | 
        
            Luisehahne
         | 
        // Work-out the post link
  | 
      
      
        | 211 | 
        
            1425
         | 
        
            Luisehahne
         | 
        				$post_link = page_link($post['link']);
  | 
      
      
        | 212 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				$post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
  | 
      
      
        | 213 | 
        
         | 
        
         | 
        				$create_date = date(DATE_FORMAT, $post['created_when']+TIMEZONE);
  | 
      
      
        | 214 | 
        
         | 
        
         | 
        				$create_time = date(TIME_FORMAT, $post['created_when']+TIMEZONE);
  | 
      
      
        | 215 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 216 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				if(isset($_GET['p']) AND $position > 0) {
 | 
      
      
        | 217 | 
        
            1425
         | 
        
            Luisehahne
         | 
        					$post_link .= '?p='.$position;
  | 
      
      
        | 218 | 
        
         | 
        
         | 
        				}
  | 
      
      
        | 219 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
 | 
      
      
        | 220 | 
        
         | 
        
         | 
        					if(isset($_GET['p']) AND $position > 0) { $post_link .= '&'; } else { $post_link .= '?'; } {
 | 
      
      
        | 221 | 
        
            1425
         | 
        
            Luisehahne
         | 
        					$post_link .= 'g='.$_GET['g'];
  | 
      
      
        | 222 | 
        
            1895
         | 
        
            Luisehahne
         | 
        					}
  | 
      
      
        | 223 | 
        
            1425
         | 
        
            Luisehahne
         | 
        				}
  | 
      
      
        | 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 | 
        
         | 
        
         | 
        
  | 
      
      
        | 231 | 
        
         | 
        
         | 
        				if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";
  | 
      
      
        | 232 | 
        
         | 
        
         | 
        
  | 
      
      
        | 233 | 
        
         | 
        
         | 
        				// Replace [wblink--PAGE_ID--] with real link
  | 
      
      
        | 234 | 
        
         | 
        
         | 
        				$short = ($post['content_short']);
  | 
      
      
        | 235 | 
        
         | 
        
         | 
        				// Replace vars with values
  | 
      
      
        | 236 | 
        
         | 
        
         | 
        				$post_long_len = strlen($post['content_long']);
  | 
      
      
        | 237 | 
        
            1968
         | 
        
            darkviper
         | 
        				$vars = array('[POST_ID]', '[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[MODI_DATE]', '[MODI_TIME]', '[CREATED_DATE]', '[CREATED_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]','[SHOW_READ_MORE]');
 | 
      
      
        | 238 | 
        
            1425
         | 
        
            Luisehahne
         | 
        				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
  | 
      
      
        | 239 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				{
 | 
      
      
        | 240 | 
        
         | 
        
         | 
        					if($post_long_len < 9) {
 | 
      
      
        | 241 | 
        
            1968
         | 
        
            darkviper
         | 
        						$values = array($post['post_id'], 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, $create_date, $create_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '', 'hidden');
  | 
      
      
        | 242 | 
        
            1425
         | 
        
            Luisehahne
         | 
        					} else {
 | 
      
      
        | 243 | 
        
            1968
         | 
        
            darkviper
         | 
        						$values = array($post['post_id'], PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $create_date, $create_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $MOD_NEWS['TEXT_READ_MORE'], 'visible');
  | 
      
      
        | 244 | 
        
            1425
         | 
        
            Luisehahne
         | 
        					}
  | 
      
      
        | 245 | 
        
         | 
        
         | 
        				} else {
 | 
      
      
        | 246 | 
        
            1895
         | 
        
            Luisehahne
         | 
        					if($post_long_len < 9) {
 | 
      
      
        | 247 | 
        
            1968
         | 
        
            darkviper
         | 
        						$values = array($post['post_id'], 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, $create_date, $create_time, $publ_date, $publ_time, '', '', '', '', '','hidden');
  | 
      
      
        | 248 | 
        
            1425
         | 
        
            Luisehahne
         | 
        					} else {
 | 
      
      
        | 249 | 
        
            1968
         | 
        
            darkviper
         | 
        						$values = array($post['post_id'], PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $create_date, $create_time, $publ_date, $publ_time, '', '', '', '', $MOD_NEWS['TEXT_READ_MORE'],'visible');
  | 
      
      
        | 250 | 
        
            1425
         | 
        
            Luisehahne
         | 
        					}
  | 
      
      
        | 251 | 
        
         | 
        
         | 
        				}
  | 
      
      
        | 252 | 
        
         | 
        
         | 
        				print str_replace($vars, $values, $setting_post_loop);
  | 
      
      
        | 253 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 254 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 255 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 256 | 
        
            1895
         | 
        
            Luisehahne
         | 
        // Print footer
  | 
      
      
        | 257 | 
        
         | 
        
         | 
        	if($display_previous_next_links == 'none') {
 | 
      
      
        | 258 | 
        
         | 
        
         | 
        		print  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);
 | 
      
      
        | 259 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 260 | 
        
         | 
        
         | 
        		print 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);
 | 
      
      
        | 261 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 262 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 263 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 264 | 
        
            1457
         | 
        
            Luisehahne
         | 
        //elseif(defined('POST_ID') AND is_numeric(POST_ID))
 | 
      
      
        | 265 | 
        
            1918
         | 
        
            Luisehahne
         | 
        elseif(isset($post_id) && is_numeric($post_id)){
 | 
      
      
        | 266 | 
        
            1895
         | 
        
            Luisehahne
         | 
        // print '<h2>'.POST_ID.'/'.PAGE_ID.'/'.POST_SECTION.'</h2>';
  | 
      
      
        | 267 | 
        
            1457
         | 
        
            Luisehahne
         | 
        //  if(defined('POST_SECTION') AND POST_SECTION == $section_id)
 | 
      
      
        | 268 | 
        
            1918
         | 
        
            Luisehahne
         | 
        	if(isset($post_section) && ($post_section == $section_id)){
 | 
      
      
        | 269 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		// Get settings
  | 
      
      
        | 270 | 
        
         | 
        
         | 
        		$setting_post_header = $setting_post_footer = $setting_comments_header
  | 
      
      
        | 271 | 
        
         | 
        
         | 
        		                     = $setting_comments_loop = $setting_comments_footer = '';
  | 
      
      
        | 272 | 
        
         | 
        
         | 
        		$sql  = 'SELECT `post_header`, `post_footer`, `comments_header`, `comments_loop`, `comments_footer` ';
  | 
      
      
        | 273 | 
        
         | 
        
         | 
        		$sql .= 'FROM `'.TABLE_PREFIX.'mod_news_settings` ';
  | 
      
      
        | 274 | 
        
         | 
        
         | 
        		$sql .= 'WHERE `section_id`='.(int)$section_id;
  | 
      
      
        | 275 | 
        
         | 
        
         | 
        		if( ($resSettings = $database->query($sql)) ){
 | 
      
      
        | 276 | 
        
         | 
        
         | 
        			if( ($recSettings = $resSettings->fetchRow()) ) {
 | 
      
      
        | 277 | 
        
         | 
        
         | 
        				foreach($recSettings as $key=>$val){
 | 
      
      
        | 278 | 
        
         | 
        
         | 
        					${'setting_'.$key} = $val;
 | 
      
      
        | 279 | 
        
         | 
        
         | 
        				}
  | 
      
      
        | 280 | 
        
            1457
         | 
        
            Luisehahne
         | 
        			}
  | 
      
      
        | 281 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 282 | 
        
            1895
         | 
        
            Luisehahne
         | 
        // Get page info
  | 
      
      
        | 283 | 
        
         | 
        
         | 
        		$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".PAGE_ID."'");
 | 
      
      
        | 284 | 
        
         | 
        
         | 
        		if($query_page->numRows() > 0) {
 | 
      
      
        | 285 | 
        
         | 
        
         | 
        			$page = $query_page->fetchRow();
  | 
      
      
        | 286 | 
        
         | 
        
         | 
        			$page_link = page_link($page['link']);
  | 
      
      
        | 287 | 
        
         | 
        
         | 
        			if(isset($_GET['p']) AND $position > 0) {
 | 
      
      
        | 288 | 
        
         | 
        
         | 
        				$page_link .= '?p='.$_GET['p'];
  | 
      
      
        | 289 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 290 | 
        
         | 
        
         | 
        			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
 | 
      
      
        | 291 | 
        
         | 
        
         | 
        				if(isset($_GET['p']) AND $position > 0) { $page_link .= '&'; } else { $page_link .= '?'; }
 | 
      
      
        | 292 | 
        
         | 
        
         | 
        				$page_link .= 'g='.$_GET['g'];
  | 
      
      
        | 293 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 294 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 295 | 
        
         | 
        
         | 
        			exit($MESSAGE['PAGES_NOT_FOUND']);
  | 
      
      
        | 296 | 
        
            1425
         | 
        
            Luisehahne
         | 
        		}
  | 
      
      
        | 297 | 
        
         | 
        
         | 
        
  | 
      
      
        | 298 | 
        
            1918
         | 
        
            Luisehahne
         | 
        // Get post info
  | 
      
      
        | 299 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		$t = time();
  | 
      
      
        | 300 | 
        
         | 
        
         | 
        		$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
 | 
      
      
        | 301 | 
        
         | 
        
         | 
        			WHERE post_id = '".$post_id."' AND active = '1'
  | 
      
      
        | 302 | 
        
         | 
        
         | 
        			AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)");
  | 
      
      
        | 303 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 304 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		if($query_post->numRows() > 0)
  | 
      
      
        | 305 | 
        
         | 
        
         | 
        		{
 | 
      
      
        | 306 | 
        
         | 
        
         | 
        			$post = $query_post->fetchRow();
  | 
      
      
        | 307 | 
        
         | 
        
         | 
        			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
  | 
      
      
        | 308 | 
        
         | 
        
         | 
        			{ // Make sure parent group is active
 | 
      
      
        | 309 | 
        
         | 
        
         | 
        				$uid = $post['posted_by']; // User who last modified the post
  | 
      
      
        | 310 | 
        
         | 
        
         | 
        				// Workout date and time of last modified post
  | 
      
      
        | 311 | 
        
         | 
        
         | 
        				if ($post['published_when'] === '0'){ $post['published_when'] = time();}
 | 
      
      
        | 312 | 
        
         | 
        
         | 
        				if ($post['published_when'] > $post['posted_when']) {
 | 
      
      
        | 313 | 
        
         | 
        
         | 
        					$post_date = date(DATE_FORMAT, $post['published_when']+TIMEZONE);
  | 
      
      
        | 314 | 
        
         | 
        
         | 
        					$post_time = date(TIME_FORMAT, $post['published_when']+TIMEZONE);
  | 
      
      
        | 315 | 
        
         | 
        
         | 
        				} else {
 | 
      
      
        | 316 | 
        
         | 
        
         | 
        					$post_date = date(DATE_FORMAT, $post['posted_when']+TIMEZONE);
  | 
      
      
        | 317 | 
        
         | 
        
         | 
        					$post_time = date(TIME_FORMAT, $post['posted_when']+TIMEZONE);
  | 
      
      
        | 318 | 
        
         | 
        
         | 
        				}
  | 
      
      
        | 319 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 320 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				$publ_date = date(DATE_FORMAT,$post['published_when']+TIMEZONE);
  | 
      
      
        | 321 | 
        
         | 
        
         | 
        				$publ_time = date(TIME_FORMAT,$post['published_when']+TIMEZONE);
  | 
      
      
        | 322 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 323 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				// Work-out the post link
  | 
      
      
        | 324 | 
        
         | 
        
         | 
        				$post_link = page_link($post['link']);
  | 
      
      
        | 325 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 326 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				$post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
  | 
      
      
        | 327 | 
        
         | 
        
         | 
        				$create_date = date(DATE_FORMAT, $post['created_when']+TIMEZONE);
  | 
      
      
        | 328 | 
        
         | 
        
         | 
        				$create_time = date(TIME_FORMAT, $post['created_when']+TIMEZONE);
  | 
      
      
        | 329 | 
        
            1918
         | 
        
            Luisehahne
         | 
        // Get group id, title, and image
  | 
      
      
        | 330 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				$group_id = $post['group_id'];
  | 
      
      
        | 331 | 
        
         | 
        
         | 
        				$group_title = $groups[$group_id]['title'];
  | 
      
      
        | 332 | 
        
         | 
        
         | 
        				$group_image = $groups[$group_id]['image'];
  | 
      
      
        | 333 | 
        
         | 
        
         | 
        				$display_image = ($group_image == '') ? "none" : "inherit";
  | 
      
      
        | 334 | 
        
         | 
        
         | 
        				$display_group = ($group_id == 0) ? 'none' : 'inherit';
  | 
      
      
        | 335 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 336 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";
  | 
      
      
        | 337 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 338 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				$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]', '[CREATED_DATE]', '[CREATED_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[TEXT_POSTED_BY]', '[TEXT_ON]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]');
 | 
      
      
        | 339 | 
        
         | 
        
         | 
        				$post_short=$post['content_short'];
  | 
      
      
        | 340 | 
        
         | 
        
         | 
        				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
 | 
      
      
        | 341 | 
        
         | 
        
         | 
        					$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, $create_date, $create_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']);
  | 
      
      
        | 342 | 
        
         | 
        
         | 
        				} else {
 | 
      
      
        | 343 | 
        
         | 
        
         | 
        					$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, $create_date, $create_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], '', '', '', '');
  | 
      
      
        | 344 | 
        
         | 
        
         | 
        				}
  | 
      
      
        | 345 | 
        
         | 
        
         | 
        				// $post_long = ($post['content_long']);
  | 
      
      
        | 346 | 
        
         | 
        
         | 
        				$post_long = ($post['content_long'] != '') ? $post['content_long'] : $post['content_short'];
  | 
      
      
        | 347 | 
        
            1425
         | 
        
            Luisehahne
         | 
        			}
  | 
      
      
        | 348 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		} else {
 | 
      
      
        | 349 | 
        
         | 
        
         | 
        				$wb->print_error($MESSAGE['FRONTEND_SORRY_NO_ACTIVE_SECTIONS'], 'view.php', false);
  | 
      
      
        | 350 | 
        
            1425
         | 
        
            Luisehahne
         | 
        		}
  | 
      
      
        | 351 | 
        
         | 
        
         | 
        
  | 
      
      
        | 352 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		// Print post header
  | 
      
      
        | 353 | 
        
         | 
        
         | 
        		print str_replace($vars, $values, $setting_post_header);
  | 
      
      
        | 354 | 
        
         | 
        
         | 
        		// Print long
  | 
      
      
        | 355 | 
        
         | 
        
         | 
        		print $post_long;
  | 
      
      
        | 356 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 357 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		// Print post footer
  | 
      
      
        | 358 | 
        
         | 
        
         | 
        		print str_replace($vars, $values, $setting_post_footer);
  | 
      
      
        | 359 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 360 | 
        
            1895
         | 
        
            Luisehahne
         | 
        		// Show comments section if we have to
  | 
      
      
        | 361 | 
        
         | 
        
         | 
        		if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public')
  | 
      
      
        | 362 | 
        
         | 
        
         | 
        		{
 | 
      
      
        | 363 | 
        
         | 
        
         | 
        			// Print comments header
  | 
      
      
        | 364 | 
        
         | 
        
         | 
        			$vars = array('[ADD_COMMENT_URL]','[TEXT_COMMENTS]');
 | 
      
      
        | 365 | 
        
         | 
        
         | 
        			// $pid = $admin->getIDKEY(POST_ID);
  | 
      
      
        | 366 | 
        
         | 
        
         | 
        			$values = array(WB_URL.'/modules/news/comment.php?post_id='.$post_id.'&section_id='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);
  | 
      
      
        | 367 | 
        
         | 
        
         | 
        			print str_replace($vars, $values, $setting_comments_header);
  | 
      
      
        | 368 | 
        
            1425
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 369 | 
        
            1918
         | 
        
            Luisehahne
         | 
        // Query for comments
  | 
      
      
        | 370 | 
        
            1895
         | 
        
            Luisehahne
         | 
        			$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");
 | 
      
      
        | 371 | 
        
         | 
        
         | 
        			if($query_comments->numRows() > 0)
  | 
      
      
        | 372 | 
        
         | 
        
         | 
        			{
 | 
      
      
        | 373 | 
        
         | 
        
         | 
        				while( false != ($comment = $query_comments->fetchRow()) )
  | 
      
      
        | 374 | 
        
         | 
        
         | 
        				{
 | 
      
      
        | 375 | 
        
         | 
        
         | 
        					// Display Comments without slashes, but with new-line characters
  | 
      
      
        | 376 | 
        
         | 
        
         | 
        					$comment['comment'] = nl2br($wb->strip_slashes($comment['comment']));
  | 
      
      
        | 377 | 
        
         | 
        
         | 
        					$comment['title'] = $wb->strip_slashes($comment['title']);
  | 
      
      
        | 378 | 
        
         | 
        
         | 
        					// Print comments loop
  | 
      
      
        | 379 | 
        
         | 
        
         | 
        					$commented_date = date(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
  | 
      
      
        | 380 | 
        
         | 
        
         | 
        					$commented_time = date(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
  | 
      
      
        | 381 | 
        
         | 
        
         | 
        					$uid = $comment['commented_by'];
  | 
      
      
        | 382 | 
        
         | 
        
         | 
        					$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
 | 
      
      
        | 383 | 
        
         | 
        
         | 
        					if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
 | 
      
      
        | 384 | 
        
         | 
        
         | 
        						$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']));
  | 
      
      
        | 385 | 
        
         | 
        
         | 
        					} else {
 | 
      
      
        | 386 | 
        
         | 
        
         | 
        						$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'], '');
  | 
      
      
        | 387 | 
        
         | 
        
         | 
        					}
  | 
      
      
        | 388 | 
        
         | 
        
         | 
        					print str_replace($vars, $values, $setting_comments_loop);
  | 
      
      
        | 389 | 
        
         | 
        
         | 
        				}
  | 
      
      
        | 390 | 
        
         | 
        
         | 
        			} else {
 | 
      
      
        | 391 | 
        
         | 
        
         | 
        				// Say no comments found
  | 
      
      
        | 392 | 
        
         | 
        
         | 
        				$content = '';
  | 
      
      
        | 393 | 
        
            1425
         | 
        
            Luisehahne
         | 
        				$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
 | 
      
      
        | 394 | 
        
            1895
         | 
        
            Luisehahne
         | 
        				$values = array( '', $MOD_NEWS['NO_COMMENT_FOUND'], '', '', '', '', '', '', '', '');
  | 
      
      
        | 395 | 
        
            1425
         | 
        
            Luisehahne
         | 
        				print str_replace($vars, $values, $setting_comments_loop);
  | 
      
      
        | 396 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 397 | 
        
            1895
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 398 | 
        
         | 
        
         | 
        			// Print comments footer
  | 
      
      
        | 399 | 
        
         | 
        
         | 
        			$vars = array('[ADD_COMMENT_URL]','[TEXT_ADD_COMMENT]');
 | 
      
      
        | 400 | 
        
         | 
        
         | 
        			$values = array(WB_URL.'/modules/news/comment.php?post_id='.$post_id.'&section_id='.$section_id, $MOD_NEWS['TEXT_ADD_COMMENT']);
  | 
      
      
        | 401 | 
        
         | 
        
         | 
        			print str_replace($vars, $values, $setting_comments_footer);
  | 
      
      
        | 402 | 
        
         | 
        
         | 
        
  | 
      
      
        | 403 | 
        
            1425
         | 
        
            Luisehahne
         | 
        		}
  | 
      
      
        | 404 | 
        
         | 
        
         | 
        
  | 
      
      
        | 405 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 406 | 
        
         | 
        
         | 
        
  | 
      
      
        | 407 | 
        
            1895
         | 
        
            Luisehahne
         | 
        	if(ENABLED_ASP) {
 | 
      
      
        | 408 | 
        
            1457
         | 
        
            Luisehahne
         | 
        		$_SESSION['comes_from_view'] = $post_id;
  | 
      
      
        | 409 | 
        
            1425
         | 
        
            Luisehahne
         | 
        		$_SESSION['comes_from_view_time'] = time();
  | 
      
      
        | 410 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 411 | 
        
         | 
        
         | 
        
  | 
      
      
        | 412 | 
        
         | 
        
         | 
        }
  |