sibtracker/system/forum/ajax/post.preview.php

38 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2019-05-18 13:46:03 +08:00
<?php
include 'init.php';
require_once SYSTEM_DIR.'/classes/parse.class.php';
if (!@is_dir(ROOT_DIR.'/templates/'.$_REQUEST['skin']) OR $_REQUEST['skin'] == "") die ("Hacking attempt!");
$tpl = new dle_template;
$tpl->dir = ROOT_DIR.'/templates/'.$_REQUEST['skin'];
define('TEMPLATE_DIR', $tpl->dir);
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
$_POST['post_text'] = convert_unicode($_POST['post_text'], $config['charset']);
$parse = new ParseFilter(Array(), Array(), 1, 1);
$post_text = $parse->process($_POST['post_text']);
$post_text = $parse->BB_Parse($post_text, FALSE);
if( function_exists( "get_magic_quotes_gpc" ) && get_magic_quotes_gpc() ) $post_text = stripslashes( $post_text );
$tpl->load_template('forum/msg.tpl');
$tpl->set('{title}', "Preview");
$tpl->set('{msg}', $post_text);
$tpl->compile('content');
$tpl->clear();
$tpl->result['content'] = str_replace('{THEME}', $config['http_home_url'].'templates/'.$_REQUEST['skin'], $tpl->result['content']);
@header("Content-type: text/css; charset=".$config['charset']);
echo $tpl->result['content'];
?>