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

Revision 405, 9.7 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
34if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
35
36// XOOPS Header
37$xoopsOption['template_main'] = "tinycontent{$mydirnumber}_index.html" ;
38include( XOOPS_ROOT_PATH . '/header.php' ) ;
39
40// $myts
41$myts =& MyTextSanitizer::getInstance() ;
42
43extract( $result_array ) ;
44
45// getting "content"
46if( $link > 0 ) {
47
48    // external (=wrapped) content
49    $wrap_file = "$mymodpath/content/$address" ;
50    if( ! file_exists( $wrap_file ) ) {
51        redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ;
52        exit ;
53    }
54
55    ob_start() ;
56    include( $wrap_file ) ;
57    $content = tc_convert_wrap_to_ie( ob_get_contents() ) ;
58    if( $link == TC_WRAPTYPE_CHANGESRCHREF ) $content = tc_change_srchref( $content , XOOPS_URL . "/modules/$mydirname/content" ) ;
59    ob_end_clean() ;
60
61} else {
62
63    $content = tc_content_render( $text , $nohtml , $nosmiley , $nobreaks , $xoopsModuleConfig['tc_space2nbsp'] ) ;
64
65}
66
67// "tell to a friend" (It is too dificult to treat this for multibyte langs...)
68if( $xoopsModuleConfig['tc_use_taf_module'] ) {
69    $mail_link = XOOPS_URL.'/modules/tellafriend/index.php?target_uri='.rawurlencode( XOOPS_URL . "/modules/$mydirname/index.php?id=$id" ).'&amp;subject='.rawurlencode(sprintf(_TC_INTARTICLE,$xoopsConfig['sitename'])) ;
70} else {
71    if( _TC_DONE_MAILTOENCODE ) {
72        $mail_link = 'mailto:?subject=' . _TC_MB_INTARTICLE . '&amp;body=' . _TC_MB_INTARTFOUND . '%3A%20' . XOOPS_URL . "/modules/$mydirname/index.php?id=$id" ;
73    } else {
74        $mail_link = 'mailto:?subject='.rawurlencode(sprintf(_TC_INTARTICLE,$xoopsConfig['sitename'])).'&amp;body='.rawurlencode(sprintf(_TC_INTARTFOUND, $xoopsConfig['sitename'])).'%3A%20'.XOOPS_URL."/modules/$mydirname/index.php?id=$id" ;
75    }
76}
77
78// mod_url & vmod_url
79$mod_url = XOOPS_URL."/modules/$mydirname" ;
80// check modulesless rewrite
81if( ! empty( $xoopsModuleConfig['tc_modulesless_dir'] ) ) {
82    $vmod_url = XOOPS_URL.'/'.$xoopsModuleConfig['tc_modulesless_dir'];
83    $tc_rewrite_dir = '' ;
84} else {
85    $vmod_url = $mod_url ;
86    $tc_rewrite_dir = TC_REWRITE_DIR ;
87}
88
89
90// Page Navigation
91if( ! empty( $xoopsModuleConfig['tc_display_pagenav'] ) ) {
92
93    $whr_sub = $xoopsModuleConfig['tc_display_pagenav'] == 2 ? "(submenu=1 OR storyid='$id')" : "1" ;
94    $result = $xoopsDB->query("SELECT storyid,title,link,submenu FROM ".$xoopsDB->prefix( "tinycontent{$mydirnumber}" )." WHERE $whr_sub AND visible ORDER BY blockid" ) ;
95    while( $tmp_array = $xoopsDB->fetchArray( $result ) ) {
96        if( $tmp_array['storyid'] == $id ) {
97            $next_array = $xoopsDB->fetchArray( $result ) ;
98            break ;
99        }
100        $prev_array = $tmp_array ;
101    }
102}
103
104// submenu unit mode
105if( $xoopsModuleConfig['tc_display_pagenav'] == 3 ) {
106    if( ! empty( $next_array ) && $next_array['submenu'] ) {
107        unset( $next_array ) ;
108    }
109    if( ! empty( $tmp_array ) && $tmp_array['submenu'] ) {
110        unset( $prev_array ) ;
111    }
112}
113
114if( ! empty( $prev_array ) ) {
115    $prev_title = $myts->makeTboxData4Show( $prev_array['title'] ) ;
116    if( ! empty( $xoopsModuleConfig['tc_force_mod_rewrite'] ) || $prev_array['link'] == TC_WRAPTYPE_USEREWRITE ) {
117        $prev_link = $tc_rewrite_dir . sprintf( TC_REWRITE_FILENAME_FMT , $prev_array['storyid'] ) ;
118    } else {
119        $wraproot = $prev_array['link'] == TC_WRAPTYPE_CONTENTBASE ? "content/" : '' ;
120        $prev_link = "{$wraproot}index.php?id={$prev_array['storyid']}" ;
121    }
122} else {
123    $prev_title = $prev_link = '' ;
124}
125
126if( ! empty( $next_array ) ) {
127    $next_title = $myts->makeTboxData4Show( $next_array['title'] ) ;
128    if( ! empty( $xoopsModuleConfig['tc_force_mod_rewrite'] ) || $next_array['link'] == TC_WRAPTYPE_USEREWRITE ) {
129        $next_link = $tc_rewrite_dir . sprintf( TC_REWRITE_FILENAME_FMT , $next_array['storyid'] ) ;
130    } else {
131        $wraproot = $next_array['link'] == TC_WRAPTYPE_CONTENTBASE ? "content/" : '' ;
132        $next_link = "{$wraproot}index.php?id={$next_array['storyid']}" ;
133    }
134} else {
135    $next_title = $next_link = '' ;
136}
137
138if( ! empty( $homepage_id ) ) {
139    if( ! empty( $xoopsModuleConfig['tc_force_mod_rewrite'] ) || $homepage_link_type == TC_WRAPTYPE_USEREWRITE ) {
140        $top_link = $tc_rewrite_dir . sprintf( TC_REWRITE_FILENAME_FMT , $homepage_id ) ;
141    } else {
142        $wraproot = $homepage_link_type == TC_WRAPTYPE_CONTENTBASE ? "content/" : '' ;
143        $top_link = "{$wraproot}index.php?id=$homepage_id" ;
144    }
145} else {
146    $top_link = 'index.php' ;
147}
148
149
150// convert from {X_SITEURL} to XOOPS_URL
151$content = str_replace( '{X_SITEURL}' , XOOPS_URL , $content ) ;
152
153// assignment to Smarty
154$xoopsTpl->assign( 'mod_url' , $mod_url ) ;
155$xoopsTpl->assign( 'vmod_url' , $vmod_url ) ;
156$xoopsTpl->assign( 'title' , $myts->makeTboxData4Show( $title ) ) ;
157$xoopsTpl->assign( 'xoops_pagetitle' , $myts->makeTboxData4Show( $title ) ) ;
158$xoopsTpl->assign( 'xoops_default_comment_title' , sprintf( _TC_FMT_DEFAULT_COMMENT_TITLE , $myts->makeTboxData4Edit( $title ) ) ) ;
159$xoopsTpl->assign( 'xoops_module_header' , $xoopsModuleConfig['tc_common_htmlheader'] . "\n" . $html_header . "\n" . $xoopsTpl->get_template_vars( "xoops_module_header" ) ) ;
160$xoopsTpl->assign( 'content' , $content ) ;
161$xoopsTpl->assign( 'nocomments' , $nocomments ) ;
162$xoopsTpl->assign( 'mail_link', $mail_link ) ;
163$xoopsTpl->assign( 'lang_printerpage' , _TC_PRINTERFRIENDLY ) ;
164$xoopsTpl->assign( 'lang_sendstory' , _TC_SENDSTORY ) ;
165$xoopsTpl->assign( 'lang_nextpage' , _TC_NEXTPAGE ) ;
166$xoopsTpl->assign( 'lang_prevpage' , _TC_PREVPAGE ) ;
167$xoopsTpl->assign( 'lang_topofcontents' , _TC_TOPOFCONTENTS ) ;
168$xoopsTpl->assign( 'is_display_print_icon' , $xoopsModuleConfig['tc_display_print_icon'] ) ;
169$xoopsTpl->assign( 'is_display_friend_icon' , $xoopsModuleConfig['tc_display_friend_icon'] ) ;
170$xoopsTpl->assign( 'is_display_pagenav' , $xoopsModuleConfig['tc_display_pagenav'] ) ;
171$xoopsTpl->assign( 'prev_title' , $prev_title ) ;
172$xoopsTpl->assign( 'prev_link' , $prev_link ) ;
173$xoopsTpl->assign( 'next_title' , $next_title ) ;
174$xoopsTpl->assign( 'next_link' , $next_link ) ;
175$xoopsTpl->assign( 'top_link' , $top_link ) ;
176$xoopsTpl->assign( 'id' , $id ) ;
177$xoopsTpl->assign( 'homepage_id' , isset( $homepage_id ) ? $homepage_id : 0 ) ;
178$xoopsTpl->assign( 'last_modified' , $last_modified ) ;
179
180include( XOOPS_ROOT_PATH.'/include/comment_view.php' ) ;
181
182
183if( ! empty( $xoopsModuleConfig['tc_force_mod_rewrite'] ) || $link == TC_WRAPTYPE_USEREWRITE ) {
184    $mod_url_rewrite = $mod_url . '/' . substr( $tc_rewrite_dir , 0, -1 ) ;
185} else {
186    $mod_url_rewrite = $mod_url ;
187}
188
189$php_self_ab = $mod_url_rewrite . ($link == TC_WRAPTYPE_CONTENTBASE ? '/content' : '' ) . '/index.php' ;
190
191// relative link to absolut link of comment_links
192$commentsnav = $xoopsTpl->get_template_vars( "commentsnav" ) ;
193$commentsnav = str_replace( 'action="index.php"' , 'action="'.$php_self_ab.'"' , $commentsnav ) ;
194$commentsnav = str_replace( "href='comment_new.php" , "href='$mod_url_rewrite/comment_new.php" , $commentsnav ) ;
195$xoopsTpl->assign( 'commentsnav' , $commentsnav ) ;
196
197$editcomment_link = $xoopsTpl->get_template_vars( "editcomment_link" ) ;
198if( substr( $editcomment_link , 0 , 8 ) == 'comment_' ) {
199    $xoopsTpl->assign( 'editcomment_link' , "$mod_url_rewrite/$editcomment_link" ) ;
200}
201
202$deletecomment_link = $xoopsTpl->get_template_vars( "deletecomment_link" ) ;
203if( substr( $deletecomment_link , 0 , 8 ) == 'comment_' ) {
204    $xoopsTpl->assign( 'deletecomment_link' , "$mod_url_rewrite/$deletecomment_link" ) ;
205}
206
207$replycomment_link = $xoopsTpl->get_template_vars( "replycomment_link" ) ;
208if( substr( $replycomment_link , 0 , 8 ) == 'comment_' ) {
209    $xoopsTpl->assign( 'replycomment_link' , "$mod_url_rewrite/$replycomment_link" ) ;
210}
211
212include( XOOPS_ROOT_PATH.'/footer.php' ) ;
213
214?>
Note: See TracBrowser for help on using the repository browser.