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

Revision 405, 4.0 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// check modulesless rewrite
35if( ! stristr( $_SERVER['REQUEST_URI'] , 'modules' ) ) {
36    $tinyd_vmod_dir = $_SERVER['REQUEST_URI'] ;
37    $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] ;
38}
39
40include( '../../mainfile.php' ) ;
41include_once( 'class/tinyd.textsanitizer.php' ) ;
42include_once( 'include/render_function.inc.php' ) ;
43include_once( 'include/constants.inc.php' ) ;
44
45// for "Duplicatable"
46$mydirname = basename( dirname( __FILE__ ) ) ;
47if( ! preg_match( '/^(\D+)(\d*)$/' , $mydirname , $regs ) ) echo ( "invalid dirname: " . htmlspecialchars( $mydirname ) ) ;
48$mydirnumber = $regs[2] === '' ? '' : intval( $regs[2] ) ;
49
50// utility variables
51$mymodpath = XOOPS_ROOT_PATH."/modules/$mydirname" ;
52$mytablename = $xoopsDB->prefix( "tinycontent{$mydirnumber}" ) ;
53
54// check if $_GET['wrap'] is specified & exists the file
55if( empty( $_GET['wrap'] ) ) {
56    redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ;
57    exit ;
58}
59
60// before fopen it eliminates '..' (thx JM2)
61$wrap = str_replace( '..' , '' , $_GET['wrap'] ) ;
62if( ! ( $fp = fopen( "content/$wrap" , "r" ) ) ) {
63    redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ;
64    exit ;
65}
66
67$body_flag = false ;
68$content = "" ;
69while( $buf = fgets( $fp , 4096 ) ) {
70//  if( ! $body_flag && preg_match( "/<body.*>(.*)/i" , $buf , $regs ) ) {
71//      $body_flag = true ;
72//      $content .= $regs[1] ;
73//  } else {
74        $content .= $buf ;
75//  }
76}
77fclose( $fp ) ;
78
79/* $str=str_replace("\r\n","\n",$str);
80   $str=str_replace("\r","\n",$str);
81   $lines = explode("\n",$str); */
82
83include XOOPS_ROOT_PATH."/header.php";
84echo tc_convert_wrap_to_ie( $content ) ;
85include XOOPS_ROOT_PATH."/footer.php";
86
87?>
Note: See TracBrowser for help on using the repository browser.