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

Revision 405, 4.6 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( ! empty( $_SERVER['REQUEST_URI'] ) && ! stristr( $_SERVER['REQUEST_URI'] , 'modules' ) ) {
36    $tinyd_vmod_dir = $_SERVER['REQUEST_URI'] ;
37    $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] ;
38}
39
40/* echo "<pre>" ;
41var_dump( $_SERVER ) ;
42exit ; */
43
44include( '../../mainfile.php' ) ;
45include_once( 'class/tinyd.textsanitizer.php' ) ;
46include_once( 'include/render_function.inc.php' ) ;
47include_once( 'include/constants.inc.php' ) ;
48
49// for "Duplicatable"
50$mydirname = basename( dirname( __FILE__ ) ) ;
51if( ! preg_match( '/^(\D+)(\d*)$/' , $mydirname , $regs ) ) echo ( "invalid dirname: " . htmlspecialchars( $mydirname ) ) ;
52$mydirnumber = $regs[2] === '' ? '' : intval( $regs[2] ) ;
53
54// utility variables
55$mymodpath = XOOPS_ROOT_PATH."/modules/$mydirname" ;
56$mytablename = $xoopsDB->prefix( "tinycontent{$mydirnumber}" ) ;
57
58// get id of homepage
59$result = $xoopsDB->query( "SELECT storyid FROM $mytablename WHERE visible='1' ORDER BY homepage DESC, blockid" ) ;
60if( $xoopsDB->getRowsNum( $result ) < 1 ) {
61    redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ;
62    exit ;
63}
64list( $homepage_id ) = $xoopsDB->fetchRow( $result ) ;
65
66// check if $_GET['id'] is specified
67$id = empty( $_GET['id'] ) ? 0 : intval( $_GET['id'] ) ;
68if( $id <= 0 )  {
69    $_REQUEST['id'] = $_GET['id'] = $id = $homepage_id ;
70}
71
72// main query
73$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" ) ;
74if( ( $result_array = $xoopsDB->fetchArray( $result ) ) == false ) {
75    redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ;
76    exit ;
77}
78
79// redirect if its base of wrapping is wrap_path (content)
80/* if( ! $xoopsModuleConfig['tc_force_mod_rewrite'] && $result_array['link'] == TC_WRAPTYPE_CONTENTBASE ) {
81    if( headers_sent() ) {
82        redirect_header( XOOPS_URL . "/modules/$mydirname/content/index.php?id={$result_array['storyid']}" , 0 , '&nbsp;' ) ;
83    } else {
84        header( "Location: content/index.php?id={$result_array['storyid']}" ) ;
85    }
86    exit ;
87} TODO */
88
89$tinyd_singlecontent = true ;
90include( "include/print.inc.php" ) ;
91
92?>
Note: See TracBrowser for help on using the repository browser.