// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
//
" ;
var_dump( $_SERVER ) ;
exit ; */
include( '../../mainfile.php' ) ;
include_once( 'class/tinyd.textsanitizer.php' ) ;
include_once( 'include/render_function.inc.php' ) ;
include_once( 'include/constants.inc.php' ) ;
// for "Duplicatable"
$mydirname = basename( dirname( __FILE__ ) ) ;
if( ! preg_match( '/^(\D+)(\d*)$/' , $mydirname , $regs ) ) echo ( "invalid dirname: " . htmlspecialchars( $mydirname ) ) ;
$mydirnumber = $regs[2] === '' ? '' : intval( $regs[2] ) ;
// utility variables
$mymodpath = XOOPS_ROOT_PATH."/modules/$mydirname" ;
$mytablename = $xoopsDB->prefix( "tinycontent{$mydirnumber}" ) ;
// get id of homepage
$result = $xoopsDB->query( "SELECT storyid,link FROM $mytablename WHERE visible='1' ORDER BY homepage DESC, blockid" ) ;
if( $xoopsDB->getRowsNum( $result ) < 1 ) {
redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ;
exit ;
}
list( $homepage_id , $homepage_link_type ) = $xoopsDB->fetchRow( $result ) ;
// check if $_GET['id'] is specified
$id = empty( $_GET['id'] ) ? 0 : intval( $_GET['id'] ) ;
if( $id <= 0 ) {
$_REQUEST['id'] = $_GET['id'] = $id = $homepage_id ;
}
// main query
$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" ) ;
if( ( $result_array = $xoopsDB->fetchArray( $result ) ) == false ) {
redirect_header( XOOPS_URL , 2 , _TC_FILENOTFOUND ) ;
exit ;
}
// redirect if its base of wrapping is wrap_path (content)
if( ! $xoopsModuleConfig['tc_force_mod_rewrite'] && $result_array['link'] == TC_WRAPTYPE_CONTENTBASE ) {
if( headers_sent() ) {
redirect_header( XOOPS_URL . "/modules/$mydirname/content/index.php?id={$result_array['storyid']}" , 0 , ' ' ) ;
} else {
header( "Location: content/index.php?id={$result_array['storyid']}" ) ;
}
exit ;
}
include( "include/display.inc.php" ) ;
?>