*
* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License. 
* http://creativecommons.org/licenses/by/3.0/
*
* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Creative Commons Attribution 3.0 License for more details. 
* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, 
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once 'inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
// --------------- page variables
$_page['name_index'] = 21;
$_page['css_name'] = 'news_view.css';
$logged['member'] = member_auth(0, false);
$_page['header'] = _t("_COMPOSE_NEWS_VIEW_H");
$_page['header_text'] = _t("_COMPOSE_NEWS_VIEW_H1");
// --------------- page components
$_ni = $_page['name_index'];
$query = "\n\tSELECT\n\t\t`Header`,\n\t\t`Snippet`,\n\t\t`Text`,\n\t\tDATE_FORMAT(`Date`, '{$date_format}' ) AS 'Date'\n\tFROM `News`\n\tWHERE `ID`=" . (int) $_GET['ID'];
$news_arr = db_arr($query);
$_page_cont[$_ni]['news_date'] = $news_arr['Date'];
$_page_cont[$_ni]['news_header'] = process_line_output($news_arr['Header']);
$_page_cont[$_ni]['news_text'] = process_text_withlinks_output($news_arr['Text']);
$_page_cont[$_ni]['news_snippet'] = process_text_output($news_arr['Snippet']);
// --------------- [END] page components
PageCode();
// --------------- page components functions
 function getBasicFileInfoForm(&$aInfo, $sUrlPref = '')
 {
     $aForm = array('title' => array('type' => 'value', 'value' => $aInfo['medTitle'], 'caption' => _t('_Title')), 'album' => array('type' => 'value', 'value' => '<a href = "' . $sUrlPref . 'browse/album/' . $aInfo['albumUri'] . '/owner/' . $aInfo['NickName'] . '">' . $aInfo['albumCaption'] . '</a>', 'caption' => _t('_sys_album')), 'desc' => array('type' => 'value', 'value' => process_text_withlinks_output($aInfo['medDesc']), 'caption' => _t('_Description')), 'category' => array('type' => 'value', 'value' => getLinkSet($aInfo['Categories'], $sUrlPref . 'browse/category/', CATEGORIES_DIVIDER), 'caption' => _t('_Category')), 'tags' => array('type' => 'value', 'value' => getLinkSet($aInfo['medTags'], $sUrlPref . 'browse/tag/'), 'caption' => _t('_Tags')), 'url' => array('type' => 'text', 'value' => $sUrlPref . 'view/' . $aInfo['medUri'], 'attrs' => array('onclick' => 'this.focus(); this.select();', 'readonly' => 'readonly'), 'caption' => _t('_URL')));
     return $aForm;
 }
/**
 * Latest News block
 */
function PageCompNews($sCaption)
{
    global $site;
    global $PageCompNews_db_num;
    global $short_date_format;
    global $oTemplConfig;
    $php_date_format = getParam('php_date_format');
    // news
    $news_limit_chars = getParam("max_news_preview");
    $max_news_on_home = getParam("max_news_on_home");
    $news_res = db_res("SELECT `Header`, `Snippet`, `News`.`ID` AS `newsID`, UNIX_TIMESTAMP( `Date` ) AS 'Date' FROM `News` ORDER BY `Date` DESC LIMIT {$max_news_on_home}");
    $news_count = db_arr("SELECT COUNT(ID) FROM `News`");
    $news_counter = $news_count['0'];
    $ret = '';
    if ($news_counter > 0) {
        while ($news_arr = mysql_fetch_assoc($news_res)) {
            //$ret .= '<img src="' . $site['icons'] . 'news.gif" alt="" />';
            //$ret .= '<span style="position:relative; left:5px; bottom:3px;">';
            //$ret .= '</span>';
            //$ret .= '<div class="news_divider"></div>';
            $ret .= '<div class="newsWrap">';
            $ret .= '<div class="newsHead">';
            $ret .= '<a href="' . $site['url'] . 'news_view.php?ID=' . $news_arr['newsID'] . '">';
            $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="newsText">';
            $ret .= process_text_withlinks_output($news_arr['Snippet']);
            $ret .= '</div>';
            $ret .= '</div>';
        }
        if ($news_counter > $max_news_on_home) {
            $ret .= '<div style="position:relative; text-align:center;">';
            $ret .= '<a href="' . $site['url'] . 'news.php">' . _t("_Read news in archive") . '</a>';
            $ret .= '</div>';
        }
    } else {
        $ret .= '<div class="no_result"><div>' . _t("_No news available") . '</div></div>';
    }
    return DesignBoxContent(_t($sCaption), $ret, 1);
}