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

Revision 405, 5.9 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
34include( '../../../mainfile.php' ) ;
35include_once( '../class/tinyd.textsanitizer.php' ) ;
36include_once( '../include/render_function.inc.php' ) ;
37include_once( '../include/constants.inc.php' ) ;
38
39// for "Duplicatable"
40$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
41if( ! preg_match( '/^(\D+)(\d*)$/' , $mydirname , $regs ) ) echo ( "invalid dirname: " . htmlspecialchars( $mydirname ) ) ;
42$mydirnumber = $regs[2] === '' ? '' : intval( $regs[2] ) ;
43
44//
45// import from common.php
46//
47    if (file_exists('../xoops_version.php')) {
48        $module_handler =& xoops_gethandler('module');
49        $xoopsModule =& $module_handler->getByDirname($mydirname);
50        // unset($url_arr);
51        if (!$xoopsModule || !$xoopsModule->getVar('isactive')) {
52            include_once XOOPS_ROOT_PATH."/header.php";
53            echo "<h4>"._MODULENOEXIST."</h4>";
54            include_once XOOPS_ROOT_PATH."/footer.php";
55            exit();
56        }
57        $moduleperm_handler =& xoops_gethandler('groupperm');
58        if ($xoopsUser) {
59            if (!$moduleperm_handler->checkRight('module_read', $xoopsModule->getVar('mid'), $xoopsUser->getGroups())) {
60                redirect_header(XOOPS_URL."/user.php",1,_NOPERM);
61                exit();
62            }
63        } else {
64            if (!$moduleperm_handler->checkRight('module_read', $xoopsModule->getVar('mid'), XOOPS_GROUP_ANONYMOUS)) {
65                redirect_header(XOOPS_URL."/user.php",1,_NOPERM);
66                exit();
67            }
68        }
69        if ( file_exists(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar('dirname')."/language/".$xoopsConfig['language']."/main.php") ) {
70            include_once XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar('dirname')."/language/".$xoopsConfig['language']."/main.php";
71        } else {
72            if ( file_exists(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar('dirname')."/language/english/main.php") ) {
73                include_once XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar('dirname')."/language/english/main.php";
74            }
75        }
76        if ($xoopsModule->getVar('hasconfig') == 1 || $xoopsModule->getVar('hascomments') == 1 || $xoopsModule->getVar( 'hasnotification' ) == 1) {
77            $xoopsModuleConfig =& $config_handler->getConfigsByCat(0, $xoopsModule->getVar('mid'));
78        }
79    }
80//
81// end of import from common.php
82//
83
84
85// utility variables
86$mymodpath = XOOPS_ROOT_PATH."/modules/$mydirname" ;
87$mytablename = $xoopsDB->prefix( "tinycontent{$mydirnumber}" ) ;
88
89// get id of homepage
90$result = $xoopsDB->query( "SELECT storyid,link FROM $mytablename WHERE visible='1' ORDER BY homepage DESC, blockid" ) ;
91if( $xoopsDB->getRowsNum( $result ) < 1 ) {
92    redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ;
93    exit ;
94}
95list( $homepage_id , $homepage_link_type ) = $xoopsDB->fetchRow( $result ) ;
96
97// check if $_GET['id'] is specified
98$id = empty( $_GET['id'] ) ? 0 : intval( $_GET['id'] ) ;
99if( $id <= 0 )  {
100    redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ;
101    exit ;
102}
103
104// main query
105$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" ) ;
106if( ( $result_array = $xoopsDB->fetchArray( $result ) ) == false ) {
107    redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ;
108    exit ;
109}
110
111// disable comment feature of XOOPS
112// $result_array['nocomments'] = 1 ;
113
114
115// branch if op=print
116if( isset( $_GET['op'] ) && $_GET['op'] == 'print' ) {
117    include( '../include/print.inc.php' ) ;
118} else {
119    include( "../include/display.inc.php" ) ;
120}
121
122?>
Note: See TracBrowser for help on using the repository browser.