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

Revision 405, 9.2 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( __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$modversion['name']         = _MI_TINYCONTENT_NAME . $mydirnumber ;
39$modversion['version']      = 2.25;
40$modversion['author']       = 'Tobias Liegl (AKA CHAPI)';
41$modversion['description']  = _MI_TINYCONTENT_DESC;
42$modversion['credits']      = "The XOOPS Project";
43$modversion['license']      = "GPL see LICENSE";
44$modversion['help']         = "";
45$modversion['official']     = 0;
46$modversion['image']        = "images/tinycontent{$mydirnumber}.png";
47$modversion['dirname']      = $mydirname;
48//$modversion['dirname']        = _MI_DIR_NAME;
49
50// All tables should not have any prefix!
51$modversion['sqlfile']['mysql'] = "sql/tinycontent{$mydirnumber}.sql";
52
53// Tables created by sql file (without prefix!)
54//$modversion['tables'][0]  = _MI_DIR_NAME;
55$modversion['tables'][0]    = "tinycontent{$mydirnumber}" ;
56
57// Admin things
58$modversion['hasAdmin']     = 1;
59$modversion['adminindex']   = "admin/index.php";
60$modversion['adminmenu']    = "admin/menu.php";
61
62// Search
63$modversion['hasSearch'] = 1;
64$modversion['search']['file'] = "include/search.inc.php";
65$modversion['search']['func'] = "tinycontent{$mydirnumber}_search";
66
67// Menu
68$modversion['hasMain'] = 1;
69
70// get my config
71$module_handler =& xoops_gethandler('module');
72$module =& $module_handler->getByDirname($mydirname);
73if( is_object( $module ) ) {
74    $config_handler =& xoops_gethandler('config');
75    $config =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
76    $myts =& MyTextSanitizer::getInstance();
77    $db =& Database::getInstance() ;
78
79    // Submenu Items
80    $result = $db->query("SELECT storyid,title,link FROM ".$db->prefix( "tinycontent{$mydirnumber}" )." WHERE submenu='1' AND visible ORDER BY blockid" ) ;
81    $i = 1 ;
82    while( list( $storyid , $title , $link ) = $db->fetchRow( $result ) )
83    {
84        $modversion['sub'][$i]['name'] = $myts->makeTboxData4Show( $title ) ;
85   
86        if( ! empty( $config['tc_force_mod_rewrite'] ) || $link == TC_WRAPTYPE_USEREWRITE ) {
87            if( empty( $config['tc_modulesless_dir'] ) ) {
88                $wraproot = TC_REWRITE_DIR ;
89                $modversion['sub'][$i]['url'] = TC_REWRITE_DIR . sprintf( TC_REWRITE_FILENAME_FMT , $storyid ) ;
90            } else {
91                $wraproot = '' ;
92                $modversion['sub'][$i]['url'] = '../../'.$config['tc_modulesless_dir'].'/'.sprintf( TC_REWRITE_FILENAME_FMT , $storyid ) ;
93            }
94        } else {
95            $wraproot = $link == TC_WRAPTYPE_CONTENTBASE ? "content/" : '' ;
96            $modversion['sub'][$i]['url'] = "{$wraproot}index.php?id=$storyid" ;
97        }
98        $i++ ;
99    }
100}
101
102// Templates
103$modversion['templates'][1]['file'] = "tinycontent{$mydirnumber}_index.html";
104$modversion['templates'][1]['description'] = "Layout for Monitor";
105$modversion['templates'][2]['file'] = "tinycontent{$mydirnumber}_print.html";
106$modversion['templates'][2]['description'] = "Layout for Printer";
107
108// Blocks
109$modversion['blocks'][1]['file'] = "tinycontent_navigation.php";
110$modversion['blocks'][1]['name'] = sprintf( _MI_TC_BNAME1 , $mydirnumber ) ;
111$modversion['blocks'][1]['description'] = _MI_TC_BDESC1 ;
112$modversion['blocks'][1]['show_func'] = "tinycontent{$mydirnumber}_block_nav";
113$modversion['blocks'][1]['template'] = "tinycontent{$mydirnumber}_nav_block.html";
114$modversion['blocks'][1]['can_clone'] = false ;
115$modversion['blocks'][1]['options'] = "{$mydirname}";
116
117
118$modversion['blocks'][2]['file'] = "tinycontent_content.php";
119$modversion['blocks'][2]['name'] = sprintf( _MI_TC_BNAME2 , $mydirnumber ) ;
120$modversion['blocks'][2]['description'] = _MI_TC_BDESC2 ;
121$modversion['blocks'][2]['show_func'] = "b_tinycontent_content_show";
122$modversion['blocks'][2]['edit_func'] = "b_tinycontent_content_edit";
123$modversion['blocks'][2]['template'] = "";
124$modversion['blocks'][2]['can_clone'] = true ;
125$modversion['blocks'][2]['options'] = "{$mydirname}|1";
126
127// Comments
128$modversion['hasComments'] = 1;
129$modversion['comments']['itemName'] = 'id';
130$modversion['comments']['pageName'] = 'index.php';
131
132// Configs
133$modversion['config'][1] = array(
134    'name' => 'tc_common_htmlheader',
135    'title' => '_MI_COMMON_HTMLHEADER',
136    'description' => '_MI_COMMON_HTMLHEADER_DESC',
137    'formtype' => 'textarea',
138    'valuetype' => 'text',
139    'default' => ''
140) ;
141
142$modversion['config'][] = array(
143    'name' => 'tc_tarea_width',
144    'title' => '_MI_TAREA_WIDTH',
145    'description' => '_MI_TAREA_WIDTH_DESC',
146    'formtype' => 'text',
147    'valuetype' => 'int',
148    'default' => 35
149) ;
150
151$modversion['config'][] = array(
152    'name' => 'tc_header_tarea_height',
153    'title' => '_MI_HEADER_TAREA_HEIGHT',
154    'description' => '_MI_HEADER_TAREA_HEIGHT_DESC',
155    'formtype' => 'text',
156    'valuetype' => 'int',
157    'default' => 3
158) ;
159
160$modversion['config'][] = array(
161    'name' => 'tc_tarea_height',
162    'title' => '_MI_TAREA_HEIGHT',
163    'description' => '_MI_TAREA_HEIGHT_DESC',
164    'formtype' => 'text',
165    'valuetype' => 'int',
166    'default' => 37
167) ;
168
169$modversion['config'][] = array(
170    'name' => 'tc_force_mod_rewrite',
171    'title' => '_MI_FORCE_MOD_REWRITE',
172    'description' => '_MI_FORCE_MOD_REWRITE_DESC',
173    'formtype' => 'yesno',
174    'valuetype' => 'int',
175    'default' => 0
176) ;
177
178$modversion['config'][] = array(
179    'name' => 'tc_modulesless_dir',
180    'title' => '_MI_MODULESLESS_DIR',
181    'description' => '_MI_MODULESLESS_DIR_DESC',
182    'formtype' => 'text',
183    'valuetype' => 'text',
184    'default' => ''
185) ;
186
187$modversion['config'][] = array(
188    'name' => 'tc_space2nbsp',
189    'title' => '_MI_SPACE2NBSP',
190    'description' => '',
191    'formtype' => 'yesno',
192    'valuetype' => 'int',
193    'default' => 0
194) ;
195
196$modversion['config'][] = array(
197    'name' => 'tc_display_print_icon',
198    'title' => '_MI_DISPLAY_PRINT_ICON',
199    'description' => '',
200    'formtype' => 'yesno',
201    'valuetype' => 'int',
202    'default' => 1
203) ;
204
205$modversion['config'][] = array(
206    'name' => 'tc_display_friend_icon',
207    'title' => '_MI_DISPLAY_FRIEND_ICON',
208    'description' => '' ,
209    'formtype' => 'yesno',
210    'valuetype' => 'int',
211    'default' => 1
212) ;
213
214$modversion['config'][] = array(
215    'name' => 'tc_use_taf_module',
216    'title' => '_MI_USE_TAF_MODULE',
217    'description' => '' ,
218    'formtype' => 'yesno',
219    'valuetype' => 'int',
220    'default' => 0
221) ;
222
223$modversion['config'][] = array(
224    'name' => 'tc_display_pagenav',
225    'title' => '_MI_DISPLAY_PAGENAV',
226    'description' => '' ,
227    'formtype' => 'select',
228    'valuetype' => 'int',
229    'default' => 0,
230    'options' => array(
231        '_MI_DISPLAY_PAGENAV_NONE' => 0 ,
232        '_MI_DISPLAY_PAGENAV_DISP' => 1 ,
233        '_MI_DISPLAY_PAGENAV_SUB' => 2 ,
234        '_MI_DISPLAY_PAGENAV_PERSUB' => 3 )
235) ;
236
237$modversion['config'][] = array(
238    'name' => 'tc_navblock_target',
239    'title' => '_MI_NAVBLOCK_TARGET',
240    'description' => '' ,
241    'formtype' => 'select',
242    'valuetype' => 'int',
243    'default' => 1,
244    'options' => array(
245        '_MI_NAVBLOCK_TARGET_DISP' => 1 ,
246        '_MI_NAVBLOCK_TARGET_SUB' => 2 )
247) ;
248
249
250// Notification
251$modversion['hasNotification'] = 0;
252
253// onUpdate
254if( ! empty( $_POST['fct'] ) && ! empty( $_POST['op'] ) && $_POST['fct'] == 'modulesadmin' && $_POST['op'] == 'update_ok' && $_POST['dirname'] == $modversion['dirname'] ) {
255    include dirname( __FILE__ ) . "/include/onupdate.inc.php" ;
256}
257
258?>
Note: See TracBrowser for help on using the repository browser.