Location: PHPKode > projects > XS PHP Content Management System > xsphpcms-1.1.0/content/preview.php
<?php
//
// +--------------------------------------------------------------------------+
// |                                                                          |
// |                     XS PHP Content Management System                     |
// |                                                                          |
// |                   Copyright (c) 2001-2002 XSPHPCMS Group.                |
// |                                                                          |
// +--------------------------------------------------------------------------+
// |                                                                          |
// | This program is free software; you can redistribute it and/or modify it  |
// | under the terms of the GNU General Public License as published by the    |
// | Free Software Foundation; either version 2 of the License, or any later  |
// | version.                                                                 |
// |                                                                          |
// | This program 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 GNU General |
// | Public License for more details.                                         |
// |                                                                          |
// | You should have received a copy of the GNU General Public License along  |
// | with this program; if not, write to the Free Software Foundation, Inc.,  |
// | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                    |
// |                                                                          |
// +--------------------------------------------------------------------------+
// |                                                                          |
// | Authors: Robert Bala <hide@address.com>                                   |
// |                                                                          |
// +--------------------------------------------------------------------------+
//
// $Id: preview.php,v 1.3 2003/01/26 19:00:53 rbala Exp $

if (!defined('XS_SYSTEM_DIR') && !defined('XS_SYSTEM_URL')) {
    header('HTTP/1.0 404 Not Found');
    exit;
}

xscms_include('xstopic.inc.php');
xscms_include('xsarticle.inc.php');

xscms_start();

$aid = xscms_getGetParam('aid');

$xstopic =& xscms_createObject('XSTopic');
$xsarticle =& xscms_createObject('XSArticle');

if (!$xsarticle->isPublished($aid)) {
    xcms_error404();
}

$item = $xsarticle->fetchItem(array('aid' => $aid));

if (($item['tid'] != 0) && !$xstopic->isPublished($item['tid'])) {
    xcms_error404();
}

if (strlen($item['perms'])) {
    xscms_checkPerms($item['perms']);
}

if (strlen($item['keywords'])) {
    xscms_setScreenParam('page_keywords', substr($item['keywords'], 0, 1000));
}

if (strlen($item['description'])) {
    $item['description'] = ereg_replace('<([^>]|\n)*>', '', $item['description']);
    $item['description'] = ereg_replace('{([^}]|\n)*}', '', $item['description']);

    xscms_setScreenParam('page_description', substr($item['description'], 0, 200));
}

xscms_setScreenParam('subject', $item['title']);

if ($settings['page_preview']) {
    xscms_fetchScreen(XS_PAGE_SCREEN,  'ContentDetails');

    xscms_setScreenParam('lc_username_label', xscms_getLocaleParam('lc_username_label'));

    xscms_setScreenParam('publisher_value', $item['username']);
    xscms_setScreenParam('published_value', $item['publish_date']);

    xscms_parseScreen('ContentDetails');
} else {
    xscms_clearScreen(XS_PAGE_SCREEN, 'ContentDetails');
}

xscms_setScreenParam('content', $item['contents']);

xscms_parseScreen('subject');
xscms_parseScreen('content');

xscms_setScreenParam('lc_print_button', xscms_getLocaleParam('lc_print_button'));
xscms_setScreenParam('lc_close_button', xscms_getLocaleParam('lc_close_button'));
    
xscms_close();

?>
Return current item: XS PHP Content Management System