Esempio n. 1
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);
                $compile_id = 'news_preview_' . time();
                $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'));