source: temp/test-xoops.ec-cube.net/html/modules/tinyd0/preview.php @ 405

Revision 405, 4.3 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2//  ------------------------------------------------------------------------ //
3//                XOOPS - PHP Content Management System                      //
4//                    Copyright (c) 2000 XOOPS.org                           //
5//                       <http://www.xoops.org/>                             //
6//  ------------------------------------------------------------------------ //
7//  This program is free software; you can redistribute it and/or modify     //
8//  it under the terms of the GNU General Public License as published by     //
9//  the Free Software Foundation; either version 2 of the License, or        //
10//  (at your option) any later version.                                      //
11//                                                                           //
12//  You may not change or alter any portion of this comment or credits       //
13//  of supporting developers from this source code or any supporting         //
14//  source code which is considered copyrighted (c) material of the          //
15//  original comment or credit authors.                                      //
16//                                                                           //
17//  This program is distributed in the hope that it will be useful,          //
18//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
19//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
20//  GNU General Public License for more details.                             //
21//                                                                           //
22//  You should have received a copy of the GNU General Public License        //
23//  along with this program; if not, write to the Free Software              //
24//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
25// ------------------------------------------------------------------------- //
26// Author: Tobias Liegl (AKA CHAPI)                                          //
27// Site: http://www.chapi.de                                                 //
28// Project: The XOOPS Project                                                //
29// ------------------------------------------------------------------------- //
30// Hacker: GIJ=CHECKMATE (AKA GIJOE)                                         //
31// Site: http://www.peak.ne.jp/xoops/                                        //
32// ------------------------------------------------------------------------- //
33
34// sleep( 1 ) ; // for getting session
35
36include( '../../mainfile.php' ) ;
37include_once( 'class/tinyd.textsanitizer.php' ) ;
38include_once( 'include/render_function.inc.php' ) ;
39include_once( 'include/constants.inc.php' ) ;
40// include_once( "include/gtickets.php" ) ;
41
42// $myts
43$myts =& TinyDTextSanitizer::getInstance() ;
44
45// only Administrator can show
46if( ! is_object( $xoopsUser ) || ! $xoopsUser->isAdmin() ) exit ;
47
48// for "Duplicatable"
49$mydirname = basename( dirname( __FILE__ ) ) ;
50if( ! preg_match( '/^(\D+)(\d*)$/' , $mydirname , $regs ) ) echo ( "invalid dirname: " . htmlspecialchars( $mydirname ) ) ;
51$mydirnumber = $regs[2] === '' ? '' : intval( $regs[2] ) ;
52
53// utility variables
54$mymodpath = XOOPS_ROOT_PATH."/modules/$mydirname" ;
55$mytablename = $xoopsDB->prefix( "tinycontent{$mydirnumber}" ) ;
56
57// check if post data is passed via session...
58if( empty( $_SESSION['tinyd_preview_post'] ) ) exit ;
59
60$post = $_SESSION['tinyd_preview_post'] ;
61unset( $_SESSION['tinyd_preview_post'] ) ;
62
63// cache file name check (thx JM2)
64/* if( ! preg_match( '/^'.$mydirname.'_preview_\d{10}$/' , $_GET['preview'] ) ) exit ;
65
66$content_cache_full_path = XOOPS_CACHE_PATH . '/' . $_GET['preview'] ;
67$fp = fopen( $content_cache_full_path , 'r' ) ;
68if( $fp === false ) die( _TC_FILENOTFOUND . " $content_cache_full_path" ) ;
69$text = fread( $fp , 65536 ) ;
70fclose( $fp ) ;
71@unlink( $content_cache_full_path ) ;*/
72
73// force turning PHP debug on
74$original_level = error_reporting( E_ALL ) ;
75
76$content = tc_content_render( $post['message'] , $post['nohtml'] , $post['nosmiley'] , $post['nobreaks'] , $xoopsModuleConfig['tc_space2nbsp'] ) ;
77
78// restore error_report_level
79error_reporting( $original_level ) ;
80
81echo '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" /><meta http-equiv="content-language" content="'._LANGCODE.'" /><title>'.$xoopsConfig['sitename'].'</title></head><body>'.$content.'</body></html>';
82
83?>
Note: See TracBrowser for help on using the repository browser.