/**
 * Print news
 */
function printNewsList()
{
    global $news_limit_chars;
    global $short_date_format;
    global $tmpl;
    $bNewsFriendly = getParam('permalinks_news') == 'on' ? true : false;
    $res = getNewsList();
    ob_start();
    if (!mysql_num_rows($res)) {
        ?>
			<div class="no_news">
				<?php 
        echo _t("_No news available");
        ?>
			</div>
		<?php 
    } else {
        while ($news_arr = mysql_fetch_array($res)) {
            ?>
			<div class="news_cont">
				<div class="clear_both"></div>
				<div class="news_header">
					<a href="<?php 
            echo getNewsUrl($news_arr['newsID'], $news_arr['NewsUri'], $bNewsFriendly);
            ?>
">
						<?php 
            echo process_line_output($news_arr['Header']);
            ?>
					</a>
				</div>
				<div class="news_date"><?php 
            echo date(str_replace('%', '', $short_date_format), $news_arr['Date']);
            ?>
</div>
				<div class="news_snippet">
					<?php 
            echo process_html_output($news_arr['Snippet']);
            ?>
				</div>
				<div class="clear_both"></div>
			</div>
			<?php 
        }
    }
    return ob_get_clean();
}
function MemberPrintNews()
{
    global $site;
    global $short_date_format;
    $bNewsFriendly = getParam('permalinks_news') == 'on' ? true : false;
    $res = getNewsList();
    if (!$res) {
        return;
    }
    echo "<table cellspacing=1 cellpadding=2 class=small width='100%'>\n";
    if (!mysql_num_rows($res)) {
        echo "<tr class=panel><td align=center>No news available.</td></tr>\n";
    }
    while ($news_arr = mysql_fetch_array($res)) {
        $news_header = process_line_output($news_arr['Header']);
        $sNewsUrl = getNewsUrl($news_arr['newsID'], $news_arr['NewsUri'], $bNewsFriendly);
        echo "\r\n\t\t\t<tr >\r\n\t\t\t\t<td align=center width=15%>\r\n\t\t\t\t\t<a href=\"news.php?edit_id={$news_arr['newsID']}\">Edit</a> |\r\n\t\t\t\t\t<a href=\"news.php?action=delete&delete_id={$news_arr['newsID']}\">Delete</a>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td align=center width=15%>" . date(str_replace('%', '', $short_date_format), $news_arr['Date']) . "</td>\r\n\t\t\t\t<td aling=left>&nbsp;<a target='_blank' href='{$sNewsUrl}'>{$news_header}</a></td>\r\n\t\t\t</tr>\n";
    }
    echo "</table>\n";
}
function printNewsPanel($iLimit = 0, $iPreview = 128)
{
    global $site;
    $php_date_format = getParam('php_date_format');
    // news
    $news_limit_chars = getParam("max_news_preview");
    $bNewsFriendly = getParam('permalinks_news') == 'on' ? true : false;
    $news_res = getNewsList($iLimit);
    $news_count = db_arr("SELECT COUNT(*) FROM `News`");
    $news_counter = $news_count['0'];
    $ret = '';
    if ($news_counter > 0) {
        while ($news_arr = mysql_fetch_assoc($news_res)) {
            $ret .= '<div class="newsWrap">';
            $ret .= '<div class="newsHead">';
            $ret .= '<a href="' . getNewsUrl($news_arr['newsID'], $news_arr['NewsUri'], $bNewsFriendly) . '">';
            $ret .= process_line_output($news_arr['Header']);
            $ret .= '</a>';
            $ret .= '</div>';
            //$ret .= '<div class="newsInfo"><img src="' . getTemplateIcon( 'clock.gif' ) . '" />' . date( $php_date_format, $news_arr['Date'] ) . '</div>';
            $ret .= '<div class="newsInfo"><img src="' . getTemplateIcon('clock.gif') . '" />' . LocaledDataTime($news_arr['Date']) . '</div>';
            $ret .= '<div class="newsText">';
            //$ret .= process_text_withlinks_output( $news_arr['Snippet'] );
            $ret .= process_html_output($news_arr['Snippet']);
            $ret .= '</div>';
            $ret .= '</div>';
        }
        if ($news_counter > $max_news_on_home) {
            $sNewsLink = $bNewsFriendly ? $site['url'] . 'news/' : $site['url'] . 'news.php';
            $ret .= '<div class="newsReadMore">';
            $ret .= '<a href="' . $sNewsLink . '">' . _t("_Read news in archive") . '</a>';
            $ret .= '</div>';
        }
    } else {
        $ret .= '<div class="no_result"><div>' . _t("_No news available") . '</div></div>';
    }
    return $ret;
}