| 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 | include( '../../mainfile.php' ) ; |
|---|
| 35 | include_once( 'class/tinyd.textsanitizer.php' ) ; |
|---|
| 36 | include_once( 'include/render_function.inc.php' ) ; |
|---|
| 37 | include_once( 'include/constants.inc.php' ) ; |
|---|
| 38 | |
|---|
| 39 | // for "Duplicatable" |
|---|
| 40 | $mydirname = basename( dirname( __FILE__ ) ) ; |
|---|
| 41 | if( ! preg_match( '/^(\D+)(\d*)$/' , $mydirname , $regs ) ) echo ( "invalid dirname: " . htmlspecialchars( $mydirname ) ) ; |
|---|
| 42 | $mydirnumber = $regs[2] === '' ? '' : intval( $regs[2] ) ; |
|---|
| 43 | |
|---|
| 44 | // utility variables |
|---|
| 45 | $mymodpath = XOOPS_ROOT_PATH."/modules/$mydirname" ; |
|---|
| 46 | $mytablename = $xoopsDB->prefix( "tinycontent{$mydirnumber}" ) ; |
|---|
| 47 | |
|---|
| 48 | // check if $_GET['id'] is specified |
|---|
| 49 | $id = empty( $_GET['id'] ) ? 0 : intval( $_GET['id'] ) ; |
|---|
| 50 | if( $id <= 0 ) { |
|---|
| 51 | redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ; |
|---|
| 52 | exit ; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | // main query |
|---|
| 56 | $result = $xoopsDB->query( "SELECT storyid,title,text,visible,nohtml,nosmiley,nobreaks,nocomments,link,address,UNIX_TIMESTAMP(last_modified) AS last_modified,html_header FROM $mytablename WHERE storyid='$id' AND visible" ) ; |
|---|
| 57 | if( ( $result_array = $xoopsDB->fetchArray( $result ) ) == false ) { |
|---|
| 58 | redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ; |
|---|
| 59 | exit ; |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | // redirect if its base of wrapping is wrap_path (content) |
|---|
| 63 | if( $result_array['link'] >= TC_WRAPTYPE_CONTENTBASE ) { |
|---|
| 64 | if( headers_sent() ) { |
|---|
| 65 | redirect_header( XOOPS_URL . "/modules/$mydirname/content/index.php?op=print&id={$result_array['storyid']}" , 0 , ' ' ) ; |
|---|
| 66 | } else { |
|---|
| 67 | header( "Location: content/index.php?op=print&id={$result_array['storyid']}" ) ; |
|---|
| 68 | } |
|---|
| 69 | exit ; |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | include( "include/print.inc.php" ) ; |
|---|
| 73 | |
|---|
| 74 | ?> |
|---|