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

Revision 405, 4.3 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
31if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
32$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
33if( ! preg_match( '/^(\D+)(\d*)$/' , $mydirname , $regs ) ) echo ( "invalid dirname: " . htmlspecialchars( $mydirname ) ) ;
34$mydirnumber = $regs[2] === '' ? '' : intval( $regs[2] ) ;
35
36include_once( XOOPS_ROOT_PATH . "/modules/$mydirname/include/constants.inc.php" ) ;
37
38
39
40eval( '
41
42function tinycontent'.$mydirnumber.'_block_nav()
43{
44    return tinyd_block_nav_base( "'.$mydirname.'" , "'.$mydirnumber.'" ) ;
45}
46
47' ) ;
48
49
50if( ! function_exists( 'tinyd_block_nav_base' ) ) {
51
52function tinyd_block_nav_base( $mydirname , $mydirnumber )
53{
54    // get my config
55    $module_handler =& xoops_gethandler('module');
56    $config_handler =& xoops_gethandler('config');
57    $module =& $module_handler->getByDirname($mydirname);
58    $config =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
59    $navblock_target = empty( $config['tc_navblock_target'] ) ? 1 : intval( $config['tc_navblock_target'] ) ;
60
61    if( empty( $config['tc_modulesless_dir'] ) ) {
62        $block["mod_url"] = XOOPS_URL . "/modules/$mydirname" ;
63        $tc_rewrite_dir = TC_REWRITE_DIR ;
64    } else {
65        $block["mod_url"] = XOOPS_URL . '/' . $config['tc_modulesless_dir'] ;
66        $tc_rewrite_dir = "" ;
67    }
68
69    $myts =& MyTextSanitizer::getInstance() ;
70    $db =& Database::getInstance() ;
71
72    $whr_submenu = $navblock_target == 2 ? "submenu=1" : "1" ;
73
74    $result = $db->query("SELECT storyid,title,link,UNIX_TIMESTAMP(last_modified) FROM ".$db->prefix("tinycontent{$mydirnumber}")." WHERE visible=1 AND $whr_submenu ORDER BY blockid" ) ;
75
76    while( list( $id , $title , $link , $last_modified ) = $db->fetchRow( $result ) ) {
77        if( ! empty( $config['tc_force_mod_rewrite'] ) || $link == TC_WRAPTYPE_USEREWRITE ) $href = $tc_rewrite_dir . sprintf( TC_REWRITE_FILENAME_FMT , $id ) ;
78        else if( $link == TC_WRAPTYPE_CONTENTBASE ) $href = "content/index.php?id=$id" ;
79        else $href = "index.php?id=$id" ;
80
81        $block["links"][] = array(
82            "href" => $href ,
83            "id" => $id ,
84            "title" => $myts->makeTboxData4Show( $title ) ,
85            "date" => formatTimestamp( $last_modified ) ,
86            "last_modified" => $last_modified
87        ) ;
88    }
89    return $block ;
90}
91
92}
93
94?>
Note: See TracBrowser for help on using the repository browser.