Esempio n. 1
0
                $preview = TRUE;
            }
        }
    }
}
if ($preview || !$smarty->isCached($this->GetDatabaseResource($template), $cache_id, $compile_id)) {
    // not cached... have to do to the work.
    if (isset($params['articleid']) && $params['articleid'] == -1) {
        $article = news_ops::get_latest_article();
    } else {
        if (isset($params['articleid']) && (int) $params['articleid'] > 0) {
            $show_expired = $this->GetPreference('expired_viewable', 1);
            if (isset($params['showall'])) {
                $show_expired = 1;
            }
            $article = news_ops::get_article_by_id((int) $params['articleid'], TRUE, $show_expired);
        }
    }
    if (!$article) {
        throw new CmsError404Exception('Article ' . (int) $params['articleid'] . ' not found, or otherwise unavailable');
        return;
    }
    $article->set_linkdata($id, $params);
    $return_url = $this->CreateReturnLink($id, isset($params['origid']) ? $params['origid'] : $returnid, $this->lang('news_return'));
    $smarty->assign_by_ref('return_url', $return_url);
    $smarty->assign_by_ref('entry', $article);
    $catName = '';
    if (isset($params['category_id'])) {
        $catName = $db->GetOne('SELECT news_category_name FROM ' . cms_db_prefix() . 'module_news_categories where news_category_id=?', array($params['category_id']));
    }
    $smarty->assign('category_name', $catName);
Esempio n. 2
0
            $data = unserialize(file_get_contents($fname));
            if (is_array($data)) {
                // get passed data into a standard format.
                $article = new news_article();
                $article->set_linkdata($id, $params);
                news_ops::fill_article_from_formparams($article, $data, FALSE, FALSE);
            }
        }
    }
} else {
    if (isset($params['articleid']) && $params['articleid'] == -1) {
        $article = news_ops::get_latest_article();
        $article->set_linkdata($id, $params);
    } else {
        if (isset($params['articleid']) && (int) $params['articleid'] > 0) {
            $article = news_ops::get_article_by_id((int) $params['articleid']);
            $article->set_linkdata($id, $params);
            // todo, should we 404 here if article not found?
        }
    }
}
if (!$article) {
    return;
}
$return_url = $this->CreateReturnLink($id, isset($params['origid']) ? $params['origid'] : $returnid, $this->lang('news_return'));
$smarty->assign_by_ref('return_url', $return_url);
$smarty->assign_by_ref('entry', $article);
$catName = '';
if (isset($params['category_id'])) {
    $catName = $db->GetOne('SELECT news_category_name FROM ' . cms_db_prefix() . 'module_news_categories where news_category_id=?', array($params['category_id']));
}